🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.acorn.tech
Article #573

Re: Getting 3rd Party Filing Systems To Use Showfree

#573
From: Brian Brunswick
Date: Fri, 20 Nov 1992 23:14
43 lines
2768 bytes
In article <20250@acorn.co.uk> RMokady@acorn.co.uk (Ran Mokady) writes:
( Quoting Owen smith at start0
>>
>>Actually using this is a bit tricky. Brian Brunswick has working code which
>>uses this in Memphis (possibly not the released version). The biggest
>>problem is that when the FreeSpace module calls your handler routine, you
>>are in User mode and R13 points to the FreeSpace module's private stack in
>>it's workspace. This is of zero gauranteed depth ie. you can't use it, so
>>you have no stack (unless you want to over-write random bits of RMA). So you
>>need to supply your own stack, or not use any stack, or call SWI OS_EnterOS
>>to get the SVC stack. You can ease the problem by doing as little work
>>yourself as possible eg. call SWI OS_FSControl 49 (get free space) to do all
>>the work for you for free space reason code 2 (the other option for IDEFS
>>is to call IDEFS_DescribeDisc).
>>
>
> This is not quite as bad as you try and present it ...
>
> By the same token, you are never guaranteed that there is any free space on
>the SVC stack, and so should check every time before you push a register.
>
> The routines are called in USR mode, WITH SUFFICIENT STACK SPACE !
>
...
> In fact, from having a second look at the code, for some of the reason
>codes you may be called in SVC mode, so don't go round allocating a stack
>and making R13 point to it, or you may end up corrupting the SVC stack
>pointer!


It wouldn't have been so bad if I hadn't been writing in C with cmhg
style headers on the entrance, that fix up the stack chunks for you.
I was mystified as to why my routines kept reporting out of memory
errors for allocating from the rma... until I found out the the stack
pointer that I was being passed was in the RMA, so that the stub
routine ahppily put the C relocation offsets over the beginning of the
RMA area, corrupting its heap, so allocation failed. Of course, when I
returned an error the exit routine UNcorrupted them again...
Eventually I wrote some m/c stubs that used FSControl freespace,
and settled for implementing the fscontrol properly in call my fses.

--
Brian.Brunswick@cl.cam.ac.uk  Disclaimer.  Short sig rules!
Technical Details
Message-ID: <1992Nov20.231423.21354@infodev.cam.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!pavo.csi.cam.ac.uk!bdb
References: <ARM200-921118163118-7952E65F*@MHS> <20250@acorn.co.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.acorn.tech
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!pavo.csi.cam.ac.uk!bdb
From: bdb@cl.cam.ac.uk (Brian Brunswick)
Subject: Re: Getting 3rd Party Filing Systems To Use Showfree
Message-ID: <1992Nov20.231423.21354@infodev.cam.ac.uk>
Sender: news@infodev.cam.ac.uk (USENET news)
Nntp-Posting-Host: ely.cl.cam.ac.uk
Reply-To: Brian.Brunswick@cl.cam.ac.uk (Brian Brunswick)
Organization: U of Cambridge Comp Lab, UK
References: <ARM200-921118163118-7952E65F*@MHS> <20250@acorn.co.uk>
Date: Fri, 20 Nov 1992 23:14:23 GMT
Lines: 43