[Openmcl-cvs-notifications] r14965 - in /trunk/source/lisp-kernel: arm-constants.h arm-constants.s arm-exceptions.c arm-gc.c arm-macros.s arm-spentry.s lisp-debug.c

gb at clozure.com gb at clozure.com
Wed Aug 31 05:11:12 CDT 2011


Author: gb
Date: Wed Aug 31 05:11:12 2011
New Revision: 14965

Log:
Treat s28-s31 (save0-save3) as non-volatile node-bearing regs; it
may be cheaper to access values in such registers than it would be
to access memory.

When entering lisp context (thread entry/callback), save all non-volatile
FP regs (d8-d15) and load benign values into s28-s31.  When creating a
lisp catch frame, save d8-d13 in a stack-consed vector and s28-s31 in
new slots in the catch frame.

C code only needs to know about catch frame layout to support thread
reset from C, and that hasn't worked in a long time.  If C code ever
needs this info, should define the ARM (not PPC) version.

On Linux, vfp state is maintained as a tagged record in the
uc_regspace field of a ucontext stucture; there can be other tagged
records (Marvell CPUs may contain iwmmxt info, for instance.)  Some
comments in header files (somewhere) suggest that only certain
exception contexts contain vfp state; other comments suggest that
those comments have been bogus for a long time.  This whole scheme
obviously depends on the GC being able to find non-null VFP info in
any exception context it processes. mark_xp() checks for that and enters
the kernel debugger if it's missing; forward_xp() assumes that mark_xp()
has checked.

Make the l and r kernel debugger commands print the values of save0-save3
and make the f command ignore them.

Since the lisp side of things is (currently) blissfully unaware of all
this, save0-save3 should (at the moment) always contain "benign values"
(0).

Modified:
    trunk/source/lisp-kernel/arm-constants.h
    trunk/source/lisp-kernel/arm-constants.s
    trunk/source/lisp-kernel/arm-exceptions.c
    trunk/source/lisp-kernel/arm-gc.c
    trunk/source/lisp-kernel/arm-macros.s
    trunk/source/lisp-kernel/arm-spentry.s
    trunk/source/lisp-kernel/lisp-debug.c

Modified: trunk/source/lisp-kernel/arm-constants.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/arm-constants.h (original)
+++ trunk/source/lisp-kernel/arm-constants.h Wed Aug 31 05:11:12 2011
@@ -39,6 +39,12 @@
 #define next_method_context temp1
 #define nargs imm2
 #define allocbase temp0         /* while consing */
+
+/* Non-volatile pseudo node regs kept in s28-s31 */
+#define save0 28
+#define save1 29
+#define save2 30
+#define save3 31
 =

 #define nbits_in_word 32
 #define log2_nbits_in_word 5
@@ -219,24 +225,6 @@
 } single_float;
 =

 =

