stuff !
This commit is contained in:
parent
53be658a4a
commit
5fc538c9d2
|
@ -44,6 +44,11 @@ MB_header:
|
||||||
dd MB_HEADER_MAGIC
|
dd MB_HEADER_MAGIC
|
||||||
dd MB_HEADER_FLAGS
|
dd MB_HEADER_FLAGS
|
||||||
dd CHECKSUM
|
dd CHECKSUM
|
||||||
|
times 5 dd 0x0
|
||||||
|
dd MB_VIDEO_MODE
|
||||||
|
dd MB_VIDEO_WIDTH
|
||||||
|
dd MB_VIDEO_HEIGHT
|
||||||
|
dd MB_VIDEO_DEPTH
|
||||||
|
|
||||||
[section .text]
|
[section .text]
|
||||||
|
|
||||||
|
@ -71,7 +76,7 @@ Error:
|
||||||
call write32
|
call write32
|
||||||
pop esi
|
pop esi
|
||||||
jmp Die
|
jmp Die
|
||||||
.ergo : db 219, 219, 219, " Error "
|
.ergo : db 219, 219, 219, " OS/K Loader Error "
|
||||||
.code : db "00"
|
.code : db "00"
|
||||||
db 0x0
|
db 0x0
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
|
@ -104,6 +109,12 @@ mbMagic dq 0
|
||||||
lbegin:
|
lbegin:
|
||||||
call clear ; Clear the screen
|
call clear ; Clear the screen
|
||||||
|
|
||||||
|
push esi ; Print the logo
|
||||||
|
mov bl, 0x0E
|
||||||
|
mov esi, LOGO
|
||||||
|
call write32
|
||||||
|
pop esi
|
||||||
|
|
||||||
;; BEGIN OF CHECKLIST
|
;; BEGIN OF CHECKLIST
|
||||||
call MB_check ; Check Multiboot State, ERR 01
|
call MB_check ; Check Multiboot State, ERR 01
|
||||||
|
|
||||||
|
@ -115,12 +126,6 @@ lbegin:
|
||||||
call Setup_paging ; Enable paging
|
call Setup_paging ; Enable paging
|
||||||
call Go64 ; Prepare switch into long mode
|
call Go64 ; Prepare switch into long mode
|
||||||
|
|
||||||
push esi ; Print the logo
|
|
||||||
mov bl, 0x0E
|
|
||||||
mov esi, LOGO
|
|
||||||
call write32
|
|
||||||
pop esi
|
|
||||||
|
|
||||||
;call disable_cursor
|
;call disable_cursor
|
||||||
|
|
||||||
lgdt [GDT64.pointer]
|
lgdt [GDT64.pointer]
|
||||||
|
|
|
@ -27,8 +27,13 @@
|
||||||
MB_AOUT_KLUDGE equ 0 << 16 ; if we are not an ELF executable
|
MB_AOUT_KLUDGE equ 0 << 16 ; if we are not an ELF executable
|
||||||
MB_ALIGN equ 1 << 0 ; Ask to align loaded modules on page boundaries
|
MB_ALIGN equ 1 << 0 ; Ask to align loaded modules on page boundaries
|
||||||
MB_MEMINFO equ 1 << 1 ; Ask to provide memory map
|
MB_MEMINFO equ 1 << 1 ; Ask to provide memory map
|
||||||
|
MB_VIDEOINFO equ 1 << 2 ; Ask to provide video infos
|
||||||
|
MB_VIDEO_MODE equ 0x1 ; Text mode
|
||||||
|
MB_VIDEO_WIDTH equ 80
|
||||||
|
MB_VIDEO_HEIGHT equ 24
|
||||||
|
MB_VIDEO_DEPTH equ 0x0
|
||||||
MB_HEADER_MAGIC equ 0x1badb002
|
MB_HEADER_MAGIC equ 0x1badb002
|
||||||
MB_GRUB_MAGIC equ 0x2badb002
|
MB_GRUB_MAGIC equ 0x2badb002
|
||||||
MB_HEADER_FLAGS equ MB_AOUT_KLUDGE|MB_ALIGN|MB_MEMINFO
|
MB_HEADER_FLAGS equ MB_AOUT_KLUDGE|MB_ALIGN|MB_MEMINFO|MB_VIDEOINFO
|
||||||
CHECKSUM equ -(MB_HEADER_MAGIC + MB_HEADER_FLAGS)
|
CHECKSUM equ -(MB_HEADER_MAGIC + MB_HEADER_FLAGS)
|
||||||
KERNEL_STACK equ 0x00200000 ; Stack starts at the 2mb address & grows down
|
KERNEL_STACK equ 0x00200000 ; Stack starts at the 2mb address & grows down
|
||||||
|
|
|
@ -40,34 +40,33 @@ void InitBootInfo(multiboot_info_t *mbi)
|
||||||
//Retrieves the bootloader flags to ensure infos are valid
|
//Retrieves the bootloader flags to ensure infos are valid
|
||||||
GetBootInfo(btldr).grubFlags = mbi->flags;
|
GetBootInfo(btldr).grubFlags = mbi->flags;
|
||||||
|
|
||||||
if (
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) {
|
||||||
(GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) == MULTIBOOT_INFO_BOOT_LOADER_NAME &&
|
|
||||||
(GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MODS) == MULTIBOOT_INFO_MODS
|
|
||||||
) {
|
|
||||||
GetBootInfo(btldr).grubName = (char*)(ullong)(mbi->boot_loader_name);
|
GetBootInfo(btldr).grubName = (char*)(ullong)(mbi->boot_loader_name);
|
||||||
GetBootInfo(btldr).modulesCount = mbi->mods_count;
|
|
||||||
GetBootInfo(btldr).modulesAddr = (void*)(ullong)mbi->mods_addr;
|
|
||||||
GetBootInfo(btldr).mbHeaderAddr = (void*)(ullong)&MB_header;
|
GetBootInfo(btldr).mbHeaderAddr = (void*)(ullong)&MB_header;
|
||||||
GetBootInfo(btldr).valid = 1;
|
GetBootInfo(btldr).valid = 1;
|
||||||
}
|
}
|
||||||
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MODS) {
|
||||||
|
GetBootInfo(btldr).modulesCount = mbi->mods_count;
|
||||||
|
GetBootInfo(btldr).modulesAddr = (void*)(ullong)mbi->mods_addr;
|
||||||
|
}
|
||||||
//Retrieves the drives informations
|
//Retrieves the drives informations
|
||||||
if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_DRIVE_INFO) == MULTIBOOT_INFO_DRIVE_INFO) {
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_DRIVE_INFO) {
|
||||||
GetBootInfo(drives).bufferLength = mbi->drives_length;
|
GetBootInfo(drives).bufferLength = mbi->drives_length;
|
||||||
GetBootInfo(drives).bufferAddr = (void*)(ullong)mbi->drives_addr;
|
GetBootInfo(drives).bufferAddr = (void*)(ullong)mbi->drives_addr;
|
||||||
GetBootInfo(drives).bufferValid = 1;
|
GetBootInfo(drives).bufferValid = 1;
|
||||||
}
|
}
|
||||||
if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOTDEV) == MULTIBOOT_INFO_BOOTDEV) {
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOTDEV) {
|
||||||
GetBootInfo(drives).bootDrv = mbi->boot_device;
|
GetBootInfo(drives).bootDrv = mbi->boot_device;
|
||||||
GetBootInfo(drives).drvValid = 1;
|
GetBootInfo(drives).drvValid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Retrieves the memory informations
|
//Retrieves the memory informations
|
||||||
if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEMORY) == MULTIBOOT_INFO_MEMORY) {
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEMORY) {
|
||||||
GetBootInfo(memory).lowMemory = mbi->mem_lower;
|
GetBootInfo(memory).lowMemory = mbi->mem_lower;
|
||||||
GetBootInfo(memory).upMemory = mbi->mem_upper;
|
GetBootInfo(memory).upMemory = mbi->mem_upper;
|
||||||
GetBootInfo(memory).memValid = 1;
|
GetBootInfo(memory).memValid = 1;
|
||||||
}
|
}
|
||||||
if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP) == MULTIBOOT_INFO_MEM_MAP) {
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP) {
|
||||||
GetBootInfo(memory).mapAddr = (void*)(ullong)mbi->mmap_addr;
|
GetBootInfo(memory).mapAddr = (void*)(ullong)mbi->mmap_addr;
|
||||||
GetBootInfo(memory).mapLength = mbi->mmap_length;
|
GetBootInfo(memory).mapLength = mbi->mmap_length;
|
||||||
GetBootInfo(memory).mapValid = 1;
|
GetBootInfo(memory).mapValid = 1;
|
||||||
|
@ -76,30 +75,30 @@ void InitBootInfo(multiboot_info_t *mbi)
|
||||||
// XXX assign video infos, but unused at this time
|
// XXX assign video infos, but unused at this time
|
||||||
|
|
||||||
// Retrieves the firmware infos
|
// Retrieves the firmware infos
|
||||||
if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_CONFIG_TABLE) == MULTIBOOT_INFO_CONFIG_TABLE) {
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_CONFIG_TABLE) {
|
||||||
GetBootInfo(firmware).romTable = mbi->config_table;
|
GetBootInfo(firmware).romTable = mbi->config_table;
|
||||||
GetBootInfo(firmware).romValid = 1;
|
GetBootInfo(firmware).romValid = 1;
|
||||||
}
|
}
|
||||||
if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_APM_TABLE ) == MULTIBOOT_INFO_APM_TABLE ) {
|
if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_APM_TABLE) {
|
||||||
GetBootInfo(firmware).apmTable = mbi->apm_table;
|
GetBootInfo(firmware).apmTable = mbi->apm_table;
|
||||||
GetBootInfo(firmware).apmValid = 1;
|
GetBootInfo(firmware).apmValid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now we check (debug)
|
//Now we check (debug)
|
||||||
DebugLog("\n[InitBootInfo] Boot loader %s",
|
DebugLog("\n[InitBootInfo] Boot loader %s",
|
||||||
GetBootInfo(btldr).valid ? "OK" : "");
|
GetBootInfo(btldr).valid ? "present" : "");
|
||||||
DebugLog("\n[InitBootInfo] Boot drive %s",
|
DebugLog("\n[InitBootInfo] Boot drive %s",
|
||||||
GetBootInfo(drives).drvValid ? "OK" : "");
|
GetBootInfo(drives).drvValid ? "present" : "");
|
||||||
DebugLog("\n[InitBootInfo] Disk buffer %s",
|
DebugLog("\n[InitBootInfo] Disk buffer %s",
|
||||||
GetBootInfo(drives).bufferValid ? "OK" : "");
|
GetBootInfo(drives).bufferValid ? "present" : "");
|
||||||
DebugLog("\n[InitBootInfo] Basic mem %s",
|
DebugLog("\n[InitBootInfo] Basic mem %s",
|
||||||
GetBootInfo(memory).memValid ? "OK" : "");
|
GetBootInfo(memory).memValid ? "present" : "");
|
||||||
DebugLog("\n[InitBootInfo] Memory map %s",
|
DebugLog("\n[InitBootInfo] Memory map %s",
|
||||||
GetBootInfo(memory).mapValid ? "OK" : "");
|
GetBootInfo(memory).mapValid ? "present" : "");
|
||||||
DebugLog("\n[InitBootInfo] ROM table %s",
|
DebugLog("\n[InitBootInfo] ROM table %s",
|
||||||
GetBootInfo(firmware).romValid ? "OK" : "");
|
GetBootInfo(firmware).romValid ? "present" : "");
|
||||||
DebugLog("\n[InitBootInfo] APM table %s",
|
DebugLog("\n[InitBootInfo] APM table %s",
|
||||||
GetBootInfo(firmware).apmValid ? "OK\n" : "\n");
|
GetBootInfo(firmware).apmValid ? "present\n" : "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue