first attempt to call the pxe bios, still untested
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19620 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,11 +19,7 @@
|
|||||||
#define REAL_MODE_STACK 0x9000
|
#define REAL_MODE_STACK 0x9000
|
||||||
// the location of the stack in real mode
|
// the location of the stack in real mode
|
||||||
|
|
||||||
#define SAVED_ESP 0x10000
|
#define SAVED_EAX 0x10000
|
||||||
#define SAVED_CR3 0x10004
|
|
||||||
#define SAVED_EAX 0x10008
|
|
||||||
#define SAVED_ES 0x1000c
|
|
||||||
#define SAVED_FLAGS 0x10010
|
|
||||||
// we're overwriting the start of our boot loader to hold some
|
// we're overwriting the start of our boot loader to hold some
|
||||||
// temporary values - the first 1024 bytes of it are used at
|
// temporary values - the first 1024 bytes of it are used at
|
||||||
// startup only, and we avoid some linking issues this way
|
// startup only, and we avoid some linking issues this way
|
||||||
@@ -33,76 +29,64 @@
|
|||||||
.code32
|
.code32
|
||||||
|
|
||||||
|
|
||||||
/** void call_pxe_bios(...)
|
/** uint16 call_pxe_bios(void *pxe, uint16 opcode, void *param)
|
||||||
* Does a call to the PXE BIOS functions in real mode.
|
* Does a call to the PXE BIOS functions in real mode.
|
||||||
|
* Both pxe and param must be as linear pointer in lower 1 MB,
|
||||||
|
* pxe is the pointer to the !PXE structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FUNCTION(call_pxe_bios)
|
FUNCTION(call_pxe_bios)
|
||||||
|
|
||||||
pushal
|
pushal
|
||||||
pushfl
|
pushfl
|
||||||
|
|
||||||
// make sure the correct IDT is in place
|
// make sure the correct IDT is in place
|
||||||
lidt idt_descriptor
|
lidt idt_descriptor
|
||||||
|
|
||||||
// get the interrupt vector and patch the instruction at the target address
|
// !PXE
|
||||||
movl 40(%esp), %eax
|
movl 40(%esp), %eax
|
||||||
|
// entry point SEG:OFS
|
||||||
|
movl 0x10(%eax), %ebx
|
||||||
|
|
||||||
// Fills registers from the passed in structure
|
// opcode
|
||||||
// Since switch_to_real_mode() clobbers %eax, we have to handle
|
movl 44(%esp), %ecx
|
||||||
// it specially here (by temporarily storing it to an arbitrary
|
|
||||||
// memory location, SAVED_EAX)
|
|
||||||
movl 44(%esp), %ebp
|
|
||||||
|
|
||||||
movl (%ebp), %eax
|
// param
|
||||||
movl %eax, SAVED_EAX
|
movl 48(%esp), %edx
|
||||||
movl 4(%ebp), %ebx
|
|
||||||
movl 8(%ebp), %ecx
|
|
||||||
movl 12(%ebp), %edx
|
|
||||||
movl 16(%ebp), %esi
|
|
||||||
movl 20(%ebp), %edi
|
|
||||||
movw 24(%ebp), %ax
|
|
||||||
movw %ax, SAVED_ES
|
|
||||||
|
|
||||||
call switch_to_real_mode
|
call switch_to_real_mode
|
||||||
|
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
// restore %eax and %es from saved location
|
// SEG param
|
||||||
movl (SAVED_EAX - 0x10000), %eax
|
movl %edx, %eax
|
||||||
movw (SAVED_ES - 0x10000), %es
|
shrl $4, %eax
|
||||||
|
pushw %ax
|
||||||
|
|
||||||
// call the PXE hook
|
// OFS param
|
||||||
|
andw $0xf, %dx
|
||||||
|
pushw %dx
|
||||||
|
|
||||||
|
// opcode
|
||||||
|
pushw %cx
|
||||||
|
|
||||||
|
// call PXE entry point
|
||||||
|
call * %ebx
|
||||||
|
|
||||||
// we're interested in the flags state as well
|
addw $6, %sp
|
||||||
pushf
|
|
||||||
|
|
||||||
// save %eax from the call
|
// save %ax from the call
|
||||||
movl %eax, (SAVED_EAX - 0x10000)
|
xorl %ebx, %ebx
|
||||||
|
movw %ax, %bx
|
||||||
// save flags from the call
|
movl %ebx, (SAVED_EAX - 0x10000)
|
||||||
pop %ax
|
|
||||||
movw %ax, (SAVED_FLAGS - 0x10000)
|
|
||||||
|
|
||||||
// back to protected mode
|
// back to protected mode
|
||||||
call switch_to_protected_mode
|
call switch_to_protected_mode
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
// store the register state into the structure that has been passed in
|
|
||||||
movl 44(%esp), %eax
|
|
||||||
|
|
||||||
movl %ebx, 4(%eax)
|
|
||||||
movl %ecx, 8(%eax)
|
|
||||||
movl %edx, 12(%eax)
|
|
||||||
movl %esi, 16(%eax)
|
|
||||||
movl %edi, 20(%eax)
|
|
||||||
movl SAVED_EAX, %ecx // special handling for %eax and flags
|
|
||||||
movl %ecx, (%eax)
|
|
||||||
movw SAVED_FLAGS, %cx
|
|
||||||
movw %cx, 26(%eax)
|
|
||||||
|
|
||||||
popfl
|
popfl
|
||||||
popal
|
popal
|
||||||
|
|
||||||
|
movl SAVED_EAX, %eax
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|||||||
@@ -3,4 +3,6 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
extern "C" uint16 call_pxe_bios(void *pxe, uint16 opcode, void *param);
|
||||||
|
|
||||||
void pxe_undi_init();
|
void pxe_undi_init();
|
||||||
|
|||||||
Reference in New Issue
Block a user