Replace more usage of stdint.h types with Luna's Types.h
This commit is contained in:
parent
83bcac7a16
commit
847f2b4f4c
@ -199,8 +199,8 @@ static IDTEntry idt[256];
|
||||
|
||||
struct IDTR
|
||||
{
|
||||
uint16_t limit;
|
||||
uint64_t offset;
|
||||
u16 limit;
|
||||
u64 offset;
|
||||
} __attribute__((packed));
|
||||
|
||||
static void idt_add_handler(short num, void* handler, u8 type_attr)
|
||||
|
@ -8,9 +8,9 @@ const usize ARCH_TIMER_FREQ = 10;
|
||||
|
||||
void Timer::arch_init()
|
||||
{
|
||||
constexpr u16 divisor = (uint16_t)(base_frequency / (ARCH_TIMER_FREQ * 1000));
|
||||
constexpr u16 divisor = (u16)(base_frequency / (ARCH_TIMER_FREQ * 1000));
|
||||
static_assert(divisor >= 100);
|
||||
IO::outb(PIT_CHANNEL_0, (uint8_t)(divisor & 0xFF));
|
||||
IO::outb(PIT_CHANNEL_0, (u8)(divisor & 0xFF));
|
||||
IO::outb(0x80, 0); // short delay
|
||||
IO::outb(PIT_CHANNEL_0, (uint8_t)((divisor & 0xFF00) >> 8));
|
||||
IO::outb(PIT_CHANNEL_0, (u8)((divisor & 0xFF00) >> 8));
|
||||
}
|
@ -33,10 +33,10 @@ static bool page_bitmap_read(u64 index)
|
||||
|
||||
static void page_bitmap_set(u64 index, bool value)
|
||||
{
|
||||
uint64_t byteIndex = index / 8;
|
||||
uint8_t bitIndexer = 0b10000000 >> (index % 8);
|
||||
page_virtual_bitmap_addr[byteIndex] &= (uint8_t)(~bitIndexer);
|
||||
if (value) { page_virtual_bitmap_addr[byteIndex] |= bitIndexer; }
|
||||
u64 byte_index = index / 8;
|
||||
u8 mask = 0b10000000 >> (index % 8);
|
||||
page_virtual_bitmap_addr[byte_index] &= (u8)(~mask);
|
||||
if (value) { page_virtual_bitmap_addr[byte_index] |= mask; }
|
||||
}
|
||||
|
||||
namespace MemoryManager
|
||||
@ -61,7 +61,7 @@ namespace MemoryManager
|
||||
|
||||
// walk the memory map
|
||||
MMapEnt* ptr = &bootboot.mmap;
|
||||
uint64_t mmap_entries = (bootboot.size - 128) / 16;
|
||||
u64 mmap_entries = (bootboot.size - 128) / 16;
|
||||
for (u64 i = 0; i < mmap_entries; i++)
|
||||
{
|
||||
u64 size = MMapEnt_Size(ptr);
|
||||
@ -92,17 +92,14 @@ namespace MemoryManager
|
||||
memset(page_bitmap_addr, 0xFF, page_bitmap_size);
|
||||
|
||||
ptr = &bootboot.mmap;
|
||||
for (uint64_t i = 0; i < mmap_entries; i++)
|
||||
for (u64 i = 0; i < mmap_entries; i++)
|
||||
{
|
||||
uint64_t index = MMapEnt_Ptr(ptr) / ARCH_PAGE_SIZE;
|
||||
u64 index = MMapEnt_Ptr(ptr) / ARCH_PAGE_SIZE;
|
||||
if (!MMapEnt_IsFree(ptr)) { reserved_mem += MMapEnt_Size(ptr); }
|
||||
else
|
||||
{
|
||||
free_mem += MMapEnt_Size(ptr);
|
||||
for (uint64_t j = 0; j < (MMapEnt_Size(ptr) / ARCH_PAGE_SIZE); j++)
|
||||
{
|
||||
page_bitmap_set(index + j, false);
|
||||
}
|
||||
for (u64 j = 0; j < (MMapEnt_Size(ptr) / ARCH_PAGE_SIZE); j++) { page_bitmap_set(index + j, false); }
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user