]> git.saurik.com Git - apple/libc.git/blame - i386/threads/thread.c
Libc-262.2.12.tar.gz
[apple/libc.git] / i386 / threads / thread.c
CommitLineData
e9ce8d39
A
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
734aad71 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
e9ce8d39 7 *
734aad71
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
e9ce8d39
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
734aad71
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
e9ce8d39
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*
26 * Mach Operating System
27 * Copyright (c) 1989 Carnegie-Mellon University
28 * All rights reserved. The CMU software License Agreement specifies
29 * the terms and conditions for use and redistribution.
30 */
31
32/*
33 * 386/thread.c
34 *
35 * Cproc startup for 386 MTHREAD implementation.
36 */
37
38#include <cthreads.h>
39#include <mach/mach.h>
40#include <mach/i386/thread_status.h>
41#include "cthread_internals.h"
42
43void
44_pthread_set_self(p)
45 cproc_t p;
46{
47 asm("pushl %0" : : "m" (p));
48 asm("pushl $0"); // fake the kernel out
49 asm("movl $1, %%eax" : : : "ax");
50 asm("lcall $0x3b, $0");
5b2abdfb 51 asm("addl $0x8, %%esp" ::);
e9ce8d39
A
52}
53
54void *
3b2a1fe8 55pthread_self()
e9ce8d39
A
56{
57 asm("movl $0, %eax");
58 asm("lcall $0x3b, $0");
59}