@@ -23,10 +23,17 @@ int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
{
long ret;
+#ifdef CONFIG_MMU
asm("syscall"
: "=a" (ret)
: "0" (__NR_clock_gettime), "D" (clock), "S" (ts)
: "rcx", "r11", "memory");
+#else
+ asm("call *%1"
+ : "=a" (ret)
+ : "0" ((unsigned long)__NR_clock_gettime), "D" (clock), "S" (ts)
+ : "rcx", "r11", "memory");
+#endif
return ret;
}
@@ -37,10 +44,17 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
{
long ret;
+#ifdef CONFIG_MMU
asm("syscall"
: "=a" (ret)
: "0" (__NR_gettimeofday), "D" (tv), "S" (tz)
: "rcx", "r11", "memory");
+#else
+ asm("call *%1"
+ : "=a" (ret)
+ : "0" ((unsigned long)__NR_gettimeofday), "D" (tv), "S" (tz)
+ : "rcx", "r11", "memory");
+#endif
return ret;
}
@@ -51,9 +65,15 @@ __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
{
long secs;
+#ifdef CONFIG_MMU
asm volatile("syscall"
: "=a" (secs)
: "0" (__NR_time), "D" (t) : "cc", "r11", "cx", "memory");
+#else
+ asm("call *%1"
+ : "=a" (secs)
+ : "0" ((unsigned long)__NR_time), "D" (t) : "cc", "r11", "cx", "memory");
+#endif
return secs;
}
@@ -9,6 +9,7 @@
#include <asm/page.h>
#include <asm/elf.h>
#include <linux/init.h>
+#include <os.h>
static unsigned int __read_mostly vdso_enabled = 1;
unsigned long um_vdso_addr;
@@ -24,7 +25,9 @@ static int __init init_vdso(void)
BUG_ON(vdso_end - vdso_start > PAGE_SIZE);
+#ifdef CONFIG_MMU
um_vdso_addr = task_size - PAGE_SIZE;
+#endif
vdsop = kmalloc(sizeof(struct page *), GFP_KERNEL);
if (!vdsop)
@@ -40,16 +43,26 @@ static int __init init_vdso(void)
copy_page(page_address(um_vdso), vdso_start);
*vdsop = um_vdso;
+#ifndef CONFIG_MMU
+ /* this is fine with NOMMU as everything is accessible */
+ um_vdso_addr = (unsigned long)page_address(um_vdso);
+ os_protect_memory((void *)um_vdso_addr, vdso_end - vdso_start, 1, 1, 1);
+ pr_debug("vdso_start=%lx um_vdso_addr=%lx pg_um_vdso=%lx",
+ (unsigned long)vdso_start, um_vdso_addr,
+ (unsigned long)page_address(um_vdso));
+#endif
+
return 0;
oom:
- printk(KERN_ERR "Cannot allocate vdso\n");
+ pr_err("Cannot allocate vdso");
vdso_enabled = 0;
return -ENOMEM;
}
subsys_initcall(init_vdso);
+#ifdef CONFIG_MMU
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
{
struct vm_area_struct *vma;
@@ -74,3 +87,4 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
return IS_ERR(vma) ? PTR_ERR(vma) : 0;
}
+#endif