pbatard/fasmg-ebc

hello.asm doesn't work on ia32

pbatard opened this issue · 1 comments

It doesn't seem to wait for a key to be input as the x64 version does.

Well, there's your problem: by the time we get to

  MOVI   R3, EFI_NOT_READY
  CMPeq  R7, R3

to compare the value returned by SystemTable.ConIn.ReadKeyStroke() (in R7), here are what our registers look like when running in X64 mode:

EDB > R
  R0 - 0x0000000005DB4F00, R1 - 0x0000000007DD0950
  R2 - 0x0000000000402000, R3 - 0x8000000000000006
  R4 - 0x0000000000000000, R5 - 0x0000000000000000
  R6 - 0x0000000000000000, R7 - 0x8000000000000006

But when running in IA32 mode, this is what we get:

EDB > R
  R0 - 0x00000000060EBFF4, R1 - 0x0000000007E9CE5C
  R2 - 0x0000000000402000, R3 - 0x8000000000000006
  R4 - 0x0000000000000000, R5 - 0x0000000000000000
  R6 - 0x0000000000000000, R7 - 0x060EBFFC80000006

Of course, it kind of makes sense that the external UEFI status code being returned on 32-bit is a 32-bit signed value. This'll make it tricky to test though, as we can't blindly sign extend to quad (EXTNDD64), else the 64-bit comparison will fail, and we're not gonna match the value we defined for EFI_NOT_READY anyway.

I wonder if there is an EBC standard way of handling this kind of situation...