|
@@ -66,15 +66,15 @@ physical_ds: /* 32 bit protected mode data segment, physical addresses */
|
66
|
66
|
.byte 0, 0x93, 0xcf, 0
|
67
|
67
|
|
68
|
68
|
.org gdt + REAL_CS, 0
|
69
|
|
-real_cs: /* 16 bit flat real mode code segment */
|
|
69
|
+real_cs: /* 16 bit real mode code segment */
|
70
|
70
|
.word 0xffff, 0
|
71
|
|
- .byte 0, 0x9b, 0x8f, 0
|
|
71
|
+ .byte 0, 0x9b, 0x00, 0
|
72
|
72
|
|
73
|
73
|
.org gdt + REAL_DS
|
74
|
|
-real_ds: /* 16 bit flat real mode data segment */
|
|
74
|
+real_ds: /* 16 bit real mode data segment */
|
75
|
75
|
.word 0xffff, 0
|
76
|
|
- .byte 0, 0x93, 0x8f, 0
|
77
|
|
-
|
|
76
|
+ .byte 0, 0x93, 0x00, 0
|
|
77
|
+
|
78
|
78
|
gdt_end:
|
79
|
79
|
.equ gdt_length, gdt_end - gdt
|
80
|
80
|
|
|
@@ -506,6 +506,36 @@ real_call:
|
506
|
506
|
.section ".data16", "aw", @progbits
|
507
|
507
|
rc_function: .word 0, 0
|
508
|
508
|
|
|
509
|
+/****************************************************************************
|
|
510
|
+ * flatten_real_mode (real-mode near call)
|
|
511
|
+ *
|
|
512
|
+ * Switch to flat real mode
|
|
513
|
+ *
|
|
514
|
+ ****************************************************************************
|
|
515
|
+ */
|
|
516
|
+ .section ".text16", "ax", @progbits
|
|
517
|
+ .code16
|
|
518
|
+ .globl flatten_real_mode
|
|
519
|
+flatten_real_mode:
|
|
520
|
+ /* Modify GDT to use flat real mode */
|
|
521
|
+ movb $0x8f, real_cs + 6
|
|
522
|
+ movb $0x8f, real_ds + 6
|
|
523
|
+ /* Call dummy protected-mode function */
|
|
524
|
+ pushl $flatten_dummy
|
|
525
|
+ pushw %cs
|
|
526
|
+ call prot_call
|
|
527
|
+ addw $4, %sp
|
|
528
|
+ /* Restore GDT */
|
|
529
|
+ movb $0x00, real_cs + 6
|
|
530
|
+ movb $0x00, real_ds + 6
|
|
531
|
+ /* Return */
|
|
532
|
+ ret
|
|
533
|
+
|
|
534
|
+ .section ".text", "ax", @progbits
|
|
535
|
+ .code32
|
|
536
|
+flatten_dummy:
|
|
537
|
+ ret
|
|
538
|
+
|
509
|
539
|
/****************************************************************************
|
510
|
540
|
* Stored real-mode and protected-mode stack pointers
|
511
|
541
|
*
|