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