Changeset 13958
- Timestamp:
- Jul 13, 2010, 5:58:35 AM (9 years ago)
- Location:
- branches/arm/lisp-kernel
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/arm/lisp-kernel/arm-asmutils.s
r13941 r13958 117 117 _exportfn(C(enable_fp_exceptions)) 118 118 __(.long 0) 119 __(b lr)119 __(bx lr) 120 120 _endfn 121 121 122 122 _exportfn(C(disable_fp_exceptions)) 123 123 __(.long 0) 124 __(b lr)124 __(bx lr) 125 125 _endfn 126 126 … … 131 131 __endif 132 132 133 _exportfn(save_fp_context) 133 _exportfn(C(save_fp_context)) 134 __(uuo_debug_trap(al)) 134 135 _endfn 135 _exportfn(restore_fp_context) 136 _exportfn(C(restore_fp_context)) 137 __(uuo_debug_trap(al)) 136 138 _endfn 137 _exportfn(put_vector_registers) 139 _exportfn(C(put_vector_registers)) 140 __(uuo_debug_trap(al)) 138 141 _endfn 139 _exportfn(get_vector_registers) 142 _exportfn(C(get_vector_registers)) 143 __(uuo_debug_trap(al)) 140 144 _endfn 141 145 146 __ifdef(`DARWIN') 147 _exportfn(C(__aeabi_uldivmod)) 148 __(bx lr) 149 _endfn 150 __endif 142 151 143 144 152 _endfile -
branches/arm/lisp-kernel/arm-exceptions.c
r13924 r13958 1848 1848 { 1849 1849 kern_return_t kret; 1850 MCONTEXT_Tmc = UC_MCONTEXT(pseudosigcontext);1850 _STRUCT_MCONTEXT *mc = UC_MCONTEXT(pseudosigcontext); 1851 1851 1852 1852 /* Set the thread's FP state from the pseudosigcontext */ 1853 1853 kret = thread_set_state(thread, 1854 ARM_ FLOAT_STATE,1854 ARM_VFP_STATE, 1855 1855 (thread_state_t)&(mc->__fs), 1856 ARM_ FLOAT_STATE_COUNT);1856 ARM_VFP_STATE_COUNT); 1857 1857 1858 1858 MACH_CHECK_ERROR("setting thread FP state", kret); … … 1907 1907 kern_return_t result; 1908 1908 ExceptionInformation *pseudosigcontext; 1909 MCONTEXT_Tmc;1909 _STRUCT_MCONTEXT *mc; 1910 1910 natural stackp, backlink; 1911 1911 … … 1920 1920 Bug(NULL, "Exception thread can't obtain thread state, Mach result = %d", result); 1921 1921 } 1922 stackp = ts.__ r1;1922 stackp = ts.__sp; 1923 1923 backlink = stackp; 1924 stackp = TRUNC_DOWN(stackp, C_REDZONE_LEN, C_STK_ALIGN); 1924 1925 1925 stackp -= sizeof(*pseudosigcontext); 1926 1926 pseudosigcontext = (ExceptionInformation *) ptr_from_lispobj(stackp); 1927 1927 1928 stackp = TRUNC_DOWN(stackp, sizeof(*mc), C_STK_ALIGN); 1929 mc = (MCONTEXT_T) ptr_from_lispobj(stackp); 1928 mc = (_STRUCT_MCONTEXT *) ptr_from_lispobj(stackp); 1930 1929 memmove(&(mc->__ss),&ts,sizeof(ts)); 1931 1930 1932 thread_state_count = PPC_FLOAT_STATE_COUNT;1931 thread_state_count = ARM_VFP_STATE_COUNT; 1933 1932 thread_get_state(thread, 1934 PPC_FLOAT_STATE,1933 ARM_VFP_STATE, 1935 1934 (thread_state_t)&(mc->__fs), 1936 1935 &thread_state_count); 1937 1936 1938 1937 1939 #ifdef PPC64 1940 thread_state_count = PPC_EXCEPTION_STATE64_COUNT; 1941 #else 1942 thread_state_count = PPC_EXCEPTION_STATE_COUNT; 1943 #endif 1938 thread_state_count = ARM_EXCEPTION_STATE_COUNT; 1944 1939 thread_get_state(thread, 1945 #ifdef PPC64 1946 PPC_EXCEPTION_STATE64, 1947 #else 1948 PPC_EXCEPTION_STATE, 1949 #endif 1940 ARM_EXCEPTION_STATE, 1950 1941 (thread_state_t)&(mc->__es), 1951 1942 &thread_state_count); … … 1953 1944 1954 1945 UC_MCONTEXT(pseudosigcontext) = mc; 1955 stackp = TRUNC_DOWN(stackp, C_PARAMSAVE_LEN, C_STK_ALIGN);1956 stackp -= C_LINKAGE_LEN;1957 *(natural *)ptr_from_lispobj(stackp) = backlink;1958 1946 if (new_stack_top) { 1959 1947 *new_stack_top = stackp; … … 1986 1974 TCR *tcr) 1987 1975 { 1988 #ifdef PPC64 1989 ppc_thread_state64_t ts; 1990 #else 1991 ppc_thread_state_t ts; 1992 #endif 1976 arm_thread_state_t ts; 1993 1977 ExceptionInformation *pseudosigcontext; 1994 1978 int old_valence = tcr->valence; … … 2011 1995 */ 2012 1996 2013 ts.__srr0 = (natural) handler_address; 2014 ts.__srr1 = (int) xpMSR(pseudosigcontext) & ~MSR_FE0_FE1_MASK; 2015 ts.__r1 = stackp; 2016 ts.__r3 = signum; 2017 ts.__r4 = (natural)pseudosigcontext; 2018 ts.__r5 = (natural)tcr; 2019 ts.__r6 = (natural)old_valence; 1997 ts.__pc = (natural) handler_address; 1998 ts.__sp = stackp; 1999 ts.__r[0] = signum; 2000 ts.__r[1] = (natural)pseudosigcontext; 2001 ts.__r[2] = (natural)tcr; 2002 ts.__r[3] = (natural)old_valence; 2020 2003 ts.__lr = (natural)pseudo_sigreturn; 2021 2004 2022 2005 2023 #ifdef PPC642024 ts.__r13 = xpGPR(pseudosigcontext,13);2025 thread_set_state(thread,2026 PPC_THREAD_STATE64,2027 (thread_state_t)&ts,2028 PPC_THREAD_STATE64_COUNT);2029 #else2030 2006 thread_set_state(thread, 2031 2007 MACHINE_THREAD_STATE, 2032 2008 (thread_state_t)&ts, 2033 2009 MACHINE_THREAD_STATE_COUNT); 2034 #endif2035 2010 #ifdef DEBUG_MACH_EXCEPTIONS 2036 2011 fprintf(dbgout,"Set up exception context for 0x%x at 0x%x\n", tcr, tcr->pending_exception_context); … … 2043 2018 pseudo_signal_handler(int signum, ExceptionInformation *context, TCR *tcr, int old_valence) 2044 2019 { 2045 signal_handler(signum, NULL, context, tcr, old_valence );2020 signal_handler(signum, NULL, context, tcr, old_valence, 0); 2046 2021 } 2047 2022 … … 2050 2025 thread_set_fp_exceptions_enabled(mach_port_t thread, Boolean enabled) 2051 2026 { 2052 #ifdef PPC64 2053 ppc_thread_state64_t ts; 2054 #else 2055 ppc_thread_state_t ts; 2056 #endif 2057 mach_msg_type_number_t thread_state_count; 2058 2059 #ifdef PPC64 2060 thread_state_count = PPC_THREAD_STATE64_COUNT; 2061 #else 2062 thread_state_count = PPC_THREAD_STATE_COUNT; 2063 #endif 2064 thread_get_state(thread, 2065 #ifdef PPC64 2066 PPC_THREAD_STATE64, /* GPRs, some SPRs */ 2067 #else 2068 PPC_THREAD_STATE, /* GPRs, some SPRs */ 2069 #endif 2070 (thread_state_t)&ts, 2071 &thread_state_count); 2072 if (enabled) { 2073 ts.__srr1 |= MSR_FE0_FE1_MASK; 2074 } else { 2075 ts.__srr1 &= ~MSR_FE0_FE1_MASK; 2076 } 2077 /* 2078 Hack-o-rama warning (isn't it about time for such a warning?): 2079 pthread_kill() seems to want to lose the MSR's FE0/FE1 bits. 2080 Our handler for lisp's use of pthread_kill() pushes a phony 2081 lisp frame on the stack and force the context to resume at 2082 the UUO in enable_fp_exceptions(); the "saveLR" field of that 2083 lisp frame contains the -real- address that process_interrupt 2084 should have returned to, and the fact that it's in a lisp 2085 frame should convince the GC to notice that address if it 2086 runs in the tiny time window between returning from our 2087 interrupt handler and ... here. 2088 If the top frame on the stack is a lisp frame, discard it 2089 and set ts.srr0 to the saveLR field in that frame. Otherwise, 2090 just adjust ts.srr0 to skip over the UUO. 2091 */ 2092 { 2093 lisp_frame *tos = (lisp_frame *)ts.__r1, 2094 *next_frame = tos->backlink; 2095 2096 if (tos == (next_frame -1)) { 2097 ts.__srr0 = tos->savelr; 2098 ts.__r1 = (LispObj) next_frame; 2099 } else { 2100 ts.__srr0 += 4; 2101 } 2102 } 2103 thread_set_state(thread, 2104 #ifdef PPC64 2105 PPC_THREAD_STATE64, /* GPRs, some SPRs */ 2106 #else 2107 PPC_THREAD_STATE, /* GPRs, some SPRs */ 2108 #endif 2109 (thread_state_t)&ts, 2110 #ifdef PPC64 2111 PPC_THREAD_STATE64_COUNT 2112 #else 2113 PPC_THREAD_STATE_COUNT 2114 #endif 2115 ); 2116 2027 /* Likely hopeless. */ 2117 2028 return 0; 2118 2029 } … … 2156 2067 } 2157 2068 if ((exception == EXC_BAD_INSTRUCTION) && 2158 (code_vector[0] == EXC_PPC_UNIPL_INST) && 2159 (((code1 = code_vector[1]) == (int)pseudo_sigreturn) || 2160 (code1 == (int)enable_fp_exceptions) || 2161 (code1 == (int)disable_fp_exceptions))) { 2162 if (code1 == (int)pseudo_sigreturn) { 2163 kret = do_pseudo_sigreturn(thread, tcr); 2164 #if 0 2165 fprintf(dbgout, "Exception return in 0x%x\n",tcr); 2166 #endif 2167 2168 } else if (code1 == (int)enable_fp_exceptions) { 2169 kret = thread_set_fp_exceptions_enabled(thread, true); 2170 } else kret = thread_set_fp_exceptions_enabled(thread, false); 2069 (code_vector[0] == EXC_ARM_UNDEFINED) && 2070 (((code1 = code_vector[1]) == (int)pseudo_sigreturn))) { 2071 kret = do_pseudo_sigreturn(thread, tcr); 2171 2072 } else if (tcr->flags & (1<<TCR_FLAG_BIT_PROPAGATE_EXCEPTION)) { 2172 2073 CLR_TCR_FLAG(tcr,TCR_FLAG_BIT_PROPAGATE_EXCEPTION); … … 2182 2083 break; 2183 2084 2184 case EXC_SOFTWARE:2185 if (code == EXC_PPC_TRAP) {2186 signum = SIGTRAP;2187 }2188 2085 break; 2189 2086 -
branches/arm/lisp-kernel/arm-spentry.s
r13921 r13958 3936 3936 _endfn 3937 3937 3938 _exportfn( nthrownv)3938 _exportfn(C(nthrownv)) 3939 3939 new_local_labels() 3940 3940 local_label(nthrownv_nextframe): -
branches/arm/lisp-kernel/darwinarm/Makefile
r13923 r13958 19 19 AS = /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/arm/as 20 20 M4 = m4 21 ASFLAGS = -arch arm -force_cpusubtype_ALL21 ASFLAGS = -arch armv6 22 22 M4FLAGS = -DDARWIN -DARM 23 CDEFINES = -DDARWIN -DARM -D_REENTRANT -D_GNU_SOURCE -DDISABLE_EGC -DGC_INTEGRITY_CHECKING 23 CC = /Developer/Platforms/iPhoneOS.platform/usr/bin/llvm-gcc-4.2 24 CDEFINES = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/ -DDARWIN -DARM -D_REENTRANT -D_GNU_SOURCE -DDISABLE_EGC -DGC_INTEGRITY_CHECKING -arch armv6 24 25 CDEBUG = -g 25 26 COPT = #-O2 … … 29 30 PLATFORM_H = platform-darwinarm.h 30 31 31 # If the linker supports a "--hash-style=" option, use traditional32 # Sysv hash tables. (If it doesn't support that option, assume33 # that traditional hash tables will be used by default.)34 ld_has_hash_style = $(shell $(LD) --help | grep "hash-style=")35 ifeq ($(ld_has_hash_style),)36 HASH_STYLE=37 else38 HASH_STYLE="-Wl,--hash-style=sysv"39 endif40 32 41 42 # Likewise, some versions of GAS may need a "-a32" flag, to force the43 # output file to be 32-bit compatible.44 45 A32 = $(shell ($(AS) --help -v 2>&1 | grep -q -e "-a32") && /bin/echo "-a32")46 33 47 34 .s.o: 48 35 $(M4) $(M4FLAGS) -I../ $< | $(AS) $(A32) $(ASFLAGS) -o $@ 49 36 .c.o: 50 $(CC) - include ../$(PLATFORM_H) -c $< $(CDEFINES) $(CDEBUG) $(COPT) -marm $(WFORMAT) -o $@37 $(CC) -arch arm -include ../$(PLATFORM_H) -c $< $(CDEFINES) $(CDEBUG) $(COPT) -marm $(WFORMAT) -o $@ 51 38 52 SPOBJ = pad.oarm-spentry.o arm-subprims.o39 SPOBJ = arm-spentry.o arm-subprims.o 53 40 ASMOBJ = arm-asmutils.o imports.o 54 41 … … 65 52 Threads.h arm-exceptions.h $(PLATFORM_H) 66 53 67 # Subprims linked into the kernel ?68 # Yes:69 54 70 55 KSPOBJ = $(SPOBJ) 71 all: ../../armcl 56 all: ../../darmcl 57 58 OSLIBS = /Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/v6/libgcc.a -lSystem /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/usr/lib/crt1.o /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.3/Symbols/usr/lib/libgcc_s.1.dylib 72 59 73 60 74 # No: 75 76 # KSPOBJ= 77 # all: ../../ppccl ../../subprims.so 78 79 OSLIBS = -ldl -lm -lpthread 80 81 82 ../../armcl: $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) 83 $(CC) $(CDEBUG) -Wl,--export-dynamic $(HASH_STYLE) -o $@ -T ./armdarwin.x $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) $(OSLIBS) 61 ../../darmcl: $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) 62 $(LD) -pagezero_size 0x8000 $(KSPOBJ) -L/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.3/Symbols/usr/lib -arch armv6 -o $@ $(KERNELOBJ) $(DEBUGOBJ) $(OSLIBS) 84 63 85 64 … … 91 70 92 71 cclean: 93 $(RM) -f $(KERNELOBJ) $(DEBUGOBJ) ../../ ppccl72 $(RM) -f $(KERNELOBJ) $(DEBUGOBJ) ../../darmcl 94 73 95 74 clean: cclean 96 75 $(RM) -f $(SPOBJ) 97 76 98 strip: ../../ ppccl99 strip -g ../../ ppccl77 strip: ../../darmcl 78 strip -g ../../darmcl
Note: See TracChangeset
for help on using the changeset viewer.