source: trunk/source/lisp-kernel/platform-darwinx8632.h @ 13638

Last change on this file since 13638 was 13638, checked in by gb, 10 years ago

Move more PPC exception stuff, x86 exception stuff to platform heeaders.
Introduce OS headers; so far, just signal constants. Include the applicable
os-*.h in platform-*.h.
Ensure that Makefiles have constants.h, os*.h in CHEADERS.
Will try to smoke-test & fix typos before sleeping.

File size: 2.5 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 32
19#define PLATFORM_OS PLATFORM_OS_DARWIN
20#define PLATFORM_CPU PLATFORM_CPU_X86
21#define PLATFORM_WORD_SIZE PLATFORM_WORD_SIZE_32
22
23/* ucontext/mcontext stuff; saner if OS >= 10.5 */
24#include <sys/signal.h>
25#include <sys/ucontext.h>
26
27#define UC_MCONTEXT(UC) UC->uc_mcontext
28typedef mcontext_t MCONTEXT_T;
29typedef ucontext_t ExceptionInformation;
30
31#include "standard-inttypes.h"
32
33#define MAXIMUM_MAPPABLE_MEMORY ((1U<<31)-2*heap_segment_size)
34#define IMAGE_BASE_ADDRESS 0x04000000
35
36#include "lisptypes.h"
37#include "x86-constants32.h"
38
39
40/* xp accessors, sigreturn stuff */
41#define DARWIN_USE_PSEUDO_SIGRETURN 1
42#define DarwinSigReturn(context) do {\
43    darwin_sigreturn(context);\
44    Bug(context,"sigreturn returned");\
45  } while (0)
46
47#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss)))
48#define xpGPR(x,gprno) (xpGPRvector(x)[gprno])
49#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new)
50#define xpPC(x) (xpGPR(x,Iip))
51#define eflags_register(xp) xpGPR(xp,Iflags)
52#define xpFPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__fs.__fpu_xmm0)))
53#define xpMMXvector(x) (&(UC_MCONTEXT(x)->__fs.__fpu_stmm0))
54/* Note that this yields only the lower half of the MMX reg on x8632 */
55#define xpMMXreg(x,n) *(natural *)&(xpMMXvector(x)[n])
56
57#define SIGNUM_FOR_INTN_TRAP SIGSEGV /* Not really, but our Mach handler fakes that */
58#define IS_MAYBE_INT_TRAP(info,xp) ((UC_MCONTEXT(xp)->__es.__trapno == 0xd) && (((UC_MCONTEXT(xp)->__es.__err)&7)==2))
59#define IS_PAGE_FAULT(info,xp) (UC_MCONTEXT(xp)->__es.__trapno == 0xe)
60/* The x86 version of sigreturn just needs the context argument; the
61   hidden, magic "flavor" argument that sigtramp uses is ignored. */
62#define SIGRETURN(context) DarwinSigReturn(context)
63
64#include <mach/mach.h>
65#include <mach/mach_error.h>
66#include <mach/machine/thread_state.h>
67#include <mach/machine/thread_status.h>
68
69pthread_mutex_t *mach_exception_lock;
70
71#include "os-darwin.h"
Note: See TracBrowser for help on using the repository browser.