uml: remove page_size()
userspace code used to have to call the kernelspace function page_size() in order to determine the value of the kernel's PAGE_SIZE. Since this is now available directly from kern_constants.h as UM_KERN_PAGE_SIZE, page_size() can be deleted and calls changed to use the constant. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
6e21aec3fc
commit
1ffb9164f5
@@ -29,28 +29,29 @@
|
||||
#include "uml-config.h"
|
||||
#include "os.h"
|
||||
#include "longjmp.h"
|
||||
#include "kern_constants.h"
|
||||
|
||||
void stack_protections(unsigned long address)
|
||||
{
|
||||
int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
|
||||
|
||||
if(mprotect((void *) address, page_size(), prot) < 0)
|
||||
if(mprotect((void *) address, UM_KERN_PAGE_SIZE, prot) < 0)
|
||||
panic("protecting stack failed, errno = %d", errno);
|
||||
}
|
||||
|
||||
void task_protections(unsigned long address)
|
||||
{
|
||||
unsigned long guard = address + page_size();
|
||||
unsigned long stack = guard + page_size();
|
||||
unsigned long guard = address + UM_KERN_PAGE_SIZE;
|
||||
unsigned long stack = guard + UM_KERN_PAGE_SIZE;
|
||||
int prot = 0, pages;
|
||||
|
||||
#ifdef notdef
|
||||
if(mprotect((void *) stack, page_size(), prot) < 0)
|
||||
if(mprotect((void *) stack, UM_KERN_PAGE_SIZE, prot) < 0)
|
||||
panic("protecting guard page failed, errno = %d", errno);
|
||||
#endif
|
||||
pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2;
|
||||
prot = PROT_READ | PROT_WRITE | PROT_EXEC;
|
||||
if(mprotect((void *) stack, pages * page_size(), prot) < 0)
|
||||
if(mprotect((void *) stack, pages * UM_KERN_PAGE_SIZE, prot) < 0)
|
||||
panic("protecting stack failed, errno = %d", errno);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user