0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <linux/init.h>
0017 #include <linux/threads.h>
0018
0019 #include <asm/addrspace.h>
0020 #include <asm/asm.h>
0021 #include <asm/asmmacro.h>
0022 #include <asm/irqflags.h>
0023 #include <asm/regdef.h>
0024 #include <asm/mipsregs.h>
0025 #include <asm/stackframe.h>
0026
0027 #include <kernel-entry-init.h>
0028
0029
0030
0031
0032
0033
0034
0035 .macro setup_c0_status set clr
0036 .set push
0037 mfc0 t0, CP0_STATUS
0038 or t0, ST0_KERNEL_CUMASK|\set|0x1f|\clr
0039 xor t0, 0x1f|\clr
0040 mtc0 t0, CP0_STATUS
0041 .set noreorder
0042 sll zero,3 # ehb
0043 .set pop
0044 .endm
0045
0046 .macro setup_c0_status_pri
0047 #ifdef CONFIG_64BIT
0048 setup_c0_status ST0_KX 0
0049 #else
0050 setup_c0_status 0 0
0051 #endif
0052 .endm
0053
0054 .macro setup_c0_status_sec
0055 #ifdef CONFIG_64BIT
0056 setup_c0_status ST0_KX ST0_BEV
0057 #else
0058 setup_c0_status 0 ST0_BEV
0059 #endif
0060 .endm
0061
0062 #ifndef CONFIG_NO_EXCEPT_FILL
0063
0064
0065
0066
0067 .fill 0x400
0068 #endif
0069
0070 EXPORT(_stext)
0071
0072 #ifdef CONFIG_BOOT_RAW
0073
0074
0075
0076
0077
0078 FEXPORT(__kernel_entry)
0079 j kernel_entry
0080 #endif
0081
0082 __REF
0083
0084 NESTED(kernel_entry, 16, sp) # kernel entry point
0085
0086 kernel_entry_setup # cpu specific setup
0087
0088 setup_c0_status_pri
0089
0090
0091
0092 PTR_LA t0, 0f
0093 jr t0
0094 0:
0095
0096 PTR_LA t0, __bss_start # clear .bss
0097 LONG_S zero, (t0)
0098 PTR_LA t1, __bss_stop - LONGSIZE
0099 1:
0100 PTR_ADDIU t0, LONGSIZE
0101 LONG_S zero, (t0)
0102 bne t0, t1, 1b
0103
0104 LONG_S a0, fw_arg0 # firmware arguments
0105 LONG_S a1, fw_arg1
0106 LONG_S a2, fw_arg2
0107 LONG_S a3, fw_arg3
0108
0109 MTC0 zero, CP0_CONTEXT # clear context register
0110 #ifdef CONFIG_64BIT
0111 MTC0 zero, CP0_XCONTEXT
0112 #endif
0113 PTR_LA $28, init_thread_union
0114
0115 PTR_LI sp, _THREAD_SIZE - 32 - PT_SIZE
0116 PTR_ADDU sp, $28
0117 back_to_back_c0_hazard
0118 set_saved_sp sp, t0, t1
0119 PTR_SUBU sp, 4 * SZREG # init stack pointer
0120
0121 #ifdef CONFIG_RELOCATABLE
0122
0123 jal relocate_kernel
0124
0125
0126 PTR_LI sp, _THREAD_SIZE - 32 - PT_SIZE
0127 PTR_ADDU sp, $28
0128 set_saved_sp sp, t0, t1
0129 PTR_SUBU sp, 4 * SZREG # init stack pointer
0130
0131
0132
0133
0134
0135
0136
0137
0138 jr.hb v0
0139 #else
0140 j start_kernel
0141 #endif
0142 END(kernel_entry)
0143
0144 #ifdef CONFIG_SMP
0145
0146
0147
0148
0149 NESTED(smp_bootstrap, 16, sp)
0150 smp_slave_setup
0151 setup_c0_status_sec
0152 j start_secondary
0153 END(smp_bootstrap)
0154 #endif