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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [i960/] [kernel/] [entry.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 *
3
 *  linux/arch/m68knommu/kernel/entry.S
4
 *
5
 *  Copyright (C) 1999  Keith Adams ,
6
 *                      Oregon Graduate Institute
7
 *
8
 */
9
 
10
/*
11
 * syscall, interrupt, and fault entry points
12
 */
13
 
14
#include 
15
#include 
16
#define ALL_ONES 0xffffffff
17
 
18
#include 
19
#include 
20
#include 
21
#include 
22
#include 
23
#ifdef CONFIG_I960VH
24
#include 
25
#endif
26
 
27
 
28
        .globl  SYMBOL_NAME(atmod)
29
SYMBOL_NAME_LABEL(atmod)
30
        atmod   g0, g1, g2
31
        mov     g2, g0
32
        ret
33
 
34
/*
35
 * The birthplace of kernel threads. Once here, we find the function to call
36
 * in register r3, and its argument in r4. See kernel_thread in asm/unistd.h
37
 * for why this exists.
38
 */
39
        .globl  SYMBOL_NAME(kthread_trampoline)
40
SYMBOL_NAME_LABEL(kthread_trampoline)
41
        mov     r3, g0
42
        mov     r4, g1
43
        call    SYMBOL_NAME(kthread_start)
44
        ldconst 0, g0
45
        b       SYMBOL_NAME(do_exit)
46
/* no ret */
47
 
48
/*
49
 * signal handlers start here in signal_head.
50
 */
51
        .globl  SYMBOL_NAME(signal_head)
52
SYMBOL_NAME_LABEL(signal_head)
53
        mov     g0, r5
54
        mov     r4, g0
55
        callx   (r3)
56
        mov     r5, g0
57
        ret
58
 
59
#define USER_AC 0x3b001000
60
#define USER_PC 0x00002000      /* bit 13 set: interrupted mode */
61
#define KSP_OFFSET      0x58
62
 
63
#if 0
64
#define CKPT(x,y)       \
65
        ldconst x, g0;  \
66
        mov     y, g1;  \
67
        call    SYMBOL_NAME(ckpt);
68
#endif
69
 
70
        /* XXX: todo: emulate an interrupt: put PC and AC on stack */
71
/*
72
 * This is branched to by intr and syscall; it switches to the kernel stack,
73
 * and returns to the ip in r6. The choice of registers lets us economize
74
 * on store operations.
75
 *
76
 * Be sure to branch here, rather than call; we can't use a single frame of
77
 * the shared intr/syscall stacks.
78
 *
79
 * Observe weird register conventions (because we can't alter g* regs):
80
 *      ip after switch:                r6
81
 *      r3 in new stack:                r7 (for intr/fault)
82
 *      PC to be seen in new stack:     r8
83
 */
84
        .align  4
85
switch_to_kstack:
86
        ld      SYMBOL_NAME(current_set), r3
87
        ld      KSP_OFFSET(r3), r3
88
        ldconst 64, r5
89
        addo    r3, r5, r3              # get some space on stack (for PC/AC)
90
/*
91
 * r3 now points to the address of the new stack frame. We build an image of
92
 * the new stack frame in regs r4-r7. The intr needs to
93
 * remember its intr vector, so we also put r7 on the stack, in the r3
94
 * position.
95
 */
96
 
97
        mov     pfp, r4                 # newframe->pfp = current pfp
98
        addo    r5, r3, r5              # newframe->sp = newframe + 64
99
                                        # newframe->rip = rip (passed in r6)
100
                                        # newframe->r3 = r7
101
        stq     r4, (r3)
102
 
103
/* Store AC, PC as if in interrupt context */
104
        modac   0, 0, r9
105
        stl     r8, -16(r3)             # current ac, pc passed in r8
106
        flushreg
107
        mov     r3, pfp
108
        flushreg
109
        ret                             # returns to ip from r6
110
 
111
/*
112
 * System calls all end up here.
113
 */
114
        .globl  SYMBOL_NAME(syscall)
115
        .align  4
116
SYMBOL_NAME_LABEL(syscall)
117
        /*
118
         * first, examine pfp; if its 1st and 2nd bits are 1 and 0 respectively,
119
         * we're coming from user mode, so we need to switch stacks.
120
         */
121
 
122
        bbs     2, pfp, 1f      # if bit 2 is set, we're cool
123
        bbc     1, pfp, 1f      # same if bit 1 is clear
124
        /* uh-oh, we're coming from user mode: switch stacks */
125
        lda     1f, r6
126
        ldconst USER_PC, r8
127
        b       switch_to_kstack
128
 
129
1:
130
        SAVE_ALL(r3)
131
        subo    16, fp, g0
132
        call    SYMBOL_NAME(csyscall)
133
        RESTORE_ALL(r3)
134
        ret
135
 
136
/*
137
 * This is the main interrupt handler; it is also the entry point for
138
 * system calls.
139
 */
140
        .globl  SYMBOL_NAME(intr)
141
        .align  4
142
SYMBOL_NAME_LABEL(intr)
143
        ld      -16(fp), r3
144
        ldob    -8(fp), r7
145
        bbs     1, r3, 1f               # if we're supervisor, forget it
146
        /* uh-oh, switch stacks */
147
        lda     2f, r6
148
        mov     r3, r8
149
        b       switch_to_kstack
150
 
151
1:
152
        mov     r7, r3
153
2:
154
/*
155
 * by now we're on a valid stack, and the interrupt vector number is in
156
 * r3.
157
 */
158
        SAVE_ALL(r4)
159
        mov     r3, g0          # 1st arg is intr vector
160
        flushreg                # get regs on stack
161
        subo    16, fp, g1      # 2nd arg is pointer to pt_regs
162
        call    SYMBOL_NAME(cintr)
163
        RESTORE_ALL(r3)
164
        ret                     # back to user-level
165
 
166
/*
167
 * Again, if we're coming from user mode, switch to kstack. We get this info
168
 * from the fault record, 16 bytes below the current fp. We play games similar
169
 * to intr to hold onto the fault record...
170
 */
171
        .globl  SYMBOL_NAME(fault)
172
SYMBOL_NAME_LABEL(fault)
173
        subo    16, fp, r7
174
        ld      (r7), r3        # r3 gets pc of faulting instr
175
        bbs     1, r3, 1f       # if it was a supervisor fault, don't switch
176
 
177
        lda     2f, r6
178
        ldconst USER_PC, r8
179
        b       switch_to_kstack
180
1:
181
        mov     r7, r3
182
2:
183
        SAVE_ALL(r4)
184
        mov     r3, g0
185
        subo    16, fp, g1
186
        call    SYMBOL_NAME(cfault)
187
        RESTORE_ALL(r4)
188
        ret
189
 
190
/*
191
 * The table of system calls.
192
 */
193
        .globl  SYMBOL_NAME(syscall_tab)
194
SYMBOL_NAME_LABEL(syscall_tab)
195
        .long SYMBOL_NAME(sys_setup)            /* 0 */
196
        .long SYMBOL_NAME(sys_exit)
197
        .long SYMBOL_NAME(sys_fork)
198
        .long SYMBOL_NAME(sys_read)
199
        .long SYMBOL_NAME(sys_write)
200
        .long SYMBOL_NAME(sys_open)             /* 5 */
201
        .long SYMBOL_NAME(sys_close)
202
        .long SYMBOL_NAME(sys_waitpid)
203
        .long SYMBOL_NAME(sys_creat)
204
        .long SYMBOL_NAME(sys_link)
205
        .long SYMBOL_NAME(sys_unlink)           /* 10 */
206
        .long SYMBOL_NAME(sys_execve)
207
        .long SYMBOL_NAME(sys_chdir)
208
        .long SYMBOL_NAME(sys_time)
209
        .long SYMBOL_NAME(sys_mknod)
210
        .long SYMBOL_NAME(sys_chmod)            /* 15 */
211
        .long SYMBOL_NAME(sys_chown)
212
        .long SYMBOL_NAME(sys_break)
213
        .long SYMBOL_NAME(sys_stat)
214
        .long SYMBOL_NAME(sys_lseek)
215
        .long SYMBOL_NAME(sys_getpid)           /* 20 */
216
        .long SYMBOL_NAME(sys_mount)
217
        .long SYMBOL_NAME(sys_umount)
218
        .long SYMBOL_NAME(sys_setuid)
219
        .long SYMBOL_NAME(sys_getuid)
220
        .long SYMBOL_NAME(sys_stime)            /* 25 */
221
        .long SYMBOL_NAME(sys_ptrace)
222
        .long SYMBOL_NAME(sys_alarm)
223
        .long SYMBOL_NAME(sys_fstat)
224
        .long SYMBOL_NAME(sys_pause)
225
        .long SYMBOL_NAME(sys_utime)            /* 30 */
226
        .long SYMBOL_NAME(sys_stty)
227
        .long SYMBOL_NAME(sys_gtty)
228
        .long SYMBOL_NAME(sys_access)
229
        .long SYMBOL_NAME(sys_nice)
230
        .long SYMBOL_NAME(sys_ftime)            /* 35 */
231
        .long SYMBOL_NAME(sys_sync)
232
        .long SYMBOL_NAME(sys_kill)
233
        .long SYMBOL_NAME(sys_rename)
234
        .long SYMBOL_NAME(sys_mkdir)
235
        .long SYMBOL_NAME(sys_rmdir)            /* 40 */
236
        .long SYMBOL_NAME(sys_dup)
237
        .long SYMBOL_NAME(do_pipe)
238
        .long SYMBOL_NAME(sys_times)
239
        .long SYMBOL_NAME(sys_prof)
240
        .long SYMBOL_NAME(sys_brk)              /* 45 */
241
        .long SYMBOL_NAME(sys_setgid)
242
        .long SYMBOL_NAME(sys_getgid)
243
        .long SYMBOL_NAME(sys_signal)
244
        .long SYMBOL_NAME(sys_geteuid)
245
        .long SYMBOL_NAME(sys_getegid)          /* 50 */
246
        .long SYMBOL_NAME(sys_acct)
247
        .long SYMBOL_NAME(sys_phys)
248
        .long SYMBOL_NAME(sys_lock)
249
        .long SYMBOL_NAME(sys_ioctl)
250
        .long SYMBOL_NAME(sys_fcntl)            /* 55 */
251
        .long SYMBOL_NAME(sys_mpx)
252
        .long SYMBOL_NAME(sys_setpgid)
253
        .long SYMBOL_NAME(sys_ulimit)
254
        .long SYMBOL_NAME(sys_olduname)
255
        .long SYMBOL_NAME(sys_umask)            /* 60 */
256
        .long SYMBOL_NAME(sys_chroot)
257
        .long SYMBOL_NAME(sys_ustat)
258
        .long SYMBOL_NAME(sys_dup2)
259
        .long SYMBOL_NAME(sys_getppid)
260
        .long SYMBOL_NAME(sys_getpgrp)          /* 65 */
261
        .long SYMBOL_NAME(sys_setsid)
262
        .long SYMBOL_NAME(sys_sigaction)
263
        .long SYMBOL_NAME(sys_sgetmask)
264
        .long SYMBOL_NAME(sys_ssetmask)
265
        .long SYMBOL_NAME(sys_setreuid)         /* 70 */
266
        .long SYMBOL_NAME(sys_setregid)
267
        .long SYMBOL_NAME(do_sigsuspend)
268
        .long SYMBOL_NAME(sys_sigpending)
269
        .long SYMBOL_NAME(sys_sethostname)
270
        .long SYMBOL_NAME(sys_setrlimit)        /* 75 */
271
        .long SYMBOL_NAME(sys_getrlimit)
272
        .long SYMBOL_NAME(sys_getrusage)
273
        .long SYMBOL_NAME(sys_gettimeofday)
274
        .long SYMBOL_NAME(sys_settimeofday)
275
        .long SYMBOL_NAME(sys_getgroups)        /* 80 */
276
        .long SYMBOL_NAME(sys_setgroups)
277
        .long SYMBOL_NAME(sys_select)
278
        .long SYMBOL_NAME(sys_symlink)
279
        .long SYMBOL_NAME(sys_lstat)
280
        .long SYMBOL_NAME(sys_readlink)         /* 85 */
281
        .long SYMBOL_NAME(sys_uselib)
282
        .long SYMBOL_NAME(sys_swapon)
283
        .long SYMBOL_NAME(sys_reboot)
284
        .long SYMBOL_NAME(sys_ni_syscall)
285
        .long SYMBOL_NAME(sys_ni_syscall)               /* 90 */
286
        .long SYMBOL_NAME(sys_munmap)
287
        .long SYMBOL_NAME(sys_truncate)
288
        .long SYMBOL_NAME(sys_ftruncate)
289
        .long SYMBOL_NAME(sys_fchmod)
290
        .long SYMBOL_NAME(sys_fchown)           /* 95 */
291
        .long SYMBOL_NAME(sys_getpriority)
292
        .long SYMBOL_NAME(sys_setpriority)
293
        .long SYMBOL_NAME(sys_profil)
294
        .long SYMBOL_NAME(sys_statfs)
295
        .long SYMBOL_NAME(sys_fstatfs)          /* 100 */
296
        .long SYMBOL_NAME(sys_ioperm)
297
        .long SYMBOL_NAME(sys_socketcall)
298
        .long SYMBOL_NAME(sys_syslog)
299
        .long SYMBOL_NAME(sys_setitimer)
300
        .long SYMBOL_NAME(sys_getitimer)        /* 105 */
301
        .long SYMBOL_NAME(sys_newstat)
302
        .long SYMBOL_NAME(sys_newlstat)
303
        .long SYMBOL_NAME(sys_newfstat)
304
        .long SYMBOL_NAME(sys_uname)
305
        .long SYMBOL_NAME(sys_ni_syscall)       /* iopl for i386 */ /* 110 */
306
        .long SYMBOL_NAME(sys_vhangup)
307
        .long SYMBOL_NAME(sys_idle)
308
        .long SYMBOL_NAME(sys_ni_syscall)       /* vm86 for i386 */
309
        .long SYMBOL_NAME(sys_wait4)
310
        .long SYMBOL_NAME(sys_swapoff)          /* 115 */
311
        .long SYMBOL_NAME(sys_sysinfo)
312
        .long SYMBOL_NAME(sys_ipc)
313
        .long SYMBOL_NAME(sys_fsync)
314
        .long SYMBOL_NAME(do_sigreturn)
315
        .long SYMBOL_NAME(sys_clone)            /* 120 */
316
        .long SYMBOL_NAME(sys_setdomainname)
317
        .long SYMBOL_NAME(sys_newuname)
318
        .long SYMBOL_NAME(sys_cacheflush)       /* modify_ldt for i386 */
319
        .long SYMBOL_NAME(sys_adjtimex)
320
        .long SYMBOL_NAME(sys_mprotect)         /* 125 */
321
        .long SYMBOL_NAME(sys_sigprocmask)
322
        .long SYMBOL_NAME(sys_create_module)
323
        .long SYMBOL_NAME(sys_init_module)
324
        .long SYMBOL_NAME(sys_delete_module)
325
        .long SYMBOL_NAME(sys_get_kernel_syms)  /* 130 */
326
        .long SYMBOL_NAME(sys_quotactl)
327
        .long SYMBOL_NAME(sys_getpgid)
328
        .long SYMBOL_NAME(sys_fchdir)
329
        .long SYMBOL_NAME(sys_bdflush)
330
        .long SYMBOL_NAME(sys_sysfs)            /* 135 */
331
        .long SYMBOL_NAME(sys_personality)
332
        .long SYMBOL_NAME(sys_ni_syscall)       /* for afs_syscall */
333
        .long SYMBOL_NAME(sys_setfsuid)
334
        .long SYMBOL_NAME(sys_setfsgid)
335
        .long SYMBOL_NAME(sys_llseek)           /* 140 */
336
        .long SYMBOL_NAME(sys_getdents)
337
        .long SYMBOL_NAME(sys_select)
338
        .long SYMBOL_NAME(sys_flock)
339
        .long SYMBOL_NAME(sys_msync)
340
        .long SYMBOL_NAME(sys_readv)            /* 145 */
341
        .long SYMBOL_NAME(sys_writev)
342
        .long SYMBOL_NAME(sys_getsid)
343
        .long SYMBOL_NAME(sys_fdatasync)
344
        .long SYMBOL_NAME(sys_sysctl)
345
        .long SYMBOL_NAME(sys_mlock)            /* 150 */
346
        .long SYMBOL_NAME(sys_munlock)
347
        .long SYMBOL_NAME(sys_mlockall)
348
        .long SYMBOL_NAME(sys_munlockall)
349
        .long SYMBOL_NAME(sys_sched_setparam)
350
        .long SYMBOL_NAME(sys_sched_getparam)   /* 155 */
351
        .long SYMBOL_NAME(sys_sched_setscheduler)
352
        .long SYMBOL_NAME(sys_sched_getscheduler)
353
        .long SYMBOL_NAME(sys_sched_yield)
354
        .long SYMBOL_NAME(sys_sched_get_priority_max)
355
        .long SYMBOL_NAME(sys_sched_get_priority_min)  /* 160 */
356
        .long SYMBOL_NAME(sys_sched_rr_get_interval)
357
        .long SYMBOL_NAME(sys_nanosleep)
358
        .long SYMBOL_NAME(sys_mremap)

powered by: WebSVN 2.1.0

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