2019-05-27 08:55:01 +02:00
/* SPDX-License-Identifier: GPL-2.0-or-later */
2005-04-16 15:20:36 -07:00
/ *
* Signal t r a m p o l i n e s f o r 3 2 b i t s p r o c e s s e s i n a p p c64 k e r n e l f o r
* use i n t h e v D S O
*
* Copyright ( C ) 2 0 0 4 B e n j a m i n H e r r e n s c h m u i d t ( b e n h @kernel.crashing.org), IBM Corp.
* Copyright ( C ) 2 0 0 4 A l a n M o d r a ( a m o d r a @au.ibm.com)), IBM Corp.
* /
# include < a s m / p r o c e s s o r . h >
# include < a s m / p p c _ a s m . h >
# include < a s m / u n i s t d . h >
# include < a s m / v d s o . h >
.text
/ * The n o p h e r e i s a h a c k . T h e d w a r f2 u n w i n d r o u t i n e s s u b t r a c t 1 f r o m
the r e t u r n a d d r e s s t o g e t a n a d d r e s s i n t h e m i d d l e o f t h e p r e s u m e d
2011-03-30 22:57:33 -03:00
call i n s t r u c t i o n . S i n c e w e d o n ' t h a v e a c a l l h e r e , w e a r t i f i c i a l l y
2005-04-16 15:20:36 -07:00
extend t h e r a n g e c o v e r e d b y t h e u n w i n d i n f o b y a d d i n g a n o p b e f o r e
the r e a l s t a r t . * /
nop
V_ F U N C T I O N _ B E G I N ( _ _ k e r n e l _ s i g t r a m p32 )
.Lsig_start = . - 4
li r0 ,_ _ N R _ s i g r e t u r n
sc
.Lsig_end :
V_ F U N C T I O N _ E N D ( _ _ k e r n e l _ s i g t r a m p32 )
.Lsigrt_start :
nop
V_ F U N C T I O N _ B E G I N ( _ _ k e r n e l _ s i g t r a m p _ r t 3 2 )
li r0 ,_ _ N R _ r t _ s i g r e t u r n
sc
.Lsigrt_end :
V_ F U N C T I O N _ E N D ( _ _ k e r n e l _ s i g t r a m p _ r t 3 2 )
.section .eh_frame , " a" ,@progbits
/ * Register r1 c a n b e f o u n d a t o f f s e t 4 o f a p t _ r e g s s t r u c t u r e .
A p o i n t e r t o t h e p t _ r e g s i s s t o r e d i n m e m o r y a t t h e o l d s p p l u s P T R E G S . * /
# define c f a _ s a v e \
.byte 0 x0 f ; /* DW_CFA_def_cfa_expression */ \
.uleb128 9f - 1 f; /* length */ \
1 : \
.byte 0 x7 1 ; .sleb128 PTREGS; /* DW_OP_breg1 */ \
.byte 0 x0 6 ; /* DW_OP_deref */ \
.byte 0 x2 3 ; .uleb128 RSIZE; /* DW_OP_plus_uconst */ \
.byte 0 x0 6 ; /* DW_OP_deref */ \
9 :
/ * Register R E G N O c a n b e f o u n d a t o f f s e t O F S o f a p t _ r e g s s t r u c t u r e .
A p o i n t e r t o t h e p t _ r e g s i s s t o r e d i n m e m o r y a t t h e o l d s p p l u s P T R E G S . * /
# define r s a v e ( r e g n o , o f s ) \
.byte 0 x1 0 ; /* DW_CFA_expression */ \
.uleb128 regno; /* regno */ \
.uleb128 9f - 1 f; /* length */ \
1 : \
.byte 0 x7 1 ; .sleb128 PTREGS; /* DW_OP_breg1 */ \
.byte 0 x0 6 ; /* DW_OP_deref */ \
.ifne ofs; \
.byte 0 x2 3 ; .uleb128 ofs; /* DW_OP_plus_uconst */ \
.endif ; \
9 :
/ * If m s r b i t 1 < < 2 5 i s s e t , t h e n V M X r e g i s t e r R E G N O i s a t o f f s e t R E G N O * 1 6
of t h e V M X r e g s t r u c t . T h e V M X r e g s t r u c t i s a t o f f s e t V R E G S o f
the p t _ r e g s s t r u c t . T h i s m a c r o i s f o r R E G N O = = 0 , a n d c o n t a i n s
' subroutines' t h a t t h e o t h e r m a c r o s j u m p t o . * /
# define v s a v e _ m s r0 ( r e g n o ) \
.byte 0 x1 0 ; /* DW_CFA_expression */ \
.uleb128 regno + 7 7 ; /* regno */ \
.uleb128 9f - 1 f; /* length */ \
1 : \
.byte 0x30 + regno; /* DW_OP_lit0 */ \
2 : \
.byte 0 x4 0 ; /* DW_OP_lit16 */ \
.byte 0 x1 e ; /* DW_OP_mul */ \
3 : \
.byte 0 x7 1 ; .sleb128 PTREGS; /* DW_OP_breg1 */ \
.byte 0 x0 6 ; /* DW_OP_deref */ \
.byte 0 x1 2 ; /* DW_OP_dup */ \
.byte 0 x2 3 ; /* DW_OP_plus_uconst */ \
.uleb128 3 3 * RSIZE; /* msr offset */ \
.byte 0 x0 6 ; /* DW_OP_deref */ \
.byte 0 x0 c ; .long 1 << 25; /* DW_OP_const4u */ \
.byte 0 x1 a ; /* DW_OP_and */ \
.byte 0 x1 2 ; /* DW_OP_dup, ret 0 if bra taken */ \
.byte 0 x3 0 ; /* DW_OP_lit0 */ \
.byte 0 x2 9 ; /* DW_OP_eq */ \
.byte 0 x2 8 ; .short 0x7fff; /* DW_OP_bra to end */ \
.byte 0 x1 3 ; /* DW_OP_drop, pop the 0 */ \
.byte 0 x2 3 ; .uleb128 VREGS; /* DW_OP_plus_uconst */ \
.byte 0 x2 2 ; /* DW_OP_plus */ \
.byte 0 x2 f ; .short 0x7fff; /* DW_OP_skip to end */ \
9 :
/ * If m s r b i t 1 < < 2 5 i s s e t , t h e n V M X r e g i s t e r R E G N O i s a t o f f s e t R E G N O * 1 6
of t h e V M X r e g s t r u c t . R E G N O i s 1 t h r u 3 1 . * /
# define v s a v e _ m s r1 ( r e g n o ) \
.byte 0 x1 0 ; /* DW_CFA_expression */ \
.uleb128 regno + 7 7 ; /* regno */ \
.uleb128 9f - 1 f; /* length */ \
1 : \
.byte 0x30 + regno; /* DW_OP_lit n */ \
.byte 0 x2 f ; .short 2b - 9f; /* DW_OP_skip */ \
9 :
/ * If m s r b i t 1 < < 2 5 i s s e t , t h e n V M X r e g i s t e r R E G N O i s a t o f f s e t O F S o f
the V M X s a v e b l o c k . * /
# define v s a v e _ m s r2 ( r e g n o , o f s ) \
.byte 0 x1 0 ; /* DW_CFA_expression */ \
.uleb128 regno + 7 7 ; /* regno */ \
.uleb128 9f - 1 f; /* length */ \
1 : \
.byte 0 x0 a ; .short ofs; /* DW_OP_const2u */ \
.byte 0 x2 f ; .short 3b - 9f; /* DW_OP_skip */ \
9 :
/* VMX register REGNO is at offset OFS of the VMX save area. */
# define v s a v e ( r e g n o , o f s ) \
.byte 0 x1 0 ; /* DW_CFA_expression */ \
.uleb128 regno + 7 7 ; /* regno */ \
.uleb128 9f - 1 f; /* length */ \
1 : \
.byte 0 x7 1 ; .sleb128 PTREGS; /* DW_OP_breg1 */ \
.byte 0 x0 6 ; /* DW_OP_deref */ \
.byte 0 x2 3 ; .uleb128 VREGS; /* DW_OP_plus_uconst */ \
.byte 0 x2 3 ; .uleb128 ofs; /* DW_OP_plus_uconst */ \
9 :
/* This is where the pt_regs pointer can be found on the stack. */
# define P T R E G S 6 4 + 2 8
/* Size of regs. */
# define R S I Z E 4
/* This is the offset of the VMX regs. */
# define V R E G S 4 8 * R S I Z E + 3 4 * 8
/* Describe where general purpose regs are saved. */
# define E H _ F R A M E _ G E N \
cfa_ s a v e ; \
rsave ( 0 , 0 * R S I Z E ) ; \
rsave ( 2 , 2 * R S I Z E ) ; \
rsave ( 3 , 3 * R S I Z E ) ; \
rsave ( 4 , 4 * R S I Z E ) ; \
rsave ( 5 , 5 * R S I Z E ) ; \
rsave ( 6 , 6 * R S I Z E ) ; \
rsave ( 7 , 7 * R S I Z E ) ; \
rsave ( 8 , 8 * R S I Z E ) ; \
rsave ( 9 , 9 * R S I Z E ) ; \
rsave ( 1 0 , 1 0 * R S I Z E ) ; \
rsave ( 1 1 , 1 1 * R S I Z E ) ; \
rsave ( 1 2 , 1 2 * R S I Z E ) ; \
rsave ( 1 3 , 1 3 * R S I Z E ) ; \
rsave ( 1 4 , 1 4 * R S I Z E ) ; \
rsave ( 1 5 , 1 5 * R S I Z E ) ; \
rsave ( 1 6 , 1 6 * R S I Z E ) ; \
rsave ( 1 7 , 1 7 * R S I Z E ) ; \
rsave ( 1 8 , 1 8 * R S I Z E ) ; \
rsave ( 1 9 , 1 9 * R S I Z E ) ; \
rsave ( 2 0 , 2 0 * R S I Z E ) ; \
rsave ( 2 1 , 2 1 * R S I Z E ) ; \
rsave ( 2 2 , 2 2 * R S I Z E ) ; \
rsave ( 2 3 , 2 3 * R S I Z E ) ; \
rsave ( 2 4 , 2 4 * R S I Z E ) ; \
rsave ( 2 5 , 2 5 * R S I Z E ) ; \
rsave ( 2 6 , 2 6 * R S I Z E ) ; \
rsave ( 2 7 , 2 7 * R S I Z E ) ; \
rsave ( 2 8 , 2 8 * R S I Z E ) ; \
rsave ( 2 9 , 2 9 * R S I Z E ) ; \
rsave ( 3 0 , 3 0 * R S I Z E ) ; \
rsave ( 3 1 , 3 1 * R S I Z E ) ; \
rsave ( 6 7 , 3 2 * R S I Z E ) ; /* ap, used as temp for nip */ \
rsave ( 6 5 , 3 6 * R S I Z E ) ; /* lr */ \
rsave ( 7 0 , 3 8 * R S I Z E ) / * c r * /
/* Describe where the FP regs are saved. */
# define E H _ F R A M E _ F P \
rsave ( 3 2 , 4 8 * R S I Z E + 0 * 8 ) ; \
rsave ( 3 3 , 4 8 * R S I Z E + 1 * 8 ) ; \
rsave ( 3 4 , 4 8 * R S I Z E + 2 * 8 ) ; \
rsave ( 3 5 , 4 8 * R S I Z E + 3 * 8 ) ; \
rsave ( 3 6 , 4 8 * R S I Z E + 4 * 8 ) ; \
rsave ( 3 7 , 4 8 * R S I Z E + 5 * 8 ) ; \
rsave ( 3 8 , 4 8 * R S I Z E + 6 * 8 ) ; \
rsave ( 3 9 , 4 8 * R S I Z E + 7 * 8 ) ; \
rsave ( 4 0 , 4 8 * R S I Z E + 8 * 8 ) ; \
rsave ( 4 1 , 4 8 * R S I Z E + 9 * 8 ) ; \
rsave ( 4 2 , 4 8 * R S I Z E + 1 0 * 8 ) ; \
rsave ( 4 3 , 4 8 * R S I Z E + 1 1 * 8 ) ; \
rsave ( 4 4 , 4 8 * R S I Z E + 1 2 * 8 ) ; \
rsave ( 4 5 , 4 8 * R S I Z E + 1 3 * 8 ) ; \
rsave ( 4 6 , 4 8 * R S I Z E + 1 4 * 8 ) ; \
rsave ( 4 7 , 4 8 * R S I Z E + 1 5 * 8 ) ; \
rsave ( 4 8 , 4 8 * R S I Z E + 1 6 * 8 ) ; \
rsave ( 4 9 , 4 8 * R S I Z E + 1 7 * 8 ) ; \
rsave ( 5 0 , 4 8 * R S I Z E + 1 8 * 8 ) ; \
rsave ( 5 1 , 4 8 * R S I Z E + 1 9 * 8 ) ; \
rsave ( 5 2 , 4 8 * R S I Z E + 2 0 * 8 ) ; \
rsave ( 5 3 , 4 8 * R S I Z E + 2 1 * 8 ) ; \
rsave ( 5 4 , 4 8 * R S I Z E + 2 2 * 8 ) ; \
rsave ( 5 5 , 4 8 * R S I Z E + 2 3 * 8 ) ; \
rsave ( 5 6 , 4 8 * R S I Z E + 2 4 * 8 ) ; \
rsave ( 5 7 , 4 8 * R S I Z E + 2 5 * 8 ) ; \
rsave ( 5 8 , 4 8 * R S I Z E + 2 6 * 8 ) ; \
rsave ( 5 9 , 4 8 * R S I Z E + 2 7 * 8 ) ; \
rsave ( 6 0 , 4 8 * R S I Z E + 2 8 * 8 ) ; \
rsave ( 6 1 , 4 8 * R S I Z E + 2 9 * 8 ) ; \
rsave ( 6 2 , 4 8 * R S I Z E + 3 0 * 8 ) ; \
rsave ( 6 3 , 4 8 * R S I Z E + 3 1 * 8 )
/* Describe where the VMX regs are saved. */
# ifdef C O N F I G _ A L T I V E C
# define E H _ F R A M E _ V M X \
vsave_ m s r0 ( 0 ) ; \
vsave_ m s r1 ( 1 ) ; \
vsave_ m s r1 ( 2 ) ; \
vsave_ m s r1 ( 3 ) ; \
vsave_ m s r1 ( 4 ) ; \
vsave_ m s r1 ( 5 ) ; \
vsave_ m s r1 ( 6 ) ; \
vsave_ m s r1 ( 7 ) ; \
vsave_ m s r1 ( 8 ) ; \
vsave_ m s r1 ( 9 ) ; \
vsave_ m s r1 ( 1 0 ) ; \
vsave_ m s r1 ( 1 1 ) ; \
vsave_ m s r1 ( 1 2 ) ; \
vsave_ m s r1 ( 1 3 ) ; \
vsave_ m s r1 ( 1 4 ) ; \
vsave_ m s r1 ( 1 5 ) ; \
vsave_ m s r1 ( 1 6 ) ; \
vsave_ m s r1 ( 1 7 ) ; \
vsave_ m s r1 ( 1 8 ) ; \
vsave_ m s r1 ( 1 9 ) ; \
vsave_ m s r1 ( 2 0 ) ; \
vsave_ m s r1 ( 2 1 ) ; \
vsave_ m s r1 ( 2 2 ) ; \
vsave_ m s r1 ( 2 3 ) ; \
vsave_ m s r1 ( 2 4 ) ; \
vsave_ m s r1 ( 2 5 ) ; \
vsave_ m s r1 ( 2 6 ) ; \
vsave_ m s r1 ( 2 7 ) ; \
vsave_ m s r1 ( 2 8 ) ; \
vsave_ m s r1 ( 2 9 ) ; \
vsave_ m s r1 ( 3 0 ) ; \
vsave_ m s r1 ( 3 1 ) ; \
vsave_ m s r2 ( 3 3 , 3 2 * 1 6 + 1 2 ) ; \
vsave ( 3 2 , 3 2 * 1 6 )
# else
# define E H _ F R A M E _ V M X
# endif
.Lcie :
.long .Lcie_end - .Lcie_start
.Lcie_start :
.long 0 /* CIE ID */
.byte 1 /* Version number */
2006-03-31 02:30:28 -08:00
.string " zRS" / * N U L - t e r m i n a t e d a u g m e n t a t i o n s t r i n g * /
2005-04-16 15:20:36 -07:00
.uleb128 4 /* Code alignment factor */
.sleb128 - 4 /* Data alignment factor */
.byte 67 /* Return address register column, ap */
.uleb128 1 /* Augmentation value length */
.byte 0x1b /* DW_EH_PE_pcrel | DW_EH_PE_sdata4. */
.byte 0 x0 c ,1 ,0 / * D W _ C F A _ d e f _ c f a : r1 o f s 0 * /
.balign 4
.Lcie_end :
.long .Lfde0_end - .Lfde0_start
.Lfde0_start :
.long .Lfde0_start - .Lcie /* CIE pointer. */
.long .Lsig_start - . /* PC start, length */
.long .Lsig_end - .Lsig_start
.uleb128 0 /* Augmentation */
EH_ F R A M E _ G E N
EH_ F R A M E _ F P
EH_ F R A M E _ V M X
.balign 4
.Lfde0_end :
/* We have a different stack layout for rt_sigreturn. */
# undef P T R E G S
# define P T R E G S 6 4 + 1 6 + 1 2 8 + 2 0 + 2 8
.long .Lfde1_end - .Lfde1_start
.Lfde1_start :
.long .Lfde1_start - .Lcie /* CIE pointer. */
.long .Lsigrt_start - . /* PC start, length */
.long .Lsigrt_end - .Lsigrt_start
.uleb128 0 /* Augmentation */
EH_ F R A M E _ G E N
EH_ F R A M E _ F P
EH_ F R A M E _ V M X
.balign 4
.Lfde1_end :