This source file includes following definitions.
- flat_get_addr_from_rp
- flat_put_addr_at_rp
1
2
3
4
5
6
7
8
9
10
11 #ifndef _ASM_MICROBLAZE_FLAT_H
12 #define _ASM_MICROBLAZE_FLAT_H
13
14 #include <asm/unaligned.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
31 u32 *addr)
32 {
33 u32 *p = (__force u32 *)rp;
34
35
36 if (relval & 0x80000000) {
37
38 u32 val_hi, val_lo;
39
40 val_hi = get_unaligned(p);
41 val_lo = get_unaligned(p+1);
42
43
44 *addr = ((val_hi & 0xffff) << 16) + (val_lo & 0xffff);
45 } else {
46
47 *addr = get_unaligned(p);
48 }
49
50 return 0;
51 }
52
53
54
55
56
57
58 static inline int
59 flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 relval)
60 {
61 u32 *p = (__force u32 *)rp;
62
63 if (relval & 0x80000000) {
64
65 unsigned long val_hi = get_unaligned(p);
66 unsigned long val_lo = get_unaligned(p + 1);
67
68
69 val_hi = (val_hi & 0xffff0000) | addr >> 16;
70 val_lo = (val_lo & 0xffff0000) | (addr & 0xffff);
71
72
73 put_unaligned(val_hi, p);
74 put_unaligned(val_lo, p+1);
75 } else {
76
77 put_unaligned(addr, p);
78 }
79 return 0;
80 }
81
82 #define flat_get_relocate_addr(rel) (rel & 0x7fffffff)
83
84 #endif