Browse Source

Don't say "master" (#898)

Requested by "LfX Security - Non Inclusive Language Alerts"
pull/901/head
Tim Newsome 4 years ago
committed by GitHub
parent
commit
39fc8c3921
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      riscv/debug_module.cc
  2. 2
      riscv/debug_module.h
  3. 6
      spike_main/spike.cc

28
riscv/debug_module.cc

@ -101,17 +101,17 @@ void debug_module_t::reset()
abstractauto = {0};
sbcs = {0};
if (config.max_bus_master_bits > 0) {
if (config.max_sba_data_width > 0) {
sbcs.version = 1;
sbcs.asize = sizeof(reg_t) * 8;
}
if (config.max_bus_master_bits >= 64)
if (config.max_sba_data_width >= 64)
sbcs.access64 = true;
if (config.max_bus_master_bits >= 32)
if (config.max_sba_data_width >= 32)
sbcs.access32 = true;
if (config.max_bus_master_bits >= 16)
if (config.max_sba_data_width >= 16)
sbcs.access16 = true;
if (config.max_bus_master_bits >= 8)
if (config.max_sba_data_width >= 8)
sbcs.access8 = true;
challenge = random();
@ -295,7 +295,7 @@ unsigned debug_module_t::sb_access_bits()
void debug_module_t::sb_autoincrement()
{
if (!sbcs.autoincrement || !config.max_bus_master_bits)
if (!sbcs.autoincrement || !config.max_sba_data_width)
return;
uint64_t value = sbaddress[0] + sb_access_bits() / 8;
@ -317,13 +317,13 @@ void debug_module_t::sb_read()
{
reg_t address = ((uint64_t) sbaddress[1] << 32) | sbaddress[0];
try {
if (sbcs.sbaccess == 0 && config.max_bus_master_bits >= 8) {
if (sbcs.sbaccess == 0 && config.max_sba_data_width >= 8) {
sbdata[0] = sim->debug_mmu->load_uint8(address);
} else if (sbcs.sbaccess == 1 && config.max_bus_master_bits >= 16) {
} else if (sbcs.sbaccess == 1 && config.max_sba_data_width >= 16) {
sbdata[0] = sim->debug_mmu->load_uint16(address);
} else if (sbcs.sbaccess == 2 && config.max_bus_master_bits >= 32) {
} else if (sbcs.sbaccess == 2 && config.max_sba_data_width >= 32) {
sbdata[0] = sim->debug_mmu->load_uint32(address);
} else if (sbcs.sbaccess == 3 && config.max_bus_master_bits >= 64) {
} else if (sbcs.sbaccess == 3 && config.max_sba_data_width >= 64) {
uint64_t value = sim->debug_mmu->load_uint64(address);
sbdata[0] = value;
sbdata[1] = value >> 32;
@ -339,13 +339,13 @@ void debug_module_t::sb_write()
{
reg_t address = ((uint64_t) sbaddress[1] << 32) | sbaddress[0];
D(fprintf(stderr, "sb_write() 0x%x @ 0x%lx\n", sbdata[0], address));
if (sbcs.sbaccess == 0 && config.max_bus_master_bits >= 8) {
if (sbcs.sbaccess == 0 && config.max_sba_data_width >= 8) {
sim->debug_mmu->store_uint8(address, sbdata[0]);
} else if (sbcs.sbaccess == 1 && config.max_bus_master_bits >= 16) {
} else if (sbcs.sbaccess == 1 && config.max_sba_data_width >= 16) {
sim->debug_mmu->store_uint16(address, sbdata[0]);
} else if (sbcs.sbaccess == 2 && config.max_bus_master_bits >= 32) {
} else if (sbcs.sbaccess == 2 && config.max_sba_data_width >= 32) {
sim->debug_mmu->store_uint32(address, sbdata[0]);
} else if (sbcs.sbaccess == 3 && config.max_bus_master_bits >= 64) {
} else if (sbcs.sbaccess == 3 && config.max_sba_data_width >= 64) {
sim->debug_mmu->store_uint64(address,
(((uint64_t) sbdata[1]) << 32) | sbdata[0]);
} else {

2
riscv/debug_module.h

@ -14,7 +14,7 @@ typedef struct {
// Size of program_buffer in 32-bit words, as exposed to the rest of the
// world.
unsigned progbufsize;
unsigned max_bus_master_bits;
unsigned max_sba_data_width;
bool require_authentication;
unsigned abstract_rti;
bool support_hasel;

6
spike_main/spike.cc

@ -61,7 +61,7 @@ static void help(int exit_code = 1)
fprintf(stderr, " --bootargs=<args> Provide custom bootargs for kernel [default: console=hvc0 earlycon=sbi]\n");
fprintf(stderr, " --real-time-clint Increment clint time at real-time rate\n");
fprintf(stderr, " --dm-progsize=<words> Progsize for the debug module [default 2]\n");
fprintf(stderr, " --dm-sba=<bits> Debug bus master supports up to "
fprintf(stderr, " --dm-sba=<bits> Debug system bus access supports up to "
"<bits> wide accesses [default 0]\n");
fprintf(stderr, " --dm-auth Debug module requires debugger to authenticate\n");
fprintf(stderr, " --dmi-rti=<n> Number of Run-Test/Idle cycles "
@ -243,7 +243,7 @@ int main(int argc, char** argv)
unsigned dmi_rti = 0;
debug_module_config_t dm_config = {
.progbufsize = 2,
.max_bus_master_bits = 0,
.max_sba_data_width = 0,
.require_authentication = false,
.abstract_rti = 0,
.support_hasel = true,
@ -352,7 +352,7 @@ int main(int argc, char** argv)
parser.option(0, "dm-no-impebreak", 0,
[&](const char* s){dm_config.support_impebreak = false;});
parser.option(0, "dm-sba", 1,
[&](const char* s){dm_config.max_bus_master_bits = atoul_safe(s);});
[&](const char* s){dm_config.max_sba_data_width = atoul_safe(s);});
parser.option(0, "dm-auth", 0,
[&](const char* s){dm_config.require_authentication = true;});
parser.option(0, "dmi-rti", 1,

Loading…
Cancel
Save