aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/Kconfig.um6
-rw-r--r--arch/um/defconfig1
-rw-r--r--arch/um/drivers/harddog_kern.c14
-rw-r--r--arch/um/drivers/hostaudio_kern.c26
-rw-r--r--arch/um/drivers/mconsole_kern.c3
-rw-r--r--arch/um/drivers/mmapper_kern.c1
-rw-r--r--arch/um/drivers/net_kern.c17
-rw-r--r--arch/um/drivers/random.c1
-rw-r--r--arch/um/drivers/ubd_kern.c20
-rw-r--r--arch/um/include/asm/dma-mapping.h119
-rw-r--r--arch/um/include/asm/pgtable.h2
-rw-r--r--arch/um/include/asm/system.h49
-rw-r--r--arch/um/kernel/dyn.lds.S14
-rw-r--r--arch/um/kernel/exec.c13
-rw-r--r--arch/um/kernel/internal.h2
-rw-r--r--arch/um/kernel/irq.c21
-rw-r--r--arch/um/kernel/ptrace.c23
-rw-r--r--arch/um/kernel/syscall.c8
-rw-r--r--arch/um/kernel/uml.lds.S19
-rw-r--r--arch/um/os-Linux/time.c2
-rw-r--r--arch/um/sys-i386/ptrace.c4
-rw-r--r--arch/um/sys-x86_64/ptrace.c11
22 files changed, 144 insertions, 232 deletions
diff --git a/arch/um/Kconfig.um b/arch/um/Kconfig.um
index ec2b8da1aba4..50d6aa20c353 100644
--- a/arch/um/Kconfig.um
+++ b/arch/um/Kconfig.um
@@ -120,6 +120,9 @@ config SMP
120 120
121 If you don't know what to do, say N. 121 If you don't know what to do, say N.
122 122
123config GENERIC_HARDIRQS_NO__DO_IRQ
124 def_bool y
125
123config NR_CPUS 126config NR_CPUS
124 int "Maximum number of CPUs (2-32)" 127 int "Maximum number of CPUs (2-32)"
125 range 2 32 128 range 2 32
@@ -147,3 +150,6 @@ config KERNEL_STACK_ORDER
147 This option determines the size of UML kernel stacks. They will 150 This option determines the size of UML kernel stacks. They will
148 be 1 << order pages. The default is OK unless you're running Valgrind 151 be 1 << order pages. The default is OK unless you're running Valgrind
149 on UML, in which case, set this to 3. 152 on UML, in which case, set this to 3.
153
154config NO_DMA
155 def_bool y
diff --git a/arch/um/defconfig b/arch/um/defconfig
index 6bd456f96f90..564f3de65b4a 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -566,7 +566,6 @@ CONFIG_CRC32=m
566# CONFIG_CRC7 is not set 566# CONFIG_CRC7 is not set
567# CONFIG_LIBCRC32C is not set 567# CONFIG_LIBCRC32C is not set
568CONFIG_PLIST=y 568CONFIG_PLIST=y
569CONFIG_HAS_DMA=y
570 569
571# 570#
572# SCSI device support 571# SCSI device support
diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c
index cfcac1ff4cf2..2d0266d0254d 100644
--- a/arch/um/drivers/harddog_kern.c
+++ b/arch/um/drivers/harddog_kern.c
@@ -42,7 +42,7 @@
42#include <linux/miscdevice.h> 42#include <linux/miscdevice.h>
43#include <linux/watchdog.h> 43#include <linux/watchdog.h>
44#include <linux/reboot.h> 44#include <linux/reboot.h>
45#include <linux/smp_lock.h> 45#include <linux/mutex.h>
46#include <linux/init.h> 46#include <linux/init.h>
47#include <linux/spinlock.h> 47#include <linux/spinlock.h>
48#include <asm/uaccess.h> 48#include <asm/uaccess.h>
@@ -50,6 +50,7 @@
50 50
51MODULE_LICENSE("GPL"); 51MODULE_LICENSE("GPL");
52 52
53static DEFINE_MUTEX(harddog_mutex);
53static DEFINE_SPINLOCK(lock); 54static DEFINE_SPINLOCK(lock);
54static int timer_alive; 55static int timer_alive;
55static int harddog_in_fd = -1; 56static int harddog_in_fd = -1;
@@ -66,7 +67,7 @@ static int harddog_open(struct inode *inode, struct file *file)
66 int err = -EBUSY; 67 int err = -EBUSY;
67 char *sock = NULL; 68 char *sock = NULL;
68 69
69 lock_kernel(); 70 mutex_lock(&harddog_mutex);
70 spin_lock(&lock); 71 spin_lock(&lock);
71 if(timer_alive) 72 if(timer_alive)
72 goto err; 73 goto err;
@@ -83,11 +84,11 @@ static int harddog_open(struct inode *inode, struct file *file)
83 84
84 timer_alive = 1; 85 timer_alive = 1;
85 spin_unlock(&lock); 86 spin_unlock(&lock);
86 unlock_kernel(); 87 mutex_unlock(&harddog_mutex);
87 return nonseekable_open(inode, file); 88 return nonseekable_open(inode, file);
88err: 89err:
89 spin_unlock(&lock); 90 spin_unlock(&lock);
90 unlock_kernel(); 91 mutex_unlock(&harddog_mutex);
91 return err; 92 return err;
92} 93}
93 94
@@ -153,9 +154,9 @@ static long harddog_ioctl(struct file *file,
153{ 154{
154 long ret; 155 long ret;
155 156
156 lock_kernel(); 157 mutex_lock(&harddog_mutex);
157 ret = harddog_ioctl_unlocked(file, cmd, arg); 158 ret = harddog_ioctl_unlocked(file, cmd, arg);
158 unlock_kernel(); 159 mutex_unlock(&harddog_mutex);
159 160
160 return ret; 161 return ret;
161} 162}
@@ -166,6 +167,7 @@ static const struct file_operations harddog_fops = {
166 .unlocked_ioctl = harddog_ioctl, 167 .unlocked_ioctl = harddog_ioctl,
167 .open = harddog_open, 168 .open = harddog_open,
168 .release = harddog_release, 169 .release = harddog_release,
170 .llseek = no_llseek,
169}; 171};
170 172
171static struct miscdevice harddog_miscdev = { 173static struct miscdevice harddog_miscdev = {
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index 0c46e398cd8f..f9f6a4e20590 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -8,7 +8,7 @@
8#include "linux/slab.h" 8#include "linux/slab.h"
9#include "linux/sound.h" 9#include "linux/sound.h"
10#include "linux/soundcard.h" 10#include "linux/soundcard.h"
11#include "linux/smp_lock.h" 11#include "linux/mutex.h"
12#include "asm/uaccess.h" 12#include "asm/uaccess.h"
13#include "init.h" 13#include "init.h"
14#include "os.h" 14#include "os.h"
@@ -40,6 +40,11 @@ static char *mixer = HOSTAUDIO_DEV_MIXER;
40" This is used to specify the host mixer device to the hostaudio driver.\n"\ 40" This is used to specify the host mixer device to the hostaudio driver.\n"\
41" The default is \"" HOSTAUDIO_DEV_MIXER "\".\n\n" 41" The default is \"" HOSTAUDIO_DEV_MIXER "\".\n\n"
42 42
43module_param(dsp, charp, 0644);
44MODULE_PARM_DESC(dsp, DSP_HELP);
45module_param(mixer, charp, 0644);
46MODULE_PARM_DESC(mixer, MIXER_HELP);
47
43#ifndef MODULE 48#ifndef MODULE
44static int set_dsp(char *name, int *add) 49static int set_dsp(char *name, int *add)
45{ 50{
@@ -56,17 +61,10 @@ static int set_mixer(char *name, int *add)
56} 61}
57 62
58__uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP); 63__uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP);
59
60#else /*MODULE*/
61
62module_param(dsp, charp, 0644);
63MODULE_PARM_DESC(dsp, DSP_HELP);
64
65module_param(mixer, charp, 0644);
66MODULE_PARM_DESC(mixer, MIXER_HELP);
67
68#endif 64#endif
69 65
66static DEFINE_MUTEX(hostaudio_mutex);
67
70/* /dev/dsp file operations */ 68/* /dev/dsp file operations */
71 69
72static ssize_t hostaudio_read(struct file *file, char __user *buffer, 70static ssize_t hostaudio_read(struct file *file, char __user *buffer,
@@ -202,9 +200,9 @@ static int hostaudio_open(struct inode *inode, struct file *file)
202 w = 1; 200 w = 1;
203 201
204 kparam_block_sysfs_write(dsp); 202 kparam_block_sysfs_write(dsp);
205 lock_kernel(); 203 mutex_lock(&hostaudio_mutex);
206 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); 204 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);
207 unlock_kernel(); 205 mutex_unlock(&hostaudio_mutex);
208 kparam_unblock_sysfs_write(dsp); 206 kparam_unblock_sysfs_write(dsp);
209 207
210 if (ret < 0) { 208 if (ret < 0) {
@@ -263,9 +261,9 @@ static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
263 w = 1; 261 w = 1;
264 262
265 kparam_block_sysfs_write(mixer); 263 kparam_block_sysfs_write(mixer);
266 lock_kernel(); 264 mutex_lock(&hostaudio_mutex);
267 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); 265 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);
268 unlock_kernel(); 266 mutex_unlock(&hostaudio_mutex);
269 kparam_unblock_sysfs_write(mixer); 267 kparam_unblock_sysfs_write(mixer);
270 268
271 if (ret < 0) { 269 if (ret < 0) {
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index de317d0c3294..975613b23dcf 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -690,7 +690,7 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
690static void sysrq_proc(void *arg) 690static void sysrq_proc(void *arg)
691{ 691{
692 char *op = arg; 692 char *op = arg;
693 handle_sysrq(*op, NULL); 693 handle_sysrq(*op);
694} 694}
695 695
696void mconsole_sysrq(struct mc_request *req) 696void mconsole_sysrq(struct mc_request *req)
@@ -843,6 +843,7 @@ static ssize_t mconsole_proc_write(struct file *file,
843static const struct file_operations mconsole_proc_fops = { 843static const struct file_operations mconsole_proc_fops = {
844 .owner = THIS_MODULE, 844 .owner = THIS_MODULE,
845 .write = mconsole_proc_write, 845 .write = mconsole_proc_write,
846 .llseek = noop_llseek,
846}; 847};
847 848
848static int create_proc_mconsole(void) 849static int create_proc_mconsole(void)
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c
index 7158393b6793..8501e7d0015c 100644
--- a/arch/um/drivers/mmapper_kern.c
+++ b/arch/um/drivers/mmapper_kern.c
@@ -93,6 +93,7 @@ static const struct file_operations mmapper_fops = {
93 .mmap = mmapper_mmap, 93 .mmap = mmapper_mmap,
94 .open = mmapper_open, 94 .open = mmapper_open,
95 .release = mmapper_release, 95 .release = mmapper_release,
96 .llseek = default_llseek,
96}; 97};
97 98
98/* 99/*
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 2ab233ba32c1..47d0c37897d5 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -255,18 +255,6 @@ static void uml_net_tx_timeout(struct net_device *dev)
255 netif_wake_queue(dev); 255 netif_wake_queue(dev);
256} 256}
257 257
258static int uml_net_set_mac(struct net_device *dev, void *addr)
259{
260 struct uml_net_private *lp = netdev_priv(dev);
261 struct sockaddr *hwaddr = addr;
262
263 spin_lock_irq(&lp->lock);
264 eth_mac_addr(dev, hwaddr->sa_data);
265 spin_unlock_irq(&lp->lock);
266
267 return 0;
268}
269
270static int uml_net_change_mtu(struct net_device *dev, int new_mtu) 258static int uml_net_change_mtu(struct net_device *dev, int new_mtu)
271{ 259{
272 dev->mtu = new_mtu; 260 dev->mtu = new_mtu;
@@ -373,7 +361,7 @@ static const struct net_device_ops uml_netdev_ops = {
373 .ndo_start_xmit = uml_net_start_xmit, 361 .ndo_start_xmit = uml_net_start_xmit,
374 .ndo_set_multicast_list = uml_net_set_multicast_list, 362 .ndo_set_multicast_list = uml_net_set_multicast_list,
375 .ndo_tx_timeout = uml_net_tx_timeout, 363 .ndo_tx_timeout = uml_net_tx_timeout,
376 .ndo_set_mac_address = uml_net_set_mac, 364 .ndo_set_mac_address = eth_mac_addr,
377 .ndo_change_mtu = uml_net_change_mtu, 365 .ndo_change_mtu = uml_net_change_mtu,
378 .ndo_validate_addr = eth_validate_addr, 366 .ndo_validate_addr = eth_validate_addr,
379}; 367};
@@ -472,7 +460,8 @@ static void eth_configure(int n, void *init, char *mac,
472 ((*transport->user->init)(&lp->user, dev) != 0)) 460 ((*transport->user->init)(&lp->user, dev) != 0))
473 goto out_unregister; 461 goto out_unregister;
474 462
475 eth_mac_addr(dev, device->mac); 463 /* don't use eth_mac_addr, it will not work here */
464 memcpy(dev->dev_addr, device->mac, ETH_ALEN);
476 dev->mtu = transport->user->mtu; 465 dev->mtu = transport->user->mtu;
477 dev->netdev_ops = &uml_netdev_ops; 466 dev->netdev_ops = &uml_netdev_ops;
478 dev->ethtool_ops = &uml_net_ethtool_ops; 467 dev->ethtool_ops = &uml_net_ethtool_ops;
diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
index 4949044773ba..981085a93f30 100644
--- a/arch/um/drivers/random.c
+++ b/arch/um/drivers/random.c
@@ -100,6 +100,7 @@ static const struct file_operations rng_chrdev_ops = {
100 .owner = THIS_MODULE, 100 .owner = THIS_MODULE,
101 .open = rng_dev_open, 101 .open = rng_dev_open,
102 .read = rng_dev_read, 102 .read = rng_dev_read,
103 .llseek = noop_llseek,
103}; 104};
104 105
105/* rng_init shouldn't be called more than once at boot time */ 106/* rng_init shouldn't be called more than once at boot time */
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 1bcd208c459f..ba4a98ba39c0 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -33,7 +33,7 @@
33#include "linux/mm.h" 33#include "linux/mm.h"
34#include "linux/slab.h" 34#include "linux/slab.h"
35#include "linux/vmalloc.h" 35#include "linux/vmalloc.h"
36#include "linux/smp_lock.h" 36#include "linux/mutex.h"
37#include "linux/blkpg.h" 37#include "linux/blkpg.h"
38#include "linux/genhd.h" 38#include "linux/genhd.h"
39#include "linux/spinlock.h" 39#include "linux/spinlock.h"
@@ -100,6 +100,7 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data)
100#define DRIVER_NAME "uml-blkdev" 100#define DRIVER_NAME "uml-blkdev"
101 101
102static DEFINE_MUTEX(ubd_lock); 102static DEFINE_MUTEX(ubd_lock);
103static DEFINE_MUTEX(ubd_mutex); /* replaces BKL, might not be needed */
103 104
104static int ubd_open(struct block_device *bdev, fmode_t mode); 105static int ubd_open(struct block_device *bdev, fmode_t mode);
105static int ubd_release(struct gendisk *disk, fmode_t mode); 106static int ubd_release(struct gendisk *disk, fmode_t mode);
@@ -163,6 +164,7 @@ struct ubd {
163 struct scatterlist sg[MAX_SG]; 164 struct scatterlist sg[MAX_SG];
164 struct request *request; 165 struct request *request;
165 int start_sg, end_sg; 166 int start_sg, end_sg;
167 sector_t rq_pos;
166}; 168};
167 169
168#define DEFAULT_COW { \ 170#define DEFAULT_COW { \
@@ -187,6 +189,7 @@ struct ubd {
187 .request = NULL, \ 189 .request = NULL, \
188 .start_sg = 0, \ 190 .start_sg = 0, \
189 .end_sg = 0, \ 191 .end_sg = 0, \
192 .rq_pos = 0, \
190} 193}
191 194
192/* Protected by ubd_lock */ 195/* Protected by ubd_lock */
@@ -1099,7 +1102,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1099 struct ubd *ubd_dev = disk->private_data; 1102 struct ubd *ubd_dev = disk->private_data;
1100 int err = 0; 1103 int err = 0;
1101 1104
1102 lock_kernel(); 1105 mutex_lock(&ubd_mutex);
1103 if(ubd_dev->count == 0){ 1106 if(ubd_dev->count == 0){
1104 err = ubd_open_dev(ubd_dev); 1107 err = ubd_open_dev(ubd_dev);
1105 if(err){ 1108 if(err){
@@ -1118,7 +1121,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1118 err = -EROFS; 1121 err = -EROFS;
1119 }*/ 1122 }*/
1120out: 1123out:
1121 unlock_kernel(); 1124 mutex_unlock(&ubd_mutex);
1122 return err; 1125 return err;
1123} 1126}
1124 1127
@@ -1126,10 +1129,10 @@ static int ubd_release(struct gendisk *disk, fmode_t mode)
1126{ 1129{
1127 struct ubd *ubd_dev = disk->private_data; 1130 struct ubd *ubd_dev = disk->private_data;
1128 1131
1129 lock_kernel(); 1132 mutex_lock(&ubd_mutex);
1130 if(--ubd_dev->count == 0) 1133 if(--ubd_dev->count == 0)
1131 ubd_close_dev(ubd_dev); 1134 ubd_close_dev(ubd_dev);
1132 unlock_kernel(); 1135 mutex_unlock(&ubd_mutex);
1133 return 0; 1136 return 0;
1134} 1137}
1135 1138
@@ -1228,7 +1231,6 @@ static void do_ubd_request(struct request_queue *q)
1228{ 1231{
1229 struct io_thread_req *io_req; 1232 struct io_thread_req *io_req;
1230 struct request *req; 1233 struct request *req;
1231 sector_t sector;
1232 int n; 1234 int n;
1233 1235
1234 while(1){ 1236 while(1){
@@ -1239,12 +1241,12 @@ static void do_ubd_request(struct request_queue *q)
1239 return; 1241 return;
1240 1242
1241 dev->request = req; 1243 dev->request = req;
1244 dev->rq_pos = blk_rq_pos(req);
1242 dev->start_sg = 0; 1245 dev->start_sg = 0;
1243 dev->end_sg = blk_rq_map_sg(q, req, dev->sg); 1246 dev->end_sg = blk_rq_map_sg(q, req, dev->sg);
1244 } 1247 }
1245 1248
1246 req = dev->request; 1249 req = dev->request;
1247 sector = blk_rq_pos(req);
1248 while(dev->start_sg < dev->end_sg){ 1250 while(dev->start_sg < dev->end_sg){
1249 struct scatterlist *sg = &dev->sg[dev->start_sg]; 1251 struct scatterlist *sg = &dev->sg[dev->start_sg];
1250 1252
@@ -1256,10 +1258,9 @@ static void do_ubd_request(struct request_queue *q)
1256 return; 1258 return;
1257 } 1259 }
1258 prepare_request(req, io_req, 1260 prepare_request(req, io_req,
1259 (unsigned long long)sector << 9, 1261 (unsigned long long)dev->rq_pos << 9,
1260 sg->offset, sg->length, sg_page(sg)); 1262 sg->offset, sg->length, sg_page(sg));
1261 1263
1262 sector += sg->length >> 9;
1263 n = os_write_file(thread_fd, &io_req, 1264 n = os_write_file(thread_fd, &io_req,
1264 sizeof(struct io_thread_req *)); 1265 sizeof(struct io_thread_req *));
1265 if(n != sizeof(struct io_thread_req *)){ 1266 if(n != sizeof(struct io_thread_req *)){
@@ -1272,6 +1273,7 @@ static void do_ubd_request(struct request_queue *q)
1272 return; 1273 return;
1273 } 1274 }
1274 1275
1276 dev->rq_pos += sg->length >> 9;
1275 dev->start_sg++; 1277 dev->start_sg++;
1276 } 1278 }
1277 dev->end_sg = 0; 1279 dev->end_sg = 0;
diff --git a/arch/um/include/asm/dma-mapping.h b/arch/um/include/asm/dma-mapping.h
deleted file mode 100644
index 17a2cb5a4178..000000000000
--- a/arch/um/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,119 +0,0 @@
1#ifndef _ASM_DMA_MAPPING_H
2#define _ASM_DMA_MAPPING_H
3
4#include <asm/scatterlist.h>
5
6static inline int
7dma_supported(struct device *dev, u64 mask)
8{
9 BUG();
10 return(0);
11}
12
13static inline int
14dma_set_mask(struct device *dev, u64 dma_mask)
15{
16 BUG();
17 return(0);
18}
19
20static inline void *
21dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
22 gfp_t flag)
23{
24 BUG();
25 return((void *) 0);
26}
27
28static inline void
29dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
30 dma_addr_t dma_handle)
31{
32 BUG();
33}
34
35static inline dma_addr_t
36dma_map_single(struct device *dev, void *cpu_addr, size_t size,
37 enum dma_data_direction direction)
38{
39 BUG();
40 return(0);
41}
42
43static inline void
44dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
45 enum dma_data_direction direction)
46{
47 BUG();
48}
49
50static inline dma_addr_t
51dma_map_page(struct device *dev, struct page *page,
52 unsigned long offset, size_t size,
53 enum dma_data_direction direction)
54{
55 BUG();
56 return(0);
57}
58
59static inline void
60dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
61 enum dma_data_direction direction)
62{
63 BUG();
64}
65
66static inline int
67dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
68 enum dma_data_direction direction)
69{
70 BUG();
71 return(0);
72}
73
74static inline void
75dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
76 enum dma_data_direction direction)
77{
78 BUG();
79}
80
81static inline void
82dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
83 enum dma_data_direction direction)
84{
85 BUG();
86}
87
88static inline void
89dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
90 enum dma_data_direction direction)
91{
92 BUG();
93}
94
95#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
96#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
97
98static inline int
99dma_get_cache_alignment(void)
100{
101 BUG();
102 return(0);
103}
104
105static inline void
106dma_cache_sync(struct device *dev, void *vaddr, size_t size,
107 enum dma_data_direction direction)
108{
109 BUG();
110}
111
112static inline int
113dma_mapping_error(struct device *dev, dma_addr_t dma_handle)
114{
115 BUG();
116 return 0;
117}
118
119#endif
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
index a9f7251b4a8d..41474fb5eee7 100644
--- a/arch/um/include/asm/pgtable.h
+++ b/arch/um/include/asm/pgtable.h
@@ -338,9 +338,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
338 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) 338 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
339#define pte_offset_map(dir, address) \ 339#define pte_offset_map(dir, address) \
340 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) 340 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
341#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
342#define pte_unmap(pte) do { } while (0) 341#define pte_unmap(pte) do { } while (0)
343#define pte_unmap_nested(pte) do { } while (0)
344 342
345struct mm_struct; 343struct mm_struct;
346extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr); 344extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
diff --git a/arch/um/include/asm/system.h b/arch/um/include/asm/system.h
index 93af1cf0907d..68a90ecd1450 100644
--- a/arch/um/include/asm/system.h
+++ b/arch/um/include/asm/system.h
@@ -8,23 +8,38 @@ extern int set_signals(int enable);
8extern void block_signals(void); 8extern void block_signals(void);
9extern void unblock_signals(void); 9extern void unblock_signals(void);
10 10
11#define local_save_flags(flags) do { typecheck(unsigned long, flags); \ 11static inline unsigned long arch_local_save_flags(void)
12 (flags) = get_signals(); } while(0) 12{
13#define local_irq_restore(flags) do { typecheck(unsigned long, flags); \ 13 return get_signals();
14 set_signals(flags); } while(0) 14}
15 15
16#define local_irq_save(flags) do { local_save_flags(flags); \ 16static inline void arch_local_irq_restore(unsigned long flags)
17 local_irq_disable(); } while(0) 17{
18 18 set_signals(flags);
19#define local_irq_enable() unblock_signals() 19}
20#define local_irq_disable() block_signals() 20
21 21static inline void arch_local_irq_enable(void)
22#define irqs_disabled() \ 22{
23({ \ 23 unblock_signals();
24 unsigned long flags; \ 24}
25 local_save_flags(flags); \ 25
26 (flags == 0); \ 26static inline void arch_local_irq_disable(void)
27}) 27{
28 block_signals();
29}
30
31static inline unsigned long arch_local_irq_save(void)
32{
33 unsigned long flags;
34 flags = arch_local_save_flags();
35 arch_local_irq_disable();
36 return flags;
37}
38
39static inline bool arch_irqs_disabled(void)
40{
41 return arch_local_save_flags() == 0;
42}
28 43
29extern void *_switch_to(void *prev, void *next, void *last); 44extern void *_switch_to(void *prev, void *next, void *last);
30#define switch_to(prev, next, last) prev = _switch_to(prev, next, last) 45#define switch_to(prev, next, last) prev = _switch_to(prev, next, last)
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 69268014dd8e..a3cab6d3ae02 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -50,8 +50,18 @@ SECTIONS
50 .rela.got : { *(.rela.got) } 50 .rela.got : { *(.rela.got) }
51 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 51 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
52 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 52 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
53 .rel.plt : { *(.rel.plt) } 53 .rel.plt : {
54 .rela.plt : { *(.rela.plt) } 54 *(.rel.plt)
55 PROVIDE_HIDDEN(__rel_iplt_start = .);
56 *(.rel.iplt)
57 PROVIDE_HIDDEN(__rel_iplt_end = .);
58 }
59 .rela.plt : {
60 *(.rela.plt)
61 PROVIDE_HIDDEN(__rela_iplt_start = .);
62 *(.rela.iplt)
63 PROVIDE_HIDDEN(__rela_iplt_end = .);
64 }
55 .init : { 65 .init : {
56 KEEP (*(.init)) 66 KEEP (*(.init))
57 } =0x90909090 67 } =0x90909090
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 59b20d93b6d4..340268be00b5 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -44,8 +44,9 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
44 PT_REGS_SP(regs) = esp; 44 PT_REGS_SP(regs) = esp;
45} 45}
46 46
47static long execve1(const char *file, char __user * __user *argv, 47static long execve1(const char *file,
48 char __user *__user *env) 48 const char __user *const __user *argv,
49 const char __user *const __user *env)
49{ 50{
50 long error; 51 long error;
51 52
@@ -61,7 +62,7 @@ static long execve1(const char *file, char __user * __user *argv,
61 return error; 62 return error;
62} 63}
63 64
64long um_execve(const char *file, char __user *__user *argv, char __user *__user *env) 65long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env)
65{ 66{
66 long err; 67 long err;
67 68
@@ -71,19 +72,17 @@ long um_execve(const char *file, char __user *__user *argv, char __user *__user
71 return err; 72 return err;
72} 73}
73 74
74long sys_execve(const char __user *file, char __user *__user *argv, 75long sys_execve(const char __user *file, const char __user *const __user *argv,
75 char __user *__user *env) 76 const char __user *const __user *env)
76{ 77{
77 long error; 78 long error;
78 char *filename; 79 char *filename;
79 80
80 lock_kernel();
81 filename = getname(file); 81 filename = getname(file);
82 error = PTR_ERR(filename); 82 error = PTR_ERR(filename);
83 if (IS_ERR(filename)) goto out; 83 if (IS_ERR(filename)) goto out;
84 error = execve1(filename, argv, env); 84 error = execve1(filename, argv, env);
85 putname(filename); 85 putname(filename);
86 out: 86 out:
87 unlock_kernel();
88 return error; 87 return error;
89} 88}
diff --git a/arch/um/kernel/internal.h b/arch/um/kernel/internal.h
index 1303a105fe91..5bf97db24a04 100644
--- a/arch/um/kernel/internal.h
+++ b/arch/um/kernel/internal.h
@@ -1 +1 @@
extern long um_execve(const char *file, char __user *__user *argv, char __user *__user *env); extern long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env);
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index a3f0b04d7101..3f0ac9e0c966 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -46,7 +46,7 @@ int show_interrupts(struct seq_file *p, void *v)
46 for_each_online_cpu(j) 46 for_each_online_cpu(j)
47 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 47 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
48#endif 48#endif
49 seq_printf(p, " %14s", irq_desc[i].chip->typename); 49 seq_printf(p, " %14s", irq_desc[i].chip->name);
50 seq_printf(p, " %s", action->name); 50 seq_printf(p, " %s", action->name);
51 51
52 for (action=action->next; action; action = action->next) 52 for (action=action->next; action; action = action->next)
@@ -334,7 +334,7 @@ unsigned int do_IRQ(int irq, struct uml_pt_regs *regs)
334{ 334{
335 struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)regs); 335 struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)regs);
336 irq_enter(); 336 irq_enter();
337 __do_IRQ(irq); 337 generic_handle_irq(irq);
338 irq_exit(); 338 irq_exit();
339 set_irq_regs(old_regs); 339 set_irq_regs(old_regs);
340 return 1; 340 return 1;
@@ -369,7 +369,7 @@ static void dummy(unsigned int irq)
369 369
370/* This is used for everything else than the timer. */ 370/* This is used for everything else than the timer. */
371static struct irq_chip normal_irq_type = { 371static struct irq_chip normal_irq_type = {
372 .typename = "SIGIO", 372 .name = "SIGIO",
373 .release = free_irq_by_irq_and_dev, 373 .release = free_irq_by_irq_and_dev,
374 .disable = dummy, 374 .disable = dummy,
375 .enable = dummy, 375 .enable = dummy,
@@ -378,7 +378,7 @@ static struct irq_chip normal_irq_type = {
378}; 378};
379 379
380static struct irq_chip SIGVTALRM_irq_type = { 380static struct irq_chip SIGVTALRM_irq_type = {
381 .typename = "SIGVTALRM", 381 .name = "SIGVTALRM",
382 .release = free_irq_by_irq_and_dev, 382 .release = free_irq_by_irq_and_dev,
383 .shutdown = dummy, /* never called */ 383 .shutdown = dummy, /* never called */
384 .disable = dummy, 384 .disable = dummy,
@@ -391,17 +391,10 @@ void __init init_IRQ(void)
391{ 391{
392 int i; 392 int i;
393 393
394 irq_desc[TIMER_IRQ].status = IRQ_DISABLED; 394 set_irq_chip_and_handler(TIMER_IRQ, &SIGVTALRM_irq_type, handle_edge_irq);
395 irq_desc[TIMER_IRQ].action = NULL; 395
396 irq_desc[TIMER_IRQ].depth = 1;
397 irq_desc[TIMER_IRQ].chip = &SIGVTALRM_irq_type;
398 enable_irq(TIMER_IRQ);
399 for (i = 1; i < NR_IRQS; i++) { 396 for (i = 1; i < NR_IRQS; i++) {
400 irq_desc[i].status = IRQ_DISABLED; 397 set_irq_chip_and_handler(i, &normal_irq_type, handle_edge_irq);
401 irq_desc[i].action = NULL;
402 irq_desc[i].depth = 1;
403 irq_desc[i].chip = &normal_irq_type;
404 enable_irq(i);
405 } 398 }
406} 399}
407 400
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index e0510496596c..a5e33f29bbeb 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -42,10 +42,12 @@ void ptrace_disable(struct task_struct *child)
42extern int peek_user(struct task_struct * child, long addr, long data); 42extern int peek_user(struct task_struct * child, long addr, long data);
43extern int poke_user(struct task_struct * child, long addr, long data); 43extern int poke_user(struct task_struct * child, long addr, long data);
44 44
45long arch_ptrace(struct task_struct *child, long request, long addr, long data) 45long arch_ptrace(struct task_struct *child, long request,
46 unsigned long addr, unsigned long data)
46{ 47{
47 int i, ret; 48 int i, ret;
48 unsigned long __user *p = (void __user *)(unsigned long)data; 49 unsigned long __user *p = (void __user *)data;
50 void __user *vp = p;
49 51
50 switch (request) { 52 switch (request) {
51 /* read word at location addr. */ 53 /* read word at location addr. */
@@ -107,24 +109,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
107#endif 109#endif
108#ifdef PTRACE_GETFPREGS 110#ifdef PTRACE_GETFPREGS
109 case PTRACE_GETFPREGS: /* Get the child FPU state. */ 111 case PTRACE_GETFPREGS: /* Get the child FPU state. */
110 ret = get_fpregs((struct user_i387_struct __user *) data, 112 ret = get_fpregs(vp, child);
111 child);
112 break; 113 break;
113#endif 114#endif
114#ifdef PTRACE_SETFPREGS 115#ifdef PTRACE_SETFPREGS
115 case PTRACE_SETFPREGS: /* Set the child FPU state. */ 116 case PTRACE_SETFPREGS: /* Set the child FPU state. */
116 ret = set_fpregs((struct user_i387_struct __user *) data, 117 ret = set_fpregs(vp, child);
117 child);
118 break; 118 break;
119#endif 119#endif
120 case PTRACE_GET_THREAD_AREA: 120 case PTRACE_GET_THREAD_AREA:
121 ret = ptrace_get_thread_area(child, addr, 121 ret = ptrace_get_thread_area(child, addr, vp);
122 (struct user_desc __user *) data);
123 break; 122 break;
124 123
125 case PTRACE_SET_THREAD_AREA: 124 case PTRACE_SET_THREAD_AREA:
126 ret = ptrace_set_thread_area(child, addr, 125 ret = ptrace_set_thread_area(child, addr, datavp);
127 (struct user_desc __user *) data);
128 break; 126 break;
129 127
130 case PTRACE_FAULTINFO: { 128 case PTRACE_FAULTINFO: {
@@ -134,7 +132,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
134 * On i386, ptrace_faultinfo is smaller! 132 * On i386, ptrace_faultinfo is smaller!
135 */ 133 */
136 ret = copy_to_user(p, &child->thread.arch.faultinfo, 134 ret = copy_to_user(p, &child->thread.arch.faultinfo,
137 sizeof(struct ptrace_faultinfo)); 135 sizeof(struct ptrace_faultinfo)) ?
136 -EIO : 0;
138 break; 137 break;
139 } 138 }
140 139
@@ -158,7 +157,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
158#ifdef PTRACE_ARCH_PRCTL 157#ifdef PTRACE_ARCH_PRCTL
159 case PTRACE_ARCH_PRCTL: 158 case PTRACE_ARCH_PRCTL:
160 /* XXX Calls ptrace on the host - needs some SMP thinking */ 159 /* XXX Calls ptrace on the host - needs some SMP thinking */
161 ret = arch_prctl(child, data, (void *) addr); 160 ret = arch_prctl(child, data, (void __user *) addr);
162 break; 161 break;
163#endif 162#endif
164 default: 163 default:
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 7427c0b1930c..f958cb876ee3 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -51,15 +51,17 @@ long old_mmap(unsigned long addr, unsigned long len,
51 return err; 51 return err;
52} 52}
53 53
54int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 54int kernel_execve(const char *filename,
55 const char *const argv[],
56 const char *const envp[])
55{ 57{
56 mm_segment_t fs; 58 mm_segment_t fs;
57 int ret; 59 int ret;
58 60
59 fs = get_fs(); 61 fs = get_fs();
60 set_fs(KERNEL_DS); 62 set_fs(KERNEL_DS);
61 ret = um_execve(filename, (char __user *__user *)argv, 63 ret = um_execve(filename, (const char __user *const __user *)argv,
62 (char __user *__user *) envp); 64 (const char __user *const __user *) envp);
63 set_fs(fs); 65 set_fs(fs);
64 66
65 return ret; 67 return ret;
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index ec6378550671..fbd99402d4d2 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -22,7 +22,7 @@ SECTIONS
22 _text = .; 22 _text = .;
23 _stext = .; 23 _stext = .;
24 __init_begin = .; 24 __init_begin = .;
25 INIT_TEXT_SECTION(PAGE_SIZE) 25 INIT_TEXT_SECTION(0)
26 . = ALIGN(PAGE_SIZE); 26 . = ALIGN(PAGE_SIZE);
27 27
28 .text : 28 .text :
@@ -43,6 +43,23 @@ SECTIONS
43 __syscall_stub_end = .; 43 __syscall_stub_end = .;
44 } 44 }
45 45
46 /*
47 * These are needed even in a static link, even if they wind up being empty.
48 * Newer glibc needs these __rel{,a}_iplt_{start,end} symbols.
49 */
50 .rel.plt : {
51 *(.rel.plt)
52 PROVIDE_HIDDEN(__rel_iplt_start = .);
53 *(.rel.iplt)
54 PROVIDE_HIDDEN(__rel_iplt_end = .);
55 }
56 .rela.plt : {
57 *(.rela.plt)
58 PROVIDE_HIDDEN(__rela_iplt_start = .);
59 *(.rela.iplt)
60 PROVIDE_HIDDEN(__rela_iplt_end = .);
61 }
62
46 #include "asm/common.lds.S" 63 #include "asm/common.lds.S"
47 64
48 init.data : { INIT_DATA } 65 init.data : { INIT_DATA }
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index dec5678fc17f..6e3359d6a839 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -60,7 +60,7 @@ static inline long long timeval_to_ns(const struct timeval *tv)
60long long disable_timer(void) 60long long disable_timer(void)
61{ 61{
62 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; 63 long long remain, max = UM_NSEC_PER_SEC / UM_HZ;
64 64
65 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0) 65 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
66 printk(UM_KERN_ERR "disable_timer - setitimer failed, " 66 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index c9b176534d65..d23b2d3ea384 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -203,8 +203,8 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
203 (unsigned long *) &fpregs); 203 (unsigned long *) &fpregs);
204} 204}
205 205
206long subarch_ptrace(struct task_struct *child, long request, long addr, 206long subarch_ptrace(struct task_struct *child, long request,
207 long data) 207 unsigned long addr, unsigned long data)
208{ 208{
209 return -EIO; 209 return -EIO;
210} 210}
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index f3458d7d1c5a..f43613643cdb 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -175,19 +175,18 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
175 return restore_fp_registers(userspace_pid[cpu], fpregs); 175 return restore_fp_registers(userspace_pid[cpu], fpregs);
176} 176}
177 177
178long subarch_ptrace(struct task_struct *child, long request, long addr, 178long subarch_ptrace(struct task_struct *child, long request,
179 long data) 179 unsigned long addr, unsigned long data)
180{ 180{
181 int ret = -EIO; 181 int ret = -EIO;
182 void __user *datap = (void __user *) data;
182 183
183 switch (request) { 184 switch (request) {
184 case PTRACE_GETFPXREGS: /* Get the child FPU state. */ 185 case PTRACE_GETFPXREGS: /* Get the child FPU state. */
185 ret = get_fpregs((struct user_i387_struct __user *) data, 186 ret = get_fpregs(datap, child);
186 child);
187 break; 187 break;
188 case PTRACE_SETFPXREGS: /* Set the child FPU state. */ 188 case PTRACE_SETFPXREGS: /* Set the child FPU state. */
189 ret = set_fpregs((struct user_i387_struct __user *) data, 189 ret = set_fpregs(datap, child);
190 child);
191 break; 190 break;
192 } 191 }
193 192