On Fri, Nov 16, 2018 at 9:20 AM Xabier Oneca -- xOneca <xon...@gmail.com> wrote:
>
> Hello,
>
> How is this actually possible to happen? I've been trying to reproduce
> it (on x86_64) without success... :/
>
> https://git.busybox.net/busybox/commit/?id=fe836d84554c007916adc1c2e5f5daae2f878947
>
> tls: code shrink
> function         old new delta
> spawn_ssl_client 219 218 -1
>
> diff --git a/networking/wget.c b/networking/wget.c
> index a9a0f5f..65262e1 100644
> --- a/networking/wget.c
> +++ b/networking/wget.c
> @@ -717,8 +717,8 @@ static void spawn_ssl_client(const char *host, int
> network_fd, int flags)
> char *servername, *p;
> if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) {
> - bb_error_msg("note: TLS certificate validation not implemented");
> option_mask32 |= WGET_OPT_NO_CHECK_CERT;
> + bb_error_msg("note: TLS certificate validation not implemented");
> }
> servername = xstrdup(host);
> --
>
> I can't see why that change would generate less asm. Out of curiosity,
> anybody cares to explain?

make networking/wget.s

        movl    option_mask32, %eax     # option_mask32, option_mask32.23
        testb   $32, %ah        #, option_mask32.23
        jne     .L13    #,
        orb     $32, %ah        #, option_mask32.23
        movl    %eax, option_mask32     # option_mask32.23, option_mask32
        pushl   $.LC3   #
        call    bb_error_msg    #
        popl    %esi    #
.L13:

Now, if there's a way to code bit-level test_and_set idiom in C?
x86 has BTS insn which does it efficiently, but it's not used here
by the compiler. It could be:

        btsl    $13, option_mask32
        jnc     .L13    #,
        pushl   $.LC3   #
        call    bb_error_msg    #
        popl    %esi    #
.L13:
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to