[ipxe-devel] 486 with a Realtek 8139

Michael Brown mcb30 at ipxe.org
Wed May 5 12:18:16 UTC 2021

On 05/05/2021 07:54, Martin Habets wrote:
> Long ago Etherboot used to be i386 code.
> Nowadays I think iPXE only runs on i586 or later,
> e.g. arch/x86/prefix/unlzma.S has:
> 	.arch i586
>  From memory there are a couple of places in the code where
> iPXE uses assembler opcodes that don't exist in 486.
> Your best bet is probably using the old Etherboot code base and
> debug/patch that.

A quick test indicates that unlzma.S will still build with ".arch i486". 
  AFAICT the only non-i386 instruction in there is "bswap", which should 
exist on a 486.

I did some quick testing in bochs configured for a 486 using:

   ./configure --enable-a20-pin --disable-x86_64 --enable-cpu-level=4 \
               --enable-pci --enable-e1000 --enable-debugger \
               --disable-debugger-gui --enable-readline \
               --enable-all-optimizations --enable-cdrom --disable-smp

This showed that iPXE is getting stuck on the "rdtsc" instruction, which 
is an undefined opcode on i486.

The rdtsc-based timer isn't causing the problem: the code in 
rdtsc_probe() already checks for an invariant TSC (which isn't present 
on i486) and so never issues the rdtsc instruction.

There are two remaining uses: in undinet_call() where the TSC value gets 
used only for profiling, and in rtc_sample() where the TSC value gets 
used as part of entropy generation.

Commenting out these instructions (via the attached patch) gave me an 
iPXE binary that worked fine on i486.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rdtsc-hack.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20210505/5edc9c60/attachment.bin>

More information about the ipxe-devel mailing list