tech-kern archive

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

Re: [PATCH 1/2] compat32: translate userland PT_* request values into kernel



On Thu, 2019-05-30 at 03:15 +1000, matthew green wrote:
> thanks for working on this.
> 
> > +	case PT_FIRSTMACH + 0:
> > +		return PT_STEP;
> > +	case PT_FIRSTMACH + 1:
> > +		return PT_GETREGS;
> [ ... ]
> 
> these magic numbers are a little ugly.  can you avoid them?

I know they are, however I don't think it's really possible.  One option
is to declare additional set of constants in the amd64 headers but that
doesn't really gain us anything, and ends up in kinda-absurd:

  case PT32_STEP: return PT_STEP;

or alike.

> is there a way to have amd64 have direct access to the i386
> values?

I don't think so.

> > --- a/sys/sys/ptrace.h
> > +++ b/sys/sys/ptrace.h
> > @@ -283,6 +283,10 @@ int	ptrace_machdep_dorequest(struct lwp *, struct lwp *, int,
> >  #define FIX_SSTEP(p)
> >  #endif
> >  
> > +#ifndef PTRACE_TRANSLATE_REQUEST32
> > +#define PTRACE_TRANSLATE_REQUEST32(x) x
> > +#endif
> > +
> 
> can this part live in sys/compat(/netbsd32)?  no need for the
> public ptrace header to get this, right?
> 

I'll try and see.

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: This is a digitally signed message part



Home | Main Index | Thread Index | Old Index