arch/s390/mm/extable.c
Source file repositories/reference/linux-study-clean/arch/s390/mm/extable.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/mm/extable.c- Extension
.c- Size
- 3673 bytes
- Lines
- 130
- Domain
- Architecture Layer
- Bucket
- arch/s390
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/extable.hlinux/string.hlinux/errno.hlinux/panic.hasm/asm-extable.hasm/extable.hasm/fpu.h
Detected Declarations
struct insn_ssffunction ex_handler_fixupfunction ex_handler_ua_faultfunction ex_handler_ua_load_regfunction ex_handler_fpcfunction ex_handler_ua_mvcosfunction fixup_exception
Annotated Snippet
struct insn_ssf {
u64 opc1 : 8;
u64 r3 : 4;
u64 opc2 : 4;
u64 b1 : 4;
u64 d1 : 12;
u64 b2 : 4;
u64 d2 : 12;
} __packed;
static bool ex_handler_ua_mvcos(const struct exception_table_entry *ex,
bool from, struct pt_regs *regs)
{
unsigned long uaddr, remainder;
struct insn_ssf *insn;
/*
* If the faulting user space access crossed a page boundary retry by
* limiting the access to the first page (adjust length accordingly).
* Then the mvcos instruction will either complete with condition code
* zero, or generate another fault where the user space access did not
* cross a page boundary.
* If the faulting user space access did not cross a page boundary set
* length to zero and retry. In this case no user space access will
* happen, and the mvcos instruction will complete with condition code
* zero.
* In both cases the instruction will complete with condition code
* zero (copying finished), and the register which contains the
* length, indicates the number of bytes copied.
*/
regs->psw.addr = extable_fixup(ex);
insn = (struct insn_ssf *)regs->psw.addr;
if (from)
uaddr = regs->gprs[insn->b2] + insn->d2;
else
uaddr = regs->gprs[insn->b1] + insn->d1;
remainder = PAGE_SIZE - (uaddr & (PAGE_SIZE - 1));
if (regs->gprs[insn->r3] <= remainder)
remainder = 0;
regs->gprs[insn->r3] = remainder;
return true;
}
bool fixup_exception(struct pt_regs *regs)
{
const struct exception_table_entry *ex;
ex = s390_search_extables(instruction_pointer(regs));
if (!ex)
return false;
switch (ex->type) {
case EX_TYPE_FIXUP:
return ex_handler_fixup(ex, regs);
case EX_TYPE_BPF:
return ex_handler_bpf(ex, regs);
case EX_TYPE_UA_FAULT:
return ex_handler_ua_fault(ex, regs);
case EX_TYPE_UA_LOAD_REG:
return ex_handler_ua_load_reg(ex, false, regs);
case EX_TYPE_UA_LOAD_REGPAIR:
return ex_handler_ua_load_reg(ex, true, regs);
case EX_TYPE_FPC:
return ex_handler_fpc(ex, regs);
case EX_TYPE_UA_MVCOS_TO:
return ex_handler_ua_mvcos(ex, false, regs);
case EX_TYPE_UA_MVCOS_FROM:
return ex_handler_ua_mvcos(ex, true, regs);
}
panic("invalid exception table entry");
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/extable.h`, `linux/string.h`, `linux/errno.h`, `linux/panic.h`, `asm/asm-extable.h`, `asm/extable.h`, `asm/fpu.h`.
- Detected declarations: `struct insn_ssf`, `function ex_handler_fixup`, `function ex_handler_ua_fault`, `function ex_handler_ua_load_reg`, `function ex_handler_fpc`, `function ex_handler_ua_mvcos`, `function fixup_exception`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source implementation candidate.
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.