Subject: Re: -current kernel broken
To: None <port-sparc@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: port-sparc
Date: 06/13/1996 11:59:44
>> #define RETURN_PC(frameno) __builtin_return_address(frameno)
>> which gcc is turning into something involving a "ta 3".
Which of course is reasonable; if you're going to try to extract return
PCs from the stack frames, the PCs have to _be_ in the stack frames to
begin with. :-)
> I guess I'm going to turn that macro in a no-op for the sparc. Maybe
> this particular trap can actually be handled without much fuss in
> kernel mode, but I'm slowly beginning to dread these presumptuous
> ``__builtin_*''s.
Well, unfortunately I don't see any way out of it - you have to either
give up getting those RETURN_PC values or you have to handle
flush-window traps. (Or you have to teach gcc to flush windows some
other way in the kernel; since the kernel can know how many windows
there are, it could just do a recursive call nwindows times, then
return from them all. Actually, that's all you have to do to implement
the flush-windows trap, since window overflow traps within the kernel
already work fine.)
I have code written for this; I'll test it, and once I'm confident it
works I'll send-pr it.
David Miller writes replying to pk,
> No need to no-op it, just make a special path of execution within
> locore for the from-kernel case of "ta 3". You do nwindows saves and
> restores unconditionally.
No need to special-case it in locore, even. Just have a little
recursive procedure in trap.c that forces all the windows onto the
stack. Slight overkill, but a lot easier to code and make work. :-)
> __builtin_return_address(x) is a very useful debugging feature in the
> kernel.
Somehow, I find this very easy to believe. :-)
der Mouse
mouse@collatz.mcrcim.mcgill.edu