1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
diff -bcrN gc.org/doc/README.ews4800 gc/doc/README.ews4800
*** gc.org/doc/README.ews4800 Thu Jan 1 09:00:00 1970
--- gc/doc/README.ews4800 Wed Jul 25 17:38:57 2001
***************
*** 0 ****
--- 1,75 ----
+ GC on EWS4800
+ -------------
+
+ 1. About EWS4800
+ EWS4800 is 32bit/64bit workstation.
+
+ Vender: NEC Corporation
+ OS: UX/4800 R9.* - R13.* (SystemV R4.2)
+ CPU: R4000, R4400, R10000 (MIPS)
+
+ 2. Compiler
+
+ 32bit:
+ Use ANSI C compiler.
+ CC = /usr/abiccs/bin/cc
+
+ 64bit:
+ Use 64bit ANSI C compiler.
+ CC = /usr/ccs64/bin/cc
+ AR = /usr/ccs64/bin/ar
+
+ 3. ELF file format
+ *** Caution: The following infomation is empirical. ***
+
+ 32bit:
+ ELF file has an unique format. (See a.out(4) and end(3C).)
+
+ &_start
+ : text segment
+ &etext
+ DATASTART
+ : data segment (initialized)
+ &edata
+ DATASTART2
+ : data segment (uninitialized)
+ &end
+
+ Here, DATASTART and DATASTART2 are macros of GC, and are defined as
+ the following equations. (See include/private/gcconfig.h.)
+ The algorithm for DATASTART is similar with the function
+ GC_SysVGetDataStart() in os_dep.c.
+
+ DATASTART = ((&etext + 0x3ffff) & ~0x3ffff) + (&etext & 0xffff)
+
+ Dynamically linked:
+ DATASTART2 = (&_gp + 0x8000 + 0x3ffff) & ~0x3ffff
+
+ Statically linked:
+ DATASTART2 = &edata
+
+ GC has to check addresses both between DATASTART and &edata, and
+ between DATASTART2 and &end. If a program accesses between &etext
+ and DATASTART, or between &edata and DATASTART2, the segmentation
+ error occurs and the program stops.
+
+ If a program is statically linked, there is not a gap between
+ &edata and DATASTART2. The global symbol &_DYNAMIC_LINKING is used
+ for the detection.
+
+ 64bit:
+ ELF file has a simple format. (See end(3C).)
+
+ _ftext
+ : text segment
+ _etext
+ _fdata = DATASTART
+ : data segment (initialized)
+ _edata
+ _fbss
+ : data segment (uninitialized)
+ _end = DATAEND
+
+ --
+ Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
diff -bcrN gc.org/include/private/gcconfig.h gc/include/private/gcconfig.h
*** gc.org/include/private/gcconfig.h Sun Jul 1 06:29:27 2001
--- gc/include/private/gcconfig.h Wed Jul 25 17:38:57 2001
***************
*** 75,83 ****
# endif
# define mach_type_known
# endif
! # if defined(mips) || defined(__mips)
# define MIPS
! # if !defined(LINUX)
# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
# define ULTRIX
# else
--- 75,86 ----
# endif
# define mach_type_known
# endif
! # if defined(mips) || defined(__mips) || defined(_mips)
# define MIPS
! # if defined(nec_ews) || defined(_nec_ews)
! # define EWS4800
! # endif
! # if !defined(LINUX) && !defined(EWS4800)
# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
# define ULTRIX
# else
***************
*** 1083,1088 ****
--- 1086,1114 ----
/* instead. But some kernel versions seem to give the wrong */
/* value from /proc. */
# endif /* Linux */
+ # ifdef EWS4800
+ # define HEURISTIC2
+ # if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
+ extern int _fdata[], _end[];
+ # define DATASTART ((ptr_t)_fdata)
+ # define DATAEND ((ptr_t)_end)
+ # define CPP_WORDSZ _MIPS_SZPTR
+ # define ALIGNMENT (_MIPS_SZPTR/8)
+ # else
+ extern int etext, edata, end;
+ extern int _DYNAMIC_LINKING, _gp;
+ # define DATASTART ((ptr_t)((((word)&etext + 0x3ffff) & ~0x3ffff) \
+ + ((word)&etext & 0xffff)))
+ # define DATAEND (&edata)
+ # define DATASTART2 (&_DYNAMIC_LINKING \
+ ? (ptr_t)(((word)&_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
+ : (ptr_t)&edata)
+ # define DATAEND2 (&end)
+ # define ALIGNMENT 4
+ # endif
+ # define OS_TYPE "EWS4800"
+ # define USE_GENERIC_PUSH_REGS 1
+ # endif
# ifdef ULTRIX
# define HEURISTIC2
# define DATASTART (ptr_t)0x10000000
diff -bcrN gc.org/mach_dep.c gc/mach_dep.c
*** gc.org/mach_dep.c Thu Jun 28 05:54:23 2001
--- gc/mach_dep.c Wed Jul 25 17:38:57 2001
***************
*** 429,435 ****
*i = 0;
}
# if defined(POWERPC) || defined(MSWIN32) || defined(MSWINCE) \
! || defined(UTS4) || defined(LINUX)
(void) setjmp(regs);
# else
(void) _setjmp(regs);
--- 429,435 ----
*i = 0;
}
# if defined(POWERPC) || defined(MSWIN32) || defined(MSWINCE) \
! || defined(UTS4) || defined(LINUX) || defined(EWS4800)
(void) setjmp(regs);
# else
(void) _setjmp(regs);
diff -bcrN gc.org/os_dep.c gc/os_dep.c
*** gc.org/os_dep.c Tue Jun 26 11:32:26 2001
--- gc/os_dep.c Wed Jul 25 17:38:57 2001
***************
*** 1088,1093 ****
--- 1088,1096 ----
GC_add_roots_inner(DATASTART, (char *)sbrk(0), FALSE);
# else
GC_add_roots_inner(DATASTART, (char *)(DATAEND), FALSE);
+ # if defined(DATASTART2)
+ GC_add_roots_inner(DATASTART2, (char *)(DATAEND2), FALSE);
+ # endif
# endif
# endif
# if !defined(PCR) && (defined(NEXT) || defined(MACOSX))
|