aboutsummaryrefslogtreecommitdiff
path: root/include/callback.h
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>1997-11-26 19:49:13 +0000
committerDoug Evans <dje@google.com>1997-11-26 19:49:13 +0000
commit881a60116f6ee0886327e818024bb0d9b29ed31a (patch)
tree4f1265ed1a23cf2aefc3afd5076419f315f3c058 /include/callback.h
parentfc63d75ab3d3989b84af3817f8169adc2dfe36b2 (diff)
downloadgdb-881a60116f6ee0886327e818024bb0d9b29ed31a.zip
gdb-881a60116f6ee0886327e818024bb0d9b29ed31a.tar.gz
gdb-881a60116f6ee0886327e818024bb0d9b29ed31a.tar.bz2
* callback.h (CB_SYSCALL): Change byte count arguments to
{read,write}_mem to `int'. New member `magic'. (CB_SYSCALL_MAGIC,CB_SYSCALL_INIT): New macros.
Diffstat (limited to 'include/callback.h')
-rw-r--r--include/callback.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/include/callback.h b/include/callback.h
index 6b700fe..d2847cc 100644
--- a/include/callback.h
+++ b/include/callback.h
@@ -203,10 +203,30 @@ typedef struct cb_syscall {
PTR p2;
long x1,x2;
- /* Callbacks for reading/writing memory (e.g. for read/write syscalls). */
- unsigned long (*read_mem) PARAMS ((host_callback *, struct cb_syscall *, unsigned long taddr, char *buf, unsigned long bytes));
- unsigned long (*write_mem) PARAMS ((host_callback *, struct cb_syscall *, unsigned long taddr, const char *buf, unsigned long bytes));
+ /* Callbacks for reading/writing memory (e.g. for read/write syscalls).
+ ??? long or unsigned long might be better to use for the `count'
+ argument here. We mimic sim_{read,write} for now. Be careful to
+ test any changes with -Wall -Werror, mixed signed comparisons
+ will get you. */
+ int (*read_mem) PARAMS ((host_callback *, struct cb_syscall *,
+ unsigned long taddr, char *buf, int bytes));
+ int (*write_mem) PARAMS ((host_callback *, struct cb_syscall *,
+ unsigned long taddr, const char *buf, int bytes));
+
+ /* For sanity checking, should be last entry. */
+ int magic;
} CB_SYSCALL;
+
+/* Magic number sanity checker. */
+#define CB_SYSCALL_MAGIC 0x12344321
+
+/* Macro to initialize CB_SYSCALL. Called first, before filling in
+ any fields. */
+#define CB_SYSCALL_INIT(sc) \
+do { \
+ memset ((sc), 0, sizeof (*(sc))); \
+ (sc)->magic = CB_SYSCALL_MAGIC; \
+} while (0)
/* Return codes for various interface routines. */