CPU: Add an idle_loop method
This commit is contained in:
parent
287c4ab060
commit
fd6a74e61c
@ -13,6 +13,8 @@ namespace CPU
|
|||||||
|
|
||||||
[[noreturn]] void efficient_halt();
|
[[noreturn]] void efficient_halt();
|
||||||
|
|
||||||
|
void idle_loop();
|
||||||
|
|
||||||
void switch_kernel_stack(u64 top);
|
void switch_kernel_stack(u64 top);
|
||||||
|
|
||||||
void enable_interrupts();
|
void enable_interrupts();
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "arch/CPU.h"
|
#include "arch/CPU.h"
|
||||||
#include "arch/x86_64/CPU.h"
|
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "arch/Timer.h"
|
#include "arch/Timer.h"
|
||||||
|
#include "arch/x86_64/CPU.h"
|
||||||
#include "arch/x86_64/IO.h"
|
#include "arch/x86_64/IO.h"
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
|
#include <luna/Check.h>
|
||||||
|
#include <luna/Result.h>
|
||||||
#include <luna/String.h>
|
#include <luna/String.h>
|
||||||
#include <luna/SystemError.h>
|
#include <luna/SystemError.h>
|
||||||
#include <luna/Types.h>
|
#include <luna/Types.h>
|
||||||
#include <luna/Check.h>
|
|
||||||
#include <luna/Result.h>
|
|
||||||
|
|
||||||
extern "C" void enable_sse();
|
extern "C" void enable_sse();
|
||||||
extern "C" void enable_write_protect();
|
extern "C" void enable_write_protect();
|
||||||
@ -430,6 +430,14 @@ namespace CPU
|
|||||||
goto loop; // Safeguard: if we ever wake up, start our low-power rest again
|
goto loop; // Safeguard: if we ever wake up, start our low-power rest again
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void idle_loop()
|
||||||
|
{
|
||||||
|
asm volatile("sti");
|
||||||
|
loop:
|
||||||
|
asm volatile("hlt");
|
||||||
|
goto loop;
|
||||||
|
}
|
||||||
|
|
||||||
void switch_kernel_stack(u64 top)
|
void switch_kernel_stack(u64 top)
|
||||||
{
|
{
|
||||||
task_state_segment.rsp[0] = top;
|
task_state_segment.rsp[0] = top;
|
||||||
|
Loading…
Reference in New Issue
Block a user