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

View File

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