REQ-18
This commit is contained in:
38
executer/kernel/mcctrl/arch/x86_64/archdeps.c
Normal file
38
executer/kernel/mcctrl/arch/x86_64/archdeps.c
Normal file
@ -0,0 +1,38 @@
|
||||
#include <linux/version.h>
|
||||
#include "config.h"
|
||||
#include "mcctrl.h"
|
||||
|
||||
unsigned long
|
||||
reserve_user_space_common(struct mcctrl_usrdata *usrdata, unsigned long start, unsigned long end);
|
||||
|
||||
int
|
||||
reserve_user_space(struct mcctrl_usrdata *usrdata, unsigned long *startp, unsigned long *endp)
|
||||
{
|
||||
struct vm_area_struct *vma;
|
||||
unsigned long start = 0L;
|
||||
unsigned long end;
|
||||
|
||||
#define DESIRED_USER_END 0x800000000000
|
||||
#define GAP_FOR_MCEXEC 0x008000000000UL
|
||||
end = DESIRED_USER_END;
|
||||
down_write(¤t->mm->mmap_sem);
|
||||
vma = find_vma(current->mm, 0);
|
||||
if (vma) {
|
||||
end = (vma->vm_start - GAP_FOR_MCEXEC) & ~(GAP_FOR_MCEXEC - 1);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
|
||||
up_write(¤t->mm->mmap_sem);
|
||||
#endif
|
||||
start = reserve_user_space_common(usrdata, start, end);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
|
||||
up_write(¤t->mm->mmap_sem);
|
||||
#endif
|
||||
|
||||
if (IS_ERR_VALUE(start)) {
|
||||
return start;
|
||||
}
|
||||
*startp = start;
|
||||
*endp = end;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user