arch/microblaze/kernel/ptrace.c
Source file repositories/reference/linux-study-clean/arch/microblaze/kernel/ptrace.c
File Facts
- System
- Linux kernel
- Corpus path
arch/microblaze/kernel/ptrace.c- Extension
.c- Size
- 4721 bytes
- Lines
- 170
- Domain
- Architecture Layer
- Bucket
- arch/microblaze
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/mm.hlinux/sched.hlinux/sched/task_stack.hlinux/ptrace.hlinux/signal.hlinux/elf.hlinux/audit.hlinux/seccomp.hlinux/errno.hasm/processor.hlinux/uaccess.hasm/asm-offsets.hasm/cacheflush.hasm/syscall.hlinux/io.h
Detected Declarations
function Copyrightfunction arch_ptracefunction do_syscall_trace_enterfunction do_syscall_trace_leavefunction ptrace_disable
Annotated Snippet
if (addr >= PT_SIZE && request == PTRACE_PEEKUSR) {
/*
* Special requests that don't actually correspond
* to offsets in struct pt_regs.
*/
if (addr == PT_TEXT_ADDR) {
val = child->mm->start_code;
} else if (addr == PT_DATA_ADDR) {
val = child->mm->start_data;
} else if (addr == PT_TEXT_LEN) {
val = child->mm->end_code
- child->mm->start_code;
} else {
rval = -EIO;
}
} else if (addr < PT_SIZE && (addr & 0x3) == 0) {
microblaze_reg_t *reg_addr = reg_save_addr(addr, child);
if (request == PTRACE_PEEKUSR)
val = *reg_addr;
else {
#if 1
*reg_addr = data;
#else
/* MS potential problem on WB system
* Be aware that reg_addr is virtual address
* virt_to_phys conversion is necessary.
* This could be sensible solution.
*/
u32 paddr = virt_to_phys((u32)reg_addr);
invalidate_icache_range(paddr, paddr + 4);
*reg_addr = data;
flush_dcache_range(paddr, paddr + 4);
#endif
}
} else
rval = -EIO;
if (rval == 0 && request == PTRACE_PEEKUSR)
rval = put_user(val, (unsigned long __user *)data);
break;
default:
rval = ptrace_request(child, request, addr, data);
}
return rval;
}
asmlinkage unsigned long do_syscall_trace_enter(struct pt_regs *regs)
{
unsigned long ret = 0;
secure_computing_strict(regs->r12);
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
ptrace_report_syscall_entry(regs))
/*
* Tracing decided this syscall should not happen.
* We'll return a bogus call number to get an ENOSYS
* error, but leave the original number in regs->regs[0].
*/
ret = -1L;
audit_syscall_entry(regs->r12, regs->r5, regs->r6, regs->r7, regs->r8);
return ret ?: regs->r12;
}
asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
{
int step;
audit_syscall_exit(regs);
step = test_thread_flag(TIF_SINGLESTEP);
if (step || test_thread_flag(TIF_SYSCALL_TRACE))
ptrace_report_syscall_exit(regs, step);
}
void ptrace_disable(struct task_struct *child)
{
/* nothing to do */
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/mm.h`, `linux/sched.h`, `linux/sched/task_stack.h`, `linux/ptrace.h`, `linux/signal.h`, `linux/elf.h`, `linux/audit.h`.
- Detected declarations: `function Copyright`, `function arch_ptrace`, `function do_syscall_trace_enter`, `function do_syscall_trace_leave`, `function ptrace_disable`.
- Atlas domain: Architecture Layer / arch/microblaze.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.