flat assembler
Message board for the users of flat assembler.

Index > Main > Load mbr bootloader from Long Mode/Switch to virtual mode?

Author
Thread Post new topic Reply to topic
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 06 Jun 2018, 08:27
Hi,
I found some cool info about x86 based Android devices and their bootflow.
According to http://newandroidbook.com/Articles/aboot.html all x86 android devices
have a full bios/uefi implementation which then loads aboot as bin/efi application. Even the
fastboot service is loaded by the bios/uefi. Also h2o insyde mentions that these devices have a bios
uefi the settings are just locked. "Additionally, InsydeH2O is a fully Windows compliant firmware solution that employs a true modular architecture...," sadly all theire stuff how to reach the settings is all in taiwanese or sth , but its only using to files to unlock the uefi settings these are a rom file and an efi file which is just aboot http://www.ondaforum.com/topic/575-win-81-system-to-android-system-tutorial-tools-android-os/ . I thought now after reading all this if could just make a raw bin pack it into an android boot image(kernel is in zimage formar which is just a raw bin i think) which then loads a normal pc efi bootloader for example clover or grub which then allows to boot a normal pc os for example linux. I have few questions about this, is this possible from long mode? And how would i do this or which documentation would i need. Or is there a possibility to switch back from long mode to virtual mode , enable bios interrupts and than just set the RIP to the bootloader i want to load or even virtual uefi implementation(DUET) ?. Thanks in advance.
Post 06 Jun 2018, 08:27
View user's profile Send private message Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 06 Jun 2018, 12:08
To make things short i just need to know how to switch from longmode to virtual mode, or how to load en efi file into memory and execute it in longmode. Im sorry for making the post so long.
Post 06 Jun 2018, 12:08
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2559
Furs 07 Jun 2018, 11:18
I have this on my bookmarks, but I've never actually done it, it seems to do what you asked for though: https://www.codeproject.com/Articles/45788/The-Real-Protected-Long-mode-assembly-tutorial-for

CTRL+F "Exiting from Long Mode"
Post 07 Jun 2018, 11:18
View user's profile Send private message Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 08 Jun 2018, 20:57
Thanks a lot that is exacly what i needed. Technicly is it even need to load the mbr into 07C00?
And instead load the complete bootloader/efi implementation(the part that gets loaded by the mbr) from memory to an 1:1 mappes protected mode adress in the 1mb range and set the ip to the main of the binary?
Post 08 Jun 2018, 20:57
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2559
Furs 09 Jun 2018, 14:57
If you don't use code that expects it to be loaded at 07C00 (i.e. you jump straight to second stage bootloader or w/e it's called), then no you don't have to.

Most non-efi bootloaders expect the traditional BIOS interrupts though, so you'll need to have CSM (compatibility-support-module) or whatever in the BIOS activated.
Post 09 Jun 2018, 14:57
View user's profile Send private message Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 09 Jun 2018, 22:38
Furs wrote:
If you don't use code that expects it to be loaded at 07C00 (i.e. you jump straight to second stage bootloader or w/e it's called), then no you don't have to.

Most non-efi bootloaders expect the traditional BIOS interrupts though, so you'll need to have CSM (compatibility-support-module) or whatever in the BIOS activated.

Thanks a lot, thats perfect. I want to get DUET to boot http://www.rodsbooks.com/bios2uefi/ It s a UEFI that loads on like a normal os and provides CSM. Im currently reading this https://github.com/migle/BootDuet and https://github.com/m13253/tianocore_uefi_duet_installer
Post 09 Jun 2018, 22:38
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.