source: branches/arm/lisp-kernel/arm-asmutils.s @ 13958

Last change on this file since 13958 was 13958, checked in by gb, 9 years ago

Get the kernel to compile/link/run enough to complain about a missing
image on ios.

File size: 3.5 KB
Line 
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)
40C(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))
660:      __(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)
731:      __(clrex)
742:      __(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})
920:      __(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))
1060:      __(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
Note: See TracBrowser for help on using the repository browser.