X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Ftests%2Fuserprog%2Fboundary.c;h=2e81df48e0beb5c75489e6bdb8c781c39b771213;hp=59907ec935d36d8e498766730138741f0143e89d;hb=16c7d34d02045bc7e6165a13c549a7968e074d4b;hpb=bffccc54acc0560186b8c38bc4a66897de5158eb diff --git a/src/tests/userprog/boundary.c b/src/tests/userprog/boundary.c index 59907ec..2e81df4 100644 --- a/src/tests/userprog/boundary.c +++ b/src/tests/userprog/boundary.c @@ -31,3 +31,14 @@ copy_string_across_boundary (const char *src) return p; } +/* Returns an address that is invalid, but the preceding bytes + * are all valid. Used to position information such that the + * first byte of the information is valid, but not all the + * information is valid. */ +void * +get_bad_boundary (void) +{ + /* This code assumes that dst will be in the highest page + * allocated to the user process. */ + return (void *) ROUND_UP ((uintptr_t) (dst + sizeof(dst) - 1), 4096); +}