Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Move data to CPU registers in 64bit // compiled with cl // inline assembler

$
0
0

Hello.

Currently I am developing a bootloader for a multiboot compliant operating system.
The bootloader itself is an EFI Application and is compiled with the build tools of VisualStudio 2008.

The target architecture is AMD64, the buildchain is based on nmake.

The multiboot spec (search for multiboot spec on gnu.org) tells the bootloader to use the registers EAX and EBX as paramters of the entry function of the Operating System.

EAX should contain a magic value
EBX should contain a pointer to a prepared multiboot structure

The main issue i'm currently trying to solve :
CL in x64 / AMD64 forbids to use inline assembler. The only solution given by CL are the 64bit instrinsinc functions. These instrinsinc function are far too complex for the given task which is simply copying two values into two defined registers and calling the os loader entry.

This is the code I want to execute at the end of the bootloader:

mov EAX, #magic_value
mov EBX, ptr_to_structure
call OS_ENTRY

In general it should be possible to use a single .asm file and compile the three lines of code with masm, but i'm trying to get the code as maintainable as possible without the need of external (asm) files and compilation steps.
So the best possible solution would be an instrinsinc function or some keywords i can use in the already (CL-)compiling C file of the bootloader.

Is there a solution available or should I use the "external .asm method".

Thanks in advance,
Freddy

Edit: Sorry, i didn't mention that he complete code is written in C



Viewing all articles
Browse latest Browse all 21115


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>