* 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 );
}
}
#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 */
*
*/
-/* 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.
*/
#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 */
}
* 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.
} 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 );
}
* 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
*
/* 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 );
}
*
* 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:
* 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 );
****************************************************************************
*/
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 */
/* 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
*
* 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
* 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
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
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 */
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
* 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 ();
* 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;
}
/*