@romin I found assembler code to boot an x64 machine directly in to 64-bit mode but it doesn't have BIOS so you can't use int13h to load a kernel from disk so I was trying to figure out how to do that. and it looks like you have to create an EFI application basically to access the disk, there doesn't seem to be a way around it.
@romin I found alleged code for booting it but no clear answer on how you access hardware after that other than "you have to enumerate the PCI bus and know how to communicate with it"
@Moon The approach for Protected Mode and above in OS programming is to write your own drivers interfacing with and enumerating devices directly through ports, which means that you will have to read the specifications and allow an unspecified but like large amount of exceptions. I would just customize Linux if I were in you.
@anonaccount no problem, I'm just trying to understand what would be the smallest code that boots directly into 64-bit and can then load a kernel from disk.
@romin@anonaccount I have actually made a simple EFI application already but I wondered how EFI boots or if that question even makes sense. Coreboot seems conceptually so much better than EFI.
@Moon Are you familiar with POSIX-UEFI? It provides a simple "fopen" function to open a file, couple it with the umpteeth ELF / Mach-O loader taken from a security blog or GitHub and call it a done job. wiki.osdev.org/POSIX-UEFI
Also, I must warn you that EFI does provide in-built support only for the FAT32 filesystem.
@Moon On AMD64 CPU's you cannot load directly into 64 bit mode - they used to boot in 16 bit mode, with certain instructions required to boot into 32 bit and then finally 64 bit mode - although reading down it seems that 16 bit more was finally removed on the newest computers.
Most proprietary BIOS's seem to be programmed for 16 bit or 32 bit mode even though that doesn't make that much sense.
You pretty much want to look into coreboot (specifically the GNUboot version), as it runs the 6(?) required instructions to get into 64 bit mode and then does everything in 64 bit and has drivers for southbridges, framebuffer, keyboards etc and then you can get it to boot GNU Grub.
Grub can load kernels directly in 64 bit mode without using the cancer known as UEFI, so it's time to reeeeeaaaaadddd theeeeeee soooouuurce.