arch/sparc/kernel/process_64.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/process_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/process_64.c- Extension
.c- Size
- 17704 bytes
- Lines
- 699
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/errno.hlinux/export.hlinux/sched.hlinux/sched/debug.hlinux/sched/task.hlinux/sched/task_stack.hlinux/kernel.hlinux/mm.hlinux/fs.hlinux/smp.hlinux/stddef.hlinux/ptrace.hlinux/slab.hlinux/user.hlinux/delay.hlinux/compat.hlinux/tick.hlinux/init.hlinux/cpu.hlinux/perf_event.hlinux/elfcore.hlinux/sysrq.hlinux/nmi.hlinux/context_tracking.hlinux/signal.hlinux/uaccess.hasm/page.hasm/pgalloc.hasm/processor.hasm/pstate.hasm/elf.hasm/fpumacro.h
Detected Declarations
function Copyrightfunction arch_cpu_idle_deadfunction show_regwindow32function show_regwindowfunction show_regsfunction __global_reg_selffunction __global_reg_pollfunction arch_trigger_cpumask_backtracefunction for_each_cpufunction sysrq_handle_globregfunction __global_pmu_selffunction __global_pmu_pollfunction pmu_snapshot_all_cpusfunction for_each_online_cpufunction sysrq_handle_globpmufunction sparc_sysrq_initfunction exit_threadfunction flush_threadfunction clone_stackframefunction shift_window_bufferfunction synchronize_user_stackfunction stack_unalignedfunction fault_in_user_windowsfunction clone3function arch_dup_task_structfunction __get_wchanmodule init sparc_sysrq_init
Annotated Snippet
core_initcall(sparc_sysrq_init);
#endif
/* Free current thread data structures etc.. */
void exit_thread(struct task_struct *tsk)
{
struct thread_info *t = task_thread_info(tsk);
if (t->utraps) {
if (t->utraps[0] < 2)
kfree (t->utraps);
else
t->utraps[0]--;
}
}
void flush_thread(void)
{
struct thread_info *t = current_thread_info();
struct mm_struct *mm;
mm = t->task->mm;
if (mm)
tsb_context_switch(mm);
set_thread_wsaved(0);
/* Clear FPU register state. */
t->fpsaved[0] = 0;
}
/* It's a bit more tricky when 64-bit tasks are involved... */
static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
{
bool stack_64bit = test_thread_64bit_stack(psp);
unsigned long fp, distance, rval;
if (stack_64bit) {
csp += STACK_BIAS;
psp += STACK_BIAS;
__get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));
fp += STACK_BIAS;
if (test_thread_flag(TIF_32BIT))
fp &= 0xffffffff;
} else
__get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
/* Now align the stack as this is mandatory in the Sparc ABI
* due to how register windows work. This hides the
* restriction from thread libraries etc.
*/
csp &= ~15UL;
distance = fp - psp;
rval = (csp - distance);
if (raw_copy_in_user((void __user *)rval, (void __user *)psp, distance))
rval = 0;
else if (!stack_64bit) {
if (put_user(((u32)csp),
&(((struct reg_window32 __user *)rval)->ins[6])))
rval = 0;
} else {
if (put_user(((u64)csp - STACK_BIAS),
&(((struct reg_window __user *)rval)->ins[6])))
rval = 0;
else
rval = rval - STACK_BIAS;
}
return rval;
}
/* Standard stuff. */
static inline void shift_window_buffer(int first_win, int last_win,
struct thread_info *t)
{
int i;
for (i = first_win; i < last_win; i++) {
t->rwbuf_stkptrs[i] = t->rwbuf_stkptrs[i+1];
memcpy(&t->reg_window[i], &t->reg_window[i+1],
sizeof(struct reg_window));
}
}
void synchronize_user_stack(void)
{
struct thread_info *t = current_thread_info();
unsigned long window;
Annotation
- Immediate include surface: `linux/errno.h`, `linux/export.h`, `linux/sched.h`, `linux/sched/debug.h`, `linux/sched/task.h`, `linux/sched/task_stack.h`, `linux/kernel.h`, `linux/mm.h`.
- Detected declarations: `function Copyright`, `function arch_cpu_idle_dead`, `function show_regwindow32`, `function show_regwindow`, `function show_regs`, `function __global_reg_self`, `function __global_reg_poll`, `function arch_trigger_cpumask_backtrace`, `function for_each_cpu`, `function sysrq_handle_globreg`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.