From 88993b57d9c4c3142a3860ed3324bbf15005c2a8 Mon Sep 17 00:00:00 2001 From: pk Date: Tue, 19 Jan 1999 23:05:52 +0000 Subject: [PATCH] Define macros to read & write Ancillary State registers. --- sys/arch/sparc/sparc/asm.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/arch/sparc/sparc/asm.h b/sys/arch/sparc/sparc/asm.h index a1eee9135412..9c5055dcaaa6 100644 --- a/sys/arch/sparc/sparc/asm.h +++ b/sys/arch/sparc/sparc/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.6 1998/09/27 14:32:14 pk Exp $ */ +/* $NetBSD: asm.h,v 1.7 1999/01/19 23:05:52 pk Exp $ */ /* * Copyright (c) 1992, 1993 @@ -128,3 +128,16 @@ __asm __volatile("ldstub [%1],%0" : "=r" (_v) : "r" (loc) : "memory"); \ _v; \ }) + +/* read ancillary state register */ +#define rdasr(asr) _rdasr(asr) +#define _rdasr(asr) ({ \ + register int _rdasr_v; \ + __asm __volatile("rd %%asr" #asr ",%0" : "=r" (_rdasr_v)); \ +}) + +/* write ancillary state register */ +#define wrasr(value, asr) _wrasr(value, asr) +#define _wrasr(value, asr) ({ \ + __asm __volatile("wr %0,%%asr" #asr : : "r" ((int)(value))); \ +})