ibcs2_util.h revision 11394
111394Sswallace 211394Sswallace/* 311394Sswallace * Copyright (c) 1994 Christos Zoulas 411394Sswallace * Copyright (c) 1995 Frank van der Linden 511394Sswallace * Copyright (c) 1995 Scott Bartram 611394Sswallace * All rights reserved. 711394Sswallace * 811394Sswallace * Redistribution and use in source and binary forms, with or without 911394Sswallace * modification, are permitted provided that the following conditions 1011394Sswallace * are met: 1111394Sswallace * 1. Redistributions of source code must retain the above copyright 1211394Sswallace * notice, this list of conditions and the following disclaimer. 1311394Sswallace * 2. Redistributions in binary form must reproduce the above copyright 1411394Sswallace * notice, this list of conditions and the following disclaimer in the 1511394Sswallace * documentation and/or other materials provided with the distribution. 1611394Sswallace * 3. The name of the author may not be used to endorse or promote products 1711394Sswallace * derived from this software without specific prior written permission 1811394Sswallace * 1911394Sswallace * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2011394Sswallace * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2111394Sswallace * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2211394Sswallace * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2311394Sswallace * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2411394Sswallace * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2511394Sswallace * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2611394Sswallace * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2711394Sswallace * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2811394Sswallace * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2911394Sswallace * 3011394Sswallace * from: svr4_util.h,v 1.5 1994/11/18 02:54:31 christos Exp 3111394Sswallace * from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp 3211394Sswallace */ 3311394Sswallace 3411394Sswallace/* 3511394Sswallace * This file is pretty much the same as Christos' svr4_util.h 3611394Sswallace * (for now). 3711394Sswallace */ 3811394Sswallace 3911394Sswallace#ifndef _IBCS2_UTIL_H_ 4011394Sswallace#define _IBCS2_UTIL_H_ 4111394Sswallace 4211394Sswallace#include <machine/vmparam.h> 4311394Sswallace#include <sys/exec.h> 4411394Sswallace#include <sys/cdefs.h> 4511394Sswallace 4611394Sswallacestatic __inline caddr_t 4711394Sswallacestackgap_init() 4811394Sswallace{ 4911394Sswallace extern char sigcode[], esigcode[]; 5011394Sswallace#define szsigcode ((caddr_t)(esigcode - sigcode)) 5111394Sswallace return STACKGAPBASE; 5211394Sswallace} 5311394Sswallace 5411394Sswallace 5511394Sswallacestatic __inline void * 5611394Sswallacestackgap_alloc(sgp, sz) 5711394Sswallace caddr_t *sgp; 5811394Sswallace size_t sz; 5911394Sswallace{ 6011394Sswallace void *p = (void *) *sgp; 6111394Sswallace *sgp += ALIGN(sz); 6211394Sswallace return p; 6311394Sswallace} 6411394Sswallace 6511394Sswallace#ifdef DEBUG_IBCS2 6611394Sswallace#define DPRINTF(a) printf a; 6711394Sswallace#else 6811394Sswallace#define DPRINTF(a) 6911394Sswallace#endif 7011394Sswallace 7111394Sswallaceextern const char ibcs2_emul_path[]; 7211394Sswallace 7311394Sswallaceint ibcs2_emul_find __P((struct proc *, caddr_t *, const char *, char *, 7411394Sswallace char **, int)); 7511394Sswallace 7611394Sswallace#define CHECKALTEXIST(p, sgp, path) \ 7711394Sswallace ibcs2_emul_find(p, sgp, ibcs2_emul_path, path, &(path), 0) 7811394Sswallace 7911394Sswallace#define CHECKALTCREAT(p, sgp, path) \ 8011394Sswallace ibcs2_emul_find(p, sgp, ibcs2_emul_path, path, &(path), 1) 8111394Sswallace 8211394Sswallace#endif /* !_IBCS2_UTIL_H_ */ 83