I'm working on Kernel programming (Nachos), and having some trouble passing an array of arguments from a userprogram into kernel land. Similar to argc, argv in C, C++, the user program passes:
char *args
into a syscall. In the kernel, I only get an address of where args is located. Now, my thoughts here are that I can cast this int to a char*, and then access the array via subscript, as in the user program. But this gives me cannot access memory errors.
Any thoughts?
I've tried accessing args a few ways, they are shown here:
char *argv = (char *) ReadRegister() // ReadRegister returns an int, addr of args
in addition to
char **argv = (char **) ReadRegister()
I have then tried getting each argument via either
argv[i]
or
&argv[i]
Both give Memory access errors.