X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=doc%2Fuserprog.texi;h=612bb81ba553166d0796c84a923155a7e404ce45;hp=0872f798bd170d4319bdaf9a434b5cf156970c45;hb=e587ab7ffa2d548029189e540d5716f880932cb1;hpb=bbbad85235aaccd0d295e012133bca03918be6e5 diff --git a/doc/userprog.texi b/doc/userprog.texi index 0872f79..612bb81 100644 --- a/doc/userprog.texi +++ b/doc/userprog.texi @@ -443,7 +443,7 @@ put_user (uint8_t *udst, uint8_t byte) { int error_code; asm ("movl $1f, %0; movb %b2, %1; 1:" - : "=&a" (error_code), "=m" (*udst) : "r" (byte)); + : "=&a" (error_code), "=m" (*udst) : "q" (byte)); return error_code != -1; } @end verbatim @@ -1090,10 +1090,11 @@ pointers. Then, push the address of each string plus a null pointer sentinel, on the stack, in right-to-left order. These are the elements of -@code{argv}. The order ensures that @code{argv[0]} is at the lowest -virtual address. Word-aligned accesses are faster than unaligned -accesses, so for best performance round the stack pointer down to a -multiple of 4 before the first push. +@code{argv}. The null pointer sentinel ensures that @code{argv[argc]} +is a null pointer, as required by the C standard. The order ensures +that @code{argv[0]} is at the lowest virtual address. Word-aligned +accesses are faster than unaligned accesses, so for best performance +round the stack pointer down to a multiple of 4 before the first push. Then, push @code{argv} (the address of @code{argv[0]}) and @code{argc}, in that order. Finally, push a fake ``return address'': although the