struct _heap_info *prev; /* Previous heap. */
size_t size; /* Current size in bytes. */
size_t mprotect_size; /* Size in bytes that has been mprotected
- PROT_READ|PROT_WRITE. */
+ PROT_READ|PROT_WRITE|MALLOC_PROT_EXEC. */
/* Make sure the following data is properly aligned, particularly
that sizeof (heap_info) + 2 * SIZE_SZ is a multiple of
MALLOC_ALIGNMENT. */
}
}
}
- if(mprotect(p2, size, PROT_READ|PROT_WRITE) != 0) {
+ if(mprotect(p2, size, PROT_READ|PROT_WRITE|MALLOC_PROT_EXEC) != 0) {
munmap(p2, HEAP_MAX_SIZE);
return 0;
}
if((unsigned long) new_size > h->mprotect_size) {
if (mprotect((char *)h + h->mprotect_size,
(unsigned long) new_size - h->mprotect_size,
- PROT_READ|PROT_WRITE) != 0)
+ PROT_READ|PROT_WRITE|MALLOC_PROT_EXEC) != 0)
return -2;
h->mprotect_size = new_size;
}
/* Don't try if size wraps around 0 */
if ((unsigned long)(size) > (unsigned long)(nb)) {
- mm = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
+ mm = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE|MALLOC_PROT_EXEC,
+ MAP_PRIVATE));
if (mm != MAP_FAILED) {
/* Don't try if size wraps around 0 */
if ((unsigned long)(size) > (unsigned long)(nb)) {
- char *mbrk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
+ char *mbrk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE|MALLOC_PROT_EXEC,
+ MAP_PRIVATE));
if (mbrk != MAP_FAILED) {
#include <stdio.h>
#include <paths.h>
+#ifndef __USE_SUN
/* File listing canonical interesting mount points. */
#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
__END_DECLS
+#endif /* __USE_SUN */
+
#endif /* mntent.h */
#define tsd_setspecific(key, data) __libc_tsd_set (MALLOC, (data))
#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (MALLOC))
-#include <sysdeps/generic/malloc-machine.h>
+#include <ldsodefs.h>
+#define MALLOC_PROT_EXEC GLRO(dl_malloc_prot_exec)
#endif /* !defined(_MALLOC_MACHINE_H) */
bits/string2.h bits/string3.h
routines := strcat strchr strcmp strcoll strcpy strcspn \
- strverscmp strdup strndup \
+ strverscmp strdup strndup strlcpy strlcat \
strerror _strerror strlen strnlen \
strncat strncmp strncpy \
strrchr strpbrk strsignal strspn strstr strtok \
GLIBC_2.6 {
strerror_l;
}
+ GLIBC_2.7 {
+ strlcat; strlcpy;
+ }
}
extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
size_t __n) __THROW __nonnull ((1, 2));
+extern size_t strlcat (char *__restrict __dest, __const char *__restrict __src,
+ size_t __n) __THROW __nonnull ((1, 2));
+extern size_t strlcpy (char *__restrict __dest, __const char *__restrict __src,
+ size_t __n) __THROW __nonnull ((1, 2));
+
/* Compare S1 and S2. */
extern int strcmp (__const char *__s1, __const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
--- /dev/null
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
+ * Appends src to string dst of size siz (unlike strncat, siz is the
+ * full size of dst, not space left). At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).
+ * If retval >= siz, truncation occurred.
+ */
+size_t
+strlcat (char *dst, const char *src, size_t siz)
+{
+ register char *d = dst;
+ register const char *s = src;
+ register size_t n = siz;
+ size_t dlen;
+
+ /* Find the end of dst and adjust bytes left but don't go past end */
+ while (n-- != 0 && *d != '\0')
+ d++;
+ dlen = d - dst;
+ n = siz - dlen;
+
+ if (n == 0)
+ return(dlen + strlen(s));
+ while (*s != '\0') {
+ if (n != 1) {
+ *d++ = *s;
+ n--;
+ }
+ s++;
+ }
+ *d = '\0';
+
+ return(dlen + (s - src)); /* count does not include NUL */
+}
--- /dev/null
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
+ * Copy src to string dst of size siz. At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+strlcpy (char *dst, const char *src, size_t siz)
+{
+ register char *d = dst;
+ register const char *s = src;
+ register size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0 && --n != 0) {
+ do {
+ if ((*d++ = *s++) == 0)
+ break;
+ } while (--n != 0);
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return(s - src - 1); /* count does not include NUL */
+}
+#warning FOO1
/* Basic platform-independent macro definitions for mutexes,
thread-specific data and parameters for malloc.
Copyright (C) 2003 Free Software Foundation, Inc.
# define DEFAULT_TOP_PAD 131072
#endif
+#ifndef MALLOC_PROT_EXEC
+# define MALLOC_PROT_EXEC 0
+#endif
+
#endif /* !defined(_GENERIC_MALLOC_MACHINE_H) */
headers := $(filter-out sys/socketvar.h, $(headers))
endif
-ifeq ($(subdir),string)
-sysdep_routines += strlcpy strlcat
-endif
-
ifeq ($(subdir),time)
sysdep_routines += ntp_adjtime ntp_gettime sys_time sys_stime
sysdep_headers += sys/timex.h sys/time_impl.h
_RUSAGESYS_GETVMUSAGE = 3
#define _RUSAGESYS_GETVMUSAGE _RUSAGESYS_GETVMUSAGE
};
+
+#define PRIO_MIN -20
+#define PRIO_MAX 20
typedef struct timespec timespec_t;
typedef struct timespec timestruc_t;
+typedef struct itimerspec itimerspec_t;
typedef struct tm tm_t;
# define SEC 1
# define __t_uscalar_t_defined
#endif
typedef __t_scalar_t t_scalar_t;
+typedef void *timeout_id_t;
+typedef void *bufcall_id_t;
#ifdef __USE_POSIX
typedef enum
--- /dev/null
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <link.h>
+#include <sys/mman.h>
+#include <ldsodefs.h>
+
+#define DL_SYSDEP_INIT exec_last_load (phdr, phnum)
+
+static inline void exec_last_load (const ElfW(Phdr) *phdr, ElfW(Word) phnum)
+{
+ /* Check if the last PT_LOAD segment is executable. */
+ GLRO(dl_malloc_prot_exec) = 0;
+ for (uint_fast16_t i = 0; i < phnum; ++i)
+ if (phdr[i].p_type == PT_LOAD)
+ GLRO(dl_malloc_prot_exec) = (phdr[i].p_flags & PF_X) ? PROT_EXEC : 0;
+}
+
+#include <elf/dl-sysdep.c>
#include <sys/param.h>
#include <sys/types.h>
#include <libc-internal.h>
-#include <sys/ucontext.h>
+#include <ucontext.h>
#include <sys/resource.h>
#include <ldsodefs.h>
char **__libc_argv attribute_hidden;
stack_t _dl_stack;
+int _dl_malloc_prot_exec;
void
#endif
__setfpucw (__fpu_control);
- /* Setup stack. */
- ucontext_t ctx;
- struct rlimit rlim;
- if (getrlimit (RLIMIT_STACK, &rlim) == 0 &&
- rlim.rlim_cur != RLIM_INFINITY && getcontext (&ctx) == 0)
- {
- _dl_stack.ss_sp = ctx.uc_stack.ss_sp;
- _dl_stack.ss_size = rlim.rlim_cur;
- _dl_stack.ss_flags = 0;
- setustack (&_dl_stack);
- }
+ /* Setup stack. */
+ ucontext_t ctx;
+ struct rlimit rlim;
+ if (getrlimit (RLIMIT_STACK, &rlim) == 0 &&
+ rlim.rlim_cur != RLIM_INFINITY && getcontext (&ctx) == 0)
+ {
+ _dl_stack.ss_sp = ctx.uc_stack.ss_sp;
+ _dl_stack.ss_size = rlim.rlim_cur;
+ _dl_stack.ss_flags = 0;
+ setustack (&_dl_stack);
+ }
}
/* Save the command-line arguments. */
#include <kernel-features.h>
-/* Copy of AT_SUN_EXECNAME. */
-#define PLATFORM_RTLD_GLOBAL_RO_FIELDS \
- EXTERN const char * _dl_sun_execname;
+#define PLATFORM_RTLD_GLOBAL_RO_FIELDS \
+ EXTERN const char * _dl_sun_execname; \
+ EXTERN int _dl_malloc_prot_exec;
extern const char * _dl_sun_execname;
+extern int _dl_malloc_prot_exec;
/* Get the real definitions. */
#include_next <ldsodefs.h>
--- /dev/null
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MALLOC_MACHINE_H
+#define _MALLOC_MACHINE_H
+
+#include <ldsodefs.h>
+#define MALLOC_PROT_EXEC GLRO(dl_malloc_prot_exec)
+
+#include <sysdeps/generic/malloc-machine.h>
+
+#endif /* _MALLOC_MACHINE_H */
+++ /dev/null
-/* Copyright (C) 1991,92,96,97,99,2000,2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _STRINGS_H
-#define _STRINGS_H 1
-
-#include <features.h>
-
-/* We don't need and should not read this file if <string.h> was already
- read. The one exception being that if __USE_BSD isn't defined, then
- these aren't defined in string.h, so we need to define them here. */
-#if !defined _STRING_H || !defined __USE_BSD
-
-# define __need_size_t
-# include <stddef.h>
-
-__BEGIN_DECLS
-
-/* Compare N bytes of S1 and S2 (same as memcmp). */
-extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
- __THROW __attribute_pure__;
-
-/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
-extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW;
-
-/* Set N bytes of S to 0. */
-extern void bzero (void *__s, size_t __n) __THROW;
-
-/* Return the position of the first bit set in I, or 0 if none are set.
- The least-significant bit is position 1, the most-significant 32. */
-extern int ffs (int __i) __THROW __attribute__ ((const));
-
-/* Find the first occurrence of C in S (same as strchr). */
-extern char *index (__const char *__s, int __c) __THROW __attribute_pure__;
-
-/* Find the last occurrence of C in S (same as strrchr). */
-extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__;
-
-/* Compare S1 and S2, ignoring case. */
-extern int strcasecmp (__const char *__s1, __const char *__s2)
- __THROW __attribute_pure__;
-
-/* Compare no more than N chars of S1 and S2, ignoring case. */
-extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
- __THROW __attribute_pure__;
-
-__END_DECLS
-
-#endif /* string.h */
-
-#ifdef __USE_MISC
-# include <string.h>
-#endif
-
-__BEGIN_DECLS
-
-extern size_t strlcpy (char *, const char *, size_t);
-
-extern size_t strlcat (char *, const char *, size_t);
-
-extern int uucopy (const void *, void *, size_t);
-
-extern int uucopystr (const void *, void *, size_t);
-
-__END_DECLS
-
-#endif /* strings.h */
+++ /dev/null
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
- * Returns strlen(src) + MIN(siz, strlen(initial dst)).
- * If retval >= siz, truncation occurred.
- */
-size_t
-strlcat (char *dst, const char *src, size_t siz)
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (n-- != 0 && *d != '\0')
- d++;
- dlen = d - dst;
- n = siz - dlen;
-
- if (n == 0)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1) {
- *d++ = *s;
- n--;
- }
- s++;
- }
- *d = '\0';
-
- return(dlen + (s - src)); /* count does not include NUL */
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Copy src to string dst of size siz. At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-size_t
-strlcpy (char *dst, const char *src, size_t siz)
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
-
- /* Copy as many bytes as will fit */
- if (n != 0 && --n != 0) {
- do {
- if ((*d++ = *s++) == 0)
- break;
- } while (--n != 0);
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0) {
- if (siz != 0)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
ifeq ($(subdir),misc)
-sysdep_headers += sys/segments.h
sysdep_routines += sysi86
endif
# define REG_FSBASE 26
# define REG_GSBASE 27
-# ifndef __SUN_COMPAT_SOURCE
-# define GS 0
-# define FS 1
-# define ES 2
-# define DS 3
-# define EDI 4
-# define ESI 5
-# define EBP 6
-# define ESP 7
-# define EBX 8
-# define EDX 9
-# define ECX 10
-# define EAX 11
-# define TRAPNO 12
+# define GS 0
+# define FS 1
+# define ES 2
+# define DS 3
+# define EDI 4
+# define ESI 5
+# define EBP 6
+# define ESP 7
+# define EBX 8
+# define EDX 9
+# define ECX 10
+# define EAX 11
+# define TRAPNO 12
+# ifndef ERR
# define ERR 13
-# define EIP 14
-# define CS 15
-# define EFL 16
-# define UESP 17
-# define SS 18
# endif
+# define EIP 14
+# define CS 15
+# define EFL 16
+# define UESP 17
+# define SS 18
# ifdef __amd64__
# define REG_PC REG_RIP
+++ /dev/null
-/* Declaration of segments.
- Copyright (C) 2008 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _SYS_SEGMENTS_H
-#define _SYS_SEGMENTS_H 1
-
-#define IDXTOSEL(s) ((s) << 3)
-#define SEL_GDT(s, r) (IDXTOSEL(s) | r)
-
-#define SEL_UPL 3
-
-#define GDT_LWPFS 55
-#define GDT_LWPGS 56
-
-#define LWPFS_SEL SEL_GDT(GDT_LWPFS, SEL_UPL)
-#define LWPGS_SEL SEL_GDT(GDT_LWPGS, SEL_UPL)
-
-#ifdef __i386__
-
-typedef struct user_desc
- {
- uint32_t usd_lolimit:16;
- uint32_t usd_lobase:16;
- uint32_t usd_midbase:8;
- uint32_t usd_type:5;
- uint32_t usd_dpl:2;
- uint32_t usd_p:1;
- uint32_t usd_hilimit:4;
- uint32_t usd_avl:1;
- uint32_t usd_reserved:1;
- uint32_t usd_def32:1;
- uint32_t usd_gran:1;
- uint32_t usd_hibase:8;
- } user_desc_t;
-
-typedef struct system_desc
- {
- uint32_t ssd_lolimit:16;
- uint32_t ssd_lobase:16;
- uint32_t ssd_midbase:8;
- uint32_t ssd_type:4;
- uint32_t ssd_zero:1;
- uint32_t ssd_dpl:2;
- uint32_t ssd_p:1;
- uint32_t ssd_hilimit:4;
- uint32_t ssd_avl:1;
- uint32_t ssd_reserved:2;
- uint32_t ssd_gran:1;
- uint32_t ssd_hibase:8;
- } system_desc_t;
-
-#else
-
-typedef struct user_desc
- {
- uint64_t usd_lolimit:16;
- uint64_t usd_lobase:16;
- uint64_t usd_midbase:8;
- uint64_t usd_type:5;
- uint64_t usd_dpl:2;
- uint64_t usd_p:1;
- uint64_t usd_hilimit:4;
- uint64_t usd_avl:1;
- uint64_t usd_long:1;
- uint64_t usd_def32:1;
- uint64_t usd_gran:1;
- uint64_t usd_hibase:8;
- } user_desc_t;
-
-typedef struct system_desc
- {
- uint64_t ssd_lolimit:16;
- uint64_t ssd_lobase:16;
- uint64_t ssd_midbase:8;
- uint64_t ssd_type:4;
- uint64_t ssd_zero1:1;
- uint64_t ssd_dpl:2;
- uint64_t ssd_p:1;
- uint64_t ssd_hilimit:4;
- uint64_t ssd_avl:1;
- uint64_t ssd_resv1:2;
- uint64_t ssd_gran:1;
- uint64_t ssd_hibase:8;
- uint64_t ssd_hi64base:32;
- uint64_t ssd_resv2:8;
- uint64_t ssd_zero2:5;
- uint64_t ssd_resv3:19;
- } system_desc_t;
-
-#endif /* __i386__ */
-
-#endif /* _SYS_SEGMENTS_H */