SWI argument with (code pointer | flags)

Charles Ferguson gerph at gerph.org
Tue Oct 31 20:53:00 GMT 2023


On Tue, 31 Oct 2023, Dave Lambley via oslib-user wrote:

> > On 27/10/2023 22:46 BST Charles Ferguson <gerph at gerph.org> wrote:
> > 
> >  
> > On Fri, 27 Oct 2023, Dave Lambley via oslib-user wrote:
> > 
> > > Hello,
> > >  
> > > I have been working on riscose[1] and have come across an odd usage of OS_Control in some very
> > > old code. R0 is being passed with bit 31 set. I have two questions.
> > 
> > I'm not aware of any particular use of this - OS_Control is legacy and has 
> > been deprecated since RISC OS 2, AIUI. The Archimedes PRM makes no 
> > reference to the non-26bit flag state.
> > 
> > https://www.4corn.co.uk/archive/docs/Archimedes%20Programmer's%20Reference%20Manual%20-%20Volume%201-opt.pdf
> > 
> > It's entirely likely that it would have been irrelevant on 26bit systems 
> > though as that was part of the processor flags.
> > 
> > > 1) Is OSLib able to represent an argument being a code pointer being OR'd with flags? I remember
> > > there being some calls which did in 26 bit times, but cannot find today.
> > 
> > There certainly were some; but even if there were, they'll be largely 
> > unusable in any modern software. Modern being post-RISC OS 3.5 with 
> > dynamic areas.
> 
> Yes, the practical thing to do is perhaps to treat OS_Control as a 26-bit only interface and mask off the bits on entry. It's _possible_ that there's some code which reads the error handler address and makes use of the bits, but seems unlikely.

Well it can be used in the 32bit system, despite being deprecated.. but 
presumably you know what system you're running on as you're emulating it, 
so it's easy enough to switch behaviour based on that. You'd certainly 
need to do that for some other interfaces in the environment handler 
(abort handler? callback handler?), so you have that knowledge anyhow.

> > > http://www.riscos.com/support/developers/prm/progenv.html#88693
> > >  
> > > Cheers,
> > > Dave
> > >  
> > > [1] https://repo.or.cz/riscose.git
> > 
> > Seems a fair implementation.
> > 
> > RISCOS Pyromaniac implementation is:
> > 

snip

> > Which is also different from the actual implementation in RISC OS Classic, 
> > but sufficient to meet the API.
> > 
> > However, this also reminds me that I don't have any explicit tests for 
> > OS_Control or the other legacy interfaces in RISC OS Pyromaniac. I would 
> > be interested if you have any tests yourself for those interfaces?
> 
> I'm afraid not, although a set of regression testing executables would 
> be a nice thing to start building.

The public set of regression tests lives here:

https://github.com/gerph/riscos-tests/

There's only 65 binaries there.

The full set in RISC OS Pyromaniac has 240 test binaries, and 18 test 
modules, which are part of the 3309 regression tests. I'll add the 
rudimentary OS_Control test I recently wrote shortly.

-- 
Charles Justin Ferguson
[ All information, speculation, opinion or data within, or attached to,
  this email is private and confidential. Such content may not be
  disclosed to third parties, or a public forum, without explicit
  permission being granted. ]


More information about the oslib-user mailing list