os/user_space.c

23 lines
725 B
C
Raw Normal View History

2024-05-21 18:41:16 +03:00
#include "user_space.h"
void enter_user_space(void)
{
asm volatile(" cli; \
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: \
");
}