Possible 26bit CLib issue
Jon Abbott (1421) 2651 posts |
I’m not sure what the exact issue is here, but FTPc 1.56 running under RISC OS 3.11 fails to display the User choices menu with a recent Clib loaded. I’ve gone back through the CLib builds I have to hand and the problem does not occur on CLib 6.04, but does on 6.07. I do not have 6.05 or 6.06 to narrow it to the specific build. |
Rick Murray (539) 13840 posts |
6.05 – no longer messes with the M32 flag in the abort handler (as it no longer means 26/32 bit, it means 32/64 bit and, well, that’s not how it’s done ;) ). 6.05 – two changes in rlib sprite stuff for Paint (this is RISC_OSLib). 6.06 – better support of scrollwheel requests in txtar (Edit, SrcEdit…; this also is RISC_OSLib). 6.07 – various changes because MSR returns bogus values for devices that don’t support ARM32 privileged mode. Nothing there sounds particularly culpritish. I mean, I’d say the most likely would be the 6.07 stuff, except that it occurs in stubs in two places – _kernel_entrypoint and _kernel_moduleentry. Which are unlikely to make a random window vanish. |
Sprow (202) 1158 posts |
Here are 4 modules [withdrawn] to try out. As Rick says there’s not much happening around there that directly implicates menus. |
Jon Abbott (1421) 2651 posts |
Thanks Rob, the problem starts with 6.05. I don’t suspect it’s a menu issue, my initial thought was something file related – C flag corruption on OS_GBPB perhaps? Hard to tell what’s going on without the FTPc source code. Could be a hidden bug in FTPc for all I know! |
Sprow (202) 1158 posts |
I’ve been happily using FTPc 1.55 and SharedCLibrary 6.13 in a 26 bit config on a Risc PC without anything odd menus-wise. There were 4 key additions in 6.05 so I’ve built the 4 intermediates [withdrawn] to try. There’s really only 3 since one only affected header files, but might as well do all four for completeness. |
Jon Abbott (1421) 2651 posts |
I’m getting a 404 trying to download CLib2.zip |
Martin Avison (27) 1494 posts |
@Jon: I have just downloaded it ok … but the name is clibs2.zip (with an s) |
Jon Abbott (1421) 2651 posts |
Thanks, it’s 6.05c where the problem starts. |
Sprow (202) 1158 posts |
OK, going on a hunch it might be the addition of aligned memory allocation I’ve narrowed it down a bit. The odd thing was the difference between a working and non working CLib was only in the allocation which corresponds to supervisor mode Then the penny dropped: it’s a toolbox application so the menus are handled by the Menu module which does run in supervisor mode, and that reminded me of something I’d seen on my travels that something about That’s fine, except you can’t mix and match; either use your own for everything or use the C library for everything. As a quick proof of concept I’ve changed the toolbox library to use the C library for everything. Now, the resulting Menu module [withdrawn] seems happy with FTPc again. Do you see that? |
Rick Murray (539) 13840 posts |
Aha, did a lot of searching, and finally came across this in the library Blacklog. Version: 4.44 Thu 20-Feb-92 ENevill Bug fix: _kernel_RMAextend previously freed the block it had just extended by falling through to _kernel_RMAfree. So one doesn’t use realloc in module code on a 3.10 machine with the original CLib… I have a suspicion that I ran into this myself a long long time ago, but since updated versions of CLib came regularly on the cover discs, it was easily worked around. |
Jon Abbott (1421) 2651 posts |
I can confirm the revised Menu does indeed fix FTPc with the latest CLib. Is your proof of concept something you can roll into PlingSystem without impacting current RO builds? |
Sprow (202) 1158 posts |
What I couldn’t fathom is how it worked fine on a Risc PC (26 bit, same CLib, same version of FTPc) but not on RISC OS 3.10. Then I noticed some macro foo which revealed it wasn’t calling the well known ANSI functions but actually a Toolbox_Memory SWI. In turn that revealed that if a Dynamic Area call fails it falls back to the RMA and so that’s why it differs. I think all that’s needed, based on Rick’s archaeology, is to check for 4.44 and call Searching, Menu and Window are the only two bits of the toolbox affected, so they’d both get fixed as a result, and the fix would apply to all uses (not PlingSystem specific). |
Sprow (202) 1158 posts |
Aforementioned modules with proper fix applied. These should work fine regardless of CLib version and whether or not dynamic areas are available in 26 or 32 bit configs. |
Jon Abbott (1421) 2651 posts |
This problem appears to have resurfaced with Menu 0.41 from the latest PlingSystem. Rolling back to Menu 0.40 does get the FTPc User choices menu working again. |
Sprow (202) 1158 posts |
The problem hasn’t resurfaced per-se, since I never submitted the changes. If you look 1 message earlier in the thread you’re replying to you’ll see a trio of modules waiting to be tested – but nobody’s mentioned testing them or told me if they worked. |
Jon Abbott (1421) 2651 posts |
I confirmed your fix worked above:
I then assumed from your follow up message that the fix had been applied:
Would you like me to retest a patched Menu 0.41 so you can submit the change? |
Sprow (202) 1158 posts |
Ah, no, by “proper fix” I meant “fix done properly rather than hacking around at the Menu module”. 0 lines of Menu source code are changed as the root cause is in some shared memory management elsewhere. Subsequently you’ve been lured onto the rocks by the sight of a beautiful new version of Menu, but that’s actually unrelated work and purely coincidental.
For completeness I’ve rebuilt the trio of modules to test (same link) – please test those 3 together and if they look good I can submit the changes to ROOL. |
Jon Abbott (1421) 2651 posts |
They look good to me, the FTPc menu is appearing with all three installed over a PlingSystem update from a few days ago. |
Jon Abbott (1421) 2651 posts |
Spoke too soon – just spotted a new issue with the patched Menu 0.41. If you right click on a remote file and then try to bring up the sub-menu to rename it – the menu doesn’t appear. |
Sprow (202) 1158 posts |
I think that’s a new/different bug introduced in 0.41 – it also doesn’t work on RISC OS 5; the top level menu just shimmers as though being opened/closed really quickly. Let’s just change one thing at once then, here are a trio with only the memory allocation changes. |
Jon Abbott (1421) 2651 posts |
Yes, they look good to me. |