-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a48bd7e
commit df788d0
Showing
24 changed files
with
538 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "multiboot.h" | ||
#include "ctypes.h" | ||
|
||
extern void kernel_main(multiboot_t *multiboot, uint32_t kernel_stack); | ||
extern void init_mmap(multiboot_t *multiboot); | ||
|
||
/* | ||
* 该mboot目录下的源文件与 multiboot 引导协议耦合度较高, 其主要功能对协议依赖性较大 | ||
* 故单独拆分出来, 方便移植 | ||
* kernel_head 由 boot.asm/_start 调用 | ||
*/ | ||
void kernel_head(multiboot_t *multiboot, uint32_t kernel_stack){ | ||
init_mmap(multiboot); | ||
kernel_main(multiboot,kernel_stack); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "multiboot.h" | ||
#include "ctypes.h" | ||
#include "klog.h" | ||
|
||
uint32_t phy_mem_size; | ||
|
||
void show_memory_map(multiboot_t *mboot) { | ||
uint32_t mmap_addr = mboot->mmap_addr; | ||
uint32_t mmap_length = mboot->mmap_length; | ||
|
||
mmap_entry_t *mmap = (mmap_entry_t *) mmap_addr; | ||
for (mmap = (mmap_entry_t *) mmap_addr; (uint32_t) mmap < mmap_addr + mmap_length; mmap++) { | ||
if(mmap->type == MULTIBOOT_MEMORY_ACPI_RECLAIMABLE) | ||
logkf("mmap: %08x ACPI\n",(uint32_t) mmap->base_addr_low); | ||
else if(mmap->type == MULTIBOOT_MEMORY_BADRAM) | ||
logkf("mmap: %08x BAD\n",(uint32_t) mmap->base_addr_low); | ||
else if(mmap->type == MULTIBOOT_MEMORY_INFO) | ||
logkf("mmap: %08x INFO\n",(uint32_t) mmap->base_addr_low); | ||
else if(mmap->type == MULTIBOOT_MEMORY_AVAILABLE) | ||
logkf("mmap: %08x AVAILABLE\n",(uint32_t) mmap->base_addr_low); | ||
else if(mmap->type == MULTIBOOT_MEMORY_NVS) | ||
logkf("mmap: %08x NVS\n",(uint32_t) mmap->base_addr_low); | ||
else if(mmap->type == MULTIBOOT_MEMORY_RESERVED) | ||
logkf("mmap: %08x RESERVED\n",(uint32_t) mmap->base_addr_low); | ||
else logkf("mmap: %08x UNKNOWN\n",(uint32_t) mmap->base_addr_low); | ||
} | ||
} | ||
|
||
void init_mmap(multiboot_t *multiboot){ | ||
phy_mem_size = (multiboot->mem_upper + multiboot->mem_lower) / 1024; | ||
show_memory_map(multiboot); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.