source: trunk/ccl/lisp-kernel/area.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: 5.2 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 __AREA_H__
18#define __AREA_H__ 1
19
20
21#include "bits.h"
22#include "memprotect.h"
23
24
25
26typedef enum {
27  AREA_VOID = 0,                /* Not really an area at all */
28  AREA_CSTACK = 4,              /* A control stack */
29  AREA_VSTACK = 8,              /* A value stack.  The GC sees it as being doubleword-aligned */
30  AREA_TSTACK = 12,             /* A temp stack.  It -is- doubleword-aligned */
31  AREA_READONLY = 16,           /* A (cfm) read-only section. */
32  AREA_STATICLIB = 20,          /* A static section in a shared library.  May
33                                 contain pointers to other static sections, but
34                                 not to any dynamic areas */
35  AREA_STATIC = 24,             /* A (cfm or other) static section: contains
36                                 roots, but not GCed */
37  AREA_DYNAMIC = 28             /* A heap. Only one such area is "the heap."*/
38} area_code;
39
40typedef struct area {
41  NATURAL_POINTER_FIELD(struct area,pred);  /* linked list predecessor */
42  NATURAL_POINTER_FIELD(struct area,succ);  /* linked list successor */
43  NATURAL_POINTER_FIELD(char,low);        /* arithmetic lower limit on addresses (inclusive) */
44  NATURAL_POINTER_FIELD(char,high);        /* arithmetic upper limit on addresses (exclusive) */
45  NATURAL_POINTER_FIELD(char,active);       /* low bound (stack) or high bound (heap) */
46  NATURAL_POINTER_FIELD(char,softlimit);                /* only makes sense for dynamic heaps & stacks */
47  NATURAL_POINTER_FIELD(char,hardlimit);                /* only makes sense for dynamic heaps & stacks */
48  natural code;
49  NATURAL_POINTER_FIELD(natural, markbits);           /* markbits for active area */
50  natural ndnodes;              /* "active" size of dynamic area or stack */
51  NATURAL_POINTER_FIELD(struct area,older);             /* if ephemeral, the next older ephemeral area
52                                 or the dynamic area */
53  NATURAL_POINTER_FIELD(struct area,younger); /* if ephemeral, the next "younger" ephemeral area
54                                  if there is one.  If dynamic, the oldest ephemeral
55                                 area. */
56  NATURAL_POINTER_FIELD(char, h);                       /* The pointer allocated to contain this area, or NULL
57                                 if the operating system allocated it for us. */
58  NATURAL_POINTER_FIELD(protected_area,softprot);  /* "soft" protected_area */
59  NATURAL_POINTER_FIELD(protected_area,hardprot);  /* "hard" protected_area */
60  natural owner;               /* position in external_containers linked list */
61  NATURAL_POINTER_FIELD(natural, refbits); /* intergenerational references.
62                                               May or may not be the same as markbits */
63  natural threshold; /* egc threshold (boxed "fullword count") or 0 */
64  LispObj gccount;              /* boxed generation GC count. */
65} area;
66
67
68/*
69  Areas are kept in a doubly-linked list.
70  The list header is just a distinguished element of
71  that list; by convention, the "active" dynamic
72  area is described by that header's successor, and areas
73  that may have entries in their "markbits" vector (heaps)
74  precede (in the area_list->succ sense) those  that don't (stacks).
75  The list header's "area" pointer is an "AREA_VOID" area; the header
76  (once allocated during kernel initialization) never
77  moves or changes.  Lisp code can get its hands on
78  the list header via a nilreg global, and carefully,
79  atomically, traverse it to do ROOM, etc.
80*/
81
82
83area *new_area(BytePtr, BytePtr, area_code);
84void add_area(area *);
85area *remove_area(area *);
86area *area_containing(BytePtr);
87area *stack_area_containing(BytePtr);
88area *heap_area_node_containing(BytePtr);
89void tenure_to_area(area *);
90void untenure_from_area(area *);
91
92/* serialize add_area/remove_area */
93void *area_lock;
94
95#define reserved_area ((area *)(all_areas))
96#define active_dynamic_area ((area *)(reserved_area->succ))
97
98typedef struct area_list {
99  area *the_area;
100  struct area_list *next;
101} area_list;
102
103/* The useable size of a tsp or vsp stack segment.
104  */
105/* #define STACK_SEGMENT_SIZE (64<<10) */
106#define MIN_CSTACK_SIZE (1<<17)
107#define CSTACK_HARDPROT (100<<10)
108#define CSTACK_SOFTPROT (100<<10)
109#define MIN_VSTACK_SIZE (1<<16)
110#define VSTACK_HARDPROT (1<<12)
111#define VSTACK_SOFTPROT (1<<16)
112#define MIN_TSTACK_SIZE (1<<18)
113#define TSTACK_HARDPROT 0
114#define TSTACK_SOFTPROT (1<<16)
115#define CS_OVERFLOW_FORCE_LIMIT ((unsigned)0xfffffff0)
116
117#ifdef LINUX
118#define IMAGE_BASE_ADDRESS 0x31000000
119#endif
120#ifdef DARWIN
121#define IMAGE_BASE_ADDRESS 0x01000000
122#endif
123
124#define PURESPACE_RESERVE 0x04000000 /* 64MB */
125#define STATIC_RESERVE heap_segment_size
126#define STATIC_BASE_ADDRESS 0x00001000
127
128extern LispObj image_base;
129extern BytePtr pure_space_start, pure_space_active, pure_space_limit;
130extern BytePtr static_space_start, static_space_active, static_space_limit;
131extern area *find_readonly_area(void);
132
133#endif /* __AREA_H__ */
Note: See TracBrowser for help on using the repository browser.