NetSWI* macro simplification

Ian Jeffray ian at jeffray.co.uk
Thu Jan 24 01:08:03 PST 2002


John Tytgat wrote:

> The NetSWI* macros can be simplified.  See attachements.


I'm really sorry John, but I'm again going to have to voice my
'objections' to this change, too.    I've spent a lot of time
looking at this particular issue, talking to Stewart and to
folks at RISCOS Ltd, and the issue really is still present in
Internet Modules between 5.04 and 5.09 which are distributed as
standard and a lot of people use these (RISC OS 4.0x)

As a general point - the whole point of the NetSWI macro was to add
this wrapping stuff, so if we aren't doing it, let's clean up the
code "properly" and just call the SWIs directly and cleanly, rather
via this macro which will now do nothing worthwhile.

Now, I did try removing the horrible SVC wrappers around these
SWI calls myself already, and no ill effects were observed, but
I have it on STRONG recommendation from RISCOS Ltd that we keep
the stuff in place as is.

I'm told (again, I have no evidence of my own) that the real issue
here is that the internet SWIs somehow manage to return to the
caller still in SVC mode, and not that they actually require to be
put in SVC mode to call them.    (This is similar shitty behaviour
to the Internet module's issue of sometimes calling it's Event
handler with IRQs enabled!)

That's just my 2p worth, and you're welcome to take my opinion any
way you like.   Personally, I'd like to see some proper evidence
that these SWIs do manage to return in SVC mode before I really
believe it, but I don't think these wrappers are doing too much
harm, so being left in place isn't really hurting anyone too much,
although I would like to see rid of them!  (Does that make sense?)

This change could have potentially devastating effects on stuff
if it's wrong (machine goes pop ;) so could we collate all evidence
and cover ground once again before any change is committed?

Sorry :-(

Ian.

(PS: I don't think quoting a mail list message is good form in code,
and I don't have a copy of that message anyway - could you forward
it please? :)



> -       ; NetSWI macro to call a networking (tcp/ip) swi.
> -       ; We ensure that we are in SVC mode before calling the SWI because,
> -       ; according to Stewart Brodie, certain versions of Acorn's Internet
> -       ; stack require SWIs to be called in SVC mode.
> -       ;
> -       ; If ModuleCode is "yes", then nothing needs to be done, since
> -       ; it is assumed we are already in SVC mode (possibly not always true,
> -       ; so beware).
> -       ; Note, UnixLib does not define ModuleCode.
> -       ;
> -       ; ip is destroyed. lr must be saved if called in SVC mode. This
> -       ; macro is *NOT* safe for calling from IRQ or FIQ mode because
> -       ; SVC_r14 is corrupted.
> +       ; NetSWI macro to call a networking (TCP/IP) swi.
> +       ; Previous versions of 'NetSWI' & friends macros executed the
> +       ; Internet related SWIs in SVC mode.  According to Stewart Brodie
> +       ; (see mail in UnixLib mailing list with Message-ID
> +       ; <4253de394a.Jo at village.uunet.be> for full details) "ancient
> +       ; versions" of the Internet module only had one static error
> +       ; block which could get corrupted on exit when a callback is
> +       ; fired at that time which does use an Internet related SWI
> +       ; corrupting the only static error block.  Current versions of
> +       ; the Internet module have now 4 error blocks more or less
> +       ; avoiding this issue.
> +       ; So we no longer required to into SVC mode.






More information about the gcc mailing list