aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/include')
-rw-r--r--arch/microblaze/include/asm/elf.h30
-rw-r--r--arch/microblaze/include/asm/flat.h90
2 files changed, 120 insertions, 0 deletions
diff --git a/arch/microblaze/include/asm/elf.h b/arch/microblaze/include/asm/elf.h
new file mode 100644
index 000000000000..81337f241347
--- /dev/null
+++ b/arch/microblaze/include/asm/elf.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2006 Atmark Techno, Inc.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8
9#ifndef _ASM_MICROBLAZE_ELF_H
10#define _ASM_MICROBLAZE_ELF_H
11
12/*
13 * Note there is no "official" ELF designation for Microblaze.
14 * I've snaffled the value from the microblaze binutils source code
15 * /binutils/microblaze/include/elf/microblaze.h
16 */
17#define EM_XILINX_MICROBLAZE 0xbaab
18#define ELF_ARCH EM_XILINX_MICROBLAZE
19
20/*
21 * This is used to ensure we don't load something for the wrong architecture.
22 */
23#define elf_check_arch(x) ((x)->e_machine == EM_XILINX_MICROBLAZE)
24
25/*
26 * These are used to set parameters in the core dumps.
27 */
28#define ELF_CLASS ELFCLASS32
29
30#endif /* _ASM_MICROBLAZE_ELF_H */
diff --git a/arch/microblaze/include/asm/flat.h b/arch/microblaze/include/asm/flat.h
new file mode 100644
index 000000000000..acf0da543ef1
--- /dev/null
+++ b/arch/microblaze/include/asm/flat.h
@@ -0,0 +1,90 @@
1/*
2 * uClinux flat-format executables
3 *
4 * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au>
5 *
6 * This file is subject to the terms and conditions of the GNU General
7 * Public License. See the file COPYING in the main directory of this
8 * archive for more details.
9 */
10
11#ifndef _ASM_MICROBLAZE_FLAT_H
12#define _ASM_MICROBLAZE_FLAT_H
13
14#include <asm/unaligned.h>
15
16#define flat_stack_align(sp) /* nothing needed */
17#define flat_argvp_envp_on_stack() 0
18#define flat_old_ram_flag(flags) (flags)
19#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
20#define flat_set_persistent(relval, p) 0
21
22/*
23 * Microblaze works a little differently from other arches, because
24 * of the MICROBLAZE_64 reloc type. Here, a 32 bit address is split
25 * over two instructions, an 'imm' instruction which provides the top
26 * 16 bits, then the instruction "proper" which provides the low 16
27 * bits.
28 */
29
30/*
31 * Crack open a symbol reference and extract the address to be
32 * relocated. rp is a potentially unaligned pointer to the
33 * reference
34 */
35
36static inline unsigned long
37flat_get_addr_from_rp(unsigned long *rp, unsigned long relval,
38 unsigned long flags, unsigned long *persistent)
39{
40 unsigned long addr;
41 (void)flags;
42
43 /* Is it a split 64/32 reference? */
44 if (relval & 0x80000000) {
45 /* Grab the two halves of the reference */
46 unsigned long val_hi, val_lo;
47
48 val_hi = get_unaligned(rp);
49 val_lo = get_unaligned(rp+1);
50
51 /* Crack the address out */
52 addr = ((val_hi & 0xffff) << 16) + (val_lo & 0xffff);
53 } else {
54 /* Get the address straight out */
55 addr = get_unaligned(rp);
56 }
57
58 return addr;
59}
60
61/*
62 * Insert an address into the symbol reference at rp. rp is potentially
63 * unaligned.
64 */
65
66static inline void
67flat_put_addr_at_rp(unsigned long *rp, unsigned long addr, unsigned long relval)
68{
69 /* Is this a split 64/32 reloc? */
70 if (relval & 0x80000000) {
71 /* Get the two "halves" */
72 unsigned long val_hi = get_unaligned(rp);
73 unsigned long val_lo = get_unaligned(rp + 1);
74
75 /* insert the address */
76 val_hi = (val_hi & 0xffff0000) | addr >> 16;
77 val_lo = (val_lo & 0xffff0000) | (addr & 0xffff);
78
79 /* store the two halves back into memory */
80 put_unaligned(val_hi, rp);
81 put_unaligned(val_lo, rp+1);
82 } else {
83 /* Put it straight in, no messing around */
84 put_unaligned(addr, rp);
85 }
86}
87
88#define flat_get_relocate_addr(rel) (rel & 0x7fffffff)
89
90#endif /* _ASM_MICROBLAZE_FLAT_H */