flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Fasm EFI |
Author |
|
ouadji 22 Sep 2011, 09:16
I checked and I confirm Code: EFI use32 --------- 0 | 0 y 0 | 1 y 1 | 0 n ;push ecx/illegal instruction/line 18 1 | 1 y y : does compile n : does not compile |
|||
22 Sep 2011, 09:16 |
|
Tomasz Grysztar 22 Sep 2011, 10:20
Code: format pe dll EFI at 10000000h entry start section '.text' code executable readable start: push rcx For some reason fasm makes it "use64" instead of "use32". I will investigate further in the evening. |
|||
22 Sep 2011, 10:20 |
|
Tomasz Grysztar 23 Sep 2011, 17:30
fasm's PE formatter was always assuming that PE+ is always 64-bit code, while at the same time EFI requires PE+ format even for 32-bit case. I corrected it so that those two attributes (PE+ and x86-64 architecture) are distinguished and so it should now be possible to correctly generate 32-bit EFI PE. However, due to delicate nature of these changes, it is possible I introduced some new bugs. Can you test it thoroughly for me?
|
|||
23 Sep 2011, 17:30 |
|
DJ Mauretto 24 Sep 2011, 06:59
With the code below i get:
Quote:
Code: format pe dll EFI at 10000000h entry start section '.text' code executable readable ; System Table <==== ESP + 8 ; Handle <==== ESP + 4 start: mov eax,[esp+8] ; eax = Pointer to EFI_SYSTEM_TABLE mov ecx,[eax+44] ; ecx = Pointer to SIMPLE_TEXT_OUTPUT_INTERFACE push hello ; Pointer to String push ecx ; Pointer to SIMPLE_TEXT_OUTPUT_INTERFACE call Dword [ecx+4] ; SIMPLE_TEXT_OUTPUT_INTERFACE.OutputString add esp,4*2 xor eax,eax ret ;------------------------------------------- ; Data section '.data' data readable writeable ;------------------------------------------- hello du 'Hello EFI',13,10,0 section '.reloc' fixups data discardable _________________ Nil Volentibus Arduum |
|||
24 Sep 2011, 06:59 |
|
Tomasz Grysztar 24 Sep 2011, 10:30
Please try it now.
|
|||
24 Sep 2011, 10:30 |
|
DJ Mauretto 24 Sep 2011, 11:14
Yes
Quote:
_________________ Nil Volentibus Arduum |
|||
24 Sep 2011, 11:14 |
|
vid 24 Sep 2011, 17:29
Does it run?
|
|||
24 Sep 2011, 17:29 |
|
DJ Mauretto 25 Sep 2011, 05:49
Quote:
I don't know, i haven't EFI system on my PC I started to learn EFI because i want update my Os bootloader for the new EFI/BIOS PC... I am writing all EFI API in asm, but without try it in real machine.. _________________ Nil Volentibus Arduum |
|||
25 Sep 2011, 05:49 |
|
DJ Mauretto 15 Oct 2011, 13:06
Hello Tomasz,
I think that you must check your DLL EFI format in better way, i get error when disassembly your PE in various disassembler tool, while in the same tools the example compiled with microsoft C compiler and linker work fine Anyway i get no error when i test efi program compiled with fasm under the EFI shell Some Example: Code: IDA PRO show me PUSH ESI PUSH EBP as PUSH RSI PUSH RBP Another disassembly refuse to load your EFI DLL.... _________________ Nil Volentibus Arduum |
|||
15 Oct 2011, 13:06 |
|
DJ Mauretto 16 Oct 2011, 07:16
Hello,
All the example precompiled under EFI toolkit (by intel) and EDK (efi development kit ) for 32bit use Classic Standard PE32 DLL EFI. Why Fasm make DLL EFI PE32+ format as Default ? _________________ Nil Volentibus Arduum |
|||
16 Oct 2011, 07:16 |
|
Tomasz Grysztar 16 Oct 2011, 22:16
DJ Mauretto wrote: Why Fasm make DLL EFI PE32+ format as Default ? UEFI Specification Version 2.3.1, section 2.1.1 UEFI Images wrote: UEFI uses a subset of the PE32+ image format with a modified header signature. The modification to the signature value in the PE32+ image is done to distinguish UEFI images from normal PE32 executables. The “+” addition to PE32 provides the 64-bit relocation fix-up extensions to standard PE32 format. |
|||
16 Oct 2011, 22:16 |
|
DJ Mauretto 17 Oct 2011, 08:55
Quote: Because of what UEFI Specification states: Yes I know it, i'm learning EFI, but this is the theory, the reality is another. EFI shell is a PE32 applpication, and all examples in EDK and EFI toolkit are PE32 DLL... Anyway can i select this option with fasm, without that fasm assume nothing ? If i want Standard PE32 i write 'format pe dll EFI' , and if i want PE32+ i write 'format pe+ dll EFI'... _________________ Nil Volentibus Arduum |
|||
17 Oct 2011, 08:55 |
|
DJ Mauretto 18 Oct 2011, 13:38
Hey,
Are you There ? PE32+ is for 64 bit, please update fasm with PE32 dll efi. Thanks _________________ Nil Volentibus Arduum |
|||
18 Oct 2011, 13:38 |
|
vid 19 Oct 2011, 00:03
No, PE32+ is for 32-bit EFI, specification says so. Of course, most disassembler don't support this unusual format, but that really has nothing to do with EFI.
Some specific implementation not obeying the standard completely, or your inability to use some disassembler for format it was not meant for are not good enough reasons for FASM to support a non-existent standard of plain-PE EFI files. If there was a EFI implementation unable to run 32-bit PE32+ executable, that would be a different story. |
|||
19 Oct 2011, 00:03 |
|
DJ Mauretto 19 Oct 2011, 08:11
Quote: No, PE32+ is for 32-bit EFI, specification says so. Of course, most disassembler don't support this unusual format, but that really has nothing to do with EFI. Look at the examples for efi 32 bit in the efi toolkit and edk. They are all PE32 dll.. WHY FASM make bad assumption about EFI.. The user must choose if he want PE32 or PE32+... I guess it was you who suggested the platform for 64bit efi _________________ Nil Volentibus Arduum |
|||
19 Oct 2011, 08:11 |
|
DJ Mauretto 19 Oct 2011, 09:59
Quote: or your inability to use some disassembler between you and me there is only a small difference, I'm a genius you are a 'HELLO world' programmer _________________ Nil Volentibus Arduum |
|||
19 Oct 2011, 09:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.