source: release/1.9/source/lisp-kernel/platform-darwinx8632.h @ 15706

Last change on this file since 15706 was 15706, checked in by gb, 6 years ago

Propagate recent trunk changes.

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 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/* offsets into uc_mcontext.ss */
40
41#define REG_EAX 0
42#define REG_EBX 1
43#define REG_ECX 2
44#define REG_EDX 3
45#define REG_EDI 4
46#define REG_ESI 5
47#define REG_EBP 6
48#define REG_ESP 7
49#define REG_EFL 9
50#define REG_EIP 10
51
52extern void darwin_sigreturn(ExceptionInformation *,unsigned);
53
54/* xp accessors, sigreturn stuff */
55#define DarwinSigReturn(context) do {\
56    darwin_sigreturn(context, 0x1e);                 \
57    Bug(context,"sigreturn returned");\
58  } while (0)
59
60#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss)))
61#define xpGPR(x,gprno) (xpGPRvector(x)[gprno])
62#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new)
63#define xpPC(x) (xpGPR(x,Iip))
64#define eflags_register(xp) xpGPR(xp,Iflags)
65#define xpFPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__fs.__fpu_xmm0)))
66#define xpMMXvector(x) (&(UC_MCONTEXT(x)->__fs.__fpu_stmm0))
67/* Note that this yields only the lower half of the MMX reg on x8632 */
68#define xpMMXreg(x,n) *(natural *)&(xpMMXvector(x)[n])
69#define xpMXCSR(x) (UC_MCONTEXT(x)->__fs.__fpu_mxcsr)
70#define SIGNUM_FOR_INTN_TRAP SIGSEGV /* Not really, but our Mach handler fakes that */
71#define IS_MAYBE_INT_TRAP(info,xp) ((UC_MCONTEXT(xp)->__es.__trapno == 0xd) && (((UC_MCONTEXT(xp)->__es.__err)&7)==2))
72#define IS_PAGE_FAULT(info,xp) (UC_MCONTEXT(xp)->__es.__trapno == 0xe)
73/* The x86 version of sigreturn just needs the context argument; the
74   hidden, magic "flavor" argument that sigtramp uses is ignored. */
75#define SIGRETURN(context) DarwinSigReturn(context)
76
77
78#include "os-darwin.h"
79
Note: See TracBrowser for help on using the repository browser.