Skip to content

Commit

Permalink
Merge pull request #1741 from nicolasnoble/nuke-gte-registers
Browse files Browse the repository at this point in the history
Nuking all GTE on psyqo application startup.
  • Loading branch information
nicolasnoble authored Sep 19, 2024
2 parents d56d825 + 2e2658a commit 84ae758
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/mips/psyqo/src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,29 @@ SOFTWARE.

#include "psyqo/application.hh"

#include <utility>

#include "common/syscalls/syscalls.h"
#include "psyqo/alloc.h"
#include "psyqo/gte-registers.hh"
#include "psyqo/kernel.hh"
#include "psyqo/scene.hh"

template <unsigned... regs>
static inline void clearAllGTERegistersInternal(std::integer_sequence<unsigned, regs...> regSeq) {
((psyqo::GTE::clear<static_cast<psyqo::GTE::Register>(regs), psyqo::GTE::Unsafe>)(), ...);
}

static inline void clearAllGTERegisters() { clearAllGTERegistersInternal(std::make_integer_sequence<unsigned, 64>{}); }

int psyqo::Application::run() {
Kernel::fastEnterCriticalSection();
Kernel::Internal::prepare(*this);
syscall_puts("*** PSYQo Application - starting ***\n");
psyqo_free(psyqo_malloc(1));
ramsyscall_printf("Current heap start: %p\n", psyqo_heap_start());
ramsyscall_printf("Current heap end: %p\n", psyqo_heap_end());
clearAllGTERegisters();
prepare();
Kernel::fastLeaveCriticalSection();
while (true) {
Expand Down

0 comments on commit 84ae758

Please sign in to comment.