1 | /* Copyright (C) 2009 Clozure Associates */ |
---|
2 | /* Copyright (C) 1994-2001 Digitool, Inc */ |
---|
3 | /* This file is part of Clozure CL. */ |
---|
4 | |
---|
5 | /* Clozure CL is licensed under the terms of the Lisp Lesser GNU Public */ |
---|
6 | /* License , known as the LLGPL and distributed with Clozure CL as the */ |
---|
7 | /* file "LICENSE". The LLGPL consists of a preamble and the LGPL, */ |
---|
8 | /* which is distributed with Clozure CL as the file "LGPL". Where these */ |
---|
9 | /* conflict, the preamble takes precedence. */ |
---|
10 | |
---|
11 | /* Clozure CL is referenced in the preamble as the "LIBRARY." */ |
---|
12 | |
---|
13 | /* The LLGPL is also available online at */ |
---|
14 | /* http://opensource.franz.com/preamble.html */ |
---|
15 | |
---|
16 | |
---|
17 | .syntax unified |
---|
18 | .arm |
---|
19 | |
---|
20 | include(lisp.s) |
---|
21 | |
---|
22 | _beginfile |
---|
23 | |
---|
24 | /* Force data from r0 to r1 into the icache */ |
---|
25 | _exportfn(C(flush_cache_lines)) |
---|
26 | __(mov r2,#0) /* options. Pass as 0 until we know better */ |
---|
27 | __(mov r12,r7) /* preserve r7 ; r12 saved by syscall */ |
---|
28 | __(mov r7,#0x0f0000) /* __ARM_NR_cacheflush */ |
---|
29 | __(add r7,r7,#2) |
---|
30 | __(svc #0) |
---|
31 | __(mov r7,r12) |
---|
32 | __(bx lr) |
---|
33 | |
---|
34 | _exportfn(C(touch_page)) |
---|
35 | __(str r0,[r0,#0]) |
---|
36 | __(mov r1,#0) |
---|
37 | __(str r1,[r0,#0]) |
---|
38 | __(mov r0,#1) |
---|
39 | .globl C(touch_page_end) |
---|
40 | C(touch_page_end): |
---|
41 | __(bx lr) |
---|
42 | _endfn |
---|
43 | |
---|
44 | _exportfn(C(current_stack_pointer)) |
---|
45 | __(mov r0,sp) |
---|
46 | __(bx lr) |
---|
47 | _endfn |
---|
48 | |
---|
49 | _exportfn(C(count_leading_zeros)) |
---|
50 | __(clz r0,r0) |
---|
51 | __(bx lr) |
---|
52 | _endfn |
---|
53 | |
---|
54 | _exportfn(C(noop)) |
---|
55 | __(bx lr) |
---|
56 | _endfn |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | /* Atomically store new value (r2) in *r0, if old value == expected (r1). */ |
---|
63 | /* Return actual old value. */ |
---|
64 | |
---|
65 | _exportfn(C(store_conditional)) |
---|
66 | 0: __(ldrex r3,[r0]) |
---|
67 | __(cmp r3,r1) |
---|
68 | __(bne 1f) |
---|
69 | __(strex ip,r2,[r0]) |
---|
70 | __(cmp ip,#0) |
---|
71 | __(bne 0b) |
---|
72 | __(b 2f) |
---|
73 | 1: __(clrex) |
---|
74 | 2: __(mov r0,r3) |
---|
75 | __(bx lr) |
---|
76 | _endfn |
---|
77 | |
---|
78 | /* Atomically store new_value(r1) in *r0 ; return previous contents */ |
---|
79 | /* of *r0. */ |
---|
80 | |
---|
81 | _exportfn(C(atomic_swap)) |
---|
82 | __(mov r2,r0) |
---|
83 | __(swp r0,r1,[r2]) |
---|
84 | __(bx lr) |
---|
85 | _endfn |
---|
86 | |
---|
87 | /* Logior the value in *r0 with the value in r1 (presumably a bitmask with exactly 1 */ |
---|
88 | /* bit set.) Return non-zero if any of the bits in that bitmask were already set. */ |
---|
89 | |
---|
90 | _exportfn(C(atomic_ior)) |
---|
91 | __(stmdb sp!,{r4,lr}) |
---|
92 | 0: __(ldrex r2,[r0]) |
---|
93 | __(orr r3,r2,r1) |
---|
94 | __(strex r4,r3,[r0]) |
---|
95 | __(cmp r4,#0) |
---|
96 | __(bne 0b) |
---|
97 | __(mov r0,r2) |
---|
98 | __(ldmia sp!,{r4,pc}) |
---|
99 | _endfn |
---|
100 | |
---|
101 | |
---|
102 | /* Logand the value in *r0 with the value in r1 (presumably a bitmask with exactly 1 */ |
---|
103 | /* bit set.) Return the value now in *r0 (for some value of "now" */ |
---|
104 | |
---|
105 | _exportfn(C(atomic_and)) |
---|
106 | 0: __(ldrex r2,[r0]) |
---|
107 | __(and r2,r2,r1) |
---|
108 | __(strex r3,r2,[r0]) |
---|
109 | __(cmp r3,#0) |
---|
110 | __(bne 0b) |
---|
111 | __(mov r0,r2) |
---|
112 | __(bx lr) |
---|
113 | _endfn |
---|
114 | |
---|
115 | |
---|
116 | __ifdef(`DARWIN') |
---|
117 | _exportfn(C(enable_fp_exceptions)) |
---|
118 | __(.long 0) |
---|
119 | __(bx lr) |
---|
120 | _endfn |
---|
121 | |
---|
122 | _exportfn(C(disable_fp_exceptions)) |
---|
123 | __(.long 0) |
---|
124 | __(bx lr) |
---|
125 | _endfn |
---|
126 | |
---|
127 | _exportfn(C(pseudo_sigreturn)) |
---|
128 | __(.long 0) |
---|
129 | __(b C(pseudo_sigreturn)) |
---|
130 | _endfn |
---|
131 | __endif |
---|
132 | |
---|
133 | _exportfn(C(save_fp_context)) |
---|
134 | __(uuo_debug_trap(al)) |
---|
135 | _endfn |
---|
136 | _exportfn(C(restore_fp_context)) |
---|
137 | __(uuo_debug_trap(al)) |
---|
138 | _endfn |
---|
139 | _exportfn(C(put_vector_registers)) |
---|
140 | __(uuo_debug_trap(al)) |
---|
141 | _endfn |
---|
142 | _exportfn(C(get_vector_registers)) |
---|
143 | __(uuo_debug_trap(al)) |
---|
144 | _endfn |
---|
145 | |
---|
146 | __ifdef(`DARWIN') |
---|
147 | _exportfn(C(__aeabi_uldivmod)) |
---|
148 | __(bx lr) |
---|
149 | _endfn |
---|
150 | __endif |
---|
151 | |
---|
152 | _endfile |
---|