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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [scsi/] [oktagon_io.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* -*- mode: asm -*-
2
 * Due to problems while transferring data I've put these routines as assembly
3
 * code.
4
 * Since I'm no PPC assembler guru, the code is just the assembler version of
5
 
6
int oktag_to_io(long *paddr,long *addr,long len)
7
{
8
  long *addr2 = addr;
9
  for(len=(len+sizeof(long)-1)/sizeof(long);len--;)
10
    *paddr = *addr2++;
11
  return addr2 - addr;
12
}
13
 
14
int oktag_from_io(long *addr,long *paddr,long len)
15
{
16
  long *addr2 = addr;
17
  for(len=(len+sizeof(long)-1)/sizeof(long);len--;)
18
    *addr2++ = *paddr;
19
  return addr2 - addr;
20
}
21
 
22
 * assembled using gcc -O2 -S, with two exception catch points where data
23
 * is moved to/from the IO register.
24
 */
25
 
26
#include 
27
 
28
#ifdef CONFIG_APUS
29
 
30
        .file   "oktagon_io.c"
31
 
32
gcc2_compiled.:
33
/*
34
        .section ".text"
35
*/
36
        .align 2
37
        .globl oktag_to_io
38
        .type    oktag_to_io,@function
39
oktag_to_io:
40
        addi 5,5,3
41
        srwi 5,5,2
42
        cmpwi 1,5,0
43
        mr 9,3
44
        mr 3,4
45
        addi 5,5,-1
46
        bc 12,6,.L3
47
.L5:
48
        cmpwi 1,5,0
49
        lwz 0,0(3)
50
        addi 3,3,4
51
        addi 5,5,-1
52
exp1:   stw 0,0(9)
53
        bc 4,6,.L5
54
.L3:
55
ret1:   subf 3,4,3
56
        srawi 3,3,2
57
        blr
58
.Lfe1:
59
        .size    oktag_to_io,.Lfe1-oktag_to_io
60
        .align 2
61
        .globl oktag_from_io
62
        .type    oktag_from_io,@function
63
oktag_from_io:
64
        addi 5,5,3
65
        srwi 5,5,2
66
        cmpwi 1,5,0
67
        mr 9,3
68
        addi 5,5,-1
69
        bc 12,6,.L9
70
.L11:
71
        cmpwi 1,5,0
72
exp2:   lwz 0,0(4)
73
        addi 5,5,-1
74
        stw 0,0(3)
75
        addi 3,3,4
76
        bc 4,6,.L11
77
.L9:
78
ret2:   subf 3,9,3
79
        srawi 3,3,2
80
        blr
81
.Lfe2:
82
        .size    oktag_from_io,.Lfe2-oktag_from_io
83
        .ident  "GCC: (GNU) egcs-2.90.29 980515 (egcs-1.0.3 release)"
84
 
85
/*
86
 * Exception table.
87
 * Second longword shows where to jump when an exception at the addr the first
88
 * longword is pointing to is caught.
89
 */
90
 
91
.section __ex_table,"a"
92
        .align  2
93
oktagon_except:
94
        .long   exp1,ret1
95
        .long   exp2,ret2
96
 
97
#else
98
 
99
/*
100
The code which follows is for 680x0 based assembler and is meant for
101
Linux/m68k. It was created by cross compiling the code using the
102
instructions given above. I then added the four labels used in the
103
exception handler table at the bottom of this file.
104
- Kevin 
105
*/
106
 
107
#ifdef CONFIG_AMIGA
108
 
109
        .file   "oktagon_io.c"
110
        .version        "01.01"
111
gcc2_compiled.:
112
.text
113
        .align  2
114
.globl oktag_to_io
115
        .type    oktag_to_io,@function
116
oktag_to_io:
117
        link.w %a6,#0
118
        move.l %d2,-(%sp)
119
        move.l 8(%a6),%a1
120
        move.l 12(%a6),%d1
121
        move.l %d1,%a0
122
        move.l 16(%a6),%d0
123
        addq.l #3,%d0
124
        lsr.l #2,%d0
125
        subq.l #1,%d0
126
        moveq.l #-1,%d2
127
        cmp.l %d0,%d2
128
        jbeq .L3
129
.L5:
130
exp1:
131
        move.l (%a0)+,(%a1)
132
        dbra %d0,.L5
133
        clr.w %d0
134
        subq.l #1,%d0
135
        jbcc .L5
136
.L3:
137
ret1:
138
        move.l %a0,%d0
139
        sub.l %d1,%d0
140
        asr.l #2,%d0
141
        move.l -4(%a6),%d2
142
        unlk %a6
143
        rts
144
 
145
.Lfe1:
146
        .size    oktag_to_io,.Lfe1-oktag_to_io
147
        .align  2
148
.globl oktag_from_io
149
        .type    oktag_from_io,@function
150
oktag_from_io:
151
        link.w %a6,#0
152
        move.l %d2,-(%sp)
153
        move.l 8(%a6),%d1
154
        move.l 12(%a6),%a1
155
        move.l %d1,%a0
156
        move.l 16(%a6),%d0
157
        addq.l #3,%d0
158
        lsr.l #2,%d0
159
        subq.l #1,%d0
160
        moveq.l #-1,%d2
161
        cmp.l %d0,%d2
162
        jbeq .L9
163
.L11:
164
exp2:
165
        move.l (%a1),(%a0)+
166
        dbra %d0,.L11
167
        clr.w %d0
168
        subq.l #1,%d0
169
        jbcc .L11
170
.L9:
171
ret2:
172
        move.l %a0,%d0
173
        sub.l %d1,%d0
174
        asr.l #2,%d0
175
        move.l -4(%a6),%d2
176
        unlk %a6
177
        rts
178
.Lfe2:
179
        .size    oktag_from_io,.Lfe2-oktag_from_io
180
        .ident  "GCC: (GNU) 2.7.2.1"
181
 
182
/*
183
 * Exception table.
184
 * Second longword shows where to jump when an exception at the addr the first
185
 * longword is pointing to is caught.
186
 */
187
 
188
.section __ex_table,"a"
189
        .align  2
190
oktagon_except:
191
        .long   exp1,ret1
192
        .long   exp2,ret2
193
 
194
#endif
195
#endif

powered by: WebSVN 2.1.0

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