Skip to content

Commit

Permalink
For some reason that I have forgotten, we once needed to use
Browse files Browse the repository at this point in the history
the sigreturn system call directly on Darwin.

As far as I can tell now, this has not been required for a very
long time.  What's more, it's actively harmful on a recent
beta version of macOS 10.4.  So, just get rid of it.
  • Loading branch information
xrme committed Aug 31, 2018
1 parent e6fbff8 commit 212c254
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 39 deletions.
11 changes: 1 addition & 10 deletions lisp-kernel/platform-darwinx8632.h
Expand Up @@ -46,16 +46,9 @@ typedef ucontext_t ExceptionInformation;
#define REG_EFL 9
#define REG_EIP 10

extern void darwin_sigreturn(ExceptionInformation *,unsigned);

/* xp accessors, sigreturn stuff */
#define DARWIN_USE_PSEUDO_SIGRETURN 1

#define DarwinSigReturn(context) do {\
darwin_sigreturn(context, 0x1e); \
Bug(context,"sigreturn returned");\
} while (0)

#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss)))
#define xpGPR(x,gprno) (xpGPRvector(x)[gprno])
#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new)
Expand All @@ -69,9 +62,7 @@ extern void darwin_sigreturn(ExceptionInformation *,unsigned);
#define SIGNUM_FOR_INTN_TRAP SIGSEGV /* Not really, but our Mach handler fakes that */
#define IS_MAYBE_INT_TRAP(info,xp) ((UC_MCONTEXT(xp)->__es.__trapno == 0xd) && (((UC_MCONTEXT(xp)->__es.__err)&7)==2))
#define IS_PAGE_FAULT(info,xp) (UC_MCONTEXT(xp)->__es.__trapno == 0xe)
/* The x86 version of sigreturn just needs the context argument; the
hidden, magic "flavor" argument that sigtramp uses is ignored. */
#define SIGRETURN(context) DarwinSigReturn(context)
#define SIGRETURN(context)

#include <mach/mach.h>
#include <mach/mach_error.h>
Expand Down
9 changes: 1 addition & 8 deletions lisp-kernel/platform-darwinx8664.h
Expand Up @@ -58,11 +58,6 @@ extern void darwin_sigreturn(ExceptionInformation *,unsigned);
/* xp accessors, sigreturn stuff */
#define DARWIN_USE_PSEUDO_SIGRETURN 1

#define DarwinSigReturn(context) do {\
darwin_sigreturn(context, 0x1e); \
Bug(context,"sigreturn returned");\
} while (0)

#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss)))
#define xpGPR(x,gprno) (xpGPRvector(x)[gprno])
#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new)
Expand All @@ -76,9 +71,7 @@ extern void darwin_sigreturn(ExceptionInformation *,unsigned);
#define SIGNUM_FOR_INTN_TRAP SIGSEGV /* Not really, but our Mach handler fakes that */
#define IS_MAYBE_INT_TRAP(info,xp) ((UC_MCONTEXT(xp)->__es.__trapno == 0xd) && (((UC_MCONTEXT(xp)->__es.__err)&7)==2))
#define IS_PAGE_FAULT(info,xp) (UC_MCONTEXT(xp)->__es.__trapno == 0xe)
/* The x86 version of sigreturn just needs the context argument; the
hidden, magic "flavor" argument that sigtramp uses is ignored. */
#define SIGRETURN(context) DarwinSigReturn(context)
#define SIGRETURN(context)

#include <mach/mach.h>
#include <mach/mach_error.h>
Expand Down
3 changes: 0 additions & 3 deletions lisp-kernel/pmcl-kernel.c
Expand Up @@ -854,9 +854,6 @@ user_signal_handler (int signum, siginfo_t *info, ExceptionInformation *context)
else if (signum == SIGQUIT) {
lisp_global(INTFLAG) = (((signum<<8) + 2) << fixnumshift);
}
#ifdef DARWIN
DarwinSigReturn(context);
#endif
}

#endif
Expand Down
9 changes: 0 additions & 9 deletions lisp-kernel/x86-asmutils32.s
Expand Up @@ -179,15 +179,6 @@ _exportfn(C(freebsd_sigreturn))
_endfn
__endif

__ifdef(`DARWIN')
_exportfn(C(darwin_sigreturn))
__(movl $0xb8,%eax) /* SYS_sigreturn */
__(int $0x80)
__(ret) /* shouldn't return */

_endfn
__endif

_exportfn(C(get_vector_registers))
__(ret)
_endfn
Expand Down
9 changes: 0 additions & 9 deletions lisp-kernel/x86-asmutils64.s
Expand Up @@ -184,15 +184,6 @@ _endfn
_exportfn(C(put_vector_registers))
_endfn

__ifdef(`DARWIN')
_exportfn(C(darwin_sigreturn))
.globl C(sigreturn)
__(movl $0x20000b8,%eax)
__(syscall)
__(ret)
_endfn
__endif

__ifdef(`WIN_64')
/* %rcx = CONTEXT, %rdx = tcr, %r8 = old_valence. This pretty
much has to be uninterruptible */
Expand Down

0 comments on commit 212c254

Please sign in to comment.