OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:43 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [UEFI] MSVC: Bootloader - Call MS_ABI binary (c++)
PostPosted: Mon Aug 23, 2021 10:10 am 
Offline

Joined: Sun Aug 22, 2021 2:59 pm
Posts: 2
Hello,

Im programming an Operating System and compile my Kernel binary with MSVC underVisual Studio 2019. Now i doesnt know how to call and load that C++ kernel binary.
My bootx64.efi is also compiled and works so far with simple_uefi. Im only found tutorials in c++with gcc and sysv_abi. and mingw-gcc...

Thanks so far...


Top
 Profile  
 
 Post subject: Re: [UEFI] MSVC: Bootloader - Call MS_ABI binary (c++)
PostPosted: Mon Aug 23, 2021 11:42 pm 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
Visual Studio uses PE file format for executable files, from your UEFI loader, write a function which loads the executable into a buffer, copy the entire buffer to a virtual address which will be your base address for Kernel, for my case I use x64 bit so my base address is 0xffffc00000000000, then from there extract the entry point of the pe file, then setup stack memory and call the entry point (base_address+entrypoint). Look at the PE file format article.


Top
 Profile  
 
 Post subject: Re: [UEFI] MSVC: Bootloader - Call MS_ABI binary (c++)
PostPosted: Tue Aug 24, 2021 8:46 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
LipkeGu wrote:
Im only found tutorials in c++with gcc and sysv_abi. and mingw-gcc...
Check out EDK2 tools and examples. That uses MS_ABI by default, as well as its examples. I don't know how good it is, but there's a PE loader example too.

Cheers,
bzt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: 8infy, Bing [Bot], DotBot [Bot], Google [Bot], SemrushBot [Bot] and 73 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group