powerpc/64s/exception: merge KVM handler and skip variants
[linux-2.6-block.git] / arch / powerpc / include / asm / exception-64s.h
index 4111888e04d71683549037e8bae597dea31d2c69..d2a5bbeb727d7a730a1488235b925c9584b6c74e 100644 (file)
@@ -436,26 +436,17 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
        .endif
 .endm
 
-.macro KVM_HANDLER area, hsrr, n
+.macro KVM_HANDLER area, hsrr, n, skip
+       .if \skip
+       cmpwi   r10,KVM_GUEST_MODE_SKIP
+       beq     89f
+       .else
        BEGIN_FTR_SECTION_NESTED(947)
        ld      r10,\area+EX_CFAR(r13)
        std     r10,HSTATE_CFAR(r13)
        END_FTR_SECTION_NESTED(CPU_FTR_CFAR,CPU_FTR_CFAR,947)
-       BEGIN_FTR_SECTION_NESTED(948)
-       ld      r10,\area+EX_PPR(r13)
-       std     r10,HSTATE_PPR(r13)
-       END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,948)
-       ld      r10,\area+EX_R10(r13)
-       std     r12,HSTATE_SCRATCH0(r13)
-       sldi    r12,r9,32
-       ori     r12,r12,(\n)
-       /* This reloads r9 before branching to kvmppc_interrupt */
-       __BRANCH_TO_KVM_EXIT(\area, kvmppc_interrupt)
-.endm
+       .endif
 
-.macro KVM_HANDLER_SKIP area, hsrr, n
-       cmpwi   r10,KVM_GUEST_MODE_SKIP
-       beq     89f
        BEGIN_FTR_SECTION_NESTED(948)
        ld      r10,\area+EX_PPR(r13)
        std     r10,HSTATE_PPR(r13)
@@ -466,6 +457,8 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
        ori     r12,r12,(\n)
        /* This reloads r9 before branching to kvmppc_interrupt */
        __BRANCH_TO_KVM_EXIT(\area, kvmppc_interrupt)
+
+       .if \skip
 89:    mtocrf  0x80,r9
        ld      r9,\area+EX_R9(r13)
        ld      r10,\area+EX_R10(r13)
@@ -474,14 +467,13 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
        .else
        b       kvmppc_skip_interrupt
        .endif
+       .endif
 .endm
 
 #else
 .macro KVMTEST hsrr, n
 .endm
-.macro KVM_HANDLER area, hsrr, n
-.endm
-.macro KVM_HANDLER_SKIP area, hsrr, n
+.macro KVM_HANDLER area, hsrr, n, skip
 .endm
 #endif