> Date: Sat, 23 Apr 2016 12:49:25 +0200 (CEST)
> From: Mark Kettenis <mark.kette...@xs4all.nl>
>
> > Could it be this problem is related to
> > sys/arch/amd64/stand/efi/include/i386/efibind.h using sys/stdint.h 
> > which looks like it will make uint64_t unsigned long on for BOOTIA32.EFI
> > not unsigned long long?
> 
> We consistently define uint64_t as unsigned long long (unlike some
> other OSes) so this shouldn't be the case.
> 
> I didn't look in detail at the report yet, but I can confirm that I
> had a similar problem on the Asus x205ta.  I worked around it by
> nuking the GPT and using a traditional MBR partition table instead.
> Never got around investigating the issue any further.

Seems that this is a structure memberalignment issue:

For BOOTX64 we have:

(gdb) print &((EFI_BLOCK_IO_MEDIA *)0)->LastBlock
$1 = (EFI_LBA *) 0x18

wheras for BOTIA32 we get:

(gdb) print &((EFI_BLOCK_IO_MEDIA *)0)->LastBlock
$1 = (EFI_LBA *) 0x14

Looking at the struct definition:

typedef struct {
    UINT32              MediaId;
    BOOLEAN             RemovableMedia;
    BOOLEAN             MediaPresent;

    BOOLEAN             LogicalPartition;
    BOOLEAN             ReadOnly;
    BOOLEAN             WriteCaching;

    UINT32              BlockSize;
    UINT32              IoAlign;

    EFI_LBA             LastBlock;
} EFI_BLOCK_IO_MEDIA;

We see that the 64-bit code has padding between IoAlign and LastBlock
to make sure that LastBlock is properly aligned.  That padding isn't
there in the 32-bit code since the System V ABI doesn't require 64-bit
alignment here.  But I guess the 32-bit Windows ABI does.

Reply via email to