Runtime: GuestThread::stack holds a base after CreateThread but a top after SetupThread
I maintainer di solito rispondono entro 5 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- cpp, reverse-engineering
- Ambito
- operating-systems, tooling
Direzione di ricerca
Start in ps2xRuntime/include/runtime/ee_scheduler.h and the CreateThread, SetupThread/InitMainThread, and startThread paths that write or read GuestThread::stack. Align SetupThread so it stores a base like CreateThread (or add an explicit stackTop) so consumers can recover the stack extent without guessing from RAM size. Confirm every use of thread.stack still computes the same SP after the change.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
GuestThread::stack (ps2xRuntime/include/runtime/ee_scheduler.h) does not mean the same thing depending on how the thread was created:
CreateThreadstores the base:thread.stack = params.stack, andstartThreadcomputes the top asstack + stackSize.SetupThread/InitMainThreadstores the top: it writes thespit has just computed into the same field.
Any consumer that wants a thread's stack extent therefore cannot trust the field. This surfaced while deriving an allocation ceiling from the declared thread stacks (companion issue about invocation stacks aliasing thread stacks).
Workaround used downstream
Disambiguating on the arithmetic, since a base plus a size cannot exceed RAM:
uint32_t base = thread.stack;
if (static_cast<uint64_t>(thread.stack) + thread.stackSize > PS2_RAM_SIZE)
{
if (thread.stack < thread.stackSize) { continue; }
base = thread.stack - thread.stackSize; // it was a top
}
It works, but it is a guess recovered from a value that should not have been ambiguous.
Suggested fix
Make SetupThread record a base, as CreateThread does, and let startThread derive the top. Or, if both conventions must coexist, give GuestThread an explicit stackTop field instead of overloading one.
Found while statically recompiling Ridge Racer V (NTSC-U, SLUS_200.02) with PS2Recomp.
Tested on commit 75d729ce; main was c5a9d02 at the time of writing, one README-only commit ahead.
Host: Windows 11 x64, clang-cl 22.1.3 + Ninja, MSVC toolset 14.51.36231, Windows SDK 10.0.26100.0, CMake 4.2.3.
None of these are specific to this game.
- Lingua principale
- C++
- Stelle
- 3.3k
- Fork
- 149
- Merge medio
- 5g 10h
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ran-j/PS2Recomp
-
VU0 macro VSQI / VSQD: address and source registers swapped in generated codeForse già presa @yanm1103 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 5 giorni
-
Runtime: SampleTexture casts unbounded or NaN texture coordinates to int, which is undefined behaviourForse già presa @luisbraganca l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ran-j/PS2Recomp#273 · 2 commenti ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 5 giorni
-
Runtime: writes to D_ENABLEW (0x1000F590) are never visible at D_ENABLER (0x1000F520), hanging any game that suspends the DMACForse già presa @luisbraganca l’ha presa 5 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ran-j/PS2Recomp#257 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
Tutte le issue di ran-j/PS2Recomp
Issue simili
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
README: CI link/badge checkAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
SCIInstitute/SCIRun#2842 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
agent:Windows bug code-review LOW testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno