]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/um/drivers/mconsole_kern.c
[PATCH] uml: initialize process FP registers properly
[linux-2.6-omap-h63xx.git] / arch / um / drivers / mconsole_kern.c
index e9bbc14f36553c89ae3bc1f2b3498cc64c85a771..54388d10bcf98763976a8d2305fd2222e8b974a8 100644 (file)
@@ -273,7 +273,7 @@ void mconsole_proc(struct mc_request *req)
     config <dev> - Query the configuration of a device \n\
     remove <dev> - Remove a device from UML \n\
     sysrq <letter> - Performs the SysRq action controlled by the letter \n\
-    cad - invoke the Ctl-Alt-Del handler \n\
+    cad - invoke the Ctrl-Alt-Del handler \n\
     stop - pause the UML; it will do nothing until it receives a 'go' \n\
     go - continue the UML after a 'stop' \n\
     log <string> - make UML enter <string> into the kernel log\n\
@@ -327,7 +327,7 @@ void mconsole_stop(struct mc_request *req)
 
 /* This list is populated by __initcall routines. */
 
-LIST_HEAD(mconsole_devices);
+static LIST_HEAD(mconsole_devices);
 
 void mconsole_register_dev(struct mc_device *new)
 {
@@ -422,7 +422,7 @@ void mconsole_remove(struct mc_request *req)
 {
        struct mc_device *dev;
        char *ptr = req->request.data, *err_msg = "";
-        char error[256];
+       char error[256];
        int err, start, end, n;
 
        ptr += strlen("remove");
@@ -433,54 +433,36 @@ void mconsole_remove(struct mc_request *req)
                return;
        }
 
-        ptr = &ptr[strlen(dev->name)];
-
-        err = 1;
-        n = (*dev->id)(&ptr, &start, &end);
-        if(n < 0){
-                err_msg = "Couldn't parse device number";
-                goto out;
-        }
-        else if((n < start) || (n > end)){
-                sprintf(error, "Invalid device number - must be between "
-                        "%d and %d", start, end);
-                err_msg = error;
-                goto out;
-        }
+       ptr = &ptr[strlen(dev->name)];
+
+       err = 1;
+       n = (*dev->id)(&ptr, &start, &end);
+       if(n < 0){
+               err_msg = "Couldn't parse device number";
+               goto out;
+       }
+       else if((n < start) || (n > end)){
+               sprintf(error, "Invalid device number - must be between "
+                       "%d and %d", start, end);
+               err_msg = error;
+               goto out;
+       }
 
        err = (*dev->remove)(n);
-        switch(err){
-        case -ENODEV:
-                err_msg = "Device doesn't exist";
-                break;
-        case -EBUSY:
-                err_msg = "Device is currently open";
-                break;
-        default:
-                break;
-        }
- out:
+       switch(err){
+       case -ENODEV:
+               err_msg = "Device doesn't exist";
+               break;
+       case -EBUSY:
+               err_msg = "Device is currently open";
+               break;
+       default:
+               break;
+       }
+out:
        mconsole_reply(req, err_msg, err, 0);
 }
 
-#ifdef CONFIG_MAGIC_SYSRQ
-void mconsole_sysrq(struct mc_request *req)
-{
-       char *ptr = req->request.data;
-
-       ptr += strlen("sysrq");
-       while(isspace(*ptr)) ptr++;
-
-       mconsole_reply(req, "", 0, 0);
-       handle_sysrq(*ptr, &current->thread.regs, NULL);
-}
-#else
-void mconsole_sysrq(struct mc_request *req)
-{
-       mconsole_reply(req, "Sysrq not compiled in", 1, 0);
-}
-#endif
-
 static DEFINE_SPINLOCK(console_lock);
 static LIST_HEAD(clients);
 static char console_buf[MCONSOLE_MAX_DATA];
@@ -518,7 +500,7 @@ static void console_write(struct console *console, const char *string,
 
 static struct console mc_console = { .name     = "mc",
                                     .write     = console_write,
-                                    .flags     = CON_PRINTBUFFER | CON_ENABLED,
+                                    .flags     = CON_ENABLED,
                                     .index     = -1 };
 
 static int mc_add_console(void)
@@ -549,6 +531,38 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
        list_del(&entry.list);
 }
 
+#ifdef CONFIG_MAGIC_SYSRQ
+static void sysrq_proc(void *arg)
+{
+       char *op = arg;
+
+       handle_sysrq(*op, &current->thread.regs, NULL);
+}
+
+void mconsole_sysrq(struct mc_request *req)
+{
+       char *ptr = req->request.data;
+
+       ptr += strlen("sysrq");
+       while(isspace(*ptr)) ptr++;
+
+       /* With 'b', the system will shut down without a chance to reply,
+        * so in this case, we reply first.
+        */
+       if(*ptr == 'b')
+               mconsole_reply(req, "", 0, 0);
+
+       with_console(req, sysrq_proc, ptr);
+}
+#else
+void mconsole_sysrq(struct mc_request *req)
+{
+       mconsole_reply(req, "Sysrq not compiled in", 1, 0);
+}
+#endif
+
+#ifdef CONFIG_MODE_SKAS
+
 static void stack_proc(void *arg)
 {
        struct task_struct *from = current, *to = arg;
@@ -562,38 +576,38 @@ static void stack_proc(void *arg)
  *  Dumps a stacks registers to the linux console.
  *  Usage stack <pid>.
  */
-void do_stack(struct mc_request *req)
+static void do_stack_trace(struct mc_request *req)
 {
-        char *ptr = req->request.data;
-        int pid_requested= -1;
+       char *ptr = req->request.data;
+       int pid_requested= -1;
        struct task_struct *from = NULL;
        struct task_struct *to = NULL;
 
-        /* Would be nice:
-         * 1) Send showregs output to mconsole.
+       /* Would be nice:
+        * 1) Send showregs output to mconsole.
         * 2) Add a way to stack dump all pids.
         */
 
-        ptr += strlen("stack");
-        while(isspace(*ptr)) ptr++;
+       ptr += strlen("stack");
+       while(isspace(*ptr)) ptr++;
 
-        /* Should really check for multiple pids or reject bad args here */
-        /* What do the arguments in mconsole_reply mean? */
-        if(sscanf(ptr, "%d", &pid_requested) == 0){
-                mconsole_reply(req, "Please specify a pid", 1, 0);
-                return;
-        }
+       /* Should really check for multiple pids or reject bad args here */
+       /* What do the arguments in mconsole_reply mean? */
+       if(sscanf(ptr, "%d", &pid_requested) == 0){
+               mconsole_reply(req, "Please specify a pid", 1, 0);
+               return;
+       }
 
        from = current;
 
        to = find_task_by_pid(pid_requested);
-        if((to == NULL) || (pid_requested == 0)) {
-                mconsole_reply(req, "Couldn't find that pid", 1, 0);
-                return;
-        }
-
+       if((to == NULL) || (pid_requested == 0)) {
+               mconsole_reply(req, "Couldn't find that pid", 1, 0);
+               return;
+       }
        with_console(req, stack_proc, to);
 }
+#endif /* CONFIG_MODE_SKAS */
 
 void mconsole_stack(struct mc_request *req)
 {
@@ -602,7 +616,7 @@ void mconsole_stack(struct mc_request *req)
         */
        CHOOSE_MODE(mconsole_reply(req, "Sorry, this doesn't work in TT mode",
                                   1, 0),
-                   do_stack(req));
+                   do_stack_trace(req));
 }
 
 /* Changed by mconsole_setup, which is __setup, and called before SMP is
@@ -760,14 +774,3 @@ char *mconsole_notify_socket(void)
 }
 
 EXPORT_SYMBOL(mconsole_notify_socket);
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */