Core commit. Compile and run on the OpenPandora
[mupen64plus-pandora.git] / source / mupen64plus-core / src / debugger / dbg_memory.h
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  *   Mupen64plus - dbg_memory.h                                            *
3  *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
4  *   Copyright (C) 2008 DarkJeztr                                          *
5  *   Copyright (C) 2002 davFr                                              *
6  *                                                                         *
7  *   This program is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU General Public License as published by  *
9  *   the Free Software Foundation; either version 2 of the License, or     *
10  *   (at your option) any later version.                                   *
11  *                                                                         *
12  *   This program is distributed in the hope that it will be useful,       *
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15  *   GNU General Public License for more details.                          *
16  *                                                                         *
17  *   You should have received a copy of the GNU General Public License     *
18  *   along with this program; if not, write to the                         *
19  *   Free Software Foundation, Inc.,                                       *
20  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
21  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22
23 #ifndef __DEBUGGER_MEMORY_H__
24 #define __DEBUGGER_MEMORY_H__
25
26 #define MAX_DISASSEMBLY 64
27
28 /* The following three macros create all the function calls for catching memory breakpoints
29  * these do not occur until after the PC is incremented, but jumps & branches are not yet taken.
30  */
31
32 #define MEMBREAKREAD(name,size) \
33     void name##_break(void) { \
34         check_breakpoints_on_mem_access((PC->addr)-0x4, address, size, BPT_FLAG_ENABLED | BPT_FLAG_READ); \
35         name (); \
36     }
37
38 #define MEMBREAKWRITE(name,size) \
39     void name##_break(void) { \
40         check_breakpoints_on_mem_access((PC->addr)-0x4, address, size, BPT_FLAG_ENABLED | BPT_FLAG_WRITE); \
41         name (); \
42     }
43
44 #define MEMBREAKALL(name) \
45     MEMBREAKREAD( read_##name , 4); \
46     MEMBREAKREAD( read_##name##b , 1); \
47     MEMBREAKREAD( read_##name##h , 2); \
48     MEMBREAKREAD( read_##name##d , 8); \
49     MEMBREAKWRITE( write_##name , 4); \
50     MEMBREAKWRITE( write_##name##b , 1); \
51     MEMBREAKWRITE( write_##name##h , 2); \
52     MEMBREAKWRITE( write_##name##d , 8);
53
54 #define MEMBREAKALL_local(name) \
55     static MEMBREAKREAD( read_##name , 4); \
56     static MEMBREAKREAD( read_##name##b , 1); \
57     static MEMBREAKREAD( read_##name##h , 2); \
58     static MEMBREAKREAD( read_##name##d , 8); \
59     static MEMBREAKWRITE( write_##name , 4); \
60     static MEMBREAKWRITE( write_##name##b , 1); \
61     static MEMBREAKWRITE( write_##name##h , 2); \
62     static MEMBREAKWRITE( write_##name##d , 8);
63
64 void init_host_disassembler(void);
65
66 char* get_recompiled_opcode( uint32 address, int index );
67 char* get_recompiled_args( uint32 address, int index );
68 void* get_recompiled_addr( uint32 address, int index );
69 int get_num_recompiled( uint32 address );
70 int get_has_recompiled( uint32 address );
71
72 uint64 read_memory_64(uint32 addr);
73 uint64 read_memory_64_unaligned(uint32 addr);
74 void write_memory_64(uint32 addr, uint64 value);
75 void write_memory_64_unaligned(uint32 addr, uint64 value);
76 uint32 read_memory_32(uint32);
77 uint32 read_memory_32_unaligned(uint32 addr);
78 void write_memory_32(uint32, uint32);
79 void write_memory_32_unaligned(uint32 addr, uint32 value);
80 uint16 read_memory_16(uint32 addr);
81 void write_memory_16(uint32 addr, uint16 value);
82 uint8 read_memory_8(uint32 addr);
83 void write_memory_8(uint32 addr, uint8 value);
84 uint32 get_memory_flags(uint32);
85 int get_memory_type(uint32);
86
87 void activate_memory_break_read(uint32 addr);
88 void deactivate_memory_break_read(uint32 addr);
89 void activate_memory_break_write(uint32 addr);
90 void deactivate_memory_break_write(uint32 addr);
91
92 /* Following are the prototypes for the memory breakpoint functions */
93 void read_rdram_break(void);
94 void read_rdramb_break(void);
95 void read_rdramh_break(void);
96 void read_rdramd_break(void);
97 void read_rdramFB_break(void);
98 void read_rdramFBb_break(void);
99 void read_rdramFBh_break(void);
100 void read_rdramFBd_break(void);
101
102 void write_rdram_break(void);
103 void write_rdramb_break(void);
104 void write_rdramh_break(void);
105 void write_rdramd_break(void);
106 void write_rdramFB_break(void);
107 void write_rdramFBb_break(void);
108 void write_rdramFBh_break(void);
109 void write_rdramFBd_break(void);
110
111 #endif /* __DEBUGGER_MEMORY_H__ */
112