2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 07:11:32 +00:00

Update to cope with changes in registers.h

This commit is contained in:
Michael Brown 2005-05-20 11:23:51 +00:00
parent 5231b858c9
commit d3dec7c331
9 changed files with 44 additions and 45 deletions

View File

@ -13,20 +13,20 @@
* the prefix requested.
*
*/
void arch_main ( struct i386_all_regs *regs ) {
void (*exit_path) ( struct i386_all_regs *regs );
void arch_main ( struct i386_all_regs *ix86 ) {
void (*exit_path) ( struct i386_all_regs *ix86 );
/* Determine exit path requested by prefix */
exit_path = ( typeof ( exit_path ) ) regs->eax;
exit_path = ( typeof ( exit_path ) ) ix86->regs.eax;
/* Call to main() */
regs->eax = main();
ix86->regs.eax = main();
if ( exit_path ) {
/* Prefix requested that we use a particular function
* as the exit path, so we call this function, which
* must not return.
*/
exit_path ( regs );
exit_path ( ix86 );
}
}

View File

@ -1,6 +1,6 @@
#ifndef HOOKS_H
#define HOOKS_H
extern void arch_main ( struct i386_all_regs *regs );
extern void arch_main ( struct i386_all_regs *ix86 );
#endif /* HOOKS_H */

View File

@ -12,11 +12,6 @@
*
*/
/* All i386 registers, as passed in by prot_call or kir_call */
struct real_mode_regs {
struct i386_all_regs;
} PACKED;
/* Segment:offset structure. Note that the order within the structure
* is offset:segment.
*/

View File

@ -1,13 +1,17 @@
#include "bochs.h"
#include "realmode.h"
/*
* The "exit via INT 19" exit path. INT 19 is the old (pre-BBS) "boot
* system" interrupt.
/**
* The "exit via INT 19" exit path.
*
* INT 19 is the old (pre-BBS) "boot system" interrupt. It is
* conventionally used now to return from a failed boot from floppy
* disk.
*
* @bug Not yet implemented
*
*/
void exit_via_int19 ( struct real_mode_regs *rm_regs ) {
void exit_via_int19 ( struct i386_all_regs *ix86 ) {
bochsbp();
/* Placeholder */
}

View File

@ -11,7 +11,7 @@
* would cause linker symbol pollution.
*
*/
void i386_select_isapnp_device ( struct i386_all_regs *regs ) {
void i386_select_isapnp_device ( struct i386_all_regs *ix86 ) {
/*
* PnP BIOS passes card select number in %bx and read port
* address in %dx.
@ -23,10 +23,10 @@ void i386_select_isapnp_device ( struct i386_all_regs *regs ) {
} u;
/* Set ISAPnP read port */
isapnp_read_port = regs->dx;
isapnp_read_port = ix86->regs.dx;
/* Select ISAPnP bus and specified CSN as first boot device */
memset ( &u, 0, sizeof ( u ) );
u.isapnp_loc.csn = regs->bx;
u.isapnp_loc.csn = ix86->regs.bx;
select_device ( &dev, &isapnp_driver, &u.bus_loc );
}

View File

@ -11,7 +11,7 @@
* that would cause linker symbol pollution.
*
*/
void i386_select_pci_device ( struct i386_all_regs *regs ) {
void i386_select_pci_device ( struct i386_all_regs *ix86 ) {
/*
* PCI BIOS passes busdevfn in %ax
*
@ -23,6 +23,6 @@ void i386_select_pci_device ( struct i386_all_regs *regs ) {
/* Select PCI bus and specified busdevfn as first boot device */
memset ( &u, 0, sizeof ( u ) );
u.pci_loc.busdevfn = regs->ax;
u.pci_loc.busdevfn = ix86->regs.ax;
select_device ( &dev, &pci_driver, &u.bus_loc );
}

View File

@ -135,12 +135,12 @@ kir_to_ext:
*
* Call a specific C function in the internal code. The prototype of
* the C function must be
* void function ( struct real_mode_regs *rm_regs );
* rm_regs will point to a struct containing the real-mode registers
* void function ( struct i386_all_resg *ix86 );
* ix86 will point to a struct containing the real-mode registers
* at entry to kir_call.
*
* All registers will be preserved across kir_call(), unless the C
* function explicitly overwrites values in rm_regs. Interrupt status
* function explicitly overwrites values in ix86. Interrupt status
* will also be preserved.
*
* Parameters:
@ -151,7 +151,7 @@ kir_to_ext:
* lcall $UNDI_CS, $kir_call
* addw $2, %sp
* to call in to the C function
* void pxe_api_call ( struct real_mode_regs *rm_regs );
* void pxe_api_call ( struct i386_all_regs *ix86 );
****************************************************************************
*/
@ -190,7 +190,7 @@ kir_call:
pushl %cs:ext_ds_and_es
pushl %cs:ext_cs_and_ss
/* Push &rm_regs on stack and call function */
/* Push &ix86 on stack and call function */
pushl %esp
data32 call *%cs:save_function
popl %eax /* discard */

View File

@ -106,11 +106,11 @@
/* Size of various C data structures */
#define SIZEOF_I386_SEG_REGS 12
#define SIZEOF_I386_REGS 32
#define SIZEOF_I386_ALL_REGS ( SIZEOF_I386_SEG_REGS + SIZEOF_I386_REGS )
#define SIZEOF_REAL_MODE_REGS ( SIZEOF_I386_SEG_REGS + SIZEOF_I386_REGS )
#define SIZEOF_I386_FLAGS 4
#define SIZEOF_REAL_MODE_REGS ( SIZEOF_I386_ALL_REGS + SIZEOF_I386_FLAGS )
#define SIZEOF_I386_ALL_REGS ( SIZEOF_REAL_MODE_REGS + SIZEOF_I386_FLAGS )
#define SIZEOF_SEGOFF_T 4
#define SIZEOF_REAL_CALL_PARAMS ( SIZEOF_I386_ALL_REGS + 2 * SIZEOF_SEGOFF_T )
#define SIZEOF_REAL_CALL_PARAMS ( SIZEOF_REAL_MODE_REGS + 2 * SIZEOF_SEGOFF_T )
.text
.arch i386
@ -461,12 +461,12 @@ p2r_ljmp:
*
* Call a specific C function in the protected-mode code. The
* prototype of the C function must be
* void function ( struct real_mode_regs *rm_regs );
* rm_regs will point to a struct containing the real-mode registers
* void function ( struct i386_all_regs *ix86 );
* ix86 will point to a struct containing the real-mode registers
* at entry to prot_call.
*
* All registers will be preserved across prot_call(), unless the C
* function explicitly overwrites values in rm_regs. Interrupt status
* function explicitly overwrites values in ix86. Interrupt status
* will also be preserved. Gate A20 will be enabled.
*
* The protected-mode code may install librm to a new location. If it
@ -495,12 +495,12 @@ p2r_ljmp:
* lcall $LIBRM_SEGMENT, $prot_call
* addw $4, %sp
* to call in to the C function
* void pxe_api_call ( struct real_mode_regs *rm_regs );
* void pxe_api_call ( struct i386_all_regs *ix86 );
****************************************************************************
*/
#define PC_OFFSET_RM_REGS ( 0 )
#define PC_OFFSET_RETADDR ( PC_OFFSET_RM_REGS + SIZEOF_REAL_MODE_REGS )
#define PC_OFFSET_IX86 ( 0 )
#define PC_OFFSET_RETADDR ( PC_OFFSET_IX86 + SIZEOF_I386_ALL_REGS )
#define PC_OFFSET_FUNCTION ( PC_OFFSET_RETADDR + 4 )
.code16
@ -534,14 +534,14 @@ EXPORT(prot_call):
call real_to_prot
.code32
/* Copy rm_regs from RM stack to PM stack */
movl $SIZEOF_REAL_MODE_REGS, %ecx
/* Copy ix86 from RM stack to PM stack */
movl $SIZEOF_I386_ALL_REGS, %ecx
subl %ecx, %esp
movl %esp, %edi
pushl %esi
cld
rep movsb
popl %edi /* %edi = phys addr of RM copy of rm_regs */
popl %edi /* %edi = phys addr of RM copy of ix86 */
/* Switch to virtual addresses. */
call 1f
@ -555,7 +555,7 @@ EXPORT(prot_call):
popl %eax /* discard */
popal
/* Push &rm_regs on the stack, and call function */
/* Push &ix86 on the stack, and call function */
pushl %esp
call *%ebx
popl %eax /* discard */
@ -564,16 +564,16 @@ EXPORT(prot_call):
lcall $VIRTUAL_CS, $_virt_to_phys
popl %eax /* discard */
/* Copy rm_regs from PM stack to RM stack, and remove rm_regs
/* Copy ix86 from PM stack to RM stack, and remove ix86
* from PM stack. (%edi still contains physical address of
* rm_regs on RM stack from earlier, since C code preserves
* ix86 on RM stack from earlier, since C code preserves
* %edi).
*/
movl %esp, %esi
movl $SIZEOF_REAL_MODE_REGS, %ecx
movl $SIZEOF_I386_ALL_REGS, %ecx
cld
rep movsb
movl %esi, %esp /* remove rm_regs from PM stack */
movl %esi, %esp /* remove ix86 from PM stack */
/* Obtain physical base address of installed copy of librm in
* %ebx. (It's possible that this *isn't* the physical base

View File

@ -139,7 +139,7 @@ POST_RELOC_FN ( POST_RELOC_LIBRM, librm_post_reloc );
* pointer to this new librm's entry point via es:di.
*
*/
void initialise_via_librm ( struct i386_all_regs *regs ) {
void initialise_via_librm ( struct i386_all_regs *ix86 ) {
/* Hand off to initialise() */
initialise ();
@ -147,7 +147,7 @@ void initialise_via_librm ( struct i386_all_regs *regs ) {
* already set up by setup16, so all we need to do is point
* es:0000 to the start of the new librm.
*/
regs->es = librm_base >> 4;
ix86->segs.es = librm_base >> 4;
}
/*