From aedd8349bc9f0a90d218b79aaa1de49a298c299f Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Thu, 9 Sep 1993 18:24:19 +0000 Subject: [PATCH] Linux patch. --- v7/src/microcode/ux.h | 11 +++++++- v7/src/microcode/uxsock.c | 16 ++++++++---- v7/src/microcode/uxtrap.h | 53 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/v7/src/microcode/ux.h b/v7/src/microcode/ux.h index 251239582..f56fb6b11 100644 --- a/v7/src/microcode/ux.h +++ b/v7/src/microcode/ux.h @@ -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 /* constants for access() */ #ifndef R_OK diff --git a/v7/src/microcode/uxsock.c b/v7/src/microcode/uxsock.c index 5c9dc2010..705937244 100644 --- a/v7/src/microcode/uxsock.c +++ b/v7/src/microcode/uxsock.c @@ -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) { diff --git a/v7/src/microcode/uxtrap.h b/v7/src/microcode/uxtrap.h index 5e8d06307..4358c62f8 100644 --- a/v7/src/microcode/uxtrap.h +++ b/v7/src/microcode/uxtrap.h @@ -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 */ #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 -- 2.25.1