summaryrefslogtreecommitdiff
path: root/arch/um/sys-x86_64/ptrace_user.c
blob: 12e404c6fa467f5789c5dbe66e41a60ddb722e6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright 2003 PathScale, Inc.
 *
 * Licensed under the GPL
 */

#include <stddef.h>
#include <errno.h>
#include "ptrace_user.h"
#include "user.h"
#include "kern_constants.h"

int ptrace_getregs(long pid, unsigned long *regs_out)
{
	if(ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0)
		return(-errno);
	return(0);
}

int ptrace_setregs(long pid, unsigned long *regs)
{
	if(ptrace(PTRACE_SETREGS, pid, 0, regs) < 0)
		return(-errno);
	return(0);
}

void ptrace_pokeuser(unsigned long addr, unsigned long data)
{
	panic("ptrace_pokeuser");
}

#define DS 184
#define ES 192
#define __USER_DS     0x2b

void arch_enter_kernel(void *task, int pid)
{
}

void arch_leave_kernel(void *task, int pid)
{
#ifdef UM_USER_CS
        if(ptrace(PTRACE_POKEUSR, pid, CS, UM_USER_CS) < 0)
                printk("POKEUSR CS failed");
#endif

        if(ptrace(PTRACE_POKEUSR, pid, DS, __USER_DS) < 0)
                printk("POKEUSR DS failed");
        if(ptrace(PTRACE_POKEUSR, pid, ES, __USER_DS) < 0)
                printk("POKEUSR ES failed");
}