为了这个实验,我想把PAGE_SIZE
从4096
改过来。因此,我在/arch/x86/include/asm/page_types.h
中更改了/arch/x86/include/asm/page_types.h
的值。但我不能编译它。
In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from include/linux/cache.h:4,
from include/linux/time.h:4,
from arch/x86/kernel/vsyscall_64.c:23:
arch/x86/kernel/vsyscall_64.c: function ‘map_vsyscall’ 内:
include/linux/compiler.h:437:20: eroor: call to ‘compiletime_assert_390’ declared with attribute error: BUILD_BUG_ON failed: (unsigned long)__fix_to_virt(VVAR_PAGE) != (unsigned long)VVAR_ADDRESS
prefix ## suffix(); \
^
include/linux/compiler.h:442:2: note: in expansion of macro ‘__compiletime_assert’
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler.h:454:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE)
^
include/linux/bug.h:53:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:77:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
arch/x86/kernel/vsyscall_64.c:389:2: note: in expansion of macro ‘BUILD_BUG_ON ’
BUILD_BUG_ON((unsigned long)__fix_to_virt(VVAR_PAGE) !=
^
make[2]: * [arch/x86/kernel/vsyscall_64.o] eroor 1
make[1]: * [arch/x86/kernel] error 2
make: *** [arch/x86] error 2
可能是因为VVAR_PAGE,但我不知道如何改变它。我该怎么办?
发布于 2019-12-13 08:49:29
您不能通过设置PAGE_SIZE
直接修改PAGE_SHIFT
,因为它是在编译时生成的。
假设您的处理器是一个x86,您可以使用CONFIG_PAGE_SIZE_XXX
(如CONFIG_PAGE_SIZE_8KB
)等变量系列来修改您的页面大小,最多可达8k。请注意,使用大页面将不必要地占用大量空间,因为即使是1字节文件也会占用磁盘上的整个页面。此外,更改页面大小与体系结构有关,建议保持默认的4K大小。
一个更好的方法,可能是使用巨大的页面,更灵活和更强大。他们是在那里展出的
https://stackoverflow.com/questions/59317272
复制相似问题