Add new macros:
- RAS_DECL(name): declare the RAS "name" - RAS_START(name): mark the start of the RAS "name" - RAS_END(name): mark the end of the RAS "name" - RAS_ADDR(name): compute the starting address of the RAS "name" - RAS_SIZE(name): compute the size of the RAS "name" RAS_START() and RAS_END() have implicit instruction reordering barriers. RAS_ADDR() and RAS_SIZE() are to be used when registering a RAS.
This commit is contained in:
parent
302b606369
commit
fc892593e5
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: ras.h,v 1.2 2003/06/28 14:52:10 simonb Exp $ */
|
||||
/* $NetBSD: ras.h,v 1.3 2004/03/03 21:05:30 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
|
@ -67,6 +67,27 @@ extern struct pool ras_pool;
|
|||
|
||||
#else
|
||||
|
||||
#define RAS_DECL(name) \
|
||||
extern void __CONCAT(name,_ras_start(void)), __CONCAT(name,_ras_end(void))
|
||||
|
||||
/*
|
||||
* RAS_START and RAS_END contain implicit instruction reordering
|
||||
* barriers. See __insn_barrier() in <sys/cdefs.h>.
|
||||
*/
|
||||
#define RAS_START(name) \
|
||||
__asm __volatile(".globl " ___STRING(name) "_ras_start\n" \
|
||||
___STRING(name) "_ras_start:" \
|
||||
::: "memory")
|
||||
|
||||
#define RAS_END(name) \
|
||||
__asm __volatile(".globl " ___STRING(name) "_ras_end\n" \
|
||||
___STRING(name) "_ras_end:" \
|
||||
::: "memory")
|
||||
|
||||
#define RAS_ADDR(name) (void *) __CONCAT(name,_ras_start)
|
||||
#define RAS_SIZE(name) ((size_t)((uintptr_t) __CONCAT(name,_ras_end) - \
|
||||
(uintptr_t) __CONCAT(name,_ras_start)))
|
||||
|
||||
__BEGIN_DECLS
|
||||
int rasctl(caddr_t, size_t, int);
|
||||
__END_DECLS
|
||||
|
|
Loading…
Reference in New Issue