Runtime: GuestThread::stack holds a base after CreateThread but a top after SetupThread
Los mantenedores suelen responder en 5 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- cpp, reverse-engineering
- Área
- operating-systems, tooling
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C++
- Estrellas
- 3.3k
- Forks
- 149
- Merge medio
- 5 d 10 h
- PR fusionados (30 d)
- 4
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ran-j/PS2Recomp
-
VU0 macro VSQI / VSQD: address and source registers swapped in generated codePosiblemente ocupada @yanm1103 la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 5 días
-
Runtime: SampleTexture casts unbounded or NaN texture coordinates to int, which is undefined behaviourPosiblemente ocupada @luisbraganca la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ran-j/PS2Recomp#273 · 2 comentarios ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 5 días
-
Runtime: writes to D_ENABLEW (0x1000F590) are never visible at D_ENABLER (0x1000F520), hanging any game that suspends the DMACPosiblemente ocupada @luisbraganca la tomó hace 6 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
ran-j/PS2Recomp#257 · 1 comentario ·
Los mantenedores suelen responder en 5 días
Todos los issues de ran-j/PS2Recomp
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
accessibility good first issue hacktoberfest help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
OpenChemistry/avogadrolibs#3184 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Tracktion/tracktion_engine#475 ·
Los mantenedores suelen responder en 1 día
-
CB name typo in LMAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
orbiternassp/NASSP#1701 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
redis/memtier_benchmark#732 ·
Los mantenedores suelen responder en 1 día