Re: [cc65] signals

From: dominic beesley <dominic1brahms.demon.co.uk>
Date: 2005-05-29 13:51:15
Ullrich von Bassewitz wrote:

>Hi!
>
>On Fri, May 27, 2005 at 12:37:37AM +0100, dominic beesley wrote:
>  
>
>>Well, some kind of user intervention is relevant. 
>>    
>>
>
>I see your point, but using signals won't work.
>  
>
It seems ok so far, but I take your point. I'm looking at trying to make the
file descriptor handling stuff work such that I can be sure that I know at
least which files are open, so I can close them on an Escape. Otherwise
if the user Escapes the files remain open, which is not good! ;)

>  
>
>>After some more testing, and lots of reading through the OS disassembly,
>>it seems
>>though that hanging off the Escape vector is not too bad. Do the Unices
>>not have these
>>problems though. Processes can be swapped out at any point and then
>>signals delivered?
>>    
>>
>
>Yes that works. But the architectures are slightly different:-)
>  
>
I guess really the main worry is that I'm in the middle of updating one 
of the file
structures. I'm trying to work out if an Escape is ever delivered in the 
middle of an
OS operation. In which case it gets very messy. Otherwise I'll just try 
and make sure
that the cleanup code uses some kind of semaphore to protect other file 
ops (and
possibly delays the Escape handling until after it has happened).

>  
>
>>There are other signals which might come from the calling of an OS
>>function.
>>    
>>
>
>In this case, signal are synchronous and can be used. But ... wouldn't make it
>more sense to map these signals to error codes? Returning an apropriate error
>code is used in most other cases. Or is that impossible on the BBC?
>
>  
>
That's what I'm trying to do. However the BBC OS returns errors by 
issuing a BRK instruction
so it means hanging off the interrupt vector somewhere. Also there is no 
way of returning from
BRK so I'm setting something like a setjmp/longjmp around OS functions 
so I can jump back into
the library (in assembler) at a defined point (i.e. save the stack state 
before calling the OS function)
and jumping back to a BCC/BCS instruction to test for failure. I've 
given up (for now) on signals
as suggested for these, but might need something later, I've just got to 
work out whether BRK
signals may be received when not in an OS function.

>Regards
>
>
>        Uz
>
>  
>
For now I'm a bit sidetracked, trying to get httpd working, but having 
bother with the serial
port on the BBC (its rs423 and Linux doesn't seem to want to talk to it!)

PS: Well done on getting the httpd/uip stuff to work... It _just_ fits 
in the BBC if I use a
text mode!
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun May 29 14:00:42 2005

This archive was generated by hypermail 2.1.8 : 2005-05-29 14:00:44 CEST