reorg
This commit is contained in:
parent
3708519aae
commit
e473d63728
|
@ -31,15 +31,15 @@
|
|||
%include "boot/loader/cpu/cpu.inc"
|
||||
%include "boot/loader/mem/structures.inc"
|
||||
|
||||
global MB_start
|
||||
global MB_header
|
||||
global BtStartLoader
|
||||
global BtHeader
|
||||
extern BtStartKern
|
||||
|
||||
[BITS 32]
|
||||
[section .multiboot]
|
||||
|
||||
;; MAGNIFICENT MULTIBOOT HEADER FOR GRUB ------------------------------------ ;;
|
||||
MB_header:
|
||||
BtHeader:
|
||||
ALIGN 4
|
||||
dd MB_HEADER_MAGIC
|
||||
dd MB_HEADER_FLAGS
|
||||
|
@ -53,7 +53,7 @@ MB_header:
|
|||
[section .text]
|
||||
|
||||
;;MULTIBOOT POINT ENTRY FOR GRUB -------------------------------------------- ;;
|
||||
MB_start:
|
||||
BtStartLoader:
|
||||
mov esp, KERNEL_STACK ; Setup the stack
|
||||
push 0 ; Reset EFLAGS
|
||||
popf
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
//----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
ENTRY(MB_start) /* the name of the entry label */
|
||||
ENTRY(BtStartLoader) /* the name of the entry label */
|
||||
|
||||
SECTIONS {
|
||||
. = 0x00100000; /* the code should be loaded at 1 MB */
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
//
|
||||
void BtInitBootInfo(multiboot_info_t *mbi, void *codeSeg)
|
||||
{
|
||||
extern ulong MB_header;
|
||||
extern ulong BtHeader;
|
||||
extern ulong newKernelEnd;
|
||||
extern ulong newStackEnd;
|
||||
|
||||
|
@ -43,7 +43,7 @@ void BtInitBootInfo(multiboot_info_t *mbi, void *codeSeg)
|
|||
|
||||
if (BtLoaderInfo.grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) {
|
||||
BtLoaderInfo.grubName = (char*)(ulong)(mbi->boot_loader_name);
|
||||
BtLoaderInfo.kernelAddr = (void*)&MB_header;
|
||||
BtLoaderInfo.kernelAddr = (void*)&BtHeader;
|
||||
BtLoaderInfo.kernelEndAddr = (void*)newKernelEnd;
|
||||
BtLoaderInfo.stackEndAddr = (void*)newStackEnd;
|
||||
BtLoaderInfo.codeSegment = codeSeg;
|
||||
|
@ -108,16 +108,11 @@ void BtInitBootInfo(multiboot_info_t *mbi, void *codeSeg)
|
|||
}
|
||||
|
||||
void BtDoSanityChecks(uint mbMagic) {
|
||||
uint tmp;
|
||||
|
||||
if (!(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC))
|
||||
KeStartPanic("[Init] Magic number %x is incorrect\n", mbMagic);
|
||||
KeStartPanic("[Init]\tMagic number %x is incorrect\n", mbMagic);
|
||||
|
||||
tmp = (BtLoaderInfo.kernelEndAddr
|
||||
- BtLoaderInfo.kernelAddr) / KB;
|
||||
DebugLog("[Init] Kernel successfully loaded at %p with %x magic\n"
|
||||
" and it uses %dKB\n\n",
|
||||
BtLoaderInfo.kernelAddr,
|
||||
mbMagic, tmp);
|
||||
DebugLog("[Init]\tKernel successfully loaded at %p\n",
|
||||
BtLoaderInfo.kernelAddr);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,11 @@ void MmInitMemoryMap(void)
|
|||
{
|
||||
error_t rc;
|
||||
|
||||
if ((rc = InitMemoryMap()))
|
||||
KeStartPanic("[Init] The memory map failed to initialize. Error : %d",
|
||||
rc
|
||||
);
|
||||
rc = InitMemoryMap();
|
||||
|
||||
if (rc)
|
||||
KeStartPanic("[Mm]\tThe memory map failed to initialize.\nError : %s",
|
||||
strerror(rc) );
|
||||
}
|
||||
|
||||
static error_t InitMemoryMap(void)
|
||||
|
@ -84,9 +85,6 @@ static error_t InitMemoryMap(void)
|
|||
i++;
|
||||
}
|
||||
|
||||
DebugLog("[InitMemoryMap] %d entries detected in the memory map\n",
|
||||
memoryMap.length);
|
||||
|
||||
// compute the free ram size
|
||||
for (i = 0; i < memoryMap.length; i++) {
|
||||
if (memoryMap.entry[i].type == AVAILABLE_ZONE) {
|
||||
|
@ -100,10 +98,8 @@ static error_t InitMemoryMap(void)
|
|||
if (memoryMap.freeRamSize < MINIMUM_RAM_SIZE)
|
||||
return ENOMEM;
|
||||
|
||||
DebugLog("[InitMemoryMap] Available Ram Size : %u Mio, Used Ram Size : %u Kio\n\n",
|
||||
memoryMap.freeRamSize / MB, memoryMap.nonfreeRamSize / KB);
|
||||
/*DebugLog("[InitMemoryMap] Physical Ram Size : %d Mio\n\n",
|
||||
(memoryMap.freeRamSize + memoryMap.nonfreeRamSize) / MB);*/
|
||||
KernLog("[Mm]\tAvailable Ram Size : %u Mio\n",
|
||||
memoryMap.freeRamSize / MB);
|
||||
|
||||
// Magic value in memory to prevent smashing
|
||||
ulong * heapStart = BtLoaderInfo.stackEndAddr + 8;
|
||||
|
|
Loading…
Reference in New Issue