vm: fix a null dereference on out-of-memory
[minix.git] / lib / libc / arch / x86_64 / stdlib / labs.S
blobffc8f2bb9a76d81254b81fb1d05028d7597c9163
1 /*      $NetBSD: labs.S,v 1.2 2008/08/04 20:21:26 matt Exp $    */
3 /*
4  * Written by Frank van der Linden (fvdl@wasabisystems.com)
5  * Public Domain.
6  */
8 #include <machine/asm.h>
10 #if defined(LIBC_SCCS)
11         RCSID("$NetBSD: labs.S,v 1.2 2008/08/04 20:21:26 matt Exp $")
12 #endif
14 #ifdef WEAK_ALIAS
15 WEAK_ALIAS(imaxabs, _llabs)
16 WEAK_ALIAS(llabs, _llabs)
17 WEAK_ALIAS(labs, _labs)
18 #endif
20 #ifdef WEAK_ALIAS
21 ENTRY(_llabs)
22 ENTRY(_labs)
23 #else
24 ENTRY(llabs)
25 ENTRY(labs)
26 #endif
27         movq    %rdi,%rax
28         testq   %rax,%rax
29         jns     1f
30         negq    %rax
31 1:      ret