Changeset 13799
- Timestamp:
- Jun 9, 2010, 9:14:38 PM (14 years ago)
- File:
-
- 1 edited
-
branches/arm/lisp-kernel/arm-exceptions.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/arm/lisp-kernel/arm-exceptions.c
r13789 r13799 321 321 } 322 322 323 OSStatus 323 Boolean 324 324 handle_alloc_trap(ExceptionInformation *xp, TCR *tcr) 325 325 { … … 331 331 332 332 cur_allocptr = xpGPR(xp,allocptr); 333 program_counter = xpPC(xp); 334 prev_instr = *(program_counter-1); 333 335 334 allocptr_tag = fulltag_of(cur_allocptr); 336 335 … … 341 340 break; 342 341 343 case fulltag_even_fixnum:344 case fulltag_odd_fixnum:345 break;346 347 342 case fulltag_misc: 348 343 disp = allocptr_displacement(xp); … … 352 347 /* else fall thru */ 353 348 default: 354 return -1; 355 } 356 357 if (bytes_needed) { 358 update_bytes_allocated(tcr,((BytePtr)(cur_allocptr-disp))); 359 if (allocate_object(xp, bytes_needed, disp, tcr)) { 360 #if 0 361 fprintf(dbgout, "alloc_trap in 0x%lx, new allocptr = 0x%lx\n", 362 tcr, xpGPR(xp, allocptr)); 363 #endif 364 adjust_exception_pc(xp,4); 365 return 0; 366 } 367 lisp_allocation_failure(xp,tcr,bytes_needed); 368 return -1; 369 } 370 return -1; 349 return false; 350 } 351 352 update_bytes_allocated(tcr,((BytePtr)(cur_allocptr-disp))); 353 if (allocate_object(xp, bytes_needed, disp, tcr)) { 354 adjust_exception_pc(xp,4); 355 return true; 356 } 357 lisp_allocation_failure(xp,tcr,bytes_needed); 358 return true; 371 359 } 372 360 … … 379 367 } 380 368 381 OSStatus 369 Boolean 382 370 handle_gc_trap(ExceptionInformation *xp, TCR *tcr) 383 371 { … … 511 499 512 500 adjust_exception_pc(xp,4); 513 return 0;501 return true; 514 502 } 515 503 … … 831 819 } 832 820 833 OSStatus 821 Boolean 834 822 handle_protection_violation(ExceptionInformation *xp, siginfo_t *info, TCR *tcr, int old_valence) 835 823 { … … 850 838 851 839 xpGPR(xp,imm0) = 0; 852 return 0;840 return true; 853 841 } 854 842 … … 856 844 xpGPR(xp,imm0) = 0; 857 845 xpPC(xp) = (pc)touch_page_end; 858 return 0;846 return true; 859 847 } 860 848 … … 870 858 UnProtectMemory((LogicalAddress)(truncate_to_power_of_2(addr,log2_page_size)), 871 859 page_size); 872 return 0;860 return true; 873 861 } 874 862 } 875 863 } 876 864 if (old_valence == TCR_STATE_LISP) { 877 callback_for_trap(nrs_CMAIN.vcell, xp, is_write_fault(xp,info)?SIGBUS:SIGSEGV, (natural)addr); 878 } 879 return -1; 865 LispObj cmain = nrs_CMAIN.vcell; 866 867 if ((fulltag_of(cmain) == fulltag_misc) && 868 (header_subtag(header_of(cmain)) == subtag_macptr)) { 869 870 callback_for_trap(nrs_CMAIN.vcell, xp, is_write_fault(xp,info)?SIGBUS:SIGSEGV, (natural)addr); 871 } 872 } 873 return false; 880 874 } 881 875 … … 991 985 } 992 986 993 OSStatus 994 PMCL_exception_handler(int xnum, 995 ExceptionInformation *xp, 996 TCR *tcr, 997 siginfo_t *info, 998 int old_valence) 999 { 1000 OSStatus status = -1; 987 Boolean 988 handle_exception(int xnum, 989 ExceptionInformation *xp, 990 TCR *tcr, 991 siginfo_t *info, 992 int old_valence) 993 { 1001 994 pc program_counter; 1002 995 opcode instruction = 0; … … 1010 1003 1011 1004 if (IS_ALLOC_TRAP(instruction)) { 1012 status =handle_alloc_trap(xp, tcr);1005 return handle_alloc_trap(xp, tcr); 1013 1006 } else if ((xnum == SIGSEGV) || 1014 1007 (xnum == SIGBUS)) { 1015 status =handle_protection_violation(xp, info, tcr, old_valence);1008 return handle_protection_violation(xp, info, tcr, old_valence); 1016 1009 } else if (xnum == SIGFPE) { 1017 status =handle_sigfpe(xp, tcr);1010 return handle_sigfpe(xp, tcr); 1018 1011 } else if ((xnum == SIGILL)) { 1019 1012 if (IS_GC_TRAP(instruction)) { 1020 status =handle_gc_trap(xp, tcr);1013 return handle_gc_trap(xp, tcr); 1021 1014 } else if (IS_UUO(instruction)) { 1022 status =handle_uuo(xp, instruction);1015 return handle_uuo(xp, instruction); 1023 1016 } else { 1024 status =handle_unimplemented_instruction(xp,instruction,tcr);1017 return handle_unimplemented_instruction(xp,instruction,tcr); 1025 1018 } 1026 1019 } else if (xnum == SIGNAL_FOR_PROCESS_INTERRUPT) { 1027 1020 tcr->interrupt_pending = 0; 1028 1021 callback_for_trap(nrs_CMAIN.vcell, xp, xnum, 0); 1029 status = 0;1030 } 1031 1032 return status;1022 return true; 1023 } 1024 1025 return false; 1033 1026 } 1034 1027 … … 1053 1046 } 1054 1047 1055 OSStatus 1048 Boolean 1056 1049 handle_uuo(ExceptionInformation *xp, opcode the_uuo) 1057 1050 { 1058 1051 unsigned 1059 1052 format = UUO_FORMAT(the_uuo); 1060 OSStatus status = -1;1053 Boolean handled = false; 1061 1054 int bump = 4; 1062 1055 TCR *tcr = get_tcr(true); … … 1068 1061 int service = UUO_UNARY_field(the_uuo); 1069 1062 1070 status = 0;1071 1063 switch (service) { 1072 1064 case error_propagate_suspend: 1065 handled = true; 1073 1066 break; 1074 1067 case error_interrupt: 1075 1068 xpGPR(xp,imm0) = (LispObj) raise_thread_interrupt(target); 1069 handled = true; 1076 1070 break; 1077 1071 case error_suspend: 1078 1072 xpGPR(xp,imm0) = (LispObj) lisp_suspend_tcr(target); 1073 handled = true; 1079 1074 break; 1080 1075 case error_suspend_all: 1081 1076 lisp_suspend_other_threads(); 1077 handled = true; 1082 1078 break; 1083 1079 case error_resume: 1084 1080 xpGPR(xp,imm0) = (LispObj) lisp_resume_tcr(target); 1081 handled = true; 1085 1082 break; 1086 1083 case error_resume_all: 1087 1084 lisp_resume_other_threads(); 1085 handled = true; 1088 1086 break; 1089 1087 case error_kill: 1090 1088 xpGPR(xp,imm0) = (LispObj)kill_tcr(target); 1089 handled = true; 1091 1090 break; 1092 1091 case error_allocate_list: 1093 1092 allocate_list(xp,tcr); 1093 handled = true; 1094 1094 break; 1095 1095 default: 1096 status = -1;1096 handled = false; 1097 1097 break; 1098 1098 } … … 1103 1103 case 3: 1104 1104 if (extend_tcr_tlb(tcr,xp,UUOA_field(the_uuo))) { 1105 status = 0;1105 handled = true; 1106 1106 bump = 4; 1107 1107 break; … … 1109 1109 /* fall in */ 1110 1110 default: 1111 status = -1;1111 handled = false; 1112 1112 break; 1113 1113 … … 1120 1120 tcr->interrupt_pending = 0; 1121 1121 callback_for_trap(nrs_CMAIN.vcell, xp, SIGNAL_FOR_PROCESS_INTERRUPT, 0); 1122 handled = true; 1123 break; 1124 default: 1125 handled = false; 1122 1126 break; 1123 1127 } … … 1129 1133 case uuo_format_unary_error: 1130 1134 case uuo_format_binary_error: 1131 bump = handle_error(xp,0,the_uuo); 1132 if (bump >= 0) { 1133 status = 0; 1134 } 1135 handled = handle_error(xp,0,the_uuo); 1135 1136 break; 1136 1137 1137 1138 default: 1138 status = -1;1139 handled = false; 1139 1140 bump = 0; 1140 1141 } 1141 1142 1142 if ( (!status)&& bump) {1143 if (handled && bump) { 1143 1144 adjust_exception_pc(xp, bump); 1144 1145 } 1145 return status;1146 return handled; 1146 1147 } 1147 1148 … … 1249 1250 } 1250 1251 1251 /* The main opcode. */ 1252 1253 1254 int 1252 1253 1254 Boolean 1255 1255 handle_error(ExceptionInformation *xp, unsigned arg1, unsigned arg2) 1256 1256 { … … 1263 1263 } 1264 1264 1265 return (-1);1265 return false; 1266 1266 } 1267 1267 … … 1358 1358 1359 1359 wait_for_exception_lock_in_handler(tcr, context, &xframe_link); 1360 if (( noErr != PMCL_exception_handler(signum, context, tcr, info, old_valence))) {1360 if ((!handle_exception(signum, context, tcr, info, old_valence))) { 1361 1361 char msg[512]; 1362 1362 snprintf(msg, sizeof(msg), "Unhandled exception %d at 0x%lx, context->regs at #x%lx", signum, xpPC(context), (natural)xpGPRvector(context)); … … 1574 1574 old_valence = prepare_to_wait_for_exception_lock(tcr, context); 1575 1575 wait_for_exception_lock_in_handler(tcr, context, &xframe_link); 1576 PMCL_exception_handler(signum, context, tcr, info, old_valence);1576 handle_exception(signum, context, tcr, info, old_valence); 1577 1577 if (disp) { 1578 1578 xpGPR(context,allocptr) -= disp;
Note:
See TracChangeset
for help on using the changeset viewer.
