Core commit. Compile and run on the OpenPandora
[mupen64plus-pandora.git] / source / mupen64plus-core / src / debugger / dbg_memory.h
CommitLineData
451ab91e 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
64void init_host_disassembler(void);
65
66char* get_recompiled_opcode( uint32 address, int index );
67char* get_recompiled_args( uint32 address, int index );
68void* get_recompiled_addr( uint32 address, int index );
69int get_num_recompiled( uint32 address );
70int get_has_recompiled( uint32 address );
71
72uint64 read_memory_64(uint32 addr);
73uint64 read_memory_64_unaligned(uint32 addr);
74void write_memory_64(uint32 addr, uint64 value);
75void write_memory_64_unaligned(uint32 addr, uint64 value);
76uint32 read_memory_32(uint32);
77uint32 read_memory_32_unaligned(uint32 addr);
78void write_memory_32(uint32, uint32);
79void write_memory_32_unaligned(uint32 addr, uint32 value);
80uint16 read_memory_16(uint32 addr);
81void write_memory_16(uint32 addr, uint16 value);
82uint8 read_memory_8(uint32 addr);
83void write_memory_8(uint32 addr, uint8 value);
84uint32 get_memory_flags(uint32);
85int get_memory_type(uint32);
86
87void activate_memory_break_read(uint32 addr);
88void deactivate_memory_break_read(uint32 addr);
89void activate_memory_break_write(uint32 addr);
90void deactivate_memory_break_write(uint32 addr);
91
92/* Following are the prototypes for the memory breakpoint functions */
93void read_rdram_break(void);
94void read_rdramb_break(void);
95void read_rdramh_break(void);
96void read_rdramd_break(void);
97void read_rdramFB_break(void);
98void read_rdramFBb_break(void);
99void read_rdramFBh_break(void);
100void read_rdramFBd_break(void);
101
102void write_rdram_break(void);
103void write_rdramb_break(void);
104void write_rdramh_break(void);
105void write_rdramd_break(void);
106void write_rdramFB_break(void);
107void write_rdramFBb_break(void);
108void write_rdramFBh_break(void);
109void write_rdramFBd_break(void);
110
111#endif /* __DEBUGGER_MEMORY_H__ */
112