Compare commits
5 Commits
cbf061d18f
...
8c04788793
Author | SHA1 | Date | |
---|---|---|---|
8c04788793 | |||
c5476115df | |||
b93a208f22 | |||
98a55b2c13 | |||
3248041aef |
@ -13,7 +13,7 @@ namespace CPU
|
|||||||
|
|
||||||
[[noreturn]] void efficient_halt();
|
[[noreturn]] void efficient_halt();
|
||||||
|
|
||||||
void idle_loop();
|
[[noreturn]] void idle_loop();
|
||||||
|
|
||||||
void switch_kernel_stack(u64 top);
|
void switch_kernel_stack(u64 top);
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ 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()
|
[[noreturn]] void idle_loop()
|
||||||
{
|
{
|
||||||
asm volatile("sti");
|
asm volatile("sti");
|
||||||
loop:
|
loop:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
#include <luna/Types.h>
|
#include <luna/Types.h>
|
||||||
|
|
||||||
struct Registers // Saved CPU registers for x86-64
|
struct Registers // Saved CPU registers for x86-64
|
||||||
|
23
luna/include/luna/Stack.h
Normal file
23
luna/include/luna/Stack.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <luna/Types.h>
|
||||||
|
|
||||||
|
struct Stack
|
||||||
|
{
|
||||||
|
Stack(u64 base, usize bytes);
|
||||||
|
|
||||||
|
u64 bottom()
|
||||||
|
{
|
||||||
|
return m_base;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 top();
|
||||||
|
|
||||||
|
usize bytes()
|
||||||
|
{
|
||||||
|
return m_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
u64 m_base;
|
||||||
|
usize m_bytes;
|
||||||
|
};
|
@ -62,11 +62,14 @@ void Bitmap::clear_region(usize start, usize bits, bool value)
|
|||||||
expect(initialized(), "Bitmap was never initialized");
|
expect(initialized(), "Bitmap was never initialized");
|
||||||
expect((start + bits) <= size(), "Bitmap clear out of range");
|
expect((start + bits) <= size(), "Bitmap clear out of range");
|
||||||
|
|
||||||
|
if (!bits) return;
|
||||||
|
|
||||||
// Set individual bits while not on a byte boundary.
|
// Set individual bits while not on a byte boundary.
|
||||||
while ((start % 8) && bits--)
|
while ((start % 8) && bits)
|
||||||
{
|
{
|
||||||
set(start, value);
|
set(start, value);
|
||||||
start++;
|
start++;
|
||||||
|
bits--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear out the rest in bytes.
|
// Clear out the rest in bytes.
|
||||||
|
10
luna/src/Stack.cpp
Normal file
10
luna/src/Stack.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <luna/Stack.h>
|
||||||
|
|
||||||
|
Stack::Stack(u64 base, usize bytes) : m_base(base), m_bytes(bytes)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 Stack::top()
|
||||||
|
{
|
||||||
|
return (m_base + m_bytes) - sizeof(void*);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user