aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/daemon_user.c6
-rw-r--r--arch/um/drivers/line.c19
-rw-r--r--arch/um/drivers/mconsole_kern.c36
-rw-r--r--arch/um/drivers/net_kern.c31
-rw-r--r--arch/um/drivers/ssl.c9
-rw-r--r--arch/um/drivers/stdio_console.c7
-rw-r--r--arch/um/drivers/ubd_kern.c37
-rw-r--r--arch/um/include/line.h3
-rw-r--r--arch/um/include/mconsole_kern.h3
-rw-r--r--arch/um/include/time_user.h2
-rw-r--r--arch/um/kernel/main.c1
-rw-r--r--arch/um/kernel/process_kern.c6
-rw-r--r--arch/um/kernel/reboot.c9
-rw-r--r--arch/um/kernel/skas/Makefile4
-rw-r--r--arch/um/kernel/skas/include/mode-skas.h1
-rw-r--r--arch/um/kernel/skas/process_kern.c15
-rw-r--r--arch/um/kernel/skas/time.c30
-rw-r--r--arch/um/kernel/syscall_kern.c19
-rw-r--r--arch/um/kernel/time.c31
-rw-r--r--arch/um/kernel/time_kern.c2
-rw-r--r--arch/um/kernel/tt/Makefile4
-rw-r--r--arch/um/kernel/tt/gdb.c4
-rw-r--r--arch/um/kernel/tt/gdb_kern.c2
-rw-r--r--arch/um/kernel/tt/include/debug.h17
-rw-r--r--arch/um/kernel/tt/include/mode-tt.h1
-rw-r--r--arch/um/kernel/tt/process_kern.c17
-rw-r--r--arch/um/kernel/tt/time.c28
-rw-r--r--arch/um/sys-i386/signal.c2
-rw-r--r--arch/um/sys-i386/syscalls.c23
-rw-r--r--arch/um/sys-x86_64/syscalls.c23
30 files changed, 161 insertions, 231 deletions
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index cf15b4a8b517..c1b03f7c1daa 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -157,9 +157,9 @@ static void daemon_remove(void *data)
157 157
158 os_close_file(pri->fd); 158 os_close_file(pri->fd);
159 os_close_file(pri->control); 159 os_close_file(pri->control);
160 if(pri->data_addr != NULL) kfree(pri->data_addr); 160 kfree(pri->data_addr);
161 if(pri->ctl_addr != NULL) kfree(pri->ctl_addr); 161 kfree(pri->ctl_addr);
162 if(pri->local_addr != NULL) kfree(pri->local_addr); 162 kfree(pri->local_addr);
163} 163}
164 164
165int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri) 165int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri)
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 0f59736db329..2bb4c4f5dec4 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -602,11 +602,26 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
602 return n; 602 return n;
603} 603}
604 604
605int line_remove(struct line *lines, unsigned int num, char *str) 605int line_id(char **str, int *start_out, int *end_out)
606{
607 char *end;
608 int n;
609
610 n = simple_strtoul(*str, &end, 0);
611 if((*end != '\0') || (end == *str))
612 return -1;
613
614 *str = end;
615 *start_out = n;
616 *end_out = n;
617 return n;
618}
619
620int line_remove(struct line *lines, unsigned int num, int n)
606{ 621{
607 char config[sizeof("conxxxx=none\0")]; 622 char config[sizeof("conxxxx=none\0")];
608 623
609 sprintf(config, "%s=none", str); 624 sprintf(config, "%d=none", n);
610 return !line_setup(lines, num, config, 0); 625 return !line_setup(lines, num, config, 0);
611} 626}
612 627
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index d7c7adcc0a67..404de41a4f67 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -419,8 +419,9 @@ void mconsole_config(struct mc_request *req)
419void mconsole_remove(struct mc_request *req) 419void mconsole_remove(struct mc_request *req)
420{ 420{
421 struct mc_device *dev; 421 struct mc_device *dev;
422 char *ptr = req->request.data; 422 char *ptr = req->request.data, *err_msg = "";
423 int err; 423 char error[256];
424 int err, start, end, n;
424 425
425 ptr += strlen("remove"); 426 ptr += strlen("remove");
426 while(isspace(*ptr)) ptr++; 427 while(isspace(*ptr)) ptr++;
@@ -429,8 +430,35 @@ void mconsole_remove(struct mc_request *req)
429 mconsole_reply(req, "Bad remove option", 1, 0); 430 mconsole_reply(req, "Bad remove option", 1, 0);
430 return; 431 return;
431 } 432 }
432 err = (*dev->remove)(&ptr[strlen(dev->name)]); 433
433 mconsole_reply(req, "", err, 0); 434 ptr = &ptr[strlen(dev->name)];
435
436 err = 1;
437 n = (*dev->id)(&ptr, &start, &end);
438 if(n < 0){
439 err_msg = "Couldn't parse device number";
440 goto out;
441 }
442 else if((n < start) || (n > end)){
443 sprintf(error, "Invalid device number - must be between "
444 "%d and %d", start, end);
445 err_msg = error;
446 goto out;
447 }
448
449 err = (*dev->remove)(n);
450 switch(err){
451 case -ENODEV:
452 err_msg = "Device doesn't exist";
453 break;
454 case -EBUSY:
455 err_msg = "Device is currently open";
456 break;
457 default:
458 break;
459 }
460 out:
461 mconsole_reply(req, err_msg, err, 0);
434} 462}
435 463
436#ifdef CONFIG_MAGIC_SYSRQ 464#ifdef CONFIG_MAGIC_SYSRQ
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 5388a7428691..1495007bf6c0 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -612,25 +612,35 @@ static int net_config(char *str)
612 return(err); 612 return(err);
613} 613}
614 614
615static int net_remove(char *str) 615static int net_id(char **str, int *start_out, int *end_out)
616{
617 char *end;
618 int n;
619
620 n = simple_strtoul(*str, &end, 0);
621 if((*end != '\0') || (end == *str))
622 return -1;
623
624 *start_out = n;
625 *end_out = n;
626 *str = end;
627 return n;
628}
629
630static int net_remove(int n)
616{ 631{
617 struct uml_net *device; 632 struct uml_net *device;
618 struct net_device *dev; 633 struct net_device *dev;
619 struct uml_net_private *lp; 634 struct uml_net_private *lp;
620 char *end;
621 int n;
622
623 n = simple_strtoul(str, &end, 0);
624 if((*end != '\0') || (end == str))
625 return(-1);
626 635
627 device = find_device(n); 636 device = find_device(n);
628 if(device == NULL) 637 if(device == NULL)
629 return(0); 638 return -ENODEV;
630 639
631 dev = device->dev; 640 dev = device->dev;
632 lp = dev->priv; 641 lp = dev->priv;
633 if(lp->fd > 0) return(-1); 642 if(lp->fd > 0)
643 return -EBUSY;
634 if(lp->remove != NULL) (*lp->remove)(&lp->user); 644 if(lp->remove != NULL) (*lp->remove)(&lp->user);
635 unregister_netdev(dev); 645 unregister_netdev(dev);
636 platform_device_unregister(&device->pdev); 646 platform_device_unregister(&device->pdev);
@@ -638,13 +648,14 @@ static int net_remove(char *str)
638 list_del(&device->list); 648 list_del(&device->list);
639 kfree(device); 649 kfree(device);
640 free_netdev(dev); 650 free_netdev(dev);
641 return(0); 651 return 0;
642} 652}
643 653
644static struct mc_device net_mc = { 654static struct mc_device net_mc = {
645 .name = "eth", 655 .name = "eth",
646 .config = net_config, 656 .config = net_config,
647 .get_config = NULL, 657 .get_config = NULL,
658 .id = net_id,
648 .remove = net_remove, 659 .remove = net_remove,
649}; 660};
650 661
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index b32a77010fbe..62e04ecfada8 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -49,7 +49,7 @@ static struct chan_opts opts = {
49 49
50static int ssl_config(char *str); 50static int ssl_config(char *str);
51static int ssl_get_config(char *dev, char *str, int size, char **error_out); 51static int ssl_get_config(char *dev, char *str, int size, char **error_out);
52static int ssl_remove(char *str); 52static int ssl_remove(int n);
53 53
54static struct line_driver driver = { 54static struct line_driver driver = {
55 .name = "UML serial line", 55 .name = "UML serial line",
@@ -69,6 +69,7 @@ static struct line_driver driver = {
69 .name = "ssl", 69 .name = "ssl",
70 .config = ssl_config, 70 .config = ssl_config,
71 .get_config = ssl_get_config, 71 .get_config = ssl_get_config,
72 .id = line_id,
72 .remove = ssl_remove, 73 .remove = ssl_remove,
73 }, 74 },
74}; 75};
@@ -94,10 +95,10 @@ static int ssl_get_config(char *dev, char *str, int size, char **error_out)
94 str, size, error_out)); 95 str, size, error_out));
95} 96}
96 97
97static int ssl_remove(char *str) 98static int ssl_remove(int n)
98{ 99{
99 return(line_remove(serial_lines, 100 return line_remove(serial_lines,
100 sizeof(serial_lines)/sizeof(serial_lines[0]), str)); 101 sizeof(serial_lines)/sizeof(serial_lines[0]), n);
101} 102}
102 103
103int ssl_open(struct tty_struct *tty, struct file *filp) 104int ssl_open(struct tty_struct *tty, struct file *filp)
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index afbe1e71ed83..005aa6333b6e 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -55,7 +55,7 @@ static struct chan_opts opts = {
55 55
56static int con_config(char *str); 56static int con_config(char *str);
57static int con_get_config(char *dev, char *str, int size, char **error_out); 57static int con_get_config(char *dev, char *str, int size, char **error_out);
58static int con_remove(char *str); 58static int con_remove(int n);
59 59
60static struct line_driver driver = { 60static struct line_driver driver = {
61 .name = "UML console", 61 .name = "UML console",
@@ -75,6 +75,7 @@ static struct line_driver driver = {
75 .name = "con", 75 .name = "con",
76 .config = con_config, 76 .config = con_config,
77 .get_config = con_get_config, 77 .get_config = con_get_config,
78 .id = line_id,
78 .remove = con_remove, 79 .remove = con_remove,
79 }, 80 },
80}; 81};
@@ -99,9 +100,9 @@ static int con_get_config(char *dev, char *str, int size, char **error_out)
99 size, error_out)); 100 size, error_out));
100} 101}
101 102
102static int con_remove(char *str) 103static int con_remove(int n)
103{ 104{
104 return(line_remove(vts, sizeof(vts)/sizeof(vts[0]), str)); 105 return line_remove(vts, sizeof(vts)/sizeof(vts[0]), n);
105} 106}
106 107
107static int con_open(struct tty_struct *tty, struct file *filp) 108static int con_open(struct tty_struct *tty, struct file *filp)
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 2a7f6892c55c..344b24d09a7c 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -754,24 +754,34 @@ static int ubd_get_config(char *name, char *str, int size, char **error_out)
754 return(len); 754 return(len);
755} 755}
756 756
757static int ubd_remove(char *str) 757static int ubd_id(char **str, int *start_out, int *end_out)
758{
759 int n;
760
761 n = parse_unit(str);
762 *start_out = 0;
763 *end_out = MAX_DEV - 1;
764 return n;
765}
766
767static int ubd_remove(int n)
758{ 768{
759 struct ubd *dev; 769 struct ubd *dev;
760 int n, err = -ENODEV; 770 int err = -ENODEV;
761 771
762 n = parse_unit(&str); 772 spin_lock(&ubd_lock);
763 773
764 if((n < 0) || (n >= MAX_DEV)) 774 if(ubd_gendisk[n] == NULL)
765 return(err); 775 goto out;
766 776
767 dev = &ubd_dev[n]; 777 dev = &ubd_dev[n];
768 if(dev->count > 0)
769 return(-EBUSY); /* you cannot remove a open disk */
770 778
771 err = 0; 779 if(dev->file == NULL)
772 spin_lock(&ubd_lock); 780 goto out;
773 781
774 if(ubd_gendisk[n] == NULL) 782 /* you cannot remove a open disk */
783 err = -EBUSY;
784 if(dev->count > 0)
775 goto out; 785 goto out;
776 786
777 del_gendisk(ubd_gendisk[n]); 787 del_gendisk(ubd_gendisk[n]);
@@ -787,15 +797,16 @@ static int ubd_remove(char *str)
787 platform_device_unregister(&dev->pdev); 797 platform_device_unregister(&dev->pdev);
788 *dev = ((struct ubd) DEFAULT_UBD); 798 *dev = ((struct ubd) DEFAULT_UBD);
789 err = 0; 799 err = 0;
790 out: 800out:
791 spin_unlock(&ubd_lock); 801 spin_unlock(&ubd_lock);
792 return(err); 802 return err;
793} 803}
794 804
795static struct mc_device ubd_mc = { 805static struct mc_device ubd_mc = {
796 .name = "ubd", 806 .name = "ubd",
797 .config = ubd_config, 807 .config = ubd_config,
798 .get_config = ubd_get_config, 808 .get_config = ubd_get_config,
809 .id = ubd_id,
799 .remove = ubd_remove, 810 .remove = ubd_remove,
800}; 811};
801 812
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 4c5e92c04ccb..5323d22a6ca7 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -101,7 +101,8 @@ extern void lines_init(struct line *lines, int nlines);
101extern void close_lines(struct line *lines, int nlines); 101extern void close_lines(struct line *lines, int nlines);
102 102
103extern int line_config(struct line *lines, unsigned int sizeof_lines, char *str); 103extern int line_config(struct line *lines, unsigned int sizeof_lines, char *str);
104extern int line_remove(struct line *lines, unsigned int sizeof_lines, char *str); 104extern int line_id(char **str, int *start_out, int *end_out);
105extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n);
105extern int line_get_config(char *dev, struct line *lines, unsigned int sizeof_lines, char *str, 106extern int line_get_config(char *dev, struct line *lines, unsigned int sizeof_lines, char *str,
106 int size, char **error_out); 107 int size, char **error_out);
107 108
diff --git a/arch/um/include/mconsole_kern.h b/arch/um/include/mconsole_kern.h
index 61c274fcee5d..d86ee14260ce 100644
--- a/arch/um/include/mconsole_kern.h
+++ b/arch/um/include/mconsole_kern.h
@@ -20,7 +20,8 @@ struct mc_device {
20 char *name; 20 char *name;
21 int (*config)(char *); 21 int (*config)(char *);
22 int (*get_config)(char *, char *, int, char **); 22 int (*get_config)(char *, char *, int, char **);
23 int (*remove)(char *); 23 int (*id)(char **, int *, int *);
24 int (*remove)(int);
24}; 25};
25 26
26#define CONFIG_CHUNK(str, size, current, chunk, end) \ 27#define CONFIG_CHUNK(str, size, current, chunk, end) \
diff --git a/arch/um/include/time_user.h b/arch/um/include/time_user.h
index 6793a2fcd0ae..f64ef77019a3 100644
--- a/arch/um/include/time_user.h
+++ b/arch/um/include/time_user.h
@@ -8,11 +8,11 @@
8 8
9extern void timer(void); 9extern void timer(void);
10extern void switch_timers(int to_real); 10extern void switch_timers(int to_real);
11extern void set_interval(int timer_type);
12extern void idle_sleep(int secs); 11extern void idle_sleep(int secs);
13extern void enable_timer(void); 12extern void enable_timer(void);
14extern void disable_timer(void); 13extern void disable_timer(void);
15extern unsigned long time_lock(void); 14extern unsigned long time_lock(void);
16extern void time_unlock(unsigned long); 15extern void time_unlock(unsigned long);
16extern void user_time_init(void);
17 17
18#endif 18#endif
diff --git a/arch/um/kernel/main.c b/arch/um/kernel/main.c
index e59f58152678..1e1a87f1c510 100644
--- a/arch/um/kernel/main.c
+++ b/arch/um/kernel/main.c
@@ -69,7 +69,6 @@ static __init void do_uml_initcalls(void)
69 69
70static void last_ditch_exit(int sig) 70static void last_ditch_exit(int sig)
71{ 71{
72 kmalloc_ok = 0;
73 signal(SIGINT, SIG_DFL); 72 signal(SIGINT, SIG_DFL);
74 signal(SIGTERM, SIG_DFL); 73 signal(SIGTERM, SIG_DFL);
75 signal(SIGHUP, SIG_DFL); 74 signal(SIGHUP, SIG_DFL);
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
index 157584ae4792..d4036ed680bc 100644
--- a/arch/um/kernel/process_kern.c
+++ b/arch/um/kernel/process_kern.c
@@ -96,8 +96,8 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
96 96
97 current->thread.request.u.thread.proc = fn; 97 current->thread.request.u.thread.proc = fn;
98 current->thread.request.u.thread.arg = arg; 98 current->thread.request.u.thread.arg = arg;
99 pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0, NULL, 0, NULL, 99 pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0,
100 NULL); 100 &current->thread.regs, 0, NULL, NULL);
101 if(pid < 0) 101 if(pid < 0)
102 panic("do_fork failed in kernel_thread, errno = %d", pid); 102 panic("do_fork failed in kernel_thread, errno = %d", pid);
103 return(pid); 103 return(pid);
@@ -169,7 +169,7 @@ int current_pid(void)
169 169
170void default_idle(void) 170void default_idle(void)
171{ 171{
172 uml_idle_timer(); 172 CHOOSE_MODE(uml_idle_timer(), (void) 0);
173 173
174 atomic_inc(&init_mm.mm_count); 174 atomic_inc(&init_mm.mm_count);
175 current->mm = &init_mm; 175 current->mm = &init_mm;
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 207f89d74908..fcec51da1d37 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -38,14 +38,14 @@ static void kill_off_processes(void)
38 38
39void uml_cleanup(void) 39void uml_cleanup(void)
40{ 40{
41 kill_off_processes(); 41 kmalloc_ok = 0;
42 do_uml_exitcalls(); 42 do_uml_exitcalls();
43 kill_off_processes();
43} 44}
44 45
45void machine_restart(char * __unused) 46void machine_restart(char * __unused)
46{ 47{
47 do_uml_exitcalls(); 48 uml_cleanup();
48 kill_off_processes();
49 CHOOSE_MODE(reboot_tt(), reboot_skas()); 49 CHOOSE_MODE(reboot_tt(), reboot_skas());
50} 50}
51 51
@@ -53,8 +53,7 @@ EXPORT_SYMBOL(machine_restart);
53 53
54void machine_power_off(void) 54void machine_power_off(void)
55{ 55{
56 do_uml_exitcalls(); 56 uml_cleanup();
57 kill_off_processes();
58 CHOOSE_MODE(halt_tt(), halt_skas()); 57 CHOOSE_MODE(halt_tt(), halt_skas());
59} 58}
60 59
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile
index d37d1bfcd6f7..ff69c4b312c0 100644
--- a/arch/um/kernel/skas/Makefile
+++ b/arch/um/kernel/skas/Makefile
@@ -4,10 +4,10 @@
4# 4#
5 5
6obj-y := exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ 6obj-y := exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \
7 syscall_kern.o syscall_user.o time.o tlb.o trap_user.o uaccess.o \ 7 syscall_kern.o syscall_user.o tlb.o trap_user.o uaccess.o \
8 8
9subdir- := util 9subdir- := util
10 10
11USER_OBJS := process.o time.o 11USER_OBJS := process.o
12 12
13include arch/um/scripts/Makefile.rules 13include arch/um/scripts/Makefile.rules
diff --git a/arch/um/kernel/skas/include/mode-skas.h b/arch/um/kernel/skas/include/mode-skas.h
index c1e33bd788db..bcd26a6a3888 100644
--- a/arch/um/kernel/skas/include/mode-skas.h
+++ b/arch/um/kernel/skas/include/mode-skas.h
@@ -13,7 +13,6 @@ extern unsigned long exec_fp_regs[];
13extern unsigned long exec_fpx_regs[]; 13extern unsigned long exec_fpx_regs[];
14extern int have_fpx_regs; 14extern int have_fpx_regs;
15 15
16extern void user_time_init_skas(void);
17extern void sig_handler_common_skas(int sig, void *sc_ptr); 16extern void sig_handler_common_skas(int sig, void *sc_ptr);
18extern void halt_skas(void); 17extern void halt_skas(void);
19extern void reboot_skas(void); 18extern void reboot_skas(void);
diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c
index fc71ef295782..0a7b8aa55db8 100644
--- a/arch/um/kernel/skas/process_kern.c
+++ b/arch/um/kernel/skas/process_kern.c
@@ -111,8 +111,7 @@ int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp,
111 void (*handler)(int); 111 void (*handler)(int);
112 112
113 if(current->thread.forking){ 113 if(current->thread.forking){
114 memcpy(&p->thread.regs.regs.skas, 114 memcpy(&p->thread.regs.regs.skas, &regs->regs.skas,
115 &current->thread.regs.regs.skas,
116 sizeof(p->thread.regs.regs.skas)); 115 sizeof(p->thread.regs.regs.skas));
117 REGS_SET_SYSCALL_RETURN(p->thread.regs.regs.skas.regs, 0); 116 REGS_SET_SYSCALL_RETURN(p->thread.regs.regs.skas.regs, 0);
118 if(sp != 0) REGS_SP(p->thread.regs.regs.skas.regs) = sp; 117 if(sp != 0) REGS_SP(p->thread.regs.regs.skas.regs) = sp;
@@ -181,7 +180,6 @@ int start_uml_skas(void)
181 start_userspace(0); 180 start_userspace(0);
182 181
183 init_new_thread_signals(1); 182 init_new_thread_signals(1);
184 uml_idle_timer();
185 183
186 init_task.thread.request.u.thread.proc = start_kernel_proc; 184 init_task.thread.request.u.thread.proc = start_kernel_proc;
187 init_task.thread.request.u.thread.arg = NULL; 185 init_task.thread.request.u.thread.arg = NULL;
@@ -201,14 +199,3 @@ int thread_pid_skas(struct task_struct *task)
201#warning Need to look up userspace_pid by cpu 199#warning Need to look up userspace_pid by cpu
202 return(userspace_pid[0]); 200 return(userspace_pid[0]);
203} 201}
204
205/*
206 * Overrides for Emacs so that we follow Linus's tabbing style.
207 * Emacs will notice this stuff at the end of the file and automatically
208 * adjust the settings for this buffer only. This must remain at the end
209 * of the file.
210 * ---------------------------------------------------------------------------
211 * Local variables:
212 * c-file-style: "linux"
213 * End:
214 */
diff --git a/arch/um/kernel/skas/time.c b/arch/um/kernel/skas/time.c
deleted file mode 100644
index 98091494b897..000000000000
--- a/arch/um/kernel/skas/time.c
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <sys/signal.h>
7#include <sys/time.h>
8#include "time_user.h"
9#include "process.h"
10#include "user.h"
11
12void user_time_init_skas(void)
13{
14 if(signal(SIGALRM, (__sighandler_t) alarm_handler) == SIG_ERR)
15 panic("Couldn't set SIGALRM handler");
16 if(signal(SIGVTALRM, (__sighandler_t) alarm_handler) == SIG_ERR)
17 panic("Couldn't set SIGVTALRM handler");
18 set_interval(ITIMER_VIRTUAL);
19}
20
21/*
22 * Overrides for Emacs so that we follow Linus's tabbing style.
23 * Emacs will notice this stuff at the end of the file and automatically
24 * adjust the settings for this buffer only. This must remain at the end
25 * of the file.
26 * ---------------------------------------------------------------------------
27 * Local variables:
28 * c-file-style: "linux"
29 * End:
30 */
diff --git a/arch/um/kernel/syscall_kern.c b/arch/um/kernel/syscall_kern.c
index b7a55251e897..8e1a3501ff46 100644
--- a/arch/um/kernel/syscall_kern.c
+++ b/arch/um/kernel/syscall_kern.c
@@ -31,7 +31,8 @@ long sys_fork(void)
31 long ret; 31 long ret;
32 32
33 current->thread.forking = 1; 33 current->thread.forking = 1;
34 ret = do_fork(SIGCHLD, 0, NULL, 0, NULL, NULL); 34 ret = do_fork(SIGCHLD, UPT_SP(&current->thread.regs.regs),
35 &current->thread.regs, 0, NULL, NULL);
35 current->thread.forking = 0; 36 current->thread.forking = 0;
36 return(ret); 37 return(ret);
37} 38}
@@ -41,8 +42,9 @@ long sys_vfork(void)
41 long ret; 42 long ret;
42 43
43 current->thread.forking = 1; 44 current->thread.forking = 1;
44 ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, NULL, 0, NULL, 45 ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
45 NULL); 46 UPT_SP(&current->thread.regs.regs),
47 &current->thread.regs, 0, NULL, NULL);
46 current->thread.forking = 0; 48 current->thread.forking = 0;
47 return(ret); 49 return(ret);
48} 50}
@@ -162,14 +164,3 @@ int next_syscall_index(int limit)
162 spin_unlock(&syscall_lock); 164 spin_unlock(&syscall_lock);
163 return(ret); 165 return(ret);
164} 166}
165
166/*
167 * Overrides for Emacs so that we follow Linus's tabbing style.
168 * Emacs will notice this stuff at the end of the file and automatically
169 * adjust the settings for this buffer only. This must remain at the end
170 * of the file.
171 * ---------------------------------------------------------------------------
172 * Local variables:
173 * c-file-style: "linux"
174 * End:
175 */
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index c40c86a3f918..f829b309b63c 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -33,7 +33,7 @@ void timer(void)
33 timeradd(&xtime, &local_offset, &xtime); 33 timeradd(&xtime, &local_offset, &xtime);
34} 34}
35 35
36void set_interval(int timer_type) 36static void set_interval(int timer_type)
37{ 37{
38 int usec = 1000000/hz(); 38 int usec = 1000000/hz();
39 struct itimerval interval = ((struct itimerval) { { 0, usec }, 39 struct itimerval interval = ((struct itimerval) { { 0, usec },
@@ -45,12 +45,7 @@ void set_interval(int timer_type)
45 45
46void enable_timer(void) 46void enable_timer(void)
47{ 47{
48 int usec = 1000000/hz(); 48 set_interval(ITIMER_VIRTUAL);
49 struct itimerval enable = ((struct itimerval) { { 0, usec },
50 { 0, usec }});
51 if(setitimer(ITIMER_VIRTUAL, &enable, NULL))
52 printk("enable_timer - setitimer failed, errno = %d\n",
53 errno);
54} 49}
55 50
56void disable_timer(void) 51void disable_timer(void)
@@ -155,13 +150,15 @@ void idle_sleep(int secs)
155 nanosleep(&ts, NULL); 150 nanosleep(&ts, NULL);
156} 151}
157 152
158/* 153/* XXX This partly duplicates init_irq_signals */
159 * Overrides for Emacs so that we follow Linus's tabbing style. 154
160 * Emacs will notice this stuff at the end of the file and automatically 155void user_time_init(void)
161 * adjust the settings for this buffer only. This must remain at the end 156{
162 * of the file. 157 set_handler(SIGVTALRM, (__sighandler_t) alarm_handler,
163 * --------------------------------------------------------------------------- 158 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH,
164 * Local variables: 159 SIGALRM, SIGUSR2, -1);
165 * c-file-style: "linux" 160 set_handler(SIGALRM, (__sighandler_t) alarm_handler,
166 * End: 161 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH,
167 */ 162 SIGVTALRM, SIGUSR2, -1);
163 set_interval(ITIMER_VIRTUAL);
164}
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index 6516fc52afe0..a8b4ef601f59 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -162,7 +162,7 @@ int __init timer_init(void)
162{ 162{
163 int err; 163 int err;
164 164
165 CHOOSE_MODE(user_time_init_tt(), user_time_init_skas()); 165 user_time_init();
166 err = request_irq(TIMER_IRQ, um_timer, SA_INTERRUPT, "timer", NULL); 166 err = request_irq(TIMER_IRQ, um_timer, SA_INTERRUPT, "timer", NULL);
167 if(err != 0) 167 if(err != 0)
168 printk(KERN_ERR "timer_init : request_irq failed - " 168 printk(KERN_ERR "timer_init : request_irq failed - "
diff --git a/arch/um/kernel/tt/Makefile b/arch/um/kernel/tt/Makefile
index 3fd2554e60b6..6939e5af8472 100644
--- a/arch/um/kernel/tt/Makefile
+++ b/arch/um/kernel/tt/Makefile
@@ -4,11 +4,11 @@
4# 4#
5 5
6obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \ 6obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \
7 syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \ 7 syscall_kern.o syscall_user.o tlb.o tracer.o trap_user.o \
8 uaccess.o uaccess_user.o 8 uaccess.o uaccess_user.o
9 9
10obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptproxy/ 10obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptproxy/
11 11
12USER_OBJS := gdb.o time.o tracer.o 12USER_OBJS := gdb.o tracer.o
13 13
14include arch/um/scripts/Makefile.rules 14include arch/um/scripts/Makefile.rules
diff --git a/arch/um/kernel/tt/gdb.c b/arch/um/kernel/tt/gdb.c
index 19a0ad7b35b3..37e22d71a0d9 100644
--- a/arch/um/kernel/tt/gdb.c
+++ b/arch/um/kernel/tt/gdb.c
@@ -153,10 +153,10 @@ void remove_gdb_cb(void *unused)
153 exit_debugger_cb(NULL); 153 exit_debugger_cb(NULL);
154} 154}
155 155
156int gdb_remove(char *unused) 156int gdb_remove(int unused)
157{ 157{
158 initial_thread_cb(remove_gdb_cb, NULL); 158 initial_thread_cb(remove_gdb_cb, NULL);
159 return(0); 159 return 0;
160} 160}
161 161
162void signal_usr1(int sig) 162void signal_usr1(int sig)
diff --git a/arch/um/kernel/tt/gdb_kern.c b/arch/um/kernel/tt/gdb_kern.c
index 93fb121f86af..26506388a6aa 100644
--- a/arch/um/kernel/tt/gdb_kern.c
+++ b/arch/um/kernel/tt/gdb_kern.c
@@ -10,7 +10,7 @@
10#ifdef CONFIG_MCONSOLE 10#ifdef CONFIG_MCONSOLE
11 11
12extern int gdb_config(char *str); 12extern int gdb_config(char *str);
13extern int gdb_remove(char *unused); 13extern int gdb_remove(int n);
14 14
15static struct mc_device gdb_mc = { 15static struct mc_device gdb_mc = {
16 .name = "gdb", 16 .name = "gdb",
diff --git a/arch/um/kernel/tt/include/debug.h b/arch/um/kernel/tt/include/debug.h
index 8eff674107ca..738435461e13 100644
--- a/arch/um/kernel/tt/include/debug.h
+++ b/arch/um/kernel/tt/include/debug.h
@@ -4,8 +4,8 @@
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
6 6
7#ifndef __DEBUG_H 7#ifndef __UML_TT_DEBUG_H
8#define __DEBUG_H 8#define __UML_TT_DEBUG_H
9 9
10extern int debugger_proxy(int status, pid_t pid); 10extern int debugger_proxy(int status, pid_t pid);
11extern void child_proxy(pid_t pid, int status); 11extern void child_proxy(pid_t pid, int status);
@@ -13,17 +13,6 @@ extern void init_proxy (pid_t pid, int waiting, int status);
13extern int start_debugger(char *prog, int startup, int stop, int *debugger_fd); 13extern int start_debugger(char *prog, int startup, int stop, int *debugger_fd);
14extern void fake_child_exit(void); 14extern void fake_child_exit(void);
15extern int gdb_config(char *str); 15extern int gdb_config(char *str);
16extern int gdb_remove(char *unused); 16extern int gdb_remove(int unused);
17 17
18#endif 18#endif
19
20/*
21 * Overrides for Emacs so that we follow Linus's tabbing style.
22 * Emacs will notice this stuff at the end of the file and automatically
23 * adjust the settings for this buffer only. This must remain at the end
24 * of the file.
25 * ---------------------------------------------------------------------------
26 * Local variables:
27 * c-file-style: "linux"
28 * End:
29 */
diff --git a/arch/um/kernel/tt/include/mode-tt.h b/arch/um/kernel/tt/include/mode-tt.h
index efe462019069..e171e15fead5 100644
--- a/arch/um/kernel/tt/include/mode-tt.h
+++ b/arch/um/kernel/tt/include/mode-tt.h
@@ -13,7 +13,6 @@ enum { OP_NONE, OP_EXEC, OP_FORK, OP_TRACE_ON, OP_REBOOT, OP_HALT, OP_CB };
13extern int tracing_pid; 13extern int tracing_pid;
14 14
15extern int tracer(int (*init_proc)(void *), void *sp); 15extern int tracer(int (*init_proc)(void *), void *sp);
16extern void user_time_init_tt(void);
17extern void sig_handler_common_tt(int sig, void *sc); 16extern void sig_handler_common_tt(int sig, void *sc);
18extern void syscall_handler_tt(int sig, union uml_pt_regs *regs); 17extern void syscall_handler_tt(int sig, union uml_pt_regs *regs);
19extern void reboot_tt(void); 18extern void reboot_tt(void);
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c
index 776310fd5b8b..a189a2b92935 100644
--- a/arch/um/kernel/tt/process_kern.c
+++ b/arch/um/kernel/tt/process_kern.c
@@ -266,10 +266,10 @@ int copy_thread_tt(int nr, unsigned long clone_flags, unsigned long sp,
266 } 266 }
267 267
268 if(current->thread.forking){ 268 if(current->thread.forking){
269 sc_to_sc(UPT_SC(&p->thread.regs.regs), 269 sc_to_sc(UPT_SC(&p->thread.regs.regs), UPT_SC(&regs->regs));
270 UPT_SC(&current->thread.regs.regs));
271 SC_SET_SYSCALL_RETURN(UPT_SC(&p->thread.regs.regs), 0); 270 SC_SET_SYSCALL_RETURN(UPT_SC(&p->thread.regs.regs), 0);
272 if(sp != 0) SC_SP(UPT_SC(&p->thread.regs.regs)) = sp; 271 if(sp != 0)
272 SC_SP(UPT_SC(&p->thread.regs.regs)) = sp;
273 } 273 }
274 p->thread.mode.tt.extern_pid = new_pid; 274 p->thread.mode.tt.extern_pid = new_pid;
275 275
@@ -459,14 +459,3 @@ int is_valid_pid(int pid)
459 read_unlock(&tasklist_lock); 459 read_unlock(&tasklist_lock);
460 return(0); 460 return(0);
461} 461}
462
463/*
464 * Overrides for Emacs so that we follow Linus's tabbing style.
465 * Emacs will notice this stuff at the end of the file and automatically
466 * adjust the settings for this buffer only. This must remain at the end
467 * of the file.
468 * ---------------------------------------------------------------------------
469 * Local variables:
470 * c-file-style: "linux"
471 * End:
472 */
diff --git a/arch/um/kernel/tt/time.c b/arch/um/kernel/tt/time.c
deleted file mode 100644
index 8565b71b07cd..000000000000
--- a/arch/um/kernel/tt/time.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7#include <sys/time.h>
8#include <time_user.h>
9#include "process.h"
10#include "user.h"
11
12void user_time_init_tt(void)
13{
14 if(signal(SIGVTALRM, (__sighandler_t) alarm_handler) == SIG_ERR)
15 panic("Couldn't set SIGVTALRM handler");
16 set_interval(ITIMER_VIRTUAL);
17}
18
19/*
20 * Overrides for Emacs so that we follow Linus's tabbing style.
21 * Emacs will notice this stuff at the end of the file and automatically
22 * adjust the settings for this buffer only. This must remain at the end
23 * of the file.
24 * ---------------------------------------------------------------------------
25 * Local variables:
26 * c-file-style: "linux"
27 * End:
28 */
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 03913ca5d256..4efc69a039d7 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -312,7 +312,7 @@ long sys_sigreturn(struct pt_regs regs)
312 unsigned long __user *extramask = frame->extramask; 312 unsigned long __user *extramask = frame->extramask;
313 int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long); 313 int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long);
314 314
315 if(copy_from_user(&set.sig[0], oldmask, sizeof(&set.sig[0])) || 315 if(copy_from_user(&set.sig[0], oldmask, sizeof(set.sig[0])) ||
316 copy_from_user(&set.sig[1], extramask, sig_size)) 316 copy_from_user(&set.sig[1], extramask, sig_size))
317 goto segfault; 317 goto segfault;
318 318
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c
index 335e2d89504d..83e9be820a86 100644
--- a/arch/um/sys-i386/syscalls.c
+++ b/arch/um/sys-i386/syscalls.c
@@ -69,15 +69,11 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
69{ 69{
70 long ret; 70 long ret;
71 71
72 /* XXX: normal arch do here this pass, and also pass the regs to 72 if (!newsp)
73 * do_fork, instead of NULL. Currently the arch-independent code 73 newsp = UPT_SP(&current->thread.regs.regs);
74 * ignores these values, while the UML code (actually it's
75 * copy_thread) does the right thing. But this should change,
76 probably. */
77 /*if (!newsp)
78 newsp = UPT_SP(current->thread.regs);*/
79 current->thread.forking = 1; 74 current->thread.forking = 1;
80 ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid); 75 ret = do_fork(clone_flags, newsp, &current->thread.regs, 0, parent_tid,
76 child_tid);
81 current->thread.forking = 0; 77 current->thread.forking = 0;
82 return(ret); 78 return(ret);
83} 79}
@@ -197,14 +193,3 @@ long sys_sigaction(int sig, const struct old_sigaction __user *act,
197 193
198 return ret; 194 return ret;
199} 195}
200
201/*
202 * Overrides for Emacs so that we follow Linus's tabbing style.
203 * Emacs will notice this stuff at the end of the file and automatically
204 * adjust the settings for this buffer only. This must remain at the end
205 * of the file.
206 * ---------------------------------------------------------------------------
207 * Local variables:
208 * c-file-style: "linux"
209 * End:
210 */
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 6f44f40204ed..3259a4db4534 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -174,26 +174,11 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
174{ 174{
175 long ret; 175 long ret;
176 176
177 /* XXX: normal arch do here this pass, and also pass the regs to 177 if (!newsp)
178 * do_fork, instead of NULL. Currently the arch-independent code 178 newsp = UPT_SP(&current->thread.regs.regs);
179 * ignores these values, while the UML code (actually it's
180 * copy_thread) does the right thing. But this should change,
181 probably. */
182 /*if (!newsp)
183 newsp = UPT_SP(current->thread.regs);*/
184 current->thread.forking = 1; 179 current->thread.forking = 1;
185 ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid); 180 ret = do_fork(clone_flags, newsp, &current->thread.regs, 0, parent_tid,
181 child_tid);
186 current->thread.forking = 0; 182 current->thread.forking = 0;
187 return(ret); 183 return(ret);
188} 184}
189
190/*
191 * Overrides for Emacs so that we follow Linus's tabbing style.
192 * Emacs will notice this stuff at the end of the file and automatically
193 * adjust the settings for this buffer only. This must remain at the end
194 * of the file.
195 * ---------------------------------------------------------------------------
196 * Local variables:
197 * c-file-style: "linux"
198 * End:
199 */