Fix Unix build; minor formatting fixes.

This commit is contained in:
Stephen Anthony 2024-08-27 21:34:13 -02:30
parent 4026ca4c80
commit 628c6fb370
8 changed files with 42 additions and 47 deletions

View File

@ -66,11 +66,13 @@ namespace {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeELFStateWidget::CartridgeELFStateWidget(GuiObject* boss, const GUI::Font& lfont, CartridgeELFStateWidget::CartridgeELFStateWidget(GuiObject* boss,
const GUI::Font& nfont, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, int x, int y, int w, int h,
CartridgeELF& cart) CartridgeELF& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart), myFlagValues(4) : CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart{cart},
myFlagValues(4)
{ {
initialize(); initialize();
} }
@ -124,6 +126,7 @@ void CartridgeELFStateWidget::initialize()
myNextTransaction = new StaticTextWidget(_boss, _font, x0, y, describeTransaction(0xffff, 0xffff, ~0ll)); myNextTransaction = new StaticTextWidget(_boss, _font, x0, y, describeTransaction(0xffff, 0xffff, ~0ll));
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeELFStateWidget::loadConfig() void CartridgeELFStateWidget::loadConfig()
{ {
for (uInt8 i = 0; i < 16; i++) for (uInt8 i = 0; i < 16; i++)

View File

@ -32,11 +32,12 @@ namespace {
} // namespace } // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeELFWidget::CartridgeELFWidget(GuiObject* boss, const GUI::Font& lfont, CartridgeELFWidget::CartridgeELFWidget(GuiObject* boss,
const GUI::Font& nfont, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, int x, int y, int w, int h,
CartridgeELF& cart) CartridgeELF& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h), myCart(cart) : CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart{cart}
{ {
initialize(); initialize();
} }

View File

@ -32,6 +32,8 @@ MODULE_OBJS := \
src/debugger/gui/CartDPCPlusWidget.o \ src/debugger/gui/CartDPCPlusWidget.o \
src/debugger/gui/CartDPCWidget.o \ src/debugger/gui/CartDPCWidget.o \
src/debugger/gui/CartE0Widget.o \ src/debugger/gui/CartE0Widget.o \
src/debugger/gui/CartELFStateWidget.o \
src/debugger/gui/CartELFWidget.o \
src/debugger/gui/CartEnhancedWidget.o \ src/debugger/gui/CartEnhancedWidget.o \
src/debugger/gui/CartE7Widget.o \ src/debugger/gui/CartE7Widget.o \
src/debugger/gui/CartEFSCWidget.o \ src/debugger/gui/CartEFSCWidget.o \
@ -48,8 +50,6 @@ MODULE_OBJS := \
src/debugger/gui/CartFCWidget.o \ src/debugger/gui/CartFCWidget.o \
src/debugger/gui/CartFEWidget.o \ src/debugger/gui/CartFEWidget.o \
src/debugger/gui/CartGLWidget.o \ src/debugger/gui/CartGLWidget.o \
src/debugger/gui/CartELFWidget.o \
src/debugger/gui/CartELFStateWidget.o \
src/debugger/gui/CartJANEWidget.o \ src/debugger/gui/CartJANEWidget.o \
src/debugger/gui/CartMDMWidget.o \ src/debugger/gui/CartMDMWidget.o \
src/debugger/gui/CartRamWidget.o \ src/debugger/gui/CartRamWidget.o \

View File

@ -221,8 +221,10 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeELF::CartridgeELF(const ByteBuffer& image, size_t size, string_view md5, CartridgeELF::CartridgeELF(const ByteBuffer& image, size_t size, string_view md5,
const Settings& settings) const Settings& settings)
: Cartridge(settings, md5), myImageSize(size), myTransactionQueue(TRANSACTION_QUEUE_CAPACITY), : Cartridge(settings, md5),
myVcsLib(myTransactionQueue) myImageSize{size},
myTransactionQueue{TRANSACTION_QUEUE_CAPACITY},
myVcsLib{myTransactionQueue}
{ {
myImage = make_unique<uInt8[]>(size); myImage = make_unique<uInt8[]>(size);
std::memcpy(myImage.get(), image.get(), size); std::memcpy(myImage.get(), image.get(), size);
@ -236,9 +238,6 @@ CartridgeELF::CartridgeELF(const ByteBuffer& image, size_t size, string_view md5
allocationSections(); allocationSections();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeELF::~CartridgeELF() = default;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeELF::reset() void CartridgeELF::reset()
{ {
@ -376,7 +375,6 @@ uInt8 CartridgeELF::overdrivePoke(uInt16 address, uInt8 value)
} }
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartDebugWidget* CartridgeELF::debugWidget( CartDebugWidget* CartridgeELF::debugWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, int x, int y, int w, int h GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, int x, int y, int w, int h
@ -425,21 +423,8 @@ std::pair<unique_ptr<uInt8[]>, size_t> CartridgeELF::getArmImage() const
return {std::move(image), imageSize}; return {std::move(image), imageSize};
} }
#endif #endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline uInt64 CartridgeELF::getArmCycles() const
{
return myCortexEmu.getCycles() + myArmCyclesOffset;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt64 CartridgeELF::getVcsCyclesArm() const
{
return mySystem->cycles() * myArmCyclesPer6502Cycle;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline uInt8 CartridgeELF::driveBus(uInt16 address, uInt8 value) inline uInt8 CartridgeELF::driveBus(uInt16 address, uInt8 value)
{ {

View File

@ -25,6 +25,7 @@
#include "ElfParser.hxx" #include "ElfParser.hxx"
#include "BusTransactionQueue.hxx" #include "BusTransactionQueue.hxx"
#include "VcsLib.hxx" #include "VcsLib.hxx"
#include "System.hxx"
class ElfLinker; class ElfLinker;
@ -47,7 +48,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);
~CartridgeELF() override; ~CartridgeELF() override = default;
// Methods from Device // Methods from Device
public: public:
@ -127,8 +128,12 @@ class CartridgeELF: public Cartridge {
void setupConfig(); void setupConfig();
void resetWithConfig(); void resetWithConfig();
uInt64 getArmCycles() const; uInt64 getArmCycles() const {
uInt64 getVcsCyclesArm() const; return myCortexEmu.getCycles() + myArmCyclesOffset;
}
uInt64 getVcsCyclesArm() const {
return mySystem->cycles() * myArmCyclesPer6502Cycle;
}
uInt8 driveBus(uInt16 address, uInt8 value); uInt8 driveBus(uInt16 address, uInt8 value);
void syncArmTime(uInt64 armCycles); void syncArmTime(uInt64 armCycles);

View File

@ -23,7 +23,6 @@
#include "ElfLinker.hxx" #include "ElfLinker.hxx"
namespace { namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
optional<ElfLinker::SegmentType> determineSegmentType(const ElfFile::Section& section) optional<ElfLinker::SegmentType> determineSegmentType(const ElfFile::Section& section)
{ {
switch (section.type) { switch (section.type) {
@ -42,7 +41,6 @@ namespace {
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
constexpr bool checkSegmentOverlap(uInt32 segmentBase1, uInt32 segmentSize1, uInt32 segmentBase2, uInt32 segmentSize2) { constexpr bool checkSegmentOverlap(uInt32 segmentBase1, uInt32 segmentSize1, uInt32 segmentBase2, uInt32 segmentSize2) {
return !(segmentBase1 + segmentSize1 <= segmentBase2 || segmentBase2 + segmentSize2 <= segmentBase1); return !(segmentBase1 + segmentSize1 <= segmentBase2 || segmentBase2 + segmentSize2 <= segmentBase1);
} }
@ -51,7 +49,10 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ElfLinker::ElfLinker(uInt32 textBase, uInt32 dataBase, uInt32 rodataBase, ElfLinker::ElfLinker(uInt32 textBase, uInt32 dataBase, uInt32 rodataBase,
const ElfFile& elf) const ElfFile& elf)
: myTextBase{textBase}, myDataBase{dataBase}, myRodataBase{rodataBase}, myElf{elf} : myTextBase{textBase},
myDataBase{dataBase},
myRodataBase{rodataBase},
myElf{elf}
{ {
} }

View File

@ -20,23 +20,23 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int32 elfUtil::decode_B_BL(uInt32 opcode) Int32 elfUtil::decode_B_BL(uInt32 opcode)
{ {
// nomenclature follows Thumb32 BL / B.W encoding in Arm Architecture Reference // nomenclature follows Thumb32 BL / B.W encoding in Arm Architecture Reference
const uInt16 hw1 = opcode; const uInt16 hw1 = opcode;
const uInt16 hw2 = opcode >> 16; const uInt16 hw2 = opcode >> 16;
const uInt8 s = (hw1 >> 10) & 0x01; const uInt8 s = (hw1 >> 10) & 0x01;
const uInt8 i1 = ~((hw2 >> 13) ^ s) & 0x01; const uInt8 i1 = ~((hw2 >> 13) ^ s) & 0x01;
const uInt8 i2 = ~((hw2 >> 11) ^ s) & 0x01; const uInt8 i2 = ~((hw2 >> 11) ^ s) & 0x01;
const uInt32 imm11 = hw2 & 0x7ff; const uInt32 imm11 = hw2 & 0x7ff;
const uInt32 imm10 = hw1 & 0x3ff; const uInt32 imm10 = hw1 & 0x3ff;
Int32 offset = imm11 | (imm10 << 11) | (i2 << 21) | (i1 << 22) | (s << 23); Int32 offset = imm11 | (imm10 << 11) | (i2 << 21) | (i1 << 22) | (s << 23);
offset <<= 8; offset <<= 8;
offset >>= 7; offset >>= 7;
return offset; return offset;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -36,6 +36,7 @@ MODULE_OBJS := \
src/emucore/CartBFSC.o \ src/emucore/CartBFSC.o \
src/emucore/CartDF.o \ src/emucore/CartDF.o \
src/emucore/CartDFSC.o \ src/emucore/CartDFSC.o \
src/emucore/CartELF.o \
src/emucore/CartF0.o \ src/emucore/CartF0.o \
src/emucore/CartF4.o \ src/emucore/CartF4.o \
src/emucore/CartF4SC.o \ src/emucore/CartF4SC.o \
@ -55,9 +56,8 @@ MODULE_OBJS := \
src/emucore/CartTVBoy.o \ src/emucore/CartTVBoy.o \
src/emucore/CartUA.o \ src/emucore/CartUA.o \
src/emucore/CartWD.o \ src/emucore/CartWD.o \
src/emucore/CartWF8.o \ src/emucore/CartWF8.o \
src/emucore/CartX07.o \ src/emucore/CartX07.o \
src/emucore/CartELF.o \
src/emucore/CompuMate.o \ src/emucore/CompuMate.o \
src/emucore/Console.o \ src/emucore/Console.o \
src/emucore/Control.o \ src/emucore/Control.o \