summaryrefslogtreecommitdiff
path: root/libthreads/i386/thread.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-05-27 02:50:10 +0000
committerRoland McGrath <roland@gnu.org>2002-05-27 02:50:10 +0000
commit2d3e2366b453da9b4288c30f3f894fccef1e7914 (patch)
tree2ada3140e12e0ba146954f447b0be0eb51f83fa0 /libthreads/i386/thread.c
parent9403905d538fbb6fd33fa8439978a868aef56d9e (diff)
2002-05-26 Roland McGrath <roland@frob.com>
Changes merged from CMU MK83a version: * cthreads.h, options.h: Various cleanups. * call.c, cthread_data.c, sync.c, mig_support.c: Likewise. * i386/cthreads.h, i386/thread.c, i386/lock.s: Likewise. * cthread_internals.h: Add decls for internal functions. (struct cproc): Use vm_offset_t for stack_base and stack_size members. Use natural_t for context member. * cprocs.c: Use prototypes for all defns. * cthreads.c: Likewise. (cthread_exit): Cast any_t to integer_t before int.
Diffstat (limited to 'libthreads/i386/thread.c')
-rw-r--r--libthreads/i386/thread.c63
1 files changed, 17 insertions, 46 deletions
diff --git a/libthreads/i386/thread.c b/libthreads/i386/thread.c
index c6781b9d..c0195a8b 100644
--- a/libthreads/i386/thread.c
+++ b/libthreads/i386/thread.c
@@ -1,6 +1,6 @@
/*
* Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
+ * Copyright (c) 1992,1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
@@ -25,44 +25,20 @@
*/
/*
* HISTORY
- * $Log: thread.c,v $
- * Revision 1.5 2001/03/31 23:03:03 roland
- * 2001-03-31 Roland McGrath <roland@frob.com>
+ * $Log: thread.c,v $
+ * Revision 2.8 93/02/02 21:54:58 mrt
+ * Changed include of mach/mach.h to mach.h.
+ * [93/02/02 mrt]
*
- * * cthreads.h: Fix obsolescent #endif syntax.
- * * cthread_internals.h: Likewise.
- * * cancel-cond.c: Likewise.
- * * stack.c: Likewise.
- * * cthreads.c: Likewise.
- * * cprocs.c: Likewise.
- * * call.c: Likewise.
- * * i386/thread.c: Likewise.
- *
- * Revision 1.4 2001/02/26 04:15:27 roland
- * 2001-02-25 Roland McGrath <roland@frob.com>
- *
- * * i386/thread.c: Remove superfluous bzero decl,
- * just include <strings.h> instead.
- *
- * Revision 1.3 1997/02/18 22:53:31 miles
- * (cproc_setup):
- * Correctly leave space at top of stack for account for GNU per-thread
- * variables.
- *
- * Revision 1.2 1994/05/04 19:05:26 mib
- * entered into RCS
+ * Revision 2.7 93/01/14 18:05:15 danner
+ * Converted file to ANSI C.
+ * Fixed argument types.
+ * [92/12/18 pds]
*
* Revision 2.6 91/07/31 18:37:07 dbg
* Undefine cthread_sp macro around function definition.
* [91/07/30 17:36:23 dbg]
*
- * Revision 2.5 91/05/14 17:57:27 mrt
- * Correcting copyright
- *
- * Revision 2.4 91/02/14 14:20:21 mrt
- * Changed to new Mach copyright
- * [91/02/13 12:20:10 mrt]
- *
* Revision 2.3 90/06/02 15:13:53 rpd
* Added definition of cthread_sp.
* [90/06/02 rpd]
@@ -78,15 +54,13 @@
*/
#ifndef lint
-static char rcs_id[] = "$Header: cvs-sans-libpthread/hurd/libthreads/i386/thread.c,v 1.6 2001/12/22 21:02:31 roland Exp $";
+char rcs_id[] = "$Header: cvs-sans-libpthread/hurd/libthreads/i386/thread.c,v 1.7 2002/05/27 02:50:10 roland Exp $";
#endif /* not lint */
-#include "../cthreads.h"
-#include "../cthread_internals.h"
-#include <strings.h>
-#include <mach/mach.h>
-
+#include <cthreads.h>
+#include "cthread_internals.h"
+#include <mach.h>
/*
* Set up the initial state of a MACH thread
@@ -94,10 +68,7 @@ static char rcs_id[] = "$Header: cvs-sans-libpthread/hurd/libthreads/i386/thread
* when it is resumed.
*/
void
-cproc_setup(child, thread, routine)
- register cproc_t child;
- int thread;
- int routine;
+cproc_setup(register cproc_t child, thread_t thread, void (*routine)(cproc_t))
{
extern unsigned int __hurd_threadvar_max; /* GNU */
register int *top = (int *)
@@ -118,7 +89,7 @@ cproc_setup(child, thread, routine)
count = i386_THREAD_STATE_COUNT;
MACH_CALL(thread_get_state(thread,i386_THREAD_STATE,(thread_state_t) &state,&count),r);
- ts->eip = routine;
+ ts->eip = (int) routine;
*--top = (int) child; /* argument to function */
*--top = 0; /* fake return address */
ts->uesp = (int) top; /* set stack pointer */
@@ -127,12 +98,12 @@ cproc_setup(child, thread, routine)
MACH_CALL(thread_set_state(thread,i386_THREAD_STATE,(thread_state_t) &state,i386_THREAD_STATE_COUNT),r);
}
-#ifdef cthread_sp
+#if defined(cthread_sp)
#undef cthread_sp
#endif
int
-cthread_sp()
+cthread_sp(void)
{
return (int) __thread_stack_pointer ();
}