]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
x86, setup: Allow global variables and functions in the decompressor
authorH. Peter Anvin <hpa@linux.intel.com>
Mon, 2 Aug 2010 22:34:44 +0000 (15:34 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Mon, 2 Aug 2010 22:34:44 +0000 (15:34 -0700)
In order for global variables and functions to work in the
decompressor, we need to fix up the GOT in assembly code.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
LKML-Reference: <4C57382E.8050501@zytor.com>

arch/x86/boot/compressed/head_32.S
arch/x86/boot/compressed/head_64.S
arch/x86/boot/compressed/vmlinux.lds.S

index f543b70ffae25b24e89c15bc03b17576124efc7b..67a655a39ce43d3da454b7fd8f230b70d8a9c6bc 100644 (file)
@@ -123,6 +123,19 @@ relocated:
        shrl    $2, %ecx
        rep     stosl
 
+/*
+ * Adjust our own GOT
+ */
+       leal    _got(%ebx), %edx
+       leal    _egot(%ebx), %ecx
+1:
+       cmpl    %ecx, %edx
+       jae     2f
+       addl    %ebx, (%edx)
+       addl    $4, %edx
+       jmp     1b
+2:
+
 /*
  * Do the decompression, and jump to the new kernel..
  */
index faff0dc9c06a2389a405cdcb3e089baf8c7ad285..52f85a196fa033df961d20349ce6b7437409e843 100644 (file)
@@ -279,6 +279,19 @@ relocated:
        shrq    $3, %rcx
        rep     stosq
 
+/*
+ * Adjust our own GOT
+ */
+       leaq    _got(%rip), %rdx
+       leaq    _egot(%rip), %rcx
+1:
+       cmpq    %rcx, %rdx
+       jae     2f
+       addq    %rbx, (%rdx)
+       addq    $8, %rdx
+       jmp     1b
+2:
+       
 /*
  * Do the decompression, and jump to the new kernel..
  */
index 5ddabceee12408d55f22b6412bbd4617dc684c55..34d047c982848439e7ed907cbea7b4398bf860cd 100644 (file)
@@ -41,6 +41,12 @@ SECTIONS
                *(.rodata.*)
                _erodata = . ;
        }
+       .got : {
+               _got = .;
+               KEEP(*(.got.plt))
+               KEEP(*(.got))
+               _egot = .;
+       }
        .data : {
                _data = . ;
                *(.data)