-/*
-  The GC also needs to know what a catch_frame looks like.
-*/
-
-typedef struct catch_frame {
-  LispObj header;
-  LispObj catch_tag;
-  LispObj link;
-  LispObj mvflag;
-  LispObj csp;
-  LispObj db_link;
-  LispObj regs[8];
-  LispObj xframe;
-  LispObj tsp_segment;
-} catch_frame;
-
-#define catch_frame_element_count ((sizeof(catch_frame)/sizeof(LispObj))-1)
-#define catch_frame_header make_header(subtag_catch_frame,catch_frame_elem=
ent_count)
 =

 typedef struct lisp_frame {
   LispObj marker;

Modified: trunk/source/lisp-kernel/arm-constants.s
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/arm-constants.s (original)
+++ trunk/source/lisp-kernel/arm-constants.s Wed Aug 31 05:11:12 2011
@@ -64,6 +64,14 @@
 define(`lr',`r14')
 define(`pc',`r15')
 =

+/* We can keep node values in some single-float registers.  By definition,
+   those registers aren't general-purpose, but copying between them and
+   GPRs may be faster than using the stack would be. */
+define(`save0',`s28')
+define(`save1',`s29')
+define(`save2',`s30')
+define(`save3',`s31')
+                                                =

 nargregs =3D 3
                 =

 define(`fname',`temp1')
@@ -320,6 +328,7 @@
 	 _node(xframe)		/* exception frame chain */
          _node(last_lisp_frame) /* from TCR */
          _node(code_vector)     /* of fn in lisp_frame, or 0 */
+         _field(nvrs,4*node_size)
 	_endstructf
 =

 	_structf(macptr)
@@ -657,11 +666,8 @@
 lr =3D 14
 r15 =3D 15
 pc =3D 15
+                =

         =

-        =

-/* Lisp code keeps 0.0 in fp_zero */
-define(`fp_zero',`f31')   /* a non-volatile reg as far as FFI is concerned=
. */
-define(`fp_s32conv',`f30')   /* for s32->fp conversion */
 	=

 /* registers, as used in destrucuring-bind/macro-bind */
 =


Modified: trunk/source/lisp-kernel/arm-exceptions.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/arm-exceptions.c (original)
+++ trunk/source/lisp-kernel/arm-exceptions.c Wed Aug 31 05:11:12 2011
@@ -609,6 +609,7 @@
 void
 reset_lisp_process(ExceptionInformation *xp)
 {
+#if 0
   TCR *tcr =3D get_tcr(true);
   catch_frame *last_catch =3D (catch_frame *) ptr_from_lispobj(untag(tcr->=
catch_top));
 =

@@ -617,6 +618,7 @@
   tcr->save_vsp =3D (LispObj *) ptr_from_lispobj(((lisp_frame *)ptr_from_l=
ispobj(last_catch->csp))->savevsp);
 =

   start_lisp(tcr, 1);
+#endif
 }
 =

 /*

Modified: trunk/source/lisp-kernel/arm-gc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/arm-gc.c (original)
+++ trunk/source/lisp-kernel/arm-gc.c Wed Aug 31 05:11:12 2011
@@ -1053,6 +1053,9 @@
 void
 mark_xp(ExceptionInformation *xp)
 {
+#ifdef LINUX
+  void *find_vfp_info(ExceptionInformation *);
+#endif
   natural *regs =3D (natural *) xpGPRvector(xp);
   int r;
   /* registers between arg_z and Rfn should be tagged and marked as
@@ -1068,11 +1071,25 @@
   for (r =3D arg_z; r <=3D Rfn; r++) {
     mark_root((regs[r]));
   }
-
+#ifdef LINUX
+  {
+    LispObj *vfp_info =3D (LispObj *)find_vfp_info(xp);
+    int nvr;
+
+    if (vfp_info =3D=3D NULL) {
+      Bug(NULL, "No VFP info in exception context!");
+    }
+    =

+    for (nvr =3D save0;nvr <=3D save3;nvr++) {
+      mark_root(vfp_info[nvr]);
+    }
+  }
+#endif
 =

 =

   mark_pc_root(ptr_to_lispobj(xpPC(xp)));
   mark_pc_root(ptr_to_lispobj(xpLR(xp)));
+  =

 }
 =

 /* A "pagelet" contains 32 doublewords.  The relocation table contains
@@ -1349,6 +1366,16 @@
     update_noderef((LispObj*) (&(regs[r])));
   }
 =

+#ifdef LINUX
+  {
+    void *find_vfp_info(ExceptionInformation *);
+    LispObj* nvrs =3D (LispObj *)find_vfp_info(xp);
+
+    for (r=3Dsave0;r<=3Dsave3;r++) {
+      update_noderef(&nvrs[r]);
+    }
+  }
+#endif
 =

   update_locref((LispObj*) (&(xpPC(xp))));
   update_locref((LispObj*) (&(xpLR(xp))));

Modified: trunk/source/lisp-kernel/arm-macros.s
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/arm-macros.s (original)
+++ trunk/source/lisp-kernel/arm-macros.s Wed Aug 31 05:11:12 2011
@@ -332,37 +332,54 @@
    floats (we effectively load a vector header into d7.)
 */        =

    =

-define(`push_fprs',`
+define(`push_foreign_fprs',`
         __(movc16(imm0,make_header(8,subtag_double_float_vector)))
         __(mov imm1,#0)
         __(fmdrr d7,imm0,imm1)
         __(fstmfdd sp!,{d7-d15})
 ')
 =

+/* Save the lisp non-volatile FPRs. */
+define(`push_lisp_fprs',`
+        __(movc16(imm0,make_header(6,subtag_double_float_vector)))
+        __(mov imm1,#0)
+        __(fmdrr d7,imm0,imm1)
+        __(fstmfdd sp!,{d7-d13})
+')
+        =

 /* Pop the non-volatile FPRs (d8-d15) from the stack-consed vector
    on top of the stack.  This loads the vector header
    into d7 as a side-effect. */
-define(`pop_fprs',`
+define(`pop_foreign_fprs',`
         __(fldmfdd sp!,{d7-d15})
 ')
 =

-/* Reload the non-volatile FPRs (d8-d15) from the stack-consed vector
+/* Pop the lisp non-volatile FPRs */        =

+define(`pop_lisp_fprs',`
+        __(fldmfdd sp!,{d7-d13})
+')
+
+/* Reload the non-volatile lisp FPRs (d8-d13) from the stack-consed vector
    on top of the stack, leaving the vector in place.  d7 winds up with
    a denormalized float in it, if anything cares. */
-define(`restore_fprs',`
-        __(fldmfdd $1,{d7-d15})
+define(`restore_lisp_fprs',`
+        __(fldmfdd $1,{d7-d13})
 ')                =

 =

 /* discard the stack-consed vector which contains a set of 8 non-volatile
    FPRs. */
-define(`discard_fprs',`
-        __(add sp,sp,#9*8)
+define(`discard_lisp_fprs',`
+        __(add sp,sp,#7*8)
 ')                        =

         =

 define(`mkcatch',`
         new_macro_labels()
-        __(push_fprs())
+        __(push_lisp_fprs())
 	__(build_lisp_frame(imm0))
+        __(movc16(imm0,make_header(catch_frame.element_count,subtag_u32_ve=
ctor)))
+        __(mov imm1,#catch_frame.element_count<<word_shift)
+        __(dnode_align(imm1,imm1,node_size))
+        __(stack_allocate_zeroed_ivector(imm0,imm1))
         __(movc16(imm0,make_header(catch_frame.element_count,subtag_catch_=
frame)))
         __(movs temp2,fn)
         __(ldrne temp2,[temp2,_function.codevector])
@@ -372,9 +389,11 @@
         /* arg_z is tag */
         __(ldr arg_x,[rcontext,#tcr.db_link])
         __(ldr temp0,[rcontext,#tcr.xframe])
-        __(stmdb sp!,{imm0,imm1,imm2,arg_z,arg_x,temp0,temp1,temp2})
+        __(stmia sp,{imm0,imm1,imm2,arg_z,arg_x,temp0,temp1,temp2})
         __(add imm0,sp,#fulltag_misc)
         __(str imm0,[rcontext,#tcr.catch_top])
+        __(add imm0,imm0,#catch_frame.nvrs)
+        __(fstmias imm0,{save0-save3})
         __(add lr,lr,#4)
 ')	=

 =


Modified: trunk/source/lisp-kernel/arm-spentry.s
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/arm-spentry.s (original)
+++ trunk/source/lisp-kernel/arm-spentry.s Wed Aug 31 05:11:12 2011
@@ -2348,7 +2348,7 @@
                          =

 _spentry(progvrestore)
         __(skip_stack_vector(imm0,imm1,sp))
-        __(ldr imm0,[imm0,#lisp_frame.size+(9*8)+node_size]) /* 9*8 =3D si=
ze of saved FPR vector, with header */
+        __(ldr imm0,[imm0,#lisp_frame.size+(7*8)+node_size]) /* 7*8 =3D si=
ze of saved FPR vector, with header */
         __(cmp imm0,#0)
         __(unbox_fixnum(imm0,imm0))
         __(bne _SPunbind_n)
@@ -2858,6 +2858,7 @@
 _spentry(eabi_ff_call)
         __(ldr arg_y,[rcontext,#tcr.last_lisp_frame])
         __(stmdb vsp!,{arg_y,arg_x,temp0,temp1,temp2})
+        __(fstmdbs vsp!,{save0-save3})
         __(str vsp,[rcontext,#tcr.save_vsp])
 /* There's a u32 vector on top of the stack ; its first data word points
    to the previous stack object.  The 4 words at the bottom of the vector
@@ -2893,12 +2894,17 @@
         __(mov arg_y,#0)
         __(mov arg_x,#0)
         __(mov fn,#0)
+        __(fmsr save0,arg_z)
+        __(fcpys save1,save0)
+        __(fcpys save2,save0)
+        __(fcpys save3,save0)
         __(mov allocptr,#VOID_ALLOCPTR)
         __(mov rcontext,temp0)
         __(ldr sp,[rcontext,#tcr.last_lisp_frame])
         __(str fn,[rcontext,#tcr.valence])
         __(ldr allocptr,[rcontext,#tcr.save_allocptr])
         __(restore_lisp_frame(temp0))
+        __(fldmias vsp!,{save0-save3})
         __(ldmia vsp!,{arg_y,arg_x,temp0,temp1,temp2})
         __(str arg_y,[rcontext,#tcr.last_lisp_frame])
         __(check_pending_interrupt(temp2))
@@ -3106,6 +3112,7 @@
         __(mov imm0,imm0,lsl #num_subtag_bits-word_shift)
         __(orr imm0,imm0,#subtag_u32_vector)
         __(stmdb sp!,{imm0,imm2})
+        __(push_foreign_fprs())
         __(mov arg_x,#0)
         __(mov temp0,#0)
         __(mov temp1,#0)
@@ -3113,6 +3120,10 @@
         __(mov allocptr,#VOID_ALLOCPTR)
         __(mov fn,#0)
         __(ldr vsp,[rcontext,#tcr.save_vsp])
+        __(fmsr save0,arg_z)
+        __(fcpys save1,save0)
+        __(fcpys save2,save0)
+        __(fcpys save3,save0)        =

         __(mov imm0,#TCR_STATE_LISP)
         __(str imm0,[rcontext,#tcr.valence])
         __(ldr allocptr,[rcontext,#tcr.save_allocptr]) =

@@ -3122,11 +3133,12 @@
         __(ldr lr,[nfn,#_function.entrypoint])
         __(blx lr)
         __(str vsp,[rcontext,#tcr.save_vsp])
-        __(ldr imm1,[sp,#4])
+        __(ldr imm1,[sp,#(9*8)+4])
         __(str imm1,[rcontext,#tcr.last_lisp_frame])
         __(str allocptr,[rcontext,#tcr.save_allocptr])
         __(mov imm0,#TCR_STATE_FOREIGN)
         __(str imm0,[rcontext,#tcr.valence])
+        __(pop_foreign_fprs())
         __(ldr sp,[sp,#node_size*2])   /* drop the ivector that hides fore=
ign stack contents and restore (possibly misaligned) sp */
         __(ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12,lr})
         __(ldmia sp!,{r0,r1})
@@ -3986,10 +3998,12 @@
         __(mov vsp,imm1)
         __(ldr imm0,[temp0,#catch_frame.link])
         __(str imm0,[rcontext,#tcr.catch_top])
+        __(add imm0,sp,#catch_frame.nvrs+fulltag_misc)
+        __(fldmias imm0,{save0-save3})
         __(ldr fn,[sp,#catch_frame.size+lisp_frame.savefn])
         __(ldr lr,[sp,#catch_frame.size+lisp_frame.savelr])
         __(add sp,sp,#catch_frame.size+lisp_frame.size)
-        __(pop_fprs())
+        __(pop_lisp_fprs())
         __(bx lr)
 _endfn(C(_throw_found))        =

 =

@@ -4018,13 +4032,17 @@
         __(cmp temp2,#0)
         __(ldreq vsp,[sp,#catch_frame.size+lisp_frame.savevsp])
         __(add sp,sp,#catch_frame.size+lisp_frame.size)
-        __(pop_fprs())
+        __(pop_lisp_fprs())
         __(b local_label(_nthrow1v_nextframe))
 local_label(_nthrow1v_do_unwind):
         /* This is harder, but not as hard (not as much BLTing) as the  */
         /* multiple-value case.  */
         /* Save our caller's LR and FN in the csp frame created by the unw=
ind-  */
         /* protect.  (Clever, eh ?)  */
+	__(flds save0,[sp,#fulltag_misc+catch_frame.nvrs+(0*node_size)])
+	__(flds save1,[sp,#fulltag_misc+catch_frame.nvrs+(1*node_size)])
+	__(flds save2,[sp,#fulltag_misc+catch_frame.nvrs+(2*node_size)])
+	__(flds save3,[sp,#fulltag_misc+catch_frame.nvrs+(3*node_size)])
         __(add sp,sp,#catch_frame.size)
         /* We used to use a swp instruction to exchange the lr with
         the lisp_frame.savelr field of the lisp frame that temp0 addresses.
@@ -4054,7 +4072,7 @@
         __(ldr vsp,[temp0,#lisp_frame.savevsp])
         __(mov fn,nfn)
         __(add temp0,temp0,#lisp_frame.size)
-        __(restore_fprs(temp0))
+        __(restore_lisp_fprs(temp0))
         __(str imm1,[rcontext,#tcr.unwinding])
         __(blx lr)
         __(mov imm1,#1)
@@ -4063,7 +4081,7 @@
         __(ldr temp2,[sp,#12])
         __(add sp,sp,#4*node_size)
         __(restore_lisp_frame(imm0))
-        __(discard_fprs())
+        __(discard_lisp_fprs())
         __(b local_label(_nthrow1v_nextframe))
 local_label(_nthrow1v_done):
         __(mov imm0,#0)
@@ -4110,7 +4128,7 @@
         __(mov vsp,imm0)
 local_label(nthrownv_skip):     =

         __(add sp,sp,#catch_frame.size+lisp_frame.size)
-        __(pop_fprs())
+        __(pop_lisp_fprs())          =

         __(b local_label(nthrownv_nextframe))                =

 local_label(nthrownv_do_unwind):
         __(ldr arg_x,[temp0,#catch_frame.xframe])
@@ -4118,6 +4136,10 @@
         __(sub sp,temp0,#fulltag_misc)
         __(str arg_x,[rcontext,#tcr.xframe])
         __(str arg_z,[rcontext,#tcr.last_lisp_frame])
+	__(flds save0,[sp,#fulltag_misc+catch_frame.nvrs+(0*node_size)])
+	__(flds save1,[sp,#fulltag_misc+catch_frame.nvrs+(1*node_size)])
+	__(flds save2,[sp,#fulltag_misc+catch_frame.nvrs+(2*node_size)])
+	__(flds save3,[sp,#fulltag_misc+catch_frame.nvrs+(3*node_size)]) =

         __(add sp,sp,#catch_frame.size)
         __(add imm1,nargs,#node_size)
         __(mov arg_z,sp)
@@ -4151,7 +4173,7 @@
         __(str fn,[arg_z,#lisp_frame.savefn])
         __(ldr vsp,[arg_z,#lisp_frame.savevsp])
         __(add arg_z,arg_z,#lisp_frame.size)
-        __(restore_fprs(arg_z))
+        __(restore_lisp_fprs(arg_z))
         __(str imm1,[rcontext,#tcr.unwinding])
         __(mov fn,nfn)
         __(blx lr)
@@ -4176,7 +4198,7 @@
         __(ldr fn,[sp,#lisp_frame.savefn])
         __(ldr lr,[sp,#lisp_frame.savelr])
         __(discard_lisp_frame())
-        __(discard_fprs())
+        __(discard_lisp_fprs())
         __(b local_label(nthrownv_nextframe))
 local_label(nthrownv_done):     =

         __(mov imm0,#0)
@@ -4369,14 +4391,21 @@
         __(mov imm0,imm0,lsl #num_subtag_bits-word_shift)
         __(orr imm0,imm0,#subtag_u32_vector)
         __(stmdb sp!,{imm0,imm2})
+        __(push_foreign_fprs())
+        __(fmsr save0,arg_z)
+        __(fcpys save1,save0)
+        __(fcpys save2,save0)
+        __(fcpys save3,save0)       =

         __(mov imm0,#TCR_STATE_LISP)
         __(str imm0,[rcontext,#tcr.valence])
         __(ldr allocptr,[rcontext,#tcr.save_allocptr])
         __(bl toplevel_loop)
-        __(ldmia sp!,{imm0,imm1})
+        __(ldr imm1,[sp,#(9*8)+4])
         __(mov imm0,#TCR_STATE_FOREIGN)
         __(str imm1,[rcontext,#tcr.last_lisp_frame])
         __(str imm0,[rcontext,#tcr.valence])
+        __(pop_foreign_fprs())
+        __(add sp,sp,#2*node_size)
         __(mov imm0,#nil_value)
         __(ldr sp,[sp])
         __(ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12,lr})

Modified: trunk/source/lisp-kernel/lisp-debug.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/lisp-debug.c (original)
+++ trunk/source/lisp-kernel/lisp-debug.c Wed Aug 31 05:11:12 2011
@@ -53,6 +53,55 @@
 #undef str
 #else
 char *kernel_svn_revision =3D "unknown";
+#endif
+
+#ifdef ARM
+#ifdef LINUX
+
+/* This stuff is buried in kernel headers.  Why ? */
+
+/* The uc_regspace field of a ucontext can contain coprocessor
+   info in structures whose first word is one of these magic
+   values; the structure list is terminated by something that's
+   not one of these magic values.
+
+   Good thinking! That'll make the mechanism easy to extend!
+   (In practice, a word of 0 seems to terminate the structure
+   list.)
+*/
+#define VFP_MAGIC		0x56465001
+#define IWMMXT_MAGIC		0x12ef842a
+#define CRUNCH_MAGIC		0x5065cf03
+
+
+struct user_vfp {
+	unsigned long long fpregs[32];
+	unsigned long fpscr;
+};
+
+struct user_vfp *
+find_vfp_info(ExceptionInformation *xp)
+{
+  char *p =3D (char *)(xp->uc_regspace);
+  unsigned *q, magic;
+
+  while (1) {
+    q =3D (unsigned *)p;                        =

+    magic =3D *q;
+    if (magic =3D=3D VFP_MAGIC) {
+      return (struct user_vfp *)(q+2);
+    }
+    if ((magic =3D=3D CRUNCH_MAGIC) ||
+        (magic =3D=3D IWMMXT_MAGIC)) {
+      p +=3D q[1];
+    }
+    else {
+      return NULL;
+    }
+  }
+}
+
+#endif
 #endif
 =

 Boolean
@@ -742,6 +791,19 @@
       show_lisp_register(xp, "temp0", temp0);
       show_lisp_register(xp, "temp1/fname/next_method_context", temp1);
       show_lisp_register(xp, "temp2/nfn", temp2);
+#ifdef LINUX
+      {
+        LispObj *nvrs =3D (LispObj *)find_vfp_info(xp);
+
+        if (nvrs !=3D NULL) {
+          int r;
+
+          for(r=3Dsave0;r<=3Dsave3;r++) {
+            fprintf(dbgout,"s%02d (save%d) =3D %s\n",r,r-save0,print_lisp_=
object(nvrs[r]));
+          }
+        }
+      }
+#endif
     }
 #endif
   }
@@ -1050,59 +1112,23 @@
 	    a, xpGPR(xp, a),
 	    b, xpGPR(xp, b));
   }
+#ifdef LINUX
+  {
+    LispObj *nvrs =3D (LispObj *)find_vfp_info(xp);
+    =

+    if (nvrs !=3D NULL) {
+      for(a=3Dsave0,b=3Dsave2;a<save2;a++,b++) {
+        fprintf(dbgout,"s%02d =3D 0x%08lX    s%02d =3D 0x%08lX\n",
+                a, nvrs[a], b, nvrs[b]);
+      }
+    }
+  }
+#endif
 #endif
 =

   return debug_continue;
 }
 =

-#ifdef ARM
-#ifdef LINUX
-
-/* This stuff is buried in kernel headers.  Why ? */
-
-/* The uc_regspace field of a ucontext can contain coprocessor
-   info in structures whose first word is one of these magic
-   values; the structure list is terminated by something that's
-   not one of these magic values.
-
-   Good thinking! That'll make the mechanism easy to extend!
-   (In practice, a word of 0 seems to terminate the structure
-   list.)
-*/
-#define VFP_MAGIC		0x56465001
-#define IWMMXT_MAGIC		0x12ef842a
-#define CRUNCH_MAGIC		0x5065cf03
-
-
-struct user_vfp {
-	unsigned long long fpregs[32];
-	unsigned long fpscr;
-};
-
-struct user_vfp *
-find_vfp_info(ExceptionInformation *xp)
-{
-  char *p =3D (char *)(xp->uc_regspace);
-  unsigned *q, magic;
-
-  while (1) {
-    q =3D (unsigned *)p;                        =

-    magic =3D *q;
-    if (magic =3D=3D VFP_MAGIC) {
-      return (struct user_vfp *)(q+2);
-    }
-    if ((magic =3D=3D CRUNCH_MAGIC) ||
-        (magic =3D=3D IWMMXT_MAGIC)) {
-      p +=3D q[1];
-    }
-    else {
-      return NULL;
-    }
-  }
-}
-
-#endif
-#endif
 =

 debug_command_return
 debug_show_fpu(ExceptionInformation *xp, siginfo_t *info, int arg)
@@ -1202,7 +1228,8 @@
     unsigned long long *llp =3D (unsigned long long *)vfp;
     int dn,fn;
 =

-    for (dn=3D0,fn=3D0;dn<16;dn++) {
+
+    for (dn=3D0,fn=3D0;dn<14;dn++) { /* d14/d15 (s28-s31) contain lisp val=
ues */
       fprintf(dbgout, "s%02d =3D %10e (0x%08x)        s%02d =3D %10e (0x%0=
8x)\n",fn,fp[fn],up[fn],fn+1,fp[fn+1],up[fn+1]);
       fn+=3D2;
       fprintf(dbgout, "d%02d =3D %10e (0x%015llx)\n",dn,dp[dn],llp[dn]);



More information about the Openmcl-cvs-notifications mailing list