/*
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
+ * Copyright 2003 PathScale, Inc.
* Licensed under the GPL
*/
#include "linux/capability.h"
#include "linux/vmalloc.h"
#include "linux/spinlock.h"
+#include "linux/proc_fs.h"
+#include "linux/ptrace.h"
#include "linux/vs_cvirt.h"
#include "asm/unistd.h"
void interrupt_end(void)
{
if(need_resched()) schedule();
- if(test_tsk_thread_flag(current, TIF_SIGPENDING)) do_signal(0);
+ if(test_tsk_thread_flag(current, TIF_SIGPENDING)) do_signal();
}
void release_thread(struct task_struct *task)
* although we are an idle CPU, we do not want to
* get into the scheduler unnecessarily.
*/
- irq_stat[smp_processor_id()].idle_timestamp = jiffies;
if(need_resched())
schedule();
return(PAGE_SIZE);
}
-int page_mask(void)
+unsigned long page_mask(void)
{
return(PAGE_MASK);
}
pte_t *pte_out)
{
pgd_t *pgd;
+ pud_t *pud;
pmd_t *pmd;
pte_t *pte;
if(task->mm == NULL)
return(ERR_PTR(-EINVAL));
pgd = pgd_offset(task->mm, addr);
- pmd = pmd_offset(pgd, addr);
+ if(!pgd_present(*pgd))
+ return(ERR_PTR(-EINVAL));
+
+ pud = pud_offset(pgd, addr);
+ if(!pud_present(*pud))
+ return(ERR_PTR(-EINVAL));
+
+ pmd = pmd_offset(pud, addr);
if(!pmd_present(*pmd))
return(ERR_PTR(-EINVAL));
+
pte = pte_offset_kernel(pmd, addr);
if(!pte_present(*pte))
return(ERR_PTR(-EINVAL));
+
if(pte_out != NULL)
*pte_out = *pte;
return((void *) (pte_val(*pte) & PAGE_MASK) + (addr & ~PAGE_MASK));
EXPORT_SYMBOL(disable_hlt);
-extern int signal_frame_size;
-
void *um_kmalloc(int size)
{
return(kmalloc(size, GFP_KERNEL));
return(&init_thread_union.thread_info.task);
}
-int copy_to_user_proc(void *to, void *from, int size)
+int copy_to_user_proc(void __user *to, void *from, int size)
{
return(copy_to_user(to, from, size));
}
-int copy_from_user_proc(void *to, void *from, int size)
+int copy_from_user_proc(void *to, void __user *from, int size)
{
return(copy_from_user(to, from, size));
}
-int clear_user_proc(void *buf, int size)
+int clear_user_proc(void __user *buf, int size)
{
return(clear_user(buf, size));
}
-int strlen_user_proc(char *str)
+int strlen_user_proc(char __user *str)
{
return(strlen_user(str));
}
return(current_thread->cpu);
}
+static atomic_t using_sysemu = ATOMIC_INIT(0);
+int sysemu_supported;
+
+void set_using_sysemu(int value)
+{
+ if (value > sysemu_supported)
+ return;
+ atomic_set(&using_sysemu, value);
+}
+
+int get_using_sysemu(void)
+{
+ return atomic_read(&using_sysemu);
+}
+
+static int proc_read_sysemu(char *buf, char **start, off_t offset, int size,int *eof, void *data)
+{
+ if (snprintf(buf, size, "%d\n", get_using_sysemu()) < size) /*No overflow*/
+ *eof = 1;
+
+ return strlen(buf);
+}
+
+static int proc_write_sysemu(struct file *file,const char *buf, unsigned long count,void *data)
+{
+ char tmp[2];
+
+ if (copy_from_user(tmp, buf, 1))
+ return -EFAULT;
+
+ if (tmp[0] >= '0' && tmp[0] <= '2')
+ set_using_sysemu(tmp[0] - '0');
+ return count; /*We use the first char, but pretend to write everything*/
+}
+
+int __init make_proc_sysemu(void)
+{
+ struct proc_dir_entry *ent;
+ if (!sysemu_supported)
+ return 0;
+
+ ent = create_proc_entry("sysemu", 0600, &proc_root);
+
+ if (ent == NULL)
+ {
+ printk("Failed to register /proc/sysemu\n");
+ return(0);
+ }
+
+ ent->read_proc = proc_read_sysemu;
+ ent->write_proc = proc_write_sysemu;
+
+ return 0;
+}
+
+late_initcall(make_proc_sysemu);
+
+int singlestepping(void * t)
+{
+ struct task_struct *task = t ? t : current;
+
+ if ( ! (task->ptrace & PT_DTRACE) )
+ return(0);
+
+ if (task->thread.singlestep_syscall)
+ return(1);
+
+ return 2;
+}
+
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically