Browse Source

[librm] Simplify definitions for prot_call() and real_call() stack frames

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
adac4b1984
1 changed files with 17 additions and 14 deletions
  1. 17
    14
      src/arch/x86/transitions/librm.S

+ 17
- 14
src/arch/x86/transitions/librm.S View File

390
  *      void pxe_api_call ( struct i386_all_regs *ix86 );
390
  *      void pxe_api_call ( struct i386_all_regs *ix86 );
391
  ****************************************************************************
391
  ****************************************************************************
392
  */
392
  */
393
-
394
-#define PC_OFFSET_GDT ( 0 )
395
-#define PC_OFFSET_IDT ( PC_OFFSET_GDT + 6 )
396
-#define PC_OFFSET_IX86 ( PC_OFFSET_IDT + 6 )
397
-#define PC_OFFSET_RETADDR ( PC_OFFSET_IX86 + SIZEOF_I386_ALL_REGS )
398
-#define PC_OFFSET_FUNCTION ( PC_OFFSET_RETADDR + 4 )
399
-#define PC_OFFSET_END ( PC_OFFSET_FUNCTION + 4 )
393
+	.struct	0
394
+PC_OFFSET_GDT:		.space	6
395
+PC_OFFSET_IDT:		.space	6
396
+PC_OFFSET_IX86:		.space	SIZEOF_I386_ALL_REGS
397
+PC_OFFSET_RETADDR:	.space	4
398
+PC_OFFSET_FUNCTION:	.space	4
399
+PC_OFFSET_END:
400
+	.previous
400
 
401
 
401
 	.section ".text16.prot_call", "ax", @progbits
402
 	.section ".text16.prot_call", "ax", @progbits
402
 	.code16
403
 	.code16
478
  * Returns: none
479
  * Returns: none
479
  ****************************************************************************
480
  ****************************************************************************
480
  */
481
  */
481
-
482
-#define RC_OFFSET_PRESERVE_REGS ( 0 )
483
-#define RC_OFFSET_RETADDR ( RC_OFFSET_PRESERVE_REGS + SIZEOF_I386_REGS )
484
-#define RC_OFFSET_FUNCTION ( RC_OFFSET_RETADDR + 4 )
485
-#define RC_OFFSET_END ( RC_OFFSET_FUNCTION + 4 )
482
+	.struct	0
483
+RC_OFFSET_REGS:		.space	SIZEOF_I386_REGS
484
+RC_OFFSET_REGS_END:
485
+RC_OFFSET_RETADDR:	.space	4
486
+RC_OFFSET_FUNCTION:	.space	4
487
+RC_OFFSET_END:
488
+	.previous
486
 
489
 
487
 	.section ".text.real_call", "ax", @progbits
490
 	.section ".text.real_call", "ax", @progbits
488
 	.code32
491
 	.code32
493
 	pushl	RC_OFFSET_FUNCTION(%esp)
496
 	pushl	RC_OFFSET_FUNCTION(%esp)
494
 
497
 
495
 	/* Switch to real mode and move register dump to RM stack  */
498
 	/* Switch to real mode and move register dump to RM stack  */
496
-	movl	$( RC_OFFSET_RETADDR + 4 /* function pointer copy */ ), %ecx
499
+	movl	$( RC_OFFSET_REGS_END + 4 /* function pointer copy */ ), %ecx
497
 	pushl	$rc_rmode
500
 	pushl	$rc_rmode
498
 	movl	$rm_default_gdtr_idtr, %esi
501
 	movl	$rm_default_gdtr_idtr, %esi
499
 	jmp	prot_to_real
502
 	jmp	prot_to_real
510
 	cld
513
 	cld
511
 
514
 
512
 	/* Switch to protected mode and move register dump back to PM stack */
515
 	/* Switch to protected mode and move register dump back to PM stack */
513
-	movl	$RC_OFFSET_RETADDR, %ecx
516
+	movl	$RC_OFFSET_REGS_END, %ecx
514
 	pushl	$rc_pmode
517
 	pushl	$rc_pmode
515
 	jmp	real_to_prot
518
 	jmp	real_to_prot
516
 	.section ".text.real_call", "ax", @progbits
519
 	.section ".text.real_call", "ax", @progbits

Loading…
Cancel
Save