25     "HARDWARE BREAKPOINT",
 
   26     "DATA ADDR WATCHPOINT PRECISE",
 
   27     "DATA VALUE WATCHPOINT PRECISE",
 
   28     "DATA VALUE WATCHPOINT IMPRECISE",
 
   30     "HARDWARE SINGLE STEP",
 
   31     "DATA ADDR WATCHPOINT NEXT PRECISE",
 
   32     "DATA VALUE WATCHPOINT NEXT PRECISE",
 
   33     "LOAD STORE GLOBAL STOP",
 
   74         LOG_DEBUG(
"reading register(cached) %" PRIi32 
"(%s), value: 0x%8.8" PRIx32,
 
   81     if (reg_arch_info->
enable == 
false) {
 
   97         LOG_DEBUG(
"reading register %" PRIi32 
"(%s), value: 0x%8.8" PRIx32,
 
  125     if (reg_arch_info->
enable == 
false) {
 
  131                 && ((reg_arch_info->
num >= 
FD0) && (reg_arch_info->
num <= 
FD31))) {
 
  155     if ((value_ir0 >> 5) & 0x1) {
 
  216         memory->
ilm_start = value_mr6 & 0xFFF00000;
 
  219         memory->
ilm_start = value_mr6 & 0xFFFFFC00;
 
  233         memory->
dlm_start = value_mr7 & 0xFFF00000;
 
  236         memory->
dlm_start = value_mr7 & 0xFFFFFC00;
 
  269     if (value & 0x80000000)
 
  296     LOG_DEBUG(
"writing register %" PRIi32 
"(%s) with value 0x%8.8" PRIx32,
 
  322     if (mapped_regnum == 
IR0) {
 
  324     } 
else if (mapped_regnum == 
MR0) {
 
  326     } 
else if ((mapped_regnum == 
MR6) || (mapped_regnum == 
MR7)) {
 
  329     } 
else if (mapped_regnum == 
MR8) {
 
  331     } 
else if (mapped_regnum == 
FUCPR) {
 
  353         ((reg_arch_info->
num >= 
FD0) && (reg_arch_info->
num <= 
FD31))) {
 
  389     if (!cache || !reg_list || !reg_arch_info) {
 
  396     cache->
name = 
"Andes registers";
 
  402         reg_arch_info[i].
num = i;
 
  405         reg_arch_info[i].
enable = 
false;
 
  408         reg_list[i].
number = reg_arch_info[i].
num;
 
  410         reg_list[i].
arch_info = ®_arch_info[i];
 
  414         if (reg_arch_info[i].
num >= 
FD0 && reg_arch_info[i].
num <= 
FD31) {
 
  420             reg_list[i].
group = 
"float";
 
  424             reg_list[i].
group = 
"general";
 
  426             if ((reg_arch_info[i].
num >= 
FS0) && (reg_arch_info[i].
num <= 
FS31)) {
 
  429                 reg_list[i].
group = 
"float";
 
  430             } 
else if ((reg_arch_info[i].
num == 
FPCSR) ||
 
  432                 reg_list[i].
group = 
"float";
 
  433             } 
else if ((reg_arch_info[i].
num == 
R28) ||
 
  434                    (reg_arch_info[i].
num == 
R29) ||
 
  435                    (reg_arch_info[i].
num == 
R31)) {
 
  438             } 
else if ((reg_arch_info[i].
num == 
R30) ||
 
  439                    (reg_arch_info[i].
num == 
PC)) {
 
  448         if (reg_arch_info[i].
num >= 
R16 && reg_arch_info[i].
num <= 
R25)
 
  456             reg_list[i].
feature->
name = 
"org.gnu.gdb.nds32.core";
 
  457         else if (reg_arch_info[i].
num >= 
CR0 && reg_arch_info[i].
num <= 
SECUR0)
 
  458             reg_list[i].
feature->
name = 
"org.gnu.gdb.nds32.system";
 
  459         else if (reg_arch_info[i].
num >= 
D0L24 && reg_arch_info[i].
num <= 
CBE3)
 
  460             reg_list[i].
feature->
name = 
"org.gnu.gdb.nds32.audio";
 
  461         else if (reg_arch_info[i].
num >= 
FPCSR && reg_arch_info[i].
num <= 
FD31)
 
  462             reg_list[i].
feature->
name = 
"org.gnu.gdb.nds32.fpu";
 
  496     uint32_t 
value, value_ir0;
 
  536     uint8_t set_value[4];
 
  545     return r->
type->
set(r, set_value);
 
  550         struct reg **reg_list[], 
int *reg_list_size)
 
  552     struct reg *reg_current;
 
  557     *reg_list = malloc(
sizeof(
struct reg *) * (
IFC_LP - 
R0 + 1));
 
  563             (*reg_list)[current_idx] = reg_current;
 
  567     *reg_list_size = current_idx;
 
  574         struct reg **reg_list[], 
int *reg_list_size)
 
  577     struct reg *reg_current;
 
  583     *reg_list = malloc(
sizeof(
struct reg *) * (*reg_list_size));
 
  589         (*reg_list)[i] = reg_current;
 
  597         struct reg **reg_list[], 
int *reg_list_size,
 
  615         uint32_t 
length, uint32_t *end_address)
 
  621     uint32_t dlm_start, dlm_end;
 
  622     uint32_t ilm_start, ilm_end;
 
  623     uint32_t address_end = address + 
length;
 
  626     *end_address = address_end;
 
  632         LOG_DEBUG(
"EDM does not support ACC_CTL");
 
  655         if (address < ilm_start) {
 
  656             if (ilm_start < address_end) {
 
  658                 *end_address = ilm_start;
 
  662         } 
else if ((ilm_start <= address) && (address < ilm_end)) {
 
  664             if (ilm_end < address_end) {
 
  666                 *end_address = ilm_end;
 
  685         if (address < dlm_start) {
 
  686             if (dlm_start < address_end) {
 
  688                 *end_address = dlm_start;
 
  692         } 
else if ((dlm_start <= address) && (address < dlm_end)) {
 
  694             if (dlm_end < address_end) {
 
  696                 *end_address = dlm_end;
 
  725     LOG_DEBUG(
"READ BUFFER: ADDR %08" PRIx32 
"  SIZE %08" PRIx32,
 
  731     uint32_t end_address;
 
  733     if (((address % 2) == 0) && (
size == 2)) {
 
  740         uint32_t unaligned = 4 - (address % 4);
 
  742         if (unaligned > 
size)
 
  751         address += unaligned;
 
  763             read_len = end_address - address;
 
  778         } 
while (aligned != 0);
 
  848     LOG_DEBUG(
"WRITE BUFFER: ADDR %08" PRIx32 
"  SIZE %08" PRIx32,
 
  854     uint32_t end_address;
 
  856     if (((address % 2) == 0) && (
size == 2)) {
 
  863         uint32_t unaligned = 4 - (address % 4);
 
  865         if (unaligned > 
size)
 
  874         address += unaligned;
 
  886             write_len = end_address - address;
 
  895             address += write_len;
 
  897             aligned -= write_len;
 
  899         } 
while (aligned != 0);
 
  948         LOG_ERROR(
"%s: target not halted", __func__);
 
  969         LOG_ERROR(
"BUG: called for a non-Andes target");
 
  973     uint32_t value_pc, value_psw;
 
  978     LOG_USER(
"target halted due to %s\n" 
  979             "psw: 0x%8.8" PRIx32 
" pc: 0x%8.8" PRIx32 
"%s",
 
 1050     memory->
icache.
way = (value_cr1 >> 3) & 0x7;
 
 1054     memory->
ilm_base = (value_cr1 >> 10) & 0x7;
 
 1060     memory->
dcache.
way = (value_cr2 >> 3) & 0x7;
 
 1064     memory->
dlm_base = (value_cr2 >> 10) & 0x7;
 
 1089     cpu_version->
revision = (value_cr0 >> 16) & 0xFF;
 
 1098         mmu_config->
tlb_size = (value_cr3 >> 8) & 0x7F;
 
 1100         mmu_config->
tlb_ways = (value_cr3 >> 8) & 0x7;
 
 1101         mmu_config->
tlb_sets = (value_cr3 >> 11) & 0x7;
 
 1105     mmu_config->
tlb_lock = (value_cr3 >> 24) & 0x1;
 
 1110     mmu_config->
vlpt = (value_cr3 >> 29) & 0x1;
 
 1111     mmu_config->
ntme = (value_cr3 >> 30) & 0x1;
 
 1112     mmu_config->
drde = (value_cr3 >> 31) & 0x1;
 
 1115     misc_config->
edm = value_cr4 & 0x1;
 
 1122     misc_config->
audio_isa = (value_cr4 >> 7) & 0x3;
 
 1123     misc_config->
l2_cache = (value_cr4 >> 9) & 0x1;
 
 1125     misc_config->
addr_24 = (value_cr4 >> 11) & 0x1;
 
 1131     misc_config->
ifc = (value_cr4 >> 19) & 0x1;
 
 1132     misc_config->
mcu = (value_cr4 >> 20) & 0x1;
 
 1133     misc_config->
shadow = (value_cr4 >> 21) & 0x7;
 
 1134     misc_config->
ex9 = (value_cr4 >> 24) & 0x1;
 
 1152             ((cpu_version->
revision & 0xFC) == 0)) {
 
 1188     if (misc_config->
ex9)
 
 1191     if (no_cr5 == 
false)
 
 1209     if (misc_config->
mcu == 
true)
 
 1230     if (misc_config->
shadow == 1) {
 
 1235     if (misc_config->
ifc)
 
 1255                 if (misc_config->
shadow == 1) {
 
 1293     if (misc_config->
edm) {
 
 1296         for (
int i = 0 ; i < dr_reg_n ; i++)
 
 1332             (no_racr0 == 
false))
 
 1367         uint32_t fucpr_backup;
 
 1370         if ((fucpr_backup & 0x80000000) == 0)
 
 1374         if ((fucpr_backup & 0x80000000) == 0)
 
 1377         if ((value_mod >> 6) & 0x1) {
 
 1402     uint32_t ivb_prog_pri_lvl;
 
 1403     uint32_t ivb_ivic_ver;
 
 1406     ivb_prog_pri_lvl = ir3_value & 0x1;
 
 1407     ivb_ivic_ver = (ir3_value >> 11) & 0x3;
 
 1409     if ((ivb_prog_pri_lvl == 1) || (ivb_ivic_ver >= 1)) {
 
 1414     if (ivb_ivic_ver >= 1) {
 
 1435     uint32_t check_data;
 
 1436     uint32_t break_insn;
 
 1443     if (*(
char *)&data & 0x80) { 
 
 1472     uint32_t check_data;
 
 1473     uint32_t break_insn;
 
 1483             (uint8_t *)&check_data);
 
 1533                 LOG_DEBUG(
"writing register %d with value 0x%8.8" PRIx32,
 
 1537                 if (reg_arch_info->
num >= 
FD0 && reg_arch_info->
num <= 
FD31) {
 
 1573     if ((edm_cfg >> 4) & 0x1)
 
 1582     if (edm_ctl & (0x1 << 29))
 
 1607     uint32_t value_mr6, value_mr7;
 
 1608     uint32_t size_index;
 
 1610     size_index = (value_mr6 >> 1) & 0xF;
 
 1614     size_index = (value_mr7 >> 1) & 0xF;
 
 1667         *physical = address;
 
 1688     uint32_t cur_address;
 
 1690     uint32_t start_line, end_line;
 
 1695         start_line = address >> (dcache->
line_size + 2);
 
 1699         for (cur_address = address, cur_line = start_line;
 
 1700                 cur_line <= end_line;
 
 1701                 cur_address += dcache_line_size, cur_line++) {
 
 1716         start_line = address >> (icache->
line_size + 2);
 
 1720         for (cur_address = address, cur_line = start_line;
 
 1721                 cur_line <= end_line;
 
 1722                 cur_address += icache_line_size, cur_line++) {
 
 1768     uint32_t ir14_value;
 
 1771         ir14_value |= (0x1 << 31);
 
 1773         ir14_value &= ~(0x1 << 31);
 
 1778     bool no_step = 
false;
 
 1789     if (no_step == 
false) {
 
 1802         ir14_value &= ~(0x1 << 31);
 
 1821     uint32_t ir14_value;
 
 1824         ir14_value |= (0x1 << 31);
 
 1826         ir14_value &= ~(0x1 << 31);
 
 1844         ir14_value &= ~(0x1 << 31);
 
 1859     switch (nds32_state) {
 
 1864             LOG_INFO(
"Target is disconnected");
 
 1923                     (instruction.
info.
imm == 0x7FFF)) {
 
 1973     uint32_t passcode_length;
 
 1974     char command_sequence[129];
 
 1975     char command_str[33];
 
 1977     uint32_t copy_length;
 
 1986         command_sequence[0] = 
'\0';
 
 1987         for (i = 0; i < passcode_length; i += 8) {
 
 1988             if (passcode_length - i < 8)
 
 1989                 copy_length = passcode_length - i;
 
 1994             code_str[copy_length] = 
'\0';
 
 1995             code = strtoul(code_str, 
NULL, 16);
 
 1997             sprintf(command_str, 
"write_misc gen_port0 0x%" PRIx32 
";", code);
 
 1998             strcat(command_sequence, command_str);
 
 2005         uint32_t value_edmsw;
 
 2012         const char *reg_name;
 
 2016                 reg_name = 
"gen_port0";
 
 2018                 reg_name = 
"gen_port1";
 
 2022             sprintf(command_str, 
"write_misc %s 0x%" PRIx32 
";", reg_name, code);
 
 2078             LOG_DEBUG(
"Change target state to TARGET_HALTED.");
 
 2091             LOG_WARNING(
"<-- TARGET WARNING! The debug target has been reset. -->");
 
 2095             LOG_DEBUG(
"Change target state to TARGET_RUNNING.");
 
 2105         target_addr_t address, 
int handle_breakpoints, 
int debug_execution)
 
 2108             " handle_breakpoints %d" 
 2109             " debug_execution %d",
 
 2110             current, address, handle_breakpoints, debug_execution);
 
 2123     if (!debug_execution)
 
 2130         value_ir0 &= ~(0x1 << 11);
 
 2144     if (!debug_execution)
 
 2184         LOG_WARNING(
"Reset is not asserted because the target is not examined.");
 
 2185         LOG_WARNING(
"Use a reset button or power cycle the target.");
 
 2238     bool backup_virtual_hosting_setting;
 
 2264     int target_number = *(
int *)
priv;
 
 2301         LOG_ERROR(
"Target has not initial file-I/O data structure");
 
 2307     uint32_t syscall_id;
 
 2313     syscall_id = (value_ir6 >> 16) & 0x7FFF;
 
 2316     LOG_DEBUG(
"hit syscall ID: 0x%" PRIx32, syscall_id);
 
 2322     uint32_t reg_r0, reg_r1, reg_r2;
 
 2327     switch (syscall_id) {
 
 2331             fileio_info->
param_1 = reg_r0;
 
 2335                 uint8_t filename[256];
 
 2338                 fileio_info->
param_1 = reg_r0;
 
 2340                 fileio_info->
param_3 = reg_r1;
 
 2341                 fileio_info->
param_4 = reg_r2;
 
 2344                 fileio_info->
param_2 = strlen((
char *)filename);
 
 2350             fileio_info->
param_1 = reg_r0;
 
 2355             fileio_info->
param_1 = reg_r0;
 
 2356             fileio_info->
param_2 = reg_r1;
 
 2357             fileio_info->
param_3 = reg_r2;
 
 2362             fileio_info->
param_1 = reg_r0;
 
 2363             fileio_info->
param_2 = reg_r1;
 
 2364             fileio_info->
param_3 = reg_r2;
 
 2369             fileio_info->
param_1 = reg_r0;
 
 2370             fileio_info->
param_2 = reg_r1;
 
 2371             fileio_info->
param_3 = reg_r2;
 
 2375                 uint8_t filename[256];
 
 2378                 fileio_info->
param_1 = reg_r0;
 
 2382                 fileio_info->
param_2 = strlen((
char *)filename);
 
 2387                 uint8_t filename[256];
 
 2390                 fileio_info->
param_1 = reg_r0;
 
 2392                 fileio_info->
param_3 = reg_r1;
 
 2396                 fileio_info->
param_2 = strlen((
char *)filename);
 
 2399                 fileio_info->
param_4 = strlen((
char *)filename);
 
 2405             fileio_info->
param_1 = reg_r0;
 
 2406             fileio_info->
param_2 = reg_r1;
 
 2410                 uint8_t filename[256];
 
 2413                 fileio_info->
param_1 = reg_r0;
 
 2415                 fileio_info->
param_3 = reg_r1;
 
 2418                 fileio_info->
param_2 = strlen((
char *)filename) + 1;
 
 2423             sprintf(fileio_info->
identifier, 
"gettimeofday");
 
 2424             fileio_info->
param_1 = reg_r0;
 
 2425             fileio_info->
param_2 = reg_r1;
 
 2430             fileio_info->
param_1 = reg_r0;
 
 2437                 fileio_info->
param_1 = reg_r0;
 
 2460     LOG_DEBUG(
"syscall return code: 0x%x, errno: 0x%x , ctrl_c: %s",
 
 2461             retcode, fileio_errno, ctrl_c ? 
"true" : 
"false");
 
 2475             uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
 
 2478     uint32_t iteration = seconds * 100;
 
 2488     if (max_num_samples < iteration)
 
 2489         iteration = max_num_samples;
 
 2492     aice_profiling(aice, 10, iteration, pc_regnum, samples, num_samples);
 
 2508         stat_buffer[0] = 
buffer[3];
 
 2509         stat_buffer[1] = 
buffer[2];
 
 2511         stat_buffer[2] = 
buffer[7];
 
 2512         stat_buffer[3] = 
buffer[6];
 
 2514         stat_buffer[4] = 
buffer[11];
 
 2515         stat_buffer[5] = 
buffer[10];
 
 2516         stat_buffer[6] = 
buffer[9];
 
 2517         stat_buffer[7] = 
buffer[8];
 
 2519         stat_buffer[8] = 
buffer[15];
 
 2520         stat_buffer[9] = 
buffer[16];
 
 2522         stat_buffer[10] = 
buffer[19];
 
 2523         stat_buffer[11] = 
buffer[18];
 
 2525         stat_buffer[12] = 
buffer[23];
 
 2526         stat_buffer[13] = 
buffer[22];
 
 2528         stat_buffer[14] = 
buffer[27];
 
 2529         stat_buffer[15] = 
buffer[26];
 
 2531         stat_buffer[16] = 
buffer[35];
 
 2532         stat_buffer[17] = 
buffer[34];
 
 2533         stat_buffer[18] = 
buffer[33];
 
 2534         stat_buffer[19] = 
buffer[32];
 
 2536         stat_buffer[20] = 
buffer[55];
 
 2537         stat_buffer[21] = 
buffer[54];
 
 2538         stat_buffer[22] = 
buffer[53];
 
 2539         stat_buffer[23] = 
buffer[52];
 
 2541         stat_buffer[24] = 0;
 
 2542         stat_buffer[25] = 0;
 
 2543         stat_buffer[26] = 0;
 
 2544         stat_buffer[27] = 0;
 
 2546         stat_buffer[28] = 
buffer[59];
 
 2547         stat_buffer[29] = 
buffer[58];
 
 2548         stat_buffer[30] = 
buffer[57];
 
 2549         stat_buffer[31] = 
buffer[56];
 
 2551         stat_buffer[32] = 0;
 
 2552         stat_buffer[33] = 0;
 
 2553         stat_buffer[34] = 0;
 
 2554         stat_buffer[35] = 0;
 
 2556         stat_buffer[36] = 
buffer[63];
 
 2557         stat_buffer[37] = 
buffer[62];
 
 2558         stat_buffer[38] = 
buffer[61];
 
 2559         stat_buffer[39] = 
buffer[60];
 
 2561         stat_buffer[40] = 0;
 
 2562         stat_buffer[41] = 0;
 
 2563         stat_buffer[42] = 0;
 
 2564         stat_buffer[43] = 0;
 
 2566         stat_buffer[44] = 
buffer[43];
 
 2567         stat_buffer[45] = 
buffer[42];
 
 2568         stat_buffer[46] = 
buffer[41];
 
 2569         stat_buffer[47] = 
buffer[40];
 
 2571         stat_buffer[48] = 
buffer[51];
 
 2572         stat_buffer[49] = 
buffer[50];
 
 2573         stat_buffer[50] = 
buffer[49];
 
 2574         stat_buffer[51] = 
buffer[48];
 
 2576         stat_buffer[52] = 0;
 
 2577         stat_buffer[53] = 0;
 
 2578         stat_buffer[54] = 0;
 
 2579         stat_buffer[55] = 0;
 
 2580         stat_buffer[56] = 0;
 
 2581         stat_buffer[57] = 0;
 
 2582         stat_buffer[58] = 0;
 
 2583         stat_buffer[59] = 0;
 
 2590         timeval_buffer[0] = 
buffer[3];
 
 2591         timeval_buffer[1] = 
buffer[2];
 
 2592         timeval_buffer[2] = 
buffer[1];
 
 2593         timeval_buffer[3] = 
buffer[0];
 
 2594         timeval_buffer[4] = 
buffer[11];
 
 2595         timeval_buffer[5] = 
buffer[10];
 
 2596         timeval_buffer[6] = 
buffer[9];
 
 2597         timeval_buffer[7] = 
buffer[8];
 
@ AICE_TARGET_DEBUG_RUNNING
@ AICE_CACHE_CTL_L1D_VA_INVAL
@ AICE_CACHE_CTL_L1D_VA_WB
@ AICE_CACHE_CTL_L1I_VA_INVAL
#define CHECK_RETVAL(action)
Support functions to access arbitrary bits in a byte array.
static void buf_set_u64(uint8_t *_buffer, unsigned first, unsigned num, uint64_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned first, unsigned num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
static void buf_set_u32(uint8_t *_buffer, unsigned first, unsigned num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static uint64_t buf_get_u64(const uint8_t *_buffer, unsigned first, unsigned num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 64-bit word.
static struct esp_usb_jtag * priv
void alive_sleep(uint64_t ms)
#define LOG_USER(expr ...)
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
static int nds32_update_mmu_info(struct nds32 *nds32)
static int nds32_get_core_reg(struct reg *reg)
int nds32_examine_debug_reason(struct nds32 *nds32)
static int nds32_soft_reset_halt(struct target *target)
int nds32_poll(struct target *target)
static struct reg_cache * nds32_build_reg_cache(struct target *target, struct nds32 *nds32)
static int nds32_update_cache_info(struct nds32 *nds32)
int nds32_config(struct nds32 *nds32)
int nds32_full_context(struct nds32 *nds32)
int nds32_mmu(struct target *target, int *enabled)
int nds32_halt(struct target *target)
static const struct reg_arch_type nds32_reg_access_type
int nds32_gdb_fileio_end(struct target *target, int retcode, int fileio_errno, bool ctrl_c)
int nds32_read_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
static int nds32_get_core_reg_64(struct reg *reg)
uint32_t nds32_edm_ops_num
int nds32_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
get all register list
int nds32_arch_state(struct target *target)
static void nds32_init_config(struct nds32 *nds32)
static int nds32_get_general_reg_list(struct nds32 *nds32, struct reg **reg_list[], int *reg_list_size)
get general register list
int nds32_get_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t *value)
int nds32_restore_context(struct target *target)
Restore the processor context on an Andes target.
int nds32_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info)
static int nds32_gdb_attach(struct nds32 *nds32)
int nds32_edm_config(struct nds32 *nds32)
int nds32_target_state(struct nds32 *nds32, enum target_state *state)
int nds32_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
int nds32_cache_sync(struct target *target, target_addr_t address, uint32_t length)
struct nds32_edm_operation nds32_edm_ops[NDS32_EDM_OPERATION_MAX_NUM]
int nds32_write_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
const char * nds32_debug_type_name[11]
int nds32_read_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int nds32_add_software_breakpoint(struct target *target, struct breakpoint *breakpoint)
static int nds32_init_memory_config(struct nds32 *nds32)
static int nds32_set_core_reg_64(struct reg *reg, uint8_t *buf)
int nds32_profiling(struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
static void nds32_init_must_have_registers(struct nds32 *nds32)
static const struct reg_arch_type nds32_reg_access_type_64
int nds32_virtual_to_physical(struct target *target, target_addr_t address, target_addr_t *physical)
int nds32_gdb_fileio_write_memory(struct nds32 *nds32, uint32_t address, uint32_t size, const uint8_t *buffer)
static struct reg * nds32_reg_current(struct nds32 *nds32, unsigned regnum)
static int nds32_init_option_registers(struct nds32 *nds32)
static int nds32_step_without_watchpoint(struct nds32 *nds32)
int nds32_login(struct nds32 *nds32)
int nds32_write_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static int nds32_update_lm_info(struct nds32 *nds32)
uint32_t nds32_nextpc(struct nds32 *nds32, int current, uint32_t address)
static const int nds32_line_size_table[6]
static int nds32_reg_cache_init(struct target *target, struct nds32 *nds32)
int nds32_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
static int nds32_select_memory_mode(struct target *target, uint32_t address, uint32_t length, uint32_t *end_address)
static int nds32_get_all_reg_list(struct nds32 *nds32, struct reg **reg_list[], int *reg_list_size)
get all register list
static int nds32_update_psw(struct nds32 *nds32)
int nds32_init_arch_info(struct target *target, struct nds32 *nds32)
int nds32_init_register_table(struct nds32 *nds32)
static int nds32_check_extension(struct nds32 *nds32)
If fpu/audio is disabled, to access fpu/audio registers will cause exceptions.
int nds32_set_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t value)
set register internally
int nds32_assert_reset(struct target *target)
static const int nds32_lm_size_table[16]
static int nds32_gdb_detach(struct nds32 *nds32)
int nds32_remove_software_breakpoint(struct target *target, struct breakpoint *breakpoint)
int nds32_read_buffer(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer)
static int nds32_set_core_reg(struct reg *reg, uint8_t *buf)
int nds32_write_buffer(struct target *target, uint32_t address, uint32_t size, const uint8_t *buffer)
static int nds32_callback_event_handler(struct target *target, enum target_event event, void *priv)
int nds32_reset_halt(struct nds32 *nds32)
int nds32_init(struct nds32 *nds32)
Holds the interface to Andes cores.
#define NDS32_EDM_OPERATION_MAX_NUM
static struct nds32 * target_to_nds32(struct target *target)
Convert target handle to generic Andes target state handle.
#define NDS32_STRUCT_TIMEVAL_SIZE
@ NDS32_SYSCALL_UNDEFINED
@ NDS32_SYSCALL_GETTIMEOFDAY
#define NDS32_COMMON_MAGIC
static bool nds32_reach_max_interrupt_level(struct nds32 *nds32)
@ NDS32_DEBUG_DATA_ADDR_WATCHPOINT_PRECISE
@ NDS32_DEBUG_DATA_ADDR_WATCHPOINT_NEXT_PRECISE
@ NDS32_DEBUG_LOAD_STORE_GLOBAL_STOP
@ NDS32_DEBUG_DATA_VALUE_WATCHPOINT_PRECISE
@ NDS32_DEBUG_DATA_VALUE_WATCHPOINT_NEXT_PRECISE
@ NDS32_DEBUG_HARDWARE_SINGLE_STEP
@ NDS32_DEBUG_DATA_VALUE_WATCHPOINT_IMPRECISE
@ NDS32_DEBUG_DEBUG_INTERRUPT
static struct aice_port_s * target_to_aice(struct target *target)
#define NDS32_STRUCT_STAT_SIZE
int aice_write_reg_64(struct aice_port_s *aice, uint32_t num, uint64_t val)
int aice_program_edm(struct aice_port_s *aice, char *command_sequence)
int aice_profiling(struct aice_port_s *aice, uint32_t interval, uint32_t iteration, uint32_t reg_no, uint32_t *samples, uint32_t *num_samples)
int aice_read_reg_64(struct aice_port_s *aice, uint32_t num, uint64_t *val)
int aice_cache_ctl(struct aice_port_s *aice, uint32_t subtype, uint32_t address)
static int aice_write_debug_reg(struct aice_port_s *aice, uint32_t addr, const uint32_t val)
static int aice_set_data_endian(struct aice_port_s *aice, enum aice_target_endian target_data_endian)
static int aice_state(struct aice_port_s *aice, enum aice_target_state_s *state)
static int aice_assert_srst(struct aice_port_s *aice, enum aice_srst_type_s srst)
static int aice_run(struct aice_port_s *aice)
static int aice_halt(struct aice_port_s *aice)
static int aice_read_mem_bulk(struct aice_port_s *aice, uint32_t addr, uint32_t length, uint8_t *buffer)
static int aice_read_debug_reg(struct aice_port_s *aice, uint32_t addr, uint32_t *val)
static int aice_read_register(struct aice_port_s *aice, uint32_t num, uint32_t *val)
static int aice_step(struct aice_port_s *aice)
static int aice_write_mem_bulk(struct aice_port_s *aice, uint32_t addr, uint32_t length, const uint8_t *buffer)
static int aice_read_mem_unit(struct aice_port_s *aice, uint32_t addr, uint32_t size, uint32_t count, uint8_t *buffer)
static int aice_write_mem_unit(struct aice_port_s *aice, uint32_t addr, uint32_t size, uint32_t count, const uint8_t *buffer)
static int aice_write_register(struct aice_port_s *aice, uint32_t num, uint32_t val)
static int aice_memory_access(struct aice_port_s *aice, enum nds_memory_access a_access)
static int aice_memory_mode(struct aice_port_s *aice, enum nds_memory_select mem_select)
int nds32_evaluate_opcode(struct nds32 *nds32, uint32_t opcode, uint32_t address, struct nds32_instruction *instruction)
int nds32_read_opcode(struct nds32 *nds32, uint32_t address, uint32_t *value)
uint8_t nds32_reg_size(uint32_t number)
enum nds32_reg_type_s nds32_reg_type(uint32_t number)
void nds32_reg_init(void)
bool nds32_reg_exception(uint32_t number, uint32_t value)
const char * nds32_reg_simple_name(uint32_t number)
#define NDS32_REGISTER_DISABLE
int nds32_walk_page_table(struct nds32 *nds32, const target_addr_t virtual_address, target_addr_t *physical_address)
int nds32_probe_tlb(struct nds32 *nds32, const target_addr_t virtual_address, target_addr_t *physical_address)
struct reg * register_get_by_name(struct reg_cache *first, const char *name, bool search_all)
struct reg_cache ** register_get_last_cache_p(struct reg_cache **first)
void register_cache_invalidate(struct reg_cache *cache)
Marks the contents of the register cache as invalid (and clean).
size_t size
Size of the control block search area.
bool lock_support
cache locking support
int line_size
cache line size
int set
cache sets per way
bool enable
enable cache or not
bool performance_extension
bool performance_extension_2
bool direct_access_local_memory
EDM_CFG.DALM, indicate if direct local memory access feature is supported or not.
int breakpoint_num
The number of hardware breakpoints.
bool access_control
Support ACC_CTL register.
int version
EDM_CFG.VER, indicate the EDM version.
struct nds32_instruction::@106 info
int ilm_size
On-chip instruction local memory size.
int dlm_size
On-chip data local memory size.
enum nds_memory_access access_channel
Memory access method.
int dlm_base
On-chip data local memory base.
int dlm_start
DLM start address.
bool address_translation
Address translation.
int dlm_end
DLM end address.
int ilm_base
On-chip instruction local memory base.
struct nds32_cache dcache
DCache.
struct nds32_cache icache
ICache.
bool ilm_enable
DLM is enabled or not.
enum nds_memory_select mode
Memory access mode.
int dlm_align_ver
DLM base register alignment version.
int ilm_end
DLM end address.
int ilm_align_ver
ILM base register alignment version.
int ilm_start
DLM start address.
bool dlm_enable
DLM is enabled or not.
bool high_speed_memory_port
bool implement_dependant_register
bool implement_dependant_sr_encoding
int default_min_page_size
bool hardware_page_table_walker
bool multiple_page_size_in_use
bool fully_associative_tlb
int extra_page_size_support
int memory_protection_version
Represents a generic Andes core.
bool init_arch_info_after_halted
Flag to indicate register table is ready or not.
int virtual_hosting_errno
Value to be returned by virtual hosting SYS_ERRNO request.
struct target * target
Backpointer to the target.
bool auto_convert_hw_bp
Flag to indicate if auto convert software breakpoints to hardware breakpoints or not in ROM.
bool fpu_enable
Flag to indicate fpu-extension is enabled or not.
int privilege_level
current privilege_level if using secure MCU.
uint32_t boot_time
Period to wait after SRST.
int(* register_map)(struct nds32 *nds32, int reg_no)
Register mappings.
bool reset_halt_as_examine
reset-halt as target examine
bool keep_target_edm_ctl
backup/restore target EDM_CTL value.
bool word_access_mem
always use word-aligned address to access memory
struct nds32_memory memory
Memory information.
bool hit_syscall
Flag reporting whether continue/step hits syscall or not.
bool global_stop
Flag reporting whether global stop is active.
bool soft_reset_halt
Flag reporting whether to use soft-reset-halt or not as issuing reset-halt.
bool audio_enable
Flag to indicate audio-extension is enabled or not.
char * edm_passcode
EDM passcode for debugging secure MCU.
struct nds32_edm edm
Handle for the debug module.
bool virtual_hosting
Flag reporting whether virtual hosting is active.
struct nds32_cpu_version cpu_version
cpu version
unsigned int common_magic
uint32_t max_interrupt_level
maximum interrupt level
struct nds32_mmu_config mmu_config
MMU configuration.
enum target_endianness data_endian
Endian of data memory.
struct reg_cache * core_cache
int(* leave_debug_state)(struct nds32 *nds32, bool enable_watchpoint)
Restore target registers may be modified in debug state.
int active_syscall_id
Record syscall ID for other operations to do special processing for target.
int(* get_debug_reason)(struct nds32 *nds32, uint32_t *reason)
Get debug exception virtual address.
int(* get_watched_address)(struct nds32 *nds32, uint32_t *address, uint32_t reason)
Get address hit watchpoint.
bool virtual_hosting_ctrl_c
Flag reporting whether syscall is aborted.
struct nds32_misc_config misc_config
Misc configuration.
struct breakpoint syscall_break
bool step_isr_enable
Flag to indicate HSS steps into ISR or not.
int(* enter_debug_state)(struct nds32 *nds32, bool enable_watchpoint)
Backup target registers may be modified in debug state.
int(* get)(struct reg *reg)
int(* set)(struct reg *reg, uint8_t *buf)
struct reg_feature * feature
struct reg_data_type * reg_data_type
const struct reg_arch_type * type
int(* read_buffer)(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
int(* write_buffer)(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int(* virt2phys)(struct target *target, target_addr_t address, target_addr_t *physical)
enum target_debug_reason debug_reason
struct reg_cache * reg_cache
struct target_type * type
int target_call_event_callbacks(struct target *target, enum target_event event)
void target_free_all_working_areas(struct target *target)
const char * target_state_name(struct target *t)
Return the name of this targets current state.
int target_register_event_callback(int(*callback)(struct target *target, enum target_event event, void *priv), void *priv)
int target_halt(struct target *target)
const char * debug_reason_name(struct target *t)
int target_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
Make the target (re)start executing using its saved execution context (possibly with some modificatio...
#define ERROR_TARGET_NOT_HALTED
#define ERROR_TARGET_INVALID
@ TARGET_EVENT_GDB_ATTACH
@ TARGET_EVENT_GDB_DETACH
#define ERROR_TARGET_NOT_EXAMINED
static bool target_was_examined(struct target *target)