Search
lxdream.org :: lxdream :: r566:59be465e5f01
lxdream 0.9.1
released Jun 29
Download Now
changeset566:59be465e5f01 lxdream-mmu
parent565:a44f0465bbbe
child567:b14dad34c441
authornkeynes
dateTue Jan 01 08:57:33 2008 +0000 (12 years ago)
branchlxdream-mmu
Add breakpoint_type_t enum (general cleanup)
src/aica/armcore.c
src/aica/armcore.h
src/cpu.h
src/mem.h
src/sh4/sh4.c
src/sh4/sh4.h
1.1 --- a/src/aica/armcore.c Tue Jan 01 08:57:03 2008 +0000
1.2 +++ b/src/aica/armcore.c Tue Jan 01 08:57:33 2008 +0000
1.3 @@ -53,14 +53,14 @@
1.4 static struct breakpoint_struct arm_breakpoints[MAX_BREAKPOINTS];
1.5 static int arm_breakpoint_count = 0;
1.6
1.7 -void arm_set_breakpoint( uint32_t pc, int type )
1.8 +void arm_set_breakpoint( uint32_t pc, breakpoint_type_t type )
1.9 {
1.10 arm_breakpoints[arm_breakpoint_count].address = pc;
1.11 arm_breakpoints[arm_breakpoint_count].type = type;
1.12 arm_breakpoint_count++;
1.13 }
1.14
1.15 -gboolean arm_clear_breakpoint( uint32_t pc, int type )
1.16 +gboolean arm_clear_breakpoint( uint32_t pc, breakpoint_type_t type )
1.17 {
1.18 int i;
1.19
2.1 --- a/src/aica/armcore.h Tue Jan 01 08:57:03 2008 +0000
2.2 +++ b/src/aica/armcore.h Tue Jan 01 08:57:33 2008 +0000
2.3 @@ -19,7 +19,8 @@
2.4 #ifndef dream_armcore_H
2.5 #define dream_armcore_H 1
2.6
2.7 -#include "dream.h"
2.8 +#include "lxdream.h"
2.9 +#include "mem.h"
2.10 #include <stdint.h>
2.11 #include <stdio.h>
2.12
2.13 @@ -88,8 +89,8 @@
2.14 void arm_save_state( FILE *f );
2.15 int arm_load_state( FILE *f );
2.16 gboolean arm_execute_instruction( void );
2.17 -void arm_set_breakpoint( uint32_t pc, int type );
2.18 -gboolean arm_clear_breakpoint( uint32_t pc, int type );
2.19 +void arm_set_breakpoint( uint32_t pc, breakpoint_type_t type );
2.20 +gboolean arm_clear_breakpoint( uint32_t pc, breakpoint_type_t type );
2.21 int arm_get_breakpoint( uint32_t pc );
2.22
2.23 /* ARM Memory */
3.1 --- a/src/cpu.h Tue Jan 01 08:57:03 2008 +0000
3.2 +++ b/src/cpu.h Tue Jan 01 08:57:33 2008 +0000
3.3 @@ -19,9 +19,8 @@
3.4 #ifndef dream_cpu_H
3.5 #define dream_cpu_H 1
3.6
3.7 -#include <stdint.h>
3.8 -#include <stdlib.h>
3.9 -#include <glib/gtypes.h>
3.10 +#include "lxdream.h"
3.11 +#include "mem.h"
3.12
3.13 #ifdef __cplusplus
3.14 extern "C" {
3.15 @@ -58,8 +57,8 @@
3.16 disasm_func_t disasm_func; /* Disassembly function */
3.17 gboolean (*step_func)(); /* Single step function */
3.18 int (*is_valid_page_func)(uint32_t); /* Test for valid memory page */
3.19 - void (*set_breakpoint)(uint32_t, int);
3.20 - gboolean (*clear_breakpoint)(uint32_t, int);
3.21 + void (*set_breakpoint)(uint32_t, breakpoint_type_t);
3.22 + gboolean (*clear_breakpoint)(uint32_t, breakpoint_type_t);
3.23 int (*get_breakpoint)(uint32_t);
3.24 size_t instr_size; /* Size of instruction */
3.25 char *regs; /* Pointer to start of registers */
4.1 --- a/src/mem.h Tue Jan 01 08:57:03 2008 +0000
4.2 +++ b/src/mem.h Tue Jan 01 08:57:33 2008 +0000
4.3 @@ -71,25 +71,23 @@
4.4
4.5 #define ENABLE_DEBUG_MODE 1
4.6
4.7 +typedef enum { BREAK_NONE=0, BREAK_ONESHOT=1, BREAK_KEEP=2 } breakpoint_type_t;
4.8 +
4.9 struct breakpoint_struct {
4.10 uint32_t address;
4.11 - int type;
4.12 + breakpoint_type_t type;
4.13 };
4.14
4.15 #define MAX_BREAKPOINTS 32
4.16 -#define BREAK_NONE 0
4.17 -#define BREAK_ONESHOT 1
4.18 -#define BREAK_KEEP 2
4.19
4.20 -#undef ENABLE_WATCH
4.21 +
4.22 +#define MEM_FLAG_ROM 4 /* Mem region is ROM-based */
4.23 +#define MEM_FLAG_RAM 6
4.24
4.25 #define WATCH_WRITE 1
4.26 #define WATCH_READ 2
4.27 #define WATCH_EXEC 3 /* AKA Breakpoint :) */
4.28
4.29 -#define MEM_FLAG_ROM 4 /* Mem region is ROM-based */
4.30 -#define MEM_FLAG_RAM 6
4.31 -
4.32 typedef struct watch_point *watch_point_t;
4.33
4.34 watch_point_t mem_new_watch( uint32_t start, uint32_t end, int flags );
5.1 --- a/src/sh4/sh4.c Tue Jan 01 08:57:03 2008 +0000
5.2 +++ b/src/sh4/sh4.c Tue Jan 01 08:57:33 2008 +0000
5.3 @@ -51,6 +51,16 @@
5.4 extern sh4ptr_t sh4_main_ram;
5.5 static gboolean sh4_use_translator = FALSE;
5.6
5.7 +struct sh4_icache_info {
5.8 + char *page;
5.9 + uint32_t page_start;
5.10 + uint32_t page_size;
5.11 +};
5.12 +
5.13 +extern struct sh4_icache_info sh4_icache;
5.14 +
5.15 +// struct sh4_icache_info sh4_icache = { NULL, -1, -1 };
5.16 +
5.17 void sh4_set_use_xlat( gboolean use )
5.18 {
5.19 // No-op if the translator was not built
5.20 @@ -144,14 +154,14 @@
5.21 }
5.22
5.23
5.24 -void sh4_set_breakpoint( uint32_t pc, int type )
5.25 +void sh4_set_breakpoint( uint32_t pc, breakpoint_type_t type )
5.26 {
5.27 sh4_breakpoints[sh4_breakpoint_count].address = pc;
5.28 sh4_breakpoints[sh4_breakpoint_count].type = type;
5.29 sh4_breakpoint_count++;
5.30 }
5.31
5.32 -gboolean sh4_clear_breakpoint( uint32_t pc, int type )
5.33 +gboolean sh4_clear_breakpoint( uint32_t pc, breakpoint_type_t type )
5.34 {
5.35 int i;
5.36
6.1 --- a/src/sh4/sh4.h Tue Jan 01 08:57:03 2008 +0000
6.2 +++ b/src/sh4/sh4.h Tue Jan 01 08:57:33 2008 +0000
6.3 @@ -21,6 +21,7 @@
6.4 #define lxdream_sh4_H 1
6.5
6.6 #include "lxdream.h"
6.7 +#include "mem.h"
6.8
6.9 #ifdef __cplusplus
6.10 extern "C" {
6.11 @@ -108,17 +109,10 @@
6.12 gboolean sh4_execute_instruction( void );
6.13
6.14 /* SH4 breakpoints */
6.15 -
6.16 -#define BREAK_ONESHOT 1
6.17 -#define BREAK_PERM 2
6.18 -
6.19 -void sh4_set_breakpoint( uint32_t pc, int type );
6.20 -gboolean sh4_clear_breakpoint( uint32_t pc, int type );
6.21 +void sh4_set_breakpoint( uint32_t pc, breakpoint_type_t type );
6.22 +gboolean sh4_clear_breakpoint( uint32_t pc, breakpoint_type_t type );
6.23 int sh4_get_breakpoint( uint32_t pc );
6.24
6.25 -
6.26 -
6.27 -
6.28 #ifdef __cplusplus
6.29 }
6.30 #endif
.