There are some times when access to 0 is really needed. Use the linker to
work around NULL pointer logic in the compiler.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
}
}
+/*
+ * Linker games to use virtual addresses at 0 without triggering NULL pointer
+ * "logic" and associated compiler optimisations.
+ */
+zeroptr = 0;
+
ASSERT(IS_ALIGNED(hypercall_page, PAGE_SIZE), "hypercall_page misaligned");
ASSERT(IS_ALIGNED(boot_stack, PAGE_SIZE), "boot_stack misaligned");
+/**
+ * @file include/xtf/types.h
+ *
+ * Common declarations for all tests.
+ */
#ifndef XTF_TYPES_H
#define XTF_TYPES_H
#include <stddef.h>
#include <inttypes.h>
+/**
+ * An array which the linker resolves to 0.
+ *
+ * For use instead of NULL when access to 0 is really needed, without
+ * triggering NULL pointer logic in the compiler.
+ */
+extern char zeroptr[];
+
#endif /* !__ASSEMBLY__ */
#endif /* XTF_TYPES_H */