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

Last change on this file since 14347 was 14295, checked in by rme, 9 years ago

Eliminate some (but not all) warnings produced when building with
"-Wall -Wno-format". Also a couple of minor changes that enable
clang to build the lisp kernel (at least on x8632 and x8664).

File size: 2.6 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/* xp accessors, sigreturn stuff */
41#define DARWIN_USE_PSEUDO_SIGRETURN 1
42extern int darwin_sigreturn(ExceptionInformation *context);
43#define DarwinSigReturn(context) do {\
44    darwin_sigreturn(context);\
45    Bug(context,"sigreturn returned");\
46  } while (0)
47
48#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss)))
49#define xpGPR(x,gprno) (xpGPRvector(x)[gprno])
50#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new)
51#define xpPC(x) (xpGPR(x,Iip))
52#define eflags_register(xp) xpGPR(xp,Iflags)
53#define xpFPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__fs.__fpu_xmm0)))
54#define xpMMXvector(x) (&(UC_MCONTEXT(x)->__fs.__fpu_stmm0))
55/* Note that this yields only the lower half of the MMX reg on x8632 */
56#define xpMMXreg(x,n) *(natural *)&(xpMMXvector(x)[n])
57#define xpMXCSR(x) (UC_MCONTEXT(x)->__fs.__fpu_mxcsr)
58#define SIGNUM_FOR_INTN_TRAP SIGSEGV /* Not really, but our Mach handler fakes that */
59#define IS_MAYBE_INT_TRAP(info,xp) ((UC_MCONTEXT(xp)->__es.__trapno == 0xd) && (((UC_MCONTEXT(xp)->__es.__err)&7)==2))
60#define IS_PAGE_FAULT(info,xp) (UC_MCONTEXT(xp)->__es.__trapno == 0xe)
61/* The x86 version of sigreturn just needs the context argument; the
62   hidden, magic "flavor" argument that sigtramp uses is ignored. */
63#define SIGRETURN(context) DarwinSigReturn(context)
64
65#include <mach/mach.h>
66#include <mach/mach_error.h>
67#include <mach/machine/thread_state.h>
68#include <mach/machine/thread_status.h>
69
70pthread_mutex_t *mach_exception_lock;
71
72#include "os-darwin.h"
Note: See TracBrowser for help on using the repository browser.