1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

Syscall first parameter (2)

This commit is contained in:
Adrien Bourmault 2021-02-26 18:23:46 +01:00
parent aa0207cf67
commit 4e5da302a0
Signed by: neox
GPG Key ID: 6EB408FE0ACEC664
3 changed files with 15 additions and 12 deletions

View File

@ -82,6 +82,7 @@
│   │   │   ├── proc.h
│   │   │   ├── sched.h
│   │   │   ├── spinlock.h
│   │   │   ├── syscall.h
│   │   │   └── time.h
│   │   ├── mm
│   │   │   ├── gdt.h
@ -129,7 +130,9 @@
│   │   │   ├── log.c
│   │   │   ├── panic.c
│   │   │   ├── pit.c
│   │   │   └── rtc.c
│   │   │   ├── rtc.c
│   │   │   ├── syscall.asm
│   │   │   └── syscall.c
│   │   ├── mm
│   │   │   ├── gdt.asm
│   │   │   ├── gdt.c
@ -179,4 +182,4 @@
├── ProjectTree
└── README.md
39 directories, 115 files
39 directories, 118 files

View File

@ -30,20 +30,20 @@ global KeJumpToUserspace
KeJumpToUserspace:
# rdi = user args
# rsi = entry point in user space
# rdx = user space stack
; rdi = user args
; rsi = entry point in user space
; rdx = user space stack
mov rax, 0x1b ; Selector 0x18 (User Data) + RPL 3
mov ds, ax
mov es, ax
# Build a fake iret frame
push rax # Selector 0x18 (User Data) + RPL 3
push rdx # User space stack
push 0x202 # rflags = interrupt enable + reserved bit
push 0x23 # Selector 0x20 (User Code) + RPL 3
push rsi # Entry point in user space
; Build a fake iret frame
push rax ; Selector 0x18 (User Data) + RPL 3
push rdx ; User space stack
push 0x202 ; rflags = interrupt enable + reserved bit
push 0x23 ; Selector 0x20 (User Code) + RPL 3
push rsi ; Entry point in user space
xor rax, rax