2.9
[glibc/nacl-glibc.git] / sysdeps / mach / i386 / sysdep.h
blob4fc5d50f3dd65ab6abcd7b5109065d1e1a9c1790
1 /* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2007
2 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */
22 #include <dl-sysdep.h>
23 #include <tls.h>
25 #define LOSE asm volatile ("hlt")
27 #define SNARF_ARGS(entry_sp, argc, argv, envp) \
28 do \
29 { \
30 register char **p; \
31 argc = (int) *entry_sp; \
32 argv = (char **) (entry_sp + 1); \
33 p = argv; \
34 while (*p++ != NULL) \
35 ; \
36 if (p >= (char **) argv[0]) \
37 --p; \
38 envp = p; \
39 } while (0)
41 #define CALL_WITH_SP(fn, info, sp) \
42 do { \
43 void **ptr = (void **) sp; \
44 *--(__typeof (info) *) ptr = info; \
45 ptr[-1] = ptr; \
46 --ptr; \
47 asm volatile ("movl %0, %%esp; call %1" : : \
48 "g" (ptr), "m" (*(long int *) (fn)) : "%esp"); \
49 } while (0)
51 #define RETURN_TO(sp, pc, retval) \
52 asm volatile ("movl %0, %%esp; jmp %*%1 # %2" \
53 : : "g" (sp), "r" (pc), "a" (retval))
56 #define STACK_GROWTH_DOWN
58 /* Get the machine-independent Mach definitions. */
59 #include <sysdeps/mach/sysdep.h>
62 /* This should be rearranged, but at the moment this file provides
63 the most useful definitions for assembler syntax details. */
64 #undef ENTRY
65 #undef ALIGN
66 #include <sysdeps/unix/i386/sysdep.h>