aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/Kconfig.char6
-rw-r--r--arch/um/Makefile5
-rw-r--r--arch/um/drivers/chan_user.c1
-rw-r--r--arch/um/drivers/cow_sys.h2
-rw-r--r--arch/um/drivers/daemon_user.c4
-rw-r--r--arch/um/drivers/fd.c2
-rw-r--r--arch/um/drivers/hostaudio_kern.c2
-rw-r--r--arch/um/drivers/line.c4
-rw-r--r--arch/um/drivers/mcast_user.c3
-rw-r--r--arch/um/drivers/net_user.c2
-rw-r--r--arch/um/drivers/port_user.c2
-rw-r--r--arch/um/drivers/pty.c2
-rw-r--r--arch/um/drivers/random.c122
-rw-r--r--arch/um/drivers/slip_user.c2
-rw-r--r--arch/um/drivers/tty.c2
-rw-r--r--arch/um/drivers/ubd_kern.c4
-rw-r--r--arch/um/drivers/xterm.c2
-rw-r--r--arch/um/include/as-layout.h14
-rw-r--r--arch/um/include/line.h6
-rw-r--r--arch/um/include/os.h1
-rw-r--r--arch/um/include/process.h20
-rw-r--r--arch/um/include/skas_ptrace.h13
-rw-r--r--arch/um/include/sysdep-i386/ptrace_user.h30
-rw-r--r--arch/um/include/sysdep-i386/sigcontext.h2
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace_user.h17
-rw-r--r--arch/um/include/um_malloc.h9
-rw-r--r--arch/um/kernel/dyn.lds.S7
-rw-r--r--arch/um/kernel/mem.c5
-rw-r--r--arch/um/kernel/time.c4
-rw-r--r--arch/um/kernel/um_arch.c7
-rw-r--r--arch/um/kernel/uml.lds.S7
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c4
-rw-r--r--arch/um/os-Linux/helper.c4
-rw-r--r--arch/um/os-Linux/main.c2
-rw-r--r--arch/um/os-Linux/sigio.c39
-rw-r--r--arch/um/os-Linux/signal.c1
-rw-r--r--arch/um/os-Linux/skas/process.c2
-rw-r--r--arch/um/os-Linux/start_up.c81
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c5
-rw-r--r--arch/um/os-Linux/time.c54
-rw-r--r--arch/um/sys-i386/ptrace.c30
-rw-r--r--arch/um/sys-i386/user-offsets.c2
-rw-r--r--arch/um/sys-x86_64/user-offsets.c1
43 files changed, 287 insertions, 247 deletions
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index 3a4b396d7979..1b238ebae6b3 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -145,14 +145,14 @@ config LEGACY_PTYS
145 systems, it is safe to say N. 145 systems, it is safe to say N.
146 146
147config RAW_DRIVER 147config RAW_DRIVER
148 tristate "RAW driver (/dev/raw/rawN) (OBSOLETE)" 148 tristate "RAW driver (/dev/raw/rawN)"
149 depends on BLOCK
149 help 150 help
150 The raw driver permits block devices to be bound to /dev/raw/rawN. 151 The raw driver permits block devices to be bound to /dev/raw/rawN.
151 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O. 152 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
152 See the raw(8) manpage for more details. 153 See the raw(8) manpage for more details.
153 154
154 The raw driver is deprecated and will be removed soon. 155 Applications should preferably open the device (eg /dev/hda1)
155 Applications should simply open the device (eg /dev/hda1)
156 with the O_DIRECT flag. 156 with the O_DIRECT flag.
157 157
158config MAX_RAW_DEVS 158config MAX_RAW_DEVS
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 01b97c19a8ba..dbeab15e7bb7 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -77,10 +77,7 @@ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
77KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ 77KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
78 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES)) 78 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES))
79KBUILD_CFLAGS += $(KERNEL_DEFINES) 79KBUILD_CFLAGS += $(KERNEL_DEFINES)
80# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use 80KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
81# a lot more stack due to the lack of sharing of stacklots:
82KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then \
83 echo $(call cc-option,-fno-unit-at-a-time); fi ;)
84 81
85PHONY += linux 82PHONY += linux
86 83
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 025764089ac8..cfeb3f4a44af 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -11,6 +11,7 @@
11#include <termios.h> 11#include <termios.h>
12#include <sys/ioctl.h> 12#include <sys/ioctl.h>
13#include "chan_user.h" 13#include "chan_user.h"
14#include "kern_constants.h"
14#include "os.h" 15#include "os.h"
15#include "um_malloc.h" 16#include "um_malloc.h"
16#include "user.h" 17#include "user.h"
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index ca8c9e11a39b..f5701fd2ef90 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -8,7 +8,7 @@
8 8
9static inline void *cow_malloc(int size) 9static inline void *cow_malloc(int size)
10{ 10{
11 return kmalloc(size, UM_GFP_KERNEL); 11 return uml_kmalloc(size, UM_GFP_KERNEL);
12} 12}
13 13
14static inline void cow_free(void *ptr) 14static inline void cow_free(void *ptr)
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index f23c109a055c..f8e85e0bdace 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -34,7 +34,7 @@ static struct sockaddr_un *new_addr(void *name, int len)
34{ 34{
35 struct sockaddr_un *sun; 35 struct sockaddr_un *sun;
36 36
37 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); 37 sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
38 if (sun == NULL) { 38 if (sun == NULL) {
39 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un " 39 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
40 "failed\n"); 40 "failed\n");
@@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri)
83 goto out_close; 83 goto out_close;
84 } 84 }
85 85
86 sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); 86 sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
87 if (sun == NULL) { 87 if (sun == NULL) {
88 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un " 88 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
89 "failed\n"); 89 "failed\n");
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 0a2bb5b64b82..f5a981a16240 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -40,7 +40,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
40 return NULL; 40 return NULL;
41 } 41 }
42 42
43 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 43 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
44 if (data == NULL) 44 if (data == NULL)
45 return NULL; 45 return NULL;
46 46
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index ff1b22b69e9c..368219cc2366 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -154,7 +154,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
154 case SNDCTL_DSP_SUBDIVIDE: 154 case SNDCTL_DSP_SUBDIVIDE:
155 case SNDCTL_DSP_SETFRAGMENT: 155 case SNDCTL_DSP_SETFRAGMENT:
156 if (get_user(data, (int __user *) arg)) 156 if (get_user(data, (int __user *) arg))
157 return EFAULT; 157 return -EFAULT;
158 break; 158 break;
159 default: 159 default:
160 break; 160 break;
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 10b86e1cc659..5047490fc299 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -191,9 +191,9 @@ void line_flush_chars(struct tty_struct *tty)
191 line_flush_buffer(tty); 191 line_flush_buffer(tty);
192} 192}
193 193
194void line_put_char(struct tty_struct *tty, unsigned char ch) 194int line_put_char(struct tty_struct *tty, unsigned char ch)
195{ 195{
196 line_write(tty, &ch, sizeof(ch)); 196 return line_write(tty, &ch, sizeof(ch));
197} 197}
198 198
199int line_write(struct tty_struct *tty, const unsigned char *buf, int len) 199int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 5f647d7a7292..ee19e91568a2 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -15,6 +15,7 @@
15#include <unistd.h> 15#include <unistd.h>
16#include <errno.h> 16#include <errno.h>
17#include <netinet/in.h> 17#include <netinet/in.h>
18#include "kern_constants.h"
18#include "mcast.h" 19#include "mcast.h"
19#include "net_user.h" 20#include "net_user.h"
20#include "um_malloc.h" 21#include "um_malloc.h"
@@ -24,7 +25,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
24{ 25{
25 struct sockaddr_in *sin; 26 struct sockaddr_in *sin;
26 27
27 sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL); 28 sin = uml_kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
28 if (sin == NULL) { 29 if (sin == NULL) {
29 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in " 30 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
30 "failed\n"); 31 "failed\n");
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index abf2653f5517..9415dd9e63ef 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -222,7 +222,7 @@ static void change(char *dev, char *what, unsigned char *addr,
222 netmask[2], netmask[3]); 222 netmask[2], netmask[3]);
223 223
224 output_len = UM_KERN_PAGE_SIZE; 224 output_len = UM_KERN_PAGE_SIZE;
225 output = kmalloc(output_len, UM_GFP_KERNEL); 225 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
226 if (output == NULL) 226 if (output == NULL)
227 printk(UM_KERN_ERR "change : failed to allocate output " 227 printk(UM_KERN_ERR "change : failed to allocate output "
228 "buffer\n"); 228 "buffer\n");
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index d269ca387f10..b49bf56a56aa 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -47,7 +47,7 @@ static void *port_init(char *str, int device, const struct chan_opts *opts)
47 if (kern_data == NULL) 47 if (kern_data == NULL)
48 return NULL; 48 return NULL;
49 49
50 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 50 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
51 if (data == NULL) 51 if (data == NULL)
52 goto err; 52 goto err;
53 53
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
index 49c79dda6046..1113911dcb2b 100644
--- a/arch/um/drivers/pty.c
+++ b/arch/um/drivers/pty.c
@@ -29,7 +29,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts)
29{ 29{
30 struct pty_chan *data; 30 struct pty_chan *data;
31 31
32 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 32 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if (data == NULL) 33 if (data == NULL)
34 return NULL; 34 return NULL;
35 35
diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
index 71f0959c1535..4949044773ba 100644
--- a/arch/um/drivers/random.c
+++ b/arch/um/drivers/random.c
@@ -1,4 +1,5 @@
1/* Copyright (C) 2005 Jeff Dike <jdike@addtoit.com> */ 1/* Copyright (C) 2005 - 2008 Jeff Dike <jdike@{linux.intel,addtoit}.com> */
2
2/* Much of this ripped from drivers/char/hw_random.c, see there for other 3/* Much of this ripped from drivers/char/hw_random.c, see there for other
3 * copyright. 4 * copyright.
4 * 5 *
@@ -8,16 +9,18 @@
8#include <linux/sched.h> 9#include <linux/sched.h>
9#include <linux/module.h> 10#include <linux/module.h>
10#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/interrupt.h>
11#include <linux/miscdevice.h> 13#include <linux/miscdevice.h>
12#include <linux/delay.h> 14#include <linux/delay.h>
13#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include "irq_kern.h"
14#include "os.h" 17#include "os.h"
15 18
16/* 19/*
17 * core module and version information 20 * core module and version information
18 */ 21 */
19#define RNG_VERSION "1.0.0" 22#define RNG_VERSION "1.0.0"
20#define RNG_MODULE_NAME "random" 23#define RNG_MODULE_NAME "hw_random"
21 24
22#define RNG_MISCDEV_MINOR 183 /* official */ 25#define RNG_MISCDEV_MINOR 183 /* official */
23 26
@@ -26,47 +29,67 @@
26 * protects against a module being loaded twice at the same time. 29 * protects against a module being loaded twice at the same time.
27 */ 30 */
28static int random_fd = -1; 31static int random_fd = -1;
32static DECLARE_WAIT_QUEUE_HEAD(host_read_wait);
29 33
30static int rng_dev_open (struct inode *inode, struct file *filp) 34static int rng_dev_open (struct inode *inode, struct file *filp)
31{ 35{
32 /* enforce read-only access to this chrdev */ 36 /* enforce read-only access to this chrdev */
33 if ((filp->f_mode & FMODE_READ) == 0) 37 if ((filp->f_mode & FMODE_READ) == 0)
34 return -EINVAL; 38 return -EINVAL;
35 if (filp->f_mode & FMODE_WRITE) 39 if ((filp->f_mode & FMODE_WRITE) != 0)
36 return -EINVAL; 40 return -EINVAL;
37 41
38 return 0; 42 return 0;
39} 43}
40 44
45static atomic_t host_sleep_count = ATOMIC_INIT(0);
46
41static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, 47static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
42 loff_t * offp) 48 loff_t *offp)
43{ 49{
44 u32 data; 50 u32 data;
45 int n, ret = 0, have_data; 51 int n, ret = 0, have_data;
46 52
47 while(size){ 53 while (size) {
48 n = os_read_file(random_fd, &data, sizeof(data)); 54 n = os_read_file(random_fd, &data, sizeof(data));
49 if(n > 0){ 55 if (n > 0) {
50 have_data = n; 56 have_data = n;
51 while (have_data && size) { 57 while (have_data && size) {
52 if (put_user((u8)data, buf++)) { 58 if (put_user((u8) data, buf++)) {
53 ret = ret ? : -EFAULT; 59 ret = ret ? : -EFAULT;
54 break; 60 break;
55 } 61 }
56 size--; 62 size--;
57 ret++; 63 ret++;
58 have_data--; 64 have_data--;
59 data>>=8; 65 data >>= 8;
60 } 66 }
61 } 67 }
62 else if(n == -EAGAIN){ 68 else if (n == -EAGAIN) {
63 if (filp->f_flags & O_NONBLOCK) 69 DECLARE_WAITQUEUE(wait, current);
64 return ret ? : -EAGAIN; 70
65 71 if (filp->f_flags & O_NONBLOCK)
66 if(need_resched()) 72 return ret ? : -EAGAIN;
67 schedule_timeout_interruptible(1); 73
68 } 74 atomic_inc(&host_sleep_count);
69 else return n; 75 reactivate_fd(random_fd, RANDOM_IRQ);
76 add_sigio_fd(random_fd);
77
78 add_wait_queue(&host_read_wait, &wait);
79 set_task_state(current, TASK_INTERRUPTIBLE);
80
81 schedule();
82 set_task_state(current, TASK_RUNNING);
83 remove_wait_queue(&host_read_wait, &wait);
84
85 if (atomic_dec_and_test(&host_sleep_count)) {
86 ignore_sigio_fd(random_fd);
87 deactivate_fd(random_fd, RANDOM_IRQ);
88 }
89 }
90 else
91 return n;
92
70 if (signal_pending (current)) 93 if (signal_pending (current))
71 return ret ? : -ERESTARTSYS; 94 return ret ? : -ERESTARTSYS;
72 } 95 }
@@ -86,6 +109,13 @@ static struct miscdevice rng_miscdev = {
86 &rng_chrdev_ops, 109 &rng_chrdev_ops,
87}; 110};
88 111
112static irqreturn_t random_interrupt(int irq, void *data)
113{
114 wake_up(&host_read_wait);
115
116 return IRQ_HANDLED;
117}
118
89/* 119/*
90 * rng_init - initialize RNG module 120 * rng_init - initialize RNG module
91 */ 121 */
@@ -93,28 +123,33 @@ static int __init rng_init (void)
93{ 123{
94 int err; 124 int err;
95 125
96 err = os_open_file("/dev/random", of_read(OPENFLAGS()), 0); 126 err = os_open_file("/dev/random", of_read(OPENFLAGS()), 0);
97 if(err < 0) 127 if (err < 0)
98 goto out; 128 goto out;
99 129
100 random_fd = err; 130 random_fd = err;
101 131
102 err = os_set_fd_block(random_fd, 0); 132 err = um_request_irq(RANDOM_IRQ, random_fd, IRQ_READ, random_interrupt,
103 if(err) 133 IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "random",
134 NULL);
135 if (err)
104 goto err_out_cleanup_hw; 136 goto err_out_cleanup_hw;
105 137
138 sigio_broken(random_fd, 1);
139
106 err = misc_register (&rng_miscdev); 140 err = misc_register (&rng_miscdev);
107 if (err) { 141 if (err) {
108 printk (KERN_ERR RNG_MODULE_NAME ": misc device register failed\n"); 142 printk (KERN_ERR RNG_MODULE_NAME ": misc device register "
143 "failed\n");
109 goto err_out_cleanup_hw; 144 goto err_out_cleanup_hw;
110 } 145 }
146out:
147 return err;
111 148
112 out: 149err_out_cleanup_hw:
113 return err; 150 os_close_file(random_fd);
114 151 random_fd = -1;
115 err_out_cleanup_hw: 152 goto out;
116 random_fd = -1;
117 goto out;
118} 153}
119 154
120/* 155/*
@@ -122,6 +157,7 @@ static int __init rng_init (void)
122 */ 157 */
123static void __exit rng_cleanup (void) 158static void __exit rng_cleanup (void)
124{ 159{
160 os_close_file(random_fd);
125 misc_deregister (&rng_miscdev); 161 misc_deregister (&rng_miscdev);
126} 162}
127 163
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index 8b80505a3fb0..a1c2d2c98a94 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -96,7 +96,7 @@ static int slip_tramp(char **argv, int fd)
96 pid = err; 96 pid = err;
97 97
98 output_len = UM_KERN_PAGE_SIZE; 98 output_len = UM_KERN_PAGE_SIZE;
99 output = kmalloc(output_len, UM_GFP_KERNEL); 99 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
100 if (output == NULL) { 100 if (output == NULL) {
101 printk(UM_KERN_ERR "slip_tramp : failed to allocate output " 101 printk(UM_KERN_ERR "slip_tramp : failed to allocate output "
102 "buffer\n"); 102 "buffer\n");
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index c930fedc5172..495858a090e4 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -29,7 +29,7 @@ static void *tty_chan_init(char *str, int device, const struct chan_opts *opts)
29 } 29 }
30 str++; 30 str++;
31 31
32 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 32 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if (data == NULL) 33 if (data == NULL)
34 return NULL; 34 return NULL;
35 *data = ((struct tty_chan) { .dev = str, 35 *data = ((struct tty_chan) { .dev = str,
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 5e45e39a8a8d..44ad1607be2d 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1178,8 +1178,8 @@ static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask,
1178 * by one word. Thanks to Lynn Kerby for the fix and James McMechan 1178 * by one word. Thanks to Lynn Kerby for the fix and James McMechan
1179 * for the original diagnosis. 1179 * for the original diagnosis.
1180 */ 1180 */
1181 if(*cow_offset == ((bitmap_len + sizeof(unsigned long) - 1) / 1181 if (*cow_offset == (DIV_ROUND_UP(bitmap_len,
1182 sizeof(unsigned long) - 1)) 1182 sizeof(unsigned long)) - 1))
1183 (*cow_offset)--; 1183 (*cow_offset)--;
1184 1184
1185 bitmap_words[0] = bitmap[*cow_offset]; 1185 bitmap_words[0] = bitmap[*cow_offset];
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index 8a1c18a9b240..da2caa5a21ef 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -30,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
30{ 30{
31 struct xterm_chan *data; 31 struct xterm_chan *data;
32 32
33 data = kmalloc(sizeof(*data), UM_GFP_KERNEL); 33 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
34 if (data == NULL) 34 if (data == NULL)
35 return NULL; 35 return NULL;
36 *data = ((struct xterm_chan) { .pid = -1, 36 *data = ((struct xterm_chan) { .pid = -1,
diff --git a/arch/um/include/as-layout.h b/arch/um/include/as-layout.h
index cac542d8ff70..58e852dfb0ce 100644
--- a/arch/um/include/as-layout.h
+++ b/arch/um/include/as-layout.h
@@ -23,16 +23,16 @@
23 */ 23 */
24 24
25#ifdef __ASSEMBLY__ 25#ifdef __ASSEMBLY__
26#define _AC(X, Y) (Y) 26#define _UML_AC(X, Y) (Y)
27#else 27#else
28#define __AC(X, Y) (X (Y)) 28#define __UML_AC(X, Y) (X(Y))
29#define _AC(X, Y) __AC(X, Y) 29#define _UML_AC(X, Y) __UML_AC(X, Y)
30#endif 30#endif
31 31
32#define STUB_START _AC(, 0x100000) 32#define STUB_START _UML_AC(, 0x100000)
33#define STUB_CODE _AC((unsigned long), STUB_START) 33#define STUB_CODE _UML_AC((unsigned long), STUB_START)
34#define STUB_DATA _AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE) 34#define STUB_DATA _UML_AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE)
35#define STUB_END _AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE) 35#define STUB_END _UML_AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE)
36 36
37#ifndef __ASSEMBLY__ 37#ifndef __ASSEMBLY__
38 38
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 1223f2c844b4..311a0d3d93af 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -58,11 +58,11 @@ struct line {
58}; 58};
59 59
60#define LINE_INIT(str, d) \ 60#define LINE_INIT(str, d) \
61 { .count_lock = SPIN_LOCK_UNLOCKED, \ 61 { .count_lock = __SPIN_LOCK_UNLOCKED((str).count_lock), \
62 .init_str = str, \ 62 .init_str = str, \
63 .init_pri = INIT_STATIC, \ 63 .init_pri = INIT_STATIC, \
64 .valid = 1, \ 64 .valid = 1, \
65 .lock = SPIN_LOCK_UNLOCKED, \ 65 .lock = __SPIN_LOCK_UNLOCKED((str).lock), \
66 .driver = d } 66 .driver = d }
67 67
68extern void line_close(struct tty_struct *tty, struct file * filp); 68extern void line_close(struct tty_struct *tty, struct file * filp);
@@ -71,7 +71,7 @@ extern int line_setup(struct line *lines, unsigned int sizeof_lines,
71 char *init, char **error_out); 71 char *init, char **error_out);
72extern int line_write(struct tty_struct *tty, const unsigned char *buf, 72extern int line_write(struct tty_struct *tty, const unsigned char *buf,
73 int len); 73 int len);
74extern void line_put_char(struct tty_struct *tty, unsigned char ch); 74extern int line_put_char(struct tty_struct *tty, unsigned char ch);
75extern void line_set_termios(struct tty_struct *tty, struct ktermios * old); 75extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
76extern int line_chars_in_buffer(struct tty_struct *tty); 76extern int line_chars_in_buffer(struct tty_struct *tty);
77extern void line_flush_buffer(struct tty_struct *tty); 77extern void line_flush_buffer(struct tty_struct *tty);
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 32c799e3a495..e2716ac8889a 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -290,6 +290,7 @@ extern void os_set_ioignore(void);
290extern int add_sigio_fd(int fd); 290extern int add_sigio_fd(int fd);
291extern int ignore_sigio_fd(int fd); 291extern int ignore_sigio_fd(int fd);
292extern void maybe_sigio_broken(int fd, int read); 292extern void maybe_sigio_broken(int fd, int read);
293extern void sigio_broken(int fd, int read);
293 294
294/* sys-x86_64/prctl.c */ 295/* sys-x86_64/prctl.c */
295extern int os_arch_prctl(int pid, int code, unsigned long *addr); 296extern int os_arch_prctl(int pid, int code, unsigned long *addr);
diff --git a/arch/um/include/process.h b/arch/um/include/process.h
index 5af9157ff54f..bb873a51262e 100644
--- a/arch/um/include/process.h
+++ b/arch/um/include/process.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -8,18 +8,10 @@
8 8
9#include <signal.h> 9#include <signal.h>
10 10
11extern void sig_handler(int sig, struct sigcontext sc); 11/* Copied from linux/compiler-gcc.h since we can't include it directly */
12extern void alarm_handler(int sig, struct sigcontext sc); 12#define barrier() __asm__ __volatile__("": : :"memory")
13 13
14#endif 14extern void sig_handler(int sig, struct sigcontext *sc);
15extern void alarm_handler(int sig, struct sigcontext *sc);
15 16
16/* 17#endif
17 * Overrides for Emacs so that we follow Linus's tabbing style.
18 * Emacs will notice this stuff at the end of the file and automatically
19 * adjust the settings for this buffer only. This must remain at the end
20 * of the file.
21 * ---------------------------------------------------------------------------
22 * Local variables:
23 * c-file-style: "linux"
24 * End:
25 */
diff --git a/arch/um/include/skas_ptrace.h b/arch/um/include/skas_ptrace.h
index cd2327d09c8d..3d31bbacd016 100644
--- a/arch/um/include/skas_ptrace.h
+++ b/arch/um/include/skas_ptrace.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -12,14 +12,3 @@
12#include "sysdep/skas_ptrace.h" 12#include "sysdep/skas_ptrace.h"
13 13
14#endif 14#endif
15
16/*
17 * Overrides for Emacs so that we follow Linus's tabbing style.
18 * Emacs will notice this stuff at the end of the file and automatically
19 * adjust the settings for this buffer only. This must remain at the end
20 * of the file.
21 * ---------------------------------------------------------------------------
22 * Local variables:
23 * c-file-style: "linux"
24 * End:
25 */
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h
index 75650723c38f..ef56247e4143 100644
--- a/arch/um/include/sysdep-i386/ptrace_user.h
+++ b/arch/um/include/sysdep-i386/ptrace_user.h
@@ -41,38 +41,10 @@
41#define PT_SP_OFFSET PT_OFFSET(UESP) 41#define PT_SP_OFFSET PT_OFFSET(UESP)
42#define PT_SP(regs) ((regs)[UESP]) 42#define PT_SP(regs) ((regs)[UESP])
43 43
44#define FP_SIZE ((HOST_XFP_SIZE > HOST_FP_SIZE) ? HOST_XFP_SIZE : HOST_FP_SIZE) 44#define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
45 45
46#ifndef FRAME_SIZE 46#ifndef FRAME_SIZE
47#define FRAME_SIZE (17) 47#define FRAME_SIZE (17)
48#endif 48#endif
49#define FRAME_SIZE_OFFSET (FRAME_SIZE * sizeof(unsigned long))
50
51#define FP_FRAME_SIZE (27)
52#define FPX_FRAME_SIZE (128)
53
54#ifdef PTRACE_GETREGS
55#define UM_HAVE_GETREGS
56#endif
57
58#ifdef PTRACE_SETREGS
59#define UM_HAVE_SETREGS
60#endif
61
62#ifdef PTRACE_GETFPREGS
63#define UM_HAVE_GETFPREGS
64#endif
65
66#ifdef PTRACE_SETFPREGS
67#define UM_HAVE_SETFPREGS
68#endif
69
70#ifdef PTRACE_GETFPXREGS
71#define UM_HAVE_GETFPXREGS
72#endif
73
74#ifdef PTRACE_SETFPXREGS
75#define UM_HAVE_SETFPXREGS
76#endif
77 49
78#endif 50#endif
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h
index 67e77122aa45..f583c87111a0 100644
--- a/arch/um/include/sysdep-i386/sigcontext.h
+++ b/arch/um/include/sysdep-i386/sigcontext.h
@@ -10,7 +10,7 @@
10 10
11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2) 11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
12 12
13#define GET_FAULTINFO_FROM_SC(fi,sc) \ 13#define GET_FAULTINFO_FROM_SC(fi, sc) \
14 { \ 14 { \
15 (fi).cr2 = SC_CR2(sc); \ 15 (fi).cr2 = SC_CR2(sc); \
16 (fi).error_code = SC_ERR(sc); \ 16 (fi).error_code = SC_ERR(sc); \
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/include/sysdep-x86_64/ptrace_user.h
index 45c0bd881cb3..4dbccdb58f48 100644
--- a/arch/um/include/sysdep-x86_64/ptrace_user.h
+++ b/arch/um/include/sysdep-x86_64/ptrace_user.h
@@ -48,7 +48,8 @@
48#define PT_ORIG_RAX_OFFSET (ORIG_RAX) 48#define PT_ORIG_RAX_OFFSET (ORIG_RAX)
49#define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)]) 49#define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)])
50 50
51/* x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though 51/*
52 * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though
52 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the 53 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the
53 * 2.4 name and value for 2.4 host compatibility. 54 * 2.4 name and value for 2.4 host compatibility.
54 */ 55 */
@@ -56,7 +57,8 @@
56#define PTRACE_OLDSETOPTIONS 21 57#define PTRACE_OLDSETOPTIONS 21
57#endif 58#endif
58 59
59/* These are before the system call, so the system call number is RAX 60/*
61 * These are before the system call, so the system call number is RAX
60 * rather than ORIG_RAX, and arg4 is R10 rather than RCX 62 * rather than ORIG_RAX, and arg4 is R10 rather than RCX
61 */ 63 */
62#define REGS_SYSCALL_NR PT_INDEX(RAX) 64#define REGS_SYSCALL_NR PT_INDEX(RAX)
@@ -73,14 +75,3 @@
73#define FP_SIZE (HOST_FP_SIZE) 75#define FP_SIZE (HOST_FP_SIZE)
74 76
75#endif 77#endif
76
77/*
78 * Overrides for Emacs so that we follow Linus's tabbing style.
79 * Emacs will notice this stuff at the end of the file and automatically
80 * adjust the settings for this buffer only. This must remain at the end
81 * of the file.
82 * ---------------------------------------------------------------------------
83 * Local variables:
84 * c-file-style: "linux"
85 * End:
86 */
diff --git a/arch/um/include/um_malloc.h b/arch/um/include/um_malloc.h
index 0ad17cb83d96..c554d706d106 100644
--- a/arch/um/include/um_malloc.h
+++ b/arch/um/include/um_malloc.h
@@ -8,15 +8,12 @@
8 8
9#include "kern_constants.h" 9#include "kern_constants.h"
10 10
11extern void *__kmalloc(int size, int flags); 11extern void *uml_kmalloc(int size, int flags);
12static inline void *kmalloc(int size, int flags)
13{
14 return __kmalloc(size, flags);
15}
16
17extern void kfree(const void *ptr); 12extern void kfree(const void *ptr);
18 13
19extern void *vmalloc(unsigned long size); 14extern void *vmalloc(unsigned long size);
20extern void vfree(void *ptr); 15extern void vfree(void *ptr);
21 16
22#endif /* __UM_MALLOC_H__ */ 17#endif /* __UM_MALLOC_H__ */
18
19
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 26090b7f323e..9975e1ab44fb 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -1,4 +1,5 @@
1#include <asm-generic/vmlinux.lds.h> 1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h>
2 3
3OUTPUT_FORMAT(ELF_FORMAT) 4OUTPUT_FORMAT(ELF_FORMAT)
4OUTPUT_ARCH(ELF_ARCH) 5OUTPUT_ARCH(ELF_ARCH)
@@ -21,7 +22,7 @@ SECTIONS
21 _einittext = .; 22 _einittext = .;
22 } 23 }
23 24
24 . = ALIGN(4096); 25 . = ALIGN(PAGE_SIZE);
25 26
26 /* Read-only sections, merged into text segment: */ 27 /* Read-only sections, merged into text segment: */
27 .hash : { *(.hash) } 28 .hash : { *(.hash) }
@@ -68,9 +69,9 @@ SECTIONS
68 /* .gnu.warning sections are handled specially by elf32.em. */ 69 /* .gnu.warning sections are handled specially by elf32.em. */
69 *(.gnu.warning) 70 *(.gnu.warning)
70 71
71 . = ALIGN(4096); 72 . = ALIGN(PAGE_SIZE);
72 } =0x90909090 73 } =0x90909090
73 . = ALIGN(4096); 74 . = ALIGN(PAGE_SIZE);
74 .syscall_stub : { 75 .syscall_stub : {
75 __syscall_stub_start = .; 76 __syscall_stub_start = .;
76 *(.__syscall_stub*) 77 *(.__syscall_stub*)
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 2eea1ff235e6..b0ee64622ff7 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -375,3 +375,8 @@ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
375 return pmd; 375 return pmd;
376} 376}
377#endif 377#endif
378
379void *uml_kmalloc(int size, int flags)
380{
381 return kmalloc(size, flags);
382}
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 0d0cea2ac98d..c3e2f369c33c 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -75,7 +75,7 @@ static irqreturn_t um_timer(int irq, void *dev)
75 75
76static cycle_t itimer_read(void) 76static cycle_t itimer_read(void)
77{ 77{
78 return os_nsecs(); 78 return os_nsecs() / 1000;
79} 79}
80 80
81static struct clocksource itimer_clocksource = { 81static struct clocksource itimer_clocksource = {
@@ -83,7 +83,7 @@ static struct clocksource itimer_clocksource = {
83 .rating = 300, 83 .rating = 300,
84 .read = itimer_read, 84 .read = itimer_read,
85 .mask = CLOCKSOURCE_MASK(64), 85 .mask = CLOCKSOURCE_MASK(64),
86 .mult = 1, 86 .mult = 1000,
87 .shift = 0, 87 .shift = 0,
88 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 88 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
89}; 89};
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 56deed623446..9db85b2ce698 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -150,7 +150,7 @@ __uml_setup("root=", uml_root_setup,
150static int __init no_skas_debug_setup(char *line, int *add) 150static int __init no_skas_debug_setup(char *line, int *add)
151{ 151{
152 printf("'debug' is not necessary to gdb UML in skas mode - run \n"); 152 printf("'debug' is not necessary to gdb UML in skas mode - run \n");
153 printf("'gdb linux'"); 153 printf("'gdb linux'\n");
154 154
155 return 0; 155 return 0;
156} 156}
@@ -258,6 +258,7 @@ int __init linux_main(int argc, char **argv)
258{ 258{
259 unsigned long avail, diff; 259 unsigned long avail, diff;
260 unsigned long virtmem_size, max_physmem; 260 unsigned long virtmem_size, max_physmem;
261 unsigned long stack;
261 unsigned int i; 262 unsigned int i;
262 int add; 263 int add;
263 char * mode; 264 char * mode;
@@ -348,7 +349,9 @@ int __init linux_main(int argc, char **argv)
348 } 349 }
349 350
350 virtmem_size = physmem_size; 351 virtmem_size = physmem_size;
351 avail = TASK_SIZE - start_vm; 352 stack = (unsigned long) argv;
353 stack &= ~(1024 * 1024 - 1);
354 avail = stack - start_vm;
352 if (physmem_size > avail) 355 if (physmem_size > avail)
353 virtmem_size = avail; 356 virtmem_size = avail;
354 end_vm = start_vm + virtmem_size; 357 end_vm = start_vm + virtmem_size;
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 5828c1d54505..11b835248b86 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -1,4 +1,5 @@
1#include <asm-generic/vmlinux.lds.h> 1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h>
2 3
3OUTPUT_FORMAT(ELF_FORMAT) 4OUTPUT_FORMAT(ELF_FORMAT)
4OUTPUT_ARCH(ELF_ARCH) 5OUTPUT_ARCH(ELF_ARCH)
@@ -26,7 +27,7 @@ SECTIONS
26 INIT_TEXT 27 INIT_TEXT
27 _einittext = .; 28 _einittext = .;
28 } 29 }
29 . = ALIGN(4096); 30 . = ALIGN(PAGE_SIZE);
30 31
31 .text : 32 .text :
32 { 33 {
@@ -39,7 +40,7 @@ SECTIONS
39 *(.gnu.linkonce.t*) 40 *(.gnu.linkonce.t*)
40 } 41 }
41 42
42 . = ALIGN(4096); 43 . = ALIGN(PAGE_SIZE);
43 .syscall_stub : { 44 .syscall_stub : {
44 __syscall_stub_start = .; 45 __syscall_stub_start = .;
45 *(.__syscall_stub*) 46 *(.__syscall_stub*)
@@ -79,7 +80,7 @@ SECTIONS
79 .sdata : { *(.sdata) } 80 .sdata : { *(.sdata) }
80 _edata = .; 81 _edata = .;
81 PROVIDE (edata = .); 82 PROVIDE (edata = .);
82 . = ALIGN(0x1000); 83 . = ALIGN(PAGE_SIZE);
83 .sbss : 84 .sbss :
84 { 85 {
85 __bss_start = .; 86 __bss_start = .;
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index 6fb0b174f538..cc72cb2c1af6 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -52,7 +52,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
52 return; 52 return;
53 } 53 }
54 54
55 output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL); 55 output = uml_kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
56 if (output == NULL) 56 if (output == NULL)
57 printk(UM_KERN_ERR "etap_change : Failed to allocate output " 57 printk(UM_KERN_ERR "etap_change : Failed to allocate output "
58 "buffer\n"); 58 "buffer\n");
@@ -165,7 +165,7 @@ static int etap_open(void *data)
165 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0], 165 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0],
166 control_fds[1], data_fds[0], data_fds[1]); 166 control_fds[1], data_fds[0], data_fds[1]);
167 output_len = UM_KERN_PAGE_SIZE; 167 output_len = UM_KERN_PAGE_SIZE;
168 output = kmalloc(output_len, UM_GFP_KERNEL); 168 output = uml_kmalloc(output_len, UM_GFP_KERNEL);
169 read_output(control_fds[0], output, output_len); 169 read_output(control_fds[0], output, output_len);
170 170
171 if (output == NULL) 171 if (output == NULL)
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index f25c29a12d00..74ca7aabf4e1 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -71,8 +71,8 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
71 data.pre_data = pre_data; 71 data.pre_data = pre_data;
72 data.argv = argv; 72 data.argv = argv;
73 data.fd = fds[1]; 73 data.fd = fds[1];
74 data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) : 74 data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
75 kmalloc(PATH_MAX, UM_GFP_KERNEL); 75 uml_kmalloc(PATH_MAX, UM_GFP_KERNEL);
76 pid = clone(helper_child, (void *) sp, CLONE_VM, &data); 76 pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
77 if (pid < 0) { 77 if (pid < 0) {
78 ret = -errno; 78 ret = -errno;
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index abb9b0ffd960..eee69b9f52c9 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -199,7 +199,7 @@ void *__wrap_malloc(int size)
199 return __real_malloc(size); 199 return __real_malloc(size);
200 else if (size <= UM_KERN_PAGE_SIZE) 200 else if (size <= UM_KERN_PAGE_SIZE)
201 /* finding contiguous pages can be hard*/ 201 /* finding contiguous pages can be hard*/
202 ret = kmalloc(size, UM_GFP_KERNEL); 202 ret = uml_kmalloc(size, UM_GFP_KERNEL);
203 else ret = vmalloc(size); 203 else ret = vmalloc(size);
204 204
205 /* 205 /*
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index abf47a7c4abd..eb8f2e4be192 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 2 * Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -15,6 +15,7 @@
15#include "kern_util.h" 15#include "kern_util.h"
16#include "init.h" 16#include "init.h"
17#include "os.h" 17#include "os.h"
18#include "process.h"
18#include "sigio.h" 19#include "sigio.h"
19#include "um_malloc.h" 20#include "um_malloc.h"
20#include "user.h" 21#include "user.h"
@@ -109,7 +110,7 @@ static int need_poll(struct pollfds *polls, int n)
109 if (n <= polls->size) 110 if (n <= polls->size)
110 return 0; 111 return 0;
111 112
112 new = kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC); 113 new = uml_kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
113 if (new == NULL) { 114 if (new == NULL) {
114 printk(UM_KERN_ERR "need_poll : failed to allocate new " 115 printk(UM_KERN_ERR "need_poll : failed to allocate new "
115 "pollfds\n"); 116 "pollfds\n");
@@ -243,7 +244,7 @@ static struct pollfd *setup_initial_poll(int fd)
243{ 244{
244 struct pollfd *p; 245 struct pollfd *p;
245 246
246 p = kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL); 247 p = uml_kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
247 if (p == NULL) { 248 if (p == NULL) {
248 printk(UM_KERN_ERR "setup_initial_poll : failed to allocate " 249 printk(UM_KERN_ERR "setup_initial_poll : failed to allocate "
249 "poll\n"); 250 "poll\n");
@@ -338,20 +339,10 @@ out_close1:
338 close(l_write_sigio_fds[1]); 339 close(l_write_sigio_fds[1]);
339} 340}
340 341
341/* Changed during early boot */ 342void sigio_broken(int fd, int read)
342static int pty_output_sigio = 0;
343static int pty_close_sigio = 0;
344
345void maybe_sigio_broken(int fd, int read)
346{ 343{
347 int err; 344 int err;
348 345
349 if (!isatty(fd))
350 return;
351
352 if ((read || pty_output_sigio) && (!read || pty_close_sigio))
353 return;
354
355 write_sigio_workaround(); 346 write_sigio_workaround();
356 347
357 sigio_lock(); 348 sigio_lock();
@@ -370,6 +361,21 @@ out:
370 sigio_unlock(); 361 sigio_unlock();
371} 362}
372 363
364/* Changed during early boot */
365static int pty_output_sigio;
366static int pty_close_sigio;
367
368void maybe_sigio_broken(int fd, int read)
369{
370 if (!isatty(fd))
371 return;
372
373 if ((read || pty_output_sigio) && (!read || pty_close_sigio))
374 return;
375
376 sigio_broken(fd, read);
377}
378
373static void sigio_cleanup(void) 379static void sigio_cleanup(void)
374{ 380{
375 if (write_sigio_pid == -1) 381 if (write_sigio_pid == -1)
@@ -383,7 +389,7 @@ static void sigio_cleanup(void)
383__uml_exitcall(sigio_cleanup); 389__uml_exitcall(sigio_cleanup);
384 390
385/* Used as a flag during SIGIO testing early in boot */ 391/* Used as a flag during SIGIO testing early in boot */
386static volatile int got_sigio = 0; 392static int got_sigio;
387 393
388static void __init handler(int sig) 394static void __init handler(int sig)
389{ 395{
@@ -498,7 +504,8 @@ static void tty_output(int master, int slave)
498 if (errno != EAGAIN) 504 if (errno != EAGAIN)
499 printk(UM_KERN_ERR "tty_output : write failed, errno = %d\n", 505 printk(UM_KERN_ERR "tty_output : write failed, errno = %d\n",
500 errno); 506 errno);
501 while (((n = read(slave, buf, sizeof(buf))) > 0) && !got_sigio) 507 while (((n = read(slave, buf, sizeof(buf))) > 0) &&
508 !({ barrier(); got_sigio; }))
502 ; 509 ;
503 510
504 if (got_sigio) { 511 if (got_sigio) {
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 3f1694b134cb..5aade6027e40 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -12,6 +12,7 @@
12#include "as-layout.h" 12#include "as-layout.h"
13#include "kern_util.h" 13#include "kern_util.h"
14#include "os.h" 14#include "os.h"
15#include "process.h"
15#include "sysdep/barrier.h" 16#include "sysdep/barrier.h"
16#include "sysdep/sigcontext.h" 17#include "sysdep/sigcontext.h"
17#include "user.h" 18#include "user.h"
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 1e8cba6550a9..6be028ca1817 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -442,7 +442,7 @@ void userspace(struct uml_pt_regs *regs)
442 unblock_signals(); 442 unblock_signals();
443 break; 443 break;
444 default: 444 default:
445 printk(UM_KERN_ERR "userspace - child stopped " 445 printk(UM_KERN_ERR "userspace - child stopped "
446 "with signal %d\n", sig); 446 "with signal %d\n", sig);
447 fatal_sigsegv(); 447 fatal_sigsegv();
448 } 448 }
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 997d01944f91..b4b36e0f2e89 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -23,6 +23,7 @@
23#include "mem_user.h" 23#include "mem_user.h"
24#include "ptrace_user.h" 24#include "ptrace_user.h"
25#include "registers.h" 25#include "registers.h"
26#include "skas.h"
26#include "skas_ptrace.h" 27#include "skas_ptrace.h"
27 28
28static void ptrace_child(void) 29static void ptrace_child(void)
@@ -140,14 +141,27 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
140} 141}
141 142
142/* Changed only during early boot */ 143/* Changed only during early boot */
143int ptrace_faultinfo = 1; 144int ptrace_faultinfo;
144int ptrace_ldt = 1; 145static int disable_ptrace_faultinfo;
145int proc_mm = 1; 146
146int skas_needs_stub = 0; 147int ptrace_ldt;
148static int disable_ptrace_ldt;
149
150int proc_mm;
151static int disable_proc_mm;
152
153int have_switch_mm;
154static int disable_switch_mm;
155
156int skas_needs_stub;
147 157
148static int __init skas0_cmd_param(char *str, int* add) 158static int __init skas0_cmd_param(char *str, int* add)
149{ 159{
150 ptrace_faultinfo = proc_mm = 0; 160 disable_ptrace_faultinfo = 1;
161 disable_ptrace_ldt = 1;
162 disable_proc_mm = 1;
163 disable_switch_mm = 1;
164
151 return 0; 165 return 0;
152} 166}
153 167
@@ -157,15 +171,12 @@ static int __init mode_skas0_cmd_param(char *str, int* add)
157 __attribute__((alias("skas0_cmd_param"))); 171 __attribute__((alias("skas0_cmd_param")));
158 172
159__uml_setup("skas0", skas0_cmd_param, 173__uml_setup("skas0", skas0_cmd_param,
160 "skas0\n" 174"skas0\n"
161 " Disables SKAS3 usage, so that SKAS0 is used, unless \n" 175" Disables SKAS3 and SKAS4 usage, so that SKAS0 is used\n\n");
162 " you specify mode=tt.\n\n");
163 176
164__uml_setup("mode=skas0", mode_skas0_cmd_param, 177__uml_setup("mode=skas0", mode_skas0_cmd_param,
165 "mode=skas0\n" 178"mode=skas0\n"
166 " Disables SKAS3 usage, so that SKAS0 is used, unless you \n" 179" Disables SKAS3 and SKAS4 usage, so that SKAS0 is used.\n\n");
167 " specify mode=tt. Note that this was recently added - on \n"
168 " older kernels you must use simply \"skas0\".\n\n");
169 180
170/* Changed only during early boot */ 181/* Changed only during early boot */
171static int force_sysemu_disabled = 0; 182static int force_sysemu_disabled = 0;
@@ -360,7 +371,7 @@ void __init os_early_checks(void)
360 371
361static int __init noprocmm_cmd_param(char *str, int* add) 372static int __init noprocmm_cmd_param(char *str, int* add)
362{ 373{
363 proc_mm = 0; 374 disable_proc_mm = 1;
364 return 0; 375 return 0;
365} 376}
366 377
@@ -372,7 +383,7 @@ __uml_setup("noprocmm", noprocmm_cmd_param,
372 383
373static int __init noptracefaultinfo_cmd_param(char *str, int* add) 384static int __init noptracefaultinfo_cmd_param(char *str, int* add)
374{ 385{
375 ptrace_faultinfo = 0; 386 disable_ptrace_faultinfo = 1;
376 return 0; 387 return 0;
377} 388}
378 389
@@ -384,7 +395,7 @@ __uml_setup("noptracefaultinfo", noptracefaultinfo_cmd_param,
384 395
385static int __init noptraceldt_cmd_param(char *str, int* add) 396static int __init noptraceldt_cmd_param(char *str, int* add)
386{ 397{
387 ptrace_ldt = 0; 398 disable_ptrace_ldt = 1;
388 return 0; 399 return 0;
389} 400}
390 401
@@ -404,17 +415,15 @@ static inline void check_skas3_ptrace_faultinfo(void)
404 415
405 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); 416 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
406 if (n < 0) { 417 if (n < 0) {
407 ptrace_faultinfo = 0;
408 if (errno == EIO) 418 if (errno == EIO)
409 non_fatal("not found\n"); 419 non_fatal("not found\n");
410 else 420 else
411 perror("not found"); 421 perror("not found");
412 } 422 } else if (disable_ptrace_faultinfo)
423 non_fatal("found but disabled on command line\n");
413 else { 424 else {
414 if (!ptrace_faultinfo) 425 ptrace_faultinfo = 1;
415 non_fatal("found but disabled on command line\n"); 426 non_fatal("found\n");
416 else
417 non_fatal("found\n");
418 } 427 }
419 428
420 stop_ptraced_child(pid, 1, 1); 429 stop_ptraced_child(pid, 1, 1);
@@ -437,38 +446,30 @@ static inline void check_skas3_ptrace_ldt(void)
437 if (n < 0) { 446 if (n < 0) {
438 if (errno == EIO) 447 if (errno == EIO)
439 non_fatal("not found\n"); 448 non_fatal("not found\n");
440 else { 449 else
441 perror("not found"); 450 perror("not found");
442 } 451 } else if (disable_ptrace_ldt)
443 ptrace_ldt = 0; 452 non_fatal("found, but use is disabled\n");
444 }
445 else { 453 else {
446 if (ptrace_ldt) 454 ptrace_ldt = 1;
447 non_fatal("found\n"); 455 non_fatal("found\n");
448 else
449 non_fatal("found, but use is disabled\n");
450 } 456 }
451 457
452 stop_ptraced_child(pid, 1, 1); 458 stop_ptraced_child(pid, 1, 1);
453#else
454 /* PTRACE_LDT might be disabled via cmdline option.
455 * We want to override this, else we might use the stub
456 * without real need
457 */
458 ptrace_ldt = 1;
459#endif 459#endif
460} 460}
461 461
462static inline void check_skas3_proc_mm(void) 462static inline void check_skas3_proc_mm(void)
463{ 463{
464 non_fatal(" - /proc/mm..."); 464 non_fatal(" - /proc/mm...");
465 if (access("/proc/mm", W_OK) < 0) { 465 if (access("/proc/mm", W_OK) < 0)
466 proc_mm = 0;
467 perror("not found"); 466 perror("not found");
468 } 467 else if (disable_proc_mm)
469 else if (!proc_mm)
470 non_fatal("found but disabled on command line\n"); 468 non_fatal("found but disabled on command line\n");
471 else non_fatal("found\n"); 469 else {
470 proc_mm = 1;
471 non_fatal("found\n");
472 }
472} 473}
473 474
474void can_do_skas(void) 475void can_do_skas(void)
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index b613473b3ec1..c6183e7aec3d 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -5,6 +5,7 @@
5 */ 5 */
6 6
7#include <errno.h> 7#include <errno.h>
8#include <asm/user.h>
8#include "kern_constants.h" 9#include "kern_constants.h"
9#include "longjmp.h" 10#include "longjmp.h"
10#include "user.h" 11#include "user.h"
@@ -74,10 +75,10 @@ int put_fp_registers(int pid, unsigned long *regs)
74 75
75void arch_init_registers(int pid) 76void arch_init_registers(int pid)
76{ 77{
77 unsigned long fpx_regs[HOST_XFP_SIZE]; 78 struct user_fxsr_struct fpx_regs;
78 int err; 79 int err;
79 80
80 err = ptrace(PTRACE_GETFPXREGS, pid, 0, fpx_regs); 81 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs);
81 if (!err) 82 if (!err)
82 return; 83 return;
83 84
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index e49280599465..bee98f466d66 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -9,7 +9,9 @@
9#include <time.h> 9#include <time.h>
10#include <sys/time.h> 10#include <sys/time.h>
11#include "kern_constants.h" 11#include "kern_constants.h"
12#include "kern_util.h"
12#include "os.h" 13#include "os.h"
14#include "process.h"
13#include "user.h" 15#include "user.h"
14 16
15int set_interval(void) 17int set_interval(void)
@@ -58,12 +60,17 @@ static inline long long timeval_to_ns(const struct timeval *tv)
58long long disable_timer(void) 60long long disable_timer(void)
59{ 61{
60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); 62 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
63 int remain, max = UM_NSEC_PER_SEC / UM_HZ;
61 64
62 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0) 65 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
63 printk(UM_KERN_ERR "disable_timer - setitimer failed, " 66 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
64 "errno = %d\n", errno); 67 "errno = %d\n", errno);
65 68
66 return timeval_to_ns(&time.it_value); 69 remain = timeval_to_ns(&time.it_value);
70 if (remain > max)
71 remain = max;
72
73 return remain;
67} 74}
68 75
69long long os_nsecs(void) 76long long os_nsecs(void)
@@ -79,7 +86,44 @@ static int after_sleep_interval(struct timespec *ts)
79{ 86{
80 return 0; 87 return 0;
81} 88}
89
90static void deliver_alarm(void)
91{
92 alarm_handler(SIGVTALRM, NULL);
93}
94
95static unsigned long long sleep_time(unsigned long long nsecs)
96{
97 return nsecs;
98}
99
82#else 100#else
101unsigned long long last_tick;
102unsigned long long skew;
103
104static void deliver_alarm(void)
105{
106 unsigned long long this_tick = os_nsecs();
107 int one_tick = UM_NSEC_PER_SEC / UM_HZ;
108
109 if (last_tick == 0)
110 last_tick = this_tick - one_tick;
111
112 skew += this_tick - last_tick;
113
114 while (skew >= one_tick) {
115 alarm_handler(SIGVTALRM, NULL);
116 skew -= one_tick;
117 }
118
119 last_tick = this_tick;
120}
121
122static unsigned long long sleep_time(unsigned long long nsecs)
123{
124 return nsecs > skew ? nsecs - skew : 0;
125}
126
83static inline long long timespec_to_us(const struct timespec *ts) 127static inline long long timespec_to_us(const struct timespec *ts)
84{ 128{
85 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) + 129 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) +
@@ -102,6 +146,8 @@ static int after_sleep_interval(struct timespec *ts)
102 */ 146 */
103 if (start_usecs > usec) 147 if (start_usecs > usec)
104 start_usecs = usec; 148 start_usecs = usec;
149
150 start_usecs -= skew / UM_NSEC_PER_USEC;
105 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC, 151 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC,
106 .tv_usec = start_usecs % UM_USEC_PER_SEC }); 152 .tv_usec = start_usecs % UM_USEC_PER_SEC });
107 interval = ((struct itimerval) { { 0, usec }, tv }); 153 interval = ((struct itimerval) { { 0, usec }, tv });
@@ -113,8 +159,6 @@ static int after_sleep_interval(struct timespec *ts)
113} 159}
114#endif 160#endif
115 161
116extern void alarm_handler(int sig, struct sigcontext *sc);
117
118void idle_sleep(unsigned long long nsecs) 162void idle_sleep(unsigned long long nsecs)
119{ 163{
120 struct timespec ts; 164 struct timespec ts;
@@ -126,10 +170,12 @@ void idle_sleep(unsigned long long nsecs)
126 */ 170 */
127 if (nsecs == 0) 171 if (nsecs == 0)
128 nsecs = UM_NSEC_PER_SEC / UM_HZ; 172 nsecs = UM_NSEC_PER_SEC / UM_HZ;
173
174 nsecs = sleep_time(nsecs);
129 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC, 175 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC,
130 .tv_nsec = nsecs % UM_NSEC_PER_SEC }); 176 .tv_nsec = nsecs % UM_NSEC_PER_SEC });
131 177
132 if (nanosleep(&ts, &ts) == 0) 178 if (nanosleep(&ts, &ts) == 0)
133 alarm_handler(SIGVTALRM, NULL); 179 deliver_alarm();
134 after_sleep_interval(&ts); 180 after_sleep_interval(&ts);
135} 181}
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 6b4499906a6c..c9b176534d65 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -148,14 +148,13 @@ int peek_user(struct task_struct *child, long addr, long data)
148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
149{ 149{
150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
151 long fpregs[HOST_FP_SIZE]; 151 struct user_i387_struct fpregs;
152 152
153 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 153 err = save_fp_registers(userspace_pid[cpu], (unsigned long *) &fpregs);
154 err = save_fp_registers(userspace_pid[cpu], fpregs);
155 if (err) 154 if (err)
156 return err; 155 return err;
157 156
158 n = copy_to_user(buf, fpregs, sizeof(fpregs)); 157 n = copy_to_user(buf, &fpregs, sizeof(fpregs));
159 if(n > 0) 158 if(n > 0)
160 return -EFAULT; 159 return -EFAULT;
161 160
@@ -165,27 +164,26 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
165int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 164int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
166{ 165{
167 int n, cpu = ((struct thread_info *) child->stack)->cpu; 166 int n, cpu = ((struct thread_info *) child->stack)->cpu;
168 long fpregs[HOST_FP_SIZE]; 167 struct user_i387_struct fpregs;
169 168
170 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 169 n = copy_from_user(&fpregs, buf, sizeof(fpregs));
171 n = copy_from_user(fpregs, buf, sizeof(fpregs));
172 if (n > 0) 170 if (n > 0)
173 return -EFAULT; 171 return -EFAULT;
174 172
175 return restore_fp_registers(userspace_pid[cpu], fpregs); 173 return restore_fp_registers(userspace_pid[cpu],
174 (unsigned long *) &fpregs);
176} 175}
177 176
178int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 177int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
179{ 178{
180 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 179 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
181 long fpregs[HOST_XFP_SIZE]; 180 struct user_fxsr_struct fpregs;
182 181
183 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 182 err = save_fpx_registers(userspace_pid[cpu], (unsigned long *) &fpregs);
184 err = save_fpx_registers(userspace_pid[cpu], fpregs);
185 if (err) 183 if (err)
186 return err; 184 return err;
187 185
188 n = copy_to_user(buf, fpregs, sizeof(fpregs)); 186 n = copy_to_user(buf, &fpregs, sizeof(fpregs));
189 if(n > 0) 187 if(n > 0)
190 return -EFAULT; 188 return -EFAULT;
191 189
@@ -195,14 +193,14 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
195int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 193int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
196{ 194{
197 int n, cpu = ((struct thread_info *) child->stack)->cpu; 195 int n, cpu = ((struct thread_info *) child->stack)->cpu;
198 long fpregs[HOST_XFP_SIZE]; 196 struct user_fxsr_struct fpregs;
199 197
200 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 198 n = copy_from_user(&fpregs, buf, sizeof(fpregs));
201 n = copy_from_user(fpregs, buf, sizeof(fpregs));
202 if (n > 0) 199 if (n > 0)
203 return -EFAULT; 200 return -EFAULT;
204 201
205 return restore_fpx_registers(userspace_pid[cpu], fpregs); 202 return restore_fpx_registers(userspace_pid[cpu],
203 (unsigned long *) &fpregs);
206} 204}
207 205
208long subarch_ptrace(struct task_struct *child, long request, long addr, 206long subarch_ptrace(struct task_struct *child, long request, long addr,
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 39bd32bf84f0..5f883bfe773f 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -22,7 +22,7 @@ void foo(void)
22 OFFSET(HOST_SC_CR2, sigcontext, cr2); 22 OFFSET(HOST_SC_CR2, sigcontext, cr2);
23 23
24 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct)); 24 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct));
25 DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fpxregs_struct)); 25 DEFINE_LONGS(HOST_FPX_SIZE, sizeof(struct user_fpxregs_struct));
26 26
27 DEFINE(HOST_IP, EIP); 27 DEFINE(HOST_IP, EIP);
28 DEFINE(HOST_SP, UESP); 28 DEFINE(HOST_SP, UESP);
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 2f3443c6e859..973585414a66 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -24,7 +24,6 @@ void foo(void)
24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); 24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
25 25
26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); 26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
27 DEFINE(HOST_XFP_SIZE, 0);
28 DEFINE_LONGS(HOST_RBX, RBX); 27 DEFINE_LONGS(HOST_RBX, RBX);
29 DEFINE_LONGS(HOST_RCX, RCX); 28 DEFINE_LONGS(HOST_RCX, RCX);
30 DEFINE_LONGS(HOST_RDI, RDI); 29 DEFINE_LONGS(HOST_RDI, RDI);