OSDev.org https://forum.osdev.org/ |
|
My OS does not boot in real hardware https://forum.osdev.org/viewtopic.php?f=1&t=33514 |
Page 4 of 4 |
Author: | deleted8917 [ Mon Feb 18, 2019 3:22 pm ] |
Post subject: | Re: My OS does not boot in real hardware |
If I remember correctly, GRUB enables the protected mode, A20 and GDT? |
Author: | Octocontrabass [ Mon Feb 18, 2019 3:30 pm ] |
Post subject: | Re: My OS does not boot in real hardware |
The CPU will be in protected mode. The A20 line will be enabled. The GDT will not be set up, so you must set up your own GDT before you can load any segment registers. That's all explained in the multiboot specification in section 3.3, "I386 machine state". You should search the specification before asking here; otherwise you'll just get a lot of answers telling you to look in the spec. |
Author: | MichaelPetch [ Mon Feb 18, 2019 3:32 pm ] |
Post subject: | Re: My OS does not boot in real hardware |
GRUB enables A20, enters 32-bit Protected mode with its own GDT. However, this is important - you should be establishing your own GDT because The Multiboot spec makes it clear the GDT record that gets loaded with LGDT should be considered invalid. You also don't know which selectors GRUB will use for code and data. The first time you attempt to load/reload a selector it could cause a crash. This is a real possibility if you enable your Interrupt Descriptor table and establish your own interrupt handlers. The documentation for Multiboot (legacy) is here: https://www.gnu.org/software/grub/manua ... iboot.html |
Author: | deleted8917 [ Mon Feb 18, 2019 3:35 pm ] |
Post subject: | Re: My OS does not boot in real hardware |
Thanks for the info. I'm gonna to port my OS to use GRUB. |
Author: | deleted8917 [ Mon Feb 18, 2019 4:46 pm ] |
Post subject: | Re: My OS does not boot in real hardware |
Hi, again here (as expected). I ported almost successfully my OS to GRUB, but I get this error: Code: error: no multiboot header found I already searched the error in Google, but I find no solution. (that can help me) Here is bootg.asm: Code: bits 32 %include "gdt.inc" %include "idt.inc" global start extern kernelmain start: mov esp, _sys_stack jmp stublet ALIGN 4 mboot: MULTIBOOT_PAGE_ALIGN equ 1<<0 MULTIBOOT_MEMORY_INFO equ 1<<1 MULTIBOOT_AOUT_KLUDGE equ 1<<16 MULTIBOOT_HEADER_MAGIC equ 0x1BADB002 MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) EXTERN code, bss, end dd MULTIBOOT_HEADER_MAGIC dd MULTIBOOT_HEADER_FLAGS dd MULTIBOOT_CHECKSUM call InstallGDT call kernelmain stublet: jmp $ SECTION .bss resb 8192 _sys_stack: The linker script is the same that can be finded in Bare bones |
Author: | zity [ Tue Feb 19, 2019 12:20 am ] |
Post subject: | Re: My OS does not boot in real hardware |
I'm not entirely sure this is the reason you get "no multiboot header found", but your header is incomplete. When using the MULTIBOOT_AOUT_KLUDGE you need to specify information about the layout of your binary file. Have a look here https://www.gnu.org/software/grub/manua ... der-layout For example, in my own loader I have the following header: Code: mboot:
dd MULTIBOOT_HEADER_MAGIC dd MULTIBOOT_HEADER_FLAGS dd MULTIBOOT_CHECKSUM dd mboot ; Location of this descriptor dd code ; Start of the .text (code) section (defined in linker script) dd bss ; End of the .data section (defined in linker script) dd end ; End of loader (defined in linker script) dd start ; Entry point below |
Author: | deleted8917 [ Tue Feb 19, 2019 7:18 am ] |
Post subject: | Re: My OS does not boot in real hardware |
zity wrote: I'm not entirely sure this is the reason you get "no multiboot header found" Also, I don't know, just bad luck I think. Using the bare bones NASM bootloader I get "invalid arch dependent elf magic" error. |
Page 4 of 4 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |