core: change types from uint32_t to u32 (e.g)
This commit is contained in:
@ -4,10 +4,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t *page_directory = &boot_page_directory;
|
||||
uint32_t page_table_default[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
uint32_t frame_zones_page_table[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
uint32_t mem_size;
|
||||
u32 *page_directory = &boot_page_directory;
|
||||
u32 page_table_default[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
u32 frame_zones_page_table[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
u32 mem_size;
|
||||
struct frame_zone *head;
|
||||
|
||||
static void lst_add_back(struct frame_zone **root, struct frame_zone *element)
|
||||
@ -24,16 +24,16 @@ static void lst_add_back(struct frame_zone **root, struct frame_zone *element)
|
||||
|
||||
static void add_frame_node(multiboot_memory_map_t *mmmt)
|
||||
{
|
||||
static uint32_t index;
|
||||
static u32 index;
|
||||
|
||||
/**
|
||||
* # = kernel code
|
||||
* - = blank
|
||||
*/
|
||||
|
||||
uint64_t start_addr = mmmt->addr;
|
||||
uint64_t end_addr = mmmt->addr + mmmt->len;
|
||||
uint64_t len = mmmt->len;
|
||||
u64 start_addr = mmmt->addr;
|
||||
u64 end_addr = mmmt->addr + mmmt->len;
|
||||
u64 len = mmmt->len;
|
||||
|
||||
/** Kernel code cover all the block
|
||||
* this situation:
|
||||
@ -62,21 +62,21 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
|
||||
|
||||
init_page_table(frame_zones_page_table, 0);
|
||||
page_directory[1022] =
|
||||
((uint32_t)frame_zones_page_table - HEAP_END) | 0x03;
|
||||
((u32)frame_zones_page_table - HEAP_END) | 0x03;
|
||||
frame_zones_page_table[index] =
|
||||
((uint32_t)start_addr & PAGE_MASK) | INIT_FLAGS;
|
||||
((u32)start_addr & PAGE_MASK) | INIT_FLAGS;
|
||||
|
||||
struct frame_zone *current =
|
||||
(struct frame_zone *)GET_PAGE_ADDR(1022, index++);
|
||||
|
||||
current->frame_table = (uint8_t *)current + sizeof(struct frame_zone);
|
||||
current->frame_table = (u8 *)current + sizeof(struct frame_zone);
|
||||
|
||||
/** 8 is cause we are using uint8_t
|
||||
/** 8 is cause we are using u8
|
||||
nb_frame = size / (PAGE_SIZE + 1 / 8)
|
||||
cause we are using non decimal number
|
||||
nb_frame = ((size * 8) / (PAGE_SIZE * 8 + 1))
|
||||
*/
|
||||
const uint32_t nb_frame = ((len * 8) / (PAGE_SIZE * 8 + 1));
|
||||
const u32 nb_frame = ((len * 8) / (PAGE_SIZE * 8 + 1));
|
||||
current->first_free_frame = 0;
|
||||
current->next = NULL;
|
||||
current->remaining_frames = nb_frame;
|
||||
@ -85,10 +85,10 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
|
||||
memset(current->frame_table, 0,
|
||||
nb_frame * sizeof(*current->frame_table));
|
||||
|
||||
uint32_t i = 1;
|
||||
u32 i = 1;
|
||||
for (; i < CEIL(nb_frame, PAGE_SIZE); i++)
|
||||
frame_zones_page_table[index + i] =
|
||||
((uint32_t)(start_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
||||
((u32)(start_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
||||
INIT_FLAGS;
|
||||
current->addr = (void *)start_addr + i * PAGE_SIZE;
|
||||
index += i - 1;
|
||||
@ -97,7 +97,7 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
|
||||
|
||||
static void init_frame_zones(void)
|
||||
{
|
||||
for (uint32_t i = 0; i < mmap_length; i++) {
|
||||
for (u32 i = 0; i < mmap_length; i++) {
|
||||
multiboot_memory_map_t *mmmt =
|
||||
(multiboot_memory_map_t *)mmap_addr + i;
|
||||
if (mmmt->type == MULTIBOOT_MEMORY_AVAILABLE)
|
||||
@ -105,12 +105,12 @@ static void init_frame_zones(void)
|
||||
}
|
||||
}
|
||||
|
||||
void init_memory(multiboot_info_t *mbd, uint32_t magic)
|
||||
void init_memory(multiboot_info_t *mbd, u32 magic)
|
||||
{
|
||||
for (uint16_t i = 0; i < 0x300; i++)
|
||||
for (u16 i = 0; i < 0x300; i++)
|
||||
page_directory[i] = 0x02;
|
||||
init_page_table(page_table_default, 0);
|
||||
page_directory[0] = ((uint32_t)page_table_default - HEAP_END) | 0x03;
|
||||
page_directory[0] = ((u32)page_table_default - HEAP_END) | 0x03;
|
||||
init_multiboot(mbd, magic);
|
||||
init_frame_zones();
|
||||
}
|
||||
|
Reference in New Issue
Block a user