Mercurial > lcfOS
comparison 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 |
comparison
equal
deleted
inserted
replaced
34:8012221dd740 | 35:bcb3b68c8147 |
---|---|
34 MultiBootHeader: | 34 MultiBootHeader: |
35 dd MAGIC | 35 dd MAGIC |
36 dd FLAGS | 36 dd FLAGS |
37 dd CHECKSUM | 37 dd CHECKSUM |
38 ; item below are present if bit 16 is set in flags | 38 ; item below are present if bit 16 is set in flags |
39 dd MultiBootHeader ; physical address in file of header (will be 0x100000 if put at start) | 39 extern load_end_address ; Import load end address from linker script |
40 dd 0x100000 ; load_addr: load address, the address to start loading | 40 extern bss_end_address ; Import bss end address to make sure data is zero initialized. |
41 dd 0x0 ; load_end_addr: zero indicates to load whole file | 41 dd MultiBootHeader ; physical address in file of header (will be 0x100000 if put at start) |
42 dd 0x0 ; bss_end_addr: zero indicates no bss segment present | 42 dd 0x100000 ; load_addr: load address, the address to start loading |
43 dd loader ; entry_addr: jump to here | 43 dd load_end_address ; load_end_addr: zero indicates to load whole file |
44 dd bss_end_address ; bss_end_addr: zero indicates no bss segment present | |
45 dd loader ; entry_addr: jump to here | |
44 | 46 |
45 ; 32 bits temporary GDT: | 47 ; 32 bits temporary GDT: |
46 align 16 | 48 align 16 |
47 gdt32: | 49 gdt32: |
48 dw 0x0000, 0x0000, 0x0000, 0x0000 ; Null desciptor | 50 dw 0x0000, 0x0000, 0x0000, 0x0000 ; Null desciptor |
93 db "Long mode not supported", 0x0 | 95 db "Long mode not supported", 0x0 |
94 | 96 |
95 ; Start of loader code: | 97 ; Start of loader code: |
96 loader: | 98 loader: |
97 ; here ebx contains the pointer to the multiboot header, store is for later use. | 99 ; here ebx contains the pointer to the multiboot header, store is for later use. |
100 ; Make sure that multiboot_info is located in the BSS section and that this section | |
101 ; is proper zeroed. | |
98 extern multiboot_info | 102 extern multiboot_info |
99 mov [multiboot_info], ebx | 103 mov [multiboot_info], ebx |
100 xor ebx, ebx | |
101 mov [multiboot_info + 4], ebx ; zero the rest of 64 bits address. | |
102 | 104 |
103 ; Check that the CPU supports long mode: | 105 ; Check that the CPU supports long mode: |
104 mov eax, 80000000h | 106 mov eax, 80000000h |
105 cpuid | 107 cpuid |
106 cmp eax, 80000000h | 108 cmp eax, 80000000h |