.. | .. |
---|
60 | 60 | |
---|
61 | 61 | /* Function descriptor handling (if any). Override in asm/sections.h */ |
---|
62 | 62 | #ifndef dereference_function_descriptor |
---|
63 | | -#define dereference_function_descriptor(p) (p) |
---|
64 | | -#define dereference_kernel_function_descriptor(p) (p) |
---|
| 63 | +#define dereference_function_descriptor(p) ((void *)(p)) |
---|
| 64 | +#define dereference_kernel_function_descriptor(p) ((void *)(p)) |
---|
65 | 65 | #endif |
---|
66 | 66 | |
---|
67 | 67 | /* random extra sections (if any). Override |
---|
.. | .. |
---|
75 | 75 | |
---|
76 | 76 | #ifndef arch_is_kernel_data |
---|
77 | 77 | static inline int arch_is_kernel_data(unsigned long addr) |
---|
| 78 | +{ |
---|
| 79 | + return 0; |
---|
| 80 | +} |
---|
| 81 | +#endif |
---|
| 82 | + |
---|
| 83 | +/* |
---|
| 84 | + * Check if an address is part of freed initmem. This is needed on architectures |
---|
| 85 | + * with virt == phys kernel mapping, for code that wants to check if an address |
---|
| 86 | + * is part of a static object within [_stext, _end]. After initmem is freed, |
---|
| 87 | + * memory can be allocated from it, and such allocations would then have |
---|
| 88 | + * addresses within the range [_stext, _end]. |
---|
| 89 | + */ |
---|
| 90 | +#ifndef arch_is_kernel_initmem_freed |
---|
| 91 | +static inline int arch_is_kernel_initmem_freed(unsigned long addr) |
---|
78 | 92 | { |
---|
79 | 93 | return 0; |
---|
80 | 94 | } |
---|
.. | .. |
---|
100 | 114 | /** |
---|
101 | 115 | * memory_intersects - checks if the region occupied by an object intersects |
---|
102 | 116 | * with another memory region |
---|
103 | | - * @begin: virtual address of the beginning of the memory regien |
---|
| 117 | + * @begin: virtual address of the beginning of the memory region |
---|
104 | 118 | * @end: virtual address of the end of the memory region |
---|
105 | 119 | * @virt: virtual address of the memory object |
---|
106 | 120 | * @size: size of the memory object |
---|
.. | .. |
---|
113 | 127 | { |
---|
114 | 128 | void *vend = virt + size; |
---|
115 | 129 | |
---|
116 | | - return (virt >= begin && virt < end) || (vend >= begin && vend < end); |
---|
| 130 | + if (virt < end && vend > begin) |
---|
| 131 | + return true; |
---|
| 132 | + |
---|
| 133 | + return false; |
---|
117 | 134 | } |
---|
118 | 135 | |
---|
119 | 136 | /** |
---|
.. | .. |
---|
144 | 161 | return memory_intersects(__init_begin, __init_end, virt, size); |
---|
145 | 162 | } |
---|
146 | 163 | |
---|
| 164 | +/** |
---|
| 165 | + * is_kernel_rodata - checks if the pointer address is located in the |
---|
| 166 | + * .rodata section |
---|
| 167 | + * |
---|
| 168 | + * @addr: address to check |
---|
| 169 | + * |
---|
| 170 | + * Returns: true if the address is located in .rodata, false otherwise. |
---|
| 171 | + */ |
---|
| 172 | +static inline bool is_kernel_rodata(unsigned long addr) |
---|
| 173 | +{ |
---|
| 174 | + return addr >= (unsigned long)__start_rodata && |
---|
| 175 | + addr < (unsigned long)__end_rodata; |
---|
| 176 | +} |
---|
| 177 | + |
---|
147 | 178 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ |
---|