* callback.h (CB_SYSCALL): Change byte count arguments to
authorDoug Evans <dje@google.com>
Wed, 26 Nov 1997 19:49:13 +0000 (19:49 +0000)
committerDoug Evans <dje@google.com>
Wed, 26 Nov 1997 19:49:13 +0000 (19:49 +0000)
{read,write}_mem to `int'.  New member `magic'.
(CB_SYSCALL_MAGIC,CB_SYSCALL_INIT): New macros.

include/ChangeLog
include/callback.h

index cda5da0f249907af775c36501fa8b280648c2e2d..02cf6f02bf6d5a54683cba3abcca997b425e7999 100644 (file)
@@ -1,3 +1,9 @@
+Wed Nov 26 11:39:30 1997  Doug Evans  <devans@canuck.cygnus.com>
+
+       * 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.
+
 Tue Nov 25 01:35:52 1997  Doug Evans  <devans@seba.cygnus.com>
 
        * callback.h (struct stat): Move forward decl up.
index 6b700fe37b185162c077c763df8a7ebf39c8053d..d2847cca0a0282c8cb5ea955636fb92bb5c4cb4b 100644 (file)
@@ -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)
 \f
 /* Return codes for various interface routines.  */
 
This page took 0.026045 seconds and 4 git commands to generate.