An LX module’s code and data are held in objects, the 32-bit successors of segments.
The object table lists them: for each one its size and address in memory, its flags, and
which entries of the object page table hold its pages. It is at the header’s object table
offset (0x40, from the start of the LX header), with as many entries as the
header’s object count (0x44). Objects are numbered from 1.
Object entry
Each entry is 24 bytes:
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | Virtual size | The size of the object in memory. |
| 4 | 4 | Relocation base | The address the object is linked to run at. |
| 8 | 4 | Flags | Access, residency and the 32-bit flag. |
| 12 | 4 | Page table index | Its first entry in the object page table, from 1. |
| 16 | 4 | Page table entries | How many pages it has. |
| 20 | 4 | Reserved | Zero. |
The object’s pages are entries index to index + entries − 1 of the page table; page j of the object (from 0) is loaded at the relocation base plus j × the page size.
Object flags
The bits are IBM’s, with Open Watcom’s names:
| Bit | Meaning |
|---|---|
0x0001 | Readable. |
0x0002 | Writable. |
0x0004 | Executable: the object holds code. |
0x0008 | Resource object. |
0x0010 | Discardable. |
0x0020 | Shared. |
0x0040 | Has preload pages. |
0x0080 | Has invalid pages. |
0x0700 | Residency: 0x100 has zero-filled pages, 0x200 resident, 0x300 resident and contiguous, 0x400 resident and long-lockable. |
0x1000 | 16:16 alias required. |
0x2000 | Big/default: a 32-bit object. In code, the default operand and address size is 32 bits. |
0x4000 | Conforming, for code. |
0x8000 | I/O privilege. |
The explorer disassembles executable objects (0x0004) as 32-bit code
when 0x2000 is set and as 16-bit code otherwise. A 32-bit object’s
addresses count from its relocation base; a 16-bit object’s count from 0, as offsets in
its segment. See the x86 instruction reference.
Worked example
00000154 50 3D 00 00 00 00 01 00 05 20 00 00 01 00 00 00 P=....... ......
00000164 04 00 00 00 00 00 00 00
0xC4 from its LX header| Object | Size | Base | Flags | Pages |
|---|---|---|---|---|
| 1 | 0x3D50 (15,696 bytes) | 0x00010000 | 0x2005: readable, executable, 32-bit | 1 to 4 |
The driver is a single 32-bit object, readable and executable, linked at
0x10000; four 4,096-byte pages hold its 15,696 bytes. The explorer shows its
code with addresses from 0x10000.