| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: options.h |
| 5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
| 6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. |
| 7 | * |
| 8 | * The above named program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public |
| 10 | * License version 2 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * The above named program is distributed in the hope that it will be |
| 13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public |
| 18 | * License along with this work; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | * |
| 21 | * ========== Copyright Header End ============================================ |
| 22 | */ |
| 23 | /* |
| 24 | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
| 25 | * Use is subject to license terms. |
| 26 | */ |
| 27 | |
| 28 | #ifndef _OPTIONS_H_ |
| 29 | #define _OPTIONS_H_ |
| 30 | |
| 31 | #pragma ident "@(#)options.h 1.19 07/05/30 SMI" |
| 32 | |
| 33 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
| 37 | #include "list.h" |
| 38 | #include "basics.h" |
| 39 | |
| 40 | /* |
| 41 | * Options for controlling Save/Restore feature |
| 42 | */ |
| 43 | typedef struct MEM_PATCH mem_patch_t; |
| 44 | |
| 45 | struct MEM_PATCH { |
| 46 | uint64_t addr; |
| 47 | uint64_t val; |
| 48 | mem_patch_t *nextp; |
| 49 | uint8_t *datap; |
| 50 | }; |
| 51 | |
| 52 | typedef struct { |
| 53 | char *filenamep; /* filename for memory image */ |
| 54 | bool_t legion_format; /* flag to determine whether to save in |
| 55 | * axis or legion format. Default is to |
| 56 | * save in legion format */ |
| 57 | uint64_t trigger_icount; /* instn count to trigger save_state */ |
| 58 | uint64_t trap_pc; /* %pc to jump to when save requested */ |
| 59 | /* XXX FIXME: for now, add one struct, need to make this a linked list later */ |
| 60 | mem_patch_t mem_patch; /* mem patch to apply on save */ |
| 61 | } save_restore_t; |
| 62 | |
| 63 | /* |
| 64 | * Simulator options - gleaned from the argv list, or later modified |
| 65 | * via CLI commands. |
| 66 | */ |
| 67 | |
| 68 | typedef struct { |
| 69 | char * cpp_cmd; /* CPP command path */ |
| 70 | char * cpp_optionsp; /* CPP options for pre-processing the config files */ |
| 71 | char * config_filep; /* configuration file name */ |
| 72 | |
| 73 | int accept_port; /* Socket to accept debugger / CLI connections */ |
| 74 | bool_t specific_port; /* true if -p option specified by user */ |
| 75 | int port_retry_max; /* Max no of retries on new ports if busy */ |
| 76 | bool_t flag_auto_start;/* If true start exection immediately - dont wait for the debugger */ |
| 77 | bool_t analyzer; /* If true enable logic analyzer mode */ |
| 78 | bool_t magic_traps; /* If true allow "magic" traps */ |
| 79 | int buffersz; /* Set size of log buffer, 0 = line buffering */ |
| 80 | char * log_file; |
| 81 | int threads; /* Number of simcpu execution threads */ |
| 82 | uint32_t quantum; /* execution quantum */ |
| 83 | bool_t verbose; /* determine whether to print all messages or not */ |
| 84 | bool_t dumpconfig; /* dump configuration after parsing */ |
| 85 | save_restore_t save_restore; /* save/restore debug options */ |
| 86 | bool_t walltime; /* simulation is walltime based */ |
| 87 | |
| 88 | LIST_DEF(libpath, char); /* list of search paths */ |
| 89 | } options_t; |
| 90 | |
| 91 | extern options_t options; |
| 92 | |
| 93 | extern bool_t process_opts(int argc, char ** argv); |
| 94 | |
| 95 | extern void banner_print(); |
| 96 | extern void version_print(); |
| 97 | extern void consolidate(); |
| 98 | |
| 99 | typedef char clibuf_t[2048]; |
| 100 | |
| 101 | #ifdef __cplusplus |
| 102 | } |
| 103 | #endif |
| 104 | |
| 105 | #endif /* !_OPTIONS_H_ */ |