On Wed, Jul 7, 2010 at 11:35 PM, Geoff Lywood <glyw...@vmware.com> wrote: > Here is an updated patch. > > Changes since the first version: > - Instructions "retf" and "movzxb" have been replaced with "lret" and "movzbl" > because that's the correct AT&T syntax > - The three calls to prep_segment were merged into a single call > > $ util/diffsize.pl origin/master HEAD > com32 +155 > com32_call +38 > com32_wrappe +33 > TOTAL: +226 > > --------------------- > COM32 binaries generally expect to run with interrupts enabled. Syslinux does > so, and COM32 programs will execute cli/sti pairs when running a critical > section, to provide mutual exclusion against BIOS interrupt handlers. > Previously, under gPXE, the IDT was not valid, so any interrupt (e.g. a timer > tick) would generally cause the machine to triple fault. > > This change introduces code to: > - Create a valid IDT at the same location that syslinux uses > - Create an "interrupt jump buffer", which contains small pieces of code that > simply record the vector number and jump to a common handler > - Thunk down to real mode and execute the BIOS's interrupt handler whenever > an interrupt is received in a COM32 program > - Switch IDTs and enable/disable interrupts when context switching to and from > COM32 binaries > > Testing done: > - Booted VMware ESX using a COM32 multiboot loader (mboot.c32) > - Built with GDBSERIAL enabled, and tested breakpoints on int22 and com32_irq > - Put the following code in a COM32 program: > asm volatile ( "sti" ); > while ( 1 ); > Before this change, the machine would triple fault immediately. After this > change, it hangs as expected. Under Bochs, it is possible to see the > interrupt handler run, and the current time in the BIOS data area gets > incremented. > --- > src/arch/i386/image/com32.c | 54 +++++++++++++++++++-- > src/arch/i386/include/comboot.h | 45 ++++++++++++++++++ > src/arch/i386/interface/syslinux/com32_call.c | 17 +++++++ > src/arch/i386/interface/syslinux/com32_wrapper.S | 28 +++++++++++ > 4 files changed, 138 insertions(+), 6 deletions(-)
Appled, thanks! http://git.etherboot.org/?p=gpxe.git;a=commitdiff;h=b764464f04c5316e0f8188ef6bf3a74e8ebc1f00 Stefan _______________________________________________ gPXE-devel mailing list gPXE-devel@etherboot.org http://etherboot.org/mailman/listinfo/gpxe-devel