I am new to bootloader stuff and going through u-boot code and looking into file zimage.c file with boot_zimage function and following are comments from boot_zimage function
Set %ebx, %ebp, and %edi to 0, %esi to point to the boot_params * structure, and then jump to the kernel. We assume that %cs is * 0x10, 4GB flat, and read/execute, and the data segments are 0x18, * 4GB flat, and read/write. U-boot is setting them up that way for * itself in arch/i386/cpu/cpu.c.
Now these comment says set ebp,ebx and edi resgister to value 0 and now my question is everytime i need to set these register to 0 before giving control to linux in case of x86 architecture., or its very much uboot specific.
What register needs to be set for booting linux kernel .
Re: What register needs to be set for booting linux kernel .
Very end of https://www.kernel.org/doc/Documentation/x86/boot.txt
At entry, the CPU must be in 32-bit protected mode with paging
disabled; a GDT must be loaded with the descriptors for selectors
__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
segment; __BOOS_CS must have execute/read permission, and __BOOT_DS
must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
must be __BOOT_DS; interrupt must be disabled; %esi must hold the base
address of the struct boot_params; %ebp, %edi and %ebx must be zero.
Learn to read.
Re: What register needs to be set for booting linux kernel .
So are you saying every bootloader(Grub,uboot,LILO etc) has to follow this protocol to boot linux/x86 ??
Re: What register needs to be set for booting linux kernel .
Apparently you need to follow Multiboot protocol to be able to boot multiboot-compliant kernel. Linux is no different.
There are probably some shortcuts if you want quick-n-dirty boot, but it will be not fully functional.
There are probably some shortcuts if you want quick-n-dirty boot, but it will be not fully functional.
Learn to read.
Re: What register needs to be set for booting linux kernel .
Thanks dozniak for your kind response,is it safe to say for any bootloader minimum required to boot linux/x86 is what you said
At entry, the CPU must be in 32-bit protected mode with paging
disabled; a GDT must be loaded with the descriptors for selectors
__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
segment; __BOOS_CS must have execute/read permission, and __BOOT_DS
must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
must be __BOOT_DS; interrupt must be disabled; %esi must hold the base
address of the struct boot_params; %ebp, %edi and %ebx must be zero.
At entry, the CPU must be in 32-bit protected mode with paging
disabled; a GDT must be loaded with the descriptors for selectors
__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
segment; __BOOS_CS must have execute/read permission, and __BOOT_DS
must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
must be __BOOT_DS; interrupt must be disabled; %esi must hold the base
address of the struct boot_params; %ebp, %edi and %ebx must be zero.
Re: What register needs to be set for booting linux kernel .
Just read the link I posted, it describes the full linux kernel boot protocol and what is needed to perform a successful kernel boot.
Learn to read.