1 /* Utility function for tests that try to break system calls by
2 passing them data that crosses from one virtual page to
8 #include "tests/userprog/boundary.h"
10 static char dst[8192];
12 /* Returns the beginning of a page. There are at least 2048
13 modifiable bytes on either side of the pointer returned. */
15 get_boundary_area (void)
17 char *p = (char *) ROUND_UP ((uintptr_t) dst, 4096);
23 /* Returns a copy of SRC split across the boundary between two
26 copy_string_across_boundary (const char *src)
28 char *p = get_boundary_area ();
29 p -= strlen (src) < 4096 ? strlen (src) / 2 : 4096;
30 strlcpy (p, src, 4096);