arch/m68k/kernel/traps.c
Source file repositories/reference/linux-study-clean/arch/m68k/kernel/traps.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/kernel/traps.c- Extension
.c- Size
- 30290 bytes
- Lines
- 1159
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- 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
linux/sched.hlinux/sched/debug.hlinux/signal.hlinux/kernel.hlinux/mm.hlinux/module.hlinux/user.hlinux/string.hlinux/linkage.hlinux/init.hlinux/ptrace.hlinux/kallsyms.hlinux/extable.hasm/setup.hasm/fpu.hlinux/uaccess.hasm/traps.hasm/machdep.hasm/processor.hasm/siginfo.hasm/tlbflush.htraps.h../mm/fault.hasm/sun3mmu.h../sun3/sun3.hasm/mcfmmu.h
Detected Declarations
function access_error060function send_fault_sigfunction probe040function do_040writeback1function fix_xframe040function do_040writebacksfunction sigreturnfunction access_error040function bus_error030function bus_error030function access_errorcffunction buserr_cfunction show_tracefunction show_registersfunction show_stackfunction bad_super_trapfunction trap_cfunction die_if_kernelfunction set_esp0function fpsp040_diefunction fpemu_signal
Annotated Snippet
if (fslw & MMU060_DESC_ERR) {
__flush_tlb040_one(addr);
errorcode = 0;
}
if (fslw & MMU060_W)
errorcode |= 2;
pr_debug("errorcode = %ld\n", errorcode);
do_page_fault(&fp->ptregs, addr, errorcode);
} else if (fslw & (MMU060_SEE)){
/* Software Emulation Error.
* fault during mem_read/mem_write in ifpsp060/os.S
*/
send_fault_sig(&fp->ptregs);
} else if (!(fslw & (MMU060_RE|MMU060_WE)) ||
send_fault_sig(&fp->ptregs) > 0) {
pr_err("pc=%#lx, fa=%#lx\n", fp->ptregs.pc,
fp->un.fmt4.effaddr);
pr_err("68060 access error, fslw=%lx\n", fslw);
trap_c( fp );
}
}
#endif /* CONFIG_M68060 */
#if defined (CONFIG_M68040)
static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
{
unsigned long mmusr;
set_fc(wbs);
if (iswrite)
asm volatile (".chip 68040; ptestw (%0); .chip 68k" : : "a" (addr));
else
asm volatile (".chip 68040; ptestr (%0); .chip 68k" : : "a" (addr));
asm volatile (".chip 68040; movec %%mmusr,%0; .chip 68k" : "=r" (mmusr));
set_fc(USER_DATA);
return mmusr;
}
static inline int do_040writeback1(unsigned short wbs, unsigned long wba,
unsigned long wbd)
{
int res = 0;
set_fc(wbs);
switch (wbs & WBSIZ_040) {
case BA_SIZE_BYTE:
res = put_user(wbd & 0xff, (char __user *)wba);
break;
case BA_SIZE_WORD:
res = put_user(wbd & 0xffff, (short __user *)wba);
break;
case BA_SIZE_LONG:
res = put_user(wbd, (int __user *)wba);
break;
}
set_fc(USER_DATA);
pr_debug("do_040writeback1, res=%d\n", res);
return res;
}
/* after an exception in a writeback the stack frame corresponding
* to that exception is discarded, set a few bits in the old frame
* to simulate what it should look like
*/
static inline void fix_xframe040(struct frame *fp, unsigned long wba, unsigned short wbs)
{
fp->un.fmt7.faddr = wba;
fp->un.fmt7.ssw = wbs & 0xff;
if (wba != current->thread.faddr)
fp->un.fmt7.ssw |= MA_040;
}
static inline void do_040writebacks(struct frame *fp)
{
int res = 0;
#if 0
if (fp->un.fmt7.wb1s & WBV_040)
pr_err("access_error040: cannot handle 1st writeback. oops.\n");
#endif
if ((fp->un.fmt7.wb2s & WBV_040) &&
!(fp->un.fmt7.wb2s & WBTT_040)) {
Annotation
- Immediate include surface: `linux/sched.h`, `linux/sched/debug.h`, `linux/signal.h`, `linux/kernel.h`, `linux/mm.h`, `linux/module.h`, `linux/user.h`, `linux/string.h`.
- Detected declarations: `function access_error060`, `function send_fault_sig`, `function probe040`, `function do_040writeback1`, `function fix_xframe040`, `function do_040writebacks`, `function sigreturn`, `function access_error040`, `function bus_error030`, `function bus_error030`.
- Atlas domain: Architecture Layer / arch/m68k.
- 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.