xref: /titanic_41/usr/src/lib/libc/i386/genassym.c (revision e4d060fb4c00d44cd578713eb9a921f594b733b8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <stdio.h>
30 #include <stddef.h>
31 #include <signal.h>
32 #include <ucontext.h>
33 #include <sys/stack.h>
34 #include <sys/synch.h>
35 #include <sys/synch32.h>
36 #include "thr_uberdata.h"
37 
38 /*
39  * This file generates two values used by _lwp_mutex_unlock.s:
40  *	a) the byte offset (in lwp_mutex_t) of the word containing the lock byte
41  *	b) a mask to extract the waiter field from the word containing it
42  * It also generates offsets into the ucontext_t structure, needed by the
43  * getcontext() function, which is written in assembly, as well as offsets
44  * into the ulwp_t (thread) structure needed by certain assembler functions.
45  */
46 
47 int
48 main(void)
49 {
50 	(void) printf("#define\tMUTEX_LOCK_WORD\t0x%x\n",
51 	    offsetof(lwp_mutex_t, mutex_lockword));
52 	(void) printf("#define\tWAITER_MASK\t0x00ff0000\n");
53 
54 	(void) printf("#define\tSIG_SETMASK\t0x%x\n", SIG_SETMASK);
55 	(void) printf("#define\tMASKSET0\t0x%x\n", MASKSET0);
56 	(void) printf("#define\tMASKSET1\t0x%x\n", MASKSET1);
57 	(void) printf("#define\tSIGSEGV\t0x%x\n", SIGSEGV);
58 
59 	(void) printf("#define\tEIP_OFF\t0x%x\n", EIP * 4);
60 	(void) printf("#define\tEAX_OFF\t0x%x\n", EAX * 4);
61 	(void) printf("#define\tUESP_OFF\t0x%x\n", UESP * 4);
62 
63 	return (0);
64 }
65