arch/mips/kernel/process.c
Source file repositories/reference/linux-study-clean/arch/mips/kernel/process.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/kernel/process.c- Extension
.c- Size
- 22904 bytes
- Lines
- 915
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/errno.hlinux/init.hlinux/kallsyms.hlinux/kernel.hlinux/nmi.hlinux/personality.hlinux/prctl.hlinux/random.hlinux/sched.hlinux/sched/debug.hlinux/sched/task_stack.hasm/abi.hasm/asm.hasm/dsemul.hasm/dsp.hasm/exec.hasm/fpu.hasm/inst.hasm/irq.hasm/irq_regs.hasm/isadep.hasm/msa.hasm/mips-cps.hasm/mipsregs.hasm/processor.hasm/reg.hasm/stacktrace.hlinux/stackprotector.h
Detected Declarations
struct mips_frame_infofunction Copyrightfunction start_threadfunction exit_threadfunction arch_dup_task_structfunction copy_threadfunction is_jr_ra_insfunction is_ra_save_insfunction is_jump_insfunction is_sp_move_insfunction get_frame_infofunction get___schedule_addrfunction get___schedule_addrfunction frame_info_initfunction thread_saved_pcfunction unwind_stack_by_addressfunction unwind_stackfunction for_each_possible_cpufunction __get_wchanfunction mips_stack_topfunction arch_align_stackfunction handle_backtracefunction raise_backtracefunction for_each_cpufunction arch_trigger_cpumask_backtracefunction mips_get_process_fp_modefunction prepare_for_fp_mode_switchfunction mips_set_process_fp_modefunction mips_dump_regs32function mips_dump_regs64export __stack_chk_guardexport unwind_stack_by_address
Annotated Snippet
struct mips_frame_info {
void *func;
unsigned long func_size;
int frame_size;
int pc_offset;
};
#define J_TARGET(pc,target) \
(((unsigned long)(pc) & 0xf0000000) | ((target) << 2))
static inline int is_jr_ra_ins(union mips_instruction *ip)
{
#ifdef CONFIG_CPU_MICROMIPS
/*
* jr16 ra
* jr ra
*/
if (mm_insn_16bit(ip->word >> 16)) {
if (ip->mm16_r5_format.opcode == mm_pool16c_op &&
ip->mm16_r5_format.rt == mm_jr16_op &&
ip->mm16_r5_format.imm == 31)
return 1;
return 0;
}
if (ip->r_format.opcode == mm_pool32a_op &&
ip->r_format.func == mm_pool32axf_op &&
((ip->u_format.uimmediate >> 6) & GENMASK(9, 0)) == mm_jalr_op &&
ip->r_format.rt == 31)
return 1;
return 0;
#else
if (ip->r_format.opcode == spec_op &&
ip->r_format.func == jr_op &&
ip->r_format.rs == 31)
return 1;
return 0;
#endif
}
static inline int is_ra_save_ins(union mips_instruction *ip, int *poff)
{
#ifdef CONFIG_CPU_MICROMIPS
/*
* swsp ra,offset
* swm16 reglist,offset(sp)
* swm32 reglist,offset(sp)
* sw32 ra,offset(sp)
* jradiussp - NOT SUPPORTED
*
* microMIPS is way more fun...
*/
if (mm_insn_16bit(ip->word >> 16)) {
switch (ip->mm16_r5_format.opcode) {
case mm_swsp16_op:
if (ip->mm16_r5_format.rt != 31)
return 0;
*poff = ip->mm16_r5_format.imm;
*poff = (*poff << 2) / sizeof(ulong);
return 1;
case mm_pool16c_op:
switch (ip->mm16_m_format.func) {
case mm_swm16_op:
*poff = ip->mm16_m_format.imm;
*poff += 1 + ip->mm16_m_format.rlist;
*poff = (*poff << 2) / sizeof(ulong);
return 1;
default:
return 0;
}
default:
return 0;
}
}
switch (ip->i_format.opcode) {
case mm_sw32_op:
if (ip->i_format.rs != 29)
return 0;
if (ip->i_format.rt != 31)
return 0;
*poff = ip->i_format.simmediate / sizeof(ulong);
return 1;
case mm_pool32b_op:
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/errno.h`, `linux/init.h`, `linux/kallsyms.h`, `linux/kernel.h`, `linux/nmi.h`, `linux/personality.h`, `linux/prctl.h`.
- Detected declarations: `struct mips_frame_info`, `function Copyright`, `function start_thread`, `function exit_thread`, `function arch_dup_task_struct`, `function copy_thread`, `function is_jr_ra_ins`, `function is_ra_save_ins`, `function is_jump_ins`, `function is_sp_move_ins`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.