aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/Makefile23
-rw-r--r--arch/um/drivers/chan_kern.c6
-rw-r--r--arch/um/drivers/daemon_kern.c4
-rw-r--r--arch/um/drivers/line.c2
-rw-r--r--arch/um/drivers/mcast_kern.c4
-rw-r--r--arch/um/drivers/mconsole_kern.c11
-rw-r--r--arch/um/drivers/slip_common.h13
-rw-r--r--arch/um/drivers/slip_kern.c15
-rw-r--r--arch/um/drivers/slirp_kern.c13
-rw-r--r--arch/um/drivers/ssl.c6
-rw-r--r--arch/um/include/kern_util.h2
-rw-r--r--arch/um/kernel/exec_kern.c2
-rw-r--r--arch/um/kernel/physmem.c2
-rw-r--r--arch/um/kernel/reboot.c1
-rw-r--r--arch/um/kernel/tt/syscall_kern.c8
-rw-r--r--arch/um/sys-i386/ldt.c2
16 files changed, 65 insertions, 49 deletions
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 6430a6383853..c58b657f0097 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -47,13 +47,16 @@ ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include
47endif 47endif
48SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH) 48SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
49 49
50# -Dvmap=kernel_vmap affects everything, and prevents anything from 50# -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so
51# referencing the libpcap.o symbol so named. 51# named - it's a common symbol in libpcap, so we get a binary which crashes.
52# 52#
53# Same things for in6addr_loopback - found in libc. 53# Same things for in6addr_loopback and mktime - found in libc. For these two we
54# only get link-time error, luckily.
55#
56# These apply to USER_CFLAGS to.
54 57
55CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ 58CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \
56 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ 59 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
57 -Din6addr_loopback=kernel_in6addr_loopback 60 -Din6addr_loopback=kernel_in6addr_loopback
58 61
59AFLAGS += $(ARCH_INCLUDE) 62AFLAGS += $(ARCH_INCLUDE)
@@ -66,6 +69,7 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
66# kernel_errno to separate them from the libc errno. This allows -fno-common 69# kernel_errno to separate them from the libc errno. This allows -fno-common
67# in CFLAGS. Otherwise, it would cause ld to complain about the two different 70# in CFLAGS. Otherwise, it would cause ld to complain about the two different
68# errnos. 71# errnos.
72# These apply to kernelspace only.
69 73
70CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ 74CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
71 -Dmktime=kernel_mktime 75 -Dmktime=kernel_mktime
@@ -168,10 +172,13 @@ else
168 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch 172 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
169endif 173endif
170 174
171$(ARCH_DIR)/include/sysdep: 175$(objtree)/$(ARCH_DIR)/include:
176 @echo ' MKDIR $@'
177 $(Q)mkdir -p $@
178
179$(ARCH_DIR)/include/sysdep: $(objtree)/$(ARCH_DIR)/include
172 @echo ' SYMLINK $@' 180 @echo ' SYMLINK $@'
173ifneq ($(KBUILD_SRC),) 181ifneq ($(KBUILD_SRC),)
174 $(Q)mkdir -p $(ARCH_DIR)/include
175 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep 182 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep
176else 183else
177 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep 184 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep
@@ -214,7 +221,7 @@ $(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s
214 221
215CLEAN_FILES += $(ARCH_DIR)/user-offsets.s 222CLEAN_FILES += $(ARCH_DIR)/user-offsets.s
216 223
217$(ARCH_DIR)/include/kern_constants.h: 224$(ARCH_DIR)/include/kern_constants.h: $(objtree)/$(ARCH_DIR)/include
218 @echo ' SYMLINK $@' 225 @echo ' SYMLINK $@'
219 $(Q) ln -sf ../../../include/asm-um/asm-offsets.h $@ 226 $(Q) ln -sf ../../../include/asm-um/asm-offsets.h $@
220 227
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index ab0d0b170816..7218c754505b 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -403,7 +403,7 @@ int chan_window_size(struct list_head *chans, unsigned short *rows_out,
403 return 0; 403 return 0;
404} 404}
405 405
406void free_one_chan(struct chan *chan, int delay_free_irq) 406static void free_one_chan(struct chan *chan, int delay_free_irq)
407{ 407{
408 list_del(&chan->list); 408 list_del(&chan->list);
409 409
@@ -416,7 +416,7 @@ void free_one_chan(struct chan *chan, int delay_free_irq)
416 kfree(chan); 416 kfree(chan);
417} 417}
418 418
419void free_chan(struct list_head *chans, int delay_free_irq) 419static void free_chan(struct list_head *chans, int delay_free_irq)
420{ 420{
421 struct list_head *ele, *next; 421 struct list_head *ele, *next;
422 struct chan *chan; 422 struct chan *chan;
@@ -497,7 +497,7 @@ struct chan_type {
497 struct chan_ops *ops; 497 struct chan_ops *ops;
498}; 498};
499 499
500struct chan_type chan_table[] = { 500static struct chan_type chan_table[] = {
501 { "fd", &fd_ops }, 501 { "fd", &fd_ops },
502 502
503#ifdef CONFIG_NULL_CHAN 503#ifdef CONFIG_NULL_CHAN
diff --git a/arch/um/drivers/daemon_kern.c b/arch/um/drivers/daemon_kern.c
index 507e3cbac9d3..a61b7b46bc02 100644
--- a/arch/um/drivers/daemon_kern.c
+++ b/arch/um/drivers/daemon_kern.c
@@ -18,7 +18,7 @@ struct daemon_init {
18 char *ctl_sock; 18 char *ctl_sock;
19}; 19};
20 20
21void daemon_init(struct net_device *dev, void *data) 21static void daemon_init(struct net_device *dev, void *data)
22{ 22{
23 struct uml_net_private *pri; 23 struct uml_net_private *pri;
24 struct daemon_data *dpri; 24 struct daemon_data *dpri;
@@ -64,7 +64,7 @@ static struct net_kern_info daemon_kern_info = {
64 .write = daemon_write, 64 .write = daemon_write,
65}; 65};
66 66
67int daemon_setup(char *str, char **mac_out, void *data) 67static int daemon_setup(char *str, char **mac_out, void *data)
68{ 68{
69 struct daemon_init *init = data; 69 struct daemon_init *init = data;
70 char *remain; 70 char *remain;
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 46ceb25a9959..6c2d4ccaf20f 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -714,7 +714,7 @@ struct winch {
714 struct tty_struct *tty; 714 struct tty_struct *tty;
715}; 715};
716 716
717irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused) 717static irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused)
718{ 718{
719 struct winch *winch = data; 719 struct winch *winch = data;
720 struct tty_struct *tty; 720 struct tty_struct *tty;
diff --git a/arch/um/drivers/mcast_kern.c b/arch/um/drivers/mcast_kern.c
index 217438cdef33..c9b078fba03e 100644
--- a/arch/um/drivers/mcast_kern.c
+++ b/arch/um/drivers/mcast_kern.c
@@ -26,7 +26,7 @@ struct mcast_init {
26 int ttl; 26 int ttl;
27}; 27};
28 28
29void mcast_init(struct net_device *dev, void *data) 29static void mcast_init(struct net_device *dev, void *data)
30{ 30{
31 struct uml_net_private *pri; 31 struct uml_net_private *pri;
32 struct mcast_data *dpri; 32 struct mcast_data *dpri;
@@ -40,7 +40,7 @@ void mcast_init(struct net_device *dev, void *data)
40 dpri->dev = dev; 40 dpri->dev = dev;
41 41
42 printk("mcast backend "); 42 printk("mcast backend ");
43 printk("multicast adddress: %s:%u, TTL:%u ", 43 printk("multicast address: %s:%u, TTL:%u ",
44 dpri->addr, dpri->port, dpri->ttl); 44 dpri->addr, dpri->port, dpri->ttl);
45 45
46 printk("\n"); 46 printk("\n");
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index e3d576567172..54388d10bcf9 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -273,7 +273,7 @@ void mconsole_proc(struct mc_request *req)
273 config <dev> - Query the configuration of a device \n\ 273 config <dev> - Query the configuration of a device \n\
274 remove <dev> - Remove a device from UML \n\ 274 remove <dev> - Remove a device from UML \n\
275 sysrq <letter> - Performs the SysRq action controlled by the letter \n\ 275 sysrq <letter> - Performs the SysRq action controlled by the letter \n\
276 cad - invoke the Ctl-Alt-Del handler \n\ 276 cad - invoke the Ctrl-Alt-Del handler \n\
277 stop - pause the UML; it will do nothing until it receives a 'go' \n\ 277 stop - pause the UML; it will do nothing until it receives a 'go' \n\
278 go - continue the UML after a 'stop' \n\ 278 go - continue the UML after a 'stop' \n\
279 log <string> - make UML enter <string> into the kernel log\n\ 279 log <string> - make UML enter <string> into the kernel log\n\
@@ -327,7 +327,7 @@ void mconsole_stop(struct mc_request *req)
327 327
328/* This list is populated by __initcall routines. */ 328/* This list is populated by __initcall routines. */
329 329
330LIST_HEAD(mconsole_devices); 330static LIST_HEAD(mconsole_devices);
331 331
332void mconsole_register_dev(struct mc_device *new) 332void mconsole_register_dev(struct mc_device *new)
333{ 333{
@@ -561,6 +561,8 @@ void mconsole_sysrq(struct mc_request *req)
561} 561}
562#endif 562#endif
563 563
564#ifdef CONFIG_MODE_SKAS
565
564static void stack_proc(void *arg) 566static void stack_proc(void *arg)
565{ 567{
566 struct task_struct *from = current, *to = arg; 568 struct task_struct *from = current, *to = arg;
@@ -574,7 +576,7 @@ static void stack_proc(void *arg)
574 * Dumps a stacks registers to the linux console. 576 * Dumps a stacks registers to the linux console.
575 * Usage stack <pid>. 577 * Usage stack <pid>.
576 */ 578 */
577void do_stack(struct mc_request *req) 579static void do_stack_trace(struct mc_request *req)
578{ 580{
579 char *ptr = req->request.data; 581 char *ptr = req->request.data;
580 int pid_requested= -1; 582 int pid_requested= -1;
@@ -605,6 +607,7 @@ void do_stack(struct mc_request *req)
605 } 607 }
606 with_console(req, stack_proc, to); 608 with_console(req, stack_proc, to);
607} 609}
610#endif /* CONFIG_MODE_SKAS */
608 611
609void mconsole_stack(struct mc_request *req) 612void mconsole_stack(struct mc_request *req)
610{ 613{
@@ -613,7 +616,7 @@ void mconsole_stack(struct mc_request *req)
613 */ 616 */
614 CHOOSE_MODE(mconsole_reply(req, "Sorry, this doesn't work in TT mode", 617 CHOOSE_MODE(mconsole_reply(req, "Sorry, this doesn't work in TT mode",
615 1, 0), 618 1, 0),
616 do_stack(req)); 619 do_stack_trace(req));
617} 620}
618 621
619/* Changed by mconsole_setup, which is __setup, and called before SMP is 622/* Changed by mconsole_setup, which is __setup, and called before SMP is
diff --git a/arch/um/drivers/slip_common.h b/arch/um/drivers/slip_common.h
index 2ae76d8f1be1..d574e0a9dc13 100644
--- a/arch/um/drivers/slip_common.h
+++ b/arch/um/drivers/slip_common.h
@@ -88,12 +88,13 @@ struct slip_proto {
88 int esc; 88 int esc;
89}; 89};
90 90
91#define SLIP_PROTO_INIT { \ 91static inline void slip_proto_init(struct slip_proto * slip)
92 .ibuf = { '\0' }, \ 92{
93 .obuf = { '\0' }, \ 93 memset(slip->ibuf, 0, sizeof(slip->ibuf));
94 .more = 0, \ 94 memset(slip->obuf, 0, sizeof(slip->obuf));
95 .pos = 0, \ 95 slip->more = 0;
96 .esc = 0 \ 96 slip->pos = 0;
97 slip->esc = 0;
97} 98}
98 99
99extern int slip_proto_read(int fd, void *buf, int len, 100extern int slip_proto_read(int fd, void *buf, int len,
diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c
index 9a6f5c85f902..a62f5ef445cf 100644
--- a/arch/um/drivers/slip_kern.c
+++ b/arch/um/drivers/slip_kern.c
@@ -21,13 +21,14 @@ void slip_init(struct net_device *dev, void *data)
21 21
22 private = dev->priv; 22 private = dev->priv;
23 spri = (struct slip_data *) private->user; 23 spri = (struct slip_data *) private->user;
24 *spri = ((struct slip_data) 24
25 { .name = { '\0' }, 25 memset(spri->name, 0, sizeof(spri->name));
26 .addr = NULL, 26 spri->addr = NULL;
27 .gate_addr = init->gate_addr, 27 spri->gate_addr = init->gate_addr;
28 .slave = -1, 28 spri->slave = -1;
29 .slip = SLIP_PROTO_INIT, 29 spri->dev = dev;
30 .dev = dev }); 30
31 slip_proto_init(&spri->slip);
31 32
32 dev->init = NULL; 33 dev->init = NULL;
33 dev->header_cache_update = NULL; 34 dev->header_cache_update = NULL;
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c
index 9864d27afdbe..33d7982be5d3 100644
--- a/arch/um/drivers/slirp_kern.c
+++ b/arch/um/drivers/slirp_kern.c
@@ -21,12 +21,13 @@ void slirp_init(struct net_device *dev, void *data)
21 21
22 private = dev->priv; 22 private = dev->priv;
23 spri = (struct slirp_data *) private->user; 23 spri = (struct slirp_data *) private->user;
24 *spri = ((struct slirp_data) 24
25 { .argw = init->argw, 25 spri->argw = init->argw;
26 .pid = -1, 26 spri->pid = -1;
27 .slave = -1, 27 spri->slave = -1;
28 .slip = SLIP_PROTO_INIT, 28 spri->dev = dev;
29 .dev = dev }); 29
30 slip_proto_init(&spri->slip);
30 31
31 dev->init = NULL; 32 dev->init = NULL;
32 dev->hard_header_len = 0; 33 dev->hard_header_len = 0;
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index a32ef55cb244..a4d6415bc8c4 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -33,7 +33,7 @@ static struct tty_driver *ssl_driver;
33 33
34#define NR_PORTS 64 34#define NR_PORTS 64
35 35
36void ssl_announce(char *dev_name, int dev) 36static void ssl_announce(char *dev_name, int dev)
37{ 37{
38 printk(KERN_INFO "Serial line %d assigned device '%s'\n", dev, 38 printk(KERN_INFO "Serial line %d assigned device '%s'\n", dev,
39 dev_name); 39 dev_name);
@@ -98,7 +98,7 @@ static int ssl_remove(int n)
98 return line_remove(serial_lines, ARRAY_SIZE(serial_lines), n); 98 return line_remove(serial_lines, ARRAY_SIZE(serial_lines), n);
99} 99}
100 100
101int ssl_open(struct tty_struct *tty, struct file *filp) 101static int ssl_open(struct tty_struct *tty, struct file *filp)
102{ 102{
103 return line_open(serial_lines, tty); 103 return line_open(serial_lines, tty);
104} 104}
@@ -182,7 +182,7 @@ static struct console ssl_cons = {
182 .index = -1, 182 .index = -1,
183}; 183};
184 184
185int ssl_init(void) 185static int ssl_init(void)
186{ 186{
187 char *new_title; 187 char *new_title;
188 188
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h
index c649108a9e9f..07176d92e1c9 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/kern_util.h
@@ -31,8 +31,6 @@ extern int timer_irq_inited;
31extern int jail; 31extern int jail;
32extern int nsyscalls; 32extern int nsyscalls;
33 33
34extern struct task_struct *idle_threads[NR_CPUS];
35
36#define UML_ROUND_DOWN(addr) ((void *)(((unsigned long) addr) & PAGE_MASK)) 34#define UML_ROUND_DOWN(addr) ((void *)(((unsigned long) addr) & PAGE_MASK))
37#define UML_ROUND_UP(addr) \ 35#define UML_ROUND_UP(addr) \
38 UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1) 36 UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1)
diff --git a/arch/um/kernel/exec_kern.c b/arch/um/kernel/exec_kern.c
index 569fe8b9b053..c264e1c05ab3 100644
--- a/arch/um/kernel/exec_kern.c
+++ b/arch/um/kernel/exec_kern.c
@@ -33,7 +33,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
33extern void log_exec(char **argv, void *tty); 33extern void log_exec(char **argv, void *tty);
34 34
35static long execve1(char *file, char __user * __user *argv, 35static long execve1(char *file, char __user * __user *argv,
36 char *__user __user *env) 36 char __user *__user *env)
37{ 37{
38 long error; 38 long error;
39 39
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index f3b583a878a6..544665e04513 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -265,7 +265,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
265 highmem_len = highmem_pages * sizeof(struct page); 265 highmem_len = highmem_pages * sizeof(struct page);
266 266
267 total_pages = phys_pages + iomem_pages + highmem_pages; 267 total_pages = phys_pages + iomem_pages + highmem_pages;
268 total_len = phys_len + iomem_pages + highmem_len; 268 total_len = phys_len + iomem_len + highmem_len;
269 269
270 if(kmalloc_ok){ 270 if(kmalloc_ok){
271 map = kmalloc(total_len, GFP_KERNEL); 271 map = kmalloc(total_len, GFP_KERNEL);
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 6f1a3a288117..3ef73bf2e781 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -5,6 +5,7 @@
5 5
6#include "linux/module.h" 6#include "linux/module.h"
7#include "linux/sched.h" 7#include "linux/sched.h"
8#include "asm/smp.h"
8#include "user_util.h" 9#include "user_util.h"
9#include "kern_util.h" 10#include "kern_util.h"
10#include "kern.h" 11#include "kern.h"
diff --git a/arch/um/kernel/tt/syscall_kern.c b/arch/um/kernel/tt/syscall_kern.c
index 3d29c90514cc..3fda9a03c59a 100644
--- a/arch/um/kernel/tt/syscall_kern.c
+++ b/arch/um/kernel/tt/syscall_kern.c
@@ -23,16 +23,20 @@ void syscall_handler_tt(int sig, struct pt_regs *regs)
23 int syscall; 23 int syscall;
24#ifdef CONFIG_SYSCALL_DEBUG 24#ifdef CONFIG_SYSCALL_DEBUG
25 int index; 25 int index;
26 index = record_syscall_start(syscall);
27#endif 26#endif
28 sc = UPT_SC(&regs->regs); 27 sc = UPT_SC(&regs->regs);
29 SC_START_SYSCALL(sc); 28 SC_START_SYSCALL(sc);
30 29
30 syscall = UPT_SYSCALL_NR(&regs->regs);
31
32#ifdef CONFIG_SYSCALL_DEBUG
33 index = record_syscall_start(syscall);
34#endif
35
31 syscall_trace(&regs->regs, 0); 36 syscall_trace(&regs->regs, 0);
32 37
33 current->thread.nsyscalls++; 38 current->thread.nsyscalls++;
34 nsyscalls++; 39 nsyscalls++;
35 syscall = UPT_SYSCALL_NR(&regs->regs);
36 40
37 if((syscall >= NR_syscalls) || (syscall < 0)) 41 if((syscall >= NR_syscalls) || (syscall < 0))
38 result = -ENOSYS; 42 result = -ENOSYS;
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 0cdfd4481d5e..1fa09a79a10b 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -16,7 +16,6 @@
16#include "choose-mode.h" 16#include "choose-mode.h"
17#include "kern.h" 17#include "kern.h"
18#include "mode_kern.h" 18#include "mode_kern.h"
19#include "proc_mm.h"
20#include "os.h" 19#include "os.h"
21 20
22extern int modify_ldt(int func, void *ptr, unsigned long bytecount); 21extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
@@ -90,6 +89,7 @@ out:
90#include "skas.h" 89#include "skas.h"
91#include "skas_ptrace.h" 90#include "skas_ptrace.h"
92#include "asm/mmu_context.h" 91#include "asm/mmu_context.h"
92#include "proc_mm.h"
93 93
94long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, 94long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
95 void **addr, int done) 95 void **addr, int done)