forked from Bananymous/banan-os
Kernel: optimize yielding
Doing a yield no longer raises a software interrupt. Instead it just saves all the callee saved registers, ip, sp and return value. Because yield is only called in the kernel, it can just restore registers and jump to the target address. There is never a need to use iret :)
This commit is contained in:
@@ -27,7 +27,6 @@ namespace Kernel
|
||||
uintptr_t r10;
|
||||
uintptr_t r9;
|
||||
uintptr_t r8;
|
||||
|
||||
uintptr_t rdi;
|
||||
uintptr_t rsi;
|
||||
uintptr_t rbp;
|
||||
@@ -36,6 +35,18 @@ namespace Kernel
|
||||
uintptr_t rcx;
|
||||
uintptr_t rax;
|
||||
};
|
||||
struct YieldRegisters
|
||||
{
|
||||
uintptr_t r15;
|
||||
uintptr_t r14;
|
||||
uintptr_t r13;
|
||||
uintptr_t r12;
|
||||
uintptr_t rbp;
|
||||
uintptr_t rbx;
|
||||
uintptr_t ret;
|
||||
uintptr_t sp;
|
||||
uintptr_t ip;
|
||||
};
|
||||
#elif ARCH(i686)
|
||||
struct InterruptRegisters
|
||||
{
|
||||
@@ -48,6 +59,16 @@ namespace Kernel
|
||||
uintptr_t ecx;
|
||||
uintptr_t eax;
|
||||
};
|
||||
struct YieldRegisters
|
||||
{
|
||||
uintptr_t ebp;
|
||||
uintptr_t edi;
|
||||
uintptr_t esi;
|
||||
uintptr_t ebx;
|
||||
uintptr_t ret;
|
||||
uintptr_t sp;
|
||||
uintptr_t ip;
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user