diff options
| author | Aleksa Vuckovic <aleksav013@gmail.com> | 2022-09-05 23:54:12 +0200 |
|---|---|---|
| committer | Aleksa Vuckovic <aleksav013@gmail.com> | 2022-09-07 17:46:10 +0200 |
| commit | 956bb743a3ba6939aaff2372fc45628cda6a9840 (patch) | |
| tree | 0d1fd304eb584c892e28e43bbc851cf66786d9da /kernel/src/sys | |
| parent | 59f86fe8dd237e50c7fea03b506125e3abff0157 (diff) | |
userspace finally working
Diffstat (limited to 'kernel/src/sys')
| -rw-r--r-- | kernel/src/sys/userspace_asm.S | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/kernel/src/sys/userspace_asm.S b/kernel/src/sys/userspace_asm.S index 5838051..c722df0 100644 --- a/kernel/src/sys/userspace_asm.S +++ b/kernel/src/sys/userspace_asm.S @@ -4,17 +4,23 @@ .global jump_userspace jump_userspace: - mov $0x23, %ax + mov $0x1b, %ax mov %ax, %ds mov %ax, %es mov %ax, %fs mov %ax, %gs - mov %esp, %eax - push $0x23 - push %rax - pushf - push $0x1b - sub $8, %rsp - movabs $begin_userspace, %rsp - iretq + mov $0xc0000082, %rcx + wrmsr + mov $0xc0000080, %rcx + rdmsr + or $1, %eax + wrmsr + mov $0xc0000081, %rcx + rdmsr + mov $0x00100008, %edx + wrmsr + + mov $begin_userspace, %ecx + mov $0x202, %r11 + sysretq |
