예제 #1
0
int copy_sc_to_user_skas(int pid, void *to_ptr, void *fp, 
			 union uml_pt_regs *regs, unsigned long fault_addr, 
			 int fault_type)
{
  	struct sigcontext sc, *to = to_ptr;
	struct _fpstate *to_fp;
	unsigned long fpregs[FP_FRAME_SIZE];
	int err;

	sc.gs = regs->skas.regs[GS];
	sc.fs = regs->skas.regs[FS];
	sc.es = regs->skas.regs[ES];
	sc.ds = regs->skas.regs[DS];
	sc.edi = regs->skas.regs[EDI];
	sc.esi = regs->skas.regs[ESI];
	sc.ebp = regs->skas.regs[EBP];
	sc.esp = regs->skas.regs[UESP];
	sc.ebx = regs->skas.regs[EBX];
	sc.edx = regs->skas.regs[EDX];
	sc.ecx = regs->skas.regs[ECX];
	sc.eax = regs->skas.regs[EAX];
	sc.eip = regs->skas.regs[EIP];
	sc.cs = regs->skas.regs[CS];
	sc.eflags = regs->skas.regs[EFL];
	sc.esp_at_signal = regs->skas.regs[UESP];
	sc.ss = regs->skas.regs[SS];
	sc.cr2 = fault_addr;
	sc.err = TO_SC_ERR(fault_type);
	sc.trapno = regs->skas.trap_type;

	err = ptrace(PTRACE_GETFPREGS, pid, 0, fpregs);
	if(err < 0){
	  	printk("copy_sc_to_user - PTRACE_GETFPREGS failed, "
		       "errno = %d\n", errno);
		return(1);
	}
	to_fp = (struct _fpstate *) 
		(fp ? (unsigned long) fp : ((unsigned long) to + sizeof(*to)));
	sc.fpstate = to_fp;

	if(err)
	  	return(err);

	return(copy_to_user_proc(to, &sc, sizeof(sc)) ||
	       copy_to_user_proc(to_fp, fpregs, sizeof(fpregs)));
}
예제 #2
0
파일: file.c 프로젝트: 12019/hg556a_source
int os_write_file(int fd, void *buf, int count)
{
	int n;

	/* Force buf into memory if it's not already. */
	
	/* XXX This fails if buf is kernel memory */
#ifdef notdef
	if(copy_to_user_proc(buf, buf, buf[0]))
		return(-EFAULT);
#endif

	n = write(fd, buf, count);
	if(n < 0)
		return(-errno);
	return(n);
}
예제 #3
0
파일: file.c 프로젝트: 12019/hg556a_source
int os_read_file(int fd, void *buf, int len)
{
	int n;

	/* Force buf into memory if it's not already. */

	/* XXX This fails if buf is kernel memory */
#ifdef notdef
	if(copy_to_user_proc(buf, &c, sizeof(c)))
		return(-EFAULT);
#endif

	n = read(fd, buf, len);
	if(n < 0)
		return(-errno);
	return(n);
}