lx_loader: treat the OS/2 null selector as a null pointer
gspac/gspcg pass 0003:0000 (selector index 0, RPL 3) as a null far pointer; lxConvert1616to32 only special-cased addr1616 == 0 and asserted on ldt[0]. Segment index 0 is the null selector by definition, so return NULL. This unblocks the TMS340 C front end (gspac), optimizer (gspopt) and code generator (gspcg) under 2ine.
This commit is contained in:
1 parent
68f873784b
commit
91b78f215d
1 file changed
+2
@@ -542,6 +542,8 @@ static void *lxConvert1616to32(const uint32 addr1616)
|
||||
|
||||
const uint16 selector = (uint16) (addr1616 >> 19); // slide segment down, and shift out control bits.
|
||||
const uint16 offset = (uint16) (addr1616 % 0x10000); // all our LDT segments start at 64k boundaries (at the moment!).
|
||||
if (selector == 0) // segment 0x0000 or 0x0003: the OS/2 null selector.
|
||||
return NULL;
|
||||
//printf("lxConvert1616to32: 0x%X -> %p\n", (uint) addr1616, (void *) (size_t) (GLoaderState.ldt[selector] + offset));
|
||||
assert(GLoaderState.ldt[selector] != 0);
|
||||
return (void *) (size_t) (GLoaderState.ldt[selector] + offset);
|
||||
|
||||
Reference in new issue
Block a user