diff --git a/Makefile b/Makefile index 660e2f4..95de132 100644 --- a/Makefile +++ b/Makefile @@ -256,7 +256,7 @@ $(KOBJDIR)/kernel/mm/gdt.o: $(KALEIDDIR)/kernel/mm/gdt.c \ @rm -f $@.1 $@.2 @echo ${CL2}[$@] ${CL}Compiled.${CL3} - $(KOBJDIR)/kernel/ke/syscall.o: $(KALEIDDIR)/kernel/ke/syscall.c \ +$(KOBJDIR)/kernel/ke/syscall.o: $(KALEIDDIR)/kernel/ke/syscall.c \ $(KALEIDDIR)/kernel/ke/syscall.asm | $(KOBJDIR) @mkdir -p $(shell dirname $@) @$(ASM) $(ASMFLAGS) $(KALEIDDIR)/kernel/ke/syscall.asm -o $@.1 diff --git a/ProjectTree b/ProjectTree index 17a6460..cec7fd2 100644 --- a/ProjectTree +++ b/ProjectTree @@ -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 diff --git a/kaleid/kernel/ke/syscall.asm b/kaleid/kernel/ke/syscall.asm index b22ab79..e761905 100644 --- a/kaleid/kernel/ke/syscall.asm +++ b/kaleid/kernel/ke/syscall.asm @@ -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