Pointers
SysSemRmpHdl contais the selector that points the system semaphore names RMP.
Locations
PTDA field SysSemPTDATbl is the location of the per-process semaphore table.
PTDA per-process semaphore contains byte-length enties, which are per-semaphore use counts.
The semaphore handle indexes both the per-process and global semaphore tables.
SysSemHighTable locates the table of SysSemHighTableS structures.
Other global tables are owned by os2krnl (0xffaa).
SysSemHandleStruc System Semaphore Handle Structure
┌──────────────────┬────┬────────┬────┬────────────────────────────────────────┐│Field Name │Off │Length │Type│Description │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemHighWord │+0 │2 │W │0x8000 for sys sems │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemPTDAIndex │+2 │2 │W │Index into the PTDA open sem table │ └──────────────────┴────┴────────┴────┴────────────────────────────────────────┘
SysSemTblStruc System Semaphore Table Structure
┌──────────────────┬────┬────────┬────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type│Description │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemOwner │+0 │2 │W │thread owning this semaphore │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemFlag │+2 │1 │B │system semaphore flag bit field │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemRefCnt │+3 │1 │B │number of references to this sys sem │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemProcCnt │+4 │1 │B │number of requests for this owner │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemPad │+5 │1 │B │pad byte to round structure up to word │ └──────────────────┴────┴────────┴────┴────────────────────────────────────────┘
SysSemHighTableS System Semaphore Table Extension Structure.
This is an extension of the SysSemTblStruc that is put into high memory so we don't impact the low data segment. It is only used in protected mode during process/thread termination.
┌──────────────────┬────┬────────┬────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type│Description │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemPidOwner │+0 │2 │W │pid owner, the thread owner has died │ └──────────────────┴────┴────────┴────┴────────────────────────────────────────┘
SysSemNameStruc System Semaphore Name table structure, managed by an RMP.
┌──────────────────┬────┬────────┬────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type│Description │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │SysSemPtr │+0 │2 │W │ │ └──────────────────┴────┴────────┴────┴────────────────────────────────────────┘
SysSemFlag flag field definitions:
┌────────────────────────┬────────┬──────────────────────────────────────┐ │Name │Bit Mask│Description │ ├────────────────────────┼────────┼──────────────────────────────────────┤ │SYSSEM_WAITING │0x01 │a thread is waiting on the sem │ ├────────────────────────┼────────┼──────────────────────────────────────┤ │SYSSEM_MUXWAITING │0x02 │a thread is muxwaiting on the sem │ ├────────────────────────┼────────┼──────────────────────────────────────┤ │SYSSEM_OWNER_DIED │0x04 │the process/thread owning the sem died│ ├────────────────────────┼────────┼──────────────────────────────────────┤ │SYSSEM_EXCLUSIVE │0x08 │indicates a exclusive system semaphore│ ├────────────────────────┼────────┼──────────────────────────────────────┤ │SYSSEM_NAME_CLEANUP │0x10 │name table entry needs to be removed │ ├────────────────────────┼────────┼──────────────────────────────────────┤ │SYSSEM_THREAD_OWNER_DIED│0x20 │the thread owning the sem died │ ├────────────────────────┼────────┼──────────────────────────────────────┤ │SYSSEM_EXITLIST_OWNER │0x40 │the exitlist thread owns the sem │ └────────────────────────┴────────┴──────────────────────────────────────┘