📄 head.s
字号:
/* * Here is where the ball gets rolling as far as the kernel is concerned. * When control is transferred to _start, the bootload has already * loaded us to the correct address. All that's left to do here is * to set up the kernel's global pointer and jump to the kernel * entry point. * * Copyright (C) 1998-2000 Hewlett-Packard Co * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com> * Copyright (C) 1999 VA Linux Systems * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> * Copyright (C) 1999 Intel Corp. * Copyright (C) 1999 Asit Mallick <Asit.K.Mallick@intel.com> * Copyright (C) 1999 Don Dugger <Don.Dugger@intel.com> */#include <linux/config.h>#include <asm/asmmacro.h>#include <asm/fpu.h>#include <asm/pal.h>#include <asm/offsets.h>#include <asm/processor.h>#include <asm/ptrace.h>#include <asm/system.h> .psr abi64 .psr lsb .lsb .section __special_page_section,"ax" .global empty_zero_pageempty_zero_page: .skip PAGE_SIZE .global swapper_pg_dirswapper_pg_dir: .skip PAGE_SIZE .global empty_bad_pageempty_bad_page: .skip PAGE_SIZE .global empty_bad_pte_tableempty_bad_pte_table: .skip PAGE_SIZE .global empty_bad_pmd_tableempty_bad_pmd_table: .skip PAGE_SIZE .rodatahalt_msg: stringz "Halting kernel\n" .textGLOBAL_ENTRY(_start) UNW(.prologue) UNW(.save rp, r4) // terminate unwind chain with a NULL rp UNW(mov r4=r0) UNW(.body) // set IVT entry point---can't access I/O ports without it movl r3=ia64_ivt ;; mov cr.iva=r3 movl r2=FPSR_DEFAULT ;; srlz.i movl gp=__gp mov ar.fpsr=r2 ;;#ifdef CONFIG_IA64_EARLY_PRINTK mov r3=(6<<8) | (28<<2) movl r2=6<<61 ;; mov rr[r2]=r3 ;; srlz.i ;;#endif#define isAP p2 // are we booting an Application Processor (not the BSP)? // Find the init_task for the currently booting CPU. At poweron, and in // UP mode, cpu_now_booting is 0 movl r3=cpu_now_booting ;; ld4 r3=[r3] movl r2=init_tasks ;; shladd r2=r3,3,r2 ;; ld8 r2=[r2] cmp4.ne isAP,p0=r3,r0 // p9 == true if this is an application processor (ap) ;; // RAW on r2 extr r3=r2,0,61 // r3 == phys addr of task struct ;; // load the "current" pointer (r13) and ar.k6 with the current task mov r13=r2 mov ar.k6=r3 // Physical address ;; /* * Reserve space at the top of the stack for "struct pt_regs". Kernel threads * don't store interesting values in that structure, but the space still needs * to be there because time-critical stuff such as the context switching can * be implemented more efficiently (for example, __switch_to() * always sets the psr.dfh bit of the task it is switching to). */ addl r12=IA64_STK_OFFSET-IA64_PT_REGS_SIZE-16,r2 addl r2=IA64_RBS_OFFSET,r2 // initialize the RSE mov ar.rsc=r0 // place RSE in enforced lazy mode ;; mov ar.bspstore=r2 // establish the new RSE stack ;; loadrs // load zero bytes from the register stack ;; mov ar.rsc=0x3 // place RSE in eager mode ;;#ifdef CONFIG_IA64_EARLY_PRINTK .rodataalive_msg: stringz "I'm alive and well\n" .previous alloc r2=ar.pfs,0,0,2,0 movl out0=alive_msg ;; br.call.sptk.few rp=early_printk1: // force new bundle#endif /* CONFIG_IA64_EARLY_PRINTK */ alloc r2=ar.pfs,8,0,2,0 ;;#ifdef CONFIG_SMP(isAP) br.call.sptk.few rp=smp_callin.ret0:(isAP) br.cond.sptk.few self#endif#undef isAP // This is executed by the bootstrap processor (bsp) only:#ifdef CONFIG_IA64_FW_EMU // initialize PAL & SAL emulator: br.call.sptk.few rp=sys_fw_init.ret1:#endif br.call.sptk.few rp=start_kernel.ret2: addl r2=@ltoff(halt_msg),gp ;; ld8 out0=[r2] br.call.sptk.few b0=console_printself: br.sptk.few self // endless loopEND(_start)GLOBAL_ENTRY(ia64_save_debug_regs) alloc r16=ar.pfs,1,0,0,0 mov r20=ar.lc // preserve ar.lc mov ar.lc=IA64_NUM_DBG_REGS-1 mov r18=0 add r19=IA64_NUM_DBG_REGS*8,in0 ;;1: mov r16=dbr[r18]#if defined(CONFIG_ITANIUM_ASTEP_SPECIFIC) || defined(CONFIG_ITANIUM_BSTEP_SPECIFIC) \ || defined(CONFIG_ITANIUM_C0_SPECIFIC) ;; srlz.d#endif mov r17=ibr[r18] add r18=1,r18 ;; st8.nta [in0]=r16,8 st8.nta [r19]=r17,8 br.cloop.sptk.few 1b ;; mov ar.lc=r20 // restore ar.lc br.ret.sptk.few rpEND(ia64_save_debug_regs)GLOBAL_ENTRY(ia64_load_debug_regs) alloc r16=ar.pfs,1,0,0,0#if !(defined(CONFIG_ITANIUM_ASTEP_SPECIFIC) \ || defined(CONFIG_ITANIUM_B0_SPECIFIC) || defined(CONFIG_ITANIUM_B1_SPECIFIC)) lfetch.nta [in0]#endif mov r20=ar.lc // preserve ar.lc add r19=IA64_NUM_DBG_REGS*8,in0 mov ar.lc=IA64_NUM_DBG_REGS-1 mov r18=-1 ;;1: ld8.nta r16=[in0],8 ld8.nta r17=[r19],8 add r18=1,r18 ;; mov dbr[r18]=r16#if defined(CONFIG_ITANIUM_ASTEP_SPECIFIC) || defined(CONFIG_ITANIUM_BSTEP_SPECIFIC) \ || defined(CONFIG_ITANIUM_C0_SPECIFIC) ;; srlz.d#endif mov ibr[r18]=r17 br.cloop.sptk.few 1b ;; mov ar.lc=r20 // restore ar.lc br.ret.sptk.few rpEND(ia64_load_debug_regs)GLOBAL_ENTRY(__ia64_save_fpu) alloc r2=ar.pfs,1,0,0,0 adds r3=16,in0 ;; stf.spill.nta [in0]=f32,32 stf.spill.nta [ r3]=f33,32 ;; stf.spill.nta [in0]=f34,32 stf.spill.nta [ r3]=f35,32 ;; stf.spill.nta [in0]=f36,32 stf.spill.nta [ r3]=f37,32 ;; stf.spill.nta [in0]=f38,32 stf.spill.nta [ r3]=f39,32 ;; stf.spill.nta [in0]=f40,32 stf.spill.nta [ r3]=f41,32 ;; stf.spill.nta [in0]=f42,32 stf.spill.nta [ r3]=f43,32 ;; stf.spill.nta [in0]=f44,32 stf.spill.nta [ r3]=f45,32 ;; stf.spill.nta [in0]=f46,32 stf.spill.nta [ r3]=f47,32 ;; stf.spill.nta [in0]=f48,32 stf.spill.nta [ r3]=f49,32 ;; stf.spill.nta [in0]=f50,32 stf.spill.nta [ r3]=f51,32 ;; stf.spill.nta [in0]=f52,32 stf.spill.nta [ r3]=f53,32 ;; stf.spill.nta [in0]=f54,32 stf.spill.nta [ r3]=f55,32 ;; stf.spill.nta [in0]=f56,32 stf.spill.nta [ r3]=f57,32 ;; stf.spill.nta [in0]=f58,32 stf.spill.nta [ r3]=f59,32 ;; stf.spill.nta [in0]=f60,32 stf.spill.nta [ r3]=f61,32 ;; stf.spill.nta [in0]=f62,32 stf.spill.nta [ r3]=f63,32 ;; stf.spill.nta [in0]=f64,32 stf.spill.nta [ r3]=f65,32 ;; stf.spill.nta [in0]=f66,32 stf.spill.nta [ r3]=f67,32 ;; stf.spill.nta [in0]=f68,32 stf.spill.nta [ r3]=f69,32 ;; stf.spill.nta [in0]=f70,32 stf.spill.nta [ r3]=f71,32 ;; stf.spill.nta [in0]=f72,32 stf.spill.nta [ r3]=f73,32 ;; stf.spill.nta [in0]=f74,32 stf.spill.nta [ r3]=f75,32 ;; stf.spill.nta [in0]=f76,32 stf.spill.nta [ r3]=f77,32 ;; stf.spill.nta [in0]=f78,32 stf.spill.nta [ r3]=f79,32 ;; stf.spill.nta [in0]=f80,32 stf.spill.nta [ r3]=f81,32 ;; stf.spill.nta [in0]=f82,32 stf.spill.nta [ r3]=f83,32 ;; stf.spill.nta [in0]=f84,32 stf.spill.nta [ r3]=f85,32 ;; stf.spill.nta [in0]=f86,32 stf.spill.nta [ r3]=f87,32 ;; stf.spill.nta [in0]=f88,32 stf.spill.nta [ r3]=f89,32 ;; stf.spill.nta [in0]=f90,32 stf.spill.nta [ r3]=f91,32 ;; stf.spill.nta [in0]=f92,32 stf.spill.nta [ r3]=f93,32 ;; stf.spill.nta [in0]=f94,32 stf.spill.nta [ r3]=f95,32 ;; stf.spill.nta [in0]=f96,32 stf.spill.nta [ r3]=f97,32 ;; stf.spill.nta [in0]=f98,32 stf.spill.nta [ r3]=f99,32 ;; stf.spill.nta [in0]=f100,32 stf.spill.nta [ r3]=f101,32 ;; stf.spill.nta [in0]=f102,32 stf.spill.nta [ r3]=f103,32 ;; stf.spill.nta [in0]=f104,32 stf.spill.nta [ r3]=f105,32 ;; stf.spill.nta [in0]=f106,32 stf.spill.nta [ r3]=f107,32 ;; stf.spill.nta [in0]=f108,32 stf.spill.nta [ r3]=f109,32 ;; stf.spill.nta [in0]=f110,32 stf.spill.nta [ r3]=f111,32 ;; stf.spill.nta [in0]=f112,32 stf.spill.nta [ r3]=f113,32 ;; stf.spill.nta [in0]=f114,32 stf.spill.nta [ r3]=f115,32 ;; stf.spill.nta [in0]=f116,32 stf.spill.nta [ r3]=f117,32 ;; stf.spill.nta [in0]=f118,32 stf.spill.nta [ r3]=f119,32 ;; stf.spill.nta [in0]=f120,32 stf.spill.nta [ r3]=f121,32 ;; stf.spill.nta [in0]=f122,32 stf.spill.nta [ r3]=f123,32 ;; stf.spill.nta [in0]=f124,32 stf.spill.nta [ r3]=f125,32 ;; stf.spill.nta [in0]=f126,32 stf.spill.nta [ r3]=f127,32 br.ret.sptk.few rpEND(__ia64_save_fpu)GLOBAL_ENTRY(__ia64_load_fpu) alloc r2=ar.pfs,1,0,0,0 adds r3=16,in0 ;; ldf.fill.nta f32=[in0],32 ldf.fill.nta f33=[ r3],32 ;; ldf.fill.nta f34=[in0],32 ldf.fill.nta f35=[ r3],32 ;; ldf.fill.nta f36=[in0],32 ldf.fill.nta f37=[ r3],32 ;; ldf.fill.nta f38=[in0],32 ldf.fill.nta f39=[ r3],32 ;; ldf.fill.nta f40=[in0],32 ldf.fill.nta f41=[ r3],32 ;; ldf.fill.nta f42=[in0],32 ldf.fill.nta f43=[ r3],32 ;; ldf.fill.nta f44=[in0],32 ldf.fill.nta f45=[ r3],32 ;; ldf.fill.nta f46=[in0],32 ldf.fill.nta f47=[ r3],32 ;; ldf.fill.nta f48=[in0],32 ldf.fill.nta f49=[ r3],32 ;;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -