Changes and additions migrated from cvs.devel.redhat.com:/cvs/devel/glibc to fedora...
[glibc.git] / sysdeps / unix / sysv / linux / i386 / dl-cache.h
blob38a1c7dfb47d47b7aa3a9ccd3f7ed13e472bd6db
1 /* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
2 Copyright (C) 2004 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 static inline int
21 is_ia64 (void)
23 unsigned int fl1, fl2;
25 /* See if we can use cpuid. */
26 __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
27 "pushl %0; popfl; pushfl; popl %0; popfl"
28 : "=&r" (fl1), "=&r" (fl2)
29 : "i" (0x00200000));
30 if (((fl1 ^ fl2) & 0x00200000) == 0)
31 return 0;
33 /* Host supports cpuid. See if cpuid gives capabilities, try
34 CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we
35 don't need their CPUID values here, and %ebx may be the PIC
36 register. */
37 __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
38 : "=a" (fl1) : "0" (0) : "edx", "cc");
39 if (fl1 == 0)
40 return 0;
42 /* Invoke CPUID(1), return %edx; caller can examine bits to
43 determine what's supported. */
44 __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
45 : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
46 return (fl2 & (1 << 30)) != 0;
49 #define arch_startup(argc, argv) \
50 do { \
51 /* On IA-64, try to execute 64-bit ldconfig if possible. \
52 This is because the badly designed /emul/ia32-linux hack \
53 will cause 32-bit ldconfig to do all sorts of weird things. */ \
54 if (is_ia64 ()) \
55 execv ("/emul/ia32-linux/../../sbin/ldconfig", \
56 (char *const *) argv); \
57 } while (0)
59 #include_next <dl-cache.h>