flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
ouadji
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 |
|||
![]() |
|
Tomasz Grysztar
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. |
|||
![]() |
|
Tomasz Grysztar
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?
|
|||
![]() |
|
DJ Mauretto
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 ![]() |
|||
![]() |
|
Tomasz Grysztar
Please try it now.
|
|||
![]() |
|
DJ Mauretto
Yes
![]() Quote:
_________________ Nil Volentibus Arduum ![]() |
|||
![]() |
|
vid
Does it run?
|
|||
![]() |
|
DJ Mauretto
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 ![]() |
|||
![]() |
|
DJ Mauretto
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 ![]() |
|||
![]() |
|
DJ Mauretto
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 ![]() |
|||
![]() |
|
Tomasz Grysztar
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. |
|||
![]() |
|
DJ Mauretto
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 ![]() |
|||
![]() |
|
DJ Mauretto
Hey,
Are you There ? ![]() PE32+ is for 64 bit, please update fasm with PE32 dll efi. Thanks ![]() _________________ Nil Volentibus Arduum ![]() |
|||
![]() |
|
vid
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. |
|||
![]() |
|
DJ Mauretto
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 ![]() |
|||
![]() |
|
DJ Mauretto
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 ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.