Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nathanw_sa]: src/lib/libpthread/arch/i386 Define _INITCONTEXT_U_MD() to ...
details: https://anonhg.NetBSD.org/src/rev/dca0e3958992
branches: nathanw_sa
changeset: 506384:dca0e3958992
user: nathanw <nathanw%NetBSD.org@localhost>
date: Tue Oct 22 01:26:42 2002 +0000
description:
Define _INITCONTEXT_U_MD() to set segment registers and flag register
to sensible values.
diffstat:
lib/libpthread/arch/i386/pthread_md.h | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diffs (32 lines):
diff -r c57064a078e0 -r dca0e3958992 lib/libpthread/arch/i386/pthread_md.h
--- a/lib/libpthread/arch/i386/pthread_md.h Tue Oct 22 01:25:43 2002 +0000
+++ b/lib/libpthread/arch/i386/pthread_md.h Tue Oct 22 01:26:42 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_md.h,v 1.1.2.7 2002/10/21 23:01:48 nathanw Exp $ */
+/* $NetBSD: pthread_md.h,v 1.1.2.8 2002/10/22 01:26:42 nathanw Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -71,6 +71,22 @@
#define pthread__uc_pc(ucp) ((ucp)->uc_mcontext.__gregs[_REG_EIP])
/*
+ * Set initial, sane values for registers whose values aren't just
+ * "don't care".
+ * 0x2b is GSEL(GUDATA_SEL, SEL_UPL), and
+ * 0x23 is GSEL(GUCODE_SEL, SEL_UPL), from arch/i386/include/segments.h.
+ * 0x202 is PSL_USERSET from arch/i386/include/psl.h
+ */
+#define _INITCONTEXT_U_MD(ucp) \
+ (ucp)->uc_mcontext.__gregs[_REG_GS] = 0x2b; \
+ (ucp)->uc_mcontext.__gregs[_REG_FS] = 0x2b; \
+ (ucp)->uc_mcontext.__gregs[_REG_ES] = 0x2b; \
+ (ucp)->uc_mcontext.__gregs[_REG_DS] = 0x2b; \
+ (ucp)->uc_mcontext.__gregs[_REG_CS] = 0x23; \
+ (ucp)->uc_mcontext.__gregs[_REG_SS] = 0x2b; \
+ (ucp)->uc_mcontext.__gregs[_REG_EFL] = 0x202;
+
+/*
* Usable stack space below the ucontext_t.
* See comment in pthread_switch.S about STACK_SWITCH.
*/
Home |
Main Index |
Thread Index |
Old Index