Add several useful macros:
- ENTRY_NOPROFILE() and ASENTRY_NOPROFILE(), similar to ENTRY() and ASENTRY(), but without the profiling prologue. - GLOBAL()/ASGLOBAL() and LOCAL()/ASLOCAL(), for defining global and local variables with C and ASM labels. - BSS()/ASBSS(), for defining items in the BSS segment, with C or ASM labels. - PANIC("panic message") - shorthand for calling panic() from assembly code. - VECTOR(), ASVECTOR(), VECTOR_UNUSED - shorthand for defining entries in the vector table. Also, change RCSID() to pad out the string to even boundary.
This commit is contained in:
parent
021d7c2fe5
commit
658ce85446
@ -1,6 +1,7 @@
|
||||
/* $NetBSD: asm.h,v 1.12 1996/11/30 02:49:00 jtc Exp $ */
|
||||
/* $NetBSD: asm.h,v 1.13 1997/04/24 22:49:39 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
|
||||
* Copyright (c) 1994 Allen Briggs
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -45,10 +46,11 @@
|
||||
#define _ASM_H_
|
||||
|
||||
#ifdef __STDC__
|
||||
#define _C_LABEL(name) _ ## name
|
||||
#define _C_LABEL(name) _ ## name
|
||||
#else
|
||||
#define _C_LABEL(name) _/**/name
|
||||
#endif
|
||||
#define _C_LABEL(name) _/**/name
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#define _ASM_LABEL(name) name
|
||||
|
||||
#ifndef _KERNEL
|
||||
@ -69,6 +71,9 @@
|
||||
#define ENTRY(name) _ENTRY(_C_LABEL(name)) _PROF_PROLOG
|
||||
#define ASENTRY(name) _ENTRY(_ASM_LABEL(name)) _PROF_PROLOG
|
||||
|
||||
#define ENTRY_NOPROFILE(name) _ENTRY(_C_LABEL(name))
|
||||
#define ASENTRY_NOPROFILE(name) _ENTRY(_ASM_LABEL(name))
|
||||
|
||||
/*
|
||||
* The m68k ALTENTRY macro is very different than the traditional
|
||||
* implementation used by other NetBSD ports. Usually ALTENTRY
|
||||
@ -88,6 +93,62 @@
|
||||
#define ALTENTRY(name, rname) _ENTRY(_C_LABEL(name))
|
||||
#endif
|
||||
|
||||
#define RCSID(x) .text; .asciz x
|
||||
#define RCSID(x) .text ; \
|
||||
.asciz x ; \
|
||||
.even
|
||||
|
||||
/*
|
||||
* Global variables of whatever sort.
|
||||
*/
|
||||
#define GLOBAL(x) \
|
||||
.globl _C_LABEL(x) ; \
|
||||
_C_LABEL(x):
|
||||
|
||||
#define ASGLOBAL(x) \
|
||||
.globl _ASM_LABEL(x) ; \
|
||||
_ASM_LABEL(x):
|
||||
|
||||
/*
|
||||
* ...and local variables.
|
||||
*/
|
||||
#define LOCAL(x) \
|
||||
_C_LABEL(x):
|
||||
|
||||
#define ASLOCAL(x) \
|
||||
_ASM_LABEL(x):
|
||||
|
||||
/*
|
||||
* Items in the BSS segment.
|
||||
*/
|
||||
#define BSS(name, size) \
|
||||
.comm _C_LABEL(name),size
|
||||
|
||||
#define ASBSS(name, size) \
|
||||
.comm _ASM_LABEL(name),size
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Shorthand for calling panic().
|
||||
* Note the side-effect: it uses up the 9: label, so be careful!
|
||||
*/
|
||||
#define PANIC(x) \
|
||||
pea 9f ; \
|
||||
jbsr _C_LABEL(panic) ; \
|
||||
9: .asciz x ; \
|
||||
.even
|
||||
|
||||
/*
|
||||
* Shorthand for defining vectors for the vector table.
|
||||
*/
|
||||
#define VECTOR(x) \
|
||||
.long _C_LABEL(x)
|
||||
|
||||
#define ASVECTOR(x) \
|
||||
.long _ASM_LABEL(x)
|
||||
|
||||
#define VECTOR_UNUSED \
|
||||
.long 0
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _ASM_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user