Re: [Etherboot-developers] pxe
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: <ebi...@ln...> - 2003-05-23 07:49:18
|
Michael Brown <mb...@fe...> writes:
> On Thu, 22 May 2003, Danny Braniss wrote:
> > > There is now a copy of pxe.h from FreeBSD in Etherboot CVS, under
> > > arch/i386/include. I used it when writing the Etherboot UNDI driver.
> > > It's been edited slightly; I corrected several typos and one alignment
> > > bug. If this is the only header required, then we've now got it.
> > hum, i think i sent out a message this morning, but it could have been
> > before coffee, so if this is a repost - sorry
>
> Did you send it to etherboot-developers-admin instead of
> etherboot-developers?
>
> > whith some minor twiks i managed to compile under FreeBSD, but there is
> > a minor unresolved:
> > main.o(.text+0x1459): undefined reference to `initsp'
> > and i found:
> > ./src/pcbios.S:.globl initsp
> > i think some initialization is missing, but since my knowledeg of x86
> > assembler is zero, i have no idea how to fix this
Wrong track. initsp was deleted. How the .globl initsp survived
is beyond me.
> You seem to be using the 5.0 branch - is this deliberate? (The BSD header
> I was referring to has been placed into the 5.1 branch.)
One branch or the other should not matter too much, in this
regard.
The two pieces of inline assembly in the pxe code in 5.1 are
both incorrect. For an old enough version of 5.0 the code
works. In particular 5.0.x one version before the inclusion
of the code.
Etherboot does not use inline assembly for this kind of thing
and that is what is causing the problem. Instead these hooks
are abstracted into subroutines, and just written in assembler.
The important part being the code is written as separate subroutines
with a clearly defined purpose.
So two things are needed.
1) A routine that will start a pxe image with the proper arguments.
To replace this junk of assembly:
Something similar to xstart16 is needed,
or possibly xstart16 can be generalized.
__asm__ __volatile__ (
"movb $1, pxeemu_nbp_active\n"
"call _prot_to_real\n"
".code16\n"
"movw %0, %%ax\n"
"movw %%ax, %%es\n"
"movl %1, %%ebx\n"
"ljmp $0x0,$0x7c00\n"
".code32\n"
: : "i" (RELOC >> 4),
"g" (((vm_offset_t)&pxenv) - RELOC));
2) A routine to generate a thunk that can be used to
reenter etherboot in 32bit mode, and transfer
control to the pxeemu handler. And eventually we will
need code to generate 16bit thunks as well. That
will allow us to replace this bit of assembly.
/* Switch Stacks */
__asm__("xorl %%eax, %%eax\n"
"movw initsp, %%ax\n"
"addl %0, %%eax\n"
"movl %%eax, %%esp\n"
: : "i" (RELOC));
Basically those two pieces of inline assembly are a maintenance
disaster because:
- What they are trying to do is not well abstracted.
- They are not doing things in the usual etherboot style.
- The code cannot even be compiled on anything except FreeBSD.
With the appropriate magic headers.
For 5.1 2 additional pieces need to happen:
- The pxenv structure needs to moved lower in memory if
it is to work with -DRELOCATE enabled.
- Etherboot needs to hook int 0x15 and reserve the memory
etherboot is living in. This may just be a cleanliness
issue.
Eric
|