Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F132973141
D16145.id45385.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D16145.id45385.diff
View Options
Index: head/sys/sys/pcpu.h
===================================================================
--- head/sys/sys/pcpu.h
+++ head/sys/sys/pcpu.h
@@ -84,8 +84,26 @@
/* struct _hack is to stop this from being used with the static keyword. */
#define DPCPU_DEFINE(t, n) \
struct _hack; t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
+#if defined(KLD_MODULE) && defined(__aarch64__)
+/*
+ * On some architectures the compiler will use PC-relative load to
+ * find the address of DPCPU data with the static keyword. We then
+ * use this to find the offset of the data in a per-CPU region.
+ * This works for in the kernel as we can allocate the space ahead
+ * of time, however modules need to allocate a sepatate space and
+ * then use relocations to fix the address of the data. As
+ * PC-relative data doesn't have a relocation there is nothing for
+ * the kernel module linker to fix so data is accessed from the
+ * wrong location.
+ *
+ * This is a workaround until a better solution can be found.
+*/
#define DPCPU_DEFINE_STATIC(t, n) \
+ t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
+#else
+#define DPCPU_DEFINE_STATIC(t, n) \
static t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
+#endif
/*
* Accessors with a given base.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 22, 5:22 PM (5 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24061419
Default Alt Text
D16145.id45385.diff (1 KB)
Attached To
Mode
D16145: Don't use static on DPCPU data in arm64 modules
Attached
Detach File
Event Timeline
Log In to Comment