devkitPro / wut

Let's try to make a Wii U Toolchain / SDK for creating rpx/rpl.
zlib License
236 stars 52 forks source link

Use reserved bytes in OSThread structs for wut related thread specifics #323

Closed Maschell closed 1 year ago

Maschell commented 1 year ago

Open for discussion.

Recently __wut_getreent got implemented which uses OSGetThreadSpecific/OSSetThreadSpecific to store some thread specific data. This works fine for regular homebrew, but for WUPS/WUMS (Plugin/Module system) we might end up using a reent within a (Cafe OS) thread we do not control (e.g. due to function replacing/patching). In this case using/overriding the "regular" thread specifics might then result in undefined behaviour. To avoid this I propose to the use the "reserved" bytes of the OSThread struct for custom thread specifics which are exclusively reserved for wut.

Contra:

Pro:

Maschell commented 1 year ago

closed in favour of #324

fincs commented 1 year ago

Superseded by #324. The "hacky" bits will not be part of wut, instead they will be user provided through overrides.