source: trunk/ccl/lisp-kernel/lisp.h @ 557

Last change on this file since 557 was 557, checked in by gb, 16 years ago

PPC64 changes (some of them rather suspect ...). 32-bit kernel may be a
little funky ...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1/*
2   Copyright (C) 1994-2001 Digitool, Inc
3   This file is part of OpenMCL. 
4
5   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
6   License , known as the LLGPL and distributed with OpenMCL as the
7   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8   which is distributed with OpenMCL as the file "LGPL".  Where these
9   conflict, the preamble takes precedence. 
10
11   OpenMCL is referenced in the preamble as the "LIBRARY."
12
13   The LLGPL is also available online at
14   http://opensource.franz.com/preamble.html
15*/
16
17#ifndef __lisp__
18#define __lisp__
19
20/*
21  On some platforms (the G5 under Panther when -mpowerpc64 is in effect)
22  the C compiler belives that pointers are only 32 bits wide, even though
23  the machine's in 64-bit mode.  If that's the case, prepand a gensym'ed
24  word to any pointer fields in any structure accessed by both C and Lisp
25  code.
26
27  This means that C and Lisp will have a slightly different notion of the
28  offset of each such field.  The alternative - representing the pointer
29  as a 64-bit int and casting on every reference - seems just as ugly.
30*/
31
32#if defined(PPC64) && defined(FOREIGN_POINTER_32BIT)
33#define NATURAL_POINTER_FIELD(type,name) unsigned _ ## name; type * name
34#else
35#define NATURAL_POINTER_FIELD(type,name) type *name;
36#endif
37
38
39#include "lisptypes.h"
40
41#include "constants.h"
42#include "macros.h"
43
44
45
46static inline unsigned long
47_align_to_power_of_2(unsigned long n, unsigned power)
48{
49  unsigned align = (1<<power) -1;
50
51  return (n+align) & ~align;
52}
53
54#define align_to_power_of_2(n,p) _align_to_power_of_2(((unsigned long)(n)),p)
55
56static inline unsigned long
57_truncate_to_power_of_2(unsigned long n, unsigned power)
58{
59  return n & ~((1<<power) -1);
60}
61
62#define truncate_to_power_of_2(n,p) _truncate_to_power_of_2((unsigned long)(n),p)
63
64LispObj start_lisp(TCR*, LispObj);
65
66#include "kernel-globals.h"
67#endif
Note: See TracBrowser for help on using the repository browser.