Commit 5f64ec64 authored by H. Peter Anvin's avatar H. Peter Anvin

x86, boot: stylistic cleanups for boot/compressed/head_32.S

Reformat arch/x86/boot/compressed/head_32.S to be closer to currently
preferred kernel assembly style, that is:

- opcode and operand separated by tab
- operands separated by ", "
- C-style comments

This also makes it more similar to head_64.S.

[ Impact: cleanup, no object code change ]
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent bd2a3698
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
* the page directory. [According to comments etc elsewhere on a compressed * the page directory. [According to comments etc elsewhere on a compressed
* kernel it will end up at 0x1000 + 1Mb I hope so as I assume this. - AC] * kernel it will end up at 0x1000 + 1Mb I hope so as I assume this. - AC]
* *
* Page 0 is deliberately kept safe, since System Management Mode code in * Page 0 is deliberately kept safe, since System Management Mode code in
* laptops may need to access the BIOS data stored there. This is also * laptops may need to access the BIOS data stored there. This is also
* useful for future device drivers that either access the BIOS via VM86 * useful for future device drivers that either access the BIOS via VM86
* mode. * mode.
*/ */
/* /*
* High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
*/ */
.text .text
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/segment.h> #include <asm/segment.h>
...@@ -29,75 +29,80 @@ ...@@ -29,75 +29,80 @@
#include <asm/boot.h> #include <asm/boot.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
.section ".text.head","ax",@progbits .section ".text.head","ax",@progbits
ENTRY(startup_32) ENTRY(startup_32)
cld cld
/* test KEEP_SEGMENTS flag to see if the bootloader is asking /*
* us to not reload segments */ * Test KEEP_SEGMENTS flag to see if the bootloader is asking
testb $(1<<6), BP_loadflags(%esi) * us to not reload segments
jnz 1f */
testb $(1<<6), BP_loadflags(%esi)
jnz 1f
cli cli
movl $(__BOOT_DS),%eax movl $__BOOT_DS, %eax
movl %eax,%ds movl %eax, %ds
movl %eax,%es movl %eax, %es
movl %eax,%fs movl %eax, %fs
movl %eax,%gs movl %eax, %gs
movl %eax,%ss movl %eax, %ss
1: 1:
/* Calculate the delta between where we were compiled to run /*
* Calculate the delta between where we were compiled to run
* at and where we were actually loaded at. This can only be done * at and where we were actually loaded at. This can only be done
* with a short local call on x86. Nothing else will tell us what * with a short local call on x86. Nothing else will tell us what
* address we are running at. The reserved chunk of the real-mode * address we are running at. The reserved chunk of the real-mode
* data at 0x1e4 (defined as a scratch field) are used as the stack * data at 0x1e4 (defined as a scratch field) are used as the stack
* for this calculation. Only 4 bytes are needed. * for this calculation. Only 4 bytes are needed.
*/ */
leal (BP_scratch+4)(%esi), %esp leal (BP_scratch+4)(%esi), %esp
call 1f call 1f
1: popl %ebp 1: popl %ebp
subl $1b, %ebp subl $1b, %ebp
/* %ebp contains the address we are loaded at by the boot loader and %ebx /*
* %ebp contains the address we are loaded at by the boot loader and %ebx
* contains the address where we should move the kernel image temporarily * contains the address where we should move the kernel image temporarily
* for safe in-place decompression. * for safe in-place decompression.
*/ */
#ifdef CONFIG_RELOCATABLE #ifdef CONFIG_RELOCATABLE
movl %ebp, %ebx movl %ebp, %ebx
addl $(CONFIG_PHYSICAL_ALIGN - 1), %ebx addl $(CONFIG_PHYSICAL_ALIGN - 1), %ebx
andl $(~(CONFIG_PHYSICAL_ALIGN - 1)), %ebx andl $(~(CONFIG_PHYSICAL_ALIGN - 1)), %ebx
#else #else
movl $LOAD_PHYSICAL_ADDR, %ebx movl $LOAD_PHYSICAL_ADDR, %ebx
#endif #endif
/* Replace the compressed data size with the uncompressed size */ /* Replace the compressed data size with the uncompressed size */
subl input_len(%ebp), %ebx subl input_len(%ebp), %ebx
movl output_len(%ebp), %eax movl output_len(%ebp), %eax
addl %eax, %ebx addl %eax, %ebx
/* Add 8 bytes for every 32K input block */ /* Add 8 bytes for every 32K input block */
shrl $12, %eax shrl $12, %eax
addl %eax, %ebx addl %eax, %ebx
/* Add 32K + 18 bytes of extra slack */ /* Add 32K + 18 bytes of extra slack */
addl $(32768 + 18), %ebx addl $(32768 + 18), %ebx
/* Align on a 4K boundary */ /* Align on a 4K boundary */
addl $4095, %ebx addl $4095, %ebx
andl $~4095, %ebx andl $~4095, %ebx
/* Copy the compressed kernel to the end of our buffer /*
* Copy the compressed kernel to the end of our buffer
* where decompression in place becomes safe. * where decompression in place becomes safe.
*/ */
pushl %esi pushl %esi
leal _ebss(%ebp), %esi leal _ebss(%ebp), %esi
leal _ebss(%ebx), %edi leal _ebss(%ebx), %edi
movl $(_ebss - startup_32), %ecx movl $(_ebss - startup_32), %ecx
std std
rep rep movsb
movsb
cld cld
popl %esi popl %esi
/* Compute the kernel start address. /*
* Compute the kernel start address.
*/ */
#ifdef CONFIG_RELOCATABLE #ifdef CONFIG_RELOCATABLE
addl $(CONFIG_PHYSICAL_ALIGN - 1), %ebp addl $(CONFIG_PHYSICAL_ALIGN - 1), %ebp
...@@ -109,81 +114,84 @@ ENTRY(startup_32) ...@@ -109,81 +114,84 @@ ENTRY(startup_32)
/* /*
* Jump to the relocated address. * Jump to the relocated address.
*/ */
leal relocated(%ebx), %eax leal relocated(%ebx), %eax
jmp *%eax jmp *%eax
ENDPROC(startup_32) ENDPROC(startup_32)
.section ".text" .text
relocated: relocated:
/* /*
* Clear BSS * Clear BSS
*/ */
xorl %eax,%eax xorl %eax, %eax
leal _edata(%ebx),%edi leal _edata(%ebx), %edi
leal _ebss(%ebx), %ecx leal _ebss(%ebx), %ecx
subl %edi,%ecx subl %edi, %ecx
cld cld
rep rep stosb
stosb
/* /*
* Setup the stack for the decompressor * Setup the stack for the decompressor
*/ */
leal boot_stack_end(%ebx), %esp leal boot_stack_end(%ebx), %esp
/* /*
* Do the decompression, and jump to the new kernel.. * Do the decompression, and jump to the new kernel..
*/ */
movl output_len(%ebx), %eax movl output_len(%ebx), %eax
pushl %eax pushl %eax
# push arguments for decompress_kernel: /* push arguments for decompress_kernel: */
pushl %ebp # output address pushl %ebp /* output address */
movl input_len(%ebx), %eax movl input_len(%ebx), %eax
pushl %eax # input_len pushl %eax /* input_len */
leal input_data(%ebx), %eax leal input_data(%ebx), %eax
pushl %eax # input_data pushl %eax /* input_data */
leal boot_heap(%ebx), %eax leal boot_heap(%ebx), %eax
pushl %eax # heap area pushl %eax /* heap area */
pushl %esi # real mode pointer pushl %esi /* real mode pointer */
call decompress_kernel call decompress_kernel
addl $20, %esp addl $20, %esp
popl %ecx popl %ecx
#if CONFIG_RELOCATABLE #if CONFIG_RELOCATABLE
/* Find the address of the relocations. /*
* Find the address of the relocations.
*/ */
movl %ebp, %edi movl %ebp, %edi
addl %ecx, %edi addl %ecx, %edi
/* Calculate the delta between where vmlinux was compiled to run /*
* Calculate the delta between where vmlinux was compiled to run
* and where it was actually loaded. * and where it was actually loaded.
*/ */
movl %ebp, %ebx movl %ebp, %ebx
subl $LOAD_PHYSICAL_ADDR, %ebx subl $LOAD_PHYSICAL_ADDR, %ebx
jz 2f /* Nothing to be done if loaded at compiled addr. */ jz 2f /* Nothing to be done if loaded at compiled addr. */
/* /*
* Process relocations. * Process relocations.
*/ */
1: subl $4, %edi 1: subl $4, %edi
movl 0(%edi), %ecx movl (%edi), %ecx
testl %ecx, %ecx testl %ecx, %ecx
jz 2f jz 2f
addl %ebx, -__PAGE_OFFSET(%ebx, %ecx) addl %ebx, -__PAGE_OFFSET(%ebx, %ecx)
jmp 1b jmp 1b
2: 2:
#endif #endif
/* /*
* Jump to the decompressed kernel. * Jump to the decompressed kernel.
*/ */
xorl %ebx,%ebx xorl %ebx, %ebx
jmp *%ebp jmp *%ebp
.bss /*
/* Stack and heap for uncompression */ * Stack and heap for uncompression
.balign 4 */
.bss
.balign 4
boot_heap: boot_heap:
.fill BOOT_HEAP_SIZE, 1, 0 .fill BOOT_HEAP_SIZE, 1, 0
boot_stack: boot_stack:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment