OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [sparc64/] [lib/] [bitops.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* $Id: bitops.S,v 1.1.1.1 2004-04-15 01:33:42 phoenix Exp $
2
 * bitops.S: Sparc64 atomic bit operations.
3
 *
4
 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5
 */
6
 
7
#include 
8
 
9
        .text
10
        .align  64
11
        .globl  __bitops_begin
12
__bitops_begin:
13
 
14
        .globl  ___test_and_set_bit
15
___test_and_set_bit:    /* %o0=nr, %o1=addr */
16
        srlx    %o0, 6, %g1
17
        mov     1, %g5
18
        sllx    %g1, 3, %g3
19
        and     %o0, 63, %g2
20
        sllx    %g5, %g2, %g5
21
        add     %o1, %g3, %o1
22
        ldx     [%o1], %g7
23
1:      andcc   %g7, %g5, %o0
24
        bne,pn  %xcc, 2f
25
         xor    %g7, %g5, %g1
26
        casx    [%o1], %g7, %g1
27
        cmp     %g7, %g1
28
        bne,a,pn %xcc, 1b
29
         ldx    [%o1], %g7
30
2:      retl
31
         membar #StoreLoad | #StoreStore
32
 
33
        .globl  ___test_and_clear_bit
34
___test_and_clear_bit:  /* %o0=nr, %o1=addr */
35
        srlx    %o0, 6, %g1
36
        mov     1, %g5
37
        sllx    %g1, 3, %g3
38
        and     %o0, 63, %g2
39
        sllx    %g5, %g2, %g5
40
        add     %o1, %g3, %o1
41
        ldx     [%o1], %g7
42
1:      andcc   %g7, %g5, %o0
43
        be,pn   %xcc, 2f
44
         xor    %g7, %g5, %g1
45
        casx    [%o1], %g7, %g1
46
        cmp     %g7, %g1
47
        bne,a,pn %xcc, 1b
48
         ldx    [%o1], %g7
49
2:      retl
50
         membar #StoreLoad | #StoreStore
51
 
52
        .globl  ___test_and_change_bit
53
___test_and_change_bit: /* %o0=nr, %o1=addr */
54
        srlx    %o0, 6, %g1
55
        mov     1, %g5
56
        sllx    %g1, 3, %g3
57
        and     %o0, 63, %g2
58
        sllx    %g5, %g2, %g5
59
        add     %o1, %g3, %o1
60
        ldx     [%o1], %g7
61
1:      and     %g7, %g5, %o0
62
        xor     %g7, %g5, %g1
63
        casx    [%o1], %g7, %g1
64
        cmp     %g7, %g1
65
        bne,a,pn %xcc, 1b
66
         ldx    [%o1], %g7
67
2:      retl
68
         membar #StoreLoad | #StoreStore
69
        nop
70
 
71
        .globl  ___test_and_set_le_bit
72
___test_and_set_le_bit: /* %o0=nr, %o1=addr */
73
        srlx    %o0, 5, %g1
74
        mov     1, %g5
75
        sllx    %g1, 2, %g3
76
        and     %o0, 31, %g2
77
        sllx    %g5, %g2, %g5
78
        add     %o1, %g3, %o1
79
        lduwa   [%o1] ASI_PL, %g7
80
1:      andcc   %g7, %g5, %o0
81
        bne,pn  %icc, 2f
82
         xor    %g7, %g5, %g1
83
        casa    [%o1] ASI_PL, %g7, %g1
84
        cmp     %g7, %g1
85
        bne,a,pn %icc, 1b
86
         lduwa  [%o1] ASI_PL, %g7
87
2:      retl
88
         membar #StoreLoad | #StoreStore
89
 
90
        .globl  ___test_and_clear_le_bit
91
___test_and_clear_le_bit:       /* %o0=nr, %o1=addr */
92
        srlx    %o0, 5, %g1
93
        mov     1, %g5
94
        sllx    %g1, 2, %g3
95
        and     %o0, 31, %g2
96
        sllx    %g5, %g2, %g5
97
        add     %o1, %g3, %o1
98
        lduwa   [%o1] ASI_PL, %g7
99
1:      andcc   %g7, %g5, %o0
100
        be,pn   %icc, 2f
101
         xor    %g7, %g5, %g1
102
        casa    [%o1] ASI_PL, %g7, %g1
103
        cmp     %g7, %g1
104
        bne,a,pn %icc, 1b
105
         lduwa  [%o1] ASI_PL, %g7
106
2:      retl
107
         membar #StoreLoad | #StoreStore
108
 
109
        .globl  __bitops_end
110
__bitops_end:

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.