PrivateEye 3.20 ready for testing
David Thomas (43) 72 posts |
> Make supervisor stack inaccessible to user mode That’ll be it then. |
djp (9726) 54 posts |
Make supervisor stack inaccessible to user mode It is indeed, verified with ROM builds here. However is simply unwinding this the “right” thing to do. See the reasoning given here |
David Thomas (43) 72 posts |
It’s a positive change… but DragAnObject will need fixing along with it. |
David Thomas (43) 72 posts |
Browse crashes in the same way, ta Mr Sprow. |
Rick Murray (539) 13840 posts |
I completely agree. Keep the SVC stack locked away, and fiddle with DragAnObject so it isn’t doing naughty things… |
Stuart Swales (8827) 1357 posts |
For a quick 32-bit fix, in DragAnObject’s renderuserfunc move the LDM {R0-R3} (the called rendering function’s args) to before the SWI XOS_LeaveOS, which will preserve those regs. A 26-bit fix could just be a separate conditionally assembled branch added to this for a soft-loaded module. [Edit: the LDR PC,[R12,#4] to call the function is also problematic – see below.] Bit of an assumption that the user’s R13 is a FD stack pointer too, which it will be 99.9% of the time, but need not be. For the paranoid, user R14 could be saved in the SVC stack with STM/LDM ^ (no wb, so adjust sp_svc before/after). |
Paul Sprangers (346) 524 posts |
(As an aside:) This is such delightful Chinese for me! |
Stuart Swales (8827) 1357 posts |
Here we go:
(NB addresses are for my ARMX6, yours will differ)
Original, faulty code, is:
a) Swap these two instructions: and the to load the called procedure arguments whilst still in SVC mode
b) Replace the 26-bit-only with to load the called procedure address whilst still in SVC mode – we make no further use of R12 before restoring it, and it’s the (spare) ip register in APCS-32 (and APCS-R FWIW)
c) Replace the with
Giving ===>
Maybe someone nice will knock up a BASIC program to apply this?! |
djp (9726) 54 posts |
The patch above has been applied to the source, Titanium and RPi ROMs built, and the Effects Drag and Drop is fine. |
David Thomas (43) 72 posts |
Woohoo! |
Richard Walker (2090) 431 posts |
For anyone interested, the offending source is here: https://gitlab.riscosopen.org/RiscOS/Sources/Desktop/DragAnObj/-/blob/master/s/DragAnObj#L389 at least I think that corresponds with what Stuart has posted above. If I had my RISC OS machine up and running, I’d probably give a merge request a bash. In theory, it could be done with the WebIDE, but I don’t think ROOL would look too kindly on something unassembled/untested! |
Stuart Swales (8827) 1357 posts |
That’s the one, Richard. It’d make sense and save code to just preserve/restore R0-R12,LR/PC in all the render functions. |
Paul Sprangers (346) 524 posts |
Err… what should mediocre souls like me exactly do to get this sorted? |
Stuart Swales (8827) 1357 posts |
If you are not in a position to be able to roll-your-own ROM, I’m afraid it’s wait until a fix is rolled into the nightly build, Paul. [Edit: Or use the DragAnObject patcher in the post below.] |
Stuart Swales (8827) 1357 posts |
Here’s a patcher writ in BASIC to be going on with: (deleted) Note that it is specific to DragAnObject 0.09, which is the one included in the troublesome RISC OS 5 ROM builds. Don’t run on RISC OS 4 etc. |
Paul Sprangers (346) 524 posts |
Stuart, when I run your patch, I get the following error: |
Stuart Swales (8827) 1357 posts |
Sounds like the one in your system has assembled to be two words shorter than the one in my ARMX6, Paul. The patcher checks that all the words are as expected before modifying anything. Try just subtracting 8 from L1% thru L4% [or, as an exercise for the reader, loop L1% from &300 to &400 stopping when you first encounter L1_OLD% (the SWI XOS_LeaveOS, which only occurs once in that module). Then set L2% thru L4% to be L1%8, L1%4 and L1%+20 (not 16) respectively. NB these are DECIMAL offsets.] |
Paul Sprangers (346) 524 posts |
Is that &8? So, should I type EDIT: Forget that, I just can’t calculate – not even in decimal. EDIT2: Well, even with the right subtractions, I get an error. Besides that, I’ve no idea what I’m doing. |
Stuart Swales (8827) 1357 posts |
L1% = &340-8 etc. :-) You have BASIC on your side, even if the bits are glowing dim. There are four locations to patch. Each must already contain the correct instruction, as in L1_OLD% etc. before they are patchable. Note that it doesn’t check to see if it’s patched already, just that those words are in the expected order. If you have already patched it, the patcher will fail. |
djp (9726) 54 posts |
Oh dear!! Stuart’s first patch runs here on a Titanium with out error. *FX0 RISC OS 5.29 (30 Oct 2022) *RMFaster DragAnObject *ADFS::Titan4.$._Temp.PEye-patch.PatchDragAnObject009 * A cheeky There is just one tiny little snag, PrivateEye’s Effects still explodes. A source code patched ROM is just fine. Similartly on the RPi400, the patch applies but to no effect. |
Stuart Swales (8827) 1357 posts |
That’s because Stuart is a cretin (and why I invited someone else to do this…). Thanks. Please try the updated updated one: https://croftnuisk.co.uk/coltsoft-downloads/other/PatchDragAnObject009-revC.zip |
djp (9726) 54 posts |
revC works, tried on both the RPi400 and Titanium. |
Stuart Swales (8827) 1357 posts |
Thanks for testing :-) |
Steve Pampling (1551) 8170 posts |
You’re a rebaked french bread product? |
Clive Semmens (2335) 3276 posts |
I always thought “cretin” was from Latin, and meant “a Christian”… Is fench bread made in Fance? |