mirror of https://github.com/stella-emu/stella.git
More fixes for warnings from clang-tidy.
This commit is contained in:
parent
bf8648679c
commit
a4b216aac1
|
@ -30,7 +30,7 @@ class CartridgeELF: public Cartridge {
|
||||||
public:
|
public:
|
||||||
CartridgeELF(const ByteBuffer& image, size_t size, string_view md5,
|
CartridgeELF(const ByteBuffer& image, size_t size, string_view md5,
|
||||||
const Settings& settings);
|
const Settings& settings);
|
||||||
virtual ~CartridgeELF();
|
~CartridgeELF() override;
|
||||||
|
|
||||||
// Methods from Device
|
// Methods from Device
|
||||||
public:
|
public:
|
||||||
|
@ -67,11 +67,11 @@ class CartridgeELF: public Cartridge {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class BusFallbackDelegate: public CortexM0::BusTransactionDelegate {
|
class BusFallbackDelegate: public CortexM0::BusTransactionDelegate {
|
||||||
CortexM0::err_t fetch16(uInt32 address, uInt16& value, uInt8& op, CortexM0& cortex);
|
CortexM0::err_t fetch16(uInt32 address, uInt16& value, uInt8& op, CortexM0& cortex) override;
|
||||||
CortexM0::err_t read8(uInt32 address, uInt8& value, CortexM0& cortex);
|
CortexM0::err_t read8(uInt32 address, uInt8& value, CortexM0& cortex) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ExecutionStage {
|
enum class ExecutionStage: uInt8 {
|
||||||
boot, preinit, init, main
|
boot, preinit, init, main
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -125,6 +125,14 @@ class CartridgeELF: public Cartridge {
|
||||||
|
|
||||||
ExecutionStage myExecutionStage{ExecutionStage::boot};
|
ExecutionStage myExecutionStage{ExecutionStage::boot};
|
||||||
uInt32 myInitFunctionIndex{0};
|
uInt32 myInitFunctionIndex{0};
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Following constructors and assignment operators not supported
|
||||||
|
CartridgeELF(const CartridgeELF&) = delete;
|
||||||
|
CartridgeELF(CartridgeELF&&) = delete;
|
||||||
|
CartridgeELF& operator=(const CartridgeELF&) = delete;
|
||||||
|
CartridgeELF& operator=(CartridgeELF&&) = delete;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CARTRIDGE_ELF
|
#endif // CARTRIDGE_ELF
|
||||||
|
|
|
@ -32,6 +32,7 @@ class CortexM0
|
||||||
|
|
||||||
class BusTransactionDelegate {
|
class BusTransactionDelegate {
|
||||||
public:
|
public:
|
||||||
|
BusTransactionDelegate() = default;
|
||||||
virtual ~BusTransactionDelegate() = default;
|
virtual ~BusTransactionDelegate() = default;
|
||||||
|
|
||||||
virtual err_t read32(uInt32 address, uInt32& value, CortexM0& cortex);
|
virtual err_t read32(uInt32 address, uInt32& value, CortexM0& cortex);
|
||||||
|
@ -43,6 +44,13 @@ class CortexM0
|
||||||
virtual err_t write8(uInt32 address, uInt8 value, CortexM0& cortex);
|
virtual err_t write8(uInt32 address, uInt8 value, CortexM0& cortex);
|
||||||
|
|
||||||
virtual err_t fetch16(uInt32 address, uInt16& value, uInt8& op, CortexM0& cortex);
|
virtual err_t fetch16(uInt32 address, uInt16& value, uInt8& op, CortexM0& cortex);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Following constructors and assignment operators not supported
|
||||||
|
BusTransactionDelegate(const BusTransactionDelegate&) = delete;
|
||||||
|
BusTransactionDelegate(BusTransactionDelegate&&) = delete;
|
||||||
|
BusTransactionDelegate& operator=(const BusTransactionDelegate&) = delete;
|
||||||
|
BusTransactionDelegate& operator=(BusTransactionDelegate&&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr uInt32 PAGE_SIZE = 4096;
|
static constexpr uInt32 PAGE_SIZE = 4096;
|
||||||
|
@ -63,27 +71,27 @@ class CortexM0
|
||||||
static constexpr err_t ERR_SWI = 13;
|
static constexpr err_t ERR_SWI = 13;
|
||||||
static constexpr err_t ERR_UNDEFINED_INST = 14;
|
static constexpr err_t ERR_UNDEFINED_INST = 14;
|
||||||
|
|
||||||
static inline bool isErrCustom(err_t err) {
|
static constexpr bool isErrCustom(err_t err) {
|
||||||
return (err & 0xff) == 0;
|
return (err & 0xff) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uInt32 getErrCustom(err_t err) {
|
static constexpr uInt32 getErrCustom(err_t err) {
|
||||||
return (err & 0xffffffff) >> 8;
|
return (err & 0xffffffff) >> 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uInt8 getErrInstrinsic(err_t err) {
|
static constexpr uInt8 getErrInstrinsic(err_t err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uInt32 getErrExtra(err_t err) {
|
static constexpr uInt32 getErrExtra(err_t err) {
|
||||||
return err >> 32;
|
return err >> 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline err_t errCustom(uInt32 code, uInt32 extra = 0) {
|
static constexpr err_t errCustom(uInt32 code, uInt32 extra = 0) {
|
||||||
return ((static_cast<uInt64>(code) << 8) & 0xffffffff) | (static_cast<uInt64>(extra) << 32);
|
return ((static_cast<uInt64>(code) << 8) & 0xffffffff) | (static_cast<uInt64>(extra) << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline err_t errIntrinsic(uInt8 code, uInt32 extra = 0) {
|
static constexpr err_t errIntrinsic(uInt8 code, uInt32 extra = 0) {
|
||||||
return static_cast<uInt64>(code) | (static_cast<uInt64>(extra) << 32);
|
return static_cast<uInt64>(code) | (static_cast<uInt64>(extra) << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +99,7 @@ class CortexM0
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CortexM0();
|
CortexM0();
|
||||||
|
~CortexM0() = default;
|
||||||
|
|
||||||
CortexM0& mapRegionData(uInt32 pageBase, uInt32 pageCount,
|
CortexM0& mapRegionData(uInt32 pageBase, uInt32 pageCount,
|
||||||
bool readOnly, uInt8* backingStore);
|
bool readOnly, uInt8* backingStore);
|
||||||
|
@ -120,7 +129,7 @@ class CortexM0
|
||||||
err_t write16(uInt32 address, uInt16 value);
|
err_t write16(uInt32 address, uInt16 value);
|
||||||
err_t write8(uInt32 address, uInt8 value);
|
err_t write8(uInt32 address, uInt8 value);
|
||||||
|
|
||||||
inline uInt64 getCycles() const {
|
uInt64 getCycles() const {
|
||||||
return myCycleCounter;
|
return myCycleCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,12 +143,12 @@ class CortexM0
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MemoryRegionAccessData {
|
struct MemoryRegionAccessData {
|
||||||
uInt8* backingStore;
|
uInt8* backingStore{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MemoryRegionAccessCode {
|
struct MemoryRegionAccessCode {
|
||||||
uInt8* backingStore;
|
uInt8* backingStore{nullptr};
|
||||||
uInt8* ops;
|
uInt8* ops{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MemoryRegion {
|
struct MemoryRegion {
|
||||||
|
@ -152,14 +161,14 @@ class CortexM0
|
||||||
|
|
||||||
MemoryRegionType type{MemoryRegionType::unmapped};
|
MemoryRegionType type{MemoryRegionType::unmapped};
|
||||||
|
|
||||||
uInt32 base;
|
uInt32 base{0};
|
||||||
uInt32 size;
|
uInt32 size{0};
|
||||||
bool readOnly;
|
bool readOnly{false};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
MemoryRegionAccessData accessData;
|
MemoryRegionAccessData accessData;
|
||||||
MemoryRegionAccessCode accessCode;
|
MemoryRegionAccessCode accessCode;
|
||||||
BusTransactionDelegate* delegate;
|
BusTransactionDelegate* delegate{nullptr};
|
||||||
} access;
|
} access;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -195,10 +204,10 @@ class CortexM0
|
||||||
uInt64 myCycleCounter{0};
|
uInt64 myCycleCounter{0};
|
||||||
|
|
||||||
static constexpr uInt32
|
static constexpr uInt32
|
||||||
CPSR_N = 1u << 31,
|
CPSR_N = 1U << 31,
|
||||||
CPSR_Z = 1u << 30,
|
CPSR_Z = 1U << 30,
|
||||||
CPSR_C = 1u << 29,
|
CPSR_C = 1U << 29,
|
||||||
CPSR_V = 1u << 28;
|
CPSR_V = 1U << 28;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
|
@ -28,14 +28,15 @@ class BusTransactionQueue {
|
||||||
|
|
||||||
void setBusState(bool& drive, uInt8& value) const;
|
void setBusState(bool& drive, uInt8& value) const;
|
||||||
|
|
||||||
uInt16 address;
|
uInt16 address{0};
|
||||||
uInt8 value;
|
uInt8 value{0};
|
||||||
uInt64 timestamp;
|
uInt64 timestamp{0};
|
||||||
bool yield;
|
bool yield{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BusTransactionQueue(size_t capacity);
|
explicit BusTransactionQueue(size_t capacity);
|
||||||
|
~BusTransactionQueue() = default;
|
||||||
|
|
||||||
BusTransactionQueue& reset();
|
BusTransactionQueue& reset();
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class BusTransactionQueue {
|
||||||
bool hasPendingTransaction() const;
|
bool hasPendingTransaction() const;
|
||||||
Transaction* getNextTransaction(uInt16 address, uInt64 timestamp);
|
Transaction* getNextTransaction(uInt16 address, uInt64 timestamp);
|
||||||
|
|
||||||
inline size_t size() const {
|
size_t size() const {
|
||||||
return myQueueSize;
|
return myQueueSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ class BusTransactionQueue {
|
||||||
void push(const Transaction& transaction);
|
void push(const Transaction& transaction);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const size_t myQueueCapacity;
|
const size_t myQueueCapacity{0};
|
||||||
|
|
||||||
unique_ptr<Transaction[]> myQueue;
|
unique_ptr<Transaction[]> myQueue;
|
||||||
size_t myQueueNext{0};
|
size_t myQueueNext{0};
|
||||||
|
|
|
@ -120,6 +120,6 @@ namespace elfEnvironment {
|
||||||
enum class Palette: uInt8 {pal, ntsc};
|
enum class Palette: uInt8 {pal, ntsc};
|
||||||
|
|
||||||
vector<ElfLinker::ExternalSymbol> externalSymbols(Palette palette);
|
vector<ElfLinker::ExternalSymbol> externalSymbols(Palette palette);
|
||||||
}
|
} // namespace elfEnvironment
|
||||||
|
|
||||||
#endif // ELF_ENVIRONMENT
|
#endif // ELF_ENVIRONMENT
|
||||||
|
|
|
@ -23,44 +23,45 @@
|
||||||
class ElfFile {
|
class ElfFile {
|
||||||
public:
|
public:
|
||||||
struct Section {
|
struct Section {
|
||||||
uInt32 nameOffset;
|
uInt32 nameOffset{0};
|
||||||
string name;
|
string name;
|
||||||
|
|
||||||
uInt32 type;
|
uInt32 type{0};
|
||||||
uInt32 flags;
|
uInt32 flags{0};
|
||||||
|
|
||||||
uInt32 virtualAddress;
|
uInt32 virtualAddress{0};
|
||||||
uInt32 offset;
|
uInt32 offset{0};
|
||||||
uInt32 size;
|
uInt32 size{0};
|
||||||
|
|
||||||
uInt32 info;
|
uInt32 info{0};
|
||||||
uInt32 align;
|
uInt32 align{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Symbol {
|
struct Symbol {
|
||||||
uInt32 nameOffset;
|
uInt32 nameOffset{0};
|
||||||
uInt32 value;
|
uInt32 value{0};
|
||||||
uInt32 size;
|
uInt32 size{0};
|
||||||
uInt8 info;
|
uInt8 info{0};
|
||||||
uInt8 visibility;
|
uInt8 visibility{0};
|
||||||
uInt16 section;
|
uInt16 section{0};
|
||||||
|
|
||||||
string name;
|
string name;
|
||||||
uInt8 bind;
|
uInt8 bind{0};
|
||||||
uInt8 type;
|
uInt8 type{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Relocation {
|
struct Relocation {
|
||||||
uInt32 offset;
|
uInt32 offset{0};
|
||||||
uInt32 info;
|
uInt32 info{0};
|
||||||
optional<uInt32> addend;
|
optional<uInt32> addend;
|
||||||
|
|
||||||
uInt32 symbol;
|
uInt32 symbol{0};
|
||||||
uInt8 type;
|
uInt8 type{0};
|
||||||
string symbolName;
|
string symbolName;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ElfFile() = default;
|
||||||
virtual ~ElfFile() = default;
|
virtual ~ElfFile() = default;
|
||||||
|
|
||||||
virtual const uInt8 *getData() const = 0;
|
virtual const uInt8 *getData() const = 0;
|
||||||
|
@ -68,7 +69,7 @@ class ElfFile {
|
||||||
|
|
||||||
virtual const vector<Section>& getSections() const = 0;
|
virtual const vector<Section>& getSections() const = 0;
|
||||||
virtual const vector<Symbol>& getSymbols() const = 0;
|
virtual const vector<Symbol>& getSymbols() const = 0;
|
||||||
virtual const optional<vector<Relocation>> getRelocations(size_t section) const = 0;
|
virtual optional<vector<Relocation>> getRelocations(size_t section) const = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr uInt8 ENDIAN_LITTLE_ENDIAN = 0x01;
|
static constexpr uInt8 ENDIAN_LITTLE_ENDIAN = 0x01;
|
||||||
|
@ -100,6 +101,13 @@ class ElfFile {
|
||||||
static constexpr uInt32 R_ARM_TARGET1 = 0x26;
|
static constexpr uInt32 R_ARM_TARGET1 = 0x26;
|
||||||
|
|
||||||
static constexpr uInt32 STT_FUNC = 0x02;
|
static constexpr uInt32 STT_FUNC = 0x02;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Following constructors and assignment operators not supported
|
||||||
|
ElfFile(const ElfFile&) = delete;
|
||||||
|
ElfFile(ElfFile&&) = delete;
|
||||||
|
ElfFile& operator=(const ElfFile&) = delete;
|
||||||
|
ElfFile& operator=(ElfFile&&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ELF_FILE
|
#endif // ELF_FILE
|
||||||
|
|
|
@ -155,7 +155,7 @@ ElfLinker::RelocatedSymbol ElfLinker::findRelocatedSymbol(string_view name) cons
|
||||||
if (!myRelocatedSymbols[i])
|
if (!myRelocatedSymbols[i])
|
||||||
ElfSymbolResolutionError::raise("symbol could not be relocated");
|
ElfSymbolResolutionError::raise("symbol could not be relocated");
|
||||||
|
|
||||||
return *myRelocatedSymbols[i];
|
return *myRelocatedSymbols[i]; // FIXME: bugprone-unchecked-optional-access
|
||||||
}
|
}
|
||||||
|
|
||||||
ElfSymbolResolutionError::raise("symbol not found");
|
ElfSymbolResolutionError::raise("symbol not found");
|
||||||
|
@ -404,7 +404,7 @@ void ElfLinker::copyInitArrays(vector<uInt32>& initArray, const std::unordered_m
|
||||||
void ElfLinker::applyRelocationToSection(const ElfFile::Relocation& relocation, size_t iSection)
|
void ElfLinker::applyRelocationToSection(const ElfFile::Relocation& relocation, size_t iSection)
|
||||||
{
|
{
|
||||||
const auto& targetSection = myElf.getSections()[iSection];
|
const auto& targetSection = myElf.getSections()[iSection];
|
||||||
const auto& targetSectionRelocated = *myRelocatedSections[iSection];
|
const auto& targetSectionRelocated = *myRelocatedSections[iSection]; // FIXME: bugprone-unchecked-optional-access
|
||||||
const auto& symbol = myElf.getSymbols()[relocation.symbol];
|
const auto& symbol = myElf.getSymbols()[relocation.symbol];
|
||||||
const auto& relocatedSymbol = myRelocatedSymbols[relocation.symbol];
|
const auto& relocatedSymbol = myRelocatedSymbols[relocation.symbol];
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ElfLinker {
|
||||||
explicit ElfLinkError(string_view reason) : myReason(reason) {}
|
explicit ElfLinkError(string_view reason) : myReason(reason) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const string myReason;
|
string myReason;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ElfSymbolResolutionError : public std::exception {
|
class ElfSymbolResolutionError : public std::exception {
|
||||||
|
@ -54,29 +54,30 @@ class ElfLinker {
|
||||||
explicit ElfSymbolResolutionError(string_view reason) : myReason(reason) {}
|
explicit ElfSymbolResolutionError(string_view reason) : myReason(reason) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const string myReason;
|
string myReason;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SegmentType: uInt8 { text, data, rodata };
|
enum class SegmentType: uInt8 { text, data, rodata };
|
||||||
|
|
||||||
struct RelocatedSection {
|
struct RelocatedSection {
|
||||||
SegmentType segment;
|
SegmentType segment;
|
||||||
uInt32 offset;
|
uInt32 offset{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RelocatedSymbol {
|
struct RelocatedSymbol {
|
||||||
optional<SegmentType> segment;
|
optional<SegmentType> segment;
|
||||||
uInt32 value;
|
uInt32 value{0};
|
||||||
bool undefined;
|
bool undefined{true};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExternalSymbol {
|
struct ExternalSymbol {
|
||||||
string name;
|
string name;
|
||||||
uInt32 value;
|
uInt32 value{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElfLinker(uInt32 textBase, uInt32 dataBase, uInt32 rodataBase, const ElfFile& elf);
|
ElfLinker(uInt32 textBase, uInt32 dataBase, uInt32 rodataBase, const ElfFile& elf);
|
||||||
|
~ElfLinker() = default;
|
||||||
|
|
||||||
ElfLinker& setUndefinedSymbolDefault(uInt32 defaultValue);
|
ElfLinker& setUndefinedSymbolDefault(uInt32 defaultValue);
|
||||||
void link(const vector<ExternalSymbol>& externalSymbols);
|
void link(const vector<ExternalSymbol>& externalSymbols);
|
||||||
|
|
|
@ -127,7 +127,7 @@ const vector<ElfParser::Symbol>& ElfParser::getSymbols() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const optional<vector<ElfParser::Relocation>> ElfParser::getRelocations(size_t section) const
|
optional<vector<ElfParser::Relocation>> ElfParser::getRelocations(size_t section) const
|
||||||
{
|
{
|
||||||
return myRelocations.contains(section) ? myRelocations.at(section) : optional<vector<Relocation>>();
|
return myRelocations.contains(section) ? myRelocations.at(section) : optional<vector<Relocation>>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,12 @@ class ElfParser : public ElfFile {
|
||||||
explicit ElfParseError(string_view reason) : myReason(reason) {}
|
explicit ElfParseError(string_view reason) : myReason(reason) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const string myReason;
|
string myReason;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElfParser() = default;
|
ElfParser() = default;
|
||||||
|
~ElfParser() override = default;
|
||||||
|
|
||||||
void parse(const uInt8 *elfData, size_t size);
|
void parse(const uInt8 *elfData, size_t size);
|
||||||
|
|
||||||
|
@ -52,18 +53,18 @@ class ElfParser : public ElfFile {
|
||||||
|
|
||||||
const vector<Section>& getSections() const override;
|
const vector<Section>& getSections() const override;
|
||||||
const vector<Symbol>& getSymbols() const override;
|
const vector<Symbol>& getSymbols() const override;
|
||||||
const optional<vector<Relocation>> getRelocations(size_t section) const override;
|
optional<vector<Relocation>> getRelocations(size_t section) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Header {
|
struct Header {
|
||||||
uInt16 type;
|
uInt16 type{0};
|
||||||
uInt16 arch;
|
uInt16 arch{0};
|
||||||
uInt8 endianess;
|
uInt8 endianess{0};
|
||||||
uInt32 shOffset;
|
uInt32 shOffset{0};
|
||||||
|
|
||||||
uInt16 shNum;
|
uInt16 shNum{0};
|
||||||
uInt16 shSize;
|
uInt16 shSize{0};
|
||||||
uInt16 shstrIndex;
|
uInt16 shstrIndex{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -81,9 +82,9 @@ class ElfParser : public ElfFile {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const uInt8 *myData{nullptr};
|
const uInt8 *myData{nullptr};
|
||||||
size_t mySize;
|
size_t mySize{0};
|
||||||
|
|
||||||
bool myBigEndian{true};
|
bool myBigEndian{false};
|
||||||
|
|
||||||
Header myHeader;
|
Header myHeader;
|
||||||
vector<Section> mySections;
|
vector<Section> mySections;
|
||||||
|
|
|
@ -24,6 +24,6 @@ namespace elfUtil {
|
||||||
Int32 decode_B_BL(uInt32 opcode);
|
Int32 decode_B_BL(uInt32 opcode);
|
||||||
|
|
||||||
uInt32 encode_B_BL(Int32 offset, bool link);
|
uInt32 encode_B_BL(Int32 offset, bool link);
|
||||||
}
|
} // namespace elfUtil
|
||||||
|
|
||||||
#endif // ELF_UTIL
|
#endif // ELF_UTIL
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace {
|
||||||
return mySymbols;
|
return mySymbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
const optional<vector<Relocation>> getRelocations(size_t section) const override {
|
optional<vector<Relocation>> getRelocations(size_t section) const override {
|
||||||
return myRelocations.contains(section) ? myRelocations.at(section) : optional<vector<Relocation>>();
|
return myRelocations.contains(section) ? myRelocations.at(section) : optional<vector<Relocation>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,8 +107,10 @@ namespace {
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
VcsLib::VcsLib(BusTransactionQueue& transactionQueue) : myTransactionQueue(transactionQueue)
|
VcsLib::VcsLib(BusTransactionQueue& transactionQueue) : myTransactionQueue(transactionQueue)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void VcsLib::reset()
|
void VcsLib::reset()
|
||||||
{
|
{
|
||||||
myStuffMaskA = myStuffMaskX = myStuffMaskY = 0x00;
|
myStuffMaskA = myStuffMaskX = myStuffMaskY = 0x00;
|
||||||
|
@ -364,7 +366,7 @@ CortexM0::err_t VcsLib::fetch16(uInt32 address, uInt16& value, uInt8& op, Cortex
|
||||||
}
|
}
|
||||||
|
|
||||||
case ADDR_RANDINT:
|
case ADDR_RANDINT:
|
||||||
cortex.setRegister(0, rand());
|
cortex.setRegister(0, rand()); // FIXME: use C++11 random library instead
|
||||||
return returnFromStub(value, op);
|
return returnFromStub(value, op);
|
||||||
|
|
||||||
case ADDR_VCS_TXS2:
|
case ADDR_VCS_TXS2:
|
||||||
|
|
|
@ -25,17 +25,18 @@
|
||||||
class VcsLib: public CortexM0::BusTransactionDelegate {
|
class VcsLib: public CortexM0::BusTransactionDelegate {
|
||||||
public:
|
public:
|
||||||
explicit VcsLib(BusTransactionQueue& transactionQueue);
|
explicit VcsLib(BusTransactionQueue& transactionQueue);
|
||||||
|
~VcsLib() override = default;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
CortexM0::err_t fetch16(uInt32 address, uInt16& value, uInt8& op, CortexM0& cortex) override;
|
CortexM0::err_t fetch16(uInt32 address, uInt16& value, uInt8& op, CortexM0& cortex) override;
|
||||||
|
|
||||||
inline void updateBus(uInt16 address, uInt8 value) {
|
void updateBus(uInt16 address, uInt8 value) {
|
||||||
myCurrentAddress = address;
|
myCurrentAddress = address;
|
||||||
myCurrentValue = value;
|
myCurrentValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isSuspended() const {
|
bool isSuspended() const {
|
||||||
return
|
return
|
||||||
myIsWaitingForRead && (myTransactionQueue.size() > 0 || (myWaitingForReadAddress != myCurrentAddress));
|
myIsWaitingForRead && (myTransactionQueue.size() > 0 || (myWaitingForReadAddress != myCurrentAddress));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue