Re: [Etherboot-developers] mknbi-1.2-7rc2 released
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: Rohit J. <ro...@pr...> - 2002-02-27 07:15:53
|
Greetings, On Wed, Feb 27, 2002 at 11:20:53AM +1100, Ken Yap wrote: > >Heh, you just got patches to do some of that in the context of the > >PXE patches to emulate PXE enough for the FreeBSD PXE boot loader to > >work! Maybe grub could be re-worked to access the hardware via PXE and > >not just look like a PXE image. Randoms thoughts are what if > >Etherboot had a PXE network driver writen in terms the PXE stuff > >that was sent in? That would seem to get us most of the way there. > >"pxegrub" could use the Etherboot "PXE network driver" to talk > >to the Etherboot PXE emulation layer. > > At first glance I don't think it can be modified to do pxelinux. The > FreeBSD patches just do "PXE-style" booting, which means a small > secondary loader is loaded starting at 0x7c00 and this loads the main > image. There is no requirement for it to go through the "official" PXE > interrupts, in fact this one just does a longjmp to the Etherboot > routines. Now that's not necessarily a bad thing, but it means you can't > take pxelinux and use that. So either: Actually the PXE API entry point is a 'C' function defined in main.c. int pxeemu_entry(struct v86 *x_v86_p, int *x_pxeemu_v86_flag, int x_pxeemu_func_nr, vm_offset_t x_pxeemu_func_arg) Its address is contained in the PXENV+ structure (pxenv->PMOffset). The nbp (network boot program) uses this address to invoke PXE calls. This is analogous to the real mode PXE API calling mechanism. This facility is non-standard and had to be invented as the PXE standard provides no way (at least none I could figure out) to access the PXE API from 32bit protected mode. The address of the PXENV+ structure is passed to the nbp in the %ebx register as required by the standard. The nbp is loaded and executes at 0x7c00 again as required by the standard. The *jmp magic is to allow the emulation code to utilize the nbp infrastructure to make vm86 calls, as _real_to_prot and _prot_to_real are unusable once the nbp switches to protected mode. The idea is that when we want to make a vm86 call we fill in the v86 structure, set the v86_flag, save our state (setjmp) and return immediately. The caller checks this flag on return from the API call, if set it executes the vm86 action defined by the v86 structure and calls the API function again with the flag set. The API entry function notices that the flag is set and does a longjmp to return to the saved state. For this to work correctly the emulation code and the nbp must not use the same stack, which is no problem as the nbp defines its own stack area as does ETHERBOOT. We switch stacks on API entry and exit (using *jmp routines). Currenty the v86 facility is used only by console_putc to provide video console feedback. IMO it should be relatively easy to modify pxelinux to use this PXE emulation, especially so if we are willing do away with all the v86/*jmp stuff. This would mean no video console output (com console is ok) from the emulation layer once the nbp is running. Should be okay as the nbp will provide feedback using its own mechanisms. regards, rohit |