Changeset 13671
- Timestamp:
- Apr 25, 2010, 11:06:19 PM (15 years ago)
- Location:
- branches/arm/lisp-kernel
- Files:
-
- 3 edited
-
arm-constants.h (modified) (1 diff)
-
arm-constants.s (modified) (6 diffs)
-
arm-macros.s (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/arm/lisp-kernel/arm-constants.h
r13645 r13671 18 18 #include "constants.h" 19 19 20 #define arg_z021 #define arg_y122 #define arg_ x223 #define temp0324 #define temp1425 #define temp 2526 #define fn627 #define rcontext720 #define fn 0 21 #define vsp 1 22 #define arg_z 2 23 #define arg_y 3 24 #define arg_x 4 25 #define temp0 5 26 #define temp1 6 27 #define temp2 7 28 28 #define imm0 8 29 29 #define imm1 9 30 30 #define imm2 10 31 #define allocptr1132 #define vsp1231 #define rcontext 11 32 #define allocptr 12 33 33 #define sp 13 34 34 #define lr 14 -
branches/arm/lisp-kernel/arm-constants.s
r13664 r13671 43 43 44 44 /* registers. These assignments may not be viable. */ 45 define(`arg_z',`r0') 46 define(`arg_y',`r1') 47 define(`arg_x',`r2') 48 define(`temp0',`r3') 49 define(`temp1',`r4') 50 define(`temp2',`r5') 51 define(`fn',`r6') 52 define(`rcontext',`r7') 53 define(`imm0',`r8') 45 /* a lisp_frame contains the caller's fn, vsp (or an adjusted copy), */ 46 /* a proxy for sp, and the lr. (we need to use a proxy for sp, since */ 47 /* use of sp in the register list is deprecated and we generally save / */ 48 /* restore lisp_frames on sp and use writeback to sp. */ 49 50 define(`fn',`r0') 51 define(`vsp',`r1') 52 define(`arg_z',`r2') 53 define(`arg_y',`r3') 54 define(`arg_x',`r4') 55 define(`temp0',`r5') 56 define(`temp1',`r6') 57 define(`temp2',`r7') 58 define(`imm0',`r8') /* even, so ldrd/strd can use imm0/imm1 */ 54 59 define(`imm1',`r9') 55 60 define(`imm2',`r10') 56 define(` allocptr',`r11')57 define(` vsp',`r12')61 define(`rcontext',`r11') 62 define(`allocptr',`r12') 58 63 define(`sp',`r13') 59 64 define(`lr',`r14') 60 65 define(`pc',`r15') 61 66 67 nargregs = 3 68 62 69 define(`fname',`temp1') 63 70 define(`nfn',`temp2') … … 70 77 ne = 1 71 78 cs = 2 79 hs = cs 72 80 cc = 3 81 lo = cc 73 82 mi = 4 74 83 pl = 5 … … 159 168 /* set in the result. */ 160 169 161 t_offset = ( 8+(8-fulltag_nil)+fulltag_misc)170 t_offset = ((dnode_size-fulltag_nil)+fulltag_misc) 162 171 t_value = nil_value+t_offset 163 172 … … 298 307 _node(link) /* backpointer to previous catch frame */ 299 308 _node(mvflag) /* 0 if single-valued catch, fixnum 1 otherwise */ 300 _node(csp) /* pointer to lisp_frame on csp */301 309 _node(db_link) /* head of special-binding chain */ 302 _field(regs,8*node_size) /* save7-save0 */303 310 _node(xframe) /* exception frame chain */ 304 _node(tsp_segment) /* maybe someday; padding for now */305 311 _endstructf 306 312 … … 350 356 _ends 351 357 358 /* Indices in %builtin-functions% */ 359 _builtin_plus = 0 /* +-2 */ 360 _builtin_minus = 1 /* --2 */ 361 _builtin_times = 2 /* *-2 */ 362 _builtin_div = 3 /* /-2 */ 363 _builtin_eq = 4 /* =-2 */ 364 _builtin_ne = 5 /* /-2 */ 365 _builtin_gt = 6 /* >-2 */ 366 _builtin_ge = 7 /* >=-2 */ 367 _builtin_lt = 8 /* <-2 */ 368 _builtin_le = 9 /* <=-2 */ 369 _builtin_eql = 10 /* eql */ 370 _builtin_length = 11 /* length */ 371 _builtin_seqtype = 12 /* sequence-type */ 372 _builtin_assq = 13 /* assq */ 373 _builtin_memq = 14 /* memq */ 374 _builtin_logbitp = 15 /* logbitp */ 375 _builtin_logior = 16 /* logior-2 */ 376 _builtin_logand = 17 /* logand-2 */ 377 _builtin_ash = 18 /* ash */ 378 _builtin_negate = 19 /* %negate */ 379 _builtin_logxor = 20 /* logxor-2 */ 380 _builtin_aref1 = 21 /* %aref1 */ 381 _builtin_aset1 = 22 /* %aset1 */ 352 382 353 383 354 384 symbol_extra = symbol.size-fulltag_misc 355 385 356 _struct(nrs,nil_value-fulltag_nil) 357 _struct_pad(fulltag_nil) 358 _field(nilptr,16-fulltag_nil) 386 _struct(nrs,0) 387 _struct_pad(dnode_size-fulltag_nil) 359 388 360 389 _struct_pad(fulltag_misc) … … 649 678 define(`RESERVATION_DISCHARGE',0x2004) 650 679 651 lisp_globals_limit = (0x3010+(LOWMEM_BIAS)) 680 lisp_globals_limit = fulltag_nil 681 682 num_lisp_globals = 49 /* MUST UPDATE THIS !!! */ 683 684 _struct(lisp_globals,lisp_globals_limit-(num_lisp_globals*node_size)) 685 _node(weakvll) /* all populations as of last GC */ 686 _node(initial_tcr) /* initial thread tcr */ 687 _node(image_name) /* --image-name argument */ 688 _node(BADfpscr_save_high) /* high word of FP reg used to save FPSCR */ 689 _node(unwind_resume) /* _Unwind_Resume */ 690 _node(batch_flag) /* -b */ 691 _node(host_platform) /* for runtime platform-specific stuff */ 692 _node(argv) /* address of argv`0' */ 693 _node(ref_base) /* start of oldest pointer-bearing area */ 694 _node(tenured_area) /* the tenured_area */ 695 _node(oldest_ephemeral) /* dword address of oldest ephemeral object or 0 */ 696 _node(lisp_exit_hook) /* install foreign exception_handling */ 697 _node(lisp_return_hook) /* install lisp exception_handling */ 698 _node(double_float_one) /* high half of 1.0d0 */ 699 _node(short_float_zero) /* low half of 1.0d0 */ 700 _node(objc2_end_catch) /* objc_end_catch() */ 701 _node(metering_info) /* address of lisp_metering global */ 702 _node(in_gc) /* non-zero when GC active */ 703 _node(lexpr_return1v) /* simpler when &lexpr called for single value. */ 704 _node(lexpr_return) /* magic &lexpr return code. */ 705 _node(all_areas) /* doubly-linked list of all memory areas */ 706 _node(kernel_path) /* real executable name */ 707 _node(objc2_begin_catch) /* objc_begin_catch */ 708 _node(stack_size) /* from command-line */ 709 _node(statically_linked) /* non-zero if -static */ 710 _node(heap_end) /* end of lisp heap */ 711 _node(heap_start) /* start of lisp heap */ 712 _node(gcable_pointers) /* linked-list of weak macptrs. */ 713 _node(gc_num) /* fixnum: GC call count. */ 714 _node(fwdnum) /* fixnum: GC "forwarder" call count. */ 715 _node(altivec_present) /* non-zero when AltiVec available */ 716 _node(oldspace_dnode_count) /* dynamic dnodes older than g0 start */ 717 _node(refbits) /* EGC refbits */ 718 _node(gc_inhibit_count) 719 _node(intflag) /* sigint pending */ 720 _node(BAD_block_tag_counter) /* counter for (immediate) block tag */ 721 _node(deleted_static_pairs) 722 _node(exception_lock) 723 _node(area_lock) 724 _node(tcr_key) /* tsd key for per-thread tcr */ 725 _node(ret1val_addr) /* address of "dynamic" subprims magic values return addr */ 726 _node(subprims_base) /* address of dynamic subprims jump table */ 727 _node(saveR13) /* probably don't really need this */ 728 _node(saveTOC) /* where the 68K emulator stores the emulated regs */ 729 _node(objc_2_personality) /* exception "personality routine" address for ObjC 2.0 */ 730 _node(kernel_imports) /* some things we need imported for us */ 731 _node(interrupt_signal) /* signal used by PROCESS-INTERRUPT */ 732 _node(tcr_count) /* tcr_id for next tcr */ 733 _node(get_tcr) /* address of get_tcr() */ 734 _ends 735 652 736 653 737 INTERRUPT_LEVEL_BINDING_INDEX = fixnumone -
branches/arm/lisp-kernel/arm-macros.s
r13664 r13671 14 14 /* http://opensource.franz.com/preamble.html */ 15 15 16 /* The assembler has to do the arithmetic here: the expression */17 /* may not be evaluable by m4. */18 16 19 17 … … 26 24 ') 27 25 26 define(`make_header',`(($1<<num_subtag_bits)|($2&subtag_mask))') 27 28 /* Load a 16-bit constant into $1, 8 bits at a time. */ 29 define(`movc16',` 30 __(mov $1,#$2&0xff) 31 __(orr $1,$1,#$2&~0xff) 32 ') 33 34 define(`test_fixnum',` 35 __(tst $1,#fixnummask) 36 ') 37 38 define(`test_two_fixnums',` 39 __(orr $3,$1,$2) 40 __(test_fixnum($3)) 41 ') 42 28 43 define(`extract_fulltag',` 29 __(and $1,$ 1,#((1<<ntagbits)-1))44 __(and $1,$2,#fulltagmask) 30 45 ') 31 46 32 47 define(`extract_lisptag',` 33 __(and $1,$ 1,#((1<<nlisptagbits)-1))48 __(and $1,$2,#tagmask) 34 49 ') 35 50 36 51 define(`extract_lisptag_',` 37 __(ands $1,$1,# ((1<<nlisptagbits)-1))52 __(ands $1,$1,#tagmask) 38 53 ') 39 54 … … 53 68 define(`extract_typecode',` 54 69 __(extract_lisptag($1,$2)) 55 __(cmp $1,# fulltag_misc)70 __(cmp $1,#tag_misc) 56 71 __(ldrbeq $1,[$2,#misc_subtag_offset]) 57 72 ') 58 73 59 74 define(`box_fixnum',` 60 __(mov #1,$2, lsl #fixnumshift)75 __(mov $1,$2, lsl #fixnumshift) 61 76 ') 62 77 … … 96 111 97 112 define(`set_nargs',` 98 __( lwi(nargs,($1)<<fixnumshift))113 __(mov nargs,#($1)<<fixnumshift) 99 114 ') 100 115 … … 105 120 106 121 define(`vref32',` 107 __(ldr #1,[$2,#misc_data_offset+(($3)<<2)])122 __(ldr $1,[$2,#misc_data_offset+(($3)<<2)]) 108 123 ') 109 124 … … 126 141 /* "Length" is fixnum element count */ 127 142 define(`header_length',` 128 mov $1,#-1<<fixnumshift129 and $1,$1,$2,lsr #num_subtag_bits-fixnumshift130 ') 131 ') 143 __(mov $1,#-1<<fixnumshift) 144 __(and $1,$1,$2,lsr #num_subtag_bits-fixnumshift) 145 ') 146 132 147 133 148 … … 139 154 140 155 define(`ref_global',` 141 __(ldr($1,lisp_globals.$2(0))) 156 __(mov $1,#nil_value) 157 __(ldr $1,[$1,#lisp_globals.$2]) 142 158 ') 143 159 144 160 145 161 define(`ref_nrs_value',` 146 __(ldr($1,((nrs.$2)+(symbol.vcell))(0))) 162 __(mov $1,#nil_value) 163 __(ldr $1,[$1,#((nrs.$2)+(symbol.vcell))]) 147 164 ') 148 165 … … 179 196 define(`vpush_argregs',` 180 197 new_macro_labels() 181 __(cmplri(cr0,nargs,0)) 182 __(cmplri(cr1,nargs,node_size*2)) 183 __(beq cr0,macro_label(done)) 184 __(blt cr1,macro_label(z)) 185 __(beq cr1,macro_label(yz)) 186 __(vpush(arg_x)) 187 macro_label(yz): 188 __(vpush(arg_y)) 189 macro_label(z): 190 __(vpush(arg_z)) 198 __(cmp nargs,#0) 199 __(beq macro_label(done)) 200 __(cmp nargs,#node_size*2) 201 __(strhi arg_x,[vsp,#-node_size]!) 202 __(strhs arg_y,[vsp,#-node_size]!) 203 __(str arg_z,[vsp,#-node_size]!) 191 204 macro_label(done): 192 205 ') 193 206 194 define(`create_lisp_frame',` 195 __(stru(sp,-lisp_frame.size(sp))) 196 ') 197 198 207 208 /* $1 = sp copy for instruction restriction, $2 = value for lisp_frame.savevsp */ 199 209 define(`build_lisp_frame',` 200 create_lisp_frame() 201 __(str(ifelse($1,`',fn,$1),lisp_frame.savefn(sp))) 202 __(str(ifelse($2,`',loc_pc,$2),lisp_frame.savelr(sp))) 203 __(str(ifelse($3,`',vsp,$3),lisp_frame.savevsp(sp))) 204 ') 205 206 210 __(mov $1,sp) 211 __(stmdb sp!,{fn,ifelse($2,$2,vsp),$1,lr}) 212 ') 213 214 /* Have to use a temp (> vsp, < sp) to avoid having sp in the register list */ 215 define(`restore_lisp_frame',` 216 __(ldm sp!,{fn,vsp,$1,lr}) 217 ') 218 219 define(`return_lisp_frame',` 220 __(ldm sp!,{fn,vsp,$1,pc}) 221 ') 222 207 223 define(`discard_lisp_frame',` 208 __( la sp,lisp_frame.size(sp))224 __(add sp,sp,#lisp_frame.size) 209 225 ') 210 226 … … 229 245 define(`trap_unless_lisptag_equal',` 230 246 __(extract_lisptag($3,$1)) 231 __(trnei($3,$2)) 247 __(cmp $3,#$2) 248 __(uuo_error_reg_not_lisptag(ne,$3,$2)) 232 249 ') 233 250 … … 279 296 __(uuo_error_not_callable(ne,nfn)) 280 297 281 ') 298 ') 299 282 300 283 301 define(`mkcatch',` 284 __(mflr loc_pc) 285 __(ldr(imm0,tcr.catch_top(rcontext))) 286 __(lwz imm1,0(loc_pc)) /* a forward branch to the catch/unwind cleanup */ 287 __(rlwinm imm1,imm1,0,6,29) /* extract LI */ 288 __(add loc_pc,loc_pc,imm1) 289 __(build_lisp_frame(fn,loc_pc,vsp)) 290 __(sub loc_pc,loc_pc,imm1) 291 __(la loc_pc,4(loc_pc)) /* skip over the forward branch */ 292 __(mtlr loc_pc) 293 __(lwi(imm4,(catch_frame.element_count<<num_subtag_bits)|subtag_catch_frame)) 294 __(ldr(imm3,tcr.xframe(rcontext))) 295 __(ldr(imm1,tcr.db_link(rcontext))) 296 __(TSP_Alloc_Fixed_Unboxed(catch_frame.size)) 297 __(la nargs,tsp_frame.data_offset+fulltag_misc(tsp)) 298 __(str(imm4,catch_frame.header(nargs))) 299 __(str(arg_z,catch_frame.catch_tag(nargs))) 300 __(str(imm0,catch_frame.link(nargs))) 301 __(str(imm2,catch_frame.mvflag(nargs))) 302 __(str(sp,catch_frame.csp(nargs))) 303 __(str(imm1,catch_frame.db_link(nargs))) 304 __(str(first_nvr,catch_frame.regs+0*node_size(nargs))) 305 __(str(second_nvr,catch_frame.regs+1*node_size(nargs))) 306 __(str(third_nvr,catch_frame.regs+2*node_size(nargs))) 307 __(str(fourth_nvr,catch_frame.regs+3*node_size(nargs))) 308 __(str(fifth_nvr,catch_frame.regs+4*node_size(nargs))) 309 __(str(sixth_nvr,catch_frame.regs+5*node_size(nargs))) 310 __(str(seventh_nvr,catch_frame.regs+6*node_size(nargs))) 311 __(str(eighth_nvr,catch_frame.regs+7*node_size(nargs))) 312 __(str(imm3,catch_frame.xframe(nargs))) 313 __(str(rzero,catch_frame.tsp_segment(nargs))) 314 __(Set_TSP_Frame_Boxed()) 315 __(str(nargs,tcr.catch_top(rcontext))) 316 __(li nargs,0) 317 302 __(build_lisp_frame(imm0)) 303 __(movc16(imm0,make_header(catch_frame.element_count,subtag_u32_vector))) 304 __(str imm0,[sp,#-((catch_frame.element_count+1)*node_size)]!) 305 __(mov imm0,#0) 306 __(str imm0,[sp,#catch_frame.catch_tag+fulltag_misc]) 307 __(ldr imm0,[rcontext,#tcr.catch_top]) 308 __(str imm0,[sp,#catch_frame.link+fulltag_misc]) 309 __(ldr imm0,[rcontext,#tcr.db_link]) 310 __(str imm0,[sp,#catch_frame.db_link+fulltag_misc]) 311 __(ldr imm0,[rcontext,#tcr.xframe]) 312 __(str imm0,[sp,#catch_frame.xframe+fulltag_misc]) 313 __(add imm0,sp,#fulltag_misc) 314 __(str imm2,[imm0,#catch_frame.mvflag]) 315 __(mov imm2,#subtag_catch_frame) 316 __(strb imm2,[imm0,#misc_subtag_offset]) 317 __(str arg_z,[imm0,#catch_frame.catch_tag]) 318 __(str imm0,[rcontext,#tcr.catch_top]) 319 __(add lr,lr,#4) 318 320 ') 319 321 … … 335 337 336 338 define(`Cons',` 339 __(add allocptr,allocptr,#-cons.size+fulltag_cons) 337 340 __(ldr allocbase,[rcontext,#tcr.save_allocbase]) 338 __(add allocptr,allocptr,#-cons.size+fulltag_cons)339 341 __(cmp allocptr,allocbase) 340 342 __(uuo_alloc_trap(lo)) … … 382 384 /* Parameters $1, $2 as above; $3 = physical size constant. */ 383 385 define(`Misc_Alloc_Fixed',` 384 __(la allocptr,(-$3)+fulltag_misc(allocptr)) 385 __(alloc_trap()) 386 __(str($2,misc_header_offset(allocptr))) 387 __(mr $1,allocptr) 386 __(add allocptr,allocptr,#(-$3)+fulltag_misc) 387 __(ldr allocbase,[rcontext,#tcr.save_allocbase]) 388 __(cmp allocptr,allocbase) 389 __(uuo_alloc_trap(lo)) 390 __(str $2,[allocptr,#misc_header_offset]) 391 __(mov $1,allocptr) 388 392 __(clear_alloc_tag()) 389 393 ') … … 514 518 515 519 define(`suspend_now',` 516 __(uuo_suspend_now( ))517 ') 520 __(uuo_suspend_now(al)) 521 ')
Note:
See TracChangeset
for help on using the changeset viewer.
