diff cos/kernel/goto64.asm @ 35:bcb3b68c8147

Added bss end address and load end address to multiboot header
author windel
date Mon, 16 Jan 2012 17:38:00 +0100
parents 8012221dd740
children
line wrap: on
line diff
--- a/cos/kernel/goto64.asm	Mon Jan 16 13:46:06 2012 +0100
+++ b/cos/kernel/goto64.asm	Mon Jan 16 17:38:00 2012 +0100
@@ -36,11 +36,13 @@
 dd FLAGS
 dd CHECKSUM
 ; item below are present if bit 16 is set in flags
-dd MultiBootHeader ; physical address in file of header (will be 0x100000 if put at start)
-dd 0x100000        ; load_addr: load address, the address to start loading
-dd 0x0             ; load_end_addr: zero indicates to load whole file
-dd 0x0             ; bss_end_addr: zero indicates no bss segment present
-dd loader          ; entry_addr: jump to here
+extern load_end_address ; Import load end address from linker script
+extern bss_end_address  ; Import bss end address to make sure data is zero initialized.
+dd MultiBootHeader  ; physical address in file of header (will be 0x100000 if put at start)
+dd 0x100000         ; load_addr: load address, the address to start loading
+dd load_end_address ; load_end_addr: zero indicates to load whole file
+dd bss_end_address  ; bss_end_addr: zero indicates no bss segment present
+dd loader           ; entry_addr: jump to here
 
 ; 32 bits temporary GDT:
 align 16                                                                        
@@ -95,10 +97,10 @@
 ; Start of loader code:
 loader:
 ; here ebx contains the pointer to the multiboot header, store is for later use.
+; Make sure that multiboot_info is located in the BSS section and that this section
+; is proper zeroed.
 extern multiboot_info
 mov [multiboot_info], ebx
-xor ebx, ebx
-mov [multiboot_info + 4], ebx ; zero the rest of 64 bits address.
 
 ; Check that the CPU supports long mode:
 mov eax, 80000000h