summaryrefslogtreecommitdiff
path: root/kernel/main.c
blob: e63ca14f3865a852600b680369180e02b1c562b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <kernel/gdt.h>
#include <kernel/tty.h>
#include <platform/sysenter.h>

extern void stack_top;

void r3_test();

void kmain()
{
	tty_clear();
	gdt_init();
	sysenter_setup();

	tty_write("user...", 7);
	sysexit(r3_test, &stack_top);
}

void r3_test() {
	tty_write("in ring3", 8);
	asm("cli"); // privileged instruction, should cause a GP
	tty_write(" oh no", 6); // shouldn't happen
	for (;;) {}
}