Linux patch.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 9 Sep 1993 18:24:19 +0000 (18:24 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 9 Sep 1993 18:24:19 +0000 (18:24 +0000)
v7/src/microcode/ux.h
v7/src/microcode/uxsock.c
v7/src/microcode/uxtrap.h

index 251239582ca2356be56fdf7e138bc3d666230346..f56fb6b114b625e1c6d0172b29fee8989173ea55 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: ux.h,v 1.51 1993/09/09 18:18:54 gjr Exp $
+$Id: ux.h,v 1.52 1993/09/09 18:19:58 gjr Exp $
 
 Copyright (c) 1988-1993 Massachusetts Institute of Technology
 
@@ -579,6 +579,15 @@ typedef int wait_status_t;
 #ifndef SIGTTOU
 #define SIGTTOU 0
 #endif
+#ifndef SIGBUS
+#define SIGBUS 0
+#endif
+#ifndef SIGEMT
+#define SIGEMT 0
+#endif
+#ifndef SIGSYS
+#define SIGSYS 0
+#endif
 \f
 /* constants for access() */
 #ifndef R_OK
index 5c9dc20109ce3d3e5b0724d11606fa4d1de32a41..7059372443b5d5744016afc1629fb44d189e9d5d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: uxsock.c,v 1.11 1993/06/15 19:00:55 gjr Exp $
+$Id: uxsock.c,v 1.12 1993/09/09 18:21:59 gjr Exp $
 
 Copyright (c) 1990-1993 Massachusetts Institute of Technology
 
@@ -68,7 +68,9 @@ DEFUN (OS_open_tcp_stream_socket, (host, port), char * host AND int port)
     }
     (address . sin_port) = port;
     STD_VOID_SYSTEM_CALL
-      (syscall_connect, (UX_connect (s, (&address), (sizeof (address)))));
+      (syscall_connect, (UX_connect (s,
+                                    ((struct sockaddr *) (& address)),
+                                    (sizeof (address)))));
   }
   MAKE_CHANNEL (s, channel_type_tcp_stream_socket, return);
 }
@@ -119,7 +121,9 @@ DEFUN (OS_open_unix_stream_socket, (filename), CONST char * filename)
     (address . sun_family) = AF_UNIX;
     strncpy ((address . sun_path), filename, (sizeof (address . sun_path)));
     STD_VOID_SYSTEM_CALL
-      (syscall_connect, (UX_connect (s, (&address), (sizeof (address)))));
+      (syscall_connect, (UX_connect (s,
+                                    ((struct sockaddr *) (& address)),
+                                    (sizeof (address)))));
   }
   MAKE_CHANNEL (s, channel_type_unix_stream_socket, return);
 #else /* not HAVE_UNIX_SOCKETS */
@@ -150,7 +154,9 @@ DEFUN (OS_open_server_socket, (port, ArgNo), unsigned int port AND int ArgNo)
     (address . sin_addr . s_addr) = INADDR_ANY;
     (address . sin_port) = port;
     STD_VOID_SYSTEM_CALL
-      (syscall_bind, (UX_bind (s, (&address), (sizeof (struct sockaddr_in)))));
+      (syscall_bind, (UX_bind (s,
+                              ((struct sockaddr *) (& address)),
+                              (sizeof (struct sockaddr_in)))));
   }
   STD_VOID_SYSTEM_CALL
     (syscall_listen, (UX_listen (s, SOCKET_LISTEN_BACKLOG)));
@@ -168,7 +174,7 @@ DEFUN (OS_server_connection_accept, (channel, peer_host, peer_port),
   int s;
 
   while ((s = (UX_accept ((CHANNEL_DESCRIPTOR (channel)),
-                         (&address),
+                         ((struct sockaddr *) (& address)),
                          (&address_length))))
         < 0)
   {
index 5e8d06307dc89c1e140768cf04c3f5dfdb4a5836..4358c62f8da802f777518c2d6c44025e9cde6f35 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: uxtrap.h,v 1.21 1993/08/28 22:46:43 gjr Exp $
+$Id: uxtrap.h,v 1.22 1993/09/09 18:24:19 gjr Exp $
 
 Copyright (c) 1990-1993 Massachusetts Institute of Technology
 
@@ -435,6 +435,53 @@ struct full_sigcontext
 /* INITIALIZE_UX_SIGNAL_CODES should be defined. */
 
 #endif /* i386 */
+
+#ifdef __linux
+/* Linux signal handlers are called with one argument -- the `signo'.
+   There's an alleged "iBCS signal stack" register dump just above it.
+   Thus, the fictitious `info' argument to the handler is actually the
+   first member of this register dump (described by struct sigcontext,
+   below).  Unfortunately, kludging SIGINFO_CODE to access the sc_trapno
+   will fail later on when looking at the saved_info. */
+#define SIGINFO_T long
+#define SIGINFO_VALID_P(info) (0)
+#define SIGINFO_CODE(info) (0)
+
+/* Here's the "iBCS signal stack", whatever that means. */
+struct sigcontext {
+  long sc_gs, sc_fs, sc_es, sc_ds, sc_edi, sc_esi, sc_ebp, sc_esp, sc_ebx;
+  long sc_edx, sc_ecx, sc_eax, sc_trapno, sc_err, sc_eip, sc_cs, sc_eflags;
+  long sc_esp_again, sc_ss;
+};
+
+/* INITIALIZE_FULL_SIGCONTEXT gives us a chance to generate a pointer to
+   the register dump, since it is used at the beginning of STD_HANDLER's.
+   In terms of the expected arguments to the STD_ signal HANDLER's, the
+   register dump is right above `signo', at `info', one long below `pscp',
+   which is what INITIALIZE_FULL_SIGCONTEXT is getting for `partial'.
+   Thus, our pointer to a `full'_SIGCONTEXT is initialized to the address
+   of `partial' minus 1 long. */
+#define HAVE_FULL_SIGCONTEXT
+#define DECLARE_FULL_SIGCONTEXT(name)                                  \
+  struct FULL_SIGCONTEXT * name
+#define INITIALIZE_FULL_SIGCONTEXT(partial, full)                      \
+  ((full) = ((struct FULL_SIGCONTEXT *) (((long *)&(partial))-1)))
+
+/* Grab them all.  Nobody looks at them, but grab them anyway. */
+#define PROCESSOR_NREGS                        19
+#define FULL_SIGCONTEXT_NREGS          19
+#define FULL_SIGCONTEXT_FIRST_REG(scp) (scp)
+
+#define SIGCONTEXT                     sigcontext
+#define SIGCONTEXT_SP(scp)             ((scp)->sc_esp)
+#define SIGCONTEXT_PC(scp)             ((scp)->sc_eip)
+
+#define FULL_SIGCONTEXT SIGCONTEXT
+#define FULL_SIGCONTEXT_SP SIGCONTEXT_SP
+#define FULL_SIGCONTEXT_PC SIGCONTEXT_PC
+#define FULL_SIGCONTEXT_RFREE(scp)     ((scp)->sc_edi)
+
+#endif /* __linux */
 \f
 #ifdef __alpha
 
@@ -540,9 +587,13 @@ struct full_sigcontext
 #endif
 
 #if !(defined (_NEXTOS) && (_NEXTOS_VERSION >= 20))
+#ifdef __linux
+extern unsigned int etext;
+#else
 #if !(defined (_HPUX) && (_HPUX_VERSION >= 80) && defined (hp9000s300))
 extern long etext;
 #endif
+#endif /* __linux */
 #  define get_etext() (&etext)
 #endif
 \f