Re: [Etherboot-developers] Q: does xstart work?
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: Eric W B. <ebi...@ln...> - 2002-07-23 11:40:10
|
Eric W Biederman <ebi...@ln...> writes:
> ke...@us... (Ken Yap) writes:
>
> > >> ADDR32 LJMPI(_execaddr-_start)
> >
> > Incidentally if you feel motivated to convert this bit of data
> > segment-modifying code to a push onto the stack followed by a ret,
> > please do.
>
> I will or something similiar, accessing the 32bit data segment
> from 16bit is a fairly bad thing to do.
O.k. I have all of the routines converted.
xstart16 still needs a little work to get the bootp data structure below
1MB. But othewise it should work fine.
The open issues are:
- How to copy/move bootp low for 16bit code.
- How to properly allocate the real mode stack.
I am thinking I can just use the initial stack and push
the code on there.
For reference the trampoline _real_call pushes on the real mode stack
is just 80 bytes. 80 bytes shouldn't overflow even a small stack.
The worst cases is meme820 which allocates a 280 byte buffer for the
memory map.
Eric
.globl xstart16
xstart16:
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %esi
pushl %edi
movl 8(%ebp),%edx
movl 12(%ebp),%ebx
/* FIXME handle the bootp record */
movl 16(%ebp),%ecx /* bootp record (32bit pointer) */
shll $12,%ecx /* convert to segment:offset form */
shrw $12,%cx
pushl $ 10f
pushl $ 20f - 10f
call _real_call
.section ".text16"
10: .code16
popw %ax /* get the return ip addr */
pushl %ecx /* bootp record */
pushl %ebx /* file header */
pushw %cs /* Setup the far return address */
pushw %ax
pushl %edx /* Setup the far address to call */
lret /* Back into the routine I'm calling */
20: .code32
.previous
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
|