Hi Andrew,

That you are right, in Main.c the main shouldn't have the EFIABI as
Jordan pointed in his message. Your detailed explanation helps me to
understand a little better the whole environment.

Thank you,
Mauro


On Tue, Jan 15, 2013 at 1:21 PM, Andrew Fish <af...@apple.com> wrote:
> In my previous mail to this thread I explained the usage of EFIABI and the 
> differences in the calling convention. If you are seeing an EFIABI issue with 
> main() this is what you should look for....
>
> The EFIABI calling convention for X64 passes the first 4 arguments in 
> registers RCX is arg1, RDX is arg2, R8 is arg3, and R9 is arg4. The System V 
> calling convention for X64 uses 6 registers and the sequence is RDI, RSI, 
> RDX, RCX, R8, and R9. If you poke around in gdb you can look at the registers 
> and see what values are being passed, and what values are being used by the C 
> code. Since main has EFIABI you would expect Argc is in RDX, if you see RDI 
> being used then you know the compiler did not generate the correct EFIABI 
> calling convention. If RDX has a bad value it could be an issue with the 
> caller not calling with EFIABI.
>
> I'm not really familiar with the StdLib, but I did a quick grep and it looks 
> like main is called from LibC as int main(int, char **) and not int EFIABI 
> main (int, char **).
>
> Andrew Fish
>
>
> On Jan 11, 2013, at 6:24 AM, Mauro Faccenda <facce...@gmail.com> wrote:
>
>> Hi all,
>>
>> I am trying to get started with EDK2 development and I'd like to
>> report some difficulties I had and am having.
>>
>> If any of you can point to some way to fix or even better way of doing
>> anything, I'd appreciate.
>>
>> I am willing to use a plain Ubuntu 12.04 64bits as development
>> platform as it comes with GCC 4.6 which seems to be well supported by
>> the EDK2 and BaseTools.
>>
>> But here comes to me the first question: which (if any) are the
>> recommended (default) platform for development? I guess it is using
>> Windows with VS since the configuration comes with all parameters set
>> to use it. But I'd like to know If there is any 'better supported'
>> Linux platform (distro, distro version+gcc version).
>>
>> The Project Wiki mentions Ubuntu 9.10, 10.10 and 10.04, and GCC 4.4,
>> but doesn't recommend any.
>>
>> For instance, I followed this documentation:
>> http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Using_EDK_II_with_Native_GCC_4.4
>>
>> Moving on, as I want to play with network connections, I built my own
>> OVMF with the Intel's E1000 Network drivers successfully using the
>> sources from EDK2 trunk.
>>
>> I already could run qemu with network support (using tap + bridge with
>> host physical interface) and use ping.efi (from the EDK2 Toolkit)
>> against devices on my network, also no problems besides the latency
>> being a bit high (>400ms, from the host I get less than 1ms).
>>
>> Then I started building some applications to test running in the
>> environment. I've built the MdeModulePkg and could run some of them.
>> But when I tried to build AppPkg I got the following error:
>> $ build -t GCC46 -a X64 -p AppPkg/AppPkg.dsc
>> [...]
>> edk2/StdLib/LibC/Containers/Queues/Fifo.c:508:27: error: assignment
>> from incompatible pointer type [-Werror]
>> cc1: all warnings being treated as errors
>>
>> As it seems to be a warning promoted to an error, I manually ran the
>> same gcc command removing the -Werror parameter and it compiled
>> successfully.
>>
>> Is this a bug? Should I report?
>>
>> Then I ran the build command again, which brought another error:
>>
>> edk2/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c:269:1: error:
>> conflicting types for ‘IIO_CursorDelta’
>> edk2/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.h:122:1: note:
>> previous declaration of ‘IIO_CursorDelta’ was here
>>
>> I opened both files looking for the definition of IIO_CursorDelta and
>> in .h file I got:
>> --
>> int
>> EFIAPI
>> IIO_CursorDelta (
>>  cIIO         *This,
>>  CURSOR_XY    *StartXY,
>>  CURSOR_XY    *EndXY
>>  );
>> --
>> while in the .c I got:
>> --
>> UINT32
>> EFIAPI
>> IIO_CursorDelta (
>>  cIIO         *This,
>>  CURSOR_XY    *StartXY,
>>  CURSOR_XY    *EndXY
>> ) [...]
>> --
>>
>> So I changed the .h from int to UINT32 and ran the build again. This
>> time with success. Should I report this?
>>
>> After that, I started to play with AppPkg/Applications/Main/Main.c,
>> trying to poke around to see what I can or can't do and got something
>> strange. I've changed the Main.c to just print the Argc value:
>> --
>> #include  <stdio.h>
>> int
>> EFIAPI
>> main (
>>  IN int Argc,
>>  IN char **Argv
>>  )
>> {
>>  printf("\nArgc=%d\n", Argc);
>>  return 0;
>> }
>> --
>> And whenever I run it on UEFI Shell (using qemu), I always get really
>> big values (> 37000000) no matter with how many parameter I run and if
>> I run with the same parameter multiple times, the value sometimes
>> changes, as you can see on the image below:
>>
>> http://s1.postimage.org/dxeg7ahdr/argc.png
>>
>> This isn't exactly a problem, since I still can successfully run
>> normal code but I'd like to know if am I doing something stupid, if
>> this is some kind of bug or if it is a side effect of something I
>> couldn't see yet.
>>
>> Any tips or clarifications will be really appreciated.
>>
>> Anyway, thanks for the good job you all have been doing on this project. =)
>>
>> Mauro Faccenda
>>
>> ------------------------------------------------------------------------------
>> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
>> much more. Get web development skills now with LearnDevNow -
>> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
>> SALE $99.99 this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122812
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
> ------------------------------------------------------------------------------
> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only - learn more at:
> http://p.sf.net/sfu/learnmore_122512
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to