Changeset 9308
- Timestamp:
- Apr 27, 2008, 11:06:25 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/win64/lisp-kernel/x86-exceptions.c
r9296 r9308 626 626 } 627 627 628 #ifdef WINDOWS629 628 Boolean 630 629 handle_fault(TCR *tcr, ExceptionInformation *xp, siginfo_t *info, int old_valence) 631 630 { 632 }633 634 Boolean635 handle_floating_point_exception(TCR *tcr, ExceptionInformation *xp, siginfo_t *info)636 {637 }638 #else639 Boolean640 handle_fault(TCR *tcr, ExceptionInformation *xp, siginfo_t *info, int old_valence)641 {642 631 #ifdef FREEBSD 643 632 BytePtr addr = (BytePtr) xp->uc_mcontext.mc_addr; 644 633 #else 634 #ifdef WINDOWS 635 BytePtr addr = NULL; /* FIX THIS */ 636 #else 645 637 BytePtr addr = (BytePtr) info->si_addr; 638 #endif 646 639 #endif 647 640 … … 681 674 handle_floating_point_exception(TCR *tcr, ExceptionInformation *xp, siginfo_t *info) 682 675 { 683 int code = info->si_code, rfn = 0, skip;676 int code, skip; 684 677 pc program_counter = (pc)xpPC(xp); 685 LispObj rpc = (LispObj) program_counter, xcf, cmain = nrs_CMAIN.vcell, 686 678 LispObj xcf, cmain = nrs_CMAIN.vcell, 687 679 save_rbp = xpGPR(xp,Irbp), save_vsp = xpGPR(xp,Isp); 688 680 681 #ifdef WINDOWS 682 code = info->ExceptionCode; 683 #else 684 code = info->si_code; 685 #endif 689 686 if ((fulltag_of(cmain) == fulltag_misc) && 690 687 (header_subtag(header_of(cmain)) == subtag_macptr)) { … … 699 696 } 700 697 } 701 #endif 698 702 699 703 700 Boolean … … 968 965 tcr->valence = TCR_STATE_EXCEPTION_WAIT; 969 966 967 #ifdef WINDOWS 968 if (tcr->flags & (1<<TCR_FLAG_BIT_PENDING_SUSPEND)) { 969 CLR_TCR_FLAG(tcr, TCR_FLAG_BIT_PENDING_SUSPEND); 970 SEM_RAISE(tcr->suspend); 971 SEM_WAIT_FOREVER(tcr->resume); 972 } 973 #else 970 974 ALLOW_EXCEPTIONS(context); 975 #endif 971 976 return old_valence; 972 977 } … … 1508 1513 TCR *tcr = get_tcr(false); 1509 1514 DWORD code = exception_pointers->ExceptionRecord->ExceptionCode; 1510 int old_valence = tcr->valence, 1511 signal_number = map_windows_exception_code_to_posix_signal(code); 1515 int old_valence, signal_number; 1512 1516 ExceptionInformation *context = exception_pointers->ContextRecord; 1513 siginfo_t *info = exception_pointers->ExceptionRecord; 1514 xframe_list xframes; 1515 1517 siginfo_t *info = exception_pointers->ExceptionRecord; 1518 xframe_list xframes; 1519 1520 old_valence = prepare_to_wait_for_exception_lock(tcr, context); 1516 1521 wait_for_exception_lock_in_handler(tcr, context, &xframes); 1522 1523 signal_number = map_windows_exception_code_to_posix_signal(code); 1517 1524 1518 1525 if (!handle_exception(signal_number, info, context, tcr, old_valence)) { … … 1544 1551 EXCEPTION_POINTERS *new_ep; 1545 1552 1546 new_context = ((CONTEXT *)(foreign_rsp&~ 2))-1;1553 new_context = ((CONTEXT *)(foreign_rsp&~15))-1; 1547 1554 *new_context = *context; 1548 1555 foreign_rsp = (LispObj)new_context; 1549 new_info = ((siginfo_t *)(foreign_rsp&~ 2))-1;1556 new_info = ((siginfo_t *)(foreign_rsp&~15))-1; 1550 1557 *new_info = *original_ep->ExceptionRecord; 1551 1558 foreign_rsp = (LispObj)new_info; 1552 new_ep = ((EXCEPTION_POINTERS *)(foreign_rsp&~ 2))-1;1559 new_ep = ((EXCEPTION_POINTERS *)(foreign_rsp&~15))-1; 1553 1560 foreign_rsp = (LispObj)new_ep; 1554 1561 new_ep->ContextRecord = new_context; … … 1885 1892 1886 1893 opcode load_allocptr_reg_from_tcr_save_allocptr_instruction[] = 1887 {0x65,0x48,0x8b,0x1c,0x25,0xd8,0x00,0x00,0x00}; 1894 #ifdef WINDOWS 1895 {0x49,0x8b,0x9b,0xd8,0x00,0x00,0x00} 1896 #else 1897 {0x65,0x48,0x8b,0x1c,0x25,0xd8,0x00,0x00,0x00} 1898 #endif 1899 ; 1888 1900 opcode compare_allocptr_reg_to_tcr_save_allocbase_instruction[] = 1889 {0x65,0x48,0x3b,0x1c,0x25,0xe0,0x00,0x00,0x00}; 1901 #ifdef WINDOWS 1902 {0x49,0x3b,0x9b,0xe0,0x00,0x00,0x00} 1903 #else 1904 {0x65,0x48,0x3b,0x1c,0x25,0xe0,0x00,0x00,0x00} 1905 #endif 1906 1907 ; 1890 1908 opcode branch_around_alloc_trap_instruction[] = 1891 1909 {0x7f,0x02}; … … 1893 1911 {0xcd,0xc5}; 1894 1912 opcode clear_tcr_save_allocptr_tag_instruction[] = 1895 {0x65,0x80,0x24,0x25,0xd8,0x00,0x00,0x00,0xf0}; 1913 #ifdef WINDOWS 1914 {0x41,0x80,0xa3,0xd8,0x00,0x00,0x00,0xf0} 1915 #else 1916 {0x65,0x80,0x24,0x25,0xd8,0x00,0x00,0x00,0xf0} 1917 #endif 1918 ; 1896 1919 opcode set_allocptr_header_instruction[] = 1897 1920 {0x48,0x89,0x43,0xf3}; … … 1905 1928 case 0x7f: return ID_branch_around_alloc_trap_instruction; 1906 1929 case 0x48: return ID_set_allocptr_header_instruction; 1930 #ifdef WINDOWS 1931 case 0x41: return ID_clear_tcr_save_allocptr_tag_instruction; 1932 case 0x49: 1933 switch(program_counter[1]) { 1934 case 0x8b: return ID_load_allocptr_reg_from_tcr_save_allocptr_instruction; 1935 case 0x3b: return ID_compare_allocptr_reg_to_tcr_save_allocbase_instruction; 1936 } 1937 #else 1907 1938 case 0x65: 1908 1939 switch(program_counter[1]) { … … 1914 1945 } 1915 1946 } 1947 #endif 1948 default: break; 1916 1949 } 1917 1950 return ID_unrecognized_alloc_instruction; 1918 1951 } 1919 1952 1920 #ifdef WINDOWS1921 void1922 pc_luser_xp(ExceptionInformation *xp, TCR *tcr, signed_natural *interrupt_displacement)1923 {1924 }1925 #else1926 1953 void 1927 1954 pc_luser_xp(ExceptionInformation *xp, TCR *tcr, signed_natural *interrupt_displacement) … … 1981 2008 attempt. */ 1982 2009 { 1983 int flags = (int) xpGPR(xp,Iflags);2010 int flags = (int)eflags_register(xp); 1984 2011 1985 2012 if ((!(flags & (1 << X86_ZERO_FLAG_BIT))) && … … 2023 2050 } 2024 2051 break; 2025 } 2052 default: 2053 break; 2054 } 2055 2056 2026 2057 return; 2027 2058 } … … 2035 2066 if ((program_counter < &egc_store_node_conditional_success_test) || 2036 2067 ((program_counter == &egc_store_node_conditional_success_test) && 2037 !( xpGPR(xp, Iflags) & (1 << X86_ZERO_FLAG_BIT)))) {2068 !(eflags_register(xp) & (1 << X86_ZERO_FLAG_BIT)))) { 2038 2069 /* Back up the PC, try again */ 2039 2070 xpPC(xp) = (LispObj) &egc_store_node_conditional; … … 2086 2117 } 2087 2118 } 2088 #endif 2119 2089 2120 2090 2121 void
Note: See TracChangeset
for help on using the changeset viewer.