aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-09-15 15:40:53 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-15 02:49:27 -0500
commitd60fdbce2b4b4cebe325b7f7a0f63beb2bf187be (patch)
tree9f2b566e82ea275703521b91445122af5b971ac0 /include
parenta6549f924353025134e331d1e611ff61c17e3a54 (diff)
downloadskiboot-d60fdbce2b4b4cebe325b7f7a0f63beb2bf187be.zip
skiboot-d60fdbce2b4b4cebe325b7f7a0f63beb2bf187be.tar.gz
skiboot-d60fdbce2b4b4cebe325b7f7a0f63beb2bf187be.tar.bz2
core: make is_rodata test-friendly
Add a dummy is_rodata() implementation for use inside test code. Currently we don't need to make this actually check if the given pointer is actually read-only, but someone might want it to work properly in the future. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/skiboot.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/skiboot.h b/include/skiboot.h
index 0ab9f38..3040c51 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -45,16 +45,23 @@
/* Special ELF sections */
#define __force_data __section(".force.data")
-/* Readonly section start and end. */
-extern char __rodata_start[], __rodata_end[];
-
struct mem_region;
extern struct mem_region *mem_region_next(struct mem_region *region);
+#ifndef __TESTING__
+/* Readonly section start and end. */
+extern char __rodata_start[], __rodata_end[];
+
static inline bool is_rodata(const void *p)
{
return ((const char *)p >= __rodata_start && (const char *)p < __rodata_end);
}
+#else
+static inline bool is_rodata(const void *p)
+{
+ return false;
+}
+#endif
#define OPAL_BOOT_COMPLETE 0x1
/* Debug descriptor. This structure is pointed to by the word at offset