summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/include/asmacros.h
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-12-29 14:14:50 +0000
committermarius <marius@FreeBSD.org>2010-12-29 14:14:50 +0000
commit074b42904fdab9d293ad8b5bc879c68aecb8192c (patch)
treef9e0f592390d106497d7f90620a42ab65c4187e7 /sys/sparc64/include/asmacros.h
parentb07041fd2b5c3871ab7ae7f49fb2f51345be372b (diff)
downloadFreeBSD-src-074b42904fdab9d293ad8b5bc879c68aecb8192c.zip
FreeBSD-src-074b42904fdab9d293ad8b5bc879c68aecb8192c.tar.gz
- Move the macros for generating load and store instructions to asmacros.h
so they can be shared by different source files and extend them by a variant for atomic compare and swap. - Consistently use EMPTY.
Diffstat (limited to 'sys/sparc64/include/asmacros.h')
-rw-r--r--sys/sparc64/include/asmacros.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/sparc64/include/asmacros.h b/sys/sparc64/include/asmacros.h
index 6d19a09..840959f 100644
--- a/sys/sparc64/include/asmacros.h
+++ b/sys/sparc64/include/asmacros.h
@@ -33,7 +33,7 @@
/*
* Normal and alternate %g6 point to the pcb of the current process. Normal,
- & alternate and interrupt %g7 point to per-cpu data.
+ * alternate and interrupt %g7 point to per-cpu data.
*/
#define PCB_REG %g6
#define PCPU_REG %g7
@@ -134,6 +134,19 @@ name:
#define EMPTY
+/*
+ * Generate atomic compare and swap, load and store instructions for the
+ * corresponding width and ASI (or not). Note that we want to evaluate the
+ * macro args before concatenating, so that EMPTY really turns into nothing.
+ */
+#define _LD(w, a) ld ## w ## a
+#define _ST(w, a) st ## w ## a
+#define _CAS(w, a) cas ## w ## a
+
+#define LD(w, a) _LD(w, a)
+#define ST(w, a) _ST(w, a)
+#define CAS(w, a) _CAS(w, a)
+
#endif /* LOCORE */
#endif /* _KERNEL */
OpenPOWER on IntegriCloud