initial commit with v2.6.9
[linux-2.6.9-moxart.git] / arch / um / sys-i386 / syscalls.c
blob6ad31749bfe72133957a89002771549b6a8afb66
1 /*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #include "linux/sched.h"
7 #include "asm/mman.h"
8 #include "asm/uaccess.h"
9 #include "asm/unistd.h"
12 * Perform the select(nd, in, out, ex, tv) and mmap() system
13 * calls. Linux/i386 didn't use to be able to handle more than
14 * 4 system call parameters, so these system calls used a memory
15 * block for parameter passing..
18 struct mmap_arg_struct {
19 unsigned long addr;
20 unsigned long len;
21 unsigned long prot;
22 unsigned long flags;
23 unsigned long fd;
24 unsigned long offset;
27 extern int old_mmap(unsigned long addr, unsigned long len,
28 unsigned long prot, unsigned long flags,
29 unsigned long fd, unsigned long offset);
31 int old_mmap_i386(struct mmap_arg_struct *arg)
33 struct mmap_arg_struct a;
34 int err = -EFAULT;
36 if (copy_from_user(&a, arg, sizeof(a)))
37 goto out;
39 err = old_mmap(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
40 out:
41 return err;
44 struct sel_arg_struct {
45 unsigned long n;
46 fd_set *inp, *outp, *exp;
47 struct timeval *tvp;
50 int old_select(struct sel_arg_struct *arg)
52 struct sel_arg_struct a;
54 if (copy_from_user(&a, arg, sizeof(a)))
55 return -EFAULT;
56 /* sys_select() does the appropriate kernel locking */
57 return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
60 /* The i386 version skips reading from %esi, the fourth argument. So we must do
61 * this, too.
63 int sys_clone(unsigned long clone_flags, unsigned long newsp, int *parent_tid,
64 int unused, int *child_tid)
66 long ret;
68 /* XXX: normal arch do here this pass, and also pass the regs to
69 * do_fork, instead of NULL. Currently the arch-independent code
70 * ignores these values, while the UML code (actually it's
71 * copy_thread) does the right thing. But this should change,
72 probably. */
73 /*if (!newsp)
74 newsp = UPT_SP(current->thread.regs);*/
75 current->thread.forking = 1;
76 ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid);
77 current->thread.forking = 0;
78 return(ret);
82 * Overrides for Emacs so that we follow Linus's tabbing style.
83 * Emacs will notice this stuff at the end of the file and automatically
84 * adjust the settings for this buffer only. This must remain at the end
85 * of the file.
86 * ---------------------------------------------------------------------------
87 * Local variables:
88 * c-file-style: "linux"
89 * End: