diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2014-12-15 20:09:28 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2014-12-15 20:09:28 +0000 |
commit | d1219c0e89d2dc4ac865889cbd23f5e4c64d86e5 (patch) | |
tree | d12eaa34998fb35d2637f1d17364281672ba1512 /libgloss/or1k/include | |
parent | 6485fc66f2fada39e681ad316352f60a17ac1367 (diff) | |
download | cygnal-d1219c0e89d2dc4ac865889cbd23f5e4c64d86e5.tar.gz cygnal-d1219c0e89d2dc4ac865889cbd23f5e4c64d86e5.tar.bz2 cygnal-d1219c0e89d2dc4ac865889cbd23f5e4c64d86e5.zip |
2014-12-15 Stefan Wallentowitz <stefan.wallentowitz@tum.de>
* README: Add details about or1k.
* configure.in: Add or1k/or1knd
* configure: Regenerated.
* or1k/aclocal.m4: New file.
* or1k/configure: Ditto.
* or1k/Makefile.in: New file
* or1k/configure.in: New file
* or1k/crt0.S: New file
* or1k/include/or1k-asm.h: New file
Diffstat (limited to 'libgloss/or1k/include')
-rw-r--r-- | libgloss/or1k/include/or1k-asm.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/libgloss/or1k/include/or1k-asm.h b/libgloss/or1k/include/or1k-asm.h new file mode 100644 index 000000000..c218c64fe --- /dev/null +++ b/libgloss/or1k/include/or1k-asm.h @@ -0,0 +1,83 @@ +/* or1k-asm.h -- OR1K assembly helper macros + + Copyright (c) 2014 OpenRISC Project Maintainers + Copyright (C) 2012-2014 Peter Gavin <pgavin@gmail.com> + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following condition + is met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + + */ + +#ifndef OR1K_ASM_H +#define OR1K_ASM_H + +/* The purpose of the OR1K_INST macro is simply to protect the commas + embedded within an instruction from the C preprocessor. An entire + instruction can be safely embedded within its arguments, including + an arbitrary number of commas, and it will be reproduced + exactly. */ +#define OR1K_INST(...) __VA_ARGS__ + +/* OR1K_DELAYED takes two arguments which must be instructions. They + should be wrapped in OR1K_INST if the instructions require commas. + The second argument should be a jump or branch instruction. If we + are assembling the code in delay-slot mode (e.g., for the standard + OR1K) the first instruction will be emitted in the delay slot of + the second instruction. In no-delay-slot mode they will be emitted + in order. If we are using compat-delay mode, they will be emitted + in order, but an l.nop instruction will be emitted immediately + after. */ + +/* OR1K_DELAYED_NOP takes a single argument, which should be a + branch/jump instruction. In delay-slot or compat-delay modes, the + instruction will be emitted with an l.nop in its delay slot. In + no-delay mode, the instruction will be emitted by itself. */ + +#if defined(__OR1K_NODELAY__) + +#define OR1K_DELAYED(a, b) a; b +#define OR1K_DELAYED_NOP(a) a + +/* Go ahead and emit the .nodelay directive when in no-delay mode, so + that the flags are appropriately set in the binary. */ +.nodelay + +#elif defined(__OR1K_DELAY__) + +#define OR1K_DELAYED(a, b) b; a +#define OR1K_DELAYED_NOP(a) a; l.nop + +#elif defined(__OR1K_DELAY_COMPAT__) + +#define OR1K_DELAYED(a, b) a; b; l.nop +#define OR1K_DELAYED_NOP(a) a; l.nop + +#else + +#error One of __OR1K_NODELAY__, __OR1K_DELAY__, or __OR1K_DELAY_COMPAT__ must be defined + +#endif + +#define LOAD_SYMBOL_2_GPR(gpr,symbol) \ + .global symbol ; \ + l.movhi gpr, hi(symbol) ; \ + l.ori gpr, gpr, lo(symbol) +#endif |