2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
8 #include <sys/ptrace.h>
15 void map(int fd, unsigned long virt, unsigned long phys, unsigned long len,
18 struct proc_mm_op map;
22 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
24 phys_fd = phys_mapping(phys, &offset);
26 map = ((struct proc_mm_op) { .op = MM_MMAP,
37 n = os_write_file(fd, &map, sizeof(map));
39 printk("map : /proc/mm map failed, err = %d\n", -n);
42 int unmap(int fd, void *addr, int len)
44 struct proc_mm_op unmap;
47 unmap = ((struct proc_mm_op) { .op = MM_MUNMAP,
50 { .addr = (unsigned long) addr,
52 n = os_write_file(fd, &unmap, sizeof(unmap));
53 if(n != sizeof(unmap)) {
63 int protect(int fd, unsigned long addr, unsigned long len, int r, int w,
64 int x, int must_succeed)
66 struct proc_mm_op protect;
69 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
72 protect = ((struct proc_mm_op) { .op = MM_MPROTECT,
75 { .addr = (unsigned long) addr,
79 n = os_write_file(fd, &protect, sizeof(protect));
80 if(n != sizeof(protect)) {
84 panic("protect failed, err = %d", -n);
92 void before_mem_skas(unsigned long unused)
97 * Overrides for Emacs so that we follow Linus's tabbing style.
98 * Emacs will notice this stuff at the end of the file and automatically
99 * adjust the settings for this buffer only. This must remain at the end
101 * ---------------------------------------------------------------------------
103 * c-file-style: "linux"