[Openmcl-cvs-notifications] r12644 - in /trunk/source/lisp-kernel: x86-constants32.h x86-constants64.h x86-exceptions.c xlbt.c
rme at clozure.com
rme at clozure.com
Fri Aug 21 21:58:31 EDT 2009
Author: rme
Date: Fri Aug 21 21:58:31 2009
New Revision: 12644
Log:
Clean up x86-exceptions.c a little bit by getting rid of some
X8632/X8664 conditionalization.
This is done by introducting a register index Ifp which is used
in lieu of Irbp or Iebp. (We already do a similar thing with Isp.)
Also rename the tcr field save_rbp/save_ebp to save_fp and update
users acccordingly.
These changes are (theoretically) cosmetic only.
Modified:
trunk/source/lisp-kernel/x86-constants32.h
trunk/source/lisp-kernel/x86-constants64.h
trunk/source/lisp-kernel/x86-exceptions.c
trunk/source/lisp-kernel/xlbt.c
Modified: trunk/source/lisp-kernel/x86-constants32.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/x86-constants32.h (original)
+++ trunk/source/lisp-kernel/x86-constants32.h Fri Aug 21 21:58:31 2009
@@ -73,6 +73,7 @@
#define Ira0 Itemp0
#define Inargs Itemp1
#define Ixfn Itemp1
+#define Ifp Iebp
=
/* MMX register offsets from where mm0 is found in uc_mcontext.fs */
#define Imm0 0
@@ -423,7 +424,7 @@
LispObj save1;
LispObj save2;
LispObj save3;
- LispObj *save_ebp; /* EBP when in foreign code */
+ LispObj *save_fp; /* EBP when in foreign code */
u32_t lisp_mxcsr;
u32_t foreign_mxcsr;
special_binding *db_link; /* special binding chain head */
Modified: trunk/source/lisp-kernel/x86-constants64.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/x86-constants64.h (original)
+++ trunk/source/lisp-kernel/x86-constants64.h Fri Aug 21 21:58:31 2009
@@ -108,6 +108,7 @@
#define Ira0 Itemp2
#define Inargs Iimm2
#define Ixfn Itemp1
+#define Ifp Irbp
=
=
#define nbits_in_word 64L
@@ -483,7 +484,7 @@
float f;
} single_float_convert;
struct tcr* linear;
- LispObj *save_rbp; /* RBP when in foreign code */
+ LispObj *save_fp; /* RBP when in foreign code */
u32_t lisp_mxcsr;
u32_t foreign_mxcsr;
special_binding* db_link; /* special binding chain head */
Modified: trunk/source/lisp-kernel/x86-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/x86-exceptions.c (original)
+++ trunk/source/lisp-kernel/x86-exceptions.c Fri Aug 21 21:58:31 2009
@@ -479,13 +479,8 @@
push_on_lisp_stack(xp,relative_pc);
push_on_lisp_stack(xp,nominal_function);
push_on_lisp_stack(xp,0);
-#ifdef X8664
- push_on_lisp_stack(xp,xpGPR(xp,Irbp));
- xpGPR(xp,Irbp) =3D xpGPR(xp,Isp);
-#else
- push_on_lisp_stack(xp,xpGPR(xp,Iebp));
- xpGPR(xp,Iebp) =3D xpGPR(xp,Isp);
-#endif
+ push_on_lisp_stack(xp,xpGPR(xp,Ifp));
+ xpGPR(xp,Ifp) =3D xpGPR(xp,Isp);
return xpGPR(xp,Isp);
}
=
@@ -596,10 +591,7 @@
set_mxcsr(0x1f80);
=
/* Put the active stack pointers where .SPcallback expects them */
-#ifdef X8664
- tcr->save_vsp =3D (LispObj *) xpGPR(xp, Isp);
- tcr->save_rbp =3D (LispObj *) xpGPR(xp, Irbp);
-#else
+#ifdef X8632
tcr->node_regs_mask =3D X8632_DEFAULT_NODE_REGS_MASK;
=
*--vsp =3D tcr->save0;
@@ -608,10 +600,9 @@
*--vsp =3D tcr->save3;
*--vsp =3D tcr->next_method_context;
xpGPR(xp, Isp) =3D (LispObj)vsp;
-
+#endif
tcr->save_vsp =3D (LispObj *)xpGPR(xp, Isp);
- tcr->save_ebp =3D (LispObj *)xpGPR(xp, Iebp);
-#endif
+ tcr->save_fp =3D (LispObj *)xpGPR(xp, Ifp);
=
/* Call back. The caller of this function may have modified stack/frame
pointers (and at least should have called prepare_for_callback()).
@@ -642,20 +633,12 @@
{
LispObj *save_vsp =3D (LispObj *)xpGPR(xp,Isp),
word_beyond_vsp =3D save_vsp[-1],
-#ifdef X8664
- save_rbp =3D xpGPR(xp,Irbp),
-#else
- save_ebp =3D xpGPR(xp,Iebp),
-#endif
+ save_fp =3D xpGPR(xp,Ifp),
xcf =3D create_exception_callback_frame(xp, tcr);
int save_errno =3D errno;
=
callback_to_lisp(tcr, nrs_CMAIN.vcell,xp, xcf, 0, 0, 0, 0);
-#ifdef X8664
- xpGPR(xp,Irbp) =3D save_rbp;
-#else
- xpGPR(xp,Iebp) =3D save_ebp;
-#endif
+ xpGPR(xp,Ifp) =3D save_fp;
xpGPR(xp,Isp) =3D (LispObj)save_vsp;
save_vsp[-1] =3D word_beyond_vsp;
errno =3D save_errno;
@@ -667,12 +650,8 @@
pc program_counter =3D (pc)xpPC(xp);
unsigned char op0 =3D program_counter[0], op1 =3D program_counter[1];
LispObj rpc, errdisp =3D nrs_ERRDISP.vcell,
- save_vsp =3D xpGPR(xp,Isp), xcf0;
-#ifdef X8664
- LispObj save_rbp =3D xpGPR(xp,Irbp);
-#else
- LispObj save_ebp =3D xpGPR(xp,Iebp);
-#endif
+ save_vsp =3D xpGPR(xp,Isp), xcf0,
+ save_fp =3D xpGPR(xp,Ifp);
int skip;
=
if ((fulltag_of(errdisp) =3D=3D fulltag_misc) &&
@@ -702,11 +681,7 @@
=
skip =3D 0;
}
-#ifdef X8664
- xpGPR(xp,Irbp) =3D save_rbp;
-#else
- xpGPR(xp,Iebp) =3D save_ebp;
-#endif
+ xpGPR(xp,Ifp) =3D save_fp;
xpGPR(xp,Isp) =3D save_vsp;
if ((op0 =3D=3D 0xcd) && (op1 =3D=3D 0xc7)) {
/* Continue after an undefined function call. The function
@@ -720,11 +695,7 @@
called when we resume.
*/
LispObj *vsp =3D(LispObj *)save_vsp, ra =3D *vsp;
-#ifdef X8664
- int nargs =3D (xpGPR(xp, Inargs) & 0xffff)>>fixnumshift;
-#else
int nargs =3D xpGPR(xp, Inargs)>>fixnumshift;
-#endif
=
#ifdef X8664
if (nargs > 3) {
@@ -792,11 +763,7 @@
*/
lisp_protection_kind which =3D prot_area->why;
Boolean on_TSP =3D (which =3D=3D kTSPsoftguard);
-#ifdef X8664
- LispObj save_rbp =3D xpGPR(xp,Irbp);
-#else
- LispObj save_ebp =3D xpGPR(xp,Iebp);
-#endif
+ LispObj save_fp =3D xpGPR(xp,Ifp);
LispObj save_vsp =3D xpGPR(xp,Isp), =
xcf,
cmain =3D nrs_CMAIN.vcell;
@@ -815,12 +782,8 @@
soft =3D a->softprot;
unprotect_area(soft);
xcf =3D create_exception_callback_frame(xp, tcr);
- skip =3D callback_to_lisp(tcr, nrs_CMAIN.vcell, xp, xcf, SIGSEGV, on_T=
SP, 0, 0);
-#ifdef X8664
- xpGPR(xp,Irbp) =3D save_rbp;
-#else
- xpGPR(xp,Iebp) =3D save_ebp;
-#endif
+ skip =3D callback_to_lisp(tcr, cmain, xp, xcf, SIGSEGV, on_TSP, 0, 0);
+ xpGPR(xp,Ifp) =3D save_fp;
xpGPR(xp,Isp) =3D save_vsp;
xpPC(xp) +=3D skip;
return true;
@@ -832,11 +795,7 @@
is_write_fault(ExceptionInformation *xp, siginfo_t *info)
{
#ifdef DARWIN
-#ifdef X8664
return (UC_MCONTEXT(xp)->__es.__err & 0x2) !=3D 0;
-#else
- return (xp->uc_mcontext->__es.__err & 0x2) !=3D 0;
-#endif
#endif
#if defined(LINUX) || defined(SOLARIS)
return (xpGPR(xp,REG_ERR) & 0x2) !=3D 0;
@@ -906,12 +865,8 @@
{
int code,skip;
LispObj xcf, cmain =3D nrs_CMAIN.vcell,
- save_vsp =3D xpGPR(xp,Isp);
-#ifdef X8664
- LispObj save_rbp =3D xpGPR(xp,Irbp);
-#else
- LispObj save_ebp =3D xpGPR(xp,Iebp);
-#endif
+ save_vsp =3D xpGPR(xp,Isp),
+ save_fp =3D xpGPR(xp,Ifp);
#ifdef WINDOWS
code =3D info->ExceptionCode;
#else
@@ -923,11 +878,7 @@
xcf =3D create_exception_callback_frame(xp, tcr);
skip =3D callback_to_lisp(tcr, cmain, xp, xcf, SIGFPE, code, 0, 0);
xpPC(xp) +=3D skip;
-#ifdef X8664
- xpGPR(xp,Irbp) =3D save_rbp;
-#else
- xpGPR(xp,Iebp) =3D save_ebp;
-#endif
+ xpGPR(xp,Ifp) =3D save_fp;
xpGPR(xp,Isp) =3D save_vsp;
return true;
} else {
@@ -1440,7 +1391,7 @@
tcr_frame_ptr(TCR *tcr)
{
ExceptionInformation *xp;
- LispObj *bp;
+ LispObj *fp;
=
if (tcr->pending_exception_context)
xp =3D tcr->pending_exception_context;
@@ -1450,19 +1401,11 @@
xp =3D NULL;
}
if (xp) {
-#ifdef X8664
- bp =3D (LispObj *) xpGPR(xp, Irbp);
-#else
- bp =3D (LispObj *) xpGPR(xp, Iebp);
-#endif
+ fp =3D (LispObj *)xpGPR(xp, Ifp);
} else {
-#ifdef X8664
- bp =3D tcr->save_rbp;
-#else
- bp =3D tcr->save_ebp;
-#endif
- }
- return bp;
+ fp =3D tcr->save_fp;
+ }
+ return fp;
}
=
=
@@ -1661,11 +1604,7 @@
(tcr->valence !=3D TCR_STATE_LISP) ||
(tcr->unwinding !=3D 0) ||
! stack_pointer_on_vstack_p(xpGPR(context,Isp), tcr) ||
-#ifdef X8664
- ! stack_pointer_on_vstack_p(xpGPR(context,Irbp), tcr)) {
-#else
- ! stack_pointer_on_vstack_p(xpGPR(context,Iebp), tcr)) {
-#endif
+ ! stack_pointer_on_vstack_p(xpGPR(context,Ifp), tcr)) {
tcr->interrupt_pending =3D (((natural) 1)<< (nbits_in_word - ((natur=
al)1)));
} else {
LispObj cmain =3D nrs_CMAIN.vcell;
Modified: trunk/source/lisp-kernel/xlbt.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/xlbt.c (original)
+++ trunk/source/lisp-kernel/xlbt.c Fri Aug 21 21:58:31 2009
@@ -137,32 +137,26 @@
}
=
void
-plbt_sp(LispObj currentRBP)
+plbt_sp(LispObj current_fp)
{
area *vs_area, *cs_area;
- =
-{
- TCR *tcr =3D (TCR *)get_tcr(true);
- char *ilevel =3D interrupt_level_description(tcr);
- vs_area =3D tcr->vs_area;
- cs_area =3D tcr->cs_area;
- if ((((LispObj) ptr_to_lispobj(vs_area->low)) > currentRBP) ||
- (((LispObj) ptr_to_lispobj(vs_area->high)) < currentRBP)) {
-#ifdef X8664
- currentRBP =3D (LispObj) (tcr->save_rbp);
-#else
- currentRBP =3D (LispObj) (tcr->save_ebp);
-#endif
- }
- if ((((LispObj) ptr_to_lispobj(vs_area->low)) > currentRBP) ||
- (((LispObj) ptr_to_lispobj(vs_area->high)) < currentRBP)) {
- Dprintf("\nFramepointer [#x%lX] in unknown area.", currentRBP);
- } else {
- fprintf(dbgout, "current thread: tcr =3D 0x%lx, native thread ID =3D=
0x%lx, interrupts %s\n", tcr, tcr->native_thread_id, ilevel);
- walk_stack_frames((lisp_frame *) ptr_from_lispobj(currentRBP), (lisp=
_frame *) (vs_area->high));
- /* walk_other_areas();*/
- }
- } =
+ TCR *tcr =3D (TCR *)get_tcr(true);
+ char *ilevel =3D interrupt_level_description(tcr);
+
+ vs_area =3D tcr->vs_area;
+ cs_area =3D tcr->cs_area;
+ if ((((LispObj) ptr_to_lispobj(vs_area->low)) > current_fp) ||
+ (((LispObj) ptr_to_lispobj(vs_area->high)) < current_fp)) {
+ current_fp =3D (LispObj) (tcr->save_fp);
+ }
+ if ((((LispObj) ptr_to_lispobj(vs_area->low)) > current_fp) ||
+ (((LispObj) ptr_to_lispobj(vs_area->high)) < current_fp)) {
+ Dprintf("\nFrame pointer [#x" LISP "] in unknown area.", current_fp);
+ } else {
+ fprintf(dbgout, "current thread: tcr =3D 0x" LISP ", native thread ID =
=3D 0x" LISP ", interrupts %s\n", tcr, tcr->native_thread_id, ilevel);
+ walk_stack_frames((lisp_frame *) ptr_from_lispobj(current_fp), (lisp_f=
rame *) (vs_area->high));
+ /* walk_other_areas();*/
+ }
}
=
=
More information about the Openmcl-cvs-notifications
mailing list