Last active
August 29, 2015 14:16
-
-
Save Bigpet/8d08661778b99e038701 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <sys/process.h> | |
| #include <sys/ppu_thread.h> | |
| #include <pthread.h> | |
| SYS_PROCESS_PARAM(1001, 0x10000) | |
| int thread_getStackSize(uint64_t arg) { | |
| pthread_attr_t attr; | |
| size_t size = 0; | |
| int ret = 0; | |
| ret = pthread_attr_init(&attr); | |
| if (ret == -1) { | |
| printf("[Error ]pthread_attr_init failed with return value=%d\n", ret); | |
| return 1; | |
| } | |
| ret = pthread_attr_getstacksize(&attr, &size); | |
| if (ret == -1) { | |
| printf("[Error ]pthread_attr_getstackstate failed with return value=%d\n", ret); | |
| return 2; | |
| } | |
| ret = pthread_attr_destroy(&attr); | |
| if (ret == -1) { | |
| printf("[Error ]pthread_attr_destroy failed with return value=%d\n", ret); | |
| return 3; | |
| } | |
| printf("[Debug ]Thread Stack size is 0x%016X. Requested size=0x%016X\n", size, arg); | |
| return 0; | |
| } | |
| int test_Execute(size_t size) { | |
| int ret = 0; | |
| sys_ppu_thread_t tid; | |
| ret = sys_ppu_thread_create(&tid, | |
| thread_getStackSize, size, | |
| 0, size, | |
| 0, "PPU:GetStackSize"); | |
| printf("[System]Created PPU thread with stacksize=0x%016X\n", size); | |
| if (ret != 0) { | |
| printf("[Error ]Call sys_ppu_thread_create failed with return value=%d\n", ret); | |
| return -1; | |
| } | |
| return 0; | |
| } | |
| int main(void) { | |
| test_Execute(4096); | |
| test_Execute(0); | |
| test_Execute(16); | |
| printf("-- Exiting --\n"); | |
| return 0; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment