Search
lxdream.org :: lxdream :: r14:fc481a638848
lxdream 0.9.1
released Jun 29
Download Now
changeset14:fc481a638848
parent13:28aea89fb9c6
child15:5194dd0fdb60
authornkeynes
dateMon Dec 12 10:37:41 2005 +0000 (14 years ago)
Use cpu-specific is_valid_page function
src/aica/armcore.h
src/aica/armdasm.c
src/aica/armmem.c
src/cpu.h
src/gui/debug_win.c
src/sh4/sh4dasm.c
1.1 --- a/src/aica/armcore.h Mon Dec 12 10:09:24 2005 +0000
1.2 +++ b/src/aica/armcore.h Mon Dec 12 10:37:41 2005 +0000
1.3 @@ -57,5 +57,6 @@
1.4 void arm_write_word( uint32_t addr, uint32_t val );
1.5 void arm_write_byte( uint32_t addr, uint32_t val );
1.6 int32_t arm_read_phys_word( uint32_t addr );
1.7 +int arm_has_page( uint32_t addr );
1.8
1.9 #endif /* !dream_armcore_H */
2.1 --- a/src/aica/armdasm.c Mon Dec 12 10:09:24 2005 +0000
2.2 +++ b/src/aica/armdasm.c Mon Dec 12 10:37:41 2005 +0000
2.3 @@ -49,12 +49,16 @@
2.4 {NULL, 0, NULL} };
2.5
2.6
2.7 -const struct cpu_desc_struct arm_cpu_desc = { "ARM7", arm_disasm_instruction, 4,
2.8 - (char *)&armr, sizeof(armr), arm_reg_map,
2.9 - &armr.r[15], &armr.icount };
2.10 -const struct cpu_desc_struct armt_cpu_desc = { "ARM7T", armt_disasm_instruction, 2,
2.11 - (char*)&armr, sizeof(armr), arm_reg_map,
2.12 - &armr.r[15], &armr.icount };
2.13 +const struct cpu_desc_struct arm_cpu_desc =
2.14 + { "ARM7", arm_disasm_instruction, 4,
2.15 + (char *)&armr, sizeof(armr), arm_reg_map,
2.16 + &armr.r[15], &armr.icount,
2.17 + arm_has_page };
2.18 +const struct cpu_desc_struct armt_cpu_desc =
2.19 + { "ARM7T", armt_disasm_instruction, 2,
2.20 + (char*)&armr, sizeof(armr), arm_reg_map,
2.21 + &armr.r[15], &armr.icount,
2.22 + arm_has_page };
2.23
2.24
2.25
3.1 --- a/src/aica/armmem.c Mon Dec 12 10:09:24 2005 +0000
3.2 +++ b/src/aica/armmem.c Mon Dec 12 10:37:41 2005 +0000
3.3 @@ -9,6 +9,11 @@
3.4
3.5 }
3.6
3.7 +int arm_has_page( uint32_t addr ) {
3.8 + return ( addr < 0x00200000 ||
3.9 + (addr >= 0x00800000 && addr <= 0x00805000 ) );
3.10 +}
3.11 +
3.12 int32_t arm_read_long( uint32_t addr ) {
3.13 if( addr < 0x00200000 ) {
3.14 return *(int32_t *)(arm_mem + addr);
4.1 --- a/src/cpu.h Mon Dec 12 10:09:24 2005 +0000
4.2 +++ b/src/cpu.h Mon Dec 12 10:37:41 2005 +0000
4.3 @@ -43,7 +43,7 @@
4.4 uint32_t *pc; /* Pointer to PC register */
4.5 uint32_t *icount; /* Pointer to instruction counter */
4.6 /* Memory map? */
4.7 - is_valid_page_t valid_page_func; /* Test for valid memory page */
4.8 + is_valid_page_t is_valid_page_func; /* Test for valid memory page */
4.9 } *cpu_desc_t;
4.10
4.11 #ifdef __cplusplus
5.1 --- a/src/gui/debug_win.c Mon Dec 12 10:09:24 2005 +0000
5.2 +++ b/src/gui/debug_win.c Mon Dec 12 10:37:41 2005 +0000
5.3 @@ -1,5 +1,5 @@
5.4 /**
5.5 - * $Id: debug_win.c,v 1.5 2005-12-11 12:00:03 nkeynes Exp $
5.6 + * $Id: debug_win.c,v 1.6 2005-12-12 10:37:36 nkeynes Exp $
5.7 * This file is responsible for the main debugger gui frame.
5.8 *
5.9 * Copyright (c) 2005 Nathan Keynes.
5.10 @@ -142,7 +142,7 @@
5.11 sprintf( addr, "%08X", from );
5.12 gtk_entry_set_text( data->page_field, addr );
5.13
5.14 - if( !mem_has_page( from ) ) {
5.15 + if( !data->cpu->is_valid_page_func( from ) ) {
5.16 arr[3] = "This page is currently unmapped";
5.17 gtk_clist_append( data->disasm_list, arr );
5.18 gtk_clist_set_foreground( data->disasm_list, 0, &clrError );
6.1 --- a/src/sh4/sh4dasm.c Mon Dec 12 10:09:24 2005 +0000
6.2 +++ b/src/sh4/sh4dasm.c Mon Dec 12 10:37:41 2005 +0000
6.3 @@ -24,9 +24,10 @@
6.4 {NULL, 0, NULL} };
6.5
6.6
6.7 -const struct cpu_desc_struct sh4_cpu_desc = { "SH4", sh4_disasm_instruction, 2,
6.8 - (char *)&sh4r, sizeof(sh4r), sh4_reg_map,
6.9 - &sh4r.pc, &sh4r.icount };
6.10 +const struct cpu_desc_struct sh4_cpu_desc =
6.11 + { "SH4", sh4_disasm_instruction, 2,
6.12 + (char *)&sh4r, sizeof(sh4r), sh4_reg_map,
6.13 + &sh4r.pc, &sh4r.icount, mem_has_page };
6.14
6.15 uint32_t sh4_disasm_instruction( uint32_t pc, char *buf, int len, char *opcode )
6.16 {
.