rtld_machdep.h revision 104724
192195Sjake/*-
292195Sjake * Copyright (c) 1999, 2000 John D. Polstra.
392195Sjake * All rights reserved.
492195Sjake *
592195Sjake * Redistribution and use in source and binary forms, with or without
692195Sjake * modification, are permitted provided that the following conditions
792195Sjake * are met:
892195Sjake * 1. Redistributions of source code must retain the above copyright
992195Sjake *    notice, this list of conditions and the following disclaimer.
1092195Sjake * 2. Redistributions in binary form must reproduce the above copyright
1192195Sjake *    notice, this list of conditions and the following disclaimer in the
1292195Sjake *    documentation and/or other materials provided with the distribution.
1392195Sjake *
1492195Sjake * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1592195Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1692195Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1792195Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1892195Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1992195Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2092195Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2192195Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2292195Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2392195Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2492195Sjake * SUCH DAMAGE.
2592195Sjake *
2692195Sjake * $FreeBSD: head/libexec/rtld-elf/sparc64/rtld_machdep.h 104724 2002-10-09 20:20:43Z ru $
2792195Sjake */
2892195Sjake
2992195Sjake#ifndef RTLD_MACHDEP_H
3092195Sjake#define RTLD_MACHDEP_H	1
3192195Sjake
32104724Sru#include <sys/types.h>
3392195Sjake#include <machine/atomic.h>
3492195Sjake
3592195Sjake#define	atomic_incr_int(p)	atomic_add_int((p), 1)
3692195Sjake#define	atomic_decr_int(p)	atomic_subtract_int((p), 1)
3792195Sjake
3892195Sjake/*
3992195Sjake * This value of CACHE_LINE_SIZE is conservative.  The actual size
4092195Sjake * is 32 on the  21064, 21064A, 21066, 21066A, and 21164.  It is 64
4192195Sjake * on the 21264.  Compaq recommends sequestering each lock in its own
4292195Sjake * 128-byte block to allow for future implementations with larger
4392195Sjake * cache lines.
4492195Sjake */
4592195Sjake#define CACHE_LINE_SIZE		128
4692195Sjake
4792195Sjakestruct Struct_Obj_Entry;
4892195Sjake
4992195Sjake/* Return the address of the .dynamic section in the dynamic linker. */
5092195Sjake#define rtld_dynamic(obj)	((Elf_Dyn *)(((char *)&_DYNAMIC) + (vm_offset_t)(obj)->relocbase))
5192195Sjake
5292195SjakeElf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr,
5392195Sjake		       const struct Struct_Obj_Entry *obj);
5492195Sjake
5592195Sjake#define make_function_pointer(def, defobj) \
5692195Sjake	((defobj)->relocbase + (def)->st_value)
5792195Sjake
5892195Sjake#define call_initfini_pointer(obj, target) \
5992195Sjake	(((InitFunc)(target))())
6092195Sjake
6192195Sjake#endif
62