Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright 2016, Cyril Bur, IBM Corp.
      3  *
      4  * This program is free software; you can redistribute it and/or
      5  * modify it under the terms of the GNU General Public License
      6  * as published by the Free Software Foundation; either version
      7  * 2 of the License, or (at your option) any later version.
      8  */
      9 
     10 #ifndef _SELFTESTS_POWERPC_GPR_ASM_H
     11 #define _SELFTESTS_POWERPC_GPR_ASM_H
     12 
     13 #include "basic_asm.h"
     14 
     15 #define __PUSH_NVREGS(top_pos); \
     16 	std r31,(top_pos)(%r1); \
     17 	std r30,(top_pos - 8)(%r1); \
     18 	std r29,(top_pos - 16)(%r1); \
     19 	std r28,(top_pos - 24)(%r1); \
     20 	std r27,(top_pos - 32)(%r1); \
     21 	std r26,(top_pos - 40)(%r1); \
     22 	std r25,(top_pos - 48)(%r1); \
     23 	std r24,(top_pos - 56)(%r1); \
     24 	std r23,(top_pos - 64)(%r1); \
     25 	std r22,(top_pos - 72)(%r1); \
     26 	std r21,(top_pos - 80)(%r1); \
     27 	std r20,(top_pos - 88)(%r1); \
     28 	std r19,(top_pos - 96)(%r1); \
     29 	std r18,(top_pos - 104)(%r1); \
     30 	std r17,(top_pos - 112)(%r1); \
     31 	std r16,(top_pos - 120)(%r1); \
     32 	std r15,(top_pos - 128)(%r1); \
     33 	std r14,(top_pos - 136)(%r1)
     34 
     35 #define __POP_NVREGS(top_pos); \
     36 	ld r31,(top_pos)(%r1); \
     37 	ld r30,(top_pos - 8)(%r1); \
     38 	ld r29,(top_pos - 16)(%r1); \
     39 	ld r28,(top_pos - 24)(%r1); \
     40 	ld r27,(top_pos - 32)(%r1); \
     41 	ld r26,(top_pos - 40)(%r1); \
     42 	ld r25,(top_pos - 48)(%r1); \
     43 	ld r24,(top_pos - 56)(%r1); \
     44 	ld r23,(top_pos - 64)(%r1); \
     45 	ld r22,(top_pos - 72)(%r1); \
     46 	ld r21,(top_pos - 80)(%r1); \
     47 	ld r20,(top_pos - 88)(%r1); \
     48 	ld r19,(top_pos - 96)(%r1); \
     49 	ld r18,(top_pos - 104)(%r1); \
     50 	ld r17,(top_pos - 112)(%r1); \
     51 	ld r16,(top_pos - 120)(%r1); \
     52 	ld r15,(top_pos - 128)(%r1); \
     53 	ld r14,(top_pos - 136)(%r1)
     54 
     55 #define PUSH_NVREGS(stack_size) \
     56 	__PUSH_NVREGS(stack_size + STACK_FRAME_MIN_SIZE)
     57 
     58 /* 18 NV FPU REGS */
     59 #define PUSH_NVREGS_BELOW_FPU(stack_size) \
     60 	__PUSH_NVREGS(stack_size + STACK_FRAME_MIN_SIZE - (18 * 8))
     61 
     62 #define POP_NVREGS(stack_size) \
     63 	__POP_NVREGS(stack_size + STACK_FRAME_MIN_SIZE)
     64 
     65 /* 18 NV FPU REGS */
     66 #define POP_NVREGS_BELOW_FPU(stack_size) \
     67 	__POP_NVREGS(stack_size + STACK_FRAME_MIN_SIZE - (18 * 8))
     68 
     69 /*
     70  * Careful calling this, it will 'clobber' NVGPRs (by design)
     71  * Don't call this from C
     72  */
     73 FUNC_START(load_gpr)
     74 	ld	r14,0(r3)
     75 	ld	r15,8(r3)
     76 	ld	r16,16(r3)
     77 	ld	r17,24(r3)
     78 	ld	r18,32(r3)
     79 	ld	r19,40(r3)
     80 	ld	r20,48(r3)
     81 	ld	r21,56(r3)
     82 	ld	r22,64(r3)
     83 	ld	r23,72(r3)
     84 	ld	r24,80(r3)
     85 	ld	r25,88(r3)
     86 	ld	r26,96(r3)
     87 	ld	r27,104(r3)
     88 	ld	r28,112(r3)
     89 	ld	r29,120(r3)
     90 	ld	r30,128(r3)
     91 	ld	r31,136(r3)
     92 	blr
     93 FUNC_END(load_gpr)
     94 
     95 
     96 #endif /* _SELFTESTS_POWERPC_GPR_ASM_H */
     97