xref: /openbsd/sys/arch/m88k/include/asm.h (revision 5746cf29)
1*5746cf29Sguenther /*	$OpenBSD: asm.h,v 1.16 2022/12/06 18:50:59 guenther Exp $	*/
23180e169Smiod 
33180e169Smiod /*
43180e169Smiod  * Mach Operating System
53180e169Smiod  * Copyright (c) 1993-1992 Carnegie Mellon University
63180e169Smiod  * Copyright (c) 1991 OMRON Corporation
73180e169Smiod  * All Rights Reserved.
83180e169Smiod  *
93180e169Smiod  * Permission to use, copy, modify and distribute this software and its
103180e169Smiod  * documentation is hereby granted, provided that both the copyright
113180e169Smiod  * notice and this permission notice appear in all copies of the
123180e169Smiod  * software, derivative works or modified versions, and any portions
133180e169Smiod  * thereof, and that both notices appear in supporting documentation.
143180e169Smiod  *
153180e169Smiod  * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
163180e169Smiod  * CONDITION.  CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
173180e169Smiod  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
183180e169Smiod  *
193180e169Smiod  * Carnegie Mellon requests users of this software to return to
203180e169Smiod  *
213180e169Smiod  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
223180e169Smiod  *  School of Computer Science
233180e169Smiod  *  Carnegie Mellon University
243180e169Smiod  *  Pittsburgh PA 15213-3890
253180e169Smiod  *
263180e169Smiod  * any improvements or extensions that they make and grant Carnegie the
273180e169Smiod  * rights to redistribute these changes.
283180e169Smiod  */
293180e169Smiod 
302fa72412Spirofti #ifndef _M88K_ASM_H_
312fa72412Spirofti #define _M88K_ASM_H_
323180e169Smiod 
330b514a07Smiod #define	_C_LABEL(name)		name
343180e169Smiod #define	_ASM_LABEL(name)	name
353180e169Smiod 
363180e169Smiod #define	_ENTRY(name) \
37f53e872eSmiod 	.text; .align 3; .globl name; .type name,@function; name:
383180e169Smiod 
39*5746cf29Sguenther #define	ENTRY(name)		_ENTRY(name)
40*5746cf29Sguenther #define	ASENTRY(name)		_ENTRY(name)
413180e169Smiod 
42f53e872eSmiod #define	END(name) \
43f53e872eSmiod 	.size name,.-name
44f53e872eSmiod 
453180e169Smiod #define	GLOBAL(name) \
46*5746cf29Sguenther 	.globl name; name:
473180e169Smiod 
483180e169Smiod #define ASGLOBAL(name) \
49*5746cf29Sguenther 	.globl name; name:
503180e169Smiod 
513180e169Smiod #define	LOCAL(name) \
52*5746cf29Sguenther 	name:
533180e169Smiod 
543180e169Smiod #define	ASLOCAL(name) \
55*5746cf29Sguenther 	name:
563180e169Smiod 
573180e169Smiod #define	BSS(name, size) \
58*5746cf29Sguenther 	.comm	name, size
593180e169Smiod 
603180e169Smiod #define	ASBSS(name, size) \
61*5746cf29Sguenther 	.comm	name, size
623180e169Smiod 
635a25e2caSmartynas #define	STRONG_ALIAS(alias,sym)						\
645a25e2caSmartynas 	.global alias;							\
655a25e2caSmartynas 	alias = sym
663180e169Smiod #define	WEAK_ALIAS(alias,sym)						\
673180e169Smiod 	.weak alias;							\
683180e169Smiod 	alias = sym
693180e169Smiod 
703180e169Smiod #ifdef _KERNEL
713180e169Smiod 
72dfff2de9Smiod #ifdef _LOCORE
73ec051e50Smiod 
743180e169Smiod /*
753180e169Smiod  * Control register symbolic names
763180e169Smiod  */
773180e169Smiod 
780b514a07Smiod #define	PID	%cr0
790b514a07Smiod #define	PSR	%cr1
800b514a07Smiod #define	EPSR	%cr2
810b514a07Smiod #define	SSBR	%cr3
820b514a07Smiod #define	SXIP	%cr4		/* 88100 */
830b514a07Smiod #define	EXIP	%cr4		/* 88110 */
840b514a07Smiod #define	SNIP	%cr5		/* 88100 */
850b514a07Smiod #define	ENIP	%cr5		/* 88110 */
860b514a07Smiod #define	SFIP	%cr6		/* 88100 */
870b514a07Smiod #define	VBR	%cr7
880b514a07Smiod #define	DMT0	%cr8		/* 88100 */
890b514a07Smiod #define	DMD0	%cr9		/* 88100 */
900b514a07Smiod #define	DMA0	%cr10		/* 88100 */
910b514a07Smiod #define	DMT1	%cr11		/* 88100 */
920b514a07Smiod #define	DMD1	%cr12		/* 88100 */
930b514a07Smiod #define	DMA1	%cr13		/* 88100 */
940b514a07Smiod #define	DMT2	%cr14		/* 88100 */
950b514a07Smiod #define	DMD2	%cr15		/* 88100 */
960b514a07Smiod #define	DMA2	%cr16		/* 88100 */
970b514a07Smiod #define	SRX	%cr16		/* 88110 */
980b514a07Smiod #define	SR0	%cr17
990b514a07Smiod #define	SR1	%cr18
1000b514a07Smiod #define	SR2	%cr19
1010b514a07Smiod #define	SR3	%cr20
1020b514a07Smiod #define	ICMD	%cr25		/* 88110 */
1030b514a07Smiod #define	ICTL	%cr26		/* 88110 */
1040b514a07Smiod #define	ISAR	%cr27		/* 88110 */
1050b514a07Smiod #define	ISAP	%cr28		/* 88110 */
1060b514a07Smiod #define	IUAP	%cr29		/* 88110 */
1070b514a07Smiod #define	IIR	%cr30		/* 88110 */
1080b514a07Smiod #define	IBP	%cr31		/* 88110 */
1090b514a07Smiod #define	IPPU	%cr32		/* 88110 */
1100b514a07Smiod #define	IPPL	%cr33		/* 88110 */
1110b514a07Smiod #define	ISR	%cr34		/* 88110 */
1120b514a07Smiod #define	ILAR	%cr35		/* 88110 */
1130b514a07Smiod #define	IPAR	%cr36		/* 88110 */
1140b514a07Smiod #define	DCMD	%cr40		/* 88110 */
1150b514a07Smiod #define	DCTL	%cr41		/* 88110 */
1160b514a07Smiod #define	DSAR	%cr42		/* 88110 */
1170b514a07Smiod #define	DSAP	%cr43		/* 88110 */
1180b514a07Smiod #define	DUAP	%cr44		/* 88110 */
1190b514a07Smiod #define	DIR	%cr45		/* 88110 */
1200b514a07Smiod #define	DBP	%cr46		/* 88110 */
1210b514a07Smiod #define	DPPU	%cr47		/* 88110 */
1220b514a07Smiod #define	DPPL	%cr48		/* 88110 */
1230b514a07Smiod #define	DSR	%cr49		/* 88110 */
1240b514a07Smiod #define	DLAR	%cr50		/* 88110 */
1250b514a07Smiod #define	DPAR	%cr51		/* 88110 */
1263180e169Smiod 
1270b514a07Smiod #define	FPECR	%fcr0
1280b514a07Smiod #define	FPHS1	%fcr1		/* 88100 */
1290b514a07Smiod #define	FPLS1	%fcr2		/* 88100 */
1300b514a07Smiod #define	FPHS2	%fcr3		/* 88100 */
1310b514a07Smiod #define	FPLS2	%fcr4		/* 88100 */
1320b514a07Smiod #define	FPPT	%fcr5		/* 88100 */
1330b514a07Smiod #define	FPRH	%fcr6		/* 88100 */
1340b514a07Smiod #define	FPRL	%fcr7		/* 88100 */
1350b514a07Smiod #define	FPIT	%fcr8		/* 88100 */
1360b514a07Smiod #define	FPSR	%fcr62
1370b514a07Smiod #define	FPCR	%fcr63
1383180e169Smiod 
139ec051e50Smiod #define	CPU	SR0
140ec051e50Smiod 
1413180e169Smiod /*
1423180e169Smiod  * At various times, there is the need to clear the pipeline (i.e.
1433180e169Smiod  * synchronize).  A "tb1 0, r0, foo" will do that (because a trap
1443180e169Smiod  * instruction always synchronizes, and this particular instruction
1453180e169Smiod  * will never actually take the trap).
1463180e169Smiod  */
1470b514a07Smiod #define	FLUSH_PIPELINE		tb1	0, %r0, 0
148ec051e50Smiod 
1490b514a07Smiod #define	NOP			or	%r0, %r0, %r0
1503180e169Smiod #define RTE			NOP; rte
1513180e169Smiod 
1523180e169Smiod /*
153ec051e50Smiod  * PSR bits
1543180e169Smiod  */
1553180e169Smiod #define	PSR_SHADOW_FREEZE_BIT		0
1563180e169Smiod #define	PSR_INTERRUPT_DISABLE_BIT	1
1573180e169Smiod #define	PSR_FPU_DISABLE_BIT		3
158ec051e50Smiod #define	PSR_GRAPHICS_DISABLE_BIT	4	/* SFU2 - MC88110 */
159ec051e50Smiod #define	PSR_SERIALIZE_BIT		25	/* MC88110 */
160ec051e50Smiod #define	PSR_CARRY_BIT			28
1614001e026Smiod #define	PSR_SERIAL_MODE_BIT		29
1623180e169Smiod #define	PSR_BIG_ENDIAN_MODE		30
1633180e169Smiod #define	PSR_SUPERVISOR_MODE_BIT		31
164dfff2de9Smiod 
1653180e169Smiod /*
166ec051e50Smiod  * DMT0/DMT1/DMT2 bits
1673180e169Smiod  */
1683180e169Smiod #define	DMT_VALID_BIT		0
1693180e169Smiod #define	DMT_WRITE_BIT		1
1703180e169Smiod #define	DMT_LOCK_BIT		12
1713180e169Smiod #define	DMT_DOUBLE_BIT		13
1723180e169Smiod #define	DMT_DAS_BIT		14
1733180e169Smiod #define	DMT_DREG_OFFSET		7
1743180e169Smiod #define	DMT_DREG_WIDTH		5
1753180e169Smiod 
176ec051e50Smiod /*
177ec051e50Smiod  * Status bits for an SXIP/SNIP/SFIP address.
178ec051e50Smiod  */
179ec051e50Smiod #define	RTE_VALID_BIT		1
180ec051e50Smiod #define	RTE_ERROR_BIT		0
181ec051e50Smiod 
182ec051e50Smiod #define	VECTOR(x) \
183*5746cf29Sguenther 	.word	x
184ec051e50Smiod 
185ec051e50Smiod #endif	/* _LOCORE */
186ec051e50Smiod 
1873180e169Smiod #endif	/* _KERNEL */
1883180e169Smiod 
1892fa72412Spirofti #endif	/* _M88K_ASM_H_ */
190