2 * linux/arch/h8300/kernel/sys_h8300.c
4 * This file contains various random system calls that
5 * have a non-standard calling sequence on the H8/300
9 #include <linux/errno.h>
10 #include <linux/sched.h>
12 #include <linux/smp.h>
13 #include <linux/sem.h>
14 #include <linux/msg.h>
15 #include <linux/shm.h>
16 #include <linux/stat.h>
17 #include <linux/syscalls.h>
18 #include <linux/mman.h>
19 #include <linux/file.h>
21 #include <linux/ipc.h>
23 #include <asm/setup.h>
24 #include <asm/uaccess.h>
25 #include <asm/cachectl.h>
26 #include <asm/traps.h>
27 #include <asm/unistd.h>
30 * Perform the select(nd, in, out, ex, tv) and mmap() system
31 * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
32 * handle more than 4 system call parameters, so these system calls
33 * used a memory block for parameter passing..
36 struct mmap_arg_struct
{
45 asmlinkage
int old_mmap(struct mmap_arg_struct
*arg
)
47 struct mmap_arg_struct a
;
50 if (copy_from_user(&a
, arg
, sizeof(a
)))
54 if (a
.offset
& ~PAGE_MASK
)
57 error
= sys_mmap_pgoff(a
.addr
, a
.len
, a
.prot
, a
.flags
, a
.fd
,
58 a
.offset
>> PAGE_SHIFT
);
63 struct sel_arg_struct
{
65 fd_set
*inp
, *outp
, *exp
;
69 asmlinkage
int old_select(struct sel_arg_struct
*arg
)
71 struct sel_arg_struct a
;
73 if (copy_from_user(&a
, arg
, sizeof(a
)))
75 /* sys_select() does the appropriate kernel locking */
76 return sys_select(a
.n
, a
.inp
, a
.outp
, a
.exp
, a
.tvp
);
80 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
82 * This is really horribly ugly.
84 asmlinkage
int sys_ipc (uint call
, int first
, int second
,
85 int third
, void *ptr
, long fifth
)
89 version
= call
>> 16; /* hack for backward compatibility */
95 return sys_semop (first
, (struct sembuf
*)ptr
, second
);
97 return sys_semget (first
, second
, third
);
102 if (get_user(fourth
.__pad
, (void **) ptr
))
104 return sys_semctl (first
, second
, third
, fourth
);
112 return sys_msgsnd (first
, (struct msgbuf
*) ptr
,
117 struct ipc_kludge tmp
;
120 if (copy_from_user (&tmp
,
121 (struct ipc_kludge
*)ptr
,
124 return sys_msgrcv (first
, tmp
.msgp
, second
,
128 return sys_msgrcv (first
,
129 (struct msgbuf
*) ptr
,
130 second
, fifth
, third
);
133 return sys_msgget ((key_t
) first
, second
);
135 return sys_msgctl (first
, second
,
136 (struct msqid_ds
*) ptr
);
146 ret
= do_shmat (first
, (char *) ptr
,
150 return put_user (raddr
, (ulong
*) third
);
154 return sys_shmdt ((char *)ptr
);
156 return sys_shmget (first
, second
, third
);
158 return sys_shmctl (first
, second
,
159 (struct shmid_ds
*) ptr
);
167 /* sys_cacheflush -- no support. */
169 sys_cacheflush (unsigned long addr
, int scope
, int cache
, unsigned long len
)
174 asmlinkage
int sys_getpagesize(void)
179 #if defined(CONFIG_SYSCALL_PRINT)
180 asmlinkage
void syscall_print(void *dummy
,...)
182 struct pt_regs
*regs
= (struct pt_regs
*) ((unsigned char *)&dummy
-4);
183 printk("call %06lx:%ld 1:%08lx,2:%08lx,3:%08lx,ret:%08lx\n",
184 ((regs
->pc
)&0xffffff)-2,regs
->orig_er0
,regs
->er1
,regs
->er2
,regs
->er3
,regs
->er0
);
189 * Do a system call from kernel instead of calling sys_execve so we
190 * end up with proper pt_regs.
192 int kernel_execve(const char *filename
, char *const argv
[], char *const envp
[])
194 register long res
__asm__("er0");
195 register char *const *_c
__asm__("er3") = envp
;
196 register char *const *_b
__asm__("er2") = argv
;
197 register const char * _a
__asm__("er1") = filename
;
198 __asm__
__volatile__ ("mov.l %1,er0\n\t"