Browse Source

Suppress -Wtype-limits warning

pull/2074/head
Andrew Waterman 11 months ago
parent
commit
e80b890ebf
  1. 3
      riscv/decode.h
  2. 5
      riscv/mmu.cc
  3. 2
      riscv/platform.h

3
riscv/decode.h

@ -245,7 +245,4 @@ private:
#define set_field(reg, mask, val) \
(((reg) & ~(std::remove_cv<decltype(reg)>::type)(mask)) | (((std::remove_cv<decltype(reg)>::type)(val) * ((mask) & ~((mask) << 1))) & (std::remove_cv<decltype(reg)>::type)(mask)))
#define DEBUG_START 0x0
#define DEBUG_END (0x1000 - 1)
#endif

5
riscv/mmu.cc

@ -6,6 +6,7 @@
#include "simif.h"
#include "processor.h"
#include "decode_macros.h"
#include "platform.h"
mmu_t::mmu_t(simif_t* sim, endianness_t endianness, processor_t* proc, reg_t cache_blocksz)
: sim(sim), proc(proc), blocksz(cache_blocksz),
@ -140,8 +141,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
static_assert(DEBUG_START == 0);
if (/* paddr >= DEBUG_START && */ paddr <= DEBUG_END && proc && !proc->state.debug_mode)
reg_t debug_start = DEBUG_START; // suppress -Wtype-limits
if (paddr >= debug_start && paddr - debug_start < DEBUG_SIZE && proc && !proc->state.debug_mode)
return false;
return true;

2
riscv/platform.h

@ -19,5 +19,7 @@
#define NS16550_INTERRUPT_ID 1
#define EXT_IO_BASE 0x40000000
#define DRAM_BASE 0x80000000
#define DEBUG_START 0x0
#define DEBUG_SIZE 0x1000
#endif

Loading…
Cancel
Save