2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
|
|
|
|
* Licensed under the GPL
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "linux/kernel.h"
|
|
|
|
#include "linux/mm.h"
|
|
|
|
#include "asm/signal.h"
|
|
|
|
#include "asm/ptrace.h"
|
|
|
|
#include "asm/uaccess.h"
|
|
|
|
#include "asm/pgalloc.h"
|
|
|
|
#include "asm/tlbflush.h"
|
|
|
|
#include "kern_util.h"
|
|
|
|
#include "irq_user.h"
|
|
|
|
#include "mem_user.h"
|
|
|
|
#include "os.h"
|
|
|
|
#include "tlb.h"
|
|
|
|
#include "mode.h"
|
|
|
|
|
|
|
|
static int exec_tramp(void *sig_stack)
|
|
|
|
{
|
|
|
|
init_new_thread_stack(sig_stack, NULL);
|
2006-07-10 19:45:07 +08:00
|
|
|
init_new_thread_signals();
|
2005-04-17 06:20:36 +08:00
|
|
|
os_stop_process(os_getpid());
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void flush_thread_tt(void)
|
|
|
|
{
|
|
|
|
unsigned long stack;
|
|
|
|
int new_pid;
|
|
|
|
|
|
|
|
stack = alloc_stack(0, 0);
|
|
|
|
if(stack == 0){
|
|
|
|
printk(KERN_ERR
|
|
|
|
"flush_thread : failed to allocate temporary stack\n");
|
|
|
|
do_exit(SIGKILL);
|
|
|
|
}
|
|
|
|
|
2006-01-12 17:05:48 +08:00
|
|
|
new_pid = start_fork_tramp(task_stack_page(current), stack, 0, exec_tramp);
|
2005-04-17 06:20:36 +08:00
|
|
|
if(new_pid < 0){
|
|
|
|
printk(KERN_ERR
|
|
|
|
"flush_thread : new thread failed, errno = %d\n",
|
|
|
|
-new_pid);
|
|
|
|
do_exit(SIGKILL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(current_thread->cpu == 0)
|
|
|
|
forward_interrupts(new_pid);
|
|
|
|
current->thread.request.op = OP_EXEC;
|
|
|
|
current->thread.request.u.exec.pid = new_pid;
|
|
|
|
unprotect_stack((unsigned long) current_thread);
|
|
|
|
os_usr1_process(os_getpid());
|
|
|
|
change_sig(SIGUSR1, 1);
|
|
|
|
|
|
|
|
change_sig(SIGUSR1, 0);
|
|
|
|
enable_timer();
|
|
|
|
free_page(stack);
|
|
|
|
protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1);
|
2007-05-11 13:22:30 +08:00
|
|
|
stack_protections((unsigned long) current_thread);
|
2005-04-17 06:20:36 +08:00
|
|
|
force_flush_all();
|
|
|
|
unblock_signals();
|
|
|
|
}
|
|
|
|
|
|
|
|
void start_thread_tt(struct pt_regs *regs, unsigned long eip,
|
|
|
|
unsigned long esp)
|
|
|
|
{
|
|
|
|
set_fs(USER_DS);
|
|
|
|
flush_tlb_mm(current->mm);
|
|
|
|
PT_REGS_IP(regs) = eip;
|
|
|
|
PT_REGS_SP(regs) = esp;
|
|
|
|
PT_FIX_EXEC_STACK(esp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Overrides for Emacs so that we follow Linus's tabbing style.
|
|
|
|
* Emacs will notice this stuff at the end of the file and automatically
|
|
|
|
* adjust the settings for this buffer only. This must remain at the end
|
|
|
|
* of the file.
|
|
|
|
* ---------------------------------------------------------------------------
|
|
|
|
* Local variables:
|
|
|
|
* c-file-style: "linux"
|
|
|
|
* End:
|
|
|
|
*/
|