question about role of modules in riscos
Steve Pampling (1551) 8170 posts |
Sorry posted quickly before a meal. The document you did with the shorter header (without the messages and flag references) was obviously based on the documentation on the riscos.com site. Unfortunately that version is not fully 32 bit safe and various elements don’t work on modern hardware. |
Steve Pampling (1551) 8170 posts |
That’s the doc that Rick referenced earlier, which he said he hadn’t got round to finishing. |
Steve Pampling (1551) 8170 posts |
Rick, I thought RMTidy did nothing these days. PS. Twiddled with your table a bit. |
Rick Murray (539) 13840 posts |
I think that has been true for a while, but I’ve not looked at the module handler code. Once I know I’ll update accordingly…unless somebody beats me to it. ;-) The hard part in writing the docs is sourcing information in the first place. But, of course, if that was easy then they’d be no need for the docs to be written and…look I’m tired I’ll be embarrassed by such a lame sentence tomorrow I’m only staying up to take medicine at 8 hour intervals which is real soon now good night |
Steve Pampling (1551) 8170 posts |
Good morning (when you read this)
I borrowed the basis of the 32 bit flag info from the old Iyonix pages1. :) 1 Might “rescue” some other bits from there too. |
Jon Abbott (1421) 2651 posts |
Thanks, rev.2 of the manual may well cover APCS-A / M if rev.3 was revised for RO2 – that’s when it all changed to the current model. I began this: https://www.riscosopen.org/wiki/documentation/show/File%20formats:%20Relocatable%20Module Looks good so far. I agree about cross-referencing with the OS source, in the few areas I’ve looked at there were a few gotcha – such as register preservation/corruption that weren’t documented in the PRM. There’s also flag corruption to consider where it’s applicable.
I wouldn’t get too hung up on stiffing machines writing Modules – there’s far easier ways to stiff the machine. If you’re programming at this level it implies some sort of competence, otherwise you wouldn’t attempt it in the first place. Rick’s point about documentation is sound though, I didn’t read it as elitist – we should have full documentation for 26bit and 32bit that you can refer too. It’s all work in progress though, the Wiki will eventually be at the level we require as the community update it. We don’t want to end up in the APCS-A/M scenario where all documentation has been lost – it may seem irrelevant as it’s legacy/deprecated etc – but if you’re in the situation I am, where you’re trying to get them working on RISCOS 5 – you’re kind of limited if there’s nothing to refer too. The process I use to update the Wiki is essentially to cover RO3 and above:
Where there’s notable changes between RISCOS 5 and previous versions, I’ll note it in the Notes section. It’s very time consuming and I try to do it in parallel with programming additions to ADFFS so I can double-check the behaviour in actual code. |
G0ST (2668) 79 posts |
Anyway with the thing i’m cooking, documentation for writing modules will be useless :D |
Rick Murray (539) 13840 posts |
Yup, I noticed that. I have reworded the text slightly; to make the bitfield entry (singular! ;-) ) a table, and to remove all references to this being the “new” way of doing this. This isn’t new, this is correct for RISC OS 5. The other way is “old” (or “legacy”, “vintage”, “mesolithic”, etc). I have also removed the note regarding RMTidy as that hasn’t been used since “Medusa”. I don’t remember the project names – RiscPC? https://www.riscosopen.org/viewer/view/castle/RiscOS/Sources/Kernel/s/ModHand?rev=4.11.2.13#l753 Just been checking the Init call. (SWI dispatch) → Module_Load → Load_Module → LinkAndInit → Add(Intrinsic)Incarnation → CallInit. Phew! As Jon says, copy-pasting existing documentation is easy. Verifying that it is correct is quite a bit more involved. |
Steve Pampling (1551) 8170 posts |
:P
I think Castle were working on the basis that other flag words could follow, although which side of the end of the next century we are likely to use all the other 31 bits I’m not sure.
Hmm, yes, the change pre-dates RO6 which doesn’t do it. That’s old. Perhaps the document should be referencing the old, deprecated way, and emphasising that properly coded a module works on both so the old is just wrong.
I believe so. I think the reference is to multiple processors (multiple headed beast) and the Acorn boys liked Romano-Greek mythology.
There was a reason I didn’t pull lots of other stuff in to fill the gaps. |
Rick Murray (539) 13840 posts |
Didn’t Justin have an idea regarding module priorities or something? I wonder if another bit will be pressed into service when multicore is supported and modules can say “we’re aware of this”? ;-)
I’m going to completely ignore RISC OS 6 until I have worked out a sensible way to explain the bizarre numbering scheme to newbies. Actually, I tend to just refer to this branch as RISC OS 5. We might need to increment if we run out of version numbers, but given we’re still in the low ‘20s, I don’t think it’ll be me updating the documentation regarding this.
The old isn’t wrong, it is just old. Kind of like how I dipped my fingers into mercury and pinged it around the table in chemistry. I enjoy telling that to modern younger teachers who look like they’d have a heart attack – especially if they around around 5 years or more younger than me so likely never will have touched the stuff. In light of modern information, it was wrong. But back then it was “normal”. Kind of like writing modules on a 26 bit only system would not have even had a need for a 32 bit flag. ;-)
So, hand up who was responsible for the TaskWindow message naming!
Didn’t feel like correlating information from the PRMs and the actual source? Well, I don’t blame you…
Huh? It doesn’t check it at all. It simply checks that the 32 bit word is there. If it is, the result will be loaded and executed – even if it immediately blows up… You cannot even hook to Service_ModulePreInit to scan through the module (R0=address, R2=length) and reject the module if it contained non 32 bit safe code. Why? Because the module loader doesn’t bother to check to see if the service call was claimed (https://www.riscosopen.org/viewer/view/castle/RiscOS/Sources/Kernel/s/ModHand?rev=4.11.2.13#l2096). Bad! Bad! Bad! So such a check would need to patch all of the module header words to be zero, then set up a callback to issue an RMKill on it. That’s such a horrid hack. :-( |
Stephen Unwin (1516) 154 posts |
Sorry if slightly off topic, but reply to Ricks’ reset switch thingy. |
Steve Pampling (1551) 8170 posts |
RO4.39 :)
Like I said the other week, you can hack a 32 bit header onto any old module. Until you try and do something with it like shut it down or access a feature it sits quietly and you’re OK, mostly, -ish.
Must be some checking going on according to the PRM1 modules chapter: (module header format info) “All code entries must be word aligned and inside the module code area, otherwise the checking performed by RISC OS will consider it invalid.” 1 On line at riscos.com or in the DDE documents, take your pick |
Rick Murray (539) 13840 posts |
I’m going to completely ignore RISC OS 6 That pretty much makes the point for me. ;-)
As you will see from my other post, RISC OS performs some basic validation on the addresses given in the header to ensure that nothing crazy happens when RISC OS attempts to jump to the address provided. |
Steve Pampling (1551) 8170 posts |
Yeah, read that after. That’s after this thread and after organising the content of food bowls for three furries.
As per the bug report it really ought to do a proper job of reporting where it found the error in the header. 1 Looking to master the art of understatement here. |
Jon Abbott (1421) 2651 posts |
Even if that’s fixed, you can’t use the service call on a 32bit OS as its called after the 32bit check It would be useful it’s original purpose of patching Modules was re-instated, irrespective of the Modules being 26bit or 32bit. The patching Module can perform the 32bit check and reject if it doesn’t support 26bit Modules. |
Rick Murray (539) 13840 posts |
Small update – I’ve documented all of the “easy” stuff. Now have the more complicated entry points to deal with. ;-) https://www.riscosopen.org/wiki/documentation/show/File%20formats:%20Relocatable%20Module |