summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroland <roland>2006-06-27 22:04:30 +0000
committerroland <roland>2006-06-27 22:04:30 +0000
commit875736d6d505129b1b02f185d548a32b55f0f84f (patch)
tree5ab460b70ebcc5e6040902b11a5f30d11c1eccec
parent7be90969051f3e5a35afaab063c36ad87de063c6 (diff)
downloadsystemtap-steved-875736d6d505129b1b02f185d548a32b55f0f84f.tar.gz
systemtap-steved-875736d6d505129b1b02f185d548a32b55f0f84f.tar.xz
systemtap-steved-875736d6d505129b1b02f185d548a32b55f0f84f.zip
2006-06-27 Roland McGrath <roland@redhat.com>
* loc2c-runtime.h: Add some comments.
-rw-r--r--runtime/loc2c-runtime.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h
index fb76bbfc..c88ad97e 100644
--- a/runtime/loc2c-runtime.h
+++ b/runtime/loc2c-runtime.h
@@ -33,11 +33,32 @@
/* These operations are target-specific. */
#include <asm/uaccess.h>
+/* Given a DWARF register number, fetch its intptr_t (long) value from the
+ probe context, or store a new value into the probe context.
+
+ The register number argument is always a canonical decimal number, so it
+ can be pasted into an identifier name. These definitions turn it into a
+ per-register macro, defined below for machines with individually-named
+ registers. */
#define fetch_register(regno) \
((intptr_t) dwarf_register_##regno (c->regs))
#define store_register(regno, value) \
(dwarf_register_##regno (c->regs) = (value))
+
+/* The deref and store_deref macros are called to safely access addresses
+ in the probe context. These macros are used only for kernel addresses.
+ The macros must handle bogus addresses here gracefully (as from
+ corrupted data structures, stale pointers, etc), by doing a "goto
+ deref_fault".
+
+ On most machines, the asm/uaccess.h macros __get_user_asm and
+ __put_user_asm do exactly the low-level work we need to access memory
+ with fault handling, and are not actually specific to user-address
+ access at all. Each machine's definition of deref and deref_store here
+ must work right for kernel addresses, and can use whatever existing
+ machine-specific kernel macros are convenient. */
+
#if defined __i386__
/* The stack pointer is unlike other registers. When a trap happens in
@@ -128,7 +149,7 @@
goto deref_fault; \
})
-#elif defined __ia64__
+#elif defined __ia64__
#define deref(size, addr) \
({ \
int _bad = 0; \