source: trunk/source/lisp-kernel/platform-darwinx8664.h @ 15473

Last change on this file since 15473 was 15473, checked in by gb, 7 years ago

Ensure that darwin_sigreturn() is prototyped on platforms where it's
used.

Remove some remaining Mach-isms (notably the paging info stuff used
by GC-VERBOSE; just use getrusage()).

Make sure that the right headers are included in threads.h, to support
the remaining Mach-ism (use of Mach semaphores. Apple still doesn't
implement POSIX semaphores, though the functions have been prototyped
for several years now.)

This builds without warnings or errors on 10.8.1 with Xcode 4.4's
toolchain. It -may- address the problems described in ticket:1019.

File size: 2.7 KB
Line 
1/*
2   Copyright (C) 2010 Clozure Associates
3   Copyright (C) 1994-2001 Digitool, Inc
4   This file is part of Clozure CL. 
5
6   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
7   License , known as the LLGPL and distributed with Clozure CL as the
8   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9   which is distributed with Clozure CL as the file "LGPL".  Where these
10   conflict, the preamble takes precedence. 
11
12   Clozure CL is referenced in the preamble as the "LIBRARY."
13
14   The LLGPL is also available online at
15   http://opensource.franz.com/preamble.html
16*/
17
18#define WORD_SIZE 64
19#define PLATFORM_OS PLATFORM_OS_DARWIN
20#define PLATFORM_CPU PLATFORM_CPU_X86
21#define PLATFORM_WORD_SIZE PLATFORM_WORD_SIZE_64
22
23
24#include <sys/signal.h>
25#include <sys/ucontext.h>
26
27/* ucontext/mcontext stuff; saner if OS >= 10.5 */
28typedef mcontext_t MCONTEXT_T;
29typedef ucontext_t ExceptionInformation;
30#define UC_MCONTEXT(UC) UC->uc_mcontext
31
32#include "standard-inttypes.h"
33
34#define MAXIMUM_MAPPABLE_MEMORY (512L<<30L)
35#define IMAGE_BASE_ADDRESS 0x300000000000L
36
37#include "lisptypes.h"
38#include "x86-constants64.h"
39
40#define REG_RAX 0
41#define REG_RBX 1
42#define REG_RCX 2
43#define REG_RDX 3
44#define REG_RDI 4
45#define REG_RSI 5
46#define REG_RBP 6
47#define REG_RSP 7
48#define REG_R8 8
49#define REG_R9 9
50#define REG_R10 10
51#define REG_R11 11
52#define REG_R12 12
53#define REG_R13 13
54#define REG_R14 14
55#define REG_R15 15
56#define REG_RIP 16
57#define REG_RFL 17
58
59extern void darwin_sigreturn(ExceptionInformation *,unsigned);
60
61/* xp accessors, sigreturn stuff */
62#define DarwinSigReturn(context) do {\
63    darwin_sigreturn(context, 0x1e);                 \
64    Bug(context,"sigreturn returned");\
65  } while (0)
66
67#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss)))
68#define xpGPR(x,gprno) (xpGPRvector(x)[gprno])
69#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new)
70#define xpPC(x) (xpGPR(x,Iip))
71#define eflags_register(xp) xpGPR(xp,Iflags)
72#define xpFPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__fs.__fpu_xmm0)))
73#define xpMMXvector(x) (&(UC_MCONTEXT(x)->__fs.__fpu_stmm0))
74/* Note that this yields only the lower half of the MMX reg on x8632 */
75#define xpMMXreg(x,n) *(natural *)&(xpMMXvector(x)[n])
76#define xpMXCSR(x) (UC_MCONTEXT(x)->__fs.__fpu_mxcsr)
77#define SIGNUM_FOR_INTN_TRAP SIGSEGV /* Not really, but our Mach handler fakes that */
78#define IS_MAYBE_INT_TRAP(info,xp) ((UC_MCONTEXT(xp)->__es.__trapno == 0xd) && (((UC_MCONTEXT(xp)->__es.__err)&7)==2))
79#define IS_PAGE_FAULT(info,xp) (UC_MCONTEXT(xp)->__es.__trapno == 0xe)
80/* The x86 version of sigreturn just needs the context argument; the
81   hidden, magic "flavor" argument that sigtramp uses is ignored. */
82#define SIGRETURN(context) DarwinSigReturn(context)
83
84
85#include "os-darwin.h"
86
87
88#define SEPARATE_ALTSTACK 1
Note: See TracBrowser for help on using the repository browser.