2017-09-03 18:57:03 -07:00
|
|
|
#ifndef _LINUX_KAISER_H
|
|
|
|
#define _LINUX_KAISER_H
|
2017-08-30 16:23:00 -07:00
|
|
|
|
2018-01-03 10:43:15 -08:00
|
|
|
#ifdef CONFIG_PAGE_TABLE_ISOLATION
|
2017-08-30 16:23:00 -07:00
|
|
|
#include <asm/kaiser.h>
|
2017-09-03 18:57:03 -07:00
|
|
|
|
|
|
|
static inline int kaiser_map_thread_stack(void *stack)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Map that page of kernel stack on which we enter from user context.
|
|
|
|
*/
|
|
|
|
return kaiser_add_mapping((unsigned long)stack +
|
|
|
|
THREAD_SIZE - PAGE_SIZE, PAGE_SIZE, __PAGE_KERNEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void kaiser_unmap_thread_stack(void *stack)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Note: may be called even when kaiser_map_thread_stack() failed.
|
|
|
|
*/
|
|
|
|
kaiser_remove_mapping((unsigned long)stack +
|
|
|
|
THREAD_SIZE - PAGE_SIZE, PAGE_SIZE);
|
|
|
|
}
|
2017-08-30 16:23:00 -07:00
|
|
|
#else
|
|
|
|
|
|
|
|
/*
|
2018-01-03 10:43:15 -08:00
|
|
|
* These stubs are used whenever CONFIG_PAGE_TABLE_ISOLATION is off, which
|
2017-09-03 18:57:03 -07:00
|
|
|
* includes architectures that support KAISER, but have it disabled.
|
2017-08-30 16:23:00 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
static inline void kaiser_init(void)
|
|
|
|
{
|
|
|
|
}
|
2017-09-03 18:57:03 -07:00
|
|
|
static inline int kaiser_add_mapping(unsigned long addr,
|
|
|
|
unsigned long size, unsigned long flags)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline void kaiser_remove_mapping(unsigned long start,
|
|
|
|
unsigned long size)
|
2017-08-30 16:23:00 -07:00
|
|
|
{
|
|
|
|
}
|
2017-09-03 18:57:03 -07:00
|
|
|
static inline int kaiser_map_thread_stack(void *stack)
|
2017-08-30 16:23:00 -07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2017-09-03 18:57:03 -07:00
|
|
|
static inline void kaiser_unmap_thread_stack(void *stack)
|
|
|
|
{
|
|
|
|
}
|
2017-08-30 16:23:00 -07:00
|
|
|
|
2018-01-03 10:43:15 -08:00
|
|
|
#endif /* !CONFIG_PAGE_TABLE_ISOLATION */
|
2017-09-03 18:57:03 -07:00
|
|
|
#endif /* _LINUX_KAISER_H */
|