X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=doc%2Fuserprog.texi;h=92959ec06f9e1242328e59688bbf5992099bb314;hb=1c07a79a63dbbd1f4047bf32046518de6f879d50;hp=bab70ec7c178094f1e1ef581b8dc18648c761acc;hpb=615bf3b3d2a8573ed6fb9ddc0055745e163ac999;p=pintos-anon diff --git a/doc/userprog.texi b/doc/userprog.texi index bab70ec..92959ec 100644 --- a/doc/userprog.texi +++ b/doc/userprog.texi @@ -415,7 +415,7 @@ provide a little bit of helpful code: Returns true if successful, false if USRC is invalid. */ static inline bool get_user (uint8_t *kdst, const uint8_t *usrc) { int eax; - asm ("mov %%eax, offset 1f; mov %%al, %2; mov %0, %%al; 1:" + asm ("movl $1f, %%eax; movb %2, %%al; movb %%al, %0; 1:" : "=m" (*kdst), "=&a" (eax) : "m" (*usrc)); return eax != 0; } @@ -424,7 +424,7 @@ static inline bool get_user (uint8_t *kdst, const uint8_t *usrc) { Returns true if successful, false if UDST is invalid. */ static inline bool put_user (uint8_t *udst, uint8_t byte) { int eax; - asm ("mov %%eax, offset 1f; mov %0, %b2; 1:" + asm ("movl $1f, %%eax; movb %b2, %0; 1:" : "=m" (*udst), "=&a" (eax) : "r" (byte)); return eax != 0; } @@ -638,15 +638,15 @@ The file defines other syscalls. Ignore them for now. You will implement some of them in project 3 and the rest in project 4, so be sure to design your system with extensibility in mind. -To implement syscalls, you need to provide ways to copy data -from user virtual address space into the kernel and vice versa. +To implement syscalls, you need to provide ways to read and write data +in user virtual address space. You need this ability before you can even obtain the system call number, because the system call number is on the user's stack in the user's virtual address space. This can be a bit tricky: what if the user provides an invalid pointer, a pointer into kernel memory, or a block partially in one of those regions? You should handle these cases by -terminating the user process. We recommend +terminating the user process. We recommend writing and testing this code before implementing any other system call functionality. @@ -783,6 +783,10 @@ user program C library does not have a @func{malloc} implementation. Modify @file{src/examples/Makefile}, then run @command{make}. +@item Can I run user programs under a debugger? + +Yes, with some limitations. @xref{Debugging User Programs}. + @item What's the difference between @code{tid_t} and @code{pid_t}? A @code{tid_t} identifies a kernel thread, which may have a user