1ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes/*
2ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * Copyright (C) 2013 The Android Open Source Project
3ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * All rights reserved.
4ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes *
5ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * Redistribution and use in source and binary forms, with or without
6ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * modification, are permitted provided that the following conditions
7ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * are met:
8ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes *  * Redistributions of source code must retain the above copyright
9ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes *    notice, this list of conditions and the following disclaimer.
10ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes *  * Redistributions in binary form must reproduce the above copyright
11ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes *    notice, this list of conditions and the following disclaimer in
12ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes *    the documentation and/or other materials provided with the
13ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes *    distribution.
14ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes *
15ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes * SUCH DAMAGE.
27ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes */
28ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes
29ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes#ifndef _PRIVATE_BIONIC_ASM_H_
30ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes#define _PRIVATE_BIONIC_ASM_H_
31ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes
32ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes#include <asm/unistd.h> /* For system call numbers. */
33ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes#define MAX_ERRNO 4095  /* For recognizing system call error returns. */
34ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes
35851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes#define __bionic_asm_custom_entry(f)
36851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes#define __bionic_asm_custom_end(f)
37851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes#define __bionic_asm_function_type @function
38851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes
39851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes#include <machine/asm.h>
40851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes
41851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes#define ENTRY(f) \
42851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    .text; \
43851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    .globl f; \
44851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    _ALIGN_TEXT; \
45851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    .type f, __bionic_asm_function_type; \
46851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    f: \
47851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    __bionic_asm_custom_entry(f); \
48851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    .cfi_startproc \
49851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes
50851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes#define END(f) \
51851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    .cfi_endproc; \
52851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    .size f, .-f; \
53851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    __bionic_asm_custom_end(f) \
549abbbdc5346020e33a8fdbe7254dd0fdff9df616Elliott Hughes
55851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes/* Like ENTRY, but with hidden visibility. */
56851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes#define ENTRY_PRIVATE(f) \
57851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    ENTRY(f); \
58851e68a2402fa414544e66650e09dfdaac813e51Elliott Hughes    .hidden f \
59ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes
60ed74484dcbc2e156a6e5fa861a62425b12e55128Elliott Hughes#endif /* _PRIVATE_BIONIC_ASM_H_ */
61