mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 07:24:37 +00:00
Hope now scheduler won't crash at IPC Service
This commit is contained in:
parent
f907ca907d
commit
1afe255fed
@ -1,19 +1,6 @@
|
|||||||
[BITS 64]
|
[BITS 64]
|
||||||
ALIGN 4096
|
|
||||||
extern SystemCallsHandler
|
|
||||||
global SystemCallHandlerStub
|
|
||||||
SystemCallHandlerStub:
|
|
||||||
swapgs
|
|
||||||
mov [gs:0x8], rsp ; CPUData->TempStack
|
|
||||||
mov rsp, [gs:0x0] ; CPUData->SystemCallStack
|
|
||||||
|
|
||||||
push qword 0x1b ; user data segment
|
%macro PushAllSC 0
|
||||||
push qword [gs:0x8] ; saved stack
|
|
||||||
push r11 ; saved rflags
|
|
||||||
push qword 0x23 ; user code segment
|
|
||||||
push rcx ; Current RIP
|
|
||||||
|
|
||||||
cld
|
|
||||||
push rax
|
push rax
|
||||||
push rbx
|
push rbx
|
||||||
push rcx
|
push rcx
|
||||||
@ -29,11 +16,9 @@ SystemCallHandlerStub:
|
|||||||
push r13
|
push r13
|
||||||
push r14
|
push r14
|
||||||
push r15
|
push r15
|
||||||
|
%endmacro
|
||||||
|
|
||||||
mov rdi, rsp
|
%macro PopAllSC 0
|
||||||
mov rbp, 0
|
|
||||||
call SystemCallsHandler
|
|
||||||
|
|
||||||
pop r15
|
pop r15
|
||||||
pop r14
|
pop r14
|
||||||
pop r13
|
pop r13
|
||||||
@ -48,8 +33,27 @@ SystemCallHandlerStub:
|
|||||||
pop rdx
|
pop rdx
|
||||||
pop rcx
|
pop rcx
|
||||||
pop rbx
|
pop rbx
|
||||||
|
%endmacro
|
||||||
|
|
||||||
mov rsp, [gs:0x8]
|
ALIGN 4096
|
||||||
swapgs
|
extern SystemCallsHandler
|
||||||
sti
|
global SystemCallHandlerStub
|
||||||
o64 sysret
|
SystemCallHandlerStub:
|
||||||
|
swapgs ; Swap gs and kernelgs
|
||||||
|
mov [gs:0x8], rsp ; CPUData->TempStack
|
||||||
|
mov rsp, [gs:0x0] ; CPUData->SystemCallStack
|
||||||
|
push qword 0x1b ; User data segment
|
||||||
|
push qword [gs:0x8] ; Saved stack
|
||||||
|
push r11 ; Saved rflags
|
||||||
|
push qword 0x23 ; User code segment
|
||||||
|
push rcx ; Current instruction pointer
|
||||||
|
cld ; Clear direction flag
|
||||||
|
PushAllSC ; Push all registers
|
||||||
|
mov rdi, rsp ; Pass pointer to registers
|
||||||
|
mov rbp, 0 ; Pass 0 as return address
|
||||||
|
call SystemCallsHandler ; Call system call handler
|
||||||
|
PopAllSC ; Pop all registers except rax
|
||||||
|
mov rsp, [gs:0x8] ; Restore stack
|
||||||
|
swapgs ; Swap back gs and kernelgs
|
||||||
|
sti ; Enable interrupts
|
||||||
|
o64 sysret ; Return to user mode
|
||||||
|
@ -131,7 +131,10 @@ namespace InterProcessCommunication
|
|||||||
trace("IPC Service Started.");
|
trace("IPC Service Started.");
|
||||||
TaskManager->GetCurrentThread()->SetPriority(1);
|
TaskManager->GetCurrentThread()->SetPriority(1);
|
||||||
// TODO: do something useful here, like, IPC event viewer or smth...
|
// TODO: do something useful here, like, IPC event viewer or smth...
|
||||||
CPU::Pause(true);
|
while (1)
|
||||||
|
{
|
||||||
|
// The scheduler doesn't like CPU::Pause for some reason. :/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::IPC()
|
IPC::IPC()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user