OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [sim/] [testsuite/] [sim/] [cris/] [c/] [mmap3.c] - Blame information for rev 330

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
/*
2
#notarget: cris*-*-elf
3
*/
4
 
5
#define _GNU_SOURCE
6
#include <string.h>
7
#include <stdlib.h>
8
#include <stdio.h>
9
#include <sys/types.h>
10
#include <sys/stat.h>
11
#include <unistd.h>
12
#include <sys/mman.h>
13
 
14
int main (int argc, char *argv[])
15
{
16
  volatile unsigned char *a;
17
 
18
  /* Check that we can map a non-multiple of a page and still get a full page.  */
19
  a = mmap (NULL, 0x4c, PROT_READ | PROT_WRITE | PROT_EXEC,
20
            MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
21
  if (a == NULL || a == (unsigned char *) -1)
22
    abort ();
23
 
24
  a[0] = 0xbe;
25
  a[8191] = 0xef;
26
  memset ((char *) a + 1, 0, 8190);
27
 
28
  if (a[0] != 0xbe || a[8191] != 0xef)
29
    abort ();
30
 
31
  printf ("pass\n");
32
  exit (0);
33
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.