Browse Source

Fix hardcoded mmap offset

mmap offset must be a multiple of the page size. It was hardcoded
to 4K, so mmap2 test failed on non-4K page size architectures.
Now we get page size using sysconf(_SC_PAGE_SIZE).

Build and run tests done on nsim arc hs38.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Eugeniy Paltsev 8 years ago
parent
commit
199ffd4d10
1 changed files with 1 additions and 1 deletions
  1. 1 1
      test/mmap/mmap2.c

+ 1 - 1
test/mmap/mmap2.c

@@ -18,7 +18,7 @@
 #define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \
   __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0)
 
-#define MAP_SIZE 4096UL
+#define MAP_SIZE sysconf(_SC_PAGESIZE)
 #define MAP_MASK (MAP_SIZE - 1)
 
 int main(int argc, char **argv) {