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,
const GUI::Font& nfont,
CartridgeELFStateWidget::CartridgeELFStateWidget(GuiObject* boss,
const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h,
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();
}
@ -124,6 +126,7 @@ void CartridgeELFStateWidget::initialize()
myNextTransaction = new StaticTextWidget(_boss, _font, x0, y, describeTransaction(0xffff, 0xffff, ~0ll));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeELFStateWidget::loadConfig()
{
for (uInt8 i = 0; i < 16; i++)

View File

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

View File

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

View File

@ -221,8 +221,10 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeELF::CartridgeELF(const ByteBuffer& image, size_t size, string_view md5,
const Settings& settings)
: Cartridge(settings, md5), myImageSize(size), myTransactionQueue(TRANSACTION_QUEUE_CAPACITY),
myVcsLib(myTransactionQueue)
: Cartridge(settings, md5),
myImageSize{size},
myTransactionQueue{TRANSACTION_QUEUE_CAPACITY},
myVcsLib{myTransactionQueue}
{
myImage = make_unique<uInt8[]>(size);
std::memcpy(myImage.get(), image.get(), size);
@ -236,9 +238,6 @@ CartridgeELF::CartridgeELF(const ByteBuffer& image, size_t size, string_view md5
allocationSections();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeELF::~CartridgeELF() = default;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeELF::reset()
{
@ -376,7 +375,6 @@ uInt8 CartridgeELF::overdrivePoke(uInt16 address, uInt8 value)
}
#ifdef DEBUGGER_SUPPORT
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartDebugWidget* CartridgeELF::debugWidget(
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};
}
#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)
{

View File

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

View File

@ -23,7 +23,6 @@
#include "ElfLinker.hxx"
namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
optional<ElfLinker::SegmentType> determineSegmentType(const ElfFile::Section& section)
{
switch (section.type) {
@ -42,7 +41,6 @@ namespace {
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
constexpr bool checkSegmentOverlap(uInt32 segmentBase1, uInt32 segmentSize1, uInt32 segmentBase2, uInt32 segmentSize2) {
return !(segmentBase1 + segmentSize1 <= segmentBase2 || segmentBase2 + segmentSize2 <= segmentBase1);
}
@ -51,7 +49,10 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ElfLinker::ElfLinker(uInt32 textBase, uInt32 dataBase, uInt32 rodataBase,
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)
{
// 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 hw2 = opcode >> 16;
const uInt16 hw1 = opcode;
const uInt16 hw2 = opcode >> 16;
const uInt8 s = (hw1 >> 10) & 0x01;
const uInt8 i1 = ~((hw2 >> 13) ^ s) & 0x01;
const uInt8 i2 = ~((hw2 >> 11) ^ s) & 0x01;
const uInt32 imm11 = hw2 & 0x7ff;
const uInt32 imm10 = hw1 & 0x3ff;
const uInt8 s = (hw1 >> 10) & 0x01;
const uInt8 i1 = ~((hw2 >> 13) ^ s) & 0x01;
const uInt8 i2 = ~((hw2 >> 11) ^ s) & 0x01;
const uInt32 imm11 = hw2 & 0x7ff;
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 >>= 7;
offset <<= 8;
offset >>= 7;
return offset;
return offset;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

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