From fc892593e5b61a6ead85330e246408432810205b Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 3 Mar 2004 21:05:30 +0000 Subject: [PATCH] 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. --- sys/sys/ras.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sys/sys/ras.h b/sys/sys/ras.h index 8e937adb0e9d..10a4108a1ecf 100644 --- a/sys/sys/ras.h +++ b/sys/sys/ras.h @@ -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 . + */ +#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