1 /* SPIM S20 MIPS simulator.
2    Interface to misc. routines for SPIM.
3 
4    Copyright (c) 1990-2010, James R. Larus.
5    All rights reserved.
6 
7    Redistribution and use in source and binary forms, with or without modification,
8    are permitted provided that the following conditions are met:
9 
10    Redistributions of source code must retain the above copyright notice,
11    this list of conditions and the following disclaimer.
12 
13    Redistributions in binary form must reproduce the above copyright notice,
14    this list of conditions and the following disclaimer in the documentation and/or
15    other materials provided with the distribution.
16 
17    Neither the name of the James R. Larus nor the names of its contributors may be
18    used to endorse or promote products derived from this software without specific
19    prior written permission.
20 
21    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27    GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 
33 
34 /* Triple containing a string and two integers.	 Used in tables
35    mapping from a name to values. */
36 
37 typedef struct
38 {
39   char *name;
40   int value1;
41   int value2;
42 } name_val_val;
43 
44 
45 
46 /* Exported functions: */
47 
48 void add_breakpoint (mem_addr addr);
49 void delete_breakpoint (mem_addr addr);
50 void format_data_segs (str_stream *ss);
51 void format_insts (str_stream *ss, mem_addr from, mem_addr to);
52 void format_mem (str_stream *ss, mem_addr from, mem_addr to);
53 void format_registers (str_stream *ss, int print_gpr_hex, int print_fpr_hex);
54 void initialize_registers ();
55 void initialize_run_stack (int argc, char **argv);
56 void initialize_world (char *exception_file_names);
57 void list_breakpoints ();
58 name_val_val *map_int_to_name_val_val (name_val_val tbl[], int tbl_len, int num);
59 name_val_val *map_string_to_name_val_val (name_val_val tbl[], int tbl_len, char *id);
60 int read_assembly_file (char *name);
61 int run_program (mem_addr pc, int steps, int display, int cont_bkpt);
62 mem_addr starting_address ();
63 char *str_copy (char *str);
64 void write_startup_message ();
65 void *xmalloc (int);
66 void *zmalloc (int);
67