Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: vax/ddb(4): clean up machine dependent code and improve usability



On Mon, Mar 10, 2025 at 10:25:40PM +0100, Jan-Benedict Glaw wrote:
> On Mon, 2025-03-10 13:08:09 +0100, Hans Rosenfeld <hans%netbsd.org@localhost> wrote:
> > I've recently fixed a few bugs on VAX, and while I did that I noticed
> > that ddb(4) on VAX is a pain to work with. Here's my attempt fix this:
> > 
> > https://github.com/NetBSD/src/compare/trunk...hrosenfeld:NetBSD-src:vax-ddb
> 
> The patch contain two chunks like this:
> 
> -/* Isolate the saved register bits, and count them */
> -regs = fp->vax_regs;
> -for (arg_base = 0; regs != 0; regs >>= 1) {
> -	if (regs & 1)
> -		arg_base++;
> -}
> +/* Count saved register bits */
> +arg_base = popcount(fp->vax_regs);
> 
> 
> I'm not entirely sure, but I think both are actually not exactly
> correct. While counting registers R0 .. R11 it totally fine, things
> may change if for whatever reason the IV and DV flags are set (and
> counted.)  Maybe AND the register mask to mask out the top two bits
> for safety?

The vax_regs member of VAX_CALLFRAME is actually a bitfield covering
only the register mask bits, so I don't think that can happen?

This may be a bit confusing because there's also a struct callsframe
defined in vax/include/frame.h which doesn't use bitfields, but that
isn't used in the stack trace code.


Hans


-- 
%SYSTEM-F-ANARCHISM, The operating system has been overthrown


Home | Main Index | Thread Index | Old Index