source: release/1.9/source/lisp-kernel/ppc-constants64.s @ 16083

Last change on this file since 16083 was 15371, checked in by gb, 7 years ago

Ensure that lisp_globals_limit is defined before lisp_globals.s
is included. (Newer versions of gas can handle forward references
better than older versions do.)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.8 KB
Line 
1/*   Copyright (C) 2003-2009, Clozure Associates. */
2/*   Copyright (C) 1994-2001 Digitool, Inc */
3/*   This file is part of Clozure CL. */
4
5/*   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public */
6/*   License , known as the LLGPL and distributed with Clozure CL as the */
7/*   file "LICENSE".  The LLGPL consists of a preamble and the LGPL, */
8/*   which is distributed with Clozure CL as the file "LGPL".  Where these */
9/*   conflict, the preamble takes precedence. */
10
11/*   Clozure CL 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
17define(`rcontext',`r2')
18       
19nbits_in_word = 64
20nbits_in_byte = 8
21ntagbits = 4
22nlisptagbits = 3
23nfixnumtagbits = 3
24nlowtagbits = 2       
25num_subtag_bits = 8
26fixnumshift = 3
27fixnum_shift = 3
28fulltagmask = 15
29tagmask = 7
30fixnummask = 7
31ncharcodebits = 8
32charcode_shift = 8
33word_shift = 3
34node_size = 8
35dnode_size = 16
36dnode_align_bits = 4
37dnode_shift = dnode_align_bits       
38bitmap_shift = 6
39       
40fixnumone = (1<<fixnumshift)
41fixnum_one = fixnumone
42fixnum1 = fixnumone
43
44
45lowtagmask = ((1<<nlowtagbits)-1)
46lowtag_mask = lowtagmask
47
48lowtag_primary = 0
49lowtag_imm = 1
50lowtag_immheader = 2
51lowtag_nodeheader = 3
52
53tag_fixnum = 0
54
55fulltag_even_fixnum = 0
56fulltag_imm_0 = 1
57fulltag_immheader_0 = 2
58fulltag_nodeheader_0 = 3
59fulltag_cons = 4
60fulltag_imm_1 = 5
61fulltag_immheader_1 = 6
62fulltag_nodeheader_1 = 7
63fulltag_odd_fixnum = 8
64fulltag_imm_2 = 9
65fulltag_immheader_2 = 10
66fulltag_nodeheader_2 = 11
67fulltag_misc = 12
68fulltag_imm_3 = 13
69fulltag_immheader_3 = 14
70fulltag_nodeheader_3 = 15
71
72define(`define_subtag',`
73subtag_$1 = ($2 | ($3 << ntagbits))
74')
75                       
76cl_array_subtag_mask = 0x80
77define(`define_cl_array_subtag',`
78define_subtag($1,(cl_array_subtag_mask|$2),$3)
79')
80
81define_cl_array_subtag(arrayH,fulltag_nodeheader_1,0)
82define_cl_array_subtag(vectorH,fulltag_nodeheader_2,0)
83define_cl_array_subtag(simple_vector,fulltag_nodeheader_3,0)
84min_vector_subtag = subtag_vectorH
85min_array_subtag = subtag_arrayH
86       
87       
88ivector_class_64_bit = fulltag_immheader_3
89ivector_class_32_bit = fulltag_immheader_2
90ivector_class_other_bit = fulltag_immheader_1
91ivector_class_8_bit = fulltag_immheader_0
92
93define_cl_array_subtag(s64_vector,ivector_class_64_bit,1)
94define_cl_array_subtag(u64_vector,ivector_class_64_bit,2)
95define_cl_array_subtag(fixnum_vector,ivector_class_64_bit,3)       
96define_cl_array_subtag(double_float_vector,ivector_class_64_bit,4)
97define_cl_array_subtag(s32_vector,ivector_class_32_bit,1)
98define_cl_array_subtag(u32_vector,ivector_class_32_bit,2)
99define_cl_array_subtag(single_float_vector,ivector_class_32_bit,3)
100define_cl_array_subtag(simple_base_string,ivector_class_32_bit,5)
101define_cl_array_subtag(s16_vector,ivector_class_other_bit,1)
102define_cl_array_subtag(u16_vector,ivector_class_other_bit,2)
103define_cl_array_subtag(bit_vector,ivector_class_other_bit,7)
104define_cl_array_subtag(s8_vector,ivector_class_8_bit,1)
105define_cl_array_subtag(u8_vector,ivector_class_8_bit,2)
106/* There's some room for expansion in non-array ivector space. */
107define_subtag(macptr,ivector_class_64_bit,1)
108define_subtag(dead_macptr,ivector_class_64_bit,2)
109define_subtag(code_vector,ivector_class_32_bit,0)
110define_subtag(xcode_vector,ivector_class_32_bit,1)
111define_subtag(bignum,ivector_class_32_bit,2)
112define_subtag(double_float,ivector_class_32_bit,3)
113
114
115
116       
117/* Size doesn't matter for non-CL-array gvectors; I can't think of a good */
118/* reason to classify them in any particular way.  Let's put funcallable */
119/* things in the first slice by themselves, though it's not clear that */
120/* that helps FUNCALL much. */
121       
122gvector_funcallable = fulltag_nodeheader_0
123       
124define_subtag(function,gvector_funcallable,0)
125define_subtag(symbol,gvector_funcallable,1)
126define_subtag(catch_frame,fulltag_nodeheader_1,0)
127define_subtag(basic_stream,fulltag_nodeheader_1,1)
128define_subtag(lock,fulltag_nodeheader_1,2)
129define_subtag(hash_vector,fulltag_nodeheader_1,3)
130define_subtag(pool,fulltag_nodeheader_1,4)
131define_subtag(weak,fulltag_nodeheader_1,5)
132define_subtag(package,fulltag_nodeheader_1,6)
133       
134define_subtag(slot_vector,fulltag_nodeheader_2,0)
135define_subtag(instance,fulltag_nodeheader_2,1)
136define_subtag(struct,fulltag_nodeheader_2,2)
137define_subtag(istruct,fulltag_nodeheader_2,3)
138define_subtag(value_cell,fulltag_nodeheader_2,4)
139define_subtag(xfunction,fulltag_nodeheader_2,5)
140       
141define_subtag(ratio,fulltag_nodeheader_3,0)
142define_subtag(complex,fulltag_nodeheader_3,1)
143                       
144t_value = (0x3000+fulltag_misc) 
145misc_bias = fulltag_misc
146cons_bias = fulltag_cons
147define(`t_offset',-symbol.size)
148       
149misc_header_offset = -fulltag_misc
150misc_data_offset = misc_header_offset+node_size /* first word of data */
151misc_subtag_offset = misc_data_offset-1       /* low byte of header */
152misc_dfloat_offset = misc_data_offset           /* double-floats are doubleword-aligned */
153
154define_subtag(single_float,fulltag_imm_0,0)
155
156define_subtag(go_tag,fulltag_imm_1,0)
157define_subtag(block_tag,fulltag_imm_1,1)
158
159define_subtag(character,fulltag_imm_1,0)
160                       
161define_subtag(unbound,fulltag_imm_3,0)
162unbound_marker = subtag_unbound
163undefined = unbound_marker
164define_subtag(slot_unbound,fulltag_imm_3,1)
165slot_unbound_marker = subtag_slot_unbound
166define_subtag(illegal,fulltag_imm_3,2)
167illegal_marker = subtag_illegal
168define_subtag(no_thread_local_binding,fulltag_imm_3,3)
169no_thread_local_binding_marker = subtag_no_thread_local_binding       
170
171       
172max_64_bit_constant_index = ((0x7fff + misc_dfloat_offset)>>3)
173max_32_bit_constant_index = ((0x7fff + misc_data_offset)>>2)
174max_16_bit_constant_index = ((0x7fff + misc_data_offset)>>1)
175max_8_bit_constant_index = (0x7fff + misc_data_offset)
176max_1_bit_constant_index = ((0x7fff + misc_data_offset)<<5)
177
178
179       
180/* The objects themselves look something like this: */
181       
182/* Order of CAR and CDR doesn't seem to matter much - there aren't */
183/* too many tricks to be played with predecrement/preincrement addressing. */
184/* Keep them in the confusing MCL 3.0 order, to avoid confusion. */
185        _struct(cons,-cons_bias)
186         _node(cdr)
187         _node(car)
188        _ends
189       
190        _structf(ratio)
191         _node(numer)
192         _node(denom)
193        _endstructf
194       
195        _structf(double_float)
196         _word(value)
197         _word(val_low)
198        _endstructf
199       
200        _structf(macptr)
201         _node(address)
202         _node(domain)
203         _node(type)
204        _endstructf
205       
206/* Functions are of (conceptually) unlimited size. */
207        _struct(_function,-misc_bias)
208         _node(header)
209         _node(codevector)
210        _ends
211
212        _struct(tsp_frame,0)
213         _node(backlink)
214         _node(type)
215         _struct_label(fixed_overhead)
216         _struct_label(data_offset)
217        _ends
218
219
220
221        _structf(symbol)
222         _node(pname)
223         _node(vcell)
224         _node(fcell)
225         _node(package_predicate)
226         _node(flags)
227         _node(plist)
228         _node(binding_index)
229        _endstructf
230
231        _structf(catch_frame)
232         _node(catch_tag)       /* #<unbound> -> unwind-protect, else catch */
233         _node(link)            /* backpointer to previous catch frame */
234         _node(mvflag)          /* 0 if single-valued catch, fixnum 1 otherwise */
235         _node(csp)             /* pointer to lisp_frame on csp */
236         _node(db_link)         /* head of special-binding chain */
237         _field(regs,8*node_size)       /* save7-save0 */
238         _node(xframe)          /* exception frame chain */
239         _node(tsp_segment)     /* maybe someday; padding for now */
240        _endstructf
241
242
243        _structf(vectorH)
244         _node(logsize)
245         _node(physsize)
246         _node(data_vector)
247         _node(displacement)
248         _node(flags)
249        _endstructf     
250       
251        _structf(arrayH)
252         _node(rank)
253         _node(physsize)
254         _node(data_vector)
255         _node(displacement)
256         _node(flags)
257         _struct_label(dim0)
258        _endstructf
259       
260        _struct(c_frame,0)      /* PowerOpen ABI C stack frame */
261         _node(backlink)
262         _node(crsave)
263         _node(savelr)
264         _field(unused, 16)
265         _node(savetoc)
266         _struct_label(params)
267         _node(param0)
268         _node(param1)
269         _node(param2)
270         _node(param3)
271         _node(param4)
272         _node(param5)
273         _node(param6)
274         _node(param7)
275         _struct_label(minsiz)
276        _ends
277
278
279        _struct(eabi_c_frame,0)
280         _word(backlink)
281         _word(savelr)
282         _word(param0)
283         _word(param1)
284         _word(param2)
285         _word(param3)
286         _word(param4)
287         _word(param5)
288         _word(param6)
289         _word(param7)
290         _struct_label(minsiz)
291        _ends
292
293        /* For entry to variable-argument-list functions */
294        /* (e.g., via callback) */
295        _struct(varargs_eabi_c_frame,0)
296         _word(backlink)
297         _word(savelr)
298         _struct_label(va_list)
299         _word(flags)           /* gpr count byte, fpr count byte, padding */
300         _word(overflow_arg_area)
301         _word(reg_save_area)
302         _field(padding,4)
303         _struct_label(regsave)
304         _field(gp_save,8*4)
305         _field(fp_save,8*8)
306         _word(old_backlink)
307         _word(old_savelr)
308         _struct_label(incoming_stack_args)
309        _ends
310               
311        _struct(lisp_frame,0)
312         _node(backlink)
313         _node(savefn) 
314         _node(savelr) 
315         _node(savevsp)
316        _ends
317
318        _struct(vector,-fulltag_misc)
319         _node(header)
320         _struct_label(data)
321        _ends
322
323        _struct(binding,0)
324         _node(link)
325         _node(sym)
326         _node(val)
327        _ends
328
329
330/* Nilreg-relative globals.  Talking the assembler into doing something reasonable here */
331/* is surprisingly hard. */
332
333
334nrs_origin = (0x3000+(LOWMEM_BIAS))
335nrs_symbol_fulltag = fulltag_misc       
336define(`nilsym',`nil')       
337lisp_globals_limit = (0x3000+(LOWMEM_BIAS))
338       
339        include(lisp_globals.s)
340       
341       
342
343define(`def_header',`
344$1 = ($2<<num_subtag_bits)|$3')
345
346        def_header(double_float_header,2,subtag_double_float)
347        def_header(two_digit_bignum_header,2,subtag_bignum)
348        def_header(three_digit_bignum_header,3,subtag_bignum)
349        def_header(four_digit_bignum_header,4,subtag_bignum)
350        def_header(five_digit_bignum_header,5,subtag_bignum)       
351        def_header(symbol_header,symbol.element_count,subtag_symbol)
352        def_header(value_cell_header,1,subtag_value_cell        )
353        def_header(macptr_header,macptr.element_count,subtag_macptr)
354        def_header(vectorH_header,vectorH.element_count,subtag_vectorH)
355
356        include(errors.s)
357
358/* Symbol bits that we care about */
359sym_vbit_bound = (0+fixnum_shift)
360sym_vbit_bound_mask = (1<<sym_vbit_bound)
361sym_vbit_const = (1+fixnum_shift)
362sym_vbit_const_mask = (1<<sym_vbit_const)
363
364        _struct(area,0)
365         _node(pred)
366         _node(succ)
367         _node(low)
368         _node(high)
369         _node(active)
370         _node(softlimit)
371         _node(hardlimit)
372         _node(code)
373         _node(markbits)
374         _node(ndwords)
375         _node(older)
376         _node(younger)
377         _node(h)
378         _node(sofprot)
379         _node(hardprot)
380         _node(owner)
381         _node(refbits)
382         _node(nextref)
383        _ends
384
385
386/* This is only referenced by c->lisp code that needs to save/restore C NVRs in a TSP frame. */
387        _struct(c_reg_save,0)
388         _node(tsp_link)        /* backpointer */
389         _node(tsp_mark)        /* frame type */
390         _node(save_fpscr)      /* for Cs FPSCR */
391         _field(save_gprs,19*node_size) /* r13-r31 */
392         _dword(save_fp_zero)   /* for fp_zero */
393         _dword(save_fps32conv)
394         _field(save_fprs,13*8)
395        _ends
396
397
398TCR_BIAS = 0
399       
400/*  Thread context record. */
401
402        _struct(tcr,-TCR_BIAS)
403         _node(prev)            /* in doubly-linked list */
404         _node(next)            /* in doubly-linked list */
405         _node(single_float_convert) /* xxxf0 */
406         _word(lisp_fpscr)      /* lisp thread's fpscr (in low word) */
407         _word(lisp_fpscr_low)
408         _node(db_link)         /* special binding chain head */
409         _node(catch_top)       /* top catch frame */
410         _node(save_vsp)        /* VSP when in foreign code */
411         _node(save_tsp)        /* TSP when in foreign code */
412         _node(cs_area)         /* cstack area pointer */
413         _node(vs_area)         /* vstack area pointer */
414         _node(ts_area)         /* tstack area pointer */
415         _node(cs_limit)        /* cstack overflow limit */
416         _word(bytes_consed_high)
417         _word(bytes_consed_low)
418         _node(log2_allocation_quantum)
419         _node(interrupt_pending)
420         _node(xframe)          /* per-thread exception frame list */
421         _node(errno_loc)       /* per-thread  errno location */
422         _node(ffi_exception)   /* fpscr exception bits from ff-call */
423         _node(osid)            /* OS thread id */
424         _node(valence)         /* odd when in foreign code */
425         _node(foreign_exception_status)
426         _node(native_thread_info)
427         _node(native_thread_id)
428         _node(last_allocptr)
429         _node(save_allocptr)
430         _node(save_allocbase)
431         _node(reset_completion)
432         _node(activate)
433         _node(suspend_count)
434         _node(suspend_context)
435         _node(pending_exception_context)
436         _node(suspend)         /* semaphore for suspension notify */
437         _node(resume)          /* sempahore for resumption notify */
438         _word(flags_pad)
439         _word(flags)     
440         _node(gc_context)
441         _node(termination_semaphore)
442         _node(unwinding)
443         _node(tlb_limit)
444         _node(tlb_pointer)     /* Consider using tcr+N as tlb_pointer */
445         _node(shutdown_count)
446         _node(safe_ref_address)
447        _ends
448
449TCR_FLAG_BIT_FOREIGN = fixnum_shift
450TCR_FLAG_BIT_AWAITING_PRESET = (fixnum_shift+1)
451TCR_FLAG_BIT_ALT_SUSPEND = (fixnumshift+2)
452TCR_FLAG_BIT_PROPAGATE_EXCEPTION = (fixnumshift+3)
453TCR_FLAG_BIT_SUSPEND_ACK_PENDING = (fixnumshift+4)
454TCR_FLAG_BIT_PENDING_EXCEPTION = (fixnumshift+5)
455TCR_FLAG_BIT_FOREIGN_EXCEPTION = (fixnumshift+6)
456TCR_FLAG_BIT_PENDING_SUSPEND = (fixnumshift+7)       
457
458
459nil_value = (0x3000+symbol.size+fulltag_misc+(LOWMEM_BIAS))
460               
461define(`RESERVATION_DISCHARGE',(0x2008+(LOWMEM_BIAS)))
462
463
464       
465INTERRUPT_LEVEL_BINDING_INDEX = fixnumone
466       
467               
Note: See TracBrowser for help on using the repository browser.