arch/um/kernel/process.c
Source file repositories/reference/linux-study-clean/arch/um/kernel/process.c
File Facts
- System
- Linux kernel
- Corpus path
arch/um/kernel/process.c- Extension
.c- Size
- 6996 bytes
- Lines
- 310
- Domain
- Architecture Layer
- Bucket
- arch/um
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/stddef.hlinux/err.hlinux/hardirq.hlinux/mm.hlinux/module.hlinux/personality.hlinux/proc_fs.hlinux/ptrace.hlinux/random.hlinux/cpu.hlinux/slab.hlinux/sched.hlinux/sched/debug.hlinux/sched/task.hlinux/sched/task_stack.hlinux/seq_file.hlinux/tick.hlinux/threads.hlinux/resume_user_mode.hasm/current.hasm/mmu_context.hasm/switch_to.hasm/exec.hlinux/uaccess.has-layout.hkern_util.hos.hskas.hregisters.hlinux/time-internal.hlinux/elfcore.h
Detected Declarations
function free_stackfunction alloc_stackfunction set_currentfunction interrupt_endfunction get_current_pidfunction new_thread_handlerfunction fork_handlerfunction copy_threadfunction initial_thread_cbfunction arch_dup_task_structfunction um_idle_sleepfunction arch_cpu_idlefunction arch_cpu_idle_preparefunction __uml_cant_sleepfunction uml_need_reschedfunction do_uml_exitcallsfunction copy_from_user_procfunction singlesteppingfunction arch_align_stackfunction __get_wchanexport cpu_tasksexport uml_strdup
Annotated Snippet
int __uml_cant_sleep(void) {
return in_atomic() || irqs_disabled() || in_interrupt();
/* Is in_interrupt() really needed? */
}
int uml_need_resched(void)
{
return need_resched();
}
extern exitcall_t __uml_exitcall_begin, __uml_exitcall_end;
void do_uml_exitcalls(void)
{
exitcall_t *call;
call = &__uml_exitcall_end;
while (--call >= &__uml_exitcall_begin)
(*call)();
}
char *uml_strdup(const char *string)
{
return kstrdup(string, GFP_KERNEL);
}
EXPORT_SYMBOL(uml_strdup);
int copy_from_user_proc(void *to, void __user *from, int size)
{
return copy_from_user(to, from, size);
}
int singlestepping(void)
{
return test_thread_flag(TIF_SINGLESTEP);
}
/*
* Only x86 and x86_64 have an arch_align_stack().
* All other arches have "#define arch_align_stack(x) (x)"
* in their asm/exec.h
* As this is included in UML from asm-um/system-generic.h,
* we can use it to behave as the subarch does.
*/
#ifndef arch_align_stack
unsigned long arch_align_stack(unsigned long sp)
{
if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
sp -= get_random_u32_below(8192);
return sp & ~0xf;
}
#endif
unsigned long __get_wchan(struct task_struct *p)
{
unsigned long stack_page, sp, ip;
bool seen_sched = 0;
stack_page = (unsigned long) task_stack_page(p);
/* Bail if the process has no kernel stack for some reason */
if (stack_page == 0)
return 0;
sp = p->thread.switch_buf->JB_SP;
/*
* Bail if the stack pointer is below the bottom of the kernel
* stack for some reason
*/
if (sp < stack_page)
return 0;
while (sp < stack_page + THREAD_SIZE) {
ip = *((unsigned long *) sp);
if (in_sched_functions(ip))
/* Ignore everything until we're above the scheduler */
seen_sched = 1;
else if (kernel_text_address(ip) && seen_sched)
return ip;
sp += sizeof(unsigned long);
}
return 0;
}
Annotation
- Immediate include surface: `linux/stddef.h`, `linux/err.h`, `linux/hardirq.h`, `linux/mm.h`, `linux/module.h`, `linux/personality.h`, `linux/proc_fs.h`, `linux/ptrace.h`.
- Detected declarations: `function free_stack`, `function alloc_stack`, `function set_current`, `function interrupt_end`, `function get_current_pid`, `function new_thread_handler`, `function fork_handler`, `function copy_thread`, `function initial_thread_cb`, `function arch_dup_task_struct`.
- Atlas domain: Architecture Layer / arch/um.
- Implementation status: integration 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.