@rjd324
Quote:
Looking through the adtools code I have seen it many times before and just never thought about it. In the code, the address of the Exec library is sought from address 0x4 - just like on classic machines.
SysBase isn't (or may not be) stored at 0x4, the zero page isn't mapped, but there is an exception handler for old m68k software returning SysBase when doing a 32 bit read from 0x4. Of course getting SysBase that way is very slow.
Accessing 0x4 in adtools is obviously a bug in the AmigaOS 4.x versions that has to be fixed, not only because it's slow and SysBase is provided as global variable by the C library startup code and available in _start() as well if you don't use a C library, but because it's completely useless.
For calling the exec.library functions you need IExec (provided by the C library startup code as well) instead of SysBase, and you must not access any of the obsolete struct ExecLibrary contents on AmigaOS 4.x either.
@Georg
Quote:
In AROS/hosted for example there is no SysBase at 0x4. Instead trying to access that address causes segfault (AROS/hosted is really just a normal linux process/program but still 99% identical to the native version).
It's the same on AmigaOS 4.x, no SysBase in 0x4, the difference is just that the "segfault handler" ("DSI" on PowerPC CPUs) returns a fake SysBase on 0x4 reads. That's for making old m68k software work, but any 32 bit read access from address 0x4 returns this SysBase, i.e. native PPC software can get it that way as well, even if it isn't required and shouldn't be used by native PPC software.
Edited by joerg on 2023/1/26 16:24:49
Edited by joerg on 2023/1/26 16:28:41
Edited by joerg on 2023/1/26 17:33:06
Edited by joerg on 2023/1/26 17:34:50