m5.c (12198:976c5b5db147) m5.c (12464:a02f2484c710)
1/*
2 * Copyright (c) 2011, 2017 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 44 unchanged lines hidden (view full) ---

53#include <stdlib.h>
54#include <string.h>
55#include <sys/mman.h>
56#include <sys/stat.h>
57#include <sys/types.h>
58#include <unistd.h>
59
60#include <gem5/m5ops.h>
1/*
2 * Copyright (c) 2011, 2017 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 44 unchanged lines hidden (view full) ---

53#include <stdlib.h>
54#include <string.h>
55#include <sys/mman.h>
56#include <sys/stat.h>
57#include <sys/types.h>
58#include <unistd.h>
59
60#include <gem5/m5ops.h>
61#include "m5_mmap.h"
61
62
62void *m5_mem = NULL;
63
64char *progname;
65char *command = "unspecified";
66void usage();
67
68void
69parse_int_args(int argc, char *argv[], uint64_t ints[], int len)
70{
71 if (argc > len)

--- 298 unchanged lines hidden (view full) ---

370 header, progname, mainfuncs[i].name, mainfuncs[i].usage);
371 }
372 fprintf(stderr, "\n");
373 fprintf(stderr, "All times in nanoseconds!\n");
374
375 exit(1);
376}
377
63char *progname;
64char *command = "unspecified";
65void usage();
66
67void
68parse_int_args(int argc, char *argv[], uint64_t ints[], int len)
69{
70 if (argc > len)

--- 298 unchanged lines hidden (view full) ---

369 header, progname, mainfuncs[i].name, mainfuncs[i].usage);
370 }
371 fprintf(stderr, "\n");
372 fprintf(stderr, "All times in nanoseconds!\n");
373
374 exit(1);
375}
376
378static void
379map_m5_mem()
380{
381#ifdef M5OP_ADDR
382 int fd;
383
384 fd = open("/dev/mem", O_RDWR | O_SYNC);
385 if (fd == -1) {
386 perror("Can't open /dev/mem");
387 exit(1);
388 }
389
390 m5_mem = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
391 M5OP_ADDR);
392 if (!m5_mem) {
393 perror("Can't mmap /dev/mem");
394 exit(1);
395 }
396#endif
397}
398
399int
400main(int argc, char *argv[])
401{
402 progname = argv[0];
403 if (argc < 2)
404 usage(1);
405
406 map_m5_mem();

--- 17 unchanged lines hidden ---
377int
378main(int argc, char *argv[])
379{
380 progname = argv[0];
381 if (argc < 2)
382 usage(1);
383
384 map_m5_mem();

--- 17 unchanged lines hidden ---