| 1 |
1534 |
robertmh |
/* Assembly macros for 32-bit OpenRISC.
|
| 2 |
|
|
Copyright (C) 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
|
| 3 |
|
|
This file is part of the GNU C Library.
|
| 4 |
|
|
|
| 5 |
|
|
Based on sysdeps/powerpc/sysdep.h
|
| 6 |
|
|
|
| 7 |
|
|
The GNU C Library is free software; you can redistribute it and/or
|
| 8 |
|
|
modify it under the terms of the GNU Lesser General Public
|
| 9 |
|
|
License as published by the Free Software Foundation; either
|
| 10 |
|
|
version 2.1 of the License, or (at your option) any later version.
|
| 11 |
|
|
|
| 12 |
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
| 13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 15 |
|
|
Lesser General Public License for more details.
|
| 16 |
|
|
|
| 17 |
|
|
You should have received a copy of the GNU Lesser General Public
|
| 18 |
|
|
License along with the GNU C Library; if not, write to the Free
|
| 19 |
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
| 20 |
|
|
02111-1307 USA. */
|
| 21 |
|
|
|
| 22 |
|
|
/* FIXME: this file is severely fucked */
|
| 23 |
|
|
|
| 24 |
|
|
#ifdef __ASSEMBLER__
|
| 25 |
|
|
|
| 26 |
|
|
#ifdef __ELF__
|
| 27 |
|
|
|
| 28 |
|
|
#if 1
|
| 29 |
|
|
/* This seems to always be the case on PPC. (FIXME: maybe too on or32?) */
|
| 30 |
|
|
#define ALIGNARG(log2) log2
|
| 31 |
|
|
/* For ELF we need the `.type' directive to make shared libs work right. */
|
| 32 |
|
|
#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
|
| 33 |
|
|
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
|
| 34 |
|
|
#endif
|
| 35 |
|
|
|
| 36 |
|
|
/* FIXME: support PIC / PROF */
|
| 37 |
|
|
#define CALL_MCOUNT /* Do nothing. */
|
| 38 |
|
|
|
| 39 |
|
|
#define ENTRY(name) \
|
| 40 |
|
|
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
|
| 41 |
|
|
ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
|
| 42 |
|
|
.align ALIGNARG(2); \
|
| 43 |
|
|
C_LABEL(name) \
|
| 44 |
|
|
CALL_MCOUNT
|
| 45 |
|
|
|
| 46 |
|
|
#define EALIGN_W_0 /* No words to insert. */
|
| 47 |
|
|
#define EALIGN_W_1 l.nop
|
| 48 |
|
|
#define EALIGN_W_2 l.nop;l.nop
|
| 49 |
|
|
#define EALIGN_W_3 l.nop;l.nop;l.nop
|
| 50 |
|
|
#define EALIGN_W_4 EALIGN_W_3;l.nop
|
| 51 |
|
|
#define EALIGN_W_5 EALIGN_W_4;l.nop
|
| 52 |
|
|
#define EALIGN_W_6 EALIGN_W_5;l.nop
|
| 53 |
|
|
#define EALIGN_W_7 EALIGN_W_6;l.nop
|
| 54 |
|
|
|
| 55 |
|
|
/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
|
| 56 |
|
|
past a 2^align boundary. */
|
| 57 |
|
|
#ifdef PROF
|
| 58 |
|
|
#define EALIGN(name, alignt, words) \
|
| 59 |
|
|
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
|
| 60 |
|
|
ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
|
| 61 |
|
|
.align ALIGNARG(2); \
|
| 62 |
|
|
C_LABEL(name) \
|
| 63 |
|
|
CALL_MCOUNT \
|
| 64 |
|
|
b 0f; \
|
| 65 |
|
|
.align ALIGNARG(alignt); \
|
| 66 |
|
|
EALIGN_W_##words; \
|
| 67 |
|
|
0:
|
| 68 |
|
|
#else /* PROF */
|
| 69 |
|
|
#define EALIGN(name, alignt, words) \
|
| 70 |
|
|
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
|
| 71 |
|
|
ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
|
| 72 |
|
|
.align ALIGNARG(alignt); \
|
| 73 |
|
|
EALIGN_W_##words; \
|
| 74 |
|
|
C_LABEL(name)
|
| 75 |
|
|
#endif
|
| 76 |
|
|
|
| 77 |
|
|
#undef END
|
| 78 |
|
|
#define END(name) \
|
| 79 |
|
|
ASM_SIZE_DIRECTIVE(name)
|
| 80 |
|
|
|
| 81 |
|
|
/* FIXME */
|
| 82 |
|
|
#define DO_CALL
|
| 83 |
|
|
|
| 84 |
|
|
#ifdef PIC
|
| 85 |
|
|
#define JUMPTARGET(name) name##@plt
|
| 86 |
|
|
#else
|
| 87 |
|
|
#define JUMPTARGET(name) name
|
| 88 |
|
|
#endif
|
| 89 |
|
|
|
| 90 |
|
|
#define PSEUDO(name, syscall_name, args) \
|
| 91 |
|
|
.section ".text"; \
|
| 92 |
|
|
ENTRY (name) \
|
| 93 |
|
|
DO_CALL (SYS_ify (syscall_name));
|
| 94 |
|
|
|
| 95 |
|
|
#define PSEUDO_RET \
|
| 96 |
|
|
l.j JUMPTARGET(__syscall_error)
|
| 97 |
|
|
#define ret PSEUDO_RET
|
| 98 |
|
|
|
| 99 |
|
|
#undef PSEUDO_END
|
| 100 |
|
|
#define PSEUDO_END(name) \
|
| 101 |
|
|
END (name)
|
| 102 |
|
|
|
| 103 |
|
|
/* Local labels stripped out by the linker. */
|
| 104 |
|
|
#undef L
|
| 105 |
|
|
#define L(x) .L##x
|
| 106 |
|
|
|
| 107 |
|
|
/* Label in text section. */
|
| 108 |
|
|
#define C_TEXT(name) name
|
| 109 |
|
|
|
| 110 |
|
|
#endif /* __ELF__ */
|
| 111 |
|
|
|
| 112 |
|
|
#endif /* __ASSEMBLER__ */
|