Back to home page

LXR

 
 

    


0001 /*
0002  *  linux/arch/sh/boot/compressed/head.S
0003  *
0004  *  Copyright (C) 1999 Stuart Menefy
0005  *  Copyright (C) 2003 SUGIOKA Toshinobu
0006  */
0007 
0008 .text
0009 
0010 #include <asm/page.h>
0011 
0012     .global startup
0013 startup:
0014     /* Load initial status register */
0015     mov.l   init_sr, r1
0016     ldc     r1, sr
0017 
0018     /* Move myself to proper location if necessary */
0019     mova    1f, r0
0020     mov.l   1f, r2
0021     cmp/eq  r2, r0
0022     bt  clear_bss
0023     sub r0, r2
0024     mov.l   bss_start_addr, r0
0025     mov #0xffffffe0, r1
0026     and r1, r0          ! align cache line
0027     mov.l   text_start_addr, r3
0028     mov r0, r1
0029     sub r2, r1
0030 3:
0031     mov.l   @r1, r4
0032     mov.l   @(4,r1), r5
0033     mov.l   @(8,r1), r6
0034     mov.l   @(12,r1), r7
0035     mov.l   @(16,r1), r8
0036     mov.l   @(20,r1), r9
0037     mov.l   @(24,r1), r10
0038     mov.l   @(28,r1), r11
0039     mov.l   r4, @r0
0040     mov.l   r5, @(4,r0)
0041     mov.l   r6, @(8,r0)
0042     mov.l   r7, @(12,r0)
0043     mov.l   r8, @(16,r0)
0044     mov.l   r9, @(20,r0)
0045     mov.l   r10, @(24,r0)
0046     mov.l   r11, @(28,r0)
0047 #ifdef CONFIG_CPU_SH4
0048     ocbwb   @r0
0049 #endif
0050     cmp/hi  r3, r0
0051     add #-32, r0
0052     bt/s    3b
0053      add    #-32, r1
0054     mov.l   2f, r0
0055     jmp @r0
0056      nop
0057 
0058     .align 2
0059 1:  .long   1b
0060 2:  .long   clear_bss
0061 text_start_addr:
0062     .long   startup
0063 
0064     /* Clear BSS */
0065 clear_bss:
0066     mov.l   end_addr, r1
0067     mov.l   bss_start_addr, r2
0068     mov #0, r0
0069 l1:
0070     mov.l   r0, @-r1
0071     cmp/eq  r1,r2
0072     bf  l1
0073 
0074     /* Set the initial pointer. */
0075     mov.l   init_stack_addr, r0
0076     mov.l   @r0, r15
0077 
0078     /* Decompress the kernel */
0079     mov.l   decompress_kernel_addr, r0
0080     jsr @r0
0081     nop
0082 
0083     /* Jump to the start of the decompressed kernel */
0084     mov.l   kernel_start_addr, r0
0085     jmp @r0
0086     nop
0087     
0088     .align  2
0089 bss_start_addr:
0090     .long   __bss_start
0091 end_addr:
0092     .long   _end
0093 init_sr:
0094     .long   0x500000F0  /* Privileged mode, Bank=0, Block=1, IMASK=0xF */
0095 kexec_magic:
0096     .long   0x400000F0  /* magic used by kexec to parse zImage format */
0097 init_stack_addr:
0098     .long   stack_start
0099 decompress_kernel_addr:
0100     .long   decompress_kernel
0101 kernel_start_addr:
0102 #ifdef CONFIG_32BIT
0103     .long   ___pa(_text+PAGE_SIZE)
0104 #else
0105     .long   _text+PAGE_SIZE
0106 #endif
0107 
0108     .align  9
0109 fake_headers_as_bzImage:
0110     .word   0
0111     .ascii  "HdrS"      ! header signature
0112     .word   0x0202      ! header version number (>= 0x0105)
0113                 ! or else old loadlin-1.5 will fail)
0114     .word   0       ! default_switch
0115     .word   0       ! SETUPSEG
0116     .word   0x1000
0117     .word   0       ! pointing to kernel version string
0118     .byte   0       ! = 0, old one (LILO, Loadlin,
0119                 ! 0xTV: T=0 for LILO
0120                 !       V = version
0121     .byte   1       ! Load flags bzImage=1
0122     .word   0x8000      ! size to move, when setup is not
0123     .long   0x100000    ! 0x100000 = default for big kernel
0124     .long   0       ! address of loaded ramdisk image
0125     .long   0       # its size in bytes