Added kernel command line to SPARC port
authorAndrew Waterman <waterman@r53.millennium.berkeley.edu>
Mon, 2 Nov 2009 10:41:31 +0000 (02:41 -0800)
committerAndrew Waterman <waterman@r53.millennium.berkeley.edu>
Mon, 2 Nov 2009 10:41:31 +0000 (02:41 -0800)
kern/arch/sparc/init.c
kern/arch/sparc/init.h

index aaf6989..2614405 100644 (file)
@@ -5,10 +5,34 @@
 #endif
 
 #include <smp.h>
+#include <arch/init.h>
+
+size_t argc;
+char** argv;
+// dummy values to avoid putting this in the BSS section
+void* __args[(4096+8)/sizeof(void*)] __attribute__((aligned(8))) = {(void*)1};
+
+static void
+init_argc_argv()
+{
+        argc = (size_t)__args[2];
+        argv = (char**)&__args[3];
+
+        //argv[0] should be "none" for ROS.  we'll ignore it.
+        if(argc > 0)
+        {
+                argc--;
+                argv++;
+        }
+
+        for(size_t i = 0; i < argc; i++)
+                argv[i] += (char*)(&__args[2])-(char*)NULL;
+}
 
 void arch_init()
 {              
        // this returns when all other cores are done and ready to receive IPIs
+       init_argc_argv();
        smp_boot();
        env_init();
 }
index 4846408..f412030 100644 (file)
@@ -3,6 +3,9 @@
 #ifndef ROS_ARCH_INIT_H
 #define ROS_ARCH_INIT_H
 
+extern size_t argc;
+extern char** argv;
+
 void arch_init();
 
 #endif // !ROS_ARCH_INIT_H