[Oberon] PO: Illegal memory access in GC

Michael Schierl schierlm at gmx.de
Fri May 15 11:08:04 CEST 2020


Hello Hellwig,


Am 15.05.2020 um 10:42 schrieb Hellwig Geisse:
> Hi all,
>
> I'm running Project Oberon (current version) on my
> own simulator for the RISC-5 processor. Yesterday
> I wanted to try Andreas Pirklbauer's Extended Oberon
> (btw, excellent explanations - thanks for that),
> but I ran into the very same error as I did when
> bringing up the original Project Oberon:
> "Reading from unknown I/O device 15", which was
> triggered by a read access to location -4.
> My simulator does monitor all memory accesses for
> correctness (out-of-bounds, alignment), which I
> suspect Peter De Wachter's simulator does not.

His emulator does not check any alignment or out-of-range accesses, just
like the real thing. (In case you ever try any of the modules on Tomas
Kral's GitHub, you will probably need to fix a few alignment errors in
the code, mostly unaligned SYSTEM.GET integer access).

I added alignment checks and out-of-range memory checks (in case you use
more than 1MB address space) to my emulators, but for IO read I still
implemented the original solution which returns 0 for nonpresent IO
devices. And I also used this for probing features in emulators. But I
never thought of actually checking if there are any illegal accesses to
those IO ports.

Nevertheless,

> The reason for the illegal memory read lies within
> the garbage collector in module Kernel.Mod:
>
> WHILE pvadr # 0 DO
>   SYSTEM.GET(pvadr, p); SYSTEM.GET(p-4, offadr);
>   IF (p >= heapOrg) & (offadr = 0) THEN ...
>
> If after the first GET the pointer p is 0 (NIL),
> the second GET at p-4 becomes an access to memory
> location -4.

this should of course be fixed, since it may interfere with whatever
device will use location -4 in the future.


Regards,


Michael


More information about the Oberon mailing list