On 06/11/2014 11:31 AM, Bill Paul wrote:
> Of all the gin joints in all the towns in all the world, Thomas Letan had to
> walk into mine at 02:02:13 on Wednesday 11 June 2014 and say:
>
>> Hello everyone.
>>
>> I am currently working on UEFI and more precisely on SMM with UEFI.
>> To handle correctly #SMI, I have to load some piece of code in RAM. In
>> order to do some tests, I wrote my assembly code, compile it with nasm,
>> get the binary content thanks to objdump and save it in a char[]
>> variable. Not very clean way to do it, IMHO.
>>
>> Is there an “EDKII way” to do it? For what I saw, the C files of EDKII
>> do not contain a single line of asm, which are written in a separate file.
>>
>> Thank you for your time
>> Thomas
>
> I don't think there is an "EDKII way" to do what you're doing. The problem is
> that the EDKII is meant to be built using a number of different C compiler
> implementations, and embedded assembly usage is not part of the ANSI C
> specification so there's no portable syntax for it. GNU C does it one way,
> Microsoft C does it another, the Wind River Diab C compiler does it yet
> another (as I have had to learn), the SunPRO C compiler probably also does it
> yet another, and so on. I think the Intel C compiler (icc) actually imitates
> the GCC syntax, but that's a rare exception.
>
> This is also why there are two versions of each Intel assembly code file in
> the EDKII: there's one written in AT&T syntax for the GNU assembler and
> another written in Intel syntax for the Microsoft assembler.
>
> The code that goes into the EDKII itself has to be written like this so that
> everybody can use it. But if you're writing this code for a custom project
> that is proprietary (and hence will have its distribution tightly controlled
> and you're not going to contribute it for inclusion in EDKII) and your project
> mandates a specific set of compiler tools, then I suppose there's nothing to
> stop you from using your chosen compiler's embedded assembly syntax to include
> the code in your C files.

All true.

There are some examples in the tree of copying assembled code around to 
other locations, such as the code which sets up the 64-bit IDT in 
MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c.  See 
MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.{S,asm}.  That may be 
what you're looking for?
-- 

                                                 Brian

--------------------------------------------------------------------

   "Twenty years from now you will be more disappointed by the things
    that you didn't do than by the ones you did do.  So throw off the
    bowlines.  Sail away from the safe harbor. Catch the trade winds
    in your sails.  Explore.  Dream.  Discover."
                                            -- Mark Twain

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to