Line 51... |
Line 51... |
#include "dcache_model.h"
|
#include "dcache_model.h"
|
#include "icache_model.h"
|
#include "icache_model.h"
|
#include "debug.h"
|
#include "debug.h"
|
#include "stats.h"
|
#include "stats.h"
|
|
|
|
#if DYNAMIC_EXECUTION
|
|
#include "dyn_rec.h"
|
|
#endif
|
|
|
extern char *disassembled;
|
extern char *disassembled;
|
|
|
/* Pointer to memory area descriptions that are assigned to individual
|
/* Pointer to memory area descriptions that are assigned to individual
|
peripheral devices. */
|
peripheral devices. */
|
struct dev_memarea *dev_list;
|
struct dev_memarea *dev_list;
|
Line 448... |
Line 452... |
mprofile (memaddr, MPROF_32 | MPROF_FETCH);
|
mprofile (memaddr, MPROF_32 | MPROF_FETCH);
|
// memaddr = simulate_ic_mmu_fetch(memaddr);
|
// memaddr = simulate_ic_mmu_fetch(memaddr);
|
|
|
cur_vadd = memaddr;
|
cur_vadd = memaddr;
|
|
|
|
#if !(DYNAMIC_EXECUTION)
|
memaddr = immu_translate(memaddr);
|
memaddr = immu_translate(memaddr);
|
|
|
if (except_pending)
|
if (except_pending)
|
return 0;
|
return 0;
|
|
#endif
|
|
|
if (config.debug.enabled)
|
if (config.debug.enabled)
|
*breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr);
|
*breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr);
|
|
|
if (config.ic.enabled)
|
if (config.ic.enabled)
|
Line 473... |
Line 479... |
if (config.debug.enabled)
|
if (config.debug.enabled)
|
*breakpoint += CheckDebugUnit(DebugLoadData,temp);
|
*breakpoint += CheckDebugUnit(DebugLoadData,temp);
|
return temp;
|
return temp;
|
}
|
}
|
|
|
|
/* Returns 32-bit values from mem array. Big endian version.
|
|
*
|
|
* STATISTICS OK
|
|
*/
|
|
uint32_t eval_insn_direct(oraddr_t memaddr, int* breakpoint, int through_mmu)
|
|
{
|
|
uint32_t temp;
|
|
int brk;
|
|
|
|
cur_vadd = memaddr;
|
|
|
|
if(through_mmu)
|
|
memaddr = peek_into_itlb(memaddr);
|
|
|
|
if (config.debug.enabled)
|
|
*breakpoint += CheckDebugUnit(DebugLoadAddress, memaddr);
|
|
|
|
temp = eval_direct32(memaddr, &brk, 0, 0);
|
|
|
|
if (config.debug.enabled)
|
|
*breakpoint += CheckDebugUnit(DebugLoadData, temp);
|
|
|
|
return temp;
|
|
}
|
|
|
|
|
/* Returns 16-bit values from mem array. Big endian version.
|
/* Returns 16-bit values from mem array. Big endian version.
|
*
|
*
|
* STATISTICS OK (only used for cpu_access, that is architectural access)
|
* STATISTICS OK (only used for cpu_access, that is architectural access)
|
*/
|
*/
|
uint16_t eval_mem16(oraddr_t memaddr,int* breakpoint)
|
uint16_t eval_mem16(oraddr_t memaddr,int* breakpoint)
|
Line 657... |
Line 689... |
* below for the read delay and fix it if necessery
|
* below for the read delay and fix it if necessery
|
*/
|
*/
|
PRINTF("unknown/unhandled memory granularuty\n");
|
PRINTF("unknown/unhandled memory granularuty\n");
|
exit(-1);
|
exit(-1);
|
}
|
}
|
|
#if DYNAMIC_EXECUTION
|
|
/* FIXME: Do this with mprotect() */
|
|
struct dyn_page *dp;
|
|
|
|
/* Since the locations 0x0-0xff are nearly always written to in an exception
|
|
* handler, ignore any writes to these locations. If code ends up jumping
|
|
* out there, we'll recompile when the jump actually happens. */
|
|
if((memaddr > 0x100) && (dp = find_dynd_page(memaddr)) && !dp->dirty)
|
|
dirtyfy_page(dp);
|
|
#endif
|
} else {
|
} else {
|
PRINTF("EXCEPTION: write out of memory (32-bit access to %"PRIxADDR")\n",
|
PRINTF("EXCEPTION: write out of memory (32-bit access to %"PRIxADDR")\n",
|
memaddr);
|
memaddr);
|
except_handle(EXCEPT_BUSERR, cur_vadd);
|
except_handle(EXCEPT_BUSERR, cur_vadd);
|
}
|
}
|
Line 705... |
Line 747... |
* below for the read delay and fix it if necessery
|
* below for the read delay and fix it if necessery
|
*/
|
*/
|
PRINTF("unknown/unhandled memory granularuty\n");
|
PRINTF("unknown/unhandled memory granularuty\n");
|
exit(-1);
|
exit(-1);
|
}
|
}
|
|
#if DYNAMIC_EXECUTION
|
|
/* FIXME: Do this with mprotect() */
|
|
struct dyn_page *dp;
|
|
|
|
/* Since the locations 0x0-0xff are nearly always written to in an exception
|
|
* handler, ignore any writes to these locations. If code ends up jumping
|
|
* out there, we'll recompile when the jump actually happens. */
|
|
|
|
if((memaddr > 0x100) && (dp = find_dynd_page(memaddr)) && !dp->dirty)
|
|
dirtyfy_page(dp);
|
|
#endif
|
} else {
|
} else {
|
PRINTF("EXCEPTION: write out of memory (16-bit access to %"PRIxADDR")\n",
|
PRINTF("EXCEPTION: write out of memory (16-bit access to %"PRIxADDR")\n",
|
memaddr);
|
memaddr);
|
except_handle(EXCEPT_BUSERR, cur_vadd);
|
except_handle(EXCEPT_BUSERR, cur_vadd);
|
}
|
}
|
Line 747... |
Line 800... |
temp &= ~(0xff << (8 * (3 - (memaddr & 3))));
|
temp &= ~(0xff << (8 * (3 - (memaddr & 3))));
|
temp |= (unsigned long)(value & 0xff) << (8 * (3 - (memaddr & 3)));
|
temp |= (unsigned long)(value & 0xff) << (8 * (3 - (memaddr & 3)));
|
setsim_mem32_atomic (memaddr & ~ADDR_C(3), temp, cpu_access);
|
setsim_mem32_atomic (memaddr & ~ADDR_C(3), temp, cpu_access);
|
break;
|
break;
|
}
|
}
|
|
#if DYNAMIC_EXECUTION
|
|
/* FIXME: Do this with mprotect() */
|
|
struct dyn_page *dp;
|
|
|
|
/* Since the locations 0x0-0xff are nearly always written to in an exception
|
|
* handler, ignore any writes to these locations. If code ends up jumping
|
|
* out there, we'll recompile when the jump actually happens. */
|
|
|
|
if((memaddr > 0x100) && (dp = find_dynd_page(memaddr)) && !dp->dirty)
|
|
dirtyfy_page(dp);
|
|
#endif
|
} else {
|
} else {
|
PRINTF("EXCEPTION: write out of memory (8-bit access to %"PRIxADDR")\n",
|
PRINTF("EXCEPTION: write out of memory (8-bit access to %"PRIxADDR")\n",
|
memaddr);
|
memaddr);
|
except_handle(EXCEPT_BUSERR, cur_vadd);
|
except_handle(EXCEPT_BUSERR, cur_vadd);
|
}
|
}
|