[libflat] Remove now-obsolete flatten_real_mode call
Flat real mode will have been set up as a side-effect of the protected-mode call invoked during install_block() for .text16.early; there is no need to do so explicitly. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
a84e15234a
commit
7f2d0f12ad
|
@ -649,7 +649,10 @@ install_prealloc:
|
|||
popl %esi
|
||||
|
||||
#ifndef KEEP_IT_REAL
|
||||
/* Access high memory */
|
||||
/* Access high memory by enabling the A20 gate. (We will
|
||||
* already have 4GB segment limits as a result of calling
|
||||
* install_block.)
|
||||
*/
|
||||
pushw %cs
|
||||
pushw $1f
|
||||
pushw %ax
|
||||
|
|
|
@ -21,124 +21,6 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
|||
|
||||
.arch i386
|
||||
|
||||
#define CR0_PE 1
|
||||
|
||||
/****************************************************************************
|
||||
* flatten_real_mode
|
||||
*
|
||||
* Set up 4GB segment limits
|
||||
*
|
||||
* Parameters:
|
||||
* none
|
||||
* Returns:
|
||||
* none
|
||||
* Corrupts:
|
||||
* none
|
||||
****************************************************************************
|
||||
*/
|
||||
/* GDT for protected-mode calls */
|
||||
.section ".text16.early.data", "aw", @progbits
|
||||
.align 16
|
||||
flatten_gdt:
|
||||
flatten_gdt_limit: .word flatten_gdt_length - 1
|
||||
flatten_gdt_base: .long 0
|
||||
.word 0 /* padding */
|
||||
flatten_cs: /* 16-bit protected-mode flat code segment */
|
||||
.equ FLAT_CS, flatten_cs - flatten_gdt
|
||||
.word 0xffff, 0
|
||||
.byte 0, 0x9b, 0x8f, 0
|
||||
flatten_ss: /* 16-bit protected-mode flat stack segment */
|
||||
.equ FLAT_SS, flatten_ss - flatten_gdt
|
||||
.word 0xffff, 0
|
||||
.byte 0, 0x93, 0x8f, 0
|
||||
flatten_gdt_end:
|
||||
.equ flatten_gdt_length, . - flatten_gdt
|
||||
.size flatten_gdt, . - flatten_gdt
|
||||
|
||||
.section ".text16.early.data", "aw", @progbits
|
||||
.align 16
|
||||
flatten_saved_gdt:
|
||||
.long 0, 0
|
||||
.size flatten_saved_gdt, . - flatten_saved_gdt
|
||||
|
||||
.section ".text16.early", "awx", @progbits
|
||||
.code16
|
||||
flatten_real_mode:
|
||||
/* Preserve registers and flags */
|
||||
pushfl
|
||||
pushl %eax
|
||||
pushw %si
|
||||
pushw %gs
|
||||
pushw %fs
|
||||
pushw %es
|
||||
pushw %ds
|
||||
pushw %ss
|
||||
|
||||
/* Set %ds for access to .text16.early.data variables */
|
||||
pushw %cs
|
||||
popw %ds
|
||||
|
||||
/* Preserve original GDT */
|
||||
sgdt flatten_saved_gdt
|
||||
|
||||
/* Set up GDT bases */
|
||||
xorl %eax, %eax
|
||||
movw %cs, %ax
|
||||
shll $4, %eax
|
||||
addl $flatten_gdt, %eax
|
||||
movl %eax, flatten_gdt_base
|
||||
movw %cs, %ax
|
||||
movw $flatten_cs, %si
|
||||
call set_seg_base
|
||||
movw %ss, %ax
|
||||
movw $flatten_ss, %si
|
||||
call set_seg_base
|
||||
|
||||
/* Switch temporarily to protected mode and set segment registers */
|
||||
pushw %cs
|
||||
pushw $2f
|
||||
cli
|
||||
data32 lgdt flatten_gdt
|
||||
movl %cr0, %eax
|
||||
orb $CR0_PE, %al
|
||||
movl %eax, %cr0
|
||||
ljmp $FLAT_CS, $1f
|
||||
1: movw $FLAT_SS, %ax
|
||||
movw %ax, %ss
|
||||
movw %ax, %ds
|
||||
movw %ax, %es
|
||||
movw %ax, %fs
|
||||
movw %ax, %gs
|
||||
movl %cr0, %eax
|
||||
andb $0!CR0_PE, %al
|
||||
movl %eax, %cr0
|
||||
lret
|
||||
2: /* lret will ljmp to here */
|
||||
|
||||
/* Restore GDT, registers and flags */
|
||||
data32 lgdt flatten_saved_gdt
|
||||
popw %ss
|
||||
popw %ds
|
||||
popw %es
|
||||
popw %fs
|
||||
popw %gs
|
||||
popw %si
|
||||
popl %eax
|
||||
popfl
|
||||
ret
|
||||
.size flatten_real_mode, . - flatten_real_mode
|
||||
|
||||
.section ".text16.early", "awx", @progbits
|
||||
.code16
|
||||
set_seg_base:
|
||||
rolw $4, %ax
|
||||
movw %ax, 2(%si)
|
||||
andw $0xfff0, 2(%si)
|
||||
movb %al, 4(%si)
|
||||
andb $0x0f, 4(%si)
|
||||
ret
|
||||
.size set_seg_base, . - set_seg_base
|
||||
|
||||
/****************************************************************************
|
||||
* test_a20_short, test_a20_long
|
||||
*
|
||||
|
@ -403,7 +285,7 @@ enable_a20_method:
|
|||
/****************************************************************************
|
||||
* access_highmem (real mode far call)
|
||||
*
|
||||
* Open up access to high memory in flat real mode with A20 enabled
|
||||
* Open up access to high memory with A20 enabled
|
||||
*
|
||||
* Parameters:
|
||||
* none
|
||||
|
@ -419,7 +301,5 @@ enable_a20_method:
|
|||
access_highmem:
|
||||
/* Enable A20 line */
|
||||
call enable_a20
|
||||
/* Set up 4GB limits */
|
||||
call flatten_real_mode
|
||||
lret
|
||||
.size access_highmem, . - access_highmem
|
||||
|
|
Reference in New Issue