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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [m68knommu/] [kernel/] [sys_m68k.c] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * linux/arch/m68knommu/kernel/sys_m68k.c
3
 *
4
 * Copyright (C) 1998  D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>,
5
 *                     Kenneth Albanowski <kjahds@kjahds.com>,
6
 *                     The Silver Hammer Group, Ltd.
7
 *
8
 * Based on:
9
 *
10
 * linux/arch/m68k/kernel/sys_m68k.c
11
 *
12
 * This file contains various random system calls that
13
 * have a non-standard calling sequence on the Linux/m68k
14
 * platform.
15
 */
16
 
17
#include <linux/errno.h>
18
#include <linux/sched.h>
19
#include <linux/mm.h>
20
#include <linux/sem.h>
21
#include <linux/msg.h>
22
#include <linux/shm.h>
23
#include <linux/stat.h>
24
#include <linux/mman.h>
25
 
26
#include <asm/setup.h>
27
#include <asm/segment.h>
28
#include <asm/traps.h>
29
 
30
/*
31
 * sys_pipe() is the normal C calling standard for creating
32
 * a pipe. It's not the way unix traditionally does this, though.
33
 */
34
asmlinkage int sys_pipe(unsigned long * fildes)
35
{
36
        int fd[2];
37
        int error;
38
 
39
        error = verify_area(VERIFY_WRITE,fildes,8);
40
        if (error)
41
                return error;
42
        error = do_pipe(fd);
43
        if (error)
44
                return error;
45
        put_user(fd[0],0+fildes);
46
        put_user(fd[1],1+fildes);
47
        return 0;
48
}
49
 
50
/*
51
 * Perform the select(nd, in, out, ex, tv) and mmap() system
52
 * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
53
 * handle more than 4 system call parameters, so these system calls
54
 * used a memory block for parameter passing..
55
 */
56
 
57
asmlinkage int old_mmap(unsigned long *buffer)
58
{
59
        int error;
60
        unsigned long flags;
61
        struct file * file = NULL;
62
 
63
        error = verify_area(VERIFY_READ, buffer, 6*sizeof(long));
64
        if (error)
65
                return error;
66
        flags = get_user(buffer+3);
67
        if (!(flags & MAP_ANONYMOUS)) {
68
                unsigned long fd = get_user(buffer+4);
69
                if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
70
                        return -EBADF;
71
        }
72
        flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
73
        return do_mmap(file, get_user(buffer), get_user(buffer+1),
74
                       get_user(buffer+2), flags, get_user(buffer+5));
75
}
76
 
77
 
78
extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
79
 
80
asmlinkage int old_select(unsigned long *buffer)
81
{
82
        int n;
83
        fd_set *inp;
84
        fd_set *outp;
85
        fd_set *exp;
86
        struct timeval *tvp;
87
 
88
        n = verify_area(VERIFY_READ, buffer, 5*sizeof(unsigned long));
89
        if (n)
90
          return n;
91
 
92
        n = get_user(buffer);
93
        inp = (fd_set *) get_user(buffer+1);
94
        outp = (fd_set *) get_user(buffer+2);
95
        exp = (fd_set *) get_user(buffer+3);
96
        tvp = (struct timeval *) get_user(buffer+4);
97
        return sys_select(n, inp, outp, exp, tvp);
98
}
99
 
100
/*
101
 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
102
 *
103
 * This is really horribly ugly.
104
 */
105
asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
106
{
107
        int version;
108
 
109
        version = call >> 16; /* hack for backward compatibility */
110
        call &= 0xffff;
111
 
112
        if (call <= SEMCTL)
113
                switch (call) {
114
                case SEMOP:
115
                        return sys_semop (first, (struct sembuf *)ptr, second);
116
                case SEMGET:
117
                        return sys_semget (first, second, third);
118
                case SEMCTL: {
119
                        union semun fourth;
120
                        int err;
121
                        if (!ptr)
122
                                return -EINVAL;
123
                        if ((err = verify_area (VERIFY_READ, ptr, sizeof(long))))
124
                                return err;
125
                        fourth.__pad = get_user((void **)ptr);
126
                        return sys_semctl (first, second, third, fourth);
127
                        }
128
                default:
129
                        return -EINVAL;
130
                }
131
        if (call <= MSGCTL)
132
                switch (call) {
133
                case MSGSND:
134
                        return sys_msgsnd (first, (struct msgbuf *) ptr,
135
                                           second, third);
136
                case MSGRCV:
137
                        switch (version) {
138
                        case 0: {
139
                                struct ipc_kludge tmp;
140
                                int err;
141
                                if (!ptr)
142
                                        return -EINVAL;
143
                                if ((err = verify_area (VERIFY_READ, ptr, sizeof(tmp))))
144
                                        return err;
145
                                memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr,
146
                                               sizeof (tmp));
147
                                return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
148
                                }
149
                        case 1: default:
150
                                return sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
151
                        }
152
                case MSGGET:
153
                        return sys_msgget ((key_t) first, second);
154
                case MSGCTL:
155
                        return sys_msgctl (first, second, (struct msqid_ds *) ptr);
156
                default:
157
                        return -EINVAL;
158
                }
159
        if (call <= SHMCTL)
160
                switch (call) {
161
                case SHMAT:
162
                        switch (version) {
163
                        case 0: default: {
164
                                ulong raddr;
165
                                int err;
166
                                if ((err = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong))))
167
                                        return err;
168
                                err = sys_shmat (first, (char *) ptr, second, &raddr);
169
                                if (err)
170
                                        return err;
171
                                put_user (raddr, (ulong *) third);
172
                                return 0;
173
                                }
174
                        case 1: /* iBCS2 emulator entry point */
175
                                if (get_fs() != get_ds())
176
                                        return -EINVAL;
177
                                return sys_shmat (first, (char *) ptr, second, (ulong *) third);
178
                        }
179
                case SHMDT:
180
                        return sys_shmdt ((char *)ptr);
181
                case SHMGET:
182
                        return sys_shmget (first, second, third);
183
                case SHMCTL:
184
                        return sys_shmctl (first, second, (struct shmid_ds *) ptr);
185
                default:
186
                        return -EINVAL;
187
                }
188
        return -EINVAL;
189
}
190
 
191
asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
192
{
193
  return -ENOSYS;
194
}
195
 
196
/* sys_cacheflush -- flush (part of) the processor cache.  */
197
asmlinkage int
198
sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
199
{
200
        return 0;
201
}

powered by: WebSVN 2.1.0

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