2024-05-21 18:41:16 +03:00
|
|
|
#include "user_space.h"
|
2024-05-22 00:15:05 +03:00
|
|
|
#include "gdt.h"
|
2024-05-21 18:41:16 +03:00
|
|
|
|
|
|
|
void enter_user_space(void)
|
|
|
|
{
|
2024-05-22 00:15:05 +03:00
|
|
|
set_kernel_stack(0x110); // 128KB ?? WHY? ??
|
|
|
|
asm volatile("cli; \
|
2024-05-21 18:41:16 +03:00
|
|
|
mov $0x23, %ax; \
|
|
|
|
mov %ax, %ds; \
|
|
|
|
mov %ax, %es; \
|
|
|
|
mov %ax, %fs; \
|
|
|
|
mov %ax, %gs; \
|
|
|
|
mov %esp, %eax; \
|
|
|
|
pushl $0x23; \
|
|
|
|
pushl %eax; \
|
|
|
|
pushf; \
|
|
|
|
popl %eax; \
|
|
|
|
orl $0x200, %eax; \
|
|
|
|
pushl %eax; \
|
|
|
|
pushl $0x1B; \
|
|
|
|
push $1f; \
|
|
|
|
iret; \
|
|
|
|
1: \
|
|
|
|
");
|
|
|
|
}
|