m5.c revision 278
1/* 2 * Copyright (c) 2003 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <c_asm.h> 30 31#include <libgen.h> 32#include <stdio.h> 33#include <stdlib.h> 34#include <string.h> 35 36#include "m5op.h" 37 38char *progname; 39 40void 41usage() 42{ 43 char *name = basename(progname); 44 printf("usage: %s ivlb <interval>\n" 45 " %s ivle <interval>\n" 46 " %s initparam\n" 47 " %s sw99param\n" 48 " %s resetstats\n" 49 " %s exit\n", name, name, name, name, name, name); 50 exit(1); 51} 52 53int 54main(int argc, char *argv[]) 55{ 56 int start; 57 int interval; 58 unsigned long long param; 59 60 progname = argv[0]; 61 if (argc < 2) 62 usage(); 63 64 if (strncmp(argv[1], "ivlb", 5) == 0) { 65 if (argc != 3) usage(); 66 ivlb((unsigned long)atoi(argv[2])); 67 } else if (strncmp(argv[1], "ivle", 5) == 0) { 68 if (argc != 3) usage(); 69 ivle((unsigned long)atoi(argv[2])); 70 } else if (strncmp(argv[1], "exit", 5) == 0) { 71 if (argc != 2) usage(); 72 m5exit(); 73 } else if (strncmp(argv[1], "initparam", 10) == 0) { 74 if (argc != 2) usage(); 75 printf("%d", initparam()); 76 } else if (strncmp(argv[1], "sw99param", 10) == 0) { 77 if (argc != 2) usage(); 78 79 param = initparam(); 80 // run-time, rampup-time, rampdown-time, warmup-time, connections 81 printf("%d %d %d %d %d", (param >> 48) & 0xfff, 82 (param >> 36) & 0xfff, (param >> 24) & 0xfff, 83 (param >> 12) & 0xfff, (param >> 0) & 0xfff); 84 } else if (strncmp(argv[1], "resetstats", 11) == 0) { 85 if (argc != 2) usage(); 86 resetstats(); 87 } 88 89 return 0; 90} 91