smp: move thread_Yield to Assembly
This commit is contained in:
parent
a8ed090450
commit
9eeb9c8632
@ -85,11 +85,6 @@ int smp_thread_Nice(smp_thread_ID id, int newnice) {
|
|||||||
return oldnice;
|
return oldnice;
|
||||||
}
|
}
|
||||||
|
|
||||||
void smp_thread_Yield() {
|
|
||||||
__smp_PauseTicker = true;
|
|
||||||
asm volatile("int $0x28"); // TODO This is just quick and dirty to get into the scheduler
|
|
||||||
}
|
|
||||||
|
|
||||||
void smp_thread_Sleep(int ticks) {
|
void smp_thread_Sleep(int ticks) {
|
||||||
INTERRUPT_DISABLE;
|
INTERRUPT_DISABLE;
|
||||||
__smp_Current[0]->lastTick = __smp_Now + ticks;
|
__smp_Current[0]->lastTick = __smp_Now + ticks;
|
||||||
|
@ -6,6 +6,7 @@ extrn __smp_Now
|
|||||||
public __smp_IntSwitch_LastState
|
public __smp_IntSwitch_LastState
|
||||||
public __smp_IntSwitch
|
public __smp_IntSwitch
|
||||||
public __smp_Switch_Idle
|
public __smp_Switch_Idle
|
||||||
|
public smp_thread_Yield
|
||||||
|
|
||||||
|
|
||||||
section '.bss' writable
|
section '.bss' writable
|
||||||
@ -27,6 +28,18 @@ __smp_IntSwitch_LastState:
|
|||||||
|
|
||||||
section '.text' executable
|
section '.text' executable
|
||||||
|
|
||||||
|
; sysvx64abi smp_thread_Yield()
|
||||||
|
;
|
||||||
|
; Sets __smp_PauseTicker.
|
||||||
|
; Pushes SS, RSP, RFLAGS, CS, RIP into the stack as Qwords,
|
||||||
|
; like what the CPU does on execption,
|
||||||
|
; and jumps to __smp_IntSwitch.
|
||||||
|
smp_thread_Yield:
|
||||||
|
mov byte [__smp_PauseTicker], 1
|
||||||
|
int 0x28
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
; interrupt_handler smp_IntSwitch()
|
; interrupt_handler smp_IntSwitch()
|
||||||
;
|
;
|
||||||
; Called from a timer interrupt.
|
; Called from a timer interrupt.
|
||||||
|
Loading…
Reference in New Issue
Block a user