Commit Graph

87 Commits

Author SHA1 Message Date
45f87a1c8d prevent t bit changes without pipeline flush on arm7
idk what's happening fully and its gonna be slow to emulate most likely
we'll figure this out later
2024-09-19 21:02:54 -04:00
6ebabde392 implement changing thumb bit. and bkpt ig
probably wrong
2024-09-19 04:37:01 -04:00
c5ac682f04 improve data abort handling further 2024-09-12 18:25:54 -04:00
332a39dbaf fix JIT being borked 2024-08-05 16:14:17 -04:00
fe69cfac7d Merge remote-tracking branch 'upstream/master' into interpreter-fixes 2024-08-04 21:28:32 -04:00
dd386d12a9 use templates to only execute GDB stub related code if enabled 2024-08-05 03:23:49 +02:00
346ac1380f forgot to remove a thingy when removing timing reworks 2024-08-04 15:21:23 -04:00
ab2a8f128f revert timing tweaks, finish thumb interwork code 2024-08-04 14:54:36 -04:00
13578a3cc9 Revert "improve timings for S variants of multiply instructions on arm9"
This reverts commit 789ef21c70.
2024-07-19 17:52:28 -04:00
36f4f2c5d3 Revert "improve timings further"
This reverts commit 764ee9ea1a.
2024-07-19 17:52:26 -04:00
764ee9ea1a improve timings further 2024-07-13 09:35:12 -04:00
789ef21c70 improve timings for S variants of multiply instructions on arm9
behavior seems to be a quirk of the way they made the interlock cycle mandatory
2024-07-12 23:11:46 -04:00
038ffa3a35 revert the *entire* interlock implemention
too slow, not accurate enough.
we need to do a *lot* more research into the specifics of how this works with all the various aspects of the cpu's timings before we can make a good implementation
2024-07-11 20:08:35 -04:00
0f02c0bbba disable interlock emulation again again
our understanding of how it works is just too incomplete to be worth implementing yet
2024-07-06 12:14:35 -04:00
ea429a1b8d improve interlock emulation
add cycles to the instruction execution time rather than the timestamp directly.
2024-07-04 12:58:58 -04:00
bd1665c1d3 minor timing tweaks 2024-07-04 12:41:09 -04:00
0060958fed Merge remote-tracking branch 'upstream/master' into jump-after-writeback 2024-07-03 15:26:58 -04:00
c5b035a973 SWP and SWPB use the same behavior as STR on the ARM9 2024-06-25 11:20:01 -04:00
541e1e6388 proper timings for ldr/str 2024-06-25 09:08:11 -04:00
dbe00e72dd improve stm timings
need to verify if they apply to all store instructions
2024-06-24 22:50:04 -04:00
109bbed3d0 improve ldm timings
I believe this also applies to other loads as well, but currently untested.
2024-06-24 20:22:38 -04:00
3583d8222f disable interlock emulation, needs more research 2024-06-24 16:17:04 -04:00
debaaa0425 fix performance regression for disabling interlock emulation path 2024-06-15 21:16:12 -04:00
449557624d don't do interlocks for the arm7 2024-06-15 18:37:31 -04:00
a973c0bf5b initial implementation of interlock cycles 2024-06-15 16:07:36 -04:00
8fc403cdad update copyright headers 2024-06-15 17:01:19 +02:00
5a174a2ce3 track interlock cycles for load instructions 2024-06-14 00:51:55 -04:00
3ddccde5b9 verified
also remove no longer needed variable
2024-06-10 13:23:18 -04:00
ae0824fdd3 it all makes sense now... 2024-06-09 19:10:43 -04:00
849d4e51ac imma be real, i have no idea what is going on here 2024-06-08 22:12:44 -04:00
1871c48849 fix double data aborts with strd 2024-06-05 10:28:51 -04:00
317a8c61e5 data abort handling for (almost) all (arm) instructions
full list: strb, ldrb, strh, ldrd, strd, ldrh, ldrsb, ldrsh
2024-06-05 00:14:14 -04:00
b5c1ee33fb implement stm 2024-06-02 10:33:29 -04:00
63d4b78733 improve implementation 2024-06-02 10:13:50 -04:00
9bfc9c08ff Sprinkle const around where appropriate (#1909)
* Sprinkle `const` around where appropriate

- This will make it easier to use `NDS` objects in `const` contexts (e.g. `const` parameters or methods)

* Remove the `const` qualifier on `DSi_DSP::DSPRead16`

- MMIO reads can be non-pure, so this may not be `const` in the future
2023-12-12 11:07:22 +01:00
399a6af91c Move some constants to MemConstants.h 2023-12-08 17:19:00 +01:00
090627b3c1 Remove the last ConfigEntry state (#1902)
* Get rid of `ConfigEntry::ExternalBIOSEnable`

- Now the BIOS files themselves are checked
- The frontend's `Config::ExternalBIOSEnable` is not affected

* Add `JITArgs`

* Pass the JIT status to the `ARM` constructors

* Encapsulate `NDS::EnableJIT`

* Pass `JITArgs` to `ARMJIT`'s constructor

* Remove the `JIT_*` `ConfigEntry`s in favor of members

- Allow all the JIT args to be set with `NDS::SetJITArgs`
- Encapsulate the JIT-related parameters in `ARMJIT` so they can reset the block cache if changed
- Update the active (or newly-created) console in the frontend with adjusted JIT args

* Make audio bit depth and interpolation configurable in `NDSArgs`

- Define enums for both
- Give those settings default values in `NDSArgs`
- Remove `ConfigEntry::AudioBitDepth`
- Initialize these settings in the relevant SPU constructors

* Move the last DSi-specific logic in `Reset` to its own subclass

* Remove `ConfigEntry::DSi_FullBIOSBoot`

- Add members to `DSi` instead for getting and setting this
- Update the frontend to accommodate these changes

* Oops, missed a spot

* Remove `ConfigEntry::Firm_MAC` and `Platform::GetConfigArray`

- Also move the MAC parsing code to `ROMManager`

* Remove the last `ConfigEntry` state

- Make GDB support configurable via members

* Add some `#ifdef`s that I'd almost forgotten
2023-12-05 16:47:16 +01:00
e973236203 Refactor NDS and DSi to be objects (#1893)
* First crack at refactoring NDS and DSi into objects

- Remove all global/`static` variables in `NDS` and related classes
- Rely more on virtual dispatch when we need to pick methods at runtime
- Pass `NDS&` or `DSi&` to its constituent components where necessary
- Introduce some headers or move some definitions to break `#include` cycles

* Refactor the frontend to accommodate the core's changes

* Move up `SchedList`'s declaration

- Move it to before the components are initialized so the `map`s inside are initialized
- Fields in C++ are initialized in the order they're declared

* Fix a crash when allocating memory

* Fix JIT-free builds

* Fix GDB-free builds

* Fix Linux builds

- Explicitly qualify some member types in NDS, since they share the same name as their classes

* Remove an unnecessary template argument

- This was causing the build to fail on macOS

* Fix ARM and Android builds

* Rename `Constants.h` to `MemConstants.h`

* Add `NDS::IsRunning()`

* Use an `#include` guard instead of `#pragma once`
2023-11-28 23:16:41 +01:00
346dd4006e Move all core types into namespaces (#1886)
* Reorganize namespaces

- Most types are now moved into the `melonDS` namespace
- Only good chance to do this for a while, since a big refactor is next

* Fix the build
2023-11-25 18:32:09 +01:00
544fefa27f Refactor the JIT to be object-oriented (#1879)
* Move TinyVector to a new file

- So it's less sensitive to #include ordering

* Forgot to include assert.h

* Refactor ARMJIT_Memory into an object

* Oops, forgot a declaration

* Refactor ARMJIT to be contained in an object

* Remove an unused function declaration

* Add a missing #include

* Remove a now-unused global

* Use ARMJIT_Memory's own memory access functions

* Fix some omissions in the ARM JIT

* Move libandroid to be a member of ARMJIT_Memory instead of a global

* Default-initialize most fields in ARMJIT_Compiler.h

* Define NOOP_IF_NO_JIT

* Finish refactoring the JIT to be object-oriented
2023-11-18 16:40:54 +01:00
4558be0d8e Refactor the GPU to be object-oriented (#1873)
* Refactor GPU3D to be an object

- Who has two thumbs and is the sworn enemy of global state? This guy!

* Refactor GPU itself to be an object

- Wow, it's used in a lot of places
- Also introduce a new `Melon` namespace for a few classes
- I expect other classes will be moved into `Melon` over time

* Change signature of Renderer3D::SetRenderSettings

- Make it noexcept, and its argument const

* Remove some stray whitespace
2023-11-09 21:54:51 +01:00
ac38faef14 update copyright years 2023-11-04 00:21:46 +01:00
3ab752b8ca GDB stub (#1583)
* gdbstub beginnings

* gdbstub: finish gdb impl things, next up is integration with melonDS

* holy fuck the gdbstub works

* gdb breakpoints work, but there's a mysterious crash on continue

* fix memory corruption that sometimes happened, and make resetting the console thru gdb work

* remove some gdb debug printing

* fix things in gdbstub

* separate option for enabling gdbstub

* add mode-dependent CPU registers

* C++ize the GDBstub code

* add gdbstub config in emu settings dialog

* make sure gdb is disabled when jit is enabled

* Remove unnecessary compiler flags, mark ARMJIT assembly code as no-execute-stack

This hardens the binary a little bit against common exploitation methods

* add option to wait for debugger attach on startup

* only insert GNU stack notes on linux

* disable gdbstub enable checkbox when jit is enabled

* fix non-linux incompatibilities

* enable gdbstub by default

* fix issues with gdbstub settings disable stuff

* format stuff

* update gdb test code

* Fix segfault when calling StubCallbacks->GetCPU()

C++ overrides are hard. Please I'm just a lowly C programmer.

* fix packet size not being sent correctly

Thanks to @GlowingUmbreon on Github for troubleshooting this

* fix select(2) calls (i should read docs more properly)

* fix GDB command sequencing/parsing issue (hopefully)

* [GDB] implement no-ack mode

* fix sending ack on handshake

* get lldb to work
2023-10-22 15:35:31 +02:00
35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
6c2ea93173 get rid of DTCMSize 2021-10-29 01:35:47 +02:00
15a66b1be1 more accurate DTCM check 2021-10-28 22:41:42 +02:00
43daa1c7d2 blarg 2021-10-28 21:24:39 +02:00
e121953c9a more complete (and accurate) CP15 setup for direct boot 2021-10-28 21:15:12 +02:00
436b3c4c1d update copyright year and add missing GPL headers 2021-03-12 20:07:40 +01:00
9772201345 remove some UB
- savestates used to read a four bytes from a single byte value
- a few unassigned variables
- some other things
- also make the ROR macro an inline function
2020-09-04 20:37:14 +02:00