more relible mach exception code

slava 2006-08-05 22:10:01 +00:00
parent 26816e583a
commit e12fba4b0e
4 changed files with 27 additions and 6 deletions

View File

@ -1,5 +1,7 @@
+ 0.84: + 0.84:
= bug fixes:
- fix contribs: boids, automata - fix contribs: boids, automata
- sometimes darcs get fails with the httpd - sometimes darcs get fails with the httpd
- gdb triggers 'mutliple i/o ops on port' error - gdb triggers 'mutliple i/o ops on port' error
@ -8,16 +10,18 @@
- editor: - editor:
- better listener multi-line expression handling - better listener multi-line expression handling
- history doesn't work in a good way if you ^K the input - history doesn't work in a good way if you ^K the input
- graphical module manager tool
- services do not launch if factor not running - services do not launch if factor not running
- roundoff is still not quite right with tracks - roundoff is still not quite right with tracks
- fix top level window positioning - fix top level window positioning
- nasty inference regressions - nasty inference regressions
- [ [ dup call ] dup call ] infer hangs - [ [ dup call ] dup call ] infer hangs
- the invalid recursion form case needs to be fixed, for inlines too - the invalid recursion form case needs to be fixed, for inlines too
= features:
- graphical module manager tool
- instead of decompiling words, add them to a 'recompile' set; compiler - instead of decompiling words, add them to a 'recompile' set; compiler
treats words in the recompile set as if they were not compiled treats words in the recompile set as if they were not compiled
- mach_signal: fault address reporting is not reliable
- see if alien calls can be made faster - see if alien calls can be made faster
- faster sequence= for UI - faster sequence= for UI
- constant branch folding - constant branch folding
@ -29,6 +33,7 @@
+ ui: + ui:
- better doc for accumulate, link from tree
- we have trouble drawing rectangles - we have trouble drawing rectangles
- the UI listener has a shitty design. perhaps it should not call out - the UI listener has a shitty design. perhaps it should not call out
to the real listener. to the real listener.

View File

@ -22,11 +22,11 @@ static mach_port_t our_exception_port;
/* Communication area for the exception state and thread state. */ /* Communication area for the exception state and thread state. */
static SIGSEGV_THREAD_STATE_TYPE save_thread_state; static SIGSEGV_THREAD_STATE_TYPE save_thread_state;
/* A handler that is called in the faulting thread. It terminates the thread. */ /* A handler that is called in the faulting thread. */
static void static void
terminating_handler () terminating_handler (void *fault_addr)
{ {
raise (SIGSEGV); memory_protection_error(fault_addr,SIGSEGV);
abort (); abort ();
} }
@ -72,6 +72,7 @@ catch_exception_raise (mach_port_t exception_port,
save_thread_state = thread_state; save_thread_state = thread_state;
SIGSEGV_PROGRAM_COUNTER (thread_state) = (unsigned long) terminating_handler; SIGSEGV_PROGRAM_COUNTER (thread_state) = (unsigned long) terminating_handler;
pass_arg0(&thread_state,SIGSEGV_EXC_STATE_FAULT(exc_state));
SIGSEGV_STACK_POINTER (thread_state) = fix_stack_ptr(sp); SIGSEGV_STACK_POINTER (thread_state) = fix_stack_ptr(sp);
/* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_set_state.html. */ /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_set_state.html. */

View File

@ -1,13 +1,20 @@
#define SIGSEGV_EXC_STATE_TYPE ppc_exception_state_t #define SIGSEGV_EXC_STATE_TYPE ppc_exception_state_t
#define SIGSEGV_EXC_STATE_FLAVOR PPC_EXCEPTION_STATE #define SIGSEGV_EXC_STATE_FLAVOR PPC_EXCEPTION_STATE
#define SIGSEGV_EXC_STATE_COUNT PPC_EXCEPTION_STATE_COUNT #define SIGSEGV_EXC_STATE_COUNT PPC_EXCEPTION_STATE_COUNT
#define SIGSEGV_EXC_STATE_FAULT(exc_state) (exc_state).dar
#define SIGSEGV_THREAD_STATE_TYPE ppc_thread_state_t #define SIGSEGV_THREAD_STATE_TYPE ppc_thread_state_t
#define SIGSEGV_THREAD_STATE_FLAVOR PPC_THREAD_STATE #define SIGSEGV_THREAD_STATE_FLAVOR PPC_THREAD_STATE
#define SIGSEGV_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT #define SIGSEGV_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
#define SIGSEGV_STACK_POINTER(thr_state) (thr_state).r1 #define SIGSEGV_STACK_POINTER(thr_state) (thr_state).r1
#define SIGSEGV_THREAD_STATE_ARG(thr_state) (thr_state).r3
#define SIGSEGV_PROGRAM_COUNTER(thr_state) (thr_state).srr0 #define SIGSEGV_PROGRAM_COUNTER(thr_state) (thr_state).srr0
INLINE unsigned long fix_stack_ptr(unsigned long sp) INLINE unsigned long fix_stack_ptr(unsigned long sp)
{ {
return sp; return sp;
} }
INLINE void pass_arg0(SIGSEGV_THREAD_STATE_TYPE *thr_state, CELL arg)
{
SIGSEGV_THREAD_STATE_ARG(*thr_state) = arg;
}

View File

@ -1,15 +1,23 @@
#define SIGSEGV_EXC_STATE_TYPE i386_exception_state_t #define SIGSEGV_EXC_STATE_TYPE i386_exception_state_t
#define SIGSEGV_EXC_STATE_FLAVOR i386_EXCEPTION_STATE #define SIGSEGV_EXC_STATE_FLAVOR i386_EXCEPTION_STATE
#define SIGSEGV_EXC_STATE_COUNT i386_EXCEPTION_STATE_COUNT #define SIGSEGV_EXC_STATE_COUNT i386_EXCEPTION_STATE_COUNT
#define SIGSEGV_EXC_STATE_FAULT(exc_state) (exc_state).dar
#define SIGSEGV_THREAD_STATE_TYPE i386_thread_state_t #define SIGSEGV_THREAD_STATE_TYPE i386_thread_state_t
#define SIGSEGV_THREAD_STATE_FLAVOR i386_THREAD_STATE #define SIGSEGV_THREAD_STATE_FLAVOR i386_THREAD_STATE
#define SIGSEGV_THREAD_STATE_COUNT i386_THREAD_STATE_COUNT #define SIGSEGV_THREAD_STATE_COUNT i386_THREAD_STATE_COUNT
#define SIGSEGV_STACK_POINTER(thr_state) (thr_state).esp #define SIGSEGV_STACK_POINTER(thr_state) (thr_state).esp
#define SIGSEGV_PROGRAM_COUNTER(thr_state) (thr_state).eip #define SIGSEGV_PROGRAM_COUNTER(thr_state) (thr_state).eip
/* Adjust stack pointer so we can push an arg */
INLINE unsigned long fix_stack_ptr(unsigned long sp) INLINE unsigned long fix_stack_ptr(unsigned long sp)
{ {
if ((sp & 0xf) != 0) sp -= (sp & 0xf); if ((sp & 0xf) != 0) sp -= (sp & 0xf);
sp -= 4; sp -= 8;
return sp; return sp;
} }
INLINE void pass_arg0(SIGSEGV_THREAD_STATE_TYPE *thr_state, CELL arg)
{
*SIGSEGV_STACK_POINTER(*thread_state) = arg;
SIGSEGV_STACK_POINTER(*thread_state) -= CELLS;
}