spu_run(2) System Calls Manual spu_run(2) spu_run - SPU (libc -lc) #include /* SPU_* */ #include /* SYS_* */ #include int syscall(SYS_spu_run, int fd, uint32_t *npc, uint32_t *event); : glibc spu_run() syscall(2). spu_run() PowerPC Cell Broadband Engine (SPUs). fd spu_create(2) SPU . SPU npc. SPU spu_run() SPU . SPU SPUs ( pthread_create(3)). spu_run() SPU npc spu_run() npc. event . SPU SPU_CREATE_EVENTS_ENABLED spu_run(). ( ) : SPE_EVENT_DMA_ALIGNMENT DMA. SPE_EVENT_INVALID_DMA MFC DMA . SPE_EVENT_SPE_DATA_STORAGE DMA. SPE_EVENT_SPE_ERROR . NULL event. . spu_run() spu_status. -1 errno . spu_status 14 stop-and-signal SPU. : 0x02 SPU stop-and-signal. 0x04 SPU halt. 0x08 SPU . 0x10 SPU . 0x20 SPU . 0x40 SPU . 0x3fff0000 stop-and-signal. 0x02. spu_run() . EBADF fd . EFAULT npc event NULL . EINTR spu_run() signal(7). npc . EINVAL fd spu_create(2). ENOMEM (MFC). ENOSYS SPUs spufs . PowerPC. 2.6.16. spu_run() SPUs . . SPU spu_run(). #include #include #include #include #include #include #include int main(void) { int context, fd, spu_status; uint32_t instruction, npc; context = syscall(SYS_spu_create, "/spu/example-context", 0, 0755); if (context == -1) err(EXIT_FAILURE, "spu_create"); /* * 'stop 0x1234' * SPU. */ instruction = 0x00001234; fd = open("/spu/example-context/mem", O_RDWR); if (fd == -1) err(EXIT_FAILURE, "open"); write(fd, &instruction, sizeof(instruction)); /* * npc * SPU. * mem 0x0. */ npc = 0; spu_status = syscall(SYS_spu_run, context, &npc, NULL); if (spu_status == -1) err(EXIT_FAILURE, "open"); /* * 0x12340002: * 0x00000002 ( spu stop-and-signal) * | 0x12340000 ( stop-and-signal) */ printf("SPU Status: %#08x\n", spu_status); exit(EXIT_SUCCESS); } close(2), spu_create(2), capabilities(7), spufs(7) 3 . . : . 6.18 8 2026 spu_run(2)