summaryrefslogtreecommitdiffstats
path: root/pintos-progos/tests/userprog/boundary.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-03-27 11:51:08 +0200
committermanuel <manuel@mausz.at>2012-03-27 11:51:08 +0200
commit4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b (patch)
tree868c52e06f207b5ec8a3cc141f4b8b2bdfcc165c /pintos-progos/tests/userprog/boundary.c
parenteae0bd57f0a26314a94785061888d193d186944a (diff)
downloadprogos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.gz
progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.bz2
progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.zip
reorganize file structure to match the upstream requirements
Diffstat (limited to 'pintos-progos/tests/userprog/boundary.c')
-rw-r--r--pintos-progos/tests/userprog/boundary.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/pintos-progos/tests/userprog/boundary.c b/pintos-progos/tests/userprog/boundary.c
deleted file mode 100644
index 59907ec..0000000
--- a/pintos-progos/tests/userprog/boundary.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/* Utility function for tests that try to break system calls by
2 passing them data that crosses from one virtual page to
3 another. */
4
5#include <inttypes.h>
6#include <round.h>
7#include <string.h>
8#include "tests/userprog/boundary.h"
9
10static char dst[8192];
11
12/* Returns the beginning of a page. There are at least 2048
13 modifiable bytes on either side of the pointer returned. */
14void *
15get_boundary_area (void)
16{
17 char *p = (char *) ROUND_UP ((uintptr_t) dst, 4096);
18 if (p - dst < 2048)
19 p += 4096;
20 return p;
21}
22
23/* Returns a copy of SRC split across the boundary between two
24 pages. */
25char *
26copy_string_across_boundary (const char *src)
27{
28 char *p = get_boundary_area ();
29 p -= strlen (src) < 4096 ? strlen (src) / 2 : 4096;
30 strlcpy (p, src, 4096);
31 return p;
32}
33