Browse Source

Suppress always-true comparison warnings (-Wextra)

pull/1963/head
Andrew Waterman 1 year ago
parent
commit
417b778955
  1. 6
      riscv/clint.cc
  2. 3
      riscv/mmu.cc
  3. 6
      riscv/plic.cc

6
riscv/clint.cc

@ -39,7 +39,8 @@ bool clint_t::load(reg_t addr, size_t len, uint8_t* bytes)
tick(0);
if (addr >= MSIP_BASE && addr < MTIMECMP_BASE) {
static_assert(MSIP_BASE == 0);
if (/* addr >= MSIP_BASE && */ addr < MTIMECMP_BASE) {
if (len == 8) {
// Implement double-word loads as a pair of word loads
return load(addr, 4, bytes) && load(addr + 4, 4, bytes + 4);
@ -68,7 +69,8 @@ bool clint_t::store(reg_t addr, size_t len, const uint8_t* bytes)
if (len > 8)
return false;
if (addr >= MSIP_BASE && addr < MTIMECMP_BASE) {
static_assert(MSIP_BASE == 0);
if (/* addr >= MSIP_BASE && */ addr < MTIMECMP_BASE) {
if (len == 8) {
// Implement double-word stores as a pair of word stores
return store(addr, 4, bytes) && store(addr + 4, 4, bytes + 4);

3
riscv/mmu.cc

@ -123,7 +123,8 @@ reg_t reg_from_bytes(size_t len, const uint8_t* bytes)
bool mmu_t::mmio_ok(reg_t paddr, access_type UNUSED type)
{
// Disallow access to debug region when not in debug mode
if (paddr >= DEBUG_START && paddr <= DEBUG_END && proc && !proc->state.debug_mode)
static_assert(DEBUG_START == 0);
if (/* paddr >= DEBUG_START && */ paddr <= DEBUG_END && proc && !proc->state.debug_mode)
return false;
return true;

6
riscv/plic.cc

@ -343,7 +343,8 @@ bool plic_t::load(reg_t addr, size_t len, uint8_t* bytes)
return false;
}
if (PRIORITY_BASE <= addr && addr < PENDING_BASE) {
static_assert(PRIORITY_BASE == 0);
if (/* PRIORITY_BASE <= addr && */ addr < PENDING_BASE) {
ret = priority_read(addr, &val);
} else if (PENDING_BASE <= addr && addr < ENABLE_BASE) {
ret = pending_read(addr - PENDING_BASE, &val);
@ -384,7 +385,8 @@ bool plic_t::store(reg_t addr, size_t len, const uint8_t* bytes)
write_little_endian_reg(&val, addr, len, bytes);
if (PRIORITY_BASE <= addr && addr < ENABLE_BASE) {
static_assert(PRIORITY_BASE == 0);
if (/* PRIORITY_BASE <= addr && */ addr < ENABLE_BASE) {
ret = priority_write(addr, val);
} else if (ENABLE_BASE <= addr && addr < CONTEXT_BASE) {
uint32_t cntx = (addr - ENABLE_BASE) / ENABLE_PER_HART;

Loading…
Cancel
Save