Changeset 14117
- Timestamp:
- Aug 5, 2010, 12:41:04 AM (10 years ago)
- Location:
- branches/arm/lisp-kernel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/arm/lisp-kernel/arm-constants.h
r14018 r14117 281 281 struct tcr *prev; 282 282 unsigned lisp_fpscr; 283 unsigned pad;283 unsigned stack_overflowed; /* non-zero when a stack has overflowed */ 284 284 special_binding *db_link; /* special binding chain head */ 285 285 LispObj catch_top; /* top catch frame */ … … 345 345 #define FPSCR_UFE_BIT 11 /* underflow enable */ 346 346 #define FPSCR_IXE_BIT 12 /* inexact enable */ 347 348 #define STACK_OVERFLOW_CSTACK fixnum_bitmask(0) 349 #define STACK_OVERFLOW_VSTACK fixnum_bitmask(1) 350 #define STACK_RECOVERY_MARGIN (8192) -
branches/arm/lisp-kernel/arm-constants.s
r14065 r14117 588 588 _node(next) /* in doubly-linked list */ 589 589 _node(lisp_fpscr) /* lisp thread's fpscr (in low word) */ 590 _node( pad)590 _node(stack_overflowed) /* Some stack has overflowed ; maybe fix */ 591 591 _node(db_link) /* special binding chain head */ 592 592 _node(catch_top) /* top catch frame */ -
branches/arm/lisp-kernel/arm-exceptions.c
r14074 r14117 507 507 signal_stack_soft_overflow(ExceptionInformation *xp, unsigned reg) 508 508 { 509 /* The cstack just overflowed. Force the current thread's 510 control stack to do so until all stacks are well under their overflow 511 limits. 512 */ 513 514 #if 0 515 lisp_global(CS_OVERFLOW_LIMIT) = CS_OVERFLOW_FORCE_LIMIT; /* force unsigned traps to fail */ 516 #endif 509 517 510 handle_error(xp, error_stack_overflow, reg, NULL); 518 511 } … … 928 921 protected_area_ptr vsp_soft = a->softprot; 929 922 unprotect_area(vsp_soft); 923 tcr->stack_overflowed |= STACK_OVERFLOW_VSTACK; 930 924 signal_stack_soft_overflow(xp,vsp); 931 925 return 0; … … 937 931 do_soft_stack_overflow(ExceptionInformation *xp, protected_area_ptr prot_area, BytePtr addr) 938 932 { 933 TCR *tcr = get_tcr(true); 934 939 935 /* Trying to write into a guard page on the vstack or tstack. 940 936 Allocate a new stack segment, emulate stwu and stwux for the TSP, and … … 945 941 } 946 942 unprotect_area(prot_area); 943 tcr->stack_overflowed |= STACK_OVERFLOW_CSTACK; 947 944 signal_stack_soft_overflow(xp,Rsp); 948 945 return 0; … … 1045 1042 opcode *there = (opcode *) where, instr, errnum = 0; 1046 1043 return err; 1044 } 1045 1046 Boolean 1047 try_stack_overflow_recovery(ExceptionInformation *xp, TCR *tcr) 1048 { 1049 area *a; 1050 protected_area_ptr soft; 1051 1052 if ((tcr->stack_overflowed) & STACK_OVERFLOW_CSTACK) { 1053 a = tcr->cs_area; 1054 soft = a->softprot; 1055 if (((BytePtr)xpGPR(xp,Rsp)-STACK_RECOVERY_MARGIN) > 1056 (soft->end)) { 1057 protect_area(soft); 1058 tcr->stack_overflowed &= ~STACK_OVERFLOW_CSTACK; 1059 } 1060 } 1061 1062 if ((tcr->stack_overflowed) & STACK_OVERFLOW_VSTACK) { 1063 a = tcr->vs_area; 1064 soft = a->softprot; 1065 if (((BytePtr)xpGPR(xp,vsp)-STACK_RECOVERY_MARGIN) > 1066 (soft->end)) { 1067 protect_area(soft); 1068 tcr->stack_overflowed &= ~STACK_OVERFLOW_VSTACK; 1069 } 1070 } 1047 1071 } 1048 1072 … … 1131 1155 handled = true; 1132 1156 break; 1157 case 6: 1158 try_stack_overflow_recovery(xp,tcr); 1159 handled = true; 1160 break; 1133 1161 default: 1134 1162 handled = false; -
branches/arm/lisp-kernel/arm-macros.s
r14101 r14117 498 498 ') 499 499 500 /* Check to see if we've unprotected a stack region in response to an overflow ; 501 if so, trap into the kernel to see if that region can be protected again. */ 502 define(`check_stack_overflow_recovery',` 503 __(ldr $1,[rcontext,#tcr.stack_overflowed]) 504 __(cmp $1,#0) 505 __(uuo_stack_overflow_recovery(ne)) 506 ') 507 -
branches/arm/lisp-kernel/arm-spentry.s
r14092 r14117 3921 3921 __(ldr lr,[sp,#catch_frame.size+lisp_frame.savelr]) 3922 3922 __(add sp,sp,#catch_frame.size+lisp_frame.size) 3923 __(check_stack_overflow_recovery(imm0)) 3923 3924 __(bx lr) 3924 3925 _endfn(C(_throw_found)) … … 3949 3950 __(ldreq vsp,[sp,#catch_frame.size+lisp_frame.savevsp]) 3950 3951 __(add sp,sp,#catch_frame.size+lisp_frame.size) 3952 __(check_stack_overflow_recovery(arg_y)) 3951 3953 __(b local_label(_nthrow1v_nextframe)) 3952 3954 local_label(_nthrow1v_do_unwind): … … 3969 3971 __(ldr vsp,[temp0,#lisp_frame.savevsp]) 3970 3972 __(mov fn,nfn) 3973 __(check_stack_overflow_recovery(arg_y)) 3971 3974 __(str imm1,[rcontext,#tcr.unwinding]) 3972 3975 __(blx lr) … … 4023 4026 local_label(nthrownv_skip): 4024 4027 __(add sp,sp,#catch_frame.size+lisp_frame.size) 4028 __(check_stack_overflow_recovery(arg_y)) 4025 4029 __(b local_label(nthrownv_nextframe)) 4026 4030 local_label(nthrownv_do_unwind): … … 4056 4060 __(str fn,[arg_z,#lisp_frame.savefn]) 4057 4061 __(ldr vsp,[arg_z,#lisp_frame.savevsp]) 4062 __(check_stack_overflow_recovery(arg_y)) 4058 4063 __(str imm1,[rcontext,#tcr.unwinding]) 4059 4064 __(mov fn,nfn) -
branches/arm/lisp-kernel/arm-uuo.s
r14024 r14117 83 83 define(`uuo_interrupt_now',`nullaryUUO($1,4)') 84 84 define(`uuo_suspend_now',`nullaryUUO($1,5)') 85 85 define(`uuo_stack_overflow_recovery',`nullaryUUO($1,6)') 86 86 87 /* Unary UUOs */ 87 88 define(`uuo_error_unbound',`unary_errorUUO($1,$2,0)')
Note: See TracChangeset
for help on using the changeset viewer.