[DTrace-devel] [DTrace] DTrace userspace branch dm/2.0-branch-dev-aggs updated. 2ffdae6376cbe280267577edbfc5dc93a776398f
Eugene Loh
eugene.loh at oracle.com
Wed Nov 25 16:31:24 PST 2020
----- kris.van.hees at oracle.com wrote:
> On Wed, Nov 25, 2020 at 09:41:33AM -0800, Eugene Loh wrote:
> > > +
> > > + // Change to a positive value
> > > + BPFCODE(BPF_NEG_REG(idxreg))
> >
> > That changes the magnitude. Probably need BPF_MUL_IMM(regfoo, -1) or
> > something. Note that x and -x are not 2s complements. If x and y are
> > 2s complements, they add up to -1. x and -x add up to 0.
>
> If the purpose of this code is to turn a vlaue that is negative into one that
> is positive, i.e. the value is a int64_t, then why would BPF_NEG_REG(reg) be
> wrong? It is actually implemented as: regs[reg] = -regs[reg]
Yup. You're right. My bad. I was thinking bitwise NOT.
More information about the DTrace-devel
mailing list