Root/target/linux/ubicom32/files/arch/ubicom32/include/asm/flat.h

1/*
2 * arch/ubicom32/include/asm/flat.h
3 * Definitions to support flat-format executables.
4 *
5 * (C) Copyright 2009, Ubicom, Inc.
6 *
7 * This file is part of the Ubicom32 Linux Kernel Port.
8 *
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
22 *
23 * Ubicom32 implementation derived from (with many thanks):
24 * arch/m68knommu
25 * arch/blackfin
26 * arch/parisc
27 */
28
29#ifndef _ASM_UBICOM32_FLAT_H
30#define _ASM_UBICOM32_FLAT_H
31
32#define ARCH_FLAT_ALIGN 0x80
33#define ARCH_FLAT_ALIGN_TEXT 1
34
35#define R_UBICOM32_32 2
36#define R_UBICOM32_HI24 7
37#define R_UBICOM32_LO7_S 8
38#define R_UBICOM32_LO7_2_S 9
39#define R_UBICOM32_LO7_4_S 10
40#define R_UBICOM32_LO7_D 11
41#define R_UBICOM32_LO7_2_D 12
42#define R_UBICOM32_LO7_4_D 13
43#define R_UBICOM32_LO7_CALLI 15
44#define R_UBICOM32_LO16_CALLI 16
45
46extern void ubicom32_flat_put_addr_at_rp(unsigned long *rp, u32_t val, u32_t rval, unsigned long *p);
47extern unsigned long ubicom32_flat_get_addr_from_rp(unsigned long *rp, u32_t relval, u32_t flags, unsigned long *p);
48
49#define flat_stack_align(sp) /* nothing needed */
50#define flat_argvp_envp_on_stack() 1
51#define flat_old_ram_flag(flags) (flags)
52#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
53#define flat_get_addr_from_rp(rp, relval, flags, p) (ubicom32_flat_get_addr_from_rp(rp, relval,flags, p))
54#define flat_put_addr_at_rp(rp, val, relval) do {ubicom32_flat_put_addr_at_rp(rp, val, relval, &persistent);} while(0)
55#define flat_get_relocate_addr(rel) ((persistent) ? (persistent & 0x07ffffff) : (rel & 0x07ffffff))
56
57static inline int flat_set_persistent(unsigned int relval, unsigned long *p)
58{
59    if (*p) {
60        return 0;
61    } else {
62        if ((relval >> 27) != R_UBICOM32_32) {
63            /*
64             * Something other than UBICOM32_32. The next entry has the relocation.
65             */
66            *p = relval;
67            return 1;
68        }
69    }
70    return 0;
71}
72
73#endif /* _ASM_UBICOM32_FLAT_H */
74

Archive Download this file



interactive