mirror of
https://github.com/ipxe/ipxe
synced 2025-12-12 06:22:01 +03:00
Code segment may not be writable; create the temporary pointer to the GDT
on the stack.
This commit is contained in:
@@ -254,6 +254,7 @@ flatten_real_mode:
|
|||||||
/* Preserve real-mode segment values and temporary registers */
|
/* Preserve real-mode segment values and temporary registers */
|
||||||
pushw %es
|
pushw %es
|
||||||
pushw %ds
|
pushw %ds
|
||||||
|
pushw %bp
|
||||||
pushl %eax
|
pushl %eax
|
||||||
|
|
||||||
/* Set GDT base and load GDT */
|
/* Set GDT base and load GDT */
|
||||||
@@ -261,8 +262,11 @@ flatten_real_mode:
|
|||||||
movw %cs, %ax
|
movw %cs, %ax
|
||||||
shll $4, %eax
|
shll $4, %eax
|
||||||
addl $gdt, %eax
|
addl $gdt, %eax
|
||||||
movl %eax, %cs:gdt_base
|
pushl %eax
|
||||||
lgdt %cs:gdt
|
pushw %cs:gdt_limit
|
||||||
|
movw %sp, %bp
|
||||||
|
lgdt (%bp)
|
||||||
|
addw $6, %sp
|
||||||
|
|
||||||
/* Switch to protected mode */
|
/* Switch to protected mode */
|
||||||
movl %cr0, %eax
|
movl %cr0, %eax
|
||||||
@@ -281,6 +285,7 @@ flatten_real_mode:
|
|||||||
|
|
||||||
/* Restore real-mode segment values and temporary registers */
|
/* Restore real-mode segment values and temporary registers */
|
||||||
popl %eax
|
popl %eax
|
||||||
|
popw %bp
|
||||||
popw %ds
|
popw %ds
|
||||||
popw %es
|
popw %es
|
||||||
ret
|
ret
|
||||||
|
|||||||
Reference in New Issue
Block a user