arch/parisc/kernel/process.c

Source file repositories/reference/linux-study-clean/arch/parisc/kernel/process.c

File Facts

System
Linux kernel
Corpus path
arch/parisc/kernel/process.c
Extension
.c
Size
7713 bytes
Lines
284
Domain
Architecture Layer
Bucket
arch/parisc
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (pdc_iodc_getc() == 13) {
			printk("Rebooting...\n");
			machine_restart(NULL);
		}
	}
}

void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);

void machine_halt(void)
{
	machine_power_off();
}

void flush_thread(void)
{
	/* Only needs to handle fpu stuff or perf monitors.
	** REVISIT: several arches implement a "lazy fpu state".
	*/
}

/*
 * Idle thread support
 *
 * Detect when running on QEMU with SeaBIOS PDC Firmware and let
 * QEMU idle the host too.
 */

int running_on_qemu __ro_after_init;
EXPORT_SYMBOL(running_on_qemu);

/*
 * Called from the idle thread for the CPU which has been shutdown.
 */
void __noreturn arch_cpu_idle_dead(void)
{
#ifdef CONFIG_HOTPLUG_CPU
	idle_task_exit();

	local_irq_disable();

	/* Tell the core that this CPU is now safe to dispose of. */
	cpuhp_ap_report_dead();

	/* Ensure that the cache lines are written out. */
	flush_cache_all_local();
	flush_tlb_all_local(NULL);

	/* Let PDC firmware put CPU into firmware idle loop. */
	__pdc_cpu_rendezvous();

	pr_warn("PDC does not provide rendezvous function.\n");
#endif
	while (1);
}

void __cpuidle arch_cpu_idle(void)
{
	/* nop on real hardware, qemu will idle sleep. */
	asm volatile("or %%r10,%%r10,%%r10\n":::);
}

static int __init parisc_idle_init(void)
{
	if (!running_on_qemu)
		cpu_idle_poll_ctrl(1);

	return 0;
}
arch_initcall(parisc_idle_init);

/*
 * Copy architecture-specific thread state
 */
int
copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
{
	u64 clone_flags = args->flags;
	unsigned long usp = args->stack;
	unsigned long tls = args->tls;
	struct pt_regs *cregs = &(p->thread.regs);
	void *stack = task_stack_page(p);
	
	/* We have to use void * instead of a function pointer, because
	 * function pointers aren't a pointer to the function on 64-bit.
	 * Make them const so the compiler knows they live in .text */
	extern void * const ret_from_kernel_thread;
	extern void * const child_return;

Annotation

Implementation Notes