Teach continue_from_trap about assembly hooks.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Tue, 16 Mar 1993 21:36:16 +0000 (21:36 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Tue, 16 Mar 1993 21:36:16 +0000 (21:36 +0000)
v7/src/microcode/uxtrap.c
v7/src/microcode/uxtrap.h

index 2b4978eaf5e95f5cbe925613b252c73b0a7019b1..ba84a0d3f82f57f9c11d400f7d59e190e6b47c34 100644 (file)
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Id: uxtrap.c,v 1.20 1992/08/29 13:11:27 jinx Exp $
+$Id: uxtrap.c,v 1.21 1993/03/16 21:36:10 gjr Exp $
 
-Copyright (c) 1990-1992 Massachusetts Institute of Technology
+Copyright (c) 1990-1993 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -490,6 +490,7 @@ DEFUN (continue_from_trap, (signo, info, scp),
        SIGINFO_T info AND
        struct FULL_SIGCONTEXT * scp)
 {
+  int pc_in_hook;
   int pc_in_C;
   int pc_in_heap;
   int pc_in_constant_space;
@@ -509,10 +510,17 @@ DEFUN (continue_from_trap, (signo, info, scp),
   fprintf (stderr, "\tCsp = 0x%08lx\n", C_sp);
   fprintf (stderr, "\tssp = 0x%08lx\n", scheme_sp);
   fprintf (stderr, "\tesp = 0x%08lx\n", Ext_Stack_Pointer);
+#ifdef hp9000s800
+  {
+    fprintf (stderr, "\tscheme_hooks_low = 0x%08lx\n", scheme_hooks_low);
+    fprintf (stderr, "\tscheme_hooks_high = 0x%08lx\n", scheme_hooks_high);
+  }
+#endif
 #endif
 
   if ((the_pc & PC_ALIGNMENT_MASK) != 0)
   {
+    pc_in_hook = 0;
     pc_in_C = 0;
     pc_in_heap = 0;
     pc_in_constant_space = 0;
@@ -521,13 +529,14 @@ DEFUN (continue_from_trap, (signo, info, scp),
   }
   else
   {
-    pc_in_C = (the_pc <= ((long) (get_etext ())));
+    pc_in_hook = (PC_HOOK_P (the_pc));
+    pc_in_C = ((the_pc <= ((long) (get_etext ()))) && (!pc_in_hook));
     pc_in_heap =
       ((the_pc < ((long) Heap_Top)) && (the_pc >= ((long) Heap_Bottom)));
     pc_in_constant_space =
       ((the_pc < ((long) Constant_Top)) &&
        (the_pc >= ((long) Constant_Space)));
-    pc_in_scheme = (pc_in_heap || pc_in_constant_space);
+    pc_in_scheme = (pc_in_heap || pc_in_constant_space || pc_in_hook);
     pc_in_hyper_space = ((!pc_in_C) && (!pc_in_scheme));
   }
 
@@ -565,17 +574,15 @@ DEFUN (continue_from_trap, (signo, info, scp),
     SCHEME_OBJECT * block_addr;
     SCHEME_OBJECT * maybe_free;
     block_addr =
-      (find_block_address (((PTR) the_pc),
-                          (pc_in_heap ? Heap_Bottom : Constant_Space)));
-    if (block_addr == 0)
+      (pc_in_hook
+       ? ((SCHEME_OBJECT *) NULL)
+       : (find_block_address (((PTR) the_pc),
+                             (pc_in_heap ? Heap_Bottom : Constant_Space))));
+    if (block_addr == ((SCHEME_OBJECT *) NULL))
     {
       (trinfo . state) = STATE_PROBABLY_COMPILED;
       (trinfo . pc_info_1) = (LONG_TO_UNSIGNED_FIXNUM (the_pc));
       (trinfo . pc_info_2) = SHARP_F;
-      if ((Free < MemTop) ||
-         (Free >= Heap_Top) ||
-         ((((unsigned long) Free) & SCHEME_ALIGNMENT_MASK) != 0))
-       Free = MemTop;
     }
     else
     {
@@ -584,6 +591,17 @@ DEFUN (continue_from_trap, (signo, info, scp),
        (MAKE_POINTER_OBJECT (TC_COMPILED_CODE_BLOCK, block_addr));
       (trinfo . pc_info_2) =
        (LONG_TO_UNSIGNED_FIXNUM (the_pc - ((long) block_addr)));
+    }
+    if ((block_addr == ((SCHEME_OBJECT *) NULL))
+       && (! pc_in_hook))
+    {
+      if ((Free < MemTop) ||
+         (Free >= Heap_Top) ||
+         ((((unsigned long) Free) & SCHEME_ALIGNMENT_MASK) != 0))
+       Free = MemTop;
+    }
+    else
+    {
 #ifdef HAVE_FULL_SIGCONTEXT
       maybe_free = ((SCHEME_OBJECT *) (FULL_SIGCONTEXT_RFREE (scp)));
       if (((((unsigned long) maybe_free) & SCHEME_ALIGNMENT_MASK) == 0)
@@ -596,9 +614,7 @@ DEFUN (continue_from_trap, (signo, info, scp),
       {
        if ((Free < MemTop) || (Free >= Heap_Top)
            || ((((unsigned long) Free) & SCHEME_ALIGNMENT_MASK) != 0))
-       {
          Free = MemTop;
-       }
       }
     }
   }
index 66ab275783720dfcd7fe4b8d0b82440dcee87f55..405fe6cd7ca6f99b61aba27dd4209e5bd4ba73a0 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: uxtrap.h,v 1.18 1993/03/14 22:12:53 gjr Exp $
+$Id: uxtrap.h,v 1.19 1993/03/16 21:36:16 gjr Exp $
 
 Copyright (c) 1990-1993 Massachusetts Institute of Technology
 
@@ -96,6 +96,13 @@ MIT in each case. */
 
 #define PC_VALUE_MASK                  ((~0) << 2)
 
+/* Pseudo-compiled code in assembly language. */
+
+extern void * scheme_hooks_low, * scheme_hooks_high;
+#define PC_HOOK_P(pc)                                                  \
+  ((((void *) (pc)) >= scheme_hooks_low)                               \
+   && (((void *) (pc)) < scheme_hooks_high))
+
 /* pcoq is the offset (32 bit in 64 bit virtual address space)
    in the space included in the corresponding sc_pcsq.
    head is the current instruction, tail is the next instruction
@@ -519,6 +526,10 @@ struct full_sigcontext
 #ifndef INITIALIZE_UX_SIGNAL_CODES
 #define INITIALIZE_UX_SIGNAL_CODES()
 #endif
+
+#ifndef PC_HOOK_P
+#define PC_HOOK_P(pc) 0
+#endif
 \f
 enum trap_state
 {