1139735Simp/*-
2263056Sian * Copyright (c) 2012 Olivier Houchard <cognet@FreeBSD.org>
3129198Scognet * All rights reserved.
4129198Scognet *
5129198Scognet * Redistribution and use in source and binary forms, with or without
6129198Scognet * modification, are permitted provided that the following conditions
7129198Scognet * are met:
8129198Scognet * 1. Redistributions of source code must retain the above copyright
9129198Scognet *    notice, this list of conditions and the following disclaimer.
10129198Scognet * 2. Redistributions in binary form must reproduce the above copyright
11129198Scognet *    notice, this list of conditions and the following disclaimer in the
12129198Scognet *    documentation and/or other materials provided with the distribution.
13129198Scognet *
14263056Sian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15263056Sian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16263056Sian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17263056Sian * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18263056Sian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19263056Sian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20263056Sian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21129198Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22129198Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23129198Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24129198Scognet * SUCH DAMAGE.
25129198Scognet *
26129198Scognet * $FreeBSD$
27129198Scognet */
28129198Scognet
29129198Scognet#ifndef	_MACHINE_ASMACROS_H_
30129198Scognet#define	_MACHINE_ASMACROS_H_
31129198Scognet
32239268Sgonzo#include <machine/asm.h>
33239268Sgonzo
34129198Scognet#ifdef _KERNEL
35129198Scognet
36129198Scognet#ifdef LOCORE
37129198Scognet
38239268Sgonzo#ifdef _ARM_ARCH_6
39239268Sgonzo#define GET_CURTHREAD_PTR(tmp) \
40261415Scognet    	mrc	p15, 0, tmp, c13, c0, 4
41239268Sgonzo#else
42262986Sian#define GET_CURTHREAD_PTR(tmp)	\
43262986Sian	ldr	tmp, =_C_LABEL(__pcpu);\
44262986Sian	ldr	tmp, [tmp, #PC_CURTHREAD]
45239268Sgonzo#endif
46239268Sgonzo
47273251Sandrew#define	ELFNOTE(section, type, vendor, desctype, descdata...)	  \
48273251Sandrew	.pushsection section					; \
49273251Sandrew	    .balign 4						; \
50273251Sandrew	    .long 2f - 1f		/* namesz */		; \
51273251Sandrew	    .long 4f - 3f		/* descsz */		; \
52273251Sandrew	    .long type			/* type */		; \
53273251Sandrew	    1: .asciz vendor		/* vendor name */	; \
54273251Sandrew	    2: .balign 4					; \
55273251Sandrew	    3:  desctype descdata	/* node */		; \
56273251Sandrew	    4: .balign 4					; \
57273251Sandrew	.popsection
58273251Sandrew
59129198Scognet#endif /* LOCORE */
60129198Scognet
61129198Scognet#endif /* _KERNEL */
62129198Scognet
63129198Scognet#endif /* !_MACHINE_ASMACROS_H_ */
64