linux/arch/s390/kernel/base.S
<<
>>
Prefs
   1/*
   2 *  arch/s390/kernel/base.S
   3 *
   4 *    Copyright IBM Corp. 2006, 2007
   5 *    Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
   6 *               Michael Holzheu <holzheu@de.ibm.com>
   7 */
   8
   9#include <linux/linkage.h>
  10#include <asm/asm-offsets.h>
  11#include <asm/ptrace.h>
  12#include <asm/sigp.h>
  13
  14#ifdef CONFIG_64BIT
  15
  16ENTRY(s390_base_mcck_handler)
  17        basr    %r13,0
  180:      lg      %r15,__LC_PANIC_STACK   # load panic stack
  19        aghi    %r15,-STACK_FRAME_OVERHEAD
  20        larl    %r1,s390_base_mcck_handler_fn
  21        lg      %r1,0(%r1)
  22        ltgr    %r1,%r1
  23        jz      1f
  24        basr    %r14,%r1
  251:      la      %r1,4095
  26        lmg     %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)
  27        lpswe   __LC_MCK_OLD_PSW
  28
  29        .section .bss
  30        .align 8
  31        .globl  s390_base_mcck_handler_fn
  32s390_base_mcck_handler_fn:
  33        .quad   0
  34        .previous
  35
  36ENTRY(s390_base_ext_handler)
  37        stmg    %r0,%r15,__LC_SAVE_AREA_ASYNC
  38        basr    %r13,0
  390:      aghi    %r15,-STACK_FRAME_OVERHEAD
  40        larl    %r1,s390_base_ext_handler_fn
  41        lg      %r1,0(%r1)
  42        ltgr    %r1,%r1
  43        jz      1f
  44        basr    %r14,%r1
  451:      lmg     %r0,%r15,__LC_SAVE_AREA_ASYNC
  46        ni      __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
  47        lpswe   __LC_EXT_OLD_PSW
  48
  49        .section .bss
  50        .align 8
  51        .globl s390_base_ext_handler_fn
  52s390_base_ext_handler_fn:
  53        .quad   0
  54        .previous
  55
  56ENTRY(s390_base_pgm_handler)
  57        stmg    %r0,%r15,__LC_SAVE_AREA_SYNC
  58        basr    %r13,0
  590:      aghi    %r15,-STACK_FRAME_OVERHEAD
  60        larl    %r1,s390_base_pgm_handler_fn
  61        lg      %r1,0(%r1)
  62        ltgr    %r1,%r1
  63        jz      1f
  64        basr    %r14,%r1
  65        lmg     %r0,%r15,__LC_SAVE_AREA_SYNC
  66        lpswe   __LC_PGM_OLD_PSW
  671:      lpswe   disabled_wait_psw-0b(%r13)
  68
  69        .align  8
  70disabled_wait_psw:
  71        .quad   0x0002000180000000,0x0000000000000000 + s390_base_pgm_handler
  72
  73        .section .bss
  74        .align 8
  75        .globl s390_base_pgm_handler_fn
  76s390_base_pgm_handler_fn:
  77        .quad   0
  78        .previous
  79
  80#
  81# Calls diag 308 subcode 1 and continues execution
  82#
  83# The following conditions must be ensured before calling this function:
  84# * Prefix register = 0
  85# * Lowcore protection is disabled
  86#
  87ENTRY(diag308_reset)
  88        larl    %r4,.Lctlregs           # Save control registers
  89        stctg   %c0,%c15,0(%r4)
  90        larl    %r4,.Lfpctl             # Floating point control register
  91        stfpc   0(%r4)
  92        larl    %r4,.Lcontinue_psw      # Save PSW flags
  93        epsw    %r2,%r3
  94        stm     %r2,%r3,0(%r4)
  95        larl    %r4,.Lrestart_psw       # Setup restart PSW at absolute 0
  96        lghi    %r3,0
  97        lg      %r4,0(%r4)              # Save PSW
  98        sturg   %r4,%r3                 # Use sturg, because of large pages
  99        lghi    %r1,1
 100        diag    %r1,%r1,0x308
 101.Lrestart_part2:
 102        lhi     %r0,0                   # Load r0 with zero
 103        lhi     %r1,2                   # Use mode 2 = ESAME (dump)
 104        sigp    %r1,%r0,SIGP_SET_ARCHITECTURE   # Switch to ESAME mode
 105        sam64                           # Switch to 64 bit addressing mode
 106        larl    %r4,.Lctlregs           # Restore control registers
 107        lctlg   %c0,%c15,0(%r4)
 108        larl    %r4,.Lfpctl             # Restore floating point ctl register
 109        lfpc    0(%r4)
 110        larl    %r4,.Lcontinue_psw      # Restore PSW flags
 111        lpswe   0(%r4)
 112.Lcontinue:
 113        br      %r14
 114.align 16
 115.Lrestart_psw:
 116        .long   0x00080000,0x80000000 + .Lrestart_part2
 117
 118        .section .data..nosave,"aw",@progbits
 119.align 8
 120.Lcontinue_psw:
 121        .quad   0,.Lcontinue
 122        .previous
 123
 124        .section .bss
 125.align 8
 126.Lctlregs:
 127        .rept   16
 128        .quad   0
 129        .endr
 130.Lfpctl:
 131        .long   0
 132        .previous
 133
 134#else /* CONFIG_64BIT */
 135
 136ENTRY(s390_base_mcck_handler)
 137        basr    %r13,0
 1380:      l       %r15,__LC_PANIC_STACK   # load panic stack
 139        ahi     %r15,-STACK_FRAME_OVERHEAD
 140        l       %r1,2f-0b(%r13)
 141        l       %r1,0(%r1)
 142        ltr     %r1,%r1
 143        jz      1f
 144        basr    %r14,%r1
 1451:      lm      %r0,%r15,__LC_GPREGS_SAVE_AREA
 146        lpsw    __LC_MCK_OLD_PSW
 147
 1482:      .long   s390_base_mcck_handler_fn
 149
 150        .section .bss
 151        .align 4
 152        .globl  s390_base_mcck_handler_fn
 153s390_base_mcck_handler_fn:
 154        .long   0
 155        .previous
 156
 157ENTRY(s390_base_ext_handler)
 158        stm     %r0,%r15,__LC_SAVE_AREA_ASYNC
 159        basr    %r13,0
 1600:      ahi     %r15,-STACK_FRAME_OVERHEAD
 161        l       %r1,2f-0b(%r13)
 162        l       %r1,0(%r1)
 163        ltr     %r1,%r1
 164        jz      1f
 165        basr    %r14,%r1
 1661:      lm      %r0,%r15,__LC_SAVE_AREA_ASYNC
 167        ni      __LC_EXT_OLD_PSW+1,0xfd # clear wait state bit
 168        lpsw    __LC_EXT_OLD_PSW
 169
 1702:      .long   s390_base_ext_handler_fn
 171
 172        .section .bss
 173        .align 4
 174        .globl  s390_base_ext_handler_fn
 175s390_base_ext_handler_fn:
 176        .long   0
 177        .previous
 178
 179ENTRY(s390_base_pgm_handler)
 180        stm     %r0,%r15,__LC_SAVE_AREA_SYNC
 181        basr    %r13,0
 1820:      ahi     %r15,-STACK_FRAME_OVERHEAD
 183        l       %r1,2f-0b(%r13)
 184        l       %r1,0(%r1)
 185        ltr     %r1,%r1
 186        jz      1f
 187        basr    %r14,%r1
 188        lm      %r0,%r15,__LC_SAVE_AREA_SYNC
 189        lpsw    __LC_PGM_OLD_PSW
 190
 1911:      lpsw    disabled_wait_psw-0b(%r13)
 192
 1932:      .long   s390_base_pgm_handler_fn
 194
 195disabled_wait_psw:
 196        .align  8
 197        .long   0x000a0000,0x00000000 + s390_base_pgm_handler
 198
 199        .section .bss
 200        .align 4
 201        .globl  s390_base_pgm_handler_fn
 202s390_base_pgm_handler_fn:
 203        .long   0
 204        .previous
 205
 206#endif /* CONFIG_64BIT */
 207