[Skiboot] [PATCH 08/14] core: make is_rodata test-friendly
Oliver O'Halloran
oohall at gmail.com
Fri Sep 15 15:40:53 AEST 2017
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 at gmail.com>
---
include/skiboot.h | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/skiboot.h b/include/skiboot.h
index 0ab9f3883973..3040c5175125 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
--
2.9.5
More information about the Skiboot
mailing list