Move sysinit and sysuninit linker sets in the data (writeable) section.
Both sets are sorted in place, and with the introduction of read-only permissions on the amd64 kernel text, the sorting override depended on CR0.WP turned off. Make it correct by moving the sets into writeable part of the KVA, also fixing boot on machines where hand-off from BIOS to OS occurs with CR0.WP set. Based on submission by: Peter Lei <peter.lei@ieee.org> MFC after: 1 week
This commit is contained in:
parent
ab14fe2948
commit
3225db018a
@ -259,7 +259,7 @@ sysinit_tslog_shim(const void * data)
|
|||||||
sysinit_tslog_shim, \
|
sysinit_tslog_shim, \
|
||||||
&uniquifier ## _sys_init_tslog \
|
&uniquifier ## _sys_init_tslog \
|
||||||
}; \
|
}; \
|
||||||
DATA_SET(sysinit_set,uniquifier ## _sys_init)
|
DATA_WSET(sysinit_set,uniquifier ## _sys_init)
|
||||||
#else
|
#else
|
||||||
#define C_SYSINIT(uniquifier, subsystem, order, func, ident) \
|
#define C_SYSINIT(uniquifier, subsystem, order, func, ident) \
|
||||||
static struct sysinit uniquifier ## _sys_init = { \
|
static struct sysinit uniquifier ## _sys_init = { \
|
||||||
@ -268,7 +268,7 @@ sysinit_tslog_shim(const void * data)
|
|||||||
func, \
|
func, \
|
||||||
(ident) \
|
(ident) \
|
||||||
}; \
|
}; \
|
||||||
DATA_SET(sysinit_set,uniquifier ## _sys_init)
|
DATA_WSET(sysinit_set,uniquifier ## _sys_init)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SYSINIT(uniquifier, subsystem, order, func, ident) \
|
#define SYSINIT(uniquifier, subsystem, order, func, ident) \
|
||||||
@ -285,7 +285,7 @@ sysinit_tslog_shim(const void * data)
|
|||||||
func, \
|
func, \
|
||||||
(ident) \
|
(ident) \
|
||||||
}; \
|
}; \
|
||||||
DATA_SET(sysuninit_set,uniquifier ## _sys_uninit)
|
DATA_WSET(sysuninit_set,uniquifier ## _sys_uninit)
|
||||||
|
|
||||||
#define SYSUNINIT(uniquifier, subsystem, order, func, ident) \
|
#define SYSUNINIT(uniquifier, subsystem, order, func, ident) \
|
||||||
C_SYSUNINIT(uniquifier, subsystem, order, \
|
C_SYSUNINIT(uniquifier, subsystem, order, \
|
||||||
|
@ -56,12 +56,13 @@
|
|||||||
* Private macros, not to be used outside this header file.
|
* Private macros, not to be used outside this header file.
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUCLIKE___SECTION
|
#ifdef __GNUCLIKE___SECTION
|
||||||
#define __MAKE_SET(set, sym) \
|
#define __MAKE_SET_QV(set, sym, qv) \
|
||||||
__GLOBL(__CONCAT(__start_set_,set)); \
|
__GLOBL(__CONCAT(__start_set_,set)); \
|
||||||
__GLOBL(__CONCAT(__stop_set_,set)); \
|
__GLOBL(__CONCAT(__stop_set_,set)); \
|
||||||
static void const * __MAKE_SET_CONST \
|
static void const * qv \
|
||||||
__set_##set##_sym_##sym __section("set_" #set) \
|
__set_##set##_sym_##sym __section("set_" #set) \
|
||||||
__used = &(sym)
|
__used = &(sym)
|
||||||
|
#define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST)
|
||||||
#else /* !__GNUCLIKE___SECTION */
|
#else /* !__GNUCLIKE___SECTION */
|
||||||
#error this file needs to be ported to your compiler
|
#error this file needs to be ported to your compiler
|
||||||
#endif /* __GNUCLIKE___SECTION */
|
#endif /* __GNUCLIKE___SECTION */
|
||||||
@ -71,6 +72,7 @@
|
|||||||
*/
|
*/
|
||||||
#define TEXT_SET(set, sym) __MAKE_SET(set, sym)
|
#define TEXT_SET(set, sym) __MAKE_SET(set, sym)
|
||||||
#define DATA_SET(set, sym) __MAKE_SET(set, sym)
|
#define DATA_SET(set, sym) __MAKE_SET(set, sym)
|
||||||
|
#define DATA_WSET(set, sym) __MAKE_SET_QV(set, sym, )
|
||||||
#define BSS_SET(set, sym) __MAKE_SET(set, sym)
|
#define BSS_SET(set, sym) __MAKE_SET(set, sym)
|
||||||
#define ABS_SET(set, sym) __MAKE_SET(set, sym)
|
#define ABS_SET(set, sym) __MAKE_SET(set, sym)
|
||||||
#define SET_ENTRY(set, sym) __MAKE_SET(set, sym)
|
#define SET_ENTRY(set, sym) __MAKE_SET(set, sym)
|
||||||
|
Loading…
Reference in New Issue
Block a user