arch/sparc/mm/fault_64.c
Source file repositories/reference/linux-study-clean/arch/sparc/mm/fault_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/mm/fault_64.c- Extension
.c- Size
- 13891 bytes
- Lines
- 533
- 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.
- 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/sched/debug.hlinux/ptrace.hlinux/mman.hlinux/signal.hlinux/mm.hlinux/extable.hlinux/init.hlinux/perf_event.hlinux/interrupt.hlinux/kprobes.hlinux/kdebug.hlinux/percpu.hlinux/context_tracking.hlinux/uaccess.hasm/page.hasm/openprom.hasm/oplib.hasm/asi.hasm/lsu.hasm/sections.hasm/mmu_context.hasm/setup.h
Detected Declarations
function unhandled_faultfunction bad_kernel_pcfunction get_user_insnfunction show_signal_msgfunction do_fault_siginfofunction get_fault_insnfunction do_kernel_faultfunction bogus_32bit_fault_tpcfunction do_sparc64_fault
Annotated Snippet
fault = handle_mm_fault(vma, address, flags, regs);
if (fault_signal_pending(fault, regs)) {
if (regs->tstate & TSTATE_PRIV) {
insn = get_fault_insn(regs, insn);
goto handle_kernel_fault;
}
goto exit_exception;
}
/* The fault is fully completed (including releasing mmap lock) */
if (fault & VM_FAULT_COMPLETED)
goto lock_released;
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);
lock_released:
mm_rss = get_mm_rss(mm);
#if defined(CONFIG_TRANSPARENT_HUGEPAGE)
mm_rss -= (mm->context.thp_pte_count * (HPAGE_SIZE / PAGE_SIZE));
#endif
if (unlikely(mm_rss >
mm->context.tsb_block[MM_TSB_BASE].tsb_rss_limit))
tsb_grow(mm, MM_TSB_BASE, mm_rss);
#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
mm_rss = mm->context.hugetlb_pte_count + mm->context.thp_pte_count;
mm_rss *= REAL_HPAGE_PER_HPAGE;
if (unlikely(mm_rss >
mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit)) {
if (mm->context.tsb_block[MM_TSB_HUGE].tsb)
tsb_grow(mm, MM_TSB_HUGE, mm_rss);
else
hugetlb_setup(regs);
}
#endif
exit_exception:
exception_exit(prev_state);
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:
insn = get_fault_insn(regs, insn);
handle_kernel_fault:
do_kernel_fault(regs, si_code, fault_code, insn, address);
goto exit_exception;
/*
* 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:
insn = get_fault_insn(regs, insn);
mmap_read_unlock(mm);
if (!(regs->tstate & TSTATE_PRIV)) {
pagefault_out_of_memory();
goto exit_exception;
}
goto handle_kernel_fault;
intr_or_no_mm:
insn = get_fault_insn(regs, 0);
goto handle_kernel_fault;
Annotation
- Immediate include surface: `asm/head.h`, `linux/string.h`, `linux/types.h`, `linux/sched.h`, `linux/sched/debug.h`, `linux/ptrace.h`, `linux/mman.h`, `linux/signal.h`.
- Detected declarations: `function unhandled_fault`, `function bad_kernel_pc`, `function get_user_insn`, `function show_signal_msg`, `function do_fault_siginfo`, `function get_fault_insn`, `function do_kernel_fault`, `function bogus_32bit_fault_tpc`, `function do_sparc64_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.