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

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

arm-asmutils.s: Actually implement atomic_ior and atomic_and, so that
calling them doesn't call whatever follows them in memory.
arm-exceptions.h: Don't mask the field that contains a constant's rotate
count in the definition of IS_SUB_FROM_ALLOCPTR.
l0-bignum32: don't reference *TRUNCATE-X* or *TRUNCATE-Y*; we're not
recycling preallocated bignums as the SPICE Lisp/CMUCL code did, and
using special variables to pass parameters around just makes the code
harder to understand.
arm-float.lisp: MAKE-BIG-53 is storing into a bignum, not a double-float.

File size: 3.3 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        __(blr)
120_endfn
121       
122_exportfn(C(disable_fp_exceptions))
123        __(.long 0)
124        __(blr)
125_endfn
126
127_exportfn(C(pseudo_sigreturn))
128        __(.long 0)
129        __(b C(pseudo_sigreturn))
130_endfn
131        __endif
132       
133_exportfn(save_fp_context)
134_endfn         
135_exportfn(restore_fp_context)
136_endfn         
137_exportfn(put_vector_registers)
138_endfn         
139_exportfn(get_vector_registers)
140_endfn         
141
142       
143
144        _endfile
Note: See TracBrowser for help on using the repository browser.