📄 mca_asm.s
字号:
st8 [r2]=r3 add r2=8*62,r2 //padding// save RRs mov ar.lc=0x08-1 movl r4=0x00;;cStRR: mov r3=rr[r4];; st8 [r2]=r3,8 add r4=1,r4 br.cloop.sptk.few cStRR ;;end_os_mca_dump: br ia64_os_mca_done_dump;;//EndStub////////////////////////////////////////////////////////////////////////++// Name:// ia64_os_mca_proc_state_restore()//// Stub Description://// This is a stub to restore the saved processor state during MCHK////--ia64_os_mca_proc_state_restore:// Restore bank1 GR16-31 movl r2=ia64_mca_proc_state_dump // Convert virtual address ;; // of OS state dump area DATA_VA_TO_PA(r2) // to physical addressrestore_GRs: // restore bank-1 GRs 16-31 bsw.1;; add r3=16*8,r2;; // to get to NaT of GR 16-31 ld8 r3=[r3];; mov ar.unat=r3;; // first restore NaT ld8.fill r16=[r2],8;; ld8.fill r17=[r2],8;; ld8.fill r18=[r2],8;; ld8.fill r19=[r2],8;; ld8.fill r20=[r2],8;; ld8.fill r21=[r2],8;; ld8.fill r22=[r2],8;; ld8.fill r23=[r2],8;; ld8.fill r24=[r2],8;; ld8.fill r25=[r2],8;; ld8.fill r26=[r2],8;; ld8.fill r27=[r2],8;; ld8.fill r28=[r2],8;; ld8.fill r29=[r2],8;; ld8.fill r30=[r2],8;; ld8.fill r31=[r2],8;; ld8 r3=[r2],8;; // increment to skip NaT bsw.0;;restore_BRs: add r4=8,r2 // duplicate r2 in r4 add r6=2*8,r2;; // duplicate r2 in r4 ld8 r3=[r2],3*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;; mov b0=r3 mov b1=r5 mov b2=r7;; ld8 r3=[r2],3*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;; mov b3=r3 mov b4=r5 mov b5=r7;; ld8 r3=[r2],2*8 ld8 r5=[r4],2*8;; mov b6=r3 mov b7=r5;;restore_CRs: add r4=8,r2 // duplicate r2 in r4 add r6=2*8,r2;; // duplicate r2 in r4 ld8 r3=[r2],8*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;; // 48 byte increments mov cr0=r3 // cr.dcr mov cr1=r5 // cr.itm mov cr2=r7;; // cr.iva ld8 r3=[r2],8*8;; // 64 byte increments// mov cr8=r3 // cr.pta// if PSR.ic=1, reading interruption registers causes an illegal operation fault mov r3=psr;; tbit.nz.unc p6,p0=r3,PSR_IC;; // PSI Valid Log bit pos. test(p6) st8 [r2]=r0,9*8+160 // increment by 232 byte inc.begin_rskip_intr_regs:(p6) br rSkipIntrRegs;; add r4=8,r2 // duplicate r2 in r4 add r6=2*8,r2;; // duplicate r2 in r4 ld8 r3=[r2],3*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;; mov cr16=r3 // cr.ipsr mov cr17=r5 // cr.isr is read only// mov cr18=r7;; // cr.ida (reserved - don't restore) ld8 r3=[r2],3*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;; mov cr19=r3 // cr.iip mov cr20=r5 // cr.idtr mov cr21=r7;; // cr.iitr ld8 r3=[r2],3*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;; mov cr22=r3 // cr.iipa mov cr23=r5 // cr.ifs mov cr24=r7 // cr.iim ld8 r3=[r2],160;; // 160 byte increment mov cr25=r3 // cr.iharSkipIntrRegs: ld8 r3=[r2],168;; // another 168 byte inc. ld8 r3=[r2],40;; // 40 byte increment mov cr66=r3 // cr.lid ld8 r3=[r2],8;;// mov cr71=r3 // cr.ivr is read only ld8 r3=[r2],24;; // 24 byte increment mov cr72=r3 // cr.tpr ld8 r3=[r2],168;; // 168 byte inc.// mov cr75=r3 // cr.eoi ld8 r3=[r2],16;; // 16 byte inc.// mov cr96=r3 // cr.irr0 is read only ld8 r3=[r2],16;; // 16 byte inc.// mov cr98=r3 // cr.irr1 is read only ld8 r3=[r2],16;; // 16 byte inc// mov cr100=r3 // cr.irr2 is read only ld8 r3=[r2],16;; // 16b inc.// mov cr102=r3 // cr.irr3 is read only ld8 r3=[r2],16;; // 16 byte inc.// mov cr114=r3 // cr.itv ld8 r3=[r2],8;;// mov cr116=r3 // cr.pmv ld8 r3=[r2],8;;// mov cr117=r3 // cr.lrr0 ld8 r3=[r2],8;;// mov cr118=r3 // cr.lrr1 ld8 r3=[r2],8*10;;// mov cr119=r3 // cr.cmcvrestore_ARs: add r4=8,r2 // duplicate r2 in r4 add r6=2*8,r2;; // duplicate r2 in r4 ld8 r3=[r2],3*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;; mov ar0=r3 // ar.kro mov ar1=r5 // ar.kr1 mov ar2=r7;; // ar.kr2 ld8 r3=[r2],3*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;; mov ar3=r3 // ar.kr3 mov ar4=r5 // ar.kr4 mov ar5=r7;; // ar.kr5 ld8 r3=[r2],10*8 ld8 r5=[r4],10*8 ld8 r7=[r6],10*8;; mov ar6=r3 // ar.kr6 mov ar7=r5 // ar.kr7// mov ar8=r6 // ar.kr8 ;; ld8 r3=[r2],3*8 ld8 r5=[r4],3*8 ld8 r7=[r6],3*8;;// mov ar16=r3 // ar.rsc// mov ar17=r5 // ar.bsp is read only mov ar16=r0 // make sure that RSE is in enforced lazy mode ;; mov ar18=r7;; // ar.bspstore ld8 r9=[r2],8*13;; mov ar19=r9 // ar.rnat mov ar16=r3 // ar.rsc ld8 r3=[r2],8*4;; mov ar32=r3 // ar.ccv ld8 r3=[r2],8*4;; mov ar36=r3 // ar.unat ld8 r3=[r2],8*4;; mov ar40=r3 // ar.fpsr ld8 r3=[r2],160;; // 160// mov ar44=r3 // ar.itc ld8 r3=[r2],8;; mov ar64=r3 // ar.pfs ld8 r3=[r2],8;; mov ar65=r3 // ar.lc ld8 r3=[r2];; mov ar66=r3 // ar.ec add r2=8*62,r2;; // paddingrestore_RRs: mov r5=ar.lc mov ar.lc=0x08-1 movl r4=0x00cStRRr: ld8 r3=[r2],8;;// mov rr[r4]=r3 // what are its access previledges? add r4=1,r4 br.cloop.sptk.few cStRRr ;; mov ar.lc=r5 ;;end_os_mca_restore: br ia64_os_mca_done_restore;;//EndStub////////////////////////////////////////////////////////////////////////++// Name:// ia64_os_mca_tlb_error_check()//// Stub Description://// This stub checks to see if the MCA resulted from a TLB error////--ia64_os_mca_tlb_error_check: // Retrieve sal data structure for uncorrected MCA // Make the ia64_sal_get_state_info() call movl r4=ia64_mca_sal_data_area;; movl r7=ia64_sal;; mov r6=r1 // save gp DATA_VA_TO_PA(r4) // convert to physical address DATA_VA_TO_PA(r7);; // convert to physical address ld8 r7=[r7] // get addr of pdesc from ia64_sal movl r3=SAL_GET_STATE_INFO;; DATA_VA_TO_PA(r7);; // convert to physical address ld8 r8=[r7],8;; // get pdesc function pointer dep r8=0,r8,61,3;; // convert SAL VA to PA ld8 r1=[r7];; // set new (ia64_sal) gp dep r1=0,r1,61,3;; // convert SAL VA to PA mov b6=r8 alloc r5=ar.pfs,8,0,8,0;; // allocate stack frame for SAL call mov out0=r3 // which SAL proc to call mov out1=r0 // error type == MCA mov out2=r0 // null arg mov out3=r4 // data copy area mov out4=r0 // null arg mov out5=r0 // null arg mov out6=r0 // null arg mov out7=r0;; // null arg br.call.sptk.few b0=b6;; mov r1=r6 // restore gp mov ar.pfs=r5;; // restore ar.pfs movl r6=ia64_tlb_functional;; DATA_VA_TO_PA(r6) // needed later cmp.eq p6,p7=r0,r8;; // check SAL call return address(p7) st8 [r6]=r0 // clear tlb_functional flag(p7) br tlb_failure // error; return to SAL // examine processor error log for type of error add r4=40+24,r4;; // parse past record header (length=40) // and section header (length=24) ld4 r4=[r4] // get valid field of processor log mov r5=0xf00;; and r5=r4,r5;; // read bits 8-11 of valid field // to determine if we have a TLB error movl r3=0x1 cmp.eq p6,p7=r0,r5;; // if no TLB failure, set tlb_functional flag(p6) st8 [r6]=r3 // else clear flag(p7) st8 [r6]=r0 // if no TLB failure, continue with normal virtual mode logging(p6) br done_tlb_error_check // else no point in entering virtual mode for loggingtlb_failure: br ia64_os_mca_virtual_end//EndStub//////////////////////////////////////////////////////////////////////// ok, the issue here is that we need to save state information so// it can be useable by the kernel debugger and show regs routines.// In order to do this, our best bet is save the current state (plus// the state information obtain from the MIN_STATE_AREA) into a pt_regs// format. This way we can pass it on in a useable format.////// SAL to OS entry point for INIT on the monarch processor// This has been defined for registration purposes with SAL// as a part of ia64_mca_init.//// When we get here, the following registers have been// set by the SAL for our use//// 1. GR1 = OS INIT GP// 2. GR8 = PAL_PROC physical address// 3. GR9 = SAL_PROC physical address// 4. GR10 = SAL GP (physical)// 5. GR11 = Init Reason// 0 = Received INIT for event other than crash dump switch// 1 = Received wakeup at the end of an OS_MCA corrected machine check// 2 = Received INIT dude to CrashDump switch assertion//// 6. GR12 = Return address to location within SAL_INIT procedureGLOBAL_ENTRY(ia64_monarch_init_handler) // stash the information the SAL passed to os SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(r2) ;;// now we want to save information so we can dump registers SAVE_MIN_WITH_COVER ;; mov r8=cr.ifa mov r9=cr.isr adds r3=8,r2 // set up second base pointer ;; SAVE_REST// ok, enough should be saved at this point to be dangerous, and supply// information for a dump// We need to switch to Virtual mode before hitting the C functions. movl r2=IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN mov r3=psr // get the current psr, minimum enabled at this point ;; or r2=r2,r3 ;; movl r3=IVirtual_Switch ;; mov cr.iip=r3 // short return to set the appropriate bits mov cr.ipsr=r2 // need to do an rfi to set appropriate bits ;; rfi ;;IVirtual_Switch: // // We should now be running virtual // // Let's call the C handler to get the rest of the state info // alloc r14=ar.pfs,0,0,1,0 // now it's safe (must be first in insn group!) ;; // adds out0=16,sp // out0 = pointer to pt_regs ;; br.call.sptk.many rp=ia64_init_handler.ret1:return_from_init: br.sptk return_from_initEND(ia64_monarch_init_handler)//// SAL to OS entry point for INIT on the slave processor// This has been defined for registration purposes with SAL// as a part of ia64_mca_init.//GLOBAL_ENTRY(ia64_slave_init_handler)1: br.sptk 1bEND(ia64_slave_init_handler)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -