Changeset 14965
- Timestamp:
- Aug 31, 2011, 3:11:12 AM (13 years ago)
- Location:
- trunk/source/lisp-kernel
- Files:
-
- 7 edited
-
arm-constants.h (modified) (2 diffs)
-
arm-constants.s (modified) (3 diffs)
-
arm-exceptions.c (modified) (2 diffs)
-
arm-gc.c (modified) (3 diffs)
-
arm-macros.s (modified) (3 diffs)
-
arm-spentry.s (modified) (17 diffs)
-
lisp-debug.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/lisp-kernel/arm-constants.h
r14270 r14965 40 40 #define nargs imm2 41 41 #define allocbase temp0 /* while consing */ 42 43 /* Non-volatile pseudo node regs kept in s28-s31 */ 44 #define save0 28 45 #define save1 29 46 #define save2 30 47 #define save3 31 42 48 43 49 #define nbits_in_word 32 … … 220 226 221 227 222 /*223 The GC also needs to know what a catch_frame looks like.224 */225 226 typedef struct catch_frame {227 LispObj header;228 LispObj catch_tag;229 LispObj link;230 LispObj mvflag;231 LispObj csp;232 LispObj db_link;233 LispObj regs[8];234 LispObj xframe;235 LispObj tsp_segment;236 } catch_frame;237 238 #define catch_frame_element_count ((sizeof(catch_frame)/sizeof(LispObj))-1)239 #define catch_frame_header make_header(subtag_catch_frame,catch_frame_element_count)240 228 241 229 typedef struct lisp_frame { -
trunk/source/lisp-kernel/arm-constants.s
r14119 r14965 65 65 define(`pc',`r15') 66 66 67 /* We can keep node values in some single-float registers. By definition, 68 those registers aren't general-purpose, but copying between them and 69 GPRs may be faster than using the stack would be. */ 70 define(`save0',`s28') 71 define(`save1',`s29') 72 define(`save2',`s30') 73 define(`save3',`s31') 74 67 75 nargregs = 3 68 76 … … 321 329 _node(last_lisp_frame) /* from TCR */ 322 330 _node(code_vector) /* of fn in lisp_frame, or 0 */ 331 _field(nvrs,4*node_size) 323 332 _endstructf 324 333 … … 658 667 r15 = 15 659 668 pc = 15 669 660 670 661 662 /* Lisp code keeps 0.0 in fp_zero */663 define(`fp_zero',`f31') /* a non-volatile reg as far as FFI is concerned. */664 define(`fp_s32conv',`f30') /* for s32->fp conversion */665 671 666 672 /* registers, as used in destrucuring-bind/macro-bind */ -
trunk/source/lisp-kernel/arm-exceptions.c
r14876 r14965 610 610 reset_lisp_process(ExceptionInformation *xp) 611 611 { 612 #if 0 612 613 TCR *tcr = get_tcr(true); 613 614 catch_frame *last_catch = (catch_frame *) ptr_from_lispobj(untag(tcr->catch_top)); … … 618 619 619 620 start_lisp(tcr, 1); 621 #endif 620 622 } 621 623 -
trunk/source/lisp-kernel/arm-gc.c
r14939 r14965 1055 1055 mark_xp(ExceptionInformation *xp) 1056 1056 { 1057 #ifdef LINUX 1058 void *find_vfp_info(ExceptionInformation *); 1059 #endif 1057 1060 natural *regs = (natural *) xpGPRvector(xp); 1058 1061 int r; … … 1070 1073 mark_root((regs[r])); 1071 1074 } 1072 1075 #ifdef LINUX 1076 { 1077 LispObj *vfp_info = (LispObj *)find_vfp_info(xp); 1078 int nvr; 1079 1080 if (vfp_info == NULL) { 1081 Bug(NULL, "No VFP info in exception context!"); 1082 } 1083 1084 for (nvr = save0;nvr <= save3;nvr++) { 1085 mark_root(vfp_info[nvr]); 1086 } 1087 } 1088 #endif 1073 1089 1074 1090 1075 1091 mark_pc_root(ptr_to_lispobj(xpPC(xp))); 1076 1092 mark_pc_root(ptr_to_lispobj(xpLR(xp))); 1093 1077 1094 } 1078 1095 … … 1351 1368 } 1352 1369 1370 #ifdef LINUX 1371 { 1372 void *find_vfp_info(ExceptionInformation *); 1373 LispObj* nvrs = (LispObj *)find_vfp_info(xp); 1374 1375 for (r=save0;r<=save3;r++) { 1376 update_noderef(&nvrs[r]); 1377 } 1378 } 1379 #endif 1353 1380 1354 1381 update_locref((LispObj*) (&(xpPC(xp)))); -
trunk/source/lisp-kernel/arm-macros.s
r14823 r14965 333 333 */ 334 334 335 define(`push_f prs',`335 define(`push_foreign_fprs',` 336 336 __(movc16(imm0,make_header(8,subtag_double_float_vector))) 337 337 __(mov imm1,#0) … … 340 340 ') 341 341 342 /* Save the lisp non-volatile FPRs. */ 343 define(`push_lisp_fprs',` 344 __(movc16(imm0,make_header(6,subtag_double_float_vector))) 345 __(mov imm1,#0) 346 __(fmdrr d7,imm0,imm1) 347 __(fstmfdd sp!,{d7-d13}) 348 ') 349 342 350 /* Pop the non-volatile FPRs (d8-d15) from the stack-consed vector 343 351 on top of the stack. This loads the vector header 344 352 into d7 as a side-effect. */ 345 define(`pop_f prs',`353 define(`pop_foreign_fprs',` 346 354 __(fldmfdd sp!,{d7-d15}) 347 355 ') 348 356 349 /* Reload the non-volatile FPRs (d8-d15) from the stack-consed vector 357 /* Pop the lisp non-volatile FPRs */ 358 define(`pop_lisp_fprs',` 359 __(fldmfdd sp!,{d7-d13}) 360 ') 361 362 /* Reload the non-volatile lisp FPRs (d8-d13) from the stack-consed vector 350 363 on top of the stack, leaving the vector in place. d7 winds up with 351 364 a denormalized float in it, if anything cares. */ 352 define(`restore_ fprs',`353 __(fldmfdd $1,{d7-d1 5})365 define(`restore_lisp_fprs',` 366 __(fldmfdd $1,{d7-d13}) 354 367 ') 355 368 356 369 /* discard the stack-consed vector which contains a set of 8 non-volatile 357 370 FPRs. */ 358 define(`discard_ fprs',`359 __(add sp,sp,# 9*8)371 define(`discard_lisp_fprs',` 372 __(add sp,sp,#7*8) 360 373 ') 361 374 362 375 define(`mkcatch',` 363 376 new_macro_labels() 364 __(push_ fprs())377 __(push_lisp_fprs()) 365 378 __(build_lisp_frame(imm0)) 379 __(movc16(imm0,make_header(catch_frame.element_count,subtag_u32_vector))) 380 __(mov imm1,#catch_frame.element_count<<word_shift) 381 __(dnode_align(imm1,imm1,node_size)) 382 __(stack_allocate_zeroed_ivector(imm0,imm1)) 366 383 __(movc16(imm0,make_header(catch_frame.element_count,subtag_catch_frame))) 367 384 __(movs temp2,fn) … … 373 390 __(ldr arg_x,[rcontext,#tcr.db_link]) 374 391 __(ldr temp0,[rcontext,#tcr.xframe]) 375 __(stm db sp!,{imm0,imm1,imm2,arg_z,arg_x,temp0,temp1,temp2})392 __(stmia sp,{imm0,imm1,imm2,arg_z,arg_x,temp0,temp1,temp2}) 376 393 __(add imm0,sp,#fulltag_misc) 377 394 __(str imm0,[rcontext,#tcr.catch_top]) 395 __(add imm0,imm0,#catch_frame.nvrs) 396 __(fstmias imm0,{save0-save3}) 378 397 __(add lr,lr,#4) 379 398 ') -
trunk/source/lisp-kernel/arm-spentry.s
r14845 r14965 2349 2349 _spentry(progvrestore) 2350 2350 __(skip_stack_vector(imm0,imm1,sp)) 2351 __(ldr imm0,[imm0,#lisp_frame.size+( 9*8)+node_size]) /* 9*8 = size of saved FPR vector, with header */2351 __(ldr imm0,[imm0,#lisp_frame.size+(7*8)+node_size]) /* 7*8 = size of saved FPR vector, with header */ 2352 2352 __(cmp imm0,#0) 2353 2353 __(unbox_fixnum(imm0,imm0)) … … 2859 2859 __(ldr arg_y,[rcontext,#tcr.last_lisp_frame]) 2860 2860 __(stmdb vsp!,{arg_y,arg_x,temp0,temp1,temp2}) 2861 __(fstmdbs vsp!,{save0-save3}) 2861 2862 __(str vsp,[rcontext,#tcr.save_vsp]) 2862 2863 /* There's a u32 vector on top of the stack ; its first data word points … … 2894 2895 __(mov arg_x,#0) 2895 2896 __(mov fn,#0) 2897 __(fmsr save0,arg_z) 2898 __(fcpys save1,save0) 2899 __(fcpys save2,save0) 2900 __(fcpys save3,save0) 2896 2901 __(mov allocptr,#VOID_ALLOCPTR) 2897 2902 __(mov rcontext,temp0) … … 2900 2905 __(ldr allocptr,[rcontext,#tcr.save_allocptr]) 2901 2906 __(restore_lisp_frame(temp0)) 2907 __(fldmias vsp!,{save0-save3}) 2902 2908 __(ldmia vsp!,{arg_y,arg_x,temp0,temp1,temp2}) 2903 2909 __(str arg_y,[rcontext,#tcr.last_lisp_frame]) … … 3107 3113 __(orr imm0,imm0,#subtag_u32_vector) 3108 3114 __(stmdb sp!,{imm0,imm2}) 3115 __(push_foreign_fprs()) 3109 3116 __(mov arg_x,#0) 3110 3117 __(mov temp0,#0) … … 3114 3121 __(mov fn,#0) 3115 3122 __(ldr vsp,[rcontext,#tcr.save_vsp]) 3123 __(fmsr save0,arg_z) 3124 __(fcpys save1,save0) 3125 __(fcpys save2,save0) 3126 __(fcpys save3,save0) 3116 3127 __(mov imm0,#TCR_STATE_LISP) 3117 3128 __(str imm0,[rcontext,#tcr.valence]) … … 3123 3134 __(blx lr) 3124 3135 __(str vsp,[rcontext,#tcr.save_vsp]) 3125 __(ldr imm1,[sp,# 4])3136 __(ldr imm1,[sp,#(9*8)+4]) 3126 3137 __(str imm1,[rcontext,#tcr.last_lisp_frame]) 3127 3138 __(str allocptr,[rcontext,#tcr.save_allocptr]) 3128 3139 __(mov imm0,#TCR_STATE_FOREIGN) 3129 3140 __(str imm0,[rcontext,#tcr.valence]) 3141 __(pop_foreign_fprs()) 3130 3142 __(ldr sp,[sp,#node_size*2]) /* drop the ivector that hides foreign stack contents and restore (possibly misaligned) sp */ 3131 3143 __(ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12,lr}) … … 3987 3999 __(ldr imm0,[temp0,#catch_frame.link]) 3988 4000 __(str imm0,[rcontext,#tcr.catch_top]) 4001 __(add imm0,sp,#catch_frame.nvrs+fulltag_misc) 4002 __(fldmias imm0,{save0-save3}) 3989 4003 __(ldr fn,[sp,#catch_frame.size+lisp_frame.savefn]) 3990 4004 __(ldr lr,[sp,#catch_frame.size+lisp_frame.savelr]) 3991 4005 __(add sp,sp,#catch_frame.size+lisp_frame.size) 3992 __(pop_ fprs())4006 __(pop_lisp_fprs()) 3993 4007 __(bx lr) 3994 4008 _endfn(C(_throw_found)) … … 4019 4033 __(ldreq vsp,[sp,#catch_frame.size+lisp_frame.savevsp]) 4020 4034 __(add sp,sp,#catch_frame.size+lisp_frame.size) 4021 __(pop_ fprs())4035 __(pop_lisp_fprs()) 4022 4036 __(b local_label(_nthrow1v_nextframe)) 4023 4037 local_label(_nthrow1v_do_unwind): … … 4026 4040 /* Save our caller's LR and FN in the csp frame created by the unwind- */ 4027 4041 /* protect. (Clever, eh ?) */ 4042 __(flds save0,[sp,#fulltag_misc+catch_frame.nvrs+(0*node_size)]) 4043 __(flds save1,[sp,#fulltag_misc+catch_frame.nvrs+(1*node_size)]) 4044 __(flds save2,[sp,#fulltag_misc+catch_frame.nvrs+(2*node_size)]) 4045 __(flds save3,[sp,#fulltag_misc+catch_frame.nvrs+(3*node_size)]) 4028 4046 __(add sp,sp,#catch_frame.size) 4029 4047 /* We used to use a swp instruction to exchange the lr with … … 4055 4073 __(mov fn,nfn) 4056 4074 __(add temp0,temp0,#lisp_frame.size) 4057 __(restore_ fprs(temp0))4075 __(restore_lisp_fprs(temp0)) 4058 4076 __(str imm1,[rcontext,#tcr.unwinding]) 4059 4077 __(blx lr) … … 4064 4082 __(add sp,sp,#4*node_size) 4065 4083 __(restore_lisp_frame(imm0)) 4066 __(discard_ fprs())4084 __(discard_lisp_fprs()) 4067 4085 __(b local_label(_nthrow1v_nextframe)) 4068 4086 local_label(_nthrow1v_done): … … 4111 4129 local_label(nthrownv_skip): 4112 4130 __(add sp,sp,#catch_frame.size+lisp_frame.size) 4113 __(pop_ fprs())4131 __(pop_lisp_fprs()) 4114 4132 __(b local_label(nthrownv_nextframe)) 4115 4133 local_label(nthrownv_do_unwind): … … 4119 4137 __(str arg_x,[rcontext,#tcr.xframe]) 4120 4138 __(str arg_z,[rcontext,#tcr.last_lisp_frame]) 4139 __(flds save0,[sp,#fulltag_misc+catch_frame.nvrs+(0*node_size)]) 4140 __(flds save1,[sp,#fulltag_misc+catch_frame.nvrs+(1*node_size)]) 4141 __(flds save2,[sp,#fulltag_misc+catch_frame.nvrs+(2*node_size)]) 4142 __(flds save3,[sp,#fulltag_misc+catch_frame.nvrs+(3*node_size)]) 4121 4143 __(add sp,sp,#catch_frame.size) 4122 4144 __(add imm1,nargs,#node_size) … … 4152 4174 __(ldr vsp,[arg_z,#lisp_frame.savevsp]) 4153 4175 __(add arg_z,arg_z,#lisp_frame.size) 4154 __(restore_ fprs(arg_z))4176 __(restore_lisp_fprs(arg_z)) 4155 4177 __(str imm1,[rcontext,#tcr.unwinding]) 4156 4178 __(mov fn,nfn) … … 4177 4199 __(ldr lr,[sp,#lisp_frame.savelr]) 4178 4200 __(discard_lisp_frame()) 4179 __(discard_ fprs())4201 __(discard_lisp_fprs()) 4180 4202 __(b local_label(nthrownv_nextframe)) 4181 4203 local_label(nthrownv_done): … … 4370 4392 __(orr imm0,imm0,#subtag_u32_vector) 4371 4393 __(stmdb sp!,{imm0,imm2}) 4394 __(push_foreign_fprs()) 4395 __(fmsr save0,arg_z) 4396 __(fcpys save1,save0) 4397 __(fcpys save2,save0) 4398 __(fcpys save3,save0) 4372 4399 __(mov imm0,#TCR_STATE_LISP) 4373 4400 __(str imm0,[rcontext,#tcr.valence]) 4374 4401 __(ldr allocptr,[rcontext,#tcr.save_allocptr]) 4375 4402 __(bl toplevel_loop) 4376 __(ld mia sp!,{imm0,imm1})4403 __(ldr imm1,[sp,#(9*8)+4]) 4377 4404 __(mov imm0,#TCR_STATE_FOREIGN) 4378 4405 __(str imm1,[rcontext,#tcr.last_lisp_frame]) 4379 4406 __(str imm0,[rcontext,#tcr.valence]) 4407 __(pop_foreign_fprs()) 4408 __(add sp,sp,#2*node_size) 4380 4409 __(mov imm0,#nil_value) 4381 4410 __(ldr sp,[sp]) -
trunk/source/lisp-kernel/lisp-debug.c
r14837 r14965 54 54 #else 55 55 char *kernel_svn_revision = "unknown"; 56 #endif 57 58 #ifdef ARM 59 #ifdef LINUX 60 61 /* This stuff is buried in kernel headers. Why ? */ 62 63 /* The uc_regspace field of a ucontext can contain coprocessor 64 info in structures whose first word is one of these magic 65 values; the structure list is terminated by something that's 66 not one of these magic values. 67 68 Good thinking! That'll make the mechanism easy to extend! 69 (In practice, a word of 0 seems to terminate the structure 70 list.) 71 */ 72 #define VFP_MAGIC 0x56465001 73 #define IWMMXT_MAGIC 0x12ef842a 74 #define CRUNCH_MAGIC 0x5065cf03 75 76 77 struct user_vfp { 78 unsigned long long fpregs[32]; 79 unsigned long fpscr; 80 }; 81 82 struct user_vfp * 83 find_vfp_info(ExceptionInformation *xp) 84 { 85 char *p = (char *)(xp->uc_regspace); 86 unsigned *q, magic; 87 88 while (1) { 89 q = (unsigned *)p; 90 magic = *q; 91 if (magic == VFP_MAGIC) { 92 return (struct user_vfp *)(q+2); 93 } 94 if ((magic == CRUNCH_MAGIC) || 95 (magic == IWMMXT_MAGIC)) { 96 p += q[1]; 97 } 98 else { 99 return NULL; 100 } 101 } 102 } 103 104 #endif 56 105 #endif 57 106 … … 743 792 show_lisp_register(xp, "temp1/fname/next_method_context", temp1); 744 793 show_lisp_register(xp, "temp2/nfn", temp2); 794 #ifdef LINUX 795 { 796 LispObj *nvrs = (LispObj *)find_vfp_info(xp); 797 798 if (nvrs != NULL) { 799 int r; 800 801 for(r=save0;r<=save3;r++) { 802 fprintf(dbgout,"s%02d (save%d) = %s\n",r,r-save0,print_lisp_object(nvrs[r])); 803 } 804 } 805 } 806 #endif 745 807 } 746 808 #endif … … 1051 1113 b, xpGPR(xp, b)); 1052 1114 } 1115 #ifdef LINUX 1116 { 1117 LispObj *nvrs = (LispObj *)find_vfp_info(xp); 1118 1119 if (nvrs != NULL) { 1120 for(a=save0,b=save2;a<save2;a++,b++) { 1121 fprintf(dbgout,"s%02d = 0x%08lX s%02d = 0x%08lX\n", 1122 a, nvrs[a], b, nvrs[b]); 1123 } 1124 } 1125 } 1126 #endif 1053 1127 #endif 1054 1128 … … 1056 1130 } 1057 1131 1058 #ifdef ARM1059 #ifdef LINUX1060 1061 /* This stuff is buried in kernel headers. Why ? */1062 1063 /* The uc_regspace field of a ucontext can contain coprocessor1064 info in structures whose first word is one of these magic1065 values; the structure list is terminated by something that's1066 not one of these magic values.1067 1068 Good thinking! That'll make the mechanism easy to extend!1069 (In practice, a word of 0 seems to terminate the structure1070 list.)1071 */1072 #define VFP_MAGIC 0x564650011073 #define IWMMXT_MAGIC 0x12ef842a1074 #define CRUNCH_MAGIC 0x5065cf031075 1076 1077 struct user_vfp {1078 unsigned long long fpregs[32];1079 unsigned long fpscr;1080 };1081 1082 struct user_vfp *1083 find_vfp_info(ExceptionInformation *xp)1084 {1085 char *p = (char *)(xp->uc_regspace);1086 unsigned *q, magic;1087 1088 while (1) {1089 q = (unsigned *)p;1090 magic = *q;1091 if (magic == VFP_MAGIC) {1092 return (struct user_vfp *)(q+2);1093 }1094 if ((magic == CRUNCH_MAGIC) ||1095 (magic == IWMMXT_MAGIC)) {1096 p += q[1];1097 }1098 else {1099 return NULL;1100 }1101 }1102 }1103 1104 #endif1105 #endif1106 1132 1107 1133 debug_command_return … … 1203 1229 int dn,fn; 1204 1230 1205 for (dn=0,fn=0;dn<16;dn++) { 1231 1232 for (dn=0,fn=0;dn<14;dn++) { /* d14/d15 (s28-s31) contain lisp values */ 1206 1233 fprintf(dbgout, "s%02d = %10e (0x%08x) s%02d = %10e (0x%08x)\n",fn,fp[fn],up[fn],fn+1,fp[fn+1],up[fn+1]); 1207 1234 fn+=2;
Note:
See TracChangeset
for help on using the changeset viewer.
