2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
Address in trampolines based on 32-bit registers when compiled with Apple's CC * loader/i386/xnu_helper.S [APPLE_CC]: use 32-bit registers for addresses * loader/i386/linux_trampoline.S [APPLE_CC]: likewise
This commit is contained in:
parent
6c68847712
commit
e93cdc3db1
3 changed files with 45 additions and 0 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Address in trampolines based on 32-bit registers when compiled
|
||||||
|
with Apple's CC
|
||||||
|
|
||||||
|
* loader/i386/xnu_helper.S [APPLE_CC]: use 32-bit registers
|
||||||
|
for addresses
|
||||||
|
* loader/i386/linux_trampoline.S [APPLE_CC]: likewise
|
||||||
|
|
||||||
2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
|
2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Avoid aliases when compiling with Apple's CC for PCBIOS machine
|
Avoid aliases when compiling with Apple's CC for PCBIOS machine
|
||||||
|
|
|
@ -31,6 +31,21 @@ VARIABLE(grub_linux_trampoline_start)
|
||||||
base:
|
base:
|
||||||
pop %rsi
|
pop %rsi
|
||||||
|
|
||||||
|
#ifdef APPLE_CC
|
||||||
|
lea (cont1 - base) (%esi, 1), %rax
|
||||||
|
mov %eax, (jump_vector - base) (%esi, 1)
|
||||||
|
|
||||||
|
lea (gdt - base) (%esi, 1), %rax
|
||||||
|
mov %rax, (gdtaddr - base) (%esi, 1)
|
||||||
|
|
||||||
|
/* Switch to compatibility mode. */
|
||||||
|
|
||||||
|
lidt (idtdesc - base) (%esi, 1)
|
||||||
|
lgdt (gdtdesc - base) (%esi, 1)
|
||||||
|
|
||||||
|
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
|
||||||
|
ljmp *(jump_vector - base) (%esi, 1)
|
||||||
|
#else
|
||||||
lea (cont1 - base) (%rsi, 1), %rax
|
lea (cont1 - base) (%rsi, 1), %rax
|
||||||
mov %eax, (jump_vector - base) (%rsi, 1)
|
mov %eax, (jump_vector - base) (%rsi, 1)
|
||||||
|
|
||||||
|
@ -44,6 +59,8 @@ base:
|
||||||
|
|
||||||
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
|
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
|
||||||
ljmp *(jump_vector - base) (%rsi, 1)
|
ljmp *(jump_vector - base) (%rsi, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
cont1:
|
cont1:
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
|
|
|
@ -94,11 +94,28 @@ VARIABLE(grub_xnu_heap_size)
|
||||||
movsl
|
movsl
|
||||||
|
|
||||||
mov %rax, %rsi
|
mov %rax, %rsi
|
||||||
|
#ifdef APPLE_CC
|
||||||
|
add $(cont0-base), %eax
|
||||||
|
#else
|
||||||
add $(cont0-base), %rax
|
add $(cont0-base), %rax
|
||||||
|
#endif
|
||||||
jmp *%rax
|
jmp *%rax
|
||||||
|
|
||||||
cont0:
|
cont0:
|
||||||
|
#ifdef APPLE_CC
|
||||||
|
lea (cont1 - base) (%esi, 1), %eax
|
||||||
|
mov %eax, (jump_vector - base) (%esi, 1)
|
||||||
|
|
||||||
|
lea (gdt - base) (%esi, 1), %eax
|
||||||
|
mov %eax, (gdt_addr - base) (%esi, 1)
|
||||||
|
|
||||||
|
/* Switch to compatibility mode. */
|
||||||
|
|
||||||
|
lgdt (gdtdesc - base) (%esi, 1)
|
||||||
|
|
||||||
|
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
|
||||||
|
ljmp *(jump_vector - base) (%esi,1)
|
||||||
|
#else
|
||||||
lea (cont1 - base) (%rsi, 1), %rax
|
lea (cont1 - base) (%rsi, 1), %rax
|
||||||
mov %eax, (jump_vector - base) (%rsi, 1)
|
mov %eax, (jump_vector - base) (%rsi, 1)
|
||||||
|
|
||||||
|
@ -111,6 +128,8 @@ cont0:
|
||||||
|
|
||||||
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
|
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
|
||||||
ljmp *(jump_vector - base) (%rsi, 1)
|
ljmp *(jump_vector - base) (%rsi, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
cont1:
|
cont1:
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue