arch/powerpc/platforms/cell/spu_syscalls.c

Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/cell/spu_syscalls.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/platforms/cell/spu_syscalls.c
Extension
.c
Size
2932 bytes
Lines
142
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: syscall or user/kernel boundary
Status
core 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

SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
	umode_t, mode, int, neighbor_fd)
{
	CLASS(spufs_calls, calls)();
	if (!calls)
		return -ENOSYS;

	if (flags & SPU_CREATE_AFFINITY_SPU) {
		CLASS(fd, neighbor)(neighbor_fd);
		if (fd_empty(neighbor))
			return -EBADF;
		return calls->create_thread(name, flags, mode, fd_file(neighbor));
	} else {
		return calls->create_thread(name, flags, mode, NULL);
	}
}

SYSCALL_DEFINE3(spu_run,int, fd, __u32 __user *, unpc, __u32 __user *, ustatus)
{
	CLASS(spufs_calls, calls)();
	if (!calls)
		return -ENOSYS;

	CLASS(fd, arg)(fd);
	if (fd_empty(arg))
		return -EBADF;

	return calls->spu_run(fd_file(arg), unpc, ustatus);
}

#ifdef CONFIG_COREDUMP
int elf_coredump_extra_notes_size(void)
{
	CLASS(spufs_calls, calls)();
	if (!calls)
		return 0;

	return calls->coredump_extra_notes_size();
}

int elf_coredump_extra_notes_write(struct coredump_params *cprm)
{
	CLASS(spufs_calls, calls)();
	if (!calls)
		return 0;

	return calls->coredump_extra_notes_write(cprm);
}
#endif

void notify_spus_active(void)
{
	struct spufs_calls *calls;

	calls = spufs_calls_get();
	if (!calls)
		return;

	calls->notify_spus_active();
	spufs_calls_put(calls);

	return;
}

int register_spu_syscalls(struct spufs_calls *calls)
{
	if (spufs_calls)
		return -EBUSY;

	rcu_assign_pointer(spufs_calls, calls);
	return 0;
}
EXPORT_SYMBOL_GPL(register_spu_syscalls);

void unregister_spu_syscalls(struct spufs_calls *calls)
{
	BUG_ON(spufs_calls->owner != calls->owner);
	RCU_INIT_POINTER(spufs_calls, NULL);
	synchronize_rcu();
}
EXPORT_SYMBOL_GPL(unregister_spu_syscalls);

Annotation

Implementation Notes