📄 vmx_minstate.h
字号:
/* * vmx_minstate.h: * Copyright (c) 2005, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Xuefei Xu (Anthony Xu) (Anthony.xu@intel.com) */#include <linux/config.h>#include <asm/asmmacro.h>#include <asm/fpu.h>#include <asm/mmu_context.h>#include <asm/offsets.h>#include <asm/pal.h>#include <asm/pgtable.h>#include <asm/processor.h>#include <asm/ptrace.h>#include <asm/system.h>#include <asm/vmx_pal_vsa.h>#include <asm/vmx_vpd.h>#include <asm/cache.h>#include "entry.h"#define VMX_MINSTATE_START_SAVE_MIN \(pUStk) mov ar.rsc=0; /* set enforced lazy mode, pl 0, little-endian, loadrs=0 */ \ ;; \(pUStk) mov.m r28=ar.rnat; \(pUStk) addl r22=IA64_RBS_OFFSET,r1; /* compute base of RBS */ \(pKStk) mov r1=sp; /* get sp */ \ ;; \(pUStk) lfetch.fault.excl.nt1 [r22]; \(pUStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1; /* compute base of memory stack */ \(pUStk) mov r23=ar.bspstore; /* save ar.bspstore */ \ ;; \(pUStk) mov ar.bspstore=r22; /* switch to kernel RBS */ \(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1; /* if in kernel mode, use sp (r12) */ \ ;; \(pUStk) mov r18=ar.bsp; \(pUStk) mov ar.rsc=0x3; /* set eager mode, pl 0, little-endian, loadrs=0 */#define VMX_MINSTATE_END_SAVE_MIN \ bsw.1; /* switch back to bank 1 (must be last in insn group) */ \ ;;#define PAL_VSA_SYNC_READ \ /* begin to call pal vps sync_read */ \{ .mii; \(pUStk) add r25=IA64_VPD_BASE_OFFSET, r21; \(pUStk) nop 0x0; \(pUStk) mov r24=ip; \ ;; \}; \{ .mmb; \(pUStk) add r24 = 0x20, r24; \(pUStk) ld8 r25=[r25]; /* read vpd base */ \(pUStk) br.cond.sptk vmx_vps_sync_read; /* call the service */ \ ;; \};#define IA64_CURRENT_REG IA64_KR(CURRENT) /* r21 is reserved for current pointer *///#define VMX_MINSTATE_GET_CURRENT(reg) mov reg=IA64_CURRENT_REG#define VMX_MINSTATE_GET_CURRENT(reg) mov reg=r21/* * VMX_DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves * the minimum state necessary that allows us to turn psr.ic back * on. * * Assumed state upon entry: * psr.ic: off * r31: contains saved predicates (pr) * * Upon exit, the state is as follows: * psr.ic: off * r2 = points to &pt_regs.r16 * r8 = contents of ar.ccv * r9 = contents of ar.csd * r10 = contents of ar.ssd * r11 = FPSR_DEFAULT * r12 = kernel sp (kernel virtual address) * r13 = points to current task_struct (kernel virtual address) * p6 = (psr.vm || isr.ni) * panic if not external interrupt (fault in xen VMM) * p15 = TRUE if psr.i is set in cr.ipsr * predicate registers (other than p2, p3, and p15), b6, r3, r14, r15: * preserved * * Note that psr.ic is NOT turned on by this macro. This is so that * we can pass interruption state as arguments to a handler. */#ifdef CONFIG_VMX_PANIC# define P6_BR_VMX_PANIC (p6)br.spnt.few vmx_panic;#else# define P6_BR_VMX_PANIC /* nothing */#endif#define P6_BR_CALL_PANIC(panic_string) \(p6) movl out0=panic_string; \(p6) br.call.spnt.few b6=panic;#define VMX_DO_SAVE_MIN(COVER,SAVE_IFS,EXTRA,VMX_PANIC) \ mov r27=ar.rsc; /* M */ \ mov r20=r1; /* A */ \ mov r25=ar.unat; /* M */ \ mov r29=cr.ipsr; /* M */ \ mov r26=ar.pfs; /* I */ \ mov r18=cr.isr; \ COVER; /* B;; (or nothing) */ \ ;; \ cmp.eq p6,p0=r0,r0; \ tbit.z pKStk,pUStk=r29,IA64_PSR_VM_BIT; \ tbit.z p0,p15=r29,IA64_PSR_I_BIT; \ ;; \(pUStk) tbit.nz.and p6,p0=r18,IA64_ISR_NI_BIT; \(pUStk)VMX_MINSTATE_GET_CURRENT(r1); \ VMX_PANIC \ /* switch from user to kernel RBS: */ \ ;; \ invala; /* M */ \ SAVE_IFS; \ ;; \ VMX_MINSTATE_START_SAVE_MIN \ adds r17=2*L1_CACHE_BYTES,r1; /* really: biggest cache-line size */ \ adds r16=PT(CR_IPSR),r1; \ ;; \ lfetch.fault.excl.nt1 [r17],L1_CACHE_BYTES; \ st8 [r16]=r29; /* save cr.ipsr */ \ ;; \ lfetch.fault.excl.nt1 [r17]; \ mov r29=b0 \ ;; \ adds r16=PT(R8),r1; /* initialize first base pointer */ \ adds r17=PT(R9),r1; /* initialize second base pointer */ \(pKStk) mov r18=r0; /* make sure r18 isn't NaT */ \ ;; \.mem.offset 0,0; st8.spill [r16]=r8,16; \.mem.offset 8,0; st8.spill [r17]=r9,16; \ ;; \.mem.offset 0,0; st8.spill [r16]=r10,24; \.mem.offset 8,0; st8.spill [r17]=r11,24; \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -