aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/Kconfig1
-rw-r--r--arch/um/Kconfig_i3866
-rw-r--r--arch/um/Kconfig_x86_646
-rw-r--r--arch/um/Makefile-i3862
-rw-r--r--arch/um/defconfig10
-rw-r--r--arch/um/drivers/chan_kern.c16
-rw-r--r--arch/um/drivers/line.c318
-rw-r--r--arch/um/drivers/ssl.c25
-rw-r--r--arch/um/drivers/stdio_console.c19
-rw-r--r--arch/um/drivers/ubd_kern.c14
-rw-r--r--arch/um/include/line.h36
-rw-r--r--arch/um/include/sysdep-i386/syscalls.h99
-rw-r--r--arch/um/include/sysdep-x86_64/syscalls.h59
-rw-r--r--arch/um/kernel/Makefile5
-rw-r--r--arch/um/kernel/process_kern.c4
-rw-r--r--arch/um/kernel/ptrace.c4
-rw-r--r--arch/um/kernel/skas/include/uaccess-skas.h2
-rw-r--r--arch/um/kernel/skas/uaccess.c4
-rw-r--r--arch/um/kernel/sys_call_table.c276
-rw-r--r--arch/um/kernel/tt/include/uaccess-tt.h2
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c7
-rw-r--r--arch/um/sys-i386/Makefile3
-rw-r--r--arch/um/sys-i386/sys_call_table.S16
-rw-r--r--arch/um/sys-x86_64/Makefile2
-rw-r--r--arch/um/sys-x86_64/syscall_table.c59
-rw-r--r--arch/um/sys-x86_64/syscalls.c12
26 files changed, 366 insertions, 641 deletions
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 9a23df182123..c5292181a664 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -244,6 +244,7 @@ config KERNEL_HALF_GIGS
244 244
245config HIGHMEM 245config HIGHMEM
246 bool "Highmem support" 246 bool "Highmem support"
247 depends on !64BIT
247 248
248config KERNEL_STACK_ORDER 249config KERNEL_STACK_ORDER
249 int "Kernel stack size order" 250 int "Kernel stack size order"
diff --git a/arch/um/Kconfig_i386 b/arch/um/Kconfig_i386
index 203c242201b6..e41f3748d30f 100644
--- a/arch/um/Kconfig_i386
+++ b/arch/um/Kconfig_i386
@@ -1,4 +1,8 @@
1config 64_BIT 1config UML_X86
2 bool
3 default y
4
5config 64BIT
2 bool 6 bool
3 default n 7 default n
4 8
diff --git a/arch/um/Kconfig_x86_64 b/arch/um/Kconfig_x86_64
index 768dc6626a8d..fd8d7e8982b1 100644
--- a/arch/um/Kconfig_x86_64
+++ b/arch/um/Kconfig_x86_64
@@ -1,4 +1,8 @@
1config 64_BIT 1config UML_X86
2 bool
3 default y
4
5config 64BIT
2 bool 6 bool
3 default y 7 default y
4 8
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 97b223bfa78e..f9e3c0f06541 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -1,4 +1,4 @@
1SUBARCH_CORE := arch/um/sys-i386/ 1SUBARCH_CORE := arch/um/sys-i386/ arch/i386/crypto/
2 2
3TOP_ADDR := $(CONFIG_TOP_ADDR) 3TOP_ADDR := $(CONFIG_TOP_ADDR)
4 4
diff --git a/arch/um/defconfig b/arch/um/defconfig
index fc3075c589d8..4067c3aa5b60 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc1-bk1 3# Linux kernel version: 2.6.12-rc3-skas3-v9-pre2
4# Sun Mar 20 16:53:00 2005 4# Sun Apr 24 19:46:10 2005
5# 5#
6CONFIG_GENERIC_HARDIRQS=y 6CONFIG_GENERIC_HARDIRQS=y
7CONFIG_UML=y 7CONFIG_UML=y
@@ -15,7 +15,8 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
15# 15#
16CONFIG_MODE_TT=y 16CONFIG_MODE_TT=y
17CONFIG_MODE_SKAS=y 17CONFIG_MODE_SKAS=y
18# CONFIG_64_BIT is not set 18CONFIG_UML_X86=y
19# CONFIG_64BIT is not set
19CONFIG_TOP_ADDR=0xc0000000 20CONFIG_TOP_ADDR=0xc0000000
20# CONFIG_3_LEVEL_PGTABLES is not set 21# CONFIG_3_LEVEL_PGTABLES is not set
21CONFIG_ARCH_HAS_SC_SIGNALS=y 22CONFIG_ARCH_HAS_SC_SIGNALS=y
@@ -41,6 +42,7 @@ CONFIG_UML_REAL_TIME_CLOCK=y
41CONFIG_EXPERIMENTAL=y 42CONFIG_EXPERIMENTAL=y
42CONFIG_CLEAN_COMPILE=y 43CONFIG_CLEAN_COMPILE=y
43CONFIG_BROKEN_ON_SMP=y 44CONFIG_BROKEN_ON_SMP=y
45CONFIG_INIT_ENV_ARG_LIMIT=32
44 46
45# 47#
46# General setup 48# General setup
@@ -158,7 +160,6 @@ CONFIG_UML_NET_SLIRP=y
158# 160#
159CONFIG_PACKET=y 161CONFIG_PACKET=y
160CONFIG_PACKET_MMAP=y 162CONFIG_PACKET_MMAP=y
161# CONFIG_NETLINK_DEV is not set
162CONFIG_UNIX=y 163CONFIG_UNIX=y
163# CONFIG_NET_KEY is not set 164# CONFIG_NET_KEY is not set
164CONFIG_INET=y 165CONFIG_INET=y
@@ -412,6 +413,5 @@ CONFIG_DEBUG_INFO=y
412# CONFIG_DEBUG_FS is not set 413# CONFIG_DEBUG_FS is not set
413CONFIG_FRAME_POINTER=y 414CONFIG_FRAME_POINTER=y
414CONFIG_PT_PROXY=y 415CONFIG_PT_PROXY=y
415# CONFIG_GPROF is not set
416# CONFIG_GCOV is not set 416# CONFIG_GCOV is not set
417# CONFIG_SYSCALL_DEBUG is not set 417# CONFIG_SYSCALL_DEBUG is not set
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 1f77deb3fd23..0150038af795 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -22,7 +22,7 @@
22#ifdef CONFIG_NOCONFIG_CHAN 22#ifdef CONFIG_NOCONFIG_CHAN
23static void *not_configged_init(char *str, int device, struct chan_opts *opts) 23static void *not_configged_init(char *str, int device, struct chan_opts *opts)
24{ 24{
25 printk(KERN_ERR "Using a channel type which is configured out of " 25 printf(KERN_ERR "Using a channel type which is configured out of "
26 "UML\n"); 26 "UML\n");
27 return(NULL); 27 return(NULL);
28} 28}
@@ -30,27 +30,27 @@ static void *not_configged_init(char *str, int device, struct chan_opts *opts)
30static int not_configged_open(int input, int output, int primary, void *data, 30static int not_configged_open(int input, int output, int primary, void *data,
31 char **dev_out) 31 char **dev_out)
32{ 32{
33 printk(KERN_ERR "Using a channel type which is configured out of " 33 printf(KERN_ERR "Using a channel type which is configured out of "
34 "UML\n"); 34 "UML\n");
35 return(-ENODEV); 35 return(-ENODEV);
36} 36}
37 37
38static void not_configged_close(int fd, void *data) 38static void not_configged_close(int fd, void *data)
39{ 39{
40 printk(KERN_ERR "Using a channel type which is configured out of " 40 printf(KERN_ERR "Using a channel type which is configured out of "
41 "UML\n"); 41 "UML\n");
42} 42}
43 43
44static int not_configged_read(int fd, char *c_out, void *data) 44static int not_configged_read(int fd, char *c_out, void *data)
45{ 45{
46 printk(KERN_ERR "Using a channel type which is configured out of " 46 printf(KERN_ERR "Using a channel type which is configured out of "
47 "UML\n"); 47 "UML\n");
48 return(-EIO); 48 return(-EIO);
49} 49}
50 50
51static int not_configged_write(int fd, const char *buf, int len, void *data) 51static int not_configged_write(int fd, const char *buf, int len, void *data)
52{ 52{
53 printk(KERN_ERR "Using a channel type which is configured out of " 53 printf(KERN_ERR "Using a channel type which is configured out of "
54 "UML\n"); 54 "UML\n");
55 return(-EIO); 55 return(-EIO);
56} 56}
@@ -58,7 +58,7 @@ static int not_configged_write(int fd, const char *buf, int len, void *data)
58static int not_configged_console_write(int fd, const char *buf, int len, 58static int not_configged_console_write(int fd, const char *buf, int len,
59 void *data) 59 void *data)
60{ 60{
61 printk(KERN_ERR "Using a channel type which is configured out of " 61 printf(KERN_ERR "Using a channel type which is configured out of "
62 "UML\n"); 62 "UML\n");
63 return(-EIO); 63 return(-EIO);
64} 64}
@@ -66,14 +66,14 @@ static int not_configged_console_write(int fd, const char *buf, int len,
66static int not_configged_window_size(int fd, void *data, unsigned short *rows, 66static int not_configged_window_size(int fd, void *data, unsigned short *rows,
67 unsigned short *cols) 67 unsigned short *cols)
68{ 68{
69 printk(KERN_ERR "Using a channel type which is configured out of " 69 printf(KERN_ERR "Using a channel type which is configured out of "
70 "UML\n"); 70 "UML\n");
71 return(-ENODEV); 71 return(-ENODEV);
72} 72}
73 73
74static void not_configged_free(void *data) 74static void not_configged_free(void *data)
75{ 75{
76 printk(KERN_ERR "Using a channel type which is configured out of " 76 printf(KERN_ERR "Using a channel type which is configured out of "
77 "UML\n"); 77 "UML\n");
78} 78}
79 79
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 6924f273ced9..d0f97127adf6 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -39,19 +39,69 @@ static void line_timer_cb(void *arg)
39 line_interrupt(line->driver->read_irq, arg, NULL); 39 line_interrupt(line->driver->read_irq, arg, NULL);
40} 40}
41 41
42static int write_room(struct line *dev) 42/* Returns the free space inside the ring buffer of this line.
43 *
44 * Should be called while holding line->lock (this does not modify datas).
45 */
46static int write_room(struct line *line)
43{ 47{
44 int n; 48 int n;
45 49
46 if (dev->buffer == NULL) 50 if (line->buffer == NULL)
47 return (LINE_BUFSIZE - 1); 51 return LINE_BUFSIZE - 1;
52
53 /* This is for the case where the buffer is wrapped! */
54 n = line->head - line->tail;
48 55
49 n = dev->head - dev->tail;
50 if (n <= 0) 56 if (n <= 0)
51 n = LINE_BUFSIZE + n; 57 n = LINE_BUFSIZE + n; /* The other case */
52 return (n - 1); 58 return n - 1;
59}
60
61int line_write_room(struct tty_struct *tty)
62{
63 struct line *line = tty->driver_data;
64 unsigned long flags;
65 int room;
66
67 if (tty->stopped)
68 return 0;
69
70 spin_lock_irqsave(&line->lock, flags);
71 room = write_room(line);
72 spin_unlock_irqrestore(&line->lock, flags);
73
74 /*XXX: Warning to remove */
75 if (0 == room)
76 printk(KERN_DEBUG "%s: %s: no room left in buffer\n",
77 __FUNCTION__,tty->name);
78 return room;
53} 79}
54 80
81int line_chars_in_buffer(struct tty_struct *tty)
82{
83 struct line *line = tty->driver_data;
84 unsigned long flags;
85 int ret;
86
87 spin_lock_irqsave(&line->lock, flags);
88
89 /*write_room subtracts 1 for the needed NULL, so we readd it.*/
90 ret = LINE_BUFSIZE - (write_room(line) + 1);
91 spin_unlock_irqrestore(&line->lock, flags);
92
93 return ret;
94}
95
96/*
97 * This copies the content of buf into the circular buffer associated with
98 * this line.
99 * The return value is the number of characters actually copied, i.e. the ones
100 * for which there was space: this function is not supposed to ever flush out
101 * the circular buffer.
102 *
103 * Must be called while holding line->lock!
104 */
55static int buffer_data(struct line *line, const char *buf, int len) 105static int buffer_data(struct line *line, const char *buf, int len)
56{ 106{
57 int end, room; 107 int end, room;
@@ -70,48 +120,95 @@ static int buffer_data(struct line *line, const char *buf, int len)
70 len = (len > room) ? room : len; 120 len = (len > room) ? room : len;
71 121
72 end = line->buffer + LINE_BUFSIZE - line->tail; 122 end = line->buffer + LINE_BUFSIZE - line->tail;
73 if(len < end){ 123
124 if (len < end){
74 memcpy(line->tail, buf, len); 125 memcpy(line->tail, buf, len);
75 line->tail += len; 126 line->tail += len;
76 } 127 } else {
77 else { 128 /* The circular buffer is wrapping */
78 memcpy(line->tail, buf, end); 129 memcpy(line->tail, buf, end);
79 buf += end; 130 buf += end;
80 memcpy(line->buffer, buf, len - end); 131 memcpy(line->buffer, buf, len - end);
81 line->tail = line->buffer + len - end; 132 line->tail = line->buffer + len - end;
82 } 133 }
83 134
84 return(len); 135 return len;
85} 136}
86 137
138/*
139 * Flushes the ring buffer to the output channels. That is, write_chan is
140 * called, passing it line->head as buffer, and an appropriate count.
141 *
142 * On exit, returns 1 when the buffer is empty,
143 * 0 when the buffer is not empty on exit,
144 * and -errno when an error occurred.
145 *
146 * Must be called while holding line->lock!*/
87static int flush_buffer(struct line *line) 147static int flush_buffer(struct line *line)
88{ 148{
89 int n, count; 149 int n, count;
90 150
91 if ((line->buffer == NULL) || (line->head == line->tail)) 151 if ((line->buffer == NULL) || (line->head == line->tail))
92 return(1); 152 return 1;
93 153
94 if (line->tail < line->head) { 154 if (line->tail < line->head) {
155 /* line->buffer + LINE_BUFSIZE is the end of the buffer! */
95 count = line->buffer + LINE_BUFSIZE - line->head; 156 count = line->buffer + LINE_BUFSIZE - line->head;
157
96 n = write_chan(&line->chan_list, line->head, count, 158 n = write_chan(&line->chan_list, line->head, count,
97 line->driver->write_irq); 159 line->driver->write_irq);
98 if (n < 0) 160 if (n < 0)
99 return(n); 161 return n;
100 if (n == count) 162 if (n == count) {
163 /* We have flushed from ->head to buffer end, now we
164 * must flush only from the beginning to ->tail.*/
101 line->head = line->buffer; 165 line->head = line->buffer;
102 else { 166 } else {
103 line->head += n; 167 line->head += n;
104 return(0); 168 return 0;
105 } 169 }
106 } 170 }
107 171
108 count = line->tail - line->head; 172 count = line->tail - line->head;
109 n = write_chan(&line->chan_list, line->head, count, 173 n = write_chan(&line->chan_list, line->head, count,
110 line->driver->write_irq); 174 line->driver->write_irq);
111 if(n < 0) return(n); 175
176 if(n < 0)
177 return n;
112 178
113 line->head += n; 179 line->head += n;
114 return(line->head == line->tail); 180 return line->head == line->tail;
181}
182
183void line_flush_buffer(struct tty_struct *tty)
184{
185 struct line *line = tty->driver_data;
186 unsigned long flags;
187 int err;
188
189 /*XXX: copied from line_write, verify if it is correct!*/
190 if(tty->stopped)
191 return;
192 //return 0;
193
194 spin_lock_irqsave(&line->lock, flags);
195 err = flush_buffer(line);
196 /*if (err == 1)
197 err = 0;*/
198 spin_unlock_irqrestore(&line->lock, flags);
199 //return err;
200}
201
202/* We map both ->flush_chars and ->put_char (which go in pair) onto ->flush_buffer
203 * and ->write. Hope it's not that bad.*/
204void line_flush_chars(struct tty_struct *tty)
205{
206 line_flush_buffer(tty);
207}
208
209void line_put_char(struct tty_struct *tty, unsigned char ch)
210{
211 line_write(tty, &ch, sizeof(ch));
115} 212}
116 213
117int line_write(struct tty_struct *tty, const unsigned char *buf, int len) 214int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
@@ -120,38 +217,31 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
120 unsigned long flags; 217 unsigned long flags;
121 int n, err, ret = 0; 218 int n, err, ret = 0;
122 219
123 if(tty->stopped) return 0; 220 if(tty->stopped)
221 return 0;
124 222
125 down(&line->sem); 223 spin_lock_irqsave(&line->lock, flags);
126 if(line->head != line->tail){ 224 if (line->head != line->tail) {
127 local_irq_save(flags);
128 ret = buffer_data(line, buf, len); 225 ret = buffer_data(line, buf, len);
129 err = flush_buffer(line); 226 err = flush_buffer(line);
130 local_irq_restore(flags); 227 if (err <= 0 && (err != -EAGAIN || !ret))
131 if(err <= 0 && (err != -EAGAIN || !ret))
132 ret = err; 228 ret = err;
133 } 229 } else {
134 else {
135 n = write_chan(&line->chan_list, buf, len, 230 n = write_chan(&line->chan_list, buf, len,
136 line->driver->write_irq); 231 line->driver->write_irq);
137 if(n < 0){ 232 if (n < 0) {
138 ret = n; 233 ret = n;
139 goto out_up; 234 goto out_up;
140 } 235 }
141 236
142 len -= n; 237 len -= n;
143 ret += n; 238 ret += n;
144 if(len > 0) 239 if (len > 0)
145 ret += buffer_data(line, buf + n, len); 240 ret += buffer_data(line, buf + n, len);
146 } 241 }
147 out_up: 242out_up:
148 up(&line->sem); 243 spin_unlock_irqrestore(&line->lock, flags);
149 return(ret); 244 return ret;
150}
151
152void line_put_char(struct tty_struct *tty, unsigned char ch)
153{
154 line_write(tty, &ch, sizeof(ch));
155} 245}
156 246
157void line_set_termios(struct tty_struct *tty, struct termios * old) 247void line_set_termios(struct tty_struct *tty, struct termios * old)
@@ -159,11 +249,6 @@ void line_set_termios(struct tty_struct *tty, struct termios * old)
159 /* nothing */ 249 /* nothing */
160} 250}
161 251
162int line_chars_in_buffer(struct tty_struct *tty)
163{
164 return 0;
165}
166
167static struct { 252static struct {
168 int cmd; 253 int cmd;
169 char *level; 254 char *level;
@@ -250,7 +335,7 @@ int line_ioctl(struct tty_struct *tty, struct file * file,
250 ret = -ENOIOCTLCMD; 335 ret = -ENOIOCTLCMD;
251 break; 336 break;
252 } 337 }
253 return(ret); 338 return ret;
254} 339}
255 340
256static irqreturn_t line_write_interrupt(int irq, void *data, 341static irqreturn_t line_write_interrupt(int irq, void *data,
@@ -260,18 +345,23 @@ static irqreturn_t line_write_interrupt(int irq, void *data,
260 struct line *line = tty->driver_data; 345 struct line *line = tty->driver_data;
261 int err; 346 int err;
262 347
348 /* Interrupts are enabled here because we registered the interrupt with
349 * SA_INTERRUPT (see line_setup_irq).*/
350
351 spin_lock_irq(&line->lock);
263 err = flush_buffer(line); 352 err = flush_buffer(line);
264 if(err == 0) 353 if (err == 0) {
265 return(IRQ_NONE); 354 return IRQ_NONE;
266 else if(err < 0){ 355 } else if(err < 0) {
267 line->head = line->buffer; 356 line->head = line->buffer;
268 line->tail = line->buffer; 357 line->tail = line->buffer;
269 } 358 }
359 spin_unlock_irq(&line->lock);
270 360
271 if(tty == NULL) 361 if(tty == NULL)
272 return(IRQ_NONE); 362 return IRQ_NONE;
273 363
274 if(test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && 364 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) &&
275 (tty->ldisc.write_wakeup != NULL)) 365 (tty->ldisc.write_wakeup != NULL))
276 (tty->ldisc.write_wakeup)(tty); 366 (tty->ldisc.write_wakeup)(tty);
277 367
@@ -281,9 +371,9 @@ static irqreturn_t line_write_interrupt(int irq, void *data,
281 * writes. 371 * writes.
282 */ 372 */
283 373
284 if(waitqueue_active(&tty->write_wait)) 374 if (waitqueue_active(&tty->write_wait))
285 wake_up_interruptible(&tty->write_wait); 375 wake_up_interruptible(&tty->write_wait);
286 return(IRQ_HANDLED); 376 return IRQ_HANDLED;
287} 377}
288 378
289int line_setup_irq(int fd, int input, int output, struct tty_struct *tty) 379int line_setup_irq(int fd, int input, int output, struct tty_struct *tty)
@@ -292,15 +382,18 @@ int line_setup_irq(int fd, int input, int output, struct tty_struct *tty)
292 struct line_driver *driver = line->driver; 382 struct line_driver *driver = line->driver;
293 int err = 0, flags = SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM; 383 int err = 0, flags = SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM;
294 384
295 if(input) err = um_request_irq(driver->read_irq, fd, IRQ_READ, 385 if (input)
386 err = um_request_irq(driver->read_irq, fd, IRQ_READ,
296 line_interrupt, flags, 387 line_interrupt, flags,
297 driver->read_irq_name, tty); 388 driver->read_irq_name, tty);
298 if(err) return(err); 389 if (err)
299 if(output) err = um_request_irq(driver->write_irq, fd, IRQ_WRITE, 390 return err;
391 if (output)
392 err = um_request_irq(driver->write_irq, fd, IRQ_WRITE,
300 line_write_interrupt, flags, 393 line_write_interrupt, flags,
301 driver->write_irq_name, tty); 394 driver->write_irq_name, tty);
302 line->have_irq = 1; 395 line->have_irq = 1;
303 return(err); 396 return err;
304} 397}
305 398
306void line_disable(struct tty_struct *tty, int current_irq) 399void line_disable(struct tty_struct *tty, int current_irq)
@@ -336,7 +429,9 @@ int line_open(struct line *lines, struct tty_struct *tty,
336 line = &lines[tty->index]; 429 line = &lines[tty->index];
337 tty->driver_data = line; 430 tty->driver_data = line;
338 431
339 down(&line->sem); 432 /* The IRQ which takes this lock is not yet enabled and won't be run
433 * before the end, so we don't need to use spin_lock_irq.*/
434 spin_lock(&line->lock);
340 if (tty->count == 1) { 435 if (tty->count == 1) {
341 if (!line->valid) { 436 if (!line->valid) {
342 err = -ENODEV; 437 err = -ENODEV;
@@ -349,6 +444,7 @@ int line_open(struct line *lines, struct tty_struct *tty,
349 err = open_chan(&line->chan_list); 444 err = open_chan(&line->chan_list);
350 if(err) goto out; 445 if(err) goto out;
351 } 446 }
447 /* Here the interrupt is registered.*/
352 enable_chan(&line->chan_list, tty); 448 enable_chan(&line->chan_list, tty);
353 INIT_WORK(&line->task, line_timer_cb, tty); 449 INIT_WORK(&line->task, line_timer_cb, tty);
354 } 450 }
@@ -362,21 +458,27 @@ int line_open(struct line *lines, struct tty_struct *tty,
362 line->count++; 458 line->count++;
363 459
364out: 460out:
365 up(&line->sem); 461 spin_unlock(&line->lock);
366 return(err); 462 return err;
367} 463}
368 464
369void line_close(struct tty_struct *tty, struct file * filp) 465void line_close(struct tty_struct *tty, struct file * filp)
370{ 466{
371 struct line *line = tty->driver_data; 467 struct line *line = tty->driver_data;
372 468
373 down(&line->sem); 469 /* XXX: I assume this should be called in process context, not with interrupt
470 * disabled!*/
471 spin_lock_irq(&line->lock);
472
473 /* We ignore the error anyway! */
474 flush_buffer(line);
475
374 line->count--; 476 line->count--;
375 if (tty->count == 1) { 477 if (tty->count == 1) {
376 line_disable(tty, -1); 478 line_disable(tty, -1);
377 tty->driver_data = NULL; 479 tty->driver_data = NULL;
378 } 480 }
379 up(&line->sem); 481 spin_unlock_irq(&line->lock);
380} 482}
381 483
382void close_lines(struct line *lines, int nlines) 484void close_lines(struct line *lines, int nlines)
@@ -387,31 +489,41 @@ void close_lines(struct line *lines, int nlines)
387 close_chan(&lines[i].chan_list); 489 close_chan(&lines[i].chan_list);
388} 490}
389 491
390int line_setup(struct line *lines, int num, char *init, int all_allowed) 492/* Common setup code for both startup command line and mconsole initialization.
493 * @lines contains the the array (of size @num) to modify;
494 * @init is the setup string;
495 * @all_allowed is a boolean saying if we can setup the whole @lines
496 * at once. For instance, it will be usually true for startup init. (where we
497 * can use con=xterm) and false for mconsole.*/
498
499int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed)
391{ 500{
392 int i, n; 501 int i, n;
393 char *end; 502 char *end;
394 503
395 if(*init == '=') n = -1; 504 if(*init == '=') {
396 else { 505 /* We said con=/ssl= instead of con#=, so we are configuring all
506 * consoles at once.*/
507 n = -1;
508 } else {
397 n = simple_strtoul(init, &end, 0); 509 n = simple_strtoul(init, &end, 0);
398 if(*end != '='){ 510 if(*end != '='){
399 printk(KERN_ERR "line_setup failed to parse \"%s\"\n", 511 printk(KERN_ERR "line_setup failed to parse \"%s\"\n",
400 init); 512 init);
401 return(0); 513 return 0;
402 } 514 }
403 init = end; 515 init = end;
404 } 516 }
405 init++; 517 init++;
406 if((n >= 0) && (n >= num)){ 518
519 if (n >= (signed int) num) {
407 printk("line_setup - %d out of range ((0 ... %d) allowed)\n", 520 printk("line_setup - %d out of range ((0 ... %d) allowed)\n",
408 n, num - 1); 521 n, num - 1);
409 return(0); 522 return 0;
410 } 523 } else if (n >= 0){
411 else if (n >= 0){
412 if (lines[n].count > 0) { 524 if (lines[n].count > 0) {
413 printk("line_setup - device %d is open\n", n); 525 printk("line_setup - device %d is open\n", n);
414 return(0); 526 return 0;
415 } 527 }
416 if (lines[n].init_pri <= INIT_ONE){ 528 if (lines[n].init_pri <= INIT_ONE){
417 lines[n].init_pri = INIT_ONE; 529 lines[n].init_pri = INIT_ONE;
@@ -422,13 +534,11 @@ int line_setup(struct line *lines, int num, char *init, int all_allowed)
422 lines[n].valid = 1; 534 lines[n].valid = 1;
423 } 535 }
424 } 536 }
425 } 537 } else if(!all_allowed){
426 else if(!all_allowed){
427 printk("line_setup - can't configure all devices from " 538 printk("line_setup - can't configure all devices from "
428 "mconsole\n"); 539 "mconsole\n");
429 return(0); 540 return 0;
430 } 541 } else {
431 else {
432 for(i = 0; i < num; i++){ 542 for(i = 0; i < num; i++){
433 if(lines[i].init_pri <= INIT_ALL){ 543 if(lines[i].init_pri <= INIT_ALL){
434 lines[i].init_pri = INIT_ALL; 544 lines[i].init_pri = INIT_ALL;
@@ -440,21 +550,21 @@ int line_setup(struct line *lines, int num, char *init, int all_allowed)
440 } 550 }
441 } 551 }
442 } 552 }
443 return(1); 553 return 1;
444} 554}
445 555
446int line_config(struct line *lines, int num, char *str) 556int line_config(struct line *lines, unsigned int num, char *str)
447{ 557{
448 char *new = uml_strdup(str); 558 char *new = uml_strdup(str);
449 559
450 if(new == NULL){ 560 if(new == NULL){
451 printk("line_config - uml_strdup failed\n"); 561 printk("line_config - uml_strdup failed\n");
452 return(-ENOMEM); 562 return -ENOMEM;
453 } 563 }
454 return(!line_setup(lines, num, new, 0)); 564 return !line_setup(lines, num, new, 0);
455} 565}
456 566
457int line_get_config(char *name, struct line *lines, int num, char *str, 567int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
458 int size, char **error_out) 568 int size, char **error_out)
459{ 569{
460 struct line *line; 570 struct line *line;
@@ -464,47 +574,33 @@ int line_get_config(char *name, struct line *lines, int num, char *str,
464 dev = simple_strtoul(name, &end, 0); 574 dev = simple_strtoul(name, &end, 0);
465 if((*end != '\0') || (end == name)){ 575 if((*end != '\0') || (end == name)){
466 *error_out = "line_get_config failed to parse device number"; 576 *error_out = "line_get_config failed to parse device number";
467 return(0); 577 return 0;
468 } 578 }
469 579
470 if((dev < 0) || (dev >= num)){ 580 if((dev < 0) || (dev >= num)){
471 *error_out = "device number of of range"; 581 *error_out = "device number out of range";
472 return(0); 582 return 0;
473 } 583 }
474 584
475 line = &lines[dev]; 585 line = &lines[dev];
476 586
477 down(&line->sem); 587 spin_lock(&line->lock);
478 if(!line->valid) 588 if(!line->valid)
479 CONFIG_CHUNK(str, size, n, "none", 1); 589 CONFIG_CHUNK(str, size, n, "none", 1);
480 else if(line->count == 0) 590 else if(line->count == 0)
481 CONFIG_CHUNK(str, size, n, line->init_str, 1); 591 CONFIG_CHUNK(str, size, n, line->init_str, 1);
482 else n = chan_config_string(&line->chan_list, str, size, error_out); 592 else n = chan_config_string(&line->chan_list, str, size, error_out);
483 up(&line->sem); 593 spin_unlock(&line->lock);
484 594
485 return(n); 595 return n;
486} 596}
487 597
488int line_remove(struct line *lines, int num, char *str) 598int line_remove(struct line *lines, unsigned int num, char *str)
489{ 599{
490 char config[sizeof("conxxxx=none\0")]; 600 char config[sizeof("conxxxx=none\0")];
491 601
492 sprintf(config, "%s=none", str); 602 sprintf(config, "%s=none", str);
493 return(!line_setup(lines, num, config, 0)); 603 return !line_setup(lines, num, config, 0);
494}
495
496int line_write_room(struct tty_struct *tty)
497{
498 struct line *dev = tty->driver_data;
499 int room;
500
501 if (tty->stopped)
502 return 0;
503 room = write_room(dev);
504 if (0 == room)
505 printk(KERN_DEBUG "%s: %s: no room left in buffer\n",
506 __FUNCTION__,tty->name);
507 return room;
508} 604}
509 605
510struct tty_driver *line_register_devfs(struct lines *set, 606struct tty_driver *line_register_devfs(struct lines *set,
@@ -553,7 +649,7 @@ void lines_init(struct line *lines, int nlines)
553 for(i = 0; i < nlines; i++){ 649 for(i = 0; i < nlines; i++){
554 line = &lines[i]; 650 line = &lines[i];
555 INIT_LIST_HEAD(&line->chan_list); 651 INIT_LIST_HEAD(&line->chan_list);
556 sema_init(&line->sem, 1); 652 spin_lock_init(&line->lock);
557 if(line->init_str != NULL){ 653 if(line->init_str != NULL){
558 line->init_str = uml_strdup(line->init_str); 654 line->init_str = uml_strdup(line->init_str);
559 if(line->init_str == NULL) 655 if(line->init_str == NULL)
@@ -587,7 +683,7 @@ irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused)
587 "errno = %d\n", -err); 683 "errno = %d\n", -err);
588 printk("fd %d is losing SIGWINCH support\n", 684 printk("fd %d is losing SIGWINCH support\n",
589 winch->tty_fd); 685 winch->tty_fd);
590 return(IRQ_HANDLED); 686 return IRQ_HANDLED;
591 } 687 }
592 goto out; 688 goto out;
593 } 689 }
@@ -603,7 +699,7 @@ irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused)
603 out: 699 out:
604 if(winch->fd != -1) 700 if(winch->fd != -1)
605 reactivate_fd(winch->fd, WINCH_IRQ); 701 reactivate_fd(winch->fd, WINCH_IRQ);
606 return(IRQ_HANDLED); 702 return IRQ_HANDLED;
607} 703}
608 704
609DECLARE_MUTEX(winch_handler_sem); 705DECLARE_MUTEX(winch_handler_sem);
@@ -625,7 +721,7 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty)
625 .pid = pid, 721 .pid = pid,
626 .tty = tty }); 722 .tty = tty });
627 list_add(&winch->list, &winch_handlers); 723 list_add(&winch->list, &winch_handlers);
628 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, 724 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
629 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM, 725 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM,
630 "winch", winch) < 0) 726 "winch", winch) < 0)
631 printk("register_winch_irq - failed to register IRQ\n"); 727 printk("register_winch_irq - failed to register IRQ\n");
@@ -656,26 +752,16 @@ char *add_xterm_umid(char *base)
656 int len; 752 int len;
657 753
658 umid = get_umid(1); 754 umid = get_umid(1);
659 if(umid == NULL) return(base); 755 if(umid == NULL)
756 return base;
660 757
661 len = strlen(base) + strlen(" ()") + strlen(umid) + 1; 758 len = strlen(base) + strlen(" ()") + strlen(umid) + 1;
662 title = kmalloc(len, GFP_KERNEL); 759 title = kmalloc(len, GFP_KERNEL);
663 if(title == NULL){ 760 if(title == NULL){
664 printk("Failed to allocate buffer for xterm title\n"); 761 printk("Failed to allocate buffer for xterm title\n");
665 return(base); 762 return base;
666 } 763 }
667 764
668 snprintf(title, len, "%s (%s)", base, umid); 765 snprintf(title, len, "%s (%s)", base, umid);
669 return(title); 766 return title;
670} 767}
671
672/*
673 * Overrides for Emacs so that we follow Linus's tabbing style.
674 * Emacs will notice this stuff at the end of the file and automatically
675 * adjust the settings for this buffer only. This must remain at the end
676 * of the file.
677 * ---------------------------------------------------------------------------
678 * Local variables:
679 * c-file-style: "linux"
680 * End:
681 */
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index c5839c3141f8..a2bac429f3d4 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -107,11 +107,6 @@ int ssl_open(struct tty_struct *tty, struct file *filp)
107} 107}
108 108
109#if 0 109#if 0
110static int ssl_chars_in_buffer(struct tty_struct *tty)
111{
112 return(0);
113}
114
115static void ssl_flush_buffer(struct tty_struct *tty) 110static void ssl_flush_buffer(struct tty_struct *tty)
116{ 111{
117 return; 112 return;
@@ -149,11 +144,11 @@ static struct tty_operations ssl_ops = {
149 .put_char = line_put_char, 144 .put_char = line_put_char,
150 .write_room = line_write_room, 145 .write_room = line_write_room,
151 .chars_in_buffer = line_chars_in_buffer, 146 .chars_in_buffer = line_chars_in_buffer,
147 .flush_buffer = line_flush_buffer,
148 .flush_chars = line_flush_chars,
152 .set_termios = line_set_termios, 149 .set_termios = line_set_termios,
153 .ioctl = line_ioctl, 150 .ioctl = line_ioctl,
154#if 0 151#if 0
155 .flush_chars = ssl_flush_chars,
156 .flush_buffer = ssl_flush_buffer,
157 .throttle = ssl_throttle, 152 .throttle = ssl_throttle,
158 .unthrottle = ssl_unthrottle, 153 .unthrottle = ssl_unthrottle,
159 .stop = ssl_stop, 154 .stop = ssl_stop,
@@ -171,10 +166,11 @@ static void ssl_console_write(struct console *c, const char *string,
171 unsigned len) 166 unsigned len)
172{ 167{
173 struct line *line = &serial_lines[c->index]; 168 struct line *line = &serial_lines[c->index];
169 unsigned long flags;
174 170
175 down(&line->sem); 171 spin_lock_irqsave(&line->lock, flags);
176 console_write_chan(&line->chan_list, string, len); 172 console_write_chan(&line->chan_list, string, len);
177 up(&line->sem); 173 spin_unlock_irqrestore(&line->lock, flags);
178} 174}
179 175
180static struct tty_driver *ssl_console_device(struct console *c, int *index) 176static struct tty_driver *ssl_console_device(struct console *c, int *index)
@@ -238,14 +234,3 @@ static int ssl_chan_setup(char *str)
238 234
239__setup("ssl", ssl_chan_setup); 235__setup("ssl", ssl_chan_setup);
240__channel_help(ssl_chan_setup, "ssl"); 236__channel_help(ssl_chan_setup, "ssl");
241
242/*
243 * Overrides for Emacs so that we follow Linus's tabbing style.
244 * Emacs will notice this stuff at the end of the file and automatically
245 * adjust the settings for this buffer only. This must remain at the end
246 * of the file.
247 * ---------------------------------------------------------------------------
248 * Local variables:
249 * c-file-style: "linux"
250 * End:
251 */
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index e604d7c87695..361d0be342b3 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -116,8 +116,11 @@ static struct tty_operations console_ops = {
116 .open = con_open, 116 .open = con_open,
117 .close = line_close, 117 .close = line_close,
118 .write = line_write, 118 .write = line_write,
119 .put_char = line_put_char,
119 .write_room = line_write_room, 120 .write_room = line_write_room,
120 .chars_in_buffer = line_chars_in_buffer, 121 .chars_in_buffer = line_chars_in_buffer,
122 .flush_buffer = line_flush_buffer,
123 .flush_chars = line_flush_chars,
121 .set_termios = line_set_termios, 124 .set_termios = line_set_termios,
122 .ioctl = line_ioctl, 125 .ioctl = line_ioctl,
123}; 126};
@@ -126,10 +129,11 @@ static void uml_console_write(struct console *console, const char *string,
126 unsigned len) 129 unsigned len)
127{ 130{
128 struct line *line = &vts[console->index]; 131 struct line *line = &vts[console->index];
132 unsigned long flags;
129 133
130 down(&line->sem); 134 spin_lock_irqsave(&line->lock, flags);
131 console_write_chan(&line->chan_list, string, len); 135 console_write_chan(&line->chan_list, string, len);
132 up(&line->sem); 136 spin_unlock_irqrestore(&line->lock, flags);
133} 137}
134 138
135static struct tty_driver *uml_console_device(struct console *c, int *index) 139static struct tty_driver *uml_console_device(struct console *c, int *index)
@@ -192,14 +196,3 @@ static int console_chan_setup(char *str)
192} 196}
193__setup("con", console_chan_setup); 197__setup("con", console_chan_setup);
194__channel_help(console_chan_setup, "con"); 198__channel_help(console_chan_setup, "con");
195
196/*
197 * Overrides for Emacs so that we follow Linus's tabbing style.
198 * Emacs will notice this stuff at the end of the file and automatically
199 * adjust the settings for this buffer only. This must remain at the end
200 * of the file.
201 * ---------------------------------------------------------------------------
202 * Local variables:
203 * c-file-style: "linux"
204 * End:
205 */
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 4d8b165bfa48..9a56ff94308d 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -156,6 +156,7 @@ static struct gendisk *fake_gendisk[MAX_DEV];
156static struct openflags global_openflags = OPEN_FLAGS; 156static struct openflags global_openflags = OPEN_FLAGS;
157 157
158struct cow { 158struct cow {
159 /* This is the backing file, actually */
159 char *file; 160 char *file;
160 int fd; 161 int fd;
161 unsigned long *bitmap; 162 unsigned long *bitmap;
@@ -927,10 +928,14 @@ static int ubd_open(struct inode *inode, struct file *filp)
927 } 928 }
928 } 929 }
929 dev->count++; 930 dev->count++;
930 if((filp->f_mode & FMODE_WRITE) && !dev->openflags.w){ 931 set_disk_ro(disk, !dev->openflags.w);
932
933 /* This should no more be needed. And it didn't work anyway to exclude
934 * read-write remounting of filesystems.*/
935 /*if((filp->f_mode & FMODE_WRITE) && !dev->openflags.w){
931 if(--dev->count == 0) ubd_close(dev); 936 if(--dev->count == 0) ubd_close(dev);
932 err = -EROFS; 937 err = -EROFS;
933 } 938 }*/
934 out: 939 out:
935 return(err); 940 return(err);
936} 941}
@@ -1096,6 +1101,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
1096 1101
1097 if(req->rq_status == RQ_INACTIVE) return(1); 1102 if(req->rq_status == RQ_INACTIVE) return(1);
1098 1103
1104 /* This should be impossible now */
1099 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ 1105 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){
1100 printk("Write attempted on readonly ubd device %s\n", 1106 printk("Write attempted on readonly ubd device %s\n",
1101 disk->disk_name); 1107 disk->disk_name);
@@ -1243,6 +1249,7 @@ static int ubd_check_remapped(int fd, unsigned long address, int is_write,
1243 1249
1244 /* It's a write to a ubd device */ 1250 /* It's a write to a ubd device */
1245 1251
1252 /* This should be impossible now */
1246 if(!dev->openflags.w){ 1253 if(!dev->openflags.w){
1247 /* It's a write access on a read-only device - probably 1254 /* It's a write access on a read-only device - probably
1248 * shouldn't happen. If the kernel is trying to change 1255 * shouldn't happen. If the kernel is trying to change
@@ -1605,8 +1612,7 @@ void do_io(struct io_thread_req *req)
1605 } 1612 }
1606 } while((n < len) && (n != 0)); 1613 } while((n < len) && (n != 0));
1607 if (n < len) memset(&buf[n], 0, len - n); 1614 if (n < len) memset(&buf[n], 0, len - n);
1608 } 1615 } else {
1609 else {
1610 n = os_write_file(req->fds[bit], buf, len); 1616 n = os_write_file(req->fds[bit], buf, len);
1611 if(n != len){ 1617 if(n != len){
1612 printk("do_io - write failed err = %d " 1618 printk("do_io - write failed err = %d "
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 6d81ecc17be5..4c5e92c04ccb 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -10,7 +10,7 @@
10#include "linux/workqueue.h" 10#include "linux/workqueue.h"
11#include "linux/tty.h" 11#include "linux/tty.h"
12#include "linux/interrupt.h" 12#include "linux/interrupt.h"
13#include "asm/semaphore.h" 13#include "linux/spinlock.h"
14#include "chan_user.h" 14#include "chan_user.h"
15#include "mconsole_kern.h" 15#include "mconsole_kern.h"
16 16
@@ -37,10 +37,18 @@ struct line {
37 struct list_head chan_list; 37 struct list_head chan_list;
38 int valid; 38 int valid;
39 int count; 39 int count;
40 struct semaphore sem; 40 /*This lock is actually, mostly, local to*/
41 spinlock_t lock;
42
43 /* Yes, this is a real circular buffer.
44 * XXX: And this should become a struct kfifo!
45 *
46 * buffer points to a buffer allocated on demand, of length
47 * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
41 char *buffer; 48 char *buffer;
42 char *head; 49 char *head;
43 char *tail; 50 char *tail;
51
44 int sigio; 52 int sigio;
45 struct work_struct task; 53 struct work_struct task;
46 struct line_driver *driver; 54 struct line_driver *driver;
@@ -52,7 +60,6 @@ struct line {
52 init_pri : INIT_STATIC, \ 60 init_pri : INIT_STATIC, \
53 chan_list : { }, \ 61 chan_list : { }, \
54 valid : 1, \ 62 valid : 1, \
55 sem : { }, \
56 buffer : NULL, \ 63 buffer : NULL, \
57 head : NULL, \ 64 head : NULL, \
58 tail : NULL, \ 65 tail : NULL, \
@@ -69,15 +76,18 @@ struct lines {
69extern void line_close(struct tty_struct *tty, struct file * filp); 76extern void line_close(struct tty_struct *tty, struct file * filp);
70extern int line_open(struct line *lines, struct tty_struct *tty, 77extern int line_open(struct line *lines, struct tty_struct *tty,
71 struct chan_opts *opts); 78 struct chan_opts *opts);
72extern int line_setup(struct line *lines, int num, char *init, 79extern int line_setup(struct line *lines, unsigned int sizeof_lines, char *init,
73 int all_allowed); 80 int all_allowed);
74extern int line_write(struct tty_struct *tty, const unsigned char *buf, int len); 81extern int line_write(struct tty_struct *tty, const unsigned char *buf, int len);
75extern void line_put_char(struct tty_struct *tty, unsigned char ch); 82extern void line_put_char(struct tty_struct *tty, unsigned char ch);
76extern void line_set_termios(struct tty_struct *tty, struct termios * old); 83extern void line_set_termios(struct tty_struct *tty, struct termios * old);
77extern int line_chars_in_buffer(struct tty_struct *tty); 84extern int line_chars_in_buffer(struct tty_struct *tty);
85extern void line_flush_buffer(struct tty_struct *tty);
86extern void line_flush_chars(struct tty_struct *tty);
78extern int line_write_room(struct tty_struct *tty); 87extern int line_write_room(struct tty_struct *tty);
79extern int line_ioctl(struct tty_struct *tty, struct file * file, 88extern int line_ioctl(struct tty_struct *tty, struct file * file,
80 unsigned int cmd, unsigned long arg); 89 unsigned int cmd, unsigned long arg);
90
81extern char *add_xterm_umid(char *base); 91extern char *add_xterm_umid(char *base);
82extern int line_setup_irq(int fd, int input, int output, struct tty_struct *tty); 92extern int line_setup_irq(int fd, int input, int output, struct tty_struct *tty);
83extern void line_close_chan(struct line *line); 93extern void line_close_chan(struct line *line);
@@ -89,20 +99,10 @@ extern struct tty_driver * line_register_devfs(struct lines *set,
89 int nlines); 99 int nlines);
90extern void lines_init(struct line *lines, int nlines); 100extern void lines_init(struct line *lines, int nlines);
91extern void close_lines(struct line *lines, int nlines); 101extern void close_lines(struct line *lines, int nlines);
92extern int line_config(struct line *lines, int num, char *str); 102
93extern int line_remove(struct line *lines, int num, char *str); 103extern int line_config(struct line *lines, unsigned int sizeof_lines, char *str);
94extern int line_get_config(char *dev, struct line *lines, int num, char *str, 104extern int line_remove(struct line *lines, unsigned int sizeof_lines, char *str);
105extern int line_get_config(char *dev, struct line *lines, unsigned int sizeof_lines, char *str,
95 int size, char **error_out); 106 int size, char **error_out);
96 107
97#endif 108#endif
98
99/*
100 * Overrides for Emacs so that we follow Linus's tabbing style.
101 * Emacs will notice this stuff at the end of the file and automatically
102 * adjust the settings for this buffer only. This must remain at the end
103 * of the file.
104 * ---------------------------------------------------------------------------
105 * Local variables:
106 * c-file-style: "linux"
107 * End:
108 */
diff --git a/arch/um/include/sysdep-i386/syscalls.h b/arch/um/include/sysdep-i386/syscalls.h
index 5db81ec9087d..be0a3e3469eb 100644
--- a/arch/um/include/sysdep-i386/syscalls.h
+++ b/arch/um/include/sysdep-i386/syscalls.h
@@ -22,102 +22,3 @@ extern syscall_handler_t old_mmap_i386;
22extern long sys_mmap2(unsigned long addr, unsigned long len, 22extern long sys_mmap2(unsigned long addr, unsigned long len,
23 unsigned long prot, unsigned long flags, 23 unsigned long prot, unsigned long flags,
24 unsigned long fd, unsigned long pgoff); 24 unsigned long fd, unsigned long pgoff);
25
26/* On i386 they choose a meaningless naming.*/
27#define __NR_kexec_load __NR_sys_kexec_load
28
29#define ARCH_SYSCALLS \
30 [ __NR_waitpid ] = (syscall_handler_t *) sys_waitpid, \
31 [ __NR_break ] = (syscall_handler_t *) sys_ni_syscall, \
32 [ __NR_oldstat ] = (syscall_handler_t *) sys_stat, \
33 [ __NR_umount ] = (syscall_handler_t *) sys_oldumount, \
34 [ __NR_stime ] = um_stime, \
35 [ __NR_oldfstat ] = (syscall_handler_t *) sys_fstat, \
36 [ __NR_stty ] = (syscall_handler_t *) sys_ni_syscall, \
37 [ __NR_gtty ] = (syscall_handler_t *) sys_ni_syscall, \
38 [ __NR_nice ] = (syscall_handler_t *) sys_nice, \
39 [ __NR_ftime ] = (syscall_handler_t *) sys_ni_syscall, \
40 [ __NR_prof ] = (syscall_handler_t *) sys_ni_syscall, \
41 [ __NR_signal ] = (syscall_handler_t *) sys_signal, \
42 [ __NR_lock ] = (syscall_handler_t *) sys_ni_syscall, \
43 [ __NR_mpx ] = (syscall_handler_t *) sys_ni_syscall, \
44 [ __NR_ulimit ] = (syscall_handler_t *) sys_ni_syscall, \
45 [ __NR_oldolduname ] = (syscall_handler_t *) sys_olduname, \
46 [ __NR_sigaction ] = (syscall_handler_t *) sys_sigaction, \
47 [ __NR_sgetmask ] = (syscall_handler_t *) sys_sgetmask, \
48 [ __NR_ssetmask ] = (syscall_handler_t *) sys_ssetmask, \
49 [ __NR_sigsuspend ] = (syscall_handler_t *) sys_sigsuspend, \
50 [ __NR_sigpending ] = (syscall_handler_t *) sys_sigpending, \
51 [ __NR_oldlstat ] = (syscall_handler_t *) sys_lstat, \
52 [ __NR_readdir ] = old_readdir, \
53 [ __NR_profil ] = (syscall_handler_t *) sys_ni_syscall, \
54 [ __NR_socketcall ] = (syscall_handler_t *) sys_socketcall, \
55 [ __NR_olduname ] = (syscall_handler_t *) sys_uname, \
56 [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
57 [ __NR_idle ] = (syscall_handler_t *) sys_ni_syscall, \
58 [ __NR_ipc ] = (syscall_handler_t *) sys_ipc, \
59 [ __NR_sigreturn ] = (syscall_handler_t *) sys_sigreturn, \
60 [ __NR_sigprocmask ] = (syscall_handler_t *) sys_sigprocmask, \
61 [ __NR_bdflush ] = (syscall_handler_t *) sys_bdflush, \
62 [ __NR__llseek ] = (syscall_handler_t *) sys_llseek, \
63 [ __NR__newselect ] = (syscall_handler_t *) sys_select, \
64 [ __NR_vm86 ] = (syscall_handler_t *) sys_ni_syscall, \
65 [ __NR_mmap ] = (syscall_handler_t *) old_mmap_i386, \
66 [ __NR_ugetrlimit ] = (syscall_handler_t *) sys_getrlimit, \
67 [ __NR_mmap2 ] = (syscall_handler_t *) sys_mmap2, \
68 [ __NR_truncate64 ] = (syscall_handler_t *) sys_truncate64, \
69 [ __NR_ftruncate64 ] = (syscall_handler_t *) sys_ftruncate64, \
70 [ __NR_stat64 ] = (syscall_handler_t *) sys_stat64, \
71 [ __NR_lstat64 ] = (syscall_handler_t *) sys_lstat64, \
72 [ __NR_fstat64 ] = (syscall_handler_t *) sys_fstat64, \
73 [ __NR_fcntl64 ] = (syscall_handler_t *) sys_fcntl64, \
74 [ __NR_sendfile64 ] = (syscall_handler_t *) sys_sendfile64, \
75 [ __NR_statfs64 ] = (syscall_handler_t *) sys_statfs64, \
76 [ __NR_fstatfs64 ] = (syscall_handler_t *) sys_fstatfs64, \
77 [ __NR_fadvise64_64 ] = (syscall_handler_t *) sys_fadvise64_64, \
78 [ __NR_select ] = (syscall_handler_t *) old_select, \
79 [ __NR_vm86old ] = (syscall_handler_t *) sys_ni_syscall, \
80 [ __NR_modify_ldt ] = (syscall_handler_t *) sys_modify_ldt, \
81 [ __NR_lchown32 ] = (syscall_handler_t *) sys_lchown, \
82 [ __NR_getuid32 ] = (syscall_handler_t *) sys_getuid, \
83 [ __NR_getgid32 ] = (syscall_handler_t *) sys_getgid, \
84 [ __NR_geteuid32 ] = (syscall_handler_t *) sys_geteuid, \
85 [ __NR_getegid32 ] = (syscall_handler_t *) sys_getegid, \
86 [ __NR_setreuid32 ] = (syscall_handler_t *) sys_setreuid, \
87 [ __NR_setregid32 ] = (syscall_handler_t *) sys_setregid, \
88 [ __NR_getgroups32 ] = (syscall_handler_t *) sys_getgroups, \
89 [ __NR_setgroups32 ] = (syscall_handler_t *) sys_setgroups, \
90 [ __NR_fchown32 ] = (syscall_handler_t *) sys_fchown, \
91 [ __NR_setresuid32 ] = (syscall_handler_t *) sys_setresuid, \
92 [ __NR_getresuid32 ] = (syscall_handler_t *) sys_getresuid, \
93 [ __NR_setresgid32 ] = (syscall_handler_t *) sys_setresgid, \
94 [ __NR_getresgid32 ] = (syscall_handler_t *) sys_getresgid, \
95 [ __NR_chown32 ] = (syscall_handler_t *) sys_chown, \
96 [ __NR_setuid32 ] = (syscall_handler_t *) sys_setuid, \
97 [ __NR_setgid32 ] = (syscall_handler_t *) sys_setgid, \
98 [ __NR_setfsuid32 ] = (syscall_handler_t *) sys_setfsuid, \
99 [ __NR_setfsgid32 ] = (syscall_handler_t *) sys_setfsgid, \
100 [ __NR_pivot_root ] = (syscall_handler_t *) sys_pivot_root, \
101 [ __NR_mincore ] = (syscall_handler_t *) sys_mincore, \
102 [ __NR_madvise ] = (syscall_handler_t *) sys_madvise, \
103 [ 222 ] = (syscall_handler_t *) sys_ni_syscall, \
104 [ 223 ] = (syscall_handler_t *) sys_ni_syscall, \
105 [ __NR_set_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
106 [ __NR_get_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
107 [ 251 ] = (syscall_handler_t *) sys_ni_syscall, \
108 [ 285 ] = (syscall_handler_t *) sys_ni_syscall,
109
110/* 222 doesn't yet have a name in include/asm-i386/unistd.h */
111
112#define LAST_ARCH_SYSCALL 285
113
114/*
115 * Overrides for Emacs so that we follow Linus's tabbing style.
116 * Emacs will notice this stuff at the end of the file and automatically
117 * adjust the settings for this buffer only. This must remain at the end
118 * of the file.
119 * ---------------------------------------------------------------------------
120 * Local variables:
121 * c-file-style: "linux"
122 * End:
123 */
diff --git a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/include/sysdep-x86_64/syscalls.h
index b187a4157ff3..67923cca5691 100644
--- a/arch/um/include/sysdep-x86_64/syscalls.h
+++ b/arch/um/include/sysdep-x86_64/syscalls.h
@@ -26,66 +26,9 @@ extern syscall_handler_t *ia32_sys_call_table[];
26extern long old_mmap(unsigned long addr, unsigned long len, 26extern long old_mmap(unsigned long addr, unsigned long len,
27 unsigned long prot, unsigned long flags, 27 unsigned long prot, unsigned long flags,
28 unsigned long fd, unsigned long pgoff); 28 unsigned long fd, unsigned long pgoff);
29extern syscall_handler_t wrap_sys_shmat;
30extern syscall_handler_t sys_modify_ldt; 29extern syscall_handler_t sys_modify_ldt;
31extern syscall_handler_t sys_arch_prctl; 30extern syscall_handler_t sys_arch_prctl;
32 31
33#define ARCH_SYSCALLS \ 32#define NR_syscalls (__NR_syscall_max + 1)
34 [ __NR_mmap ] = (syscall_handler_t *) old_mmap, \
35 [ __NR_select ] = (syscall_handler_t *) sys_select, \
36 [ __NR_mincore ] = (syscall_handler_t *) sys_mincore, \
37 [ __NR_madvise ] = (syscall_handler_t *) sys_madvise, \
38 [ __NR_shmget ] = (syscall_handler_t *) sys_shmget, \
39 [ __NR_shmat ] = (syscall_handler_t *) wrap_sys_shmat, \
40 [ __NR_shmctl ] = (syscall_handler_t *) sys_shmctl, \
41 [ __NR_semop ] = (syscall_handler_t *) sys_semop, \
42 [ __NR_semget ] = (syscall_handler_t *) sys_semget, \
43 [ __NR_semctl ] = (syscall_handler_t *) sys_semctl, \
44 [ __NR_shmdt ] = (syscall_handler_t *) sys_shmdt, \
45 [ __NR_msgget ] = (syscall_handler_t *) sys_msgget, \
46 [ __NR_msgsnd ] = (syscall_handler_t *) sys_msgsnd, \
47 [ __NR_msgrcv ] = (syscall_handler_t *) sys_msgrcv, \
48 [ __NR_msgctl ] = (syscall_handler_t *) sys_msgctl, \
49 [ __NR_pivot_root ] = (syscall_handler_t *) sys_pivot_root, \
50 [ __NR_tuxcall ] = (syscall_handler_t *) sys_ni_syscall, \
51 [ __NR_security ] = (syscall_handler_t *) sys_ni_syscall, \
52 [ __NR_epoll_ctl_old ] = (syscall_handler_t *) sys_ni_syscall, \
53 [ __NR_epoll_wait_old ] = (syscall_handler_t *) sys_ni_syscall, \
54 [ __NR_modify_ldt ] = (syscall_handler_t *) sys_modify_ldt, \
55 [ __NR_arch_prctl ] = (syscall_handler_t *) sys_arch_prctl, \
56 [ __NR_socket ] = (syscall_handler_t *) sys_socket, \
57 [ __NR_connect ] = (syscall_handler_t *) sys_connect, \
58 [ __NR_accept ] = (syscall_handler_t *) sys_accept, \
59 [ __NR_recvfrom ] = (syscall_handler_t *) sys_recvfrom, \
60 [ __NR_recvmsg ] = (syscall_handler_t *) sys_recvmsg, \
61 [ __NR_sendmsg ] = (syscall_handler_t *) sys_sendmsg, \
62 [ __NR_bind ] = (syscall_handler_t *) sys_bind, \
63 [ __NR_listen ] = (syscall_handler_t *) sys_listen, \
64 [ __NR_getsockname ] = (syscall_handler_t *) sys_getsockname, \
65 [ __NR_getpeername ] = (syscall_handler_t *) sys_getpeername, \
66 [ __NR_socketpair ] = (syscall_handler_t *) sys_socketpair, \
67 [ __NR_sendto ] = (syscall_handler_t *) sys_sendto, \
68 [ __NR_shutdown ] = (syscall_handler_t *) sys_shutdown, \
69 [ __NR_setsockopt ] = (syscall_handler_t *) sys_setsockopt, \
70 [ __NR_getsockopt ] = (syscall_handler_t *) sys_getsockopt, \
71 [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
72 [ __NR_set_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
73 [ __NR_get_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
74 [ __NR_semtimedop ] = (syscall_handler_t *) sys_semtimedop, \
75 [ 251 ] = (syscall_handler_t *) sys_ni_syscall,
76
77#define LAST_ARCH_SYSCALL 251
78#define NR_syscalls 1024
79 33
80#endif 34#endif
81
82/*
83 * Overrides for Emacs so that we follow Linus's tabbing style.
84 * Emacs will notice this stuff at the end of the file and automatically
85 * adjust the settings for this buffer only. This must remain at the end
86 * of the file.
87 * ---------------------------------------------------------------------------
88 * Local variables:
89 * c-file-style: "linux"
90 * End:
91 */
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index dc796c1bf39e..246f0e7fb4cc 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -10,7 +10,7 @@ obj-y = checksum.o config.o exec_kern.o exitcode.o \
10 helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \ 10 helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \
11 physmem.o process.o process_kern.o ptrace.o reboot.o resource.o \ 11 physmem.o process.o process_kern.o ptrace.o reboot.o resource.o \
12 sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \ 12 sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \
13 syscall_kern.o sysrq.o sys_call_table.o tempfile.o time.o time_kern.o \ 13 syscall_kern.o sysrq.o tempfile.o time.o time_kern.o \
14 tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o umid.o \ 14 tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o umid.o \
15 user_util.o 15 user_util.o
16 16
@@ -53,6 +53,7 @@ quiet_cmd_quote2 = QUOTE $@
53 cmd_quote2 = sed -e '/CONFIG/{' \ 53 cmd_quote2 = sed -e '/CONFIG/{' \
54 -e 's/"CONFIG"\;/""/' \ 54 -e 's/"CONFIG"\;/""/' \
55 -e 'r $(obj)/config.tmp' \ 55 -e 'r $(obj)/config.tmp' \
56 -e 'a""\;' \ 56 -e 'a \' \
57 -e '""\;' \
57 -e '}' \ 58 -e '}' \
58 $< > $@ 59 $< > $@
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
index 1d719d5b4bb9..7a943696f950 100644
--- a/arch/um/kernel/process_kern.c
+++ b/arch/um/kernel/process_kern.c
@@ -161,10 +161,6 @@ void *get_current(void)
161 return(current); 161 return(current);
162} 162}
163 163
164void prepare_to_copy(struct task_struct *tsk)
165{
166}
167
168int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 164int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
169 unsigned long stack_top, struct task_struct * p, 165 unsigned long stack_top, struct task_struct * p,
170 struct pt_regs *regs) 166 struct pt_regs *regs)
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 3a99ee6d94eb..e50e60ff5d27 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -143,7 +143,7 @@ long sys_ptrace(long request, long pid, long addr, long data)
143 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ 143 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
144 case PTRACE_CONT: { /* restart after signal. */ 144 case PTRACE_CONT: { /* restart after signal. */
145 ret = -EIO; 145 ret = -EIO;
146 if ((unsigned long) data > _NSIG) 146 if (!valid_signal(data))
147 break; 147 break;
148 148
149 child->ptrace &= ~PT_DTRACE; 149 child->ptrace &= ~PT_DTRACE;
@@ -179,7 +179,7 @@ long sys_ptrace(long request, long pid, long addr, long data)
179 179
180 case PTRACE_SINGLESTEP: { /* set the trap flag. */ 180 case PTRACE_SINGLESTEP: { /* set the trap flag. */
181 ret = -EIO; 181 ret = -EIO;
182 if ((unsigned long) data > _NSIG) 182 if (!valid_signal(data))
183 break; 183 break;
184 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 184 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
185 child->ptrace |= PT_DTRACE; 185 child->ptrace |= PT_DTRACE;
diff --git a/arch/um/kernel/skas/include/uaccess-skas.h b/arch/um/kernel/skas/include/uaccess-skas.h
index 11986c9b9ddf..c35620385da0 100644
--- a/arch/um/kernel/skas/include/uaccess-skas.h
+++ b/arch/um/kernel/skas/include/uaccess-skas.h
@@ -18,7 +18,7 @@
18 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \ 18 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
19 ((unsigned long) (addr) + (size) >= (unsigned long)(addr)))) 19 ((unsigned long) (addr) + (size) >= (unsigned long)(addr))))
20 20
21static inline int verify_area_skas(int type, const void * addr, 21static inline int __deprecated verify_area_skas(int type, const void * addr,
22 unsigned long size) 22 unsigned long size)
23{ 23{
24 return(access_ok_skas(type, addr, size) ? 0 : -EFAULT); 24 return(access_ok_skas(type, addr, size) ? 0 : -EFAULT);
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 7575ec489b63..f7da9d027672 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -3,6 +3,7 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/compiler.h"
6#include "linux/stddef.h" 7#include "linux/stddef.h"
7#include "linux/kernel.h" 8#include "linux/kernel.h"
8#include "linux/string.h" 9#include "linux/string.h"
@@ -61,8 +62,7 @@ static void do_buffer_op(void *jmpbuf, void *arg_ptr)
61 void *arg; 62 void *arg;
62 int *res; 63 int *res;
63 64
64 /* Some old gccs recognize __va_copy, but not va_copy */ 65 va_copy(args, *(va_list *)arg_ptr);
65 __va_copy(args, *(va_list *)arg_ptr);
66 addr = va_arg(args, unsigned long); 66 addr = va_arg(args, unsigned long);
67 len = va_arg(args, int); 67 len = va_arg(args, int);
68 is_write = va_arg(args, int); 68 is_write = va_arg(args, int);
diff --git a/arch/um/kernel/sys_call_table.c b/arch/um/kernel/sys_call_table.c
deleted file mode 100644
index 7fc06c85b29d..000000000000
--- a/arch/um/kernel/sys_call_table.c
+++ /dev/null
@@ -1,276 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
6
7#include "linux/config.h"
8#include "linux/unistd.h"
9#include "linux/sys.h"
10#include "linux/swap.h"
11#include "linux/syscalls.h"
12#include "linux/sysctl.h"
13#include "asm/signal.h"
14#include "sysdep/syscalls.h"
15#include "kern_util.h"
16
17#ifdef CONFIG_NFSD
18#define NFSSERVCTL sys_nfsservctl
19#else
20#define NFSSERVCTL sys_ni_syscall
21#endif
22
23#define LAST_GENERIC_SYSCALL __NR_keyctl
24
25#if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL
26#define LAST_SYSCALL LAST_GENERIC_SYSCALL
27#else
28#define LAST_SYSCALL LAST_ARCH_SYSCALL
29#endif
30
31extern syscall_handler_t sys_fork;
32extern syscall_handler_t sys_execve;
33extern syscall_handler_t um_time;
34extern syscall_handler_t um_stime;
35extern syscall_handler_t sys_pipe;
36extern syscall_handler_t sys_olduname;
37extern syscall_handler_t sys_sigaction;
38extern syscall_handler_t sys_sigsuspend;
39extern syscall_handler_t old_readdir;
40extern syscall_handler_t sys_uname;
41extern syscall_handler_t sys_ipc;
42extern syscall_handler_t sys_sigreturn;
43extern syscall_handler_t sys_clone;
44extern syscall_handler_t sys_rt_sigreturn;
45extern syscall_handler_t sys_sigaltstack;
46extern syscall_handler_t sys_vfork;
47extern syscall_handler_t old_select;
48extern syscall_handler_t sys_modify_ldt;
49extern syscall_handler_t sys_rt_sigsuspend;
50extern syscall_handler_t sys_mbind;
51extern syscall_handler_t sys_get_mempolicy;
52extern syscall_handler_t sys_set_mempolicy;
53extern syscall_handler_t sys_sys_setaltroot;
54
55syscall_handler_t *sys_call_table[] = {
56 [ __NR_restart_syscall ] = (syscall_handler_t *) sys_restart_syscall,
57 [ __NR_exit ] = (syscall_handler_t *) sys_exit,
58 [ __NR_fork ] = (syscall_handler_t *) sys_fork,
59 [ __NR_read ] = (syscall_handler_t *) sys_read,
60 [ __NR_write ] = (syscall_handler_t *) sys_write,
61
62 /* These three are declared differently in asm/unistd.h */
63 [ __NR_open ] = (syscall_handler_t *) sys_open,
64 [ __NR_close ] = (syscall_handler_t *) sys_close,
65 [ __NR_creat ] = (syscall_handler_t *) sys_creat,
66 [ __NR_link ] = (syscall_handler_t *) sys_link,
67 [ __NR_unlink ] = (syscall_handler_t *) sys_unlink,
68 [ __NR_execve ] = (syscall_handler_t *) sys_execve,
69
70 /* declared differently in kern_util.h */
71 [ __NR_chdir ] = (syscall_handler_t *) sys_chdir,
72 [ __NR_time ] = um_time,
73 [ __NR_mknod ] = (syscall_handler_t *) sys_mknod,
74 [ __NR_chmod ] = (syscall_handler_t *) sys_chmod,
75 [ __NR_lchown ] = (syscall_handler_t *) sys_lchown16,
76 [ __NR_lseek ] = (syscall_handler_t *) sys_lseek,
77 [ __NR_getpid ] = (syscall_handler_t *) sys_getpid,
78 [ __NR_mount ] = (syscall_handler_t *) sys_mount,
79 [ __NR_setuid ] = (syscall_handler_t *) sys_setuid16,
80 [ __NR_getuid ] = (syscall_handler_t *) sys_getuid16,
81 [ __NR_ptrace ] = (syscall_handler_t *) sys_ptrace,
82 [ __NR_alarm ] = (syscall_handler_t *) sys_alarm,
83 [ __NR_pause ] = (syscall_handler_t *) sys_pause,
84 [ __NR_utime ] = (syscall_handler_t *) sys_utime,
85 [ __NR_access ] = (syscall_handler_t *) sys_access,
86 [ __NR_sync ] = (syscall_handler_t *) sys_sync,
87 [ __NR_kill ] = (syscall_handler_t *) sys_kill,
88 [ __NR_rename ] = (syscall_handler_t *) sys_rename,
89 [ __NR_mkdir ] = (syscall_handler_t *) sys_mkdir,
90 [ __NR_rmdir ] = (syscall_handler_t *) sys_rmdir,
91
92 /* Declared differently in asm/unistd.h */
93 [ __NR_dup ] = (syscall_handler_t *) sys_dup,
94 [ __NR_pipe ] = (syscall_handler_t *) sys_pipe,
95 [ __NR_times ] = (syscall_handler_t *) sys_times,
96 [ __NR_brk ] = (syscall_handler_t *) sys_brk,
97 [ __NR_setgid ] = (syscall_handler_t *) sys_setgid16,
98 [ __NR_getgid ] = (syscall_handler_t *) sys_getgid16,
99 [ __NR_geteuid ] = (syscall_handler_t *) sys_geteuid16,
100 [ __NR_getegid ] = (syscall_handler_t *) sys_getegid16,
101 [ __NR_acct ] = (syscall_handler_t *) sys_acct,
102 [ __NR_umount2 ] = (syscall_handler_t *) sys_umount,
103 [ __NR_ioctl ] = (syscall_handler_t *) sys_ioctl,
104 [ __NR_fcntl ] = (syscall_handler_t *) sys_fcntl,
105 [ __NR_setpgid ] = (syscall_handler_t *) sys_setpgid,
106 [ __NR_umask ] = (syscall_handler_t *) sys_umask,
107 [ __NR_chroot ] = (syscall_handler_t *) sys_chroot,
108 [ __NR_ustat ] = (syscall_handler_t *) sys_ustat,
109 [ __NR_dup2 ] = (syscall_handler_t *) sys_dup2,
110 [ __NR_getppid ] = (syscall_handler_t *) sys_getppid,
111 [ __NR_getpgrp ] = (syscall_handler_t *) sys_getpgrp,
112 [ __NR_setsid ] = (syscall_handler_t *) sys_setsid,
113 [ __NR_setreuid ] = (syscall_handler_t *) sys_setreuid16,
114 [ __NR_setregid ] = (syscall_handler_t *) sys_setregid16,
115 [ __NR_sethostname ] = (syscall_handler_t *) sys_sethostname,
116 [ __NR_setrlimit ] = (syscall_handler_t *) sys_setrlimit,
117 [ __NR_getrlimit ] = (syscall_handler_t *) sys_old_getrlimit,
118 [ __NR_getrusage ] = (syscall_handler_t *) sys_getrusage,
119 [ __NR_gettimeofday ] = (syscall_handler_t *) sys_gettimeofday,
120 [ __NR_settimeofday ] = (syscall_handler_t *) sys_settimeofday,
121 [ __NR_getgroups ] = (syscall_handler_t *) sys_getgroups16,
122 [ __NR_setgroups ] = (syscall_handler_t *) sys_setgroups16,
123 [ __NR_symlink ] = (syscall_handler_t *) sys_symlink,
124 [ __NR_readlink ] = (syscall_handler_t *) sys_readlink,
125 [ __NR_uselib ] = (syscall_handler_t *) sys_uselib,
126 [ __NR_swapon ] = (syscall_handler_t *) sys_swapon,
127 [ __NR_reboot ] = (syscall_handler_t *) sys_reboot,
128 [ __NR_munmap ] = (syscall_handler_t *) sys_munmap,
129 [ __NR_truncate ] = (syscall_handler_t *) sys_truncate,
130 [ __NR_ftruncate ] = (syscall_handler_t *) sys_ftruncate,
131 [ __NR_fchmod ] = (syscall_handler_t *) sys_fchmod,
132 [ __NR_fchown ] = (syscall_handler_t *) sys_fchown16,
133 [ __NR_getpriority ] = (syscall_handler_t *) sys_getpriority,
134 [ __NR_setpriority ] = (syscall_handler_t *) sys_setpriority,
135 [ __NR_statfs ] = (syscall_handler_t *) sys_statfs,
136 [ __NR_fstatfs ] = (syscall_handler_t *) sys_fstatfs,
137 [ __NR_ioperm ] = (syscall_handler_t *) sys_ni_syscall,
138 [ __NR_syslog ] = (syscall_handler_t *) sys_syslog,
139 [ __NR_setitimer ] = (syscall_handler_t *) sys_setitimer,
140 [ __NR_getitimer ] = (syscall_handler_t *) sys_getitimer,
141 [ __NR_stat ] = (syscall_handler_t *) sys_newstat,
142 [ __NR_lstat ] = (syscall_handler_t *) sys_newlstat,
143 [ __NR_fstat ] = (syscall_handler_t *) sys_newfstat,
144 [ __NR_vhangup ] = (syscall_handler_t *) sys_vhangup,
145 [ __NR_wait4 ] = (syscall_handler_t *) sys_wait4,
146 [ __NR_swapoff ] = (syscall_handler_t *) sys_swapoff,
147 [ __NR_sysinfo ] = (syscall_handler_t *) sys_sysinfo,
148 [ __NR_fsync ] = (syscall_handler_t *) sys_fsync,
149 [ __NR_clone ] = (syscall_handler_t *) sys_clone,
150 [ __NR_setdomainname ] = (syscall_handler_t *) sys_setdomainname,
151 [ __NR_uname ] = (syscall_handler_t *) sys_newuname,
152 [ __NR_adjtimex ] = (syscall_handler_t *) sys_adjtimex,
153 [ __NR_mprotect ] = (syscall_handler_t *) sys_mprotect,
154 [ __NR_create_module ] = (syscall_handler_t *) sys_ni_syscall,
155 [ __NR_init_module ] = (syscall_handler_t *) sys_init_module,
156 [ __NR_delete_module ] = (syscall_handler_t *) sys_delete_module,
157 [ __NR_get_kernel_syms ] = (syscall_handler_t *) sys_ni_syscall,
158 [ __NR_quotactl ] = (syscall_handler_t *) sys_quotactl,
159 [ __NR_getpgid ] = (syscall_handler_t *) sys_getpgid,
160 [ __NR_fchdir ] = (syscall_handler_t *) sys_fchdir,
161 [ __NR_sysfs ] = (syscall_handler_t *) sys_sysfs,
162 [ __NR_personality ] = (syscall_handler_t *) sys_personality,
163 [ __NR_afs_syscall ] = (syscall_handler_t *) sys_ni_syscall,
164 [ __NR_setfsuid ] = (syscall_handler_t *) sys_setfsuid16,
165 [ __NR_setfsgid ] = (syscall_handler_t *) sys_setfsgid16,
166 [ __NR_getdents ] = (syscall_handler_t *) sys_getdents,
167 [ __NR_flock ] = (syscall_handler_t *) sys_flock,
168 [ __NR_msync ] = (syscall_handler_t *) sys_msync,
169 [ __NR_readv ] = (syscall_handler_t *) sys_readv,
170 [ __NR_writev ] = (syscall_handler_t *) sys_writev,
171 [ __NR_getsid ] = (syscall_handler_t *) sys_getsid,
172 [ __NR_fdatasync ] = (syscall_handler_t *) sys_fdatasync,
173 [ __NR__sysctl ] = (syscall_handler_t *) sys_sysctl,
174 [ __NR_mlock ] = (syscall_handler_t *) sys_mlock,
175 [ __NR_munlock ] = (syscall_handler_t *) sys_munlock,
176 [ __NR_mlockall ] = (syscall_handler_t *) sys_mlockall,
177 [ __NR_munlockall ] = (syscall_handler_t *) sys_munlockall,
178 [ __NR_sched_setparam ] = (syscall_handler_t *) sys_sched_setparam,
179 [ __NR_sched_getparam ] = (syscall_handler_t *) sys_sched_getparam,
180 [ __NR_sched_setscheduler ] = (syscall_handler_t *) sys_sched_setscheduler,
181 [ __NR_sched_getscheduler ] = (syscall_handler_t *) sys_sched_getscheduler,
182 [ __NR_sched_yield ] = (syscall_handler_t *) yield,
183 [ __NR_sched_get_priority_max ] = (syscall_handler_t *) sys_sched_get_priority_max,
184 [ __NR_sched_get_priority_min ] = (syscall_handler_t *) sys_sched_get_priority_min,
185 [ __NR_sched_rr_get_interval ] = (syscall_handler_t *) sys_sched_rr_get_interval,
186 [ __NR_nanosleep ] = (syscall_handler_t *) sys_nanosleep,
187 [ __NR_mremap ] = (syscall_handler_t *) sys_mremap,
188 [ __NR_setresuid ] = (syscall_handler_t *) sys_setresuid16,
189 [ __NR_getresuid ] = (syscall_handler_t *) sys_getresuid16,
190 [ __NR_query_module ] = (syscall_handler_t *) sys_ni_syscall,
191 [ __NR_poll ] = (syscall_handler_t *) sys_poll,
192 [ __NR_nfsservctl ] = (syscall_handler_t *) NFSSERVCTL,
193 [ __NR_setresgid ] = (syscall_handler_t *) sys_setresgid16,
194 [ __NR_getresgid ] = (syscall_handler_t *) sys_getresgid16,
195 [ __NR_prctl ] = (syscall_handler_t *) sys_prctl,
196 [ __NR_rt_sigreturn ] = (syscall_handler_t *) sys_rt_sigreturn,
197 [ __NR_rt_sigaction ] = (syscall_handler_t *) sys_rt_sigaction,
198 [ __NR_rt_sigprocmask ] = (syscall_handler_t *) sys_rt_sigprocmask,
199 [ __NR_rt_sigpending ] = (syscall_handler_t *) sys_rt_sigpending,
200 [ __NR_rt_sigtimedwait ] = (syscall_handler_t *) sys_rt_sigtimedwait,
201 [ __NR_rt_sigqueueinfo ] = (syscall_handler_t *) sys_rt_sigqueueinfo,
202 [ __NR_rt_sigsuspend ] = (syscall_handler_t *) sys_rt_sigsuspend,
203 [ __NR_pread64 ] = (syscall_handler_t *) sys_pread64,
204 [ __NR_pwrite64 ] = (syscall_handler_t *) sys_pwrite64,
205 [ __NR_chown ] = (syscall_handler_t *) sys_chown16,
206 [ __NR_getcwd ] = (syscall_handler_t *) sys_getcwd,
207 [ __NR_capget ] = (syscall_handler_t *) sys_capget,
208 [ __NR_capset ] = (syscall_handler_t *) sys_capset,
209 [ __NR_sigaltstack ] = (syscall_handler_t *) sys_sigaltstack,
210 [ __NR_sendfile ] = (syscall_handler_t *) sys_sendfile,
211 [ __NR_getpmsg ] = (syscall_handler_t *) sys_ni_syscall,
212 [ __NR_putpmsg ] = (syscall_handler_t *) sys_ni_syscall,
213 [ __NR_vfork ] = (syscall_handler_t *) sys_vfork,
214 [ __NR_getdents64 ] = (syscall_handler_t *) sys_getdents64,
215 [ __NR_gettid ] = (syscall_handler_t *) sys_gettid,
216 [ __NR_readahead ] = (syscall_handler_t *) sys_readahead,
217 [ __NR_setxattr ] = (syscall_handler_t *) sys_setxattr,
218 [ __NR_lsetxattr ] = (syscall_handler_t *) sys_lsetxattr,
219 [ __NR_fsetxattr ] = (syscall_handler_t *) sys_fsetxattr,
220 [ __NR_getxattr ] = (syscall_handler_t *) sys_getxattr,
221 [ __NR_lgetxattr ] = (syscall_handler_t *) sys_lgetxattr,
222 [ __NR_fgetxattr ] = (syscall_handler_t *) sys_fgetxattr,
223 [ __NR_listxattr ] = (syscall_handler_t *) sys_listxattr,
224 [ __NR_llistxattr ] = (syscall_handler_t *) sys_llistxattr,
225 [ __NR_flistxattr ] = (syscall_handler_t *) sys_flistxattr,
226 [ __NR_removexattr ] = (syscall_handler_t *) sys_removexattr,
227 [ __NR_lremovexattr ] = (syscall_handler_t *) sys_lremovexattr,
228 [ __NR_fremovexattr ] = (syscall_handler_t *) sys_fremovexattr,
229 [ __NR_tkill ] = (syscall_handler_t *) sys_tkill,
230 [ __NR_futex ] = (syscall_handler_t *) sys_futex,
231 [ __NR_sched_setaffinity ] = (syscall_handler_t *) sys_sched_setaffinity,
232 [ __NR_sched_getaffinity ] = (syscall_handler_t *) sys_sched_getaffinity,
233 [ __NR_io_setup ] = (syscall_handler_t *) sys_io_setup,
234 [ __NR_io_destroy ] = (syscall_handler_t *) sys_io_destroy,
235 [ __NR_io_getevents ] = (syscall_handler_t *) sys_io_getevents,
236 [ __NR_io_submit ] = (syscall_handler_t *) sys_io_submit,
237 [ __NR_io_cancel ] = (syscall_handler_t *) sys_io_cancel,
238 [ __NR_exit_group ] = (syscall_handler_t *) sys_exit_group,
239 [ __NR_lookup_dcookie ] = (syscall_handler_t *) sys_lookup_dcookie,
240 [ __NR_epoll_create ] = (syscall_handler_t *) sys_epoll_create,
241 [ __NR_epoll_ctl ] = (syscall_handler_t *) sys_epoll_ctl,
242 [ __NR_epoll_wait ] = (syscall_handler_t *) sys_epoll_wait,
243 [ __NR_remap_file_pages ] = (syscall_handler_t *) sys_remap_file_pages,
244 [ __NR_set_tid_address ] = (syscall_handler_t *) sys_set_tid_address,
245 [ __NR_timer_create ] = (syscall_handler_t *) sys_timer_create,
246 [ __NR_timer_settime ] = (syscall_handler_t *) sys_timer_settime,
247 [ __NR_timer_gettime ] = (syscall_handler_t *) sys_timer_gettime,
248 [ __NR_timer_getoverrun ] = (syscall_handler_t *) sys_timer_getoverrun,
249 [ __NR_timer_delete ] = (syscall_handler_t *) sys_timer_delete,
250 [ __NR_clock_settime ] = (syscall_handler_t *) sys_clock_settime,
251 [ __NR_clock_gettime ] = (syscall_handler_t *) sys_clock_gettime,
252 [ __NR_clock_getres ] = (syscall_handler_t *) sys_clock_getres,
253 [ __NR_clock_nanosleep ] = (syscall_handler_t *) sys_clock_nanosleep,
254 [ __NR_tgkill ] = (syscall_handler_t *) sys_tgkill,
255 [ __NR_utimes ] = (syscall_handler_t *) sys_utimes,
256 [ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64,
257 [ __NR_vserver ] = (syscall_handler_t *) sys_ni_syscall,
258 [ __NR_mbind ] = (syscall_handler_t *) sys_mbind,
259 [ __NR_get_mempolicy ] = (syscall_handler_t *) sys_get_mempolicy,
260 [ __NR_set_mempolicy ] = (syscall_handler_t *) sys_set_mempolicy,
261 [ __NR_mq_open ] = (syscall_handler_t *) sys_mq_open,
262 [ __NR_mq_unlink ] = (syscall_handler_t *) sys_mq_unlink,
263 [ __NR_mq_timedsend ] = (syscall_handler_t *) sys_mq_timedsend,
264 [ __NR_mq_timedreceive ] = (syscall_handler_t *) sys_mq_timedreceive,
265 [ __NR_mq_notify ] = (syscall_handler_t *) sys_mq_notify,
266 [ __NR_mq_getsetattr ] = (syscall_handler_t *) sys_mq_getsetattr,
267 [ __NR_kexec_load ] = (syscall_handler_t *) sys_ni_syscall,
268 [ __NR_waitid ] = (syscall_handler_t *) sys_waitid,
269 [ __NR_add_key ] = (syscall_handler_t *) sys_add_key,
270 [ __NR_request_key ] = (syscall_handler_t *) sys_request_key,
271 [ __NR_keyctl ] = (syscall_handler_t *) sys_keyctl,
272
273 ARCH_SYSCALLS
274 [ LAST_SYSCALL + 1 ... NR_syscalls ] =
275 (syscall_handler_t *) sys_ni_syscall
276};
diff --git a/arch/um/kernel/tt/include/uaccess-tt.h b/arch/um/kernel/tt/include/uaccess-tt.h
index f0bad010cebd..bb69d6b7d022 100644
--- a/arch/um/kernel/tt/include/uaccess-tt.h
+++ b/arch/um/kernel/tt/include/uaccess-tt.h
@@ -33,7 +33,7 @@ extern unsigned long uml_physmem;
33 (((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \ 33 (((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \
34 (under_task_size(addr, size) || is_stack(addr, size)))) 34 (under_task_size(addr, size) || is_stack(addr, size))))
35 35
36static inline int verify_area_tt(int type, const void * addr, 36static inline int __deprecated verify_area_tt(int type, const void * addr,
37 unsigned long size) 37 unsigned long size)
38{ 38{
39 return(access_ok_tt(type, addr, size) ? 0 : -EFAULT); 39 return(access_ok_tt(type, addr, size) ? 0 : -EFAULT);
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index 148645b14480..9a0ad094d926 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -105,14 +105,15 @@ void init_registers(int pid)
105 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", 105 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
106 err); 106 err);
107 107
108 errno = 0;
108 err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs); 109 err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
109 if(!err) 110 if(!err)
110 return; 111 return;
112 if(errno != EIO)
113 panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
114 errno);
111 115
112 have_fpx_regs = 0; 116 have_fpx_regs = 0;
113 if(err != EIO)
114 panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
115 err);
116 117
117 err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs); 118 err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
118 if(err) 119 if(err)
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 71b47e618605..950781e354de 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -1,5 +1,6 @@
1obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ 1obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
2 ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o 2 ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o \
3 sys_call_table.o
3 4
4obj-$(CONFIG_HIGHMEM) += highmem.o 5obj-$(CONFIG_HIGHMEM) += highmem.o
5obj-$(CONFIG_MODULES) += module.o 6obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/um/sys-i386/sys_call_table.S b/arch/um/sys-i386/sys_call_table.S
new file mode 100644
index 000000000000..ad75c27afe38
--- /dev/null
+++ b/arch/um/sys-i386/sys_call_table.S
@@ -0,0 +1,16 @@
1#include <linux/linkage.h>
2/* Steal i386 syscall table for our purposes, but with some slight changes.*/
3
4#define sys_iopl sys_ni_syscall
5#define sys_ioperm sys_ni_syscall
6
7#define sys_vm86old sys_ni_syscall
8#define sys_vm86 sys_ni_syscall
9#define sys_set_thread_area sys_ni_syscall
10#define sys_get_thread_area sys_ni_syscall
11
12#define sys_stime um_stime
13#define sys_time um_time
14#define old_mmap old_mmap_i386
15
16#include "../../i386/kernel/syscall_table.S"
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 2129e3143559..d7ed2f7908df 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -6,7 +6,7 @@
6 6
7lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ 7lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \
8 ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \ 8 ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \
9 syscalls.o sysrq.o thunk.o 9 syscalls.o sysrq.o thunk.o syscall_table.o
10 10
11USER_OBJS := ptrace_user.o sigcontext.o 11USER_OBJS := ptrace_user.o sigcontext.o
12 12
diff --git a/arch/um/sys-x86_64/syscall_table.c b/arch/um/sys-x86_64/syscall_table.c
new file mode 100644
index 000000000000..34b2e842864f
--- /dev/null
+++ b/arch/um/sys-x86_64/syscall_table.c
@@ -0,0 +1,59 @@
1/* System call table for UML/x86-64, copied from arch/x86_64/kernel/syscall.c
2 * with some changes for UML. */
3
4#include <linux/linkage.h>
5#include <linux/sys.h>
6#include <linux/cache.h>
7#include <linux/config.h>
8
9#define __NO_STUBS
10
11/* Below you can see, in terms of #define's, the differences between the x86-64
12 * and the UML syscall table. */
13
14/* Not going to be implemented by UML, since we have no hardware. */
15#define stub_iopl sys_ni_syscall
16#define sys_ioperm sys_ni_syscall
17
18/* The UML TLS problem. Note that x86_64 does not implement this, so the below
19 * is needed only for the ia32 compatibility. */
20/*#define sys_set_thread_area sys_ni_syscall
21#define sys_get_thread_area sys_ni_syscall*/
22
23/* For __NR_time. The x86-64 name hopefully will change from sys_time64 to
24 * sys_time (since the current situation is bogus). I've sent a patch to cleanup
25 * this. Remove below the obsoleted line. */
26#define sys_time64 um_time
27#define sys_time um_time
28
29/* On UML we call it this way ("old" means it's not mmap2) */
30#define sys_mmap old_mmap
31/* On x86-64 sys_uname is actually sys_newuname plus a compatibility trick.
32 * See arch/x86_64/kernel/sys_x86_64.c */
33#define sys_uname sys_uname64
34
35#define stub_clone sys_clone
36#define stub_fork sys_fork
37#define stub_vfork sys_vfork
38#define stub_execve sys_execve
39#define stub_rt_sigsuspend sys_rt_sigsuspend
40#define stub_sigaltstack sys_sigaltstack
41#define stub_rt_sigreturn sys_rt_sigreturn
42
43#define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ;
44#undef _ASM_X86_64_UNISTD_H_
45#include <asm-x86_64/unistd.h>
46
47#undef __SYSCALL
48#define __SYSCALL(nr, sym) [ nr ] = sym,
49#undef _ASM_X86_64_UNISTD_H_
50
51typedef void (*sys_call_ptr_t)(void);
52
53extern void sys_ni_syscall(void);
54
55sys_call_ptr_t sys_call_table[__NR_syscall_max+1] __cacheline_aligned = {
56 /* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */
57 [0 ... __NR_syscall_max] = &sys_ni_syscall,
58#include <asm-x86_64/unistd.h>
59};
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 68205a03364c..ab4b0abf8af3 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -14,11 +14,15 @@
14#include "asm/prctl.h" /* XXX This should get the constants from libc */ 14#include "asm/prctl.h" /* XXX This should get the constants from libc */
15#include "choose-mode.h" 15#include "choose-mode.h"
16 16
17asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) 17asmlinkage long sys_uname64(struct new_utsname __user * name)
18{ 18{
19 unsigned long raddr; 19 int err;
20 20 down_read(&uts_sem);
21 return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr; 21 err = copy_to_user(name, &system_utsname, sizeof (*name));
22 up_read(&uts_sem);
23 if (personality(current->personality) == PER_LINUX32)
24 err |= copy_to_user(&name->machine, "i686", 5);
25 return err ? -EFAULT : 0;
22} 26}
23 27
24#ifdef CONFIG_MODE_TT 28#ifdef CONFIG_MODE_TT