Use LOCAL in relocator

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-23 20:18:10 +01:00
parent d00e2a0b4c
commit 8eea9034f8

View file

@ -48,7 +48,7 @@
RELOCATOR_VARIABLE(start) RELOCATOR_VARIABLE(start)
#ifdef BACKWARD #ifdef BACKWARD
L_base: LOCAL(base):
#endif #endif
cli cli
@ -127,23 +127,23 @@ RELOCATOR_VARIABLE(size)
/* %rax contains now our new 'base'. */ /* %rax contains now our new 'base'. */
mov RAX, RSI mov RAX, RSI
add $(L_cont0 - L_base), RAX add $(LOCAL(cont0) - LOCAL(base)), RAX
jmp *RAX jmp *RAX
L_cont0: LOCAL(cont0):
lea (L_cont1 - L_base) (RSI, 1), RAX lea (LOCAL(cont1) - LOCAL(base)) (RSI, 1), RAX
movl %eax, (L_jump_vector - L_base) (RSI, 1) movl %eax, (LOCAL(jump_vector) - LOCAL(base)) (RSI, 1)
lea (L_gdt - L_base) (RSI, 1), RAX lea (LOCAL(gdt) - LOCAL(base)) (RSI, 1), RAX
mov RAX, (L_gdt_addr - L_base) (RSI, 1) mov RAX, (LOCAL(gdt_addr) - LOCAL(base)) (RSI, 1)
/* Switch to compatibility mode. */ /* Switch to compatibility mode. */
lgdt (L_gdtdesc - L_base) (RSI, 1) lgdt (LOCAL(gdtdesc) - LOCAL(base)) (RSI, 1)
/* Update %cs. Thanks to David Miller for pointing this mistake out. */ /* Update %cs. Thanks to David Miller for pointing this mistake out. */
ljmp *(L_jump_vector - L_base) (RSI, 1) ljmp *(LOCAL(jump_vector) - LOCAL(base)) (RSI, 1)
L_cont1: LOCAL(cont1):
.code32 .code32
/* Update other registers. */ /* Update other registers. */
@ -170,8 +170,8 @@ L_cont1:
andl $GRUB_MEMORY_CPU_CR4_PAE_ON, %eax andl $GRUB_MEMORY_CPU_CR4_PAE_ON, %eax
movl %eax, %cr4 movl %eax, %cr4
jmp L_cont2 jmp LOCAL(cont2)
L_cont2: LOCAL(cont2):
.code32 .code32
/* mov imm32, %eax */ /* mov imm32, %eax */
@ -212,7 +212,7 @@ RELOCATOR_VARIABLE (eip)
/* GDT. Copied from loader/i386/linux.c. */ /* GDT. Copied from loader/i386/linux.c. */
.p2align 4 .p2align 4
L_gdt: LOCAL(gdt):
/* NULL. */ /* NULL. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -226,9 +226,9 @@ L_gdt:
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x92, 0xCF, 0x00 .byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x92, 0xCF, 0x00
.p2align 4 .p2align 4
L_gdtdesc: LOCAL(gdtdesc):
.word 0x27 .word 0x27
L_gdt_addr: LOCAL(gdt_addr):
#ifdef __x86_64__ #ifdef __x86_64__
/* Filled by the code. */ /* Filled by the code. */
.quad 0 .quad 0
@ -238,13 +238,13 @@ L_gdt_addr:
#endif #endif
.p2align 4 .p2align 4
L_jump_vector: LOCAL(jump_vector):
/* Jump location. Is filled by the code */ /* Jump location. Is filled by the code */
.long 0 .long 0
.long CODE_SEGMENT .long CODE_SEGMENT
#ifndef BACKWARD #ifndef BACKWARD
L_base: LOCAL(base):
#endif #endif
RELOCATOR_VARIABLE(end) RELOCATOR_VARIABLE(end)