Преглед на файлове

[librm] Convert prot_call() to a real-mode near call

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown преди 8 години
родител
ревизия
196f0f2551

+ 0
- 3
src/arch/i386/interface/syslinux/comboot_call.c Целия файл

@@ -661,7 +661,6 @@ void hook_comboot_interrupts ( ) {
661 661
 	__asm__ __volatile__ (
662 662
 		TEXT16_CODE ( "\nint20_wrapper:\n\t"
663 663
 		              "pushl %0\n\t"
664
-		              "pushw %%cs\n\t"
665 664
 		              "call prot_call\n\t"
666 665
 			      "clc\n\t"
667 666
 			      "call patch_cf\n\t"
@@ -673,7 +672,6 @@ void hook_comboot_interrupts ( ) {
673 672
 	__asm__ __volatile__ (
674 673
 		TEXT16_CODE ( "\nint21_wrapper:\n\t"
675 674
 		              "pushl %0\n\t"
676
-		              "pushw %%cs\n\t"
677 675
 		              "call prot_call\n\t"
678 676
 			      "clc\n\t"
679 677
 			      "call patch_cf\n\t"
@@ -685,7 +683,6 @@ void hook_comboot_interrupts ( ) {
685 683
 	__asm__  __volatile__ (
686 684
 		TEXT16_CODE ( "\nint22_wrapper:\n\t"
687 685
 		              "pushl %0\n\t"
688
-		              "pushw %%cs\n\t"
689 686
 		              "call prot_call\n\t"
690 687
 			      "clc\n\t"
691 688
 			      "call patch_cf\n\t"

+ 0
- 1
src/arch/x86/core/dumpregs.c Целия файл

@@ -7,7 +7,6 @@ void __asmcall _dump_regs ( struct i386_all_regs *ix86 ) {
7 7
 		TEXT16_CODE ( ".globl dump_regs\n\t"
8 8
 			      "\ndump_regs:\n\t"
9 9
 			      "pushl $_dump_regs\n\t"
10
-			      "pushw %%cs\n\t"
11 10
 			      "call prot_call\n\t"
12 11
 			      "ret\n\t" ) : : );
13 12
 

+ 0
- 1
src/arch/x86/interface/pcbios/bios_console.c Целия файл

@@ -534,7 +534,6 @@ static void bios_inject_startup ( void ) {
534 534
 			      "cmpb $0, %%cs:bios_inject_lock\n\t"
535 535
 			      "jnz 1f\n\t"
536 536
 			      "pushl %0\n\t"
537
-			      "pushw %%cs\n\t"
538 537
 			      "call prot_call\n\t"
539 538
 			      "\n1:\n\t"
540 539
 			      "popfw\n\t"

+ 0
- 1
src/arch/x86/interface/pcbios/int13.c Целия файл

@@ -1481,7 +1481,6 @@ static void int13_hook_vector ( void ) {
1481 1481
 			     "orb $0, %%al\n\t" 
1482 1482
 			     "stc\n\t"
1483 1483
 			     "pushl %0\n\t"
1484
-			     "pushw %%cs\n\t"
1485 1484
 			     "call prot_call\n\t"
1486 1485
 			     /* Chain if OF not set */
1487 1486
 			     "jo 1f\n\t"

+ 0
- 1
src/arch/x86/interface/pxe/pxe_entry.S Целия файл

@@ -121,7 +121,6 @@ pxenv_null_entry:
121 121
 	.code16
122 122
 pxenv_entry:
123 123
 	pushl	$pxe_api_call
124
-	pushw	%cs
125 124
 	call	prot_call
126 125
 	lret
127 126
 	.size	pxenv_entry, . - pxenv_entry

+ 0
- 1
src/arch/x86/prefix/dskprefix.S Целия файл

@@ -371,7 +371,6 @@ start_runtime:
371 371
 	.section ".text16", "awx", @progbits
372 372
 1:
373 373
 	pushl	$main
374
-	pushw	%cs
375 374
 	call	prot_call
376 375
 
377 376
 	/* Uninstall iPXE */

+ 0
- 1
src/arch/x86/prefix/exeprefix.S Целия файл

@@ -149,7 +149,6 @@ _exe_start:
149 149
 
150 150
 	/* Run iPXE */
151 151
 	pushl	$main
152
-	pushw	%cs
153 152
 	call	prot_call
154 153
 
155 154
 	/* Uninstall iPXE */

+ 0
- 1
src/arch/x86/prefix/hdprefix.S Целия файл

@@ -100,7 +100,6 @@ start_image:
100 100
 	.section ".text16", "awx", @progbits
101 101
 1:
102 102
 	pushl	$main
103
-	pushw	%cs
104 103
 	call	prot_call
105 104
 
106 105
 	/* Uninstall iPXE */

+ 0
- 1
src/arch/x86/prefix/libprefix.S Целия файл

@@ -888,7 +888,6 @@ payload_death_message:
888 888
 	 */
889 889
 	progress "  relocate\n"
890 890
 	pushl	$relocate
891
-	pushw	%cs
892 891
 	call	prot_call
893 892
 
894 893
 	/* Jump back to .prefix segment */

+ 0
- 1
src/arch/x86/prefix/lkrnprefix.S Целия файл

@@ -198,7 +198,6 @@ no_cmd_line:
198 198
 
199 199
 	/* Run iPXE */
200 200
 	pushl	$main
201
-	pushw	%cs
202 201
 	call	prot_call
203 202
 
204 203
 	/* Uninstall iPXE */

+ 0
- 1
src/arch/x86/prefix/nbiprefix.S Целия файл

@@ -67,7 +67,6 @@ _nbi_start:
67 67
 	.section ".text16", "awx", @progbits
68 68
 1:
69 69
 	pushl	$main
70
-	pushw	%cs
71 70
 	call	prot_call
72 71
 
73 72
 	/* Uninstall iPXE */

+ 0
- 1
src/arch/x86/prefix/pxeprefix.S Целия файл

@@ -821,7 +821,6 @@ run_ipxe:
821 821
 
822 822
 	/* Run main program */
823 823
 	pushl	$main
824
-	pushw	%cs
825 824
 	call	prot_call
826 825
 
827 826
 	/* Uninstall iPXE */

+ 0
- 1
src/arch/x86/prefix/romprefix.S Целия файл

@@ -808,7 +808,6 @@ exec:	/* Set %ds = %cs */
808 808
 
809 809
 	/* Call main() */
810 810
 	pushl	$main
811
-	pushw	%cs
812 811
 	call	prot_call
813 812
 
814 813
 	/* Set up flat real mode for return to BIOS */

+ 0
- 1
src/arch/x86/prefix/undiloader.S Целия файл

@@ -46,7 +46,6 @@ undiloader:
46 46
 1:
47 47
 	/* Call UNDI loader C code */
48 48
 	pushl	$pxe_loader_call
49
-	pushw	%cs
50 49
 	call	prot_call
51 50
 
52 51
 1:	/* Restore registers and return */

+ 6
- 6
src/arch/x86/transitions/librm.S Целия файл

@@ -132,7 +132,6 @@ init_librm:
132 132
 
133 133
 	/* Initialise IDT */
134 134
 	pushl	$init_idt
135
-	pushw	%cs
136 135
 	call	prot_call
137 136
 
138 137
 	/* Restore registers */
@@ -358,7 +357,7 @@ rm_gdtr:
358 357
 	.long 0 /* Base */
359 358
 
360 359
 /****************************************************************************
361
- * prot_call (real-mode far call, 16-bit real-mode far return address)
360
+ * prot_call (real-mode near call, 16-bit real-mode near return address)
362 361
  *
363 362
  * Call a specific C function in the protected-mode code.  The
364 363
  * prototype of the C function must be
@@ -384,7 +383,6 @@ rm_gdtr:
384 383
  *
385 384
  * Example usage:
386 385
  *	pushl	$pxe_api_call
387
- *	pushw	%cs
388 386
  *	call	prot_call
389 387
  * to call in to the C function
390 388
  *      void pxe_api_call ( struct i386_all_regs *ix86 );
@@ -394,7 +392,8 @@ rm_gdtr:
394 392
 PC_OFFSET_GDT:		.space	6
395 393
 PC_OFFSET_IDT:		.space	6
396 394
 PC_OFFSET_IX86:		.space	SIZEOF_I386_ALL_REGS
397
-PC_OFFSET_RETADDR:	.space	4
395
+PC_OFFSET_PADDING:	.space	2 /* for alignment */
396
+PC_OFFSET_RETADDR:	.space	2
398 397
 PC_OFFSET_FUNCTION:	.space	4
399 398
 PC_OFFSET_END:
400 399
 	.previous
@@ -404,6 +403,7 @@ PC_OFFSET_END:
404 403
 	.globl prot_call
405 404
 prot_call:
406 405
 	/* Preserve registers, flags and GDT on external RM stack */
406
+	pushfw	/* padding */
407 407
 	pushfl
408 408
 	pushal
409 409
 	pushw	%gs
@@ -455,7 +455,8 @@ pc_rmode:
455 455
 	 */
456 456
 	addr32 movl -20(%esp), %esp
457 457
 	popfl
458
-	lret	$4
458
+	popfw	/* padding */
459
+	ret	$4
459 460
 
460 461
 /****************************************************************************
461 462
  * real_call (protected-mode near call, 32-bit virtual return address)
@@ -554,7 +555,6 @@ flatten_real_mode:
554 555
 	movb	$0x8f, real_ds + 6
555 556
 	/* Call dummy protected-mode function */
556 557
 	pushl	$flatten_dummy
557
-	pushw	%cs
558 558
 	call	prot_call
559 559
 	/* Restore GDT */
560 560
 	movb	$0x00, real_cs + 6

+ 0
- 1
src/arch/x86/transitions/librm_test.c Целия файл

@@ -106,7 +106,6 @@ static void librm_test_exec ( void ) {
106 106
 		__asm__ __volatile__ ( REAL_CODE ( "rdtsc\n\t"
107 107
 						   "movl %k0, %k2\n\t"
108 108
 						   "pushl %k3\n\t"
109
-						   "pushw %%cs\n\t"
110 109
 						   "call prot_call\n\t"
111 110
 						   "rdtsc\n\t" )
112 111
 				       : "=a" ( stopped ), "=d" ( discard_d ),

Loading…
Отказ
Запис