summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/include/asm.h
blob: 003d9b8d18cdfaa54ca3f811b1c39634b33ebba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*	$NetBSD: asm.h,v 1.18 2022/06/01 06:18:04 skrll Exp $	*/

/*	$OpenBSD: asm.h,v 1.12 2001/03/29 02:15:57 mickey Exp $	*/

/*
 * Copyright (c) 1990,1991,1994 The University of Utah and
 * the Computer Systems Laboratory (CSL).  All rights reserved.
 *
 * Permission to use, copy, modify and distribute this software is hereby
 * granted provided that (1) source code retains these copyright, permission,
 * and disclaimer notices, and (2) redistributions including binaries
 * reproduce the notices in supporting documentation, and (3) all advertising
 * materials mentioning features or use of this software display the following
 * acknowledgement: ``This product includes software developed by the
 * Computer Systems Laboratory at the University of Utah.''
 *
 * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
 * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
 *
 * CSL requests users of this software to return to csl-dist@cs.utah.edu any
 * improvements that they make and grant CSL redistribution rights.
 *
 *	Utah $Hdr: asm.h 1.8 94/12/14$
 */

#ifndef _HPPA_ASM_H_
#define _HPPA_ASM_H_

#include <machine/frame.h>
/*
 *	hppa assembler definitions
 */

#ifdef __STDC__
#define	__CONCAT(a,b)	a ## b
#else
#define	__CONCAT(a,b)	a/**/b
#endif

#define _C_LABEL(x)	x

#define _ASM_LS_CHAR	!

#define	_ENTRY(x) \
	 ! .text ! .align 4				!\
	.export x, entry ! .label x ! .proc

#define	LEAF_ENTRY_NOPROFILE(x)				!\
	_ENTRY(x)					!\
	.callinfo frame=0, no_calls, save_rp		!\
	.entry

#define	ENTRY_NOPROFILE(x,n)				!\
	_ENTRY(x)					!\
	.callinfo frame=n, calls, save_rp, save_sp	!\
	.entry

#ifdef GPROF

#define	_PROF_PROLOGUE				!\
1:						!\
	stw	%rp, HPPA_FRAME_CRP(%sp)	!\
	stw	%arg0, HPPA_FRAME_ARG(0)(%sp)	!\
	stw	%arg1, HPPA_FRAME_ARG(1)(%sp)	!\
	stw	%arg2, HPPA_FRAME_ARG(2)(%sp)	!\
	stw	%arg3, HPPA_FRAME_ARG(3)(%sp)	!\
	ldo	HPPA_FRAME_SIZE(%sp), %sp	!\
	copy	%rp, %arg0			!\
	bl	2f, %arg1			!\
	 depi	0, 31, 2, %arg1			!\
2:						!\
	bl	_mcount, %rp			!\
	 ldo	1b - 2b(%arg1), %arg1		!\
	ldo	-HPPA_FRAME_SIZE(%sp), %sp	!\
	ldw	HPPA_FRAME_ARG(3)(%sp), %arg3	!\
	ldw	HPPA_FRAME_ARG(2)(%sp), %arg2	!\
	ldw	HPPA_FRAME_ARG(1)(%sp), %arg1	!\
	ldw	HPPA_FRAME_ARG(0)(%sp), %arg0	!\
	ldw	HPPA_FRAME_CRP(%sp), %rp	!\

#define LEAF_ENTRY(x) 				!\
	ENTRY_NOPROFILE(x,HPPA_FRAME_SIZE)	!\
	_PROF_PROLOGUE

#else /* GPROF */

#define _PROF_PROLOGUE

#define LEAF_ENTRY(x) 				!\
	LEAF_ENTRY_NOPROFILE(x)

#endif /* GPROF */

#define ENTRY(x,n) 				!\
	ENTRY_NOPROFILE(x,n)			!\
	_PROF_PROLOGUE

#define ALTENTRY(x) ! .export x, entry ! .label x
#define EXIT(x) ! .exit ! .procend ! .size x, .-x

#define RCSID(x)	.pushsection ".ident","MS",@progbits,1;		\
			.asciz x;					\
			.popsection

#define WEAK_ALIAS(alias,sym)				\
	.weak alias !					\
	alias = sym

/*
 * STRONG_ALIAS: create a strong alias.
 */
#define STRONG_ALIAS(alias,sym)				\
	.globl alias !					\
	alias = sym

#define CALL(func,tmp)					!\
	ldil	L%func, tmp				!\
	ldo	R%func(tmp), tmp			!\
	.call						!\
	blr	%r0, %rp				!\
	bv,n	%r0(tmp)				!\
	nop

#ifdef __PIC__
#define PIC_CALL(func)					!\
	addil	LT%func, %r19				!\
	ldw	RT%func(%r1), %r1			!\
	.call						!\
	blr	%r0, %rp				!\
	bv,n	%r0(%r1)				!\
	nop
#else
#define PIC_CALL(func)					!\
	CALL(func,%r1)
#endif

#ifdef __STDC__
#define	WARN_REFERENCES(sym,msg)					\
	.pushsection .gnu.warning. ## sym;				\
	.ascii msg;							\
	.popsection
#else
#define	WARN_REFERENCES(sym,msg)					\
	.pushsection .gnu.warning./**/sym;				\
	.ascii msg;							\
	.popsection
#endif /* __STDC__ */

#define	BSS(n,s)	.comm n, s
#define	SZREG	4

#endif /* _HPPA_ASM_H_ */