Browse files

first commit for bens branch

  • Loading branch information...
1 parent e9b167c commit 04954aae1e472727c9d9141c0203b99ecbea520f @Frankencelery Frankencelery committed Oct 20, 2012
View
2 src/examples/echo.c
@@ -8,6 +8,8 @@ main (int argc, char **argv)
for (i = 0; i < argc; i++)
printf ("%s ", argv[i]);
+printf ("\n");
+ printf ("'dis is ECHO, I work!!");
printf ("\n");
return EXIT_SUCCESS;
View
14 src/examples/echo.c~
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <syscall.h>
+
+int
+main (int argc, char **argv)
+{
+ int i;
+
+ for (i = 0; i < argc; i++)
+ printf ("%s ", argv[i]);
+ printf ("\n");
+
+ return EXIT_SUCCESS;
+}
View
BIN src/examples/echo.o
Binary file not shown.
View
BIN src/userprog/filesys_dsk.backup
Binary file not shown.
View
15 src/userprog/process.c
@@ -552,24 +552,36 @@ init_cmd_line (uint8_t *kpage, uint8_t *upage, const char *cmd_line,
int argc;
char **argv;
+
+
+// OLD CODE BELOW!!! _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
+
+
/* Push a temporary working copy of the command line string. */
+ //gives us a pointer to the bottom of the stack
cmd_line_copy = push (kpage, &ofs, cmd_line, strlen (cmd_line) + 1);
if (cmd_line_copy == NULL)
return false;
+printf("Pushing: %s to %s\n",cmd_line, cmd_line_copy);
+
if (push (kpage, &ofs, &null, sizeof null) == NULL)
return false;
+printf("Pushing NULL\n");
+
/* Parse the working copy of the command line into arguments
and push them in reverse order. */
argc = 0;
for (karg = strtok_r (cmd_line_copy, " ", &saveptr); karg != NULL;
karg = strtok_r (NULL, " ", &saveptr))
{
+ // translates pointer from kernel space to user space
void *uarg = upage + (karg - (char *) kpage);
if (push (kpage, &ofs, &uarg, sizeof uarg) == NULL)
return false;
argc++;
+printf("Pushing = %s\n", karg);
}
/* Reverse the order of the command line arguments. */
@@ -582,8 +594,9 @@ init_cmd_line (uint8_t *kpage, uint8_t *upage, const char *cmd_line,
|| push (kpage, &ofs, &null, sizeof null) == NULL)
return false;
+printf("upage: %u\n",upage);
/* Set initial stack pointer. */
- *esp = upage + ofs;
+ *esp = upage + ofs - 12;
return true;
}

0 comments on commit 04954aa

Please sign in to comment.