News for hackers. Stuff that matters.
Re:TCP HTTP Server written in Assembly by pbsd on Sunday December 15, 2013 @12:34AM (#6908503)
Agree, AT&T syntax was just not designed for human reading. I doubt this is too optimized for size, since there are obvious tricks that it misses.

Another observation: the strlen code is incorrect, as it also counts the \0. We can fix this, and make the code 1 byte shorter (in glorious Intel syntax):

    lea esi, source        ; depends on source
    xor ecx, ecx           ; 2 bytes
    salc                   ; 1 byte
    cld                    ; 1 byte
    _back:
    scasb                  ; 1 byte 
    loopnz _back           ; 2 bytes
    not ecx                ; 2 bytes
Re:TCP HTTP Server written in Assembly by kragen on Sunday December 15, 2013 @11:44AM (#6909917)
Thank you! About the time you wrote this, I discovered that the strlen code was incorrect in a different way as well, and then I went to sleep. Sort of embarrassing.
Re:TCP HTTP Server written in Assembly by kragen on Sunday December 15, 2013 @03:33PM (#6910737)
BTW, I've fixed the strlen code (although differently). I didn't know about SALC! That's a very clever way of zeroing AL.

I think at this point I might be able to get away with CLD since I never STD any more :)

Some of the obvious tricks it misses are probably because they're not obvious to me, while others may be just because I haven't gotten to them yet.

Re:TCP HTTP Server written in Assembly by pbsd on Monday December 16, 2013 @09:17AM (#6914775)
Your way is much cleaner; mine was just a size gimmick. I just can't resist it :)