lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 24 Sep 2014 23:30:32 -0700
From:	Alexei Starovoitov <ast@...mgrid.com>
To:	David Miller <davem@...emloft.net>
Cc:	Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH net] sparc: bpf_jit: fix loads from negative offsets

On Wed, Sep 24, 2014 at 12:08 PM, David Miller <davem@...emloft.net> wrote:
>
> BTW, there is a trick to load arbitrary negative 32-bit constants sign
> extended to 64-bit, in just two instructions:
>
>         sethi   %(~value), reg
>         xor     reg, ~(0x400 | (value & 0x3ff)), reg
>
> Or something like that, it's been a while.  GCC knows how to emit
> that sequence too.

nice, that's a neat trick.
gcc computes it as:
  sethi   %(~value), reg
  xor     reg, -0x400 | (value & 0x3ff), reg

and llvm as:
  sethi   %(~value), reg
  xor     reg, ~(~value & 0x3ff), reg

both are equivalent. I'll try to teach JIT to emit this.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