fix REQ-2, REQ-6, REQ-8
This commit is contained in:
@@ -398,16 +398,19 @@ static int process_msg_prepare_process(unsigned long rphys)
|
||||
|
||||
vm->region.user_start = pn->user_start;
|
||||
vm->region.user_end = pn->user_end;
|
||||
/* TODO: review this code
|
||||
if(vm->region.user_end > USER_END)
|
||||
vm->region.user_end = USER_END;
|
||||
vm->region.map_start =
|
||||
(vm->region.user_start +
|
||||
(vm->region.user_end - vm->region.user_start) / 3) &
|
||||
LARGE_PAGE_MASK;
|
||||
*/
|
||||
vm->region.map_start = (USER_END / 3) & LARGE_PAGE_MASK;
|
||||
vm->region.map_end = proc->vm->region.map_start;
|
||||
if(vm->region.user_start != 0UL ||
|
||||
vm->region.user_end < TASK_UNMAPPED_BASE){
|
||||
vm->region.map_start =
|
||||
(vm->region.user_start +
|
||||
(vm->region.user_end - vm->region.user_start) / 3) &
|
||||
LARGE_PAGE_MASK;
|
||||
}
|
||||
else{
|
||||
vm->region.map_start = TASK_UNMAPPED_BASE;
|
||||
}
|
||||
vm->region.map_end = vm->region.map_start;
|
||||
memcpy(proc->rlimit, pn->rlimit, sizeof(struct rlimit) * MCK_RLIM_MAX);
|
||||
|
||||
/* TODO: Clear it at the proper timing */
|
||||
|
||||
@@ -99,6 +99,8 @@
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define __user
|
||||
|
||||
/* We don't deal with uaccess at the moment, because x86 can access
|
||||
* userspace directly, we rely on glibc and the app developers.
|
||||
*/
|
||||
@@ -106,42 +108,14 @@
|
||||
#include <arch/uaccess.h>
|
||||
#endif
|
||||
|
||||
#include <asm.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define __user
|
||||
#include <arch-futex.h>
|
||||
|
||||
#if 0
|
||||
#include <arch/processor.h>
|
||||
#include <arch/system.h>
|
||||
#endif
|
||||
|
||||
#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
|
||||
asm volatile("1:\t" insn "\n" \
|
||||
"2:\t.section .fixup,\"ax\"\n" \
|
||||
"3:\tmov\t%3, %1\n" \
|
||||
"\tjmp\t2b\n" \
|
||||
"\t.previous\n" \
|
||||
_ASM_EXTABLE(1b, 3b) \
|
||||
: "=r" (oldval), "=r" (ret), "+m" (*uaddr) \
|
||||
: "i" (-EFAULT), "0" (oparg), "1" (0))
|
||||
|
||||
#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
|
||||
asm volatile("1:\tmovl %2, %0\n" \
|
||||
"\tmovl\t%0, %3\n" \
|
||||
"\t" insn "\n" \
|
||||
"2:\tlock; cmpxchgl %3, %2\n" \
|
||||
"\tjnz\t1b\n" \
|
||||
"3:\t.section .fixup,\"ax\"\n" \
|
||||
"4:\tmov\t%5, %1\n" \
|
||||
"\tjmp\t3b\n" \
|
||||
"\t.previous\n" \
|
||||
_ASM_EXTABLE(1b, 4b) \
|
||||
_ASM_EXTABLE(2b, 4b) \
|
||||
: "=&a" (oldval), "=&r" (ret), \
|
||||
"+m" (*uaddr), "=&r" (tem) \
|
||||
: "r" (oparg), "i" (-EFAULT), "1" (0))
|
||||
|
||||
static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
|
||||
{
|
||||
int op = (encoded_op >> 28) & 7;
|
||||
@@ -206,28 +180,6 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval,
|
||||
int newval)
|
||||
{
|
||||
#ifdef __UACCESS__
|
||||
if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
|
||||
return -EFAULT;
|
||||
#endif
|
||||
|
||||
asm volatile("1:\tlock; cmpxchgl %3, %1\n"
|
||||
"2:\t.section .fixup, \"ax\"\n"
|
||||
"3:\tmov %2, %0\n"
|
||||
"\tjmp 2b\n"
|
||||
"\t.previous\n"
|
||||
_ASM_EXTABLE(1b, 3b)
|
||||
: "=a" (oldval), "+m" (*uaddr)
|
||||
: "i" (-EFAULT), "r" (newval), "0" (oldval)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
return oldval;
|
||||
}
|
||||
|
||||
#endif // __KERNEL__
|
||||
#endif // _ASM_X86_FUTEX_H
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <ihk/debug.h>
|
||||
#include <ihk/ikc.h>
|
||||
#include <ikc/master.h>
|
||||
#include <arch/cpu.h>
|
||||
|
||||
//#define DEBUG_LISTENERS
|
||||
|
||||
@@ -28,16 +29,6 @@
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
static unsigned long read_tsc(void)
|
||||
{
|
||||
unsigned int low, high;
|
||||
|
||||
asm volatile("rdtsc" : "=a"(low), "=d"(high));
|
||||
|
||||
return (low | ((unsigned long)high << 32));
|
||||
}
|
||||
|
||||
|
||||
void testmem(void *v, unsigned long size)
|
||||
{
|
||||
unsigned long i, st, ed, s = 0;
|
||||
|
||||
@@ -1701,7 +1701,7 @@ int init_process_stack(struct thread *thread, struct program_load_desc *pn,
|
||||
int s_ind = 0;
|
||||
int arg_ind;
|
||||
unsigned long size;
|
||||
unsigned long end = thread->vm->region.user_end;
|
||||
unsigned long end;
|
||||
unsigned long start;
|
||||
int rc;
|
||||
unsigned long vrflag;
|
||||
@@ -1713,6 +1713,7 @@ int init_process_stack(struct thread *thread, struct program_load_desc *pn,
|
||||
struct process *proc = thread->proc;
|
||||
|
||||
/* create stack range */
|
||||
end = STACK_TOP(&thread->vm->region);
|
||||
minsz = PAGE_SIZE;
|
||||
size = proc->rlimit[MCK_RLIMIT_STACK].rlim_cur & PAGE_MASK;
|
||||
if (size > (USER_END / 2)) {
|
||||
|
||||
Reference in New Issue
Block a user