Q_Liberator malaise

Anything QL Software or Programming Related.
User avatar
RalfR
QL Wafer Drive
Posts: 1140
Joined: Fri Jun 15, 2018 8:58 pm

Re: Q_Liberator malaise

Post by RalfR »

Derek_Stewart wrote: Wed Feb 05, 2025 11:00 pmIs it possible to alter the Qliberator compiler to produce the code the patch does?
Unfortunately, there seems to be a problem: If an unpatched (MC) program is started from a patched Q-Dock, i.e. Q-Dock only runs in the writethrough cache, then the started program also only runs in writethrough mode, so it seems to have "inherited" something. And no, the started program is not a Q-Dock daughter job.

Why and how is not yet known, but Wolfgang is informed.


7000 4E75
User avatar
RalfR
QL Wafer Drive
Posts: 1140
Joined: Fri Jun 15, 2018 8:58 pm

Re: Q_Liberator malaise

Post by RalfR »

An idea that occurred to me, which of course could be completely wrong:

Basically, QLib programs with Copyback cache enabled already run on the Q60. Programs that don't run (e.g. Q-Dock and Qtrans [this is just an example, as they are regurlarly used]) contain code from easyPTR. So it could be that the problem lies there. Possibly also in connection with the address registers abused by QLib. Or when QLib programs access the PE.

This is just an idea for now, it must be checked.
Last edited by RalfR on Mon Feb 17, 2025 7:14 pm, edited 1 time in total.


7000 4E75
User avatar
dilwyn
Mr QL
Posts: 3031
Joined: Wed Dec 01, 2010 10:39 pm

Re: Q_Liberator malaise

Post by dilwyn »

This is indeed true for my QLibbed programs. All mine contain toolkits of one form or another, usually DJToolkit, Display_cde, Basconfig, Easyptr and the QLiberator extensions files (Qerr, Qpipe, QLib_ext)

Display_cde is a prime suspect in this case. It has a small data area within its code used to get the results of an iop.flim call, which I'd forgotten about. Does not modify any of its own instructions, but does modify those 4 words. I suppose that doesn't help matters.

Don't know if DJToolkit modifies itself in any way - Norman?


User avatar
RalfR
QL Wafer Drive
Posts: 1140
Joined: Fri Jun 15, 2018 8:58 pm

Re: Q_Liberator malaise

Post by RalfR »

Regarding the misuse of the address registers: QLiberator misuses 3 bits of address registers (according to Wolfgang Lenerz).

This may interfere with other extensions.

Example:

Imagine you have a command, let's say:

move.l d0,(a0)

where A0 is $10000, i.e. you write the contents of register d0 to address $10000

If Qlib has now set the upper 3 bits, then the address becomes

$e0010000, and you write there.

If this value is now read out again, but without the 3 bits being set, it is possible that you will get some wrong value back...


7000 4E75
User avatar
Artificer
Over Heated PSU
Posts: 147
Joined: Fri Nov 24, 2017 8:43 am

Re: Q_Liberator malaise

Post by Artificer »

RalfR wrote :
Basically, QLib programs with Copyback cache enabled already run on the Q60. Programs that don't run (e.g. Q-Dock and Qtrans [this is just an example, as they are regurlarly used]) contain code from easyPTR. So it could be that the problem lies there. Possibly also in connection with the address registers abused by QLib. Or when QLib programs access the PE.
EasyPTR is not the key problem. Qliberated programs using QPTR suffer similar problems as easyPTR programs with copyback enabled. Your point about abuse of address registers might be a cause of the problem as QLIb error messages when programs crash do sometimes suggest the code has lost the place.
Dilwyn wrote :
Display_cde is a prime suspect in this case.
I doubt that Display_cde is the explanation as my own Qlib/QPTR compiled programs suffer the same problems with copyback and I do not use Display_cde.

Cheers


User avatar
tofro
Font of All Knowledge
Posts: 3007
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Q_Liberator malaise

Post by tofro »

dilwyn wrote: Mon Feb 17, 2025 6:10 pm
Display_cde is a prime suspect in this case. It has a small data area within its code used to get the results of an iop.flim call, which I'd forgotten about. Does not modify any of its own instructions, but does modify those 4 words. I suppose that doesn't help matters.
That's not particularly nice, but also not particularly dangerous. As long as what you write in the program area is data and never executed as code, the data in the data cache and in memory is identical and are read back correctly.

If you make the CPU read something back as an instruction that you've just written as data, what's in the instruction cache might not be identical to what's in memory (CPU thinks "He's just written data to x. I'll put that in the data cache for later use. Then "he wants to execute code at x, I happen to have that in instruction cache and save myself a read".

These cases need a cache flush. The data and instruction caches on 680x0 are completely separate and have no automatic interaction whatsoever.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
NormanDunbar
Forum Moderator
Posts: 2423
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Q_Liberator malaise

Post by NormanDunbar »

dilwyn wrote: Mon Feb 17, 2025 6:10 pm Don't know if DJToolkit modifies itself in any way - Norman?
There is no code that modifies itself in DJToolkit. My brain isn't good enough to keep track of what's going on in that sort of thing! ;)

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
Peter
Font of All Knowledge
Posts: 2391
Joined: Sat Jan 22, 2011 8:47 am

Re: Q_Liberator malaise

Post by Peter »

Lets always keep in mind that generating new code without cache flush would be just as wrong as modifying existing code without cache flush.
Anyway, my gut feeling goes more toward the abuse of the upper three address bits by now.


Post Reply