arch/sparc/mm/fault_32.c
Source file repositories/reference/linux-study-clean/arch/sparc/mm/fault_32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/mm/fault_32.c- Extension
.c- Size
- 8874 bytes
- Lines
- 383
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/head.hlinux/string.hlinux/types.hlinux/sched.hlinux/ptrace.hlinux/mman.hlinux/threads.hlinux/kernel.hlinux/signal.hlinux/mm.hlinux/smp.hlinux/perf_event.hlinux/interrupt.hlinux/kdebug.hlinux/uaccess.hlinux/extable.hasm/page.hasm/openprom.hasm/oplib.hasm/setup.hasm/smp.hasm/traps.hmm_32.h
Detected Declarations
function unhandled_faultfunction show_signal_msgfunction __do_fault_siginfofunction compute_si_addrfunction do_fault_siginfofunction do_sparc_faultfunction force_user_faultfunction check_stack_alignedfunction window_overflow_faultfunction window_underflow_faultfunction window_ret_fault
Annotated Snippet
fault = handle_mm_fault(vma, address, flags, regs);
if (fault_signal_pending(fault, regs)) {
if (!from_user)
goto no_context;
return;
}
/* The fault is fully completed (including releasing mmap lock) */
if (fault & VM_FAULT_COMPLETED)
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
if (fault & VM_FAULT_OOM)
goto out_of_memory;
else if (fault & VM_FAULT_SIGSEGV)
goto bad_area;
else if (fault & VM_FAULT_SIGBUS)
goto do_sigbus;
BUG();
}
if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED;
/* No need to mmap_read_unlock(mm) as we would
* have already released it in __lock_page_or_retry
* in mm/filemap.c.
*/
goto retry;
}
mmap_read_unlock(mm);
return;
/*
* Something tried to access memory that isn't in our memory map..
* Fix it, but check if it's kernel or user first..
*/
bad_area:
mmap_read_unlock(mm);
bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */
if (from_user) {
do_fault_siginfo(code, SIGSEGV, regs, text_fault);
return;
}
/* Is this in ex_table? */
no_context:
if (!from_user) {
const struct exception_table_entry *entry;
entry = search_exception_tables(regs->pc);
#ifdef DEBUG_EXCEPTIONS
printk("Exception: PC<%08lx> faddr<%08lx>\n",
regs->pc, address);
printk("EX_TABLE: insn<%08lx> fixup<%08x>\n",
regs->pc, entry->fixup);
#endif
regs->pc = entry->fixup;
regs->npc = regs->pc + 4;
return;
}
unhandled_fault(address, tsk, regs);
/*
* We ran out of memory, or some other thing happened to us that made
* us unable to handle the page fault gracefully.
*/
out_of_memory:
mmap_read_unlock(mm);
if (from_user) {
pagefault_out_of_memory();
return;
}
goto no_context;
do_sigbus:
mmap_read_unlock(mm);
do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, text_fault);
if (!from_user)
goto no_context;
vmalloc_fault:
{
/*
Annotation
- Immediate include surface: `asm/head.h`, `linux/string.h`, `linux/types.h`, `linux/sched.h`, `linux/ptrace.h`, `linux/mman.h`, `linux/threads.h`, `linux/kernel.h`.
- Detected declarations: `function unhandled_fault`, `function show_signal_msg`, `function __do_fault_siginfo`, `function compute_si_addr`, `function do_fault_siginfo`, `function do_sparc_fault`, `function force_user_fault`, `function check_stack_aligned`, `function window_overflow_fault`, `function window_underflow_fault`.
- Atlas domain: Architecture Layer / arch/sparc.
- 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.