/[hurd]/hurd/libthreads/i386/thread.c
ViewVC logotype

Diff of /hurd/libthreads/i386/thread.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by roland, Sat Dec 22 21:02:31 2001 UTC revision 1.7 by roland, Mon May 27 02:50:10 2002 UTC
# Line 1  Line 1 
1  /*  /*
2   * Mach Operating System   * Mach Operating System
3   * Copyright (c) 1991,1990 Carnegie Mellon University   * Copyright (c) 1992,1991,1990 Carnegie Mellon University
4   * All Rights Reserved.   * All Rights Reserved.
5   *   *
6   * Permission to use, copy, modify and distribute this software and its   * Permission to use, copy, modify and distribute this software and its
# Line 26  Line 26 
26  /*  /*
27   * HISTORY   * HISTORY
28   * $Log$   * $Log$
29   * Revision 1.6  2001/12/22 21:02:31  roland   * Revision 1.7  2002/05/27 02:50:10  roland
30   * 2001-12-22  Roland McGrath  <roland@frob.com>   * 2002-05-26  Roland McGrath  <roland@frob.com>
31   *   *
32   *      * i386/thread.c (cthread_sp): Use __thread_stack_pointer.   *      Changes merged from CMU MK83a version:
33   *   *      * cthreads.h, options.h: Various cleanups.
34   * Revision 1.5  2001/03/31 23:03:03  roland   *      * call.c, cthread_data.c, sync.c, mig_support.c: Likewise.
35   * 2001-03-31  Roland McGrath  <roland@frob.com>   *      * i386/cthreads.h, i386/thread.c, i386/lock.s: Likewise.
36   *   *      * cthread_internals.h: Add decls for internal functions.
37   *      * cthreads.h: Fix obsolescent #endif syntax.   *      (struct cproc): Use vm_offset_t for stack_base and stack_size members.
38   *      * cthread_internals.h: Likewise.   *      Use natural_t for context member.
39   *      * cancel-cond.c: Likewise.   *      * cprocs.c: Use prototypes for all defns.
  *      * stack.c: Likewise.  
40   *      * cthreads.c: Likewise.   *      * cthreads.c: Likewise.
41   *      * cprocs.c: Likewise.   *      (cthread_exit): Cast any_t to integer_t before int.
  *      * 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.  
42   *   *
43   * Revision 1.2  1994/05/04 19:05:26  mib   * Revision 2.8  93/02/02  21:54:58  mrt
44   * entered into RCS   *      Changed include of mach/mach.h to mach.h.
45     *      [93/02/02            mrt]
46     *
47     * Revision 2.7  93/01/14  18:05:15  danner
48     *      Converted file to ANSI C.
49     *      Fixed argument types.
50     *      [92/12/18            pds]
51   *   *
52   * Revision 2.6  91/07/31  18:37:07  dbg   * Revision 2.6  91/07/31  18:37:07  dbg
53   *      Undefine cthread_sp macro around function definition.   *      Undefine cthread_sp macro around function definition.
54   *      [91/07/30  17:36:23  dbg]   *      [91/07/30  17:36:23  dbg]
55   *   *
  * 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]  
  *  
56   * Revision 2.3  90/06/02  15:13:53  rpd   * Revision 2.3  90/06/02  15:13:53  rpd
57   *      Added definition of cthread_sp.   *      Added definition of cthread_sp.
58   *      [90/06/02            rpd]   *      [90/06/02            rpd]
# Line 83  Line 68 
68   */   */
69    
70  #ifndef lint  #ifndef lint
71  static char rcs_id[] = "$Header$";  char rcs_id[] = "$Header$";
72  #endif  /* not lint */  #endif  /* not lint */
73    
74    
75  #include "../cthreads.h"  #include <cthreads.h>
76  #include "../cthread_internals.h"  #include "cthread_internals.h"
77  #include <strings.h>  #include <mach.h>
 #include <mach/mach.h>  
   
78    
79  /*  /*
80   * Set up the initial state of a MACH thread   * Set up the initial state of a MACH thread
# Line 99  static char rcs_id[] = "$Header$"; Line 82  static char rcs_id[] = "$Header$";
82   * when it is resumed.   * when it is resumed.
83   */   */
84  void  void
85  cproc_setup(child, thread, routine)  cproc_setup(register cproc_t child, thread_t thread, void (*routine)(cproc_t))
         register cproc_t child;  
         int thread;  
         int routine;  
86  {  {
87          extern unsigned int __hurd_threadvar_max; /* GNU */          extern unsigned int __hurd_threadvar_max; /* GNU */
88          register int *top = (int *)          register int *top = (int *)
# Line 123  cproc_setup(child, thread, routine) Line 103  cproc_setup(child, thread, routine)
103          count = i386_THREAD_STATE_COUNT;          count = i386_THREAD_STATE_COUNT;
104          MACH_CALL(thread_get_state(thread,i386_THREAD_STATE,(thread_state_t) &state,&count),r);          MACH_CALL(thread_get_state(thread,i386_THREAD_STATE,(thread_state_t) &state,&count),r);
105    
106          ts->eip = routine;          ts->eip = (int) routine;
107          *--top = (int) child;   /* argument to function */          *--top = (int) child;   /* argument to function */
108          *--top = 0;             /* fake return address */          *--top = 0;             /* fake return address */
109          ts->uesp = (int) top;   /* set stack pointer */          ts->uesp = (int) top;   /* set stack pointer */
# Line 132  cproc_setup(child, thread, routine) Line 112  cproc_setup(child, thread, routine)
112          MACH_CALL(thread_set_state(thread,i386_THREAD_STATE,(thread_state_t) &state,i386_THREAD_STATE_COUNT),r);          MACH_CALL(thread_set_state(thread,i386_THREAD_STATE,(thread_state_t) &state,i386_THREAD_STATE_COUNT),r);
113  }  }
114    
115  #ifdef  cthread_sp  #if     defined(cthread_sp)
116  #undef  cthread_sp  #undef  cthread_sp
117  #endif  #endif
118    
119  int  int
120  cthread_sp()  cthread_sp(void)
121  {  {
122          return (int) __thread_stack_pointer ();          return (int) __thread_stack_pointer ();
123  }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26