diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a01479..9adba1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,18 +23,6 @@ if(FXLIBC_TARGET STREQUAL vhex-sh) set(CMAKE_INSTALL_PREFIX "${FXSDK_COMPILER_INSTALL}" CACHE PATH "..." FORCE) endif() -if(FXLIBC_TARGET STREQUAL casiowin-fx) - list(APPEND TARGET_FOLDERS sh-generic) - set(FXLIBC_ARCH sh) - add_definitions(-D__SUPPORT_CASIOWIN_FX9860G) -endif() - -if(FXLIBC_TARGET STREQUAL casiowin-cg) - list(APPEND TARGET_FOLDERS sh-generic) - set(FXLIBC_ARCH sh) - add_definitions(-D__SUPPORT_CASIOWIN_FXCG50) -endif() - if(FXLIBC_TARGET STREQUAL gint) list(APPEND TARGET_FOLDERS sh-generic) set(FXLIBC_ARCH sh) @@ -55,10 +43,6 @@ if(sh-generic IN_LIST TARGET_FOLDERS) add_definitions(-D__SUPPORT_ARCH_SH) endif() -if(x86-generic IN_LIST TARGET_FOLDERS) - add_definitions(-D__SUPPORT_ARCH_X86) -endif() - # TODO: Preprocessor definitions for configuration # configure_file() @@ -83,209 +67,187 @@ set(SOURCES 3rdparty/tinymt32/rand.c 3rdparty/tinymt32/tinymt32.c # assert - src/libc/assert/assert.c + src/assert/assert.c # ctype - src/libc/ctype/isalnum.c - src/libc/ctype/isalpha.c - src/libc/ctype/isblank.c - src/libc/ctype/iscntrl.c - src/libc/ctype/isdigit.c - src/libc/ctype/isgraph.c - src/libc/ctype/islower.c - src/libc/ctype/isprint.c - src/libc/ctype/ispunct.c - src/libc/ctype/isspace.c - src/libc/ctype/isupper.c - src/libc/ctype/isxdigit.c - src/libc/ctype/tolower.c - src/libc/ctype/toupper.c + src/ctype/isalnum.c + src/ctype/isalpha.c + src/ctype/isblank.c + src/ctype/iscntrl.c + src/ctype/isdigit.c + src/ctype/isgraph.c + src/ctype/islower.c + src/ctype/isprint.c + src/ctype/ispunct.c + src/ctype/isspace.c + src/ctype/isupper.c + src/ctype/isxdigit.c + src/ctype/tolower.c + src/ctype/toupper.c # errno - src/libc/errno/errno.c + src/errno/errno.c # inttypes - src/libc/inttypes/imaxabs.c - src/libc/inttypes/imaxdiv.c - src/libc/inttypes/strtoimax.c - src/libc/inttypes/strtoumax.c + src/inttypes/imaxabs.c + src/inttypes/imaxdiv.c + src/inttypes/strtoimax.c + src/inttypes/strtoumax.c # locale - src/libc/locale/setlocale.c - src/libc/locale/localeconv.c + src/locale/setlocale.c + src/locale/localeconv.c # signal - src/libc/signal/signal.c - src/libc/signal/raise.c + src/signal/signal.c + src/signal/raise.c # stdio - src/libc/stdio/asprintf.c - src/libc/stdio/clearerr.c - src/libc/stdio/dprintf.c - src/libc/stdio/fclose.c - src/libc/stdio/fdopen.c - src/libc/stdio/ferror.c - src/libc/stdio/feof.c - src/libc/stdio/fflush.c - src/libc/stdio/fgetc.c - src/libc/stdio/fgetpos.c - src/libc/stdio/fgets.c - src/libc/stdio/fileutil.c - src/libc/stdio/fopen.c - src/libc/stdio/fprintf.c - src/libc/stdio/fputc.c - src/libc/stdio/fputs.c - src/libc/stdio/fread.c - src/libc/stdio/freopen.c - src/libc/stdio/fseek.c - src/libc/stdio/fsetpos.c - src/libc/stdio/ftell.c - src/libc/stdio/fwrite.c - src/libc/stdio/getc.c - src/libc/stdio/getchar.c - src/libc/stdio/gets.c - src/libc/stdio/getline.c - src/libc/stdio/getdelim.c - src/libc/stdio/perror.c - src/libc/stdio/printf.c - src/libc/stdio/printf/format_fixed.c - src/libc/stdio/printf/format_fp.c - src/libc/stdio/printf/format_usual.c - src/libc/stdio/printf/print.c - src/libc/stdio/printf/util.c - src/libc/stdio/putc.c - src/libc/stdio/putchar.c - src/libc/stdio/puts.c - src/libc/stdio/remove.c - src/libc/stdio/rewind.c - src/libc/stdio/setbuf.c - src/libc/stdio/setvbuf.c - src/libc/stdio/snprintf.c - src/libc/stdio/sprintf.c - src/libc/stdio/streams.c - src/libc/stdio/ungetc.c - src/libc/stdio/vasprintf.c - src/libc/stdio/vdprintf.c - src/libc/stdio/vfprintf.c - src/libc/stdio/vprintf.c - src/libc/stdio/vsnprintf.c - src/libc/stdio/vsprintf.c + src/stdio/asprintf.c + src/stdio/clearerr.c + src/stdio/dprintf.c + src/stdio/fclose.c + src/stdio/fdopen.c + src/stdio/ferror.c + src/stdio/feof.c + src/stdio/fflush.c + src/stdio/fgetc.c + src/stdio/fgetpos.c + src/stdio/fgets.c + src/stdio/fileutil.c + src/stdio/fopen.c + src/stdio/fprintf.c + src/stdio/fputc.c + src/stdio/fputs.c + src/stdio/fread.c + src/stdio/freopen.c + src/stdio/fseek.c + src/stdio/fsetpos.c + src/stdio/ftell.c + src/stdio/fwrite.c + src/stdio/getc.c + src/stdio/getchar.c + src/stdio/gets.c + src/stdio/getline.c + src/stdio/getdelim.c + src/stdio/perror.c + src/stdio/printf.c + src/stdio/printf/format_fixed.c + src/stdio/printf/format_fp.c + src/stdio/printf/format_usual.c + src/stdio/printf/print.c + src/stdio/printf/util.c + src/stdio/putc.c + src/stdio/putchar.c + src/stdio/puts.c + src/stdio/remove.c + src/stdio/rewind.c + src/stdio/setbuf.c + src/stdio/setvbuf.c + src/stdio/snprintf.c + src/stdio/sprintf.c + src/stdio/streams.c + src/stdio/ungetc.c + src/stdio/vasprintf.c + src/stdio/vdprintf.c + src/stdio/vfprintf.c + src/stdio/vprintf.c + src/stdio/vsnprintf.c + src/stdio/vsprintf.c # stdlib - src/libc/stdlib/abort.c - src/libc/stdlib/abs.c - src/libc/stdlib/atof.c - src/libc/stdlib/atoi.c - src/libc/stdlib/atol.c - src/libc/stdlib/atoll.c - src/libc/stdlib/calloc.c - src/libc/stdlib/div.c - src/libc/stdlib/exit.c - src/libc/stdlib/labs.c - src/libc/stdlib/ldiv.c - src/libc/stdlib/llabs.c - src/libc/stdlib/lldiv.c - src/libc/stdlib/qsort.c - src/libc/stdlib/reallocarray.c - src/libc/stdlib/strto_fp.c - src/libc/stdlib/strto_int.c - src/libc/stdlib/strtod.c - src/libc/stdlib/strtof.c - src/libc/stdlib/strtol.c - src/libc/stdlib/strtold.c - src/libc/stdlib/strtoll.c - src/libc/stdlib/strtoul.c - src/libc/stdlib/strtoull.c + src/stdlib/abort.c + src/stdlib/abs.c + src/stdlib/atof.c + src/stdlib/atoi.c + src/stdlib/atol.c + src/stdlib/atoll.c + src/stdlib/calloc.c + src/stdlib/div.c + src/stdlib/exit.c + src/stdlib/labs.c + src/stdlib/ldiv.c + src/stdlib/llabs.c + src/stdlib/lldiv.c + src/stdlib/qsort.c + src/stdlib/reallocarray.c + src/stdlib/strto_fp.c + src/stdlib/strto_int.c + src/stdlib/strtod.c + src/stdlib/strtof.c + src/stdlib/strtol.c + src/stdlib/strtold.c + src/stdlib/strtoll.c + src/stdlib/strtoul.c + src/stdlib/strtoull.c # string - src/libc/string/memchr.c - src/libc/string/memcmp.c - src/libc/string/memcpy.c - src/libc/string/memmove.c - src/libc/string/memrchr.c - src/libc/string/memset.c - src/libc/string/strcasecmp.c - src/libc/string/strcasestr.c - src/libc/string/strcat.c - src/libc/string/strchr.c - src/libc/string/strchrnul.c - src/libc/string/strcmp.c - src/libc/string/strcoll.c - src/libc/string/strcpy.c - src/libc/string/strcspn.c - src/libc/string/strdup.c - src/libc/string/strerror.c - src/libc/string/strlen.c - src/libc/string/strncasecmp.c - src/libc/string/strncat.c - src/libc/string/strncmp.c - src/libc/string/strncpy.c - src/libc/string/strndup.c - src/libc/string/strnlen.c - src/libc/string/strpbrk.c - src/libc/string/strrchr.c - src/libc/string/strspn.c - src/libc/string/strstr.c - src/libc/string/strstr_base.c - src/libc/string/strtok.c - src/libc/string/strxfrm.c + src/string/memchr.c + src/string/memcmp.c + src/string/memcpy.c + src/string/memmove.c + src/string/memrchr.c + src/string/memset.c + src/string/strcasecmp.c + src/string/strcasestr.c + src/string/strcat.c + src/string/strchr.c + src/string/strchrnul.c + src/string/strcmp.c + src/string/strcoll.c + src/string/strcpy.c + src/string/strcspn.c + src/string/strdup.c + src/string/strerror.c + src/string/strlen.c + src/string/strncasecmp.c + src/string/strncat.c + src/string/strncmp.c + src/string/strncpy.c + src/string/strndup.c + src/string/strnlen.c + src/string/strpbrk.c + src/string/strrchr.c + src/string/strspn.c + src/string/strstr.c + src/string/strstr_base.c + src/string/strtok.c + src/string/strxfrm.c # time - src/libc/time/asctime.c - src/libc/time/ctime.c - src/libc/time/difftime.c - src/libc/time/gmtime.c - src/libc/time/localtime.c - src/libc/time/mktime.c - src/libc/time/strftime.c) + src/time/asctime.c + src/time/ctime.c + src/time/difftime.c + src/time/gmtime.c + src/time/localtime.c + src/time/mktime.c + src/time/strftime.c) # Silence extended warnings on Grisu2b code set_source_files_properties(3rdparty/grisu2b_59_56/grisu2b_59_56.c PROPERTIES COMPILE_OPTIONS "-Wno-all;-Wno-extra") -if(vhex-generic IN_LIST TARGET_FOLDERS) - # TODO -endif() - if(vhex-sh IN_LIST TARGET_FOLDERS) list(APPEND SOURCES - src/libc/signal/target/vhex-sh/kill.S - src/libc/signal/target/vhex-sh/signal.S - src/libc/stdlib/target/vhex-sh/free.c - src/libc/stdlib/target/vhex-sh/malloc.c - src/libc/stdlib/target/vhex-sh/realloc.c - src/posix/fcntl/target/vhex-sh/open.S - src/posix/sys/wait/target/vhex-sh/wait.S - src/posix/sys/wait/target/vhex-sh/waitpid.S - src/posix/unistd/target/vhex-sh/read.S - src/posix/unistd/target/vhex-sh/getppid.S - src/posix/unistd/target/vhex-sh/close.S - src/posix/unistd/target/vhex-sh/fork_execve.S - src/posix/unistd/target/vhex-sh/lseek.S - src/posix/unistd/target/vhex-sh/getpid.S - src/posix/unistd/target/vhex-sh/getpgid.S - src/posix/unistd/target/vhex-sh/setpgid.S - src/posix/unistd/target/vhex-sh/write.S) + src/stdlib/target/vhex-sh/free.c + src/stdlib/target/vhex-sh/malloc.c + src/stdlib/target/vhex-sh/realloc.c + ) endif() if(sh-generic IN_LIST TARGET_FOLDERS) list(APPEND SOURCES - src/libc/setjmp/target/sh-generic/setjmp.S - src/libc/setjmp/target/sh-generic/longjmp.S - src/libc/string/target/sh-generic/memchr.S - src/libc/string/target/sh-generic/memcmp.S - src/libc/string/target/sh-generic/memcpy.S - src/libc/string/target/sh-generic/memmove.S - src/libc/string/target/sh-generic/memset.S - src/libc/string/target/sh-generic/strlen.S + src/setjmp/target/sh-generic/setjmp.S + src/setjmp/target/sh-generic/longjmp.S + src/string/target/sh-generic/memchr.S + src/string/target/sh-generic/memcmp.S + src/string/target/sh-generic/memcpy.S + src/string/target/sh-generic/memmove.S + src/string/target/sh-generic/memset.S + src/string/target/sh-generic/strlen.S src/target/sh-generic/cpucap.c) endif() if(gint IN_LIST TARGET_FOLDERS) list(APPEND SOURCES # stdlib - src/libc/stdlib/target/gint/free.c - src/libc/stdlib/target/gint/malloc.c - src/libc/stdlib/target/gint/realloc.c + src/stdlib/target/gint/free.c + src/stdlib/target/gint/malloc.c + src/stdlib/target/gint/realloc.c # time - src/libc/time/target/gint/clock.c - src/libc/time/target/gint/time.c) -endif() - -if(casiowin-fx IN_LIST TARGET_FOLDERS) - list(APPEND SOURCES - src/posix/unistd/target/casiowin-fx/close.S) + src/time/target/gint/clock.c + src/time/target/gint/time.c) endif() # TODO: All targets diff --git a/include/target/casiowin-cg/bits/__trapa.h b/include/target/casiowin-cg/bits/__trapa.h deleted file mode 100644 index 1d1f898..0000000 --- a/include/target/casiowin-cg/bits/__trapa.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __BITS_TRAPA_H__ -# define __BITS_TRAPA_H__ - -/* -** Normally the SH3/SH4 processor provide a "trapa" instruction which allow -** tipping between userland and kernel. But Casio's don't use this method -** (this is why we are always in "privilegied mode" and we can do whatever -** we whant) but use custom calling convention to access the syscall call. -** -** The convention whant that the user jump into the syscall trampoline code -** located at 0x80010070 for fx9860g and 0x80020070 for fxcg20/50. -*/ -# define casio_trapa(id) \ - mov.l syscall_table, r2 ;\ - mov.l syscall_id, r0 ;\ - jmp @r2 ;\ - nop ;\ -.align 4 ;\ -syscall_table: .long 0x80020070 ;\ -syscall_id: .long id - -#endif /*__BITS_TRAPA_H__*/ diff --git a/include/target/casiowin-cg/bits/asm/unistd_32.h b/include/target/casiowin-cg/bits/asm/unistd_32.h deleted file mode 100644 index a8dcf9e..0000000 --- a/include/target/casiowin-cg/bits/asm/unistd_32.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __BITS_UNISTD_32_H__ -# define __BITS_UNISTD_32_H__ - -// File manipulation -#define __NR_BFile_Remove 0x00001db4 -#define __NR_BFile_Create 0x00001dae -#define __NR_BFile_Open 0x00001da3 -#define __NR_BFile_Close 0x00001da4 -#define __NR_BFile_Size 0x00001da6 -#define __NR_BFile_Write 0x00001daf -#define __NR_BFile_Read 0x00001dac -#define __NR_BFile_FindFirst 0x00001db7 -#define __NR_BFile_FindNext 0x00001db9 -#define __NR_BFile_FindClose 0x00001dba - -// Keyboard interface -#define __NR_PutKeyCode 0x000012c6 -#define __NR_GetKeyWait 0x000012bf -#define __NR_ClearKeyBuffer 0x000012c7 -#define __NR_GetVRAMAddress 0x000001e6 - -// Memory management -#define __NR_Bmem_malloc 0x00001f44 -#define __NR_Bmem_free 0x00001f42 -#define __NR_Bmem_calloc 0x00001f40 -#define __NR_Bmem_realloc 0x00001f46 - -// Timer interface -#define __NR_Timer_Install 0x000008d9 -#define __NR_Timer_Deinstall 0x000008da -#define __NR_Timer_Start 0x000008db -#define __NR_Timer_Stop 0x000008dc - -#endif /*__BITS_UNISTD_32_H__*/ diff --git a/include/target/casiowin-cg/bits/confname.h b/include/target/casiowin-cg/bits/confname.h deleted file mode 100644 index 39733dc..0000000 --- a/include/target/casiowin-cg/bits/confname.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __BITS_CONFNAME_H__ -# define __BITS_CONFNAME_H__ - -#define _SC_PAGE_SIZE 0 -#define _SC_PAGESIZE _SC_PAGE_SIZE - -#endif /*__BITS_CONFNAME_H__*/ diff --git a/include/target/casiowin-cg/bits/exit.h b/include/target/casiowin-cg/bits/exit.h deleted file mode 100644 index 30e4207..0000000 --- a/include/target/casiowin-cg/bits/exit.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __BITS_EXIT_H__ -# define __BITS_EXIT_H__ - -/* Exit codes for CASIOWIN add-ins. */ -#define EXIT_SUCCESS 1 -#define EXIT_FAILURE 0 - -#endif /*__BITS_EXIT_H__*/ diff --git a/include/target/casiowin-fx/bits/asm/unistd_32.h b/include/target/casiowin-fx/bits/asm/unistd_32.h deleted file mode 100644 index 89d4c93..0000000 --- a/include/target/casiowin-fx/bits/asm/unistd_32.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __BITS_UNISTD_32_H__ -# define __BITS_UNISTD_32_H__ - -// File manipulation -#define __NR_Bfile_CreateFile 0x00000434 -#define __NR_Bfile_OpenFile 0x0000042c -#define __NR_Bfile_WriteFile 0x00000435 -#define __NR_Bfile_ReadFile 0x00000432 -#define __NR_Bfile_SeekFile 0x00000431 -#define __NR_Bfile_CloseFile 0x0000042d -#define __NR_Bfile_FindFirst 0x0000043b -#define __NR_Bfile_FindNext 0x0000043c -#define __NR_Bfile_FindClose 0x0000043d -#define __NR_Bfile_GetMediaFree 0x0000042e -#define __NR_Bfile_RemoveFile 0x00000439 - -// Display syscalls -#define __NR_Bdisp_GetVRAM 0x00000135 -#define __NR_Bdisp_DrawLine 0x00000030 -#define __NR_Bdisp_AllClr_VRAM 0x00000143 -#define __NR_Bdisp_Display 0x00000028 -#define __NR_Bdisp_PrintMini 0x00000c4f -#define __NR_Bdisp_ClearArea 0x0000014b -#define __NR_Bdisp_ReverseArea 0x0000014d -#define __NR_Bdisp_RestoreDisp 0x00000814 -#define __NR_Bdisp_SaveDisp 0x00000813 - -// Keyboard primitives -#define __NR_Bkey_GetKey 0x0000090f -#define __NR_Bkey_PutKeycode 0x0000024f -#define __NR_BKey_GetKeyWait 0x00000247 - -// Memory management -#define __NR_Bmem_malloc 0x00000acd -#define __NR_Bmem_realloc 0x00000e6d -#define __NR_Bmem_called 0x00000e6b -#define __NR_Bmem_free 0x00000acc - -// USB primitive -#define __NR_USB_Open 0x000002ac // not sure -#define __NR_USB_Close 0x000004a4 // not sure - -// SD Card primitives -#define __NR_SDC_Init 0x0000017a // not sure -#define __NR_SDC_Mount 0x0000044b // not sure -#define __NR_SDC_Umount 0x0000044a - -// Timer interface -#define __NR_TimerInstall 0x00000118 -#define __NR_TimerDeinstall 0x00000119 -#define __NR_TimerStart 0x0000011a -#define __NR_TimerStop 0x0000011b - -// power management -#define __NR_PowerOff 0x000003f4 - -#endif /*__BITS_UNISTD_32__*/ diff --git a/include/target/casiowin-fx/bits/confname.h b/include/target/casiowin-fx/bits/confname.h deleted file mode 100644 index 39733dc..0000000 --- a/include/target/casiowin-fx/bits/confname.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __BITS_CONFNAME_H__ -# define __BITS_CONFNAME_H__ - -#define _SC_PAGE_SIZE 0 -#define _SC_PAGESIZE _SC_PAGE_SIZE - -#endif /*__BITS_CONFNAME_H__*/ diff --git a/include/target/casiowin-fx/bits/exit.h b/include/target/casiowin-fx/bits/exit.h deleted file mode 100644 index 30e4207..0000000 --- a/include/target/casiowin-fx/bits/exit.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __BITS_EXIT_H__ -# define __BITS_EXIT_H__ - -/* Exit codes for CASIOWIN add-ins. */ -#define EXIT_SUCCESS 1 -#define EXIT_FAILURE 0 - -#endif /*__BITS_EXIT_H__*/ diff --git a/include/target/casiowin-fx/bits/trapa.h b/include/target/casiowin-fx/bits/trapa.h deleted file mode 100644 index b4ab173..0000000 --- a/include/target/casiowin-fx/bits/trapa.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __BITS_TRAPA_H__ -# define __BITS_TRAPA_H__ - -/* -** Normally the SH3/SH4 processor provide a "trapa" instruction which allow -** tipping between userland and kernel. But Casio's don't use this method -** (this is why we are always in "privilegied mode" and we can do whatever -** we whant) but use custom calling convention to access the syscall call. -** -** The convention whant that the user jump into the syscall trampoline code -** located at 0x80010070 for fx9860g and 0x80020070 for fxcg20/50. -*/ -# define casio_trapa(id) \ - mov.l syscall_table, r2 ;\ - mov.l syscall_id, r0 ;\ - jmp @r2 ;\ - nop ;\ -.align 4 ;\ -syscall_table: .long 0x80010070 ;\ -syscall_id: .long id - -#endif /*__BITS_TRAPA_H__*/ diff --git a/include/target/vhex-generic/bits/asm/unistd_32.h b/include/target/vhex-generic/bits/asm/unistd_32.h deleted file mode 100644 index b93c17d..0000000 --- a/include/target/vhex-generic/bits/asm/unistd_32.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef __BITS_ASM_UNISTD_32_H__ -# define __BITS_ASM_UNISTD_32_H__ - -// Define the number of syscall -#define __NR_MAX 21 - -// Kernel Test -#define __NR_test_syscall 0 - -// Process -#define __NR_exit 1 -#define __NR_fork_execve 2 // (custom) -#define __NR_waitpid 3 -#define __NR_wait 4 -#define __NR_getpid 5 -#define __NR_getppid 6 -#define __NR_getpgid 7 -#define __NR_setpgid 8 - -// Signal -#define __NR_signal 9 -#define __NR_sigreturn 10 -#define __NR_sigaction 11 -#define __NR_kill 12 -#define __NR_sigprogmask 13 -#define __NR_sigpending 14 -#define __NR_sigaltstack 15 - -// VFS -#define __NR_read 16 -#define __NR_write 17 -#define __NR_open 18 -#define __NR_close 19 -#define __NR_lseek 20 -#define __NR_pread 21 -#define __NR_pwrite 22 - -// Memory -#define __NR_mmap 23 -#define __NR_munmap 24 -#define __NR_proc_heap_alloc 25 // (custom) -#define __NR_proc_heap_free 26 // (custom) -#define __NR_proc_heap_realloc 27 // (custom) - -#endif /*__BITS_ASM_UNISTD_32_H__*/ diff --git a/include/target/vhex-generic/bits/confname.h b/include/target/vhex-generic/bits/confname.h deleted file mode 100644 index 3f4a7fa..0000000 --- a/include/target/vhex-generic/bits/confname.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __BITS_CONFNAME_H__ -# define __BITS_CONFNAME_H__ - -//FIXME: this part is probably arch-specific(?) -#define _SC_PAGE_SIZE 0 -#define _SC_PAGESIZE _SC_PAGE_SIZE - -#endif /*__BITS_CONFNAME_H__*/ diff --git a/include/target/vhex-generic/bits/exit.h b/include/target/vhex-generic/bits/exit.h deleted file mode 100644 index f2e1124..0000000 --- a/include/target/vhex-generic/bits/exit.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __BITS_EXIT_H__ -# define __BITS_EXIT_H__ - -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 - -#endif /*__BITS_EXIT_H__*/ diff --git a/include/target/vhex-generic/bits/sigaction.h b/include/target/vhex-generic/bits/sigaction.h deleted file mode 100644 index 18a2041..0000000 --- a/include/target/vhex-generic/bits/sigaction.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __BITS_SIGACTION_H__ -# define __BITS_SIGACTION_H__ - -#include -#include - -/* Values for the HOW argument to `sigprocmask'. */ -#define SIG_BLOCK 0 /* Block signals. */ -#define SIG_UNBLOCK 1 /* Unblock signals. */ -#define SIG_SETMASK 2 /* Set the set of blocked signals. */ - -#endif /*__BITS_SIGACTION_H__*/ diff --git a/include/target/vhex-generic/bits/signum.h b/include/target/vhex-generic/bits/signum.h deleted file mode 100644 index d3e9fca..0000000 --- a/include/target/vhex-generic/bits/signum.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef __BITS_SIGNUM_H__ -# define __BITS_SIGNUM_H__ - -// Define the number of signals -#define _NSIG 32 - -// Vhex kernel internal define used to indicate -// if the signal is implemented or not -#define __SIGUNDEF ((__sighandler_t) -2) /* Not implemented */ - -/* Fake signal functions. */ -#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ -#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ -#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ - -/* ISO C99 signals. */ -#define SIGINT 2 /* Interactive attention signal. */ -#define SIGILL 4 /* Illegal instruction. */ -#define SIGABRT 6 /* Abnormal termination. */ -#define SIGFPE 8 /* Erroneous arithmetic operation. */ -#define SIGSEGV 11 /* Invalid access to storage. */ -#define SIGTERM 15 /* Termination request. */ - -/* Historical signals specified by POSIX. */ -#define SIGHUP 1 /* Hangup. */ -#define SIGQUIT 3 /* Quit. */ -#define SIGTRAP 5 /* Trace/breakpoint trap. */ -#define SIGKILL 9 /* Killed. */ -#define SIGBUS 10 /* Bus error. */ -#define SIGSYS 12 /* Bad system call. */ -#define SIGPIPE 13 /* Broken pipe. */ -#define SIGALRM 14 /* Alarm clock. */ - -/* New(er) POSIX signals (1003.1-2008, 1003.1-2013). */ -#define SIGURG 16 /* Urgent data is available at a socket. */ -#define SIGSTOP 17 /* Stop, unblockable. */ -#define SIGTSTP 18 /* Keyboard stop. */ -#define SIGCONT 19 /* Continue. */ -#define SIGCHLD 20 /* Child terminated or stopped. */ -#define SIGTTIN 21 /* Background read from control terminal. */ -#define SIGTTOU 22 /* Background write to control terminal. */ -#define SIGPOLL 23 /* Pollable event occurred (System V). */ -#define SIGXCPU 24 /* CPU time limit exceeded. */ -#define SIGXFSZ 25 /* File size limit exceeded. */ -#define SIGVTALRM 26 /* Virtual timer expired. */ -#define SIGPROF 27 /* Profiling timer expired. */ -#define SIGUSR1 30 /* User-defined signal 1. */ -#define SIGUSR2 31 /* User-defined signal 2. */ - -#endif /*__BITS_SIGNUM_H__*/ diff --git a/include/target/vhex-generic/bits/waitflags.h b/include/target/vhex-generic/bits/waitflags.h deleted file mode 100644 index 7148b4d..0000000 --- a/include/target/vhex-generic/bits/waitflags.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __BITS_WAITFLAGS_H__ -# define __BITS_WAITFLAGS_H__ - -/* Bits in the third argument to `waitpid'. */ -#define WNOHANG 1 /* Don't block waiting. */ -#define WUNTRACED 2 /* Report status of stopped child. */ -#define WCONTINUED 3 /* Report continued child. */ - -#endif /*__BITS_WAITFLAGS_H__*/ diff --git a/include/target/vhex-generic/bits/waitstatus.h b/include/target/vhex-generic/bits/waitstatus.h deleted file mode 100644 index d0c8349..0000000 --- a/include/target/vhex-generic/bits/waitstatus.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __BITS_WAITSTATUS_H__ -# define __BITS_WAITSTATUS_H__ - -/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ -#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) - -/* If WIFSIGNALED(STATUS), the terminating signal. */ -#define __WTERMSIG(status) ((status) & 0x7f) - -/* If WIFSTOPPED(STATUS), the signal that stopped the child. */ -#define __WSTOPSIG(status) __WEXITSTATUS(status) - -/* Nonzero if STATUS indicates normal termination. */ -#define __WIFEXITED(status) (__WTERMSIG(status) == 0) - -/* Nonzero if STATUS indicates termination by a signal. */ -#define __WIFSIGNALED(status) \ - (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) - -/* Nonzero if STATUS indicates the child is stopped. */ -#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f) - -/* Nonzero if STATUS indicates the child continued after a stop. */ -# define __WIFCONTINUED(status) ((status) == __W_CONTINUED) - -/* Nonzero if STATUS indicates the child dumped core. */ -#define __WCOREDUMP(status) ((status) & __WCOREFLAG) - -/* Macros for constructing status values. */ -#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) -#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) -#define __W_CONTINUED 0xffff -#define __WCOREFLAG 0x80 - -#endif /*__BITS_WAITSTATUS_H__*/ diff --git a/include/threads.h b/include/threads.h deleted file mode 100644 index 056f3c2..0000000 --- a/include/threads.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __THREADS_H__ -# define __THREADS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -//--- -// Warnig, this part is experimental and reserved for Vhex -//--- - -// Define Mutex type -enum { - mtx_plain = 0, - mtx_recursive = 1, - mtx_timed = 2 -}; - -// Define mutex structure -// @note: This is a custom implementation -#define MTX_WATERMARK (0xdeadbeef) -struct __mtx_s { - uint32_t __watermark; - uint16_t lock; - uint8_t type; -}; -typedef struct __mtx_s mtx_t; - - -//--- -// Mutex functions -//--- - -/* -** Creates a new mutex object with type __TYPE. -** @note: If successful the new object is pointed by __MUTEX. -*/ -extern int mtx_init(mtx_t *__mutex, int __type); - -/* -** Block the current thread until the mutex pointed to by __MUTEX is unlocked. -** In that case current thread will not be blocked. -*/ -extern int mtx_lock(mtx_t *__mutex); - -/* -** Try to lock the mutex pointed by __MUTEX without blocking. -** @note: If the mutex is free the current threads takes control of it, -** otherwise it returns immediately. -*/ -extern int mtx_trylock(mtx_t *__mutex); - -/* -** Unlock the mutex pointed by __MUTEX. -** @note: It may potentially awake other threads waiting on this mutex. -*/ -extern int mtx_unlock (mtx_t *__mutex); - -/* Destroy the mutex object pointed by __MUTEX. */ -extern void mtx_destroy(mtx_t *__mutex); - - -//--- -// Atomic operations -//--- -/* -** Save the current SR register and set the SR.BIT bit up (start atomic operations) -** @note: return the saved SR register (if has been saved), 0xffffffff otherwise. -*/ -extern uint32_t __thread_atomic_start(void); - -/* -** Restore the saved SR register -** @note: return the restored SR register or -1 otherwise. -*/ -extern uint32_t __thread_atomic_stop(void); - -#ifdef __cplusplus -} -#endif - -#endif /*__THREADS_H__*/ diff --git a/src/libc/assert/assert.c b/src/assert/assert.c similarity index 100% rename from src/libc/assert/assert.c rename to src/assert/assert.c diff --git a/src/libc/ctype/isalnum.c b/src/ctype/isalnum.c similarity index 100% rename from src/libc/ctype/isalnum.c rename to src/ctype/isalnum.c diff --git a/src/libc/ctype/isalpha.c b/src/ctype/isalpha.c similarity index 100% rename from src/libc/ctype/isalpha.c rename to src/ctype/isalpha.c diff --git a/src/libc/ctype/isblank.c b/src/ctype/isblank.c similarity index 100% rename from src/libc/ctype/isblank.c rename to src/ctype/isblank.c diff --git a/src/libc/ctype/iscntrl.c b/src/ctype/iscntrl.c similarity index 100% rename from src/libc/ctype/iscntrl.c rename to src/ctype/iscntrl.c diff --git a/src/libc/ctype/isdigit.c b/src/ctype/isdigit.c similarity index 100% rename from src/libc/ctype/isdigit.c rename to src/ctype/isdigit.c diff --git a/src/libc/ctype/isgraph.c b/src/ctype/isgraph.c similarity index 100% rename from src/libc/ctype/isgraph.c rename to src/ctype/isgraph.c diff --git a/src/libc/ctype/islower.c b/src/ctype/islower.c similarity index 100% rename from src/libc/ctype/islower.c rename to src/ctype/islower.c diff --git a/src/libc/ctype/isprint.c b/src/ctype/isprint.c similarity index 100% rename from src/libc/ctype/isprint.c rename to src/ctype/isprint.c diff --git a/src/libc/ctype/ispunct.c b/src/ctype/ispunct.c similarity index 100% rename from src/libc/ctype/ispunct.c rename to src/ctype/ispunct.c diff --git a/src/libc/ctype/isspace.c b/src/ctype/isspace.c similarity index 100% rename from src/libc/ctype/isspace.c rename to src/ctype/isspace.c diff --git a/src/libc/ctype/isupper.c b/src/ctype/isupper.c similarity index 100% rename from src/libc/ctype/isupper.c rename to src/ctype/isupper.c diff --git a/src/libc/ctype/isxdigit.c b/src/ctype/isxdigit.c similarity index 100% rename from src/libc/ctype/isxdigit.c rename to src/ctype/isxdigit.c diff --git a/src/libc/ctype/tolower.c b/src/ctype/tolower.c similarity index 100% rename from src/libc/ctype/tolower.c rename to src/ctype/tolower.c diff --git a/src/libc/ctype/toupper.c b/src/ctype/toupper.c similarity index 100% rename from src/libc/ctype/toupper.c rename to src/ctype/toupper.c diff --git a/src/libc/errno/errno.c b/src/errno/errno.c similarity index 100% rename from src/libc/errno/errno.c rename to src/errno/errno.c diff --git a/src/libc/inttypes/imaxabs.c b/src/inttypes/imaxabs.c similarity index 100% rename from src/libc/inttypes/imaxabs.c rename to src/inttypes/imaxabs.c diff --git a/src/libc/inttypes/imaxdiv.c b/src/inttypes/imaxdiv.c similarity index 100% rename from src/libc/inttypes/imaxdiv.c rename to src/inttypes/imaxdiv.c diff --git a/src/libc/inttypes/strtoimax.c b/src/inttypes/strtoimax.c similarity index 100% rename from src/libc/inttypes/strtoimax.c rename to src/inttypes/strtoimax.c diff --git a/src/libc/inttypes/strtoumax.c b/src/inttypes/strtoumax.c similarity index 100% rename from src/libc/inttypes/strtoumax.c rename to src/inttypes/strtoumax.c diff --git a/src/libc/signal/target/vhex-sh/kill.S b/src/libc/signal/target/vhex-sh/kill.S deleted file mode 100644 index 5b882d3..0000000 --- a/src/libc/signal/target/vhex-sh/kill.S +++ /dev/null @@ -1,18 +0,0 @@ -#include -.text -.global _kill -.type _kill, @function - - -.align 2 -/* -** extern int kill(pid_t pid, int sig); -** Send signal SIG to process number PID. If PID is zero, send SIG to all -** processes in the current process's process group. If PID is < -1, send SIG to -** all processes in process group - PID. -*/ -_kill: - trapa #__NR_kill - rts - nop -.end diff --git a/src/libc/signal/target/vhex-sh/signal.S b/src/libc/signal/target/vhex-sh/signal.S deleted file mode 100644 index e288726..0000000 --- a/src/libc/signal/target/vhex-sh/signal.S +++ /dev/null @@ -1,17 +0,0 @@ -#include -.text -.global _signal -.type _signal, @function - - -.align 2 -/* -** extern void (*signal(int signum, void (*handler)(int)))(int); -** Set the handler for the signal SIG to HANDLER, returning the old handler, or -** SIG_ERR on error. By default `signal' has the BSD semantic. -*/ -_signal: - trapa #__NR_signal - rts - nop -.end diff --git a/src/libc/threads/atomic.S b/src/libc/threads/atomic.S deleted file mode 100644 index 1cd105f..0000000 --- a/src/libc/threads/atomic.S +++ /dev/null @@ -1,95 +0,0 @@ -.text -.global ___thread_atomic_start -.global ___thread_atomic_stop - -.type ___thread_atomic_start, @function -.type ___thread_atomic_stop, @function - -.align 2 -/* -** extern uint32_t __thread_atomic_start(void) -** Save the current SR register and set the SR.BIT bit up to start an atomic -** context (interrupt is blocked). -** Return the saved SR register (only if the we enter into an atomic context), -** 0xffffffff otherwise. -*/ -___thread_atomic_start: - ! Check if the user is currently into an atomic operation - ! and update atomic counter. - mov.l atomic_counter, r1 - mov.l @r1, r2 - tst r2, r2 - add #1, r2 - mov.l r2, @r1 - bf.s atomic_start_exit - mov #-1, r0 - - ! Block interrupt if needed. - stc sr, r1 - mov r1, r0 - mov.l bl_mask, r2 - or r2, r1 - ldc r1, sr - - ! Save "old" SR register. - mov.l sr_save, r1 - mov.l r0, @r1 - -atomic_start_exit: - rts - nop - -/* -** extern uint32_t __thread_atomic_stop(void) -** Decreate the internal "atomic context counter" and if the counter is 0, -** restore the saved SR register status. -** Return the restored SR register (if restored) or -1 otherwise. -*/ -___thread_atomic_stop: - - ! Check if the device is currently into an atomic operation - ! and update atomic counter and, if needed, restore the SR - ! regsiter - mov.l atomic_counter, r1 - mov.l @r1, r0 - tst r0, r0 - bt atomic_end_error - cmp/eq #1, r0 - add #-1, r0 - mov.l r0, @r1 - bf atomic_end_error - - ! Restore saved SR register data. - mov.l sr_save, r1 - mov.l @r1, r0 - ldc r0, sr - bra atomic_end_exit - nop - -atomic_end_error: - mov #-1, r0 - -atomic_end_exit: - rts - nop - -.align 4 -bl_mask: .long 0x100000f0 -sr_save: .long ___thread_atomic_sr_save -atomic_counter: .long ___thread_atomic_counter - - - -##--- -## Global part. -##--- -.data -.global ___thread_atomic_sr_save -.global ___thread_atomic_counter - -.type ___thread_atomic_sr_save, @object -.type ___thread_atomic_counter, @object - -.align 4 -___thread_atomic_sr_save: .long 0x00000000 -___thread_atomic_counter: .long 0x00000000 diff --git a/src/libc/threads/mutex.c b/src/libc/threads/mutex.c deleted file mode 100644 index e1b71ff..0000000 --- a/src/libc/threads/mutex.c +++ /dev/null @@ -1,107 +0,0 @@ -#include -#include - -// Creates a new mutex object with type __TYPE. -// @note: If successful the new object is pointed by __MUTEX. -int mtx_init (mtx_t *__mutex, int __type) -{ - // Check if the mutext is already initialized - if (__mutex->__watermark == MTX_WATERMARK) - return (-1); - - // Initialize mutex - __mutex->__watermark = MTX_WATERMARK; - __mutex->type = __type; - __mutex->lock = 0; - return (0); -} - -// Block the current thread until the mutex pointed to by __MUTEX is unlocked. -// In that case current thread will not be blocked. -int mtx_lock(mtx_t *__mutex) -{ - // Check mutex validity - if (__mutex->__watermark != MTX_WATERMARK) - return (-1); - - // Wait util the mutex is unlocked - while (1) { - // Check if the mutex is unlock - __thread_atomic_start(); - if (__mutex->lock == 0) - break; - __thread_atomic_stop(); - - // TODO: force kernel schedule - __asm__ volatile ("sleep"); - } - - //TODO: handle mutex type !! - (void)__mutex->type; - - // Lock the mutex - __mutex->lock = 1; - - // Stop atomic operations - __thread_atomic_stop(); - return (0); -} - -// Try to lock the mutex pointed by __MUTEX without blocking. -// @note: If the mutex is free the current threads takes control of it, -// otherwise it returns immediately. -int mtx_trylock(mtx_t *__mutex) -{ - // Check mutex validity - if (__mutex->__watermark != MTX_WATERMARK) - return (-1); - - // Start atomic operations - __thread_atomic_start(); - - // Check if the mutex is already free - int ret = -1; - if (__mutex->lock == 0) { - //TODO: handle mutex type !! - (void)__mutex->type; - - // lock the mutex and change the return value - __mutex->lock = 1; - ret = 0; - } - - // Stop atomic operation and return - __thread_atomic_stop(); - return (ret); -} - -// Unlock the mutex pointed by __MUTEX. -// @note: It may potentially awake other threads waiting on this mutex. -int mtx_unlock(mtx_t *__mutex) -{ - // Check mutex validity - if (__mutex->__watermark != MTX_WATERMARK) - return (-1); - - // Start atomic operation - __thread_atomic_start(); - - // Check if the mutex is realy used and unluck if needed - int ret = -1; - if (__mutex->lock != 0) { - __mutex->lock = 0; - ret = 0; - } - - // Stop atomic operation and return - __thread_atomic_stop(); - return (ret); -} - -// Destroy the mutex object pointed by __MUTEX. -// TODO: check if the mutex is in use ? -void mtx_destroy(mtx_t *__mutex) -{ - __mutex->__watermark = 0x00000000; - __mutex->type = -1; -} diff --git a/src/libc/locale/localeconv.c b/src/locale/localeconv.c similarity index 100% rename from src/libc/locale/localeconv.c rename to src/locale/localeconv.c diff --git a/src/libc/locale/setlocale.c b/src/locale/setlocale.c similarity index 100% rename from src/libc/locale/setlocale.c rename to src/locale/setlocale.c diff --git a/src/posix/fcntl/target/vhex-sh/open.S b/src/posix/fcntl/target/vhex-sh/open.S deleted file mode 100644 index 6d6cd65..0000000 --- a/src/posix/fcntl/target/vhex-sh/open.S +++ /dev/null @@ -1,19 +0,0 @@ -#include -.text -.global _open -.type _open, @function - - -.align 2 -/* -** extern int open(const char *pathname, int flags, ...); -** Open FILE and return a new file descriptor for it, or -1 on error. -** OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set -** in OFLAG, the third argument is taken as a `mode_t', the mode of the -** created file. -*/ -_open: - trapa #__NR_open - rts - nop -.end diff --git a/src/posix/sys/wait/target/vhex-sh/wait.S b/src/posix/sys/wait/target/vhex-sh/wait.S deleted file mode 100644 index 7adb6b5..0000000 --- a/src/posix/sys/wait/target/vhex-sh/wait.S +++ /dev/null @@ -1,17 +0,0 @@ -#include -.text -.global _wait -.type _wait, @function - - -.align 2 -/* -** extern pid_t wait(int *wstatus); -** Wait for a child to die. When one does, put its status in *STAT_LOC -** and return its process ID. For errors, return (pid_t) -1. -*/ -_wait: - trapa #__NR_wait - rts - nop -.end diff --git a/src/posix/sys/wait/target/vhex-sh/waitpid.S b/src/posix/sys/wait/target/vhex-sh/waitpid.S deleted file mode 100644 index cfcfb2f..0000000 --- a/src/posix/sys/wait/target/vhex-sh/waitpid.S +++ /dev/null @@ -1,27 +0,0 @@ -#include -.text -.global _waitpid -.type _waitpid, @function - - -.align 2 -/* -** extern pid_t waitpid(pid_t pid, int *wstatus, int options); -** Wait for a child matching PID to die. -** - If PID is greater than 0, match any process whose process ID is PID. -** - If PID is (pid_t) -1, match any process. -** - If PID is (pid_t) 0, match any process with the same process group as the -** current process. -** - If PID is less than -1, match any process whose process group is the absolute -** value of PID. -** - If the WNOHANG bit is set in OPTIONS, and that child is not already dead, -** return (pid_t) 0. If successful, return PID and store the dead child's -** status in STAT_LOC. -** - Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS, -** return status for stopped children; otherwise don't. -*/ -_waitpid: - trapa #__NR_waitpid - rts - nop -.end diff --git a/src/posix/unistd/target/casiowin-fx/close.S b/src/posix/unistd/target/casiowin-fx/close.S deleted file mode 100644 index f6f1fab..0000000 --- a/src/posix/unistd/target/casiowin-fx/close.S +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -.text -.global _close -.type _close, @function - - -.align 2 -/* -** int close(int fd) -** close() closes a file descriptor, so that it no longer refers to any file -** and may be reused. -*/ -_close: - casio_trapa(__NR_Bfile_CloseFile) - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/close.S b/src/posix/unistd/target/vhex-sh/close.S deleted file mode 100644 index 466e448..0000000 --- a/src/posix/unistd/target/vhex-sh/close.S +++ /dev/null @@ -1,17 +0,0 @@ -#include -.text -.global _close -.type _close, @function - - -.align 2 -/* -** int close(int fd) -** close() closes a file descriptor, so that it no longer refers to any file -** and may be reused. -*/ -_close: - trapa #__NR_close - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/fork_execve.S b/src/posix/unistd/target/vhex-sh/fork_execve.S deleted file mode 100644 index 2ed984c..0000000 --- a/src/posix/unistd/target/vhex-sh/fork_execve.S +++ /dev/null @@ -1,22 +0,0 @@ -#include -.text -.global _fork_execve -.type _fork_execve, @function - - -.align 2 -/* -** pid_t fork_execve(const char *pathname, char **argv, char **envp); -** Custom syscall used to create a new process based on the new command passed -** using the `argv` and `envp` parametter. This sycall is equivalent of fork() -** and execve() combined. -** -** This custom syscall exist because the Vhex kernel doesn't have access to the -** MMU, so we cannot ensure that the memory requested by the potential new -** process is enough when execve() is involved by the user. -*/ -_fork_execve: - trapa #__NR_fork_execve - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/getpgid.S b/src/posix/unistd/target/vhex-sh/getpgid.S deleted file mode 100644 index 9b06ddb..0000000 --- a/src/posix/unistd/target/vhex-sh/getpgid.S +++ /dev/null @@ -1,16 +0,0 @@ -#include -.text -.global _getpgid -.type _getpgid, @function - - -.align 2 -/* -** extern pid_t getpgid(void); -** Get the process group ID of the calling process. -*/ -_getpgid: - trapa #__NR_getpgid - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/getpid.S b/src/posix/unistd/target/vhex-sh/getpid.S deleted file mode 100644 index 83bde68..0000000 --- a/src/posix/unistd/target/vhex-sh/getpid.S +++ /dev/null @@ -1,16 +0,0 @@ -#include -.text -.global _getpid -.type _getpid, @function - - -.align 2 -/* -** extern pid_t getpid(void); -** Get the process ID of the calling process. -*/ -_getpid: - trapa #__NR_getpid - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/getppid.S b/src/posix/unistd/target/vhex-sh/getppid.S deleted file mode 100644 index c36d46d..0000000 --- a/src/posix/unistd/target/vhex-sh/getppid.S +++ /dev/null @@ -1,16 +0,0 @@ -#include -.text -.global _getppid -.type _getppid, @function - - -.align 2 -/* -** extern pid_t getpgid(void); -** Get the parent process ID of the calling process. -*/ -_getppid: - trapa #__NR_getppid - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/lseek.S b/src/posix/unistd/target/vhex-sh/lseek.S deleted file mode 100644 index f564bfa..0000000 --- a/src/posix/unistd/target/vhex-sh/lseek.S +++ /dev/null @@ -1,19 +0,0 @@ -#include -.text -.global _lseek -.type _lseek, @function - - -.align 2 -/* -** extern off_t lseek(int fd, off_t offset, int whence) -** Move FD's file position to OFFSET bytes from the beginning of the file -** (if WHENCE is SEEK_SET), the current position (if WHENCE is SEEK_CUR), -** or the end of the file (if WHENCE is SEEK_END). -** Return the new file position. -*/ -_lseek: - trapa #__NR_lseek - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/read.S b/src/posix/unistd/target/vhex-sh/read.S deleted file mode 100644 index 2a0a918..0000000 --- a/src/posix/unistd/target/vhex-sh/read.S +++ /dev/null @@ -1,17 +0,0 @@ -#include -.text -.global _read -.type _read, @function - - -.align 2 -/* -** extern ssize_t write(int __fd, const void *__buf, size_t __nbytes); -** Write N bytes of BUF to FD. -** Return the number written, or -1. -*/ -_read: - trapa #__NR_read - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/setpgid.S b/src/posix/unistd/target/vhex-sh/setpgid.S deleted file mode 100644 index 92f08bc..0000000 --- a/src/posix/unistd/target/vhex-sh/setpgid.S +++ /dev/null @@ -1,18 +0,0 @@ -#include -.text -.global _setpgid -.type _setpgid, @function - - -.align 2 -/* -** extern int setpgid(pid_t __pid, pid_t __pgid); -** Set the process group ID of the process matching PID to PGID. -** If PID is zero, the current process's process group ID is set. -** If PGID is zero, the process ID of the process is used. -*/ -_setpgid: - trapa #__NR_setpgid - rts - nop -.end diff --git a/src/posix/unistd/target/vhex-sh/write.S b/src/posix/unistd/target/vhex-sh/write.S deleted file mode 100644 index 13597e1..0000000 --- a/src/posix/unistd/target/vhex-sh/write.S +++ /dev/null @@ -1,17 +0,0 @@ -#include -.text -.global _write -.type _write, @function - - -.align 2 -/* -** extern ssize_t write(int __fd, const void *__buf, size_t __nbytes); -** Write N bytes of BUF to FD. -** Return the number written, or -1. -*/ -_write: - trapa #__NR_write - rts - nop -.end diff --git a/src/libc/setjmp/target/sh-generic/longjmp.S b/src/setjmp/target/sh-generic/longjmp.S similarity index 100% rename from src/libc/setjmp/target/sh-generic/longjmp.S rename to src/setjmp/target/sh-generic/longjmp.S diff --git a/src/libc/setjmp/target/sh-generic/setjmp.S b/src/setjmp/target/sh-generic/setjmp.S similarity index 100% rename from src/libc/setjmp/target/sh-generic/setjmp.S rename to src/setjmp/target/sh-generic/setjmp.S diff --git a/src/libc/signal/raise.c b/src/signal/raise.c similarity index 100% rename from src/libc/signal/raise.c rename to src/signal/raise.c diff --git a/src/libc/signal/signal.c b/src/signal/signal.c similarity index 100% rename from src/libc/signal/signal.c rename to src/signal/signal.c diff --git a/src/libc/signal/signal_p.h b/src/signal/signal_p.h similarity index 100% rename from src/libc/signal/signal_p.h rename to src/signal/signal_p.h diff --git a/src/libc/stdio/asprintf.c b/src/stdio/asprintf.c similarity index 100% rename from src/libc/stdio/asprintf.c rename to src/stdio/asprintf.c diff --git a/src/libc/stdio/clearerr.c b/src/stdio/clearerr.c similarity index 100% rename from src/libc/stdio/clearerr.c rename to src/stdio/clearerr.c diff --git a/src/libc/stdio/dprintf.c b/src/stdio/dprintf.c similarity index 100% rename from src/libc/stdio/dprintf.c rename to src/stdio/dprintf.c diff --git a/src/libc/stdio/fclose.c b/src/stdio/fclose.c similarity index 100% rename from src/libc/stdio/fclose.c rename to src/stdio/fclose.c diff --git a/src/libc/stdio/fdopen.c b/src/stdio/fdopen.c similarity index 100% rename from src/libc/stdio/fdopen.c rename to src/stdio/fdopen.c diff --git a/src/libc/stdio/feof.c b/src/stdio/feof.c similarity index 100% rename from src/libc/stdio/feof.c rename to src/stdio/feof.c diff --git a/src/libc/stdio/ferror.c b/src/stdio/ferror.c similarity index 100% rename from src/libc/stdio/ferror.c rename to src/stdio/ferror.c diff --git a/src/libc/stdio/fflush.c b/src/stdio/fflush.c similarity index 100% rename from src/libc/stdio/fflush.c rename to src/stdio/fflush.c diff --git a/src/libc/stdio/fgetc.c b/src/stdio/fgetc.c similarity index 100% rename from src/libc/stdio/fgetc.c rename to src/stdio/fgetc.c diff --git a/src/libc/stdio/fgetpos.c b/src/stdio/fgetpos.c similarity index 100% rename from src/libc/stdio/fgetpos.c rename to src/stdio/fgetpos.c diff --git a/src/libc/stdio/fgets.c b/src/stdio/fgets.c similarity index 100% rename from src/libc/stdio/fgets.c rename to src/stdio/fgets.c diff --git a/src/libc/stdio/fileutil.c b/src/stdio/fileutil.c similarity index 100% rename from src/libc/stdio/fileutil.c rename to src/stdio/fileutil.c diff --git a/src/libc/stdio/fileutil.h b/src/stdio/fileutil.h similarity index 100% rename from src/libc/stdio/fileutil.h rename to src/stdio/fileutil.h diff --git a/src/libc/stdio/fopen.c b/src/stdio/fopen.c similarity index 100% rename from src/libc/stdio/fopen.c rename to src/stdio/fopen.c diff --git a/src/libc/stdio/fprintf.c b/src/stdio/fprintf.c similarity index 100% rename from src/libc/stdio/fprintf.c rename to src/stdio/fprintf.c diff --git a/src/libc/stdio/fputc.c b/src/stdio/fputc.c similarity index 100% rename from src/libc/stdio/fputc.c rename to src/stdio/fputc.c diff --git a/src/libc/stdio/fputs.c b/src/stdio/fputs.c similarity index 100% rename from src/libc/stdio/fputs.c rename to src/stdio/fputs.c diff --git a/src/libc/stdio/fread.c b/src/stdio/fread.c similarity index 100% rename from src/libc/stdio/fread.c rename to src/stdio/fread.c diff --git a/src/libc/stdio/freopen.c b/src/stdio/freopen.c similarity index 100% rename from src/libc/stdio/freopen.c rename to src/stdio/freopen.c diff --git a/src/libc/stdio/fseek.c b/src/stdio/fseek.c similarity index 100% rename from src/libc/stdio/fseek.c rename to src/stdio/fseek.c diff --git a/src/libc/stdio/fsetpos.c b/src/stdio/fsetpos.c similarity index 100% rename from src/libc/stdio/fsetpos.c rename to src/stdio/fsetpos.c diff --git a/src/libc/stdio/ftell.c b/src/stdio/ftell.c similarity index 100% rename from src/libc/stdio/ftell.c rename to src/stdio/ftell.c diff --git a/src/libc/stdio/fwrite.c b/src/stdio/fwrite.c similarity index 100% rename from src/libc/stdio/fwrite.c rename to src/stdio/fwrite.c diff --git a/src/libc/stdio/getc.c b/src/stdio/getc.c similarity index 100% rename from src/libc/stdio/getc.c rename to src/stdio/getc.c diff --git a/src/libc/stdio/getchar.c b/src/stdio/getchar.c similarity index 100% rename from src/libc/stdio/getchar.c rename to src/stdio/getchar.c diff --git a/src/libc/stdio/getdelim.c b/src/stdio/getdelim.c similarity index 100% rename from src/libc/stdio/getdelim.c rename to src/stdio/getdelim.c diff --git a/src/libc/stdio/getline.c b/src/stdio/getline.c similarity index 100% rename from src/libc/stdio/getline.c rename to src/stdio/getline.c diff --git a/src/libc/stdio/gets.c b/src/stdio/gets.c similarity index 100% rename from src/libc/stdio/gets.c rename to src/stdio/gets.c diff --git a/src/libc/stdio/perror.c b/src/stdio/perror.c similarity index 100% rename from src/libc/stdio/perror.c rename to src/stdio/perror.c diff --git a/src/libc/stdio/printf.c b/src/stdio/printf.c similarity index 100% rename from src/libc/stdio/printf.c rename to src/stdio/printf.c diff --git a/src/libc/stdio/printf/format_fixed.c b/src/stdio/printf/format_fixed.c similarity index 100% rename from src/libc/stdio/printf/format_fixed.c rename to src/stdio/printf/format_fixed.c diff --git a/src/libc/stdio/printf/format_fp.c b/src/stdio/printf/format_fp.c similarity index 99% rename from src/libc/stdio/printf/format_fp.c rename to src/stdio/printf/format_fp.c index 0098167..e6f8eed 100644 --- a/src/libc/stdio/printf/format_fp.c +++ b/src/stdio/printf/format_fp.c @@ -1,6 +1,6 @@ #include #include -#include "../../../../3rdparty/grisu2b_59_56/grisu2.h" +#include "../../../3rdparty/grisu2b_59_56/grisu2.h" #define min(x, y) ({ \ __auto_type _x = (x); \ diff --git a/src/libc/stdio/printf/format_usual.c b/src/stdio/printf/format_usual.c similarity index 100% rename from src/libc/stdio/printf/format_usual.c rename to src/stdio/printf/format_usual.c diff --git a/src/libc/stdio/printf/print.c b/src/stdio/printf/print.c similarity index 100% rename from src/libc/stdio/printf/print.c rename to src/stdio/printf/print.c diff --git a/src/libc/stdio/printf/util.c b/src/stdio/printf/util.c similarity index 100% rename from src/libc/stdio/printf/util.c rename to src/stdio/printf/util.c diff --git a/src/libc/stdio/putc.c b/src/stdio/putc.c similarity index 100% rename from src/libc/stdio/putc.c rename to src/stdio/putc.c diff --git a/src/libc/stdio/putchar.c b/src/stdio/putchar.c similarity index 100% rename from src/libc/stdio/putchar.c rename to src/stdio/putchar.c diff --git a/src/libc/stdio/puts.c b/src/stdio/puts.c similarity index 100% rename from src/libc/stdio/puts.c rename to src/stdio/puts.c diff --git a/src/libc/stdio/remove.c b/src/stdio/remove.c similarity index 100% rename from src/libc/stdio/remove.c rename to src/stdio/remove.c diff --git a/src/libc/stdio/rewind.c b/src/stdio/rewind.c similarity index 100% rename from src/libc/stdio/rewind.c rename to src/stdio/rewind.c diff --git a/src/libc/stdio/setbuf.c b/src/stdio/setbuf.c similarity index 100% rename from src/libc/stdio/setbuf.c rename to src/stdio/setbuf.c diff --git a/src/libc/stdio/setvbuf.c b/src/stdio/setvbuf.c similarity index 100% rename from src/libc/stdio/setvbuf.c rename to src/stdio/setvbuf.c diff --git a/src/libc/stdio/snprintf.c b/src/stdio/snprintf.c similarity index 100% rename from src/libc/stdio/snprintf.c rename to src/stdio/snprintf.c diff --git a/src/libc/stdio/sprintf.c b/src/stdio/sprintf.c similarity index 100% rename from src/libc/stdio/sprintf.c rename to src/stdio/sprintf.c diff --git a/src/libc/stdio/streams.c b/src/stdio/streams.c similarity index 100% rename from src/libc/stdio/streams.c rename to src/stdio/streams.c diff --git a/src/libc/stdio/ungetc.c b/src/stdio/ungetc.c similarity index 100% rename from src/libc/stdio/ungetc.c rename to src/stdio/ungetc.c diff --git a/src/libc/stdio/vasprintf.c b/src/stdio/vasprintf.c similarity index 100% rename from src/libc/stdio/vasprintf.c rename to src/stdio/vasprintf.c diff --git a/src/libc/stdio/vdprintf.c b/src/stdio/vdprintf.c similarity index 100% rename from src/libc/stdio/vdprintf.c rename to src/stdio/vdprintf.c diff --git a/src/libc/stdio/vfprintf.c b/src/stdio/vfprintf.c similarity index 100% rename from src/libc/stdio/vfprintf.c rename to src/stdio/vfprintf.c diff --git a/src/libc/stdio/vprintf.c b/src/stdio/vprintf.c similarity index 100% rename from src/libc/stdio/vprintf.c rename to src/stdio/vprintf.c diff --git a/src/libc/stdio/vsnprintf.c b/src/stdio/vsnprintf.c similarity index 100% rename from src/libc/stdio/vsnprintf.c rename to src/stdio/vsnprintf.c diff --git a/src/libc/stdio/vsprintf.c b/src/stdio/vsprintf.c similarity index 100% rename from src/libc/stdio/vsprintf.c rename to src/stdio/vsprintf.c diff --git a/src/libc/stdlib/abort.c b/src/stdlib/abort.c similarity index 100% rename from src/libc/stdlib/abort.c rename to src/stdlib/abort.c diff --git a/src/libc/stdlib/abs.c b/src/stdlib/abs.c similarity index 100% rename from src/libc/stdlib/abs.c rename to src/stdlib/abs.c diff --git a/src/libc/stdlib/atof.c b/src/stdlib/atof.c similarity index 100% rename from src/libc/stdlib/atof.c rename to src/stdlib/atof.c diff --git a/src/libc/stdlib/atoi.c b/src/stdlib/atoi.c similarity index 100% rename from src/libc/stdlib/atoi.c rename to src/stdlib/atoi.c diff --git a/src/libc/stdlib/atol.c b/src/stdlib/atol.c similarity index 100% rename from src/libc/stdlib/atol.c rename to src/stdlib/atol.c diff --git a/src/libc/stdlib/atoll.c b/src/stdlib/atoll.c similarity index 100% rename from src/libc/stdlib/atoll.c rename to src/stdlib/atoll.c diff --git a/src/libc/stdlib/calloc.c b/src/stdlib/calloc.c similarity index 100% rename from src/libc/stdlib/calloc.c rename to src/stdlib/calloc.c diff --git a/src/libc/stdlib/div.c b/src/stdlib/div.c similarity index 100% rename from src/libc/stdlib/div.c rename to src/stdlib/div.c diff --git a/src/libc/stdlib/exit.c b/src/stdlib/exit.c similarity index 100% rename from src/libc/stdlib/exit.c rename to src/stdlib/exit.c diff --git a/src/libc/stdlib/labs.c b/src/stdlib/labs.c similarity index 100% rename from src/libc/stdlib/labs.c rename to src/stdlib/labs.c diff --git a/src/libc/stdlib/ldiv.c b/src/stdlib/ldiv.c similarity index 100% rename from src/libc/stdlib/ldiv.c rename to src/stdlib/ldiv.c diff --git a/src/libc/stdlib/llabs.c b/src/stdlib/llabs.c similarity index 100% rename from src/libc/stdlib/llabs.c rename to src/stdlib/llabs.c diff --git a/src/libc/stdlib/lldiv.c b/src/stdlib/lldiv.c similarity index 100% rename from src/libc/stdlib/lldiv.c rename to src/stdlib/lldiv.c diff --git a/src/libc/stdlib/qsort.c b/src/stdlib/qsort.c similarity index 100% rename from src/libc/stdlib/qsort.c rename to src/stdlib/qsort.c diff --git a/src/libc/stdlib/reallocarray.c b/src/stdlib/reallocarray.c similarity index 76% rename from src/libc/stdlib/reallocarray.c rename to src/stdlib/reallocarray.c index 493e996..b12afa9 100644 --- a/src/libc/stdlib/reallocarray.c +++ b/src/stdlib/reallocarray.c @@ -1,4 +1,5 @@ #include +#include /* ** The reallocarray() function changes the size of the memory block pointed to @@ -9,11 +10,14 @@ ** where the multiplication would overflow. If such an overflow occurs, ** reallocarray() returns NULL, sets errno to ENOMEM, and leaves the original ** block of memory unchanged. -** -** FIXME: check safe !!!! -** FIXME: Check underflow !! */ void *reallocarray(void *ptr, size_t nmemb, size_t size) { - return (realloc(ptr, nmemb * size)); + unsigned int total_size; + + if(__builtin_umul_overflow(nmemb, size, &total_size)) { + errno = ENOMEM; + return NULL; + } + return (realloc(ptr, total_size)); } diff --git a/src/libc/stdlib/stdlib_p.h b/src/stdlib/stdlib_p.h similarity index 100% rename from src/libc/stdlib/stdlib_p.h rename to src/stdlib/stdlib_p.h diff --git a/src/libc/stdlib/strto_fp.c b/src/stdlib/strto_fp.c similarity index 100% rename from src/libc/stdlib/strto_fp.c rename to src/stdlib/strto_fp.c diff --git a/src/libc/stdlib/strto_int.c b/src/stdlib/strto_int.c similarity index 100% rename from src/libc/stdlib/strto_int.c rename to src/stdlib/strto_int.c diff --git a/src/libc/stdlib/strtod.c b/src/stdlib/strtod.c similarity index 100% rename from src/libc/stdlib/strtod.c rename to src/stdlib/strtod.c diff --git a/src/libc/stdlib/strtof.c b/src/stdlib/strtof.c similarity index 100% rename from src/libc/stdlib/strtof.c rename to src/stdlib/strtof.c diff --git a/src/libc/stdlib/strtol.c b/src/stdlib/strtol.c similarity index 100% rename from src/libc/stdlib/strtol.c rename to src/stdlib/strtol.c diff --git a/src/libc/stdlib/strtold.c b/src/stdlib/strtold.c similarity index 100% rename from src/libc/stdlib/strtold.c rename to src/stdlib/strtold.c diff --git a/src/libc/stdlib/strtoll.c b/src/stdlib/strtoll.c similarity index 100% rename from src/libc/stdlib/strtoll.c rename to src/stdlib/strtoll.c diff --git a/src/libc/stdlib/strtoul.c b/src/stdlib/strtoul.c similarity index 100% rename from src/libc/stdlib/strtoul.c rename to src/stdlib/strtoul.c diff --git a/src/libc/stdlib/strtoull.c b/src/stdlib/strtoull.c similarity index 100% rename from src/libc/stdlib/strtoull.c rename to src/stdlib/strtoull.c diff --git a/src/libc/stdlib/target/gint/free.c b/src/stdlib/target/gint/free.c similarity index 100% rename from src/libc/stdlib/target/gint/free.c rename to src/stdlib/target/gint/free.c diff --git a/src/libc/stdlib/target/gint/malloc.c b/src/stdlib/target/gint/malloc.c similarity index 100% rename from src/libc/stdlib/target/gint/malloc.c rename to src/stdlib/target/gint/malloc.c diff --git a/src/libc/stdlib/target/gint/realloc.c b/src/stdlib/target/gint/realloc.c similarity index 100% rename from src/libc/stdlib/target/gint/realloc.c rename to src/stdlib/target/gint/realloc.c diff --git a/src/libc/stdlib/target/vhex-sh/free.c b/src/stdlib/target/vhex-sh/free.c similarity index 100% rename from src/libc/stdlib/target/vhex-sh/free.c rename to src/stdlib/target/vhex-sh/free.c diff --git a/src/libc/stdlib/target/vhex-sh/malloc.c b/src/stdlib/target/vhex-sh/malloc.c similarity index 100% rename from src/libc/stdlib/target/vhex-sh/malloc.c rename to src/stdlib/target/vhex-sh/malloc.c diff --git a/src/libc/stdlib/target/vhex-sh/realloc.c b/src/stdlib/target/vhex-sh/realloc.c similarity index 100% rename from src/libc/stdlib/target/vhex-sh/realloc.c rename to src/stdlib/target/vhex-sh/realloc.c diff --git a/src/libc/string/memchr.c b/src/string/memchr.c similarity index 100% rename from src/libc/string/memchr.c rename to src/string/memchr.c diff --git a/src/libc/string/memcmp.c b/src/string/memcmp.c similarity index 100% rename from src/libc/string/memcmp.c rename to src/string/memcmp.c diff --git a/src/libc/string/memcpy.c b/src/string/memcpy.c similarity index 100% rename from src/libc/string/memcpy.c rename to src/string/memcpy.c diff --git a/src/libc/string/memmove.c b/src/string/memmove.c similarity index 100% rename from src/libc/string/memmove.c rename to src/string/memmove.c diff --git a/src/libc/string/memrchr.c b/src/string/memrchr.c similarity index 100% rename from src/libc/string/memrchr.c rename to src/string/memrchr.c diff --git a/src/libc/string/memset.c b/src/string/memset.c similarity index 100% rename from src/libc/string/memset.c rename to src/string/memset.c diff --git a/src/libc/string/strcasecmp.c b/src/string/strcasecmp.c similarity index 100% rename from src/libc/string/strcasecmp.c rename to src/string/strcasecmp.c diff --git a/src/libc/string/strcasestr.c b/src/string/strcasestr.c similarity index 100% rename from src/libc/string/strcasestr.c rename to src/string/strcasestr.c diff --git a/src/libc/string/strcat.c b/src/string/strcat.c similarity index 100% rename from src/libc/string/strcat.c rename to src/string/strcat.c diff --git a/src/libc/string/strchr.c b/src/string/strchr.c similarity index 100% rename from src/libc/string/strchr.c rename to src/string/strchr.c diff --git a/src/libc/string/strchrnul.c b/src/string/strchrnul.c similarity index 100% rename from src/libc/string/strchrnul.c rename to src/string/strchrnul.c diff --git a/src/libc/string/strcmp.c b/src/string/strcmp.c similarity index 100% rename from src/libc/string/strcmp.c rename to src/string/strcmp.c diff --git a/src/libc/string/strcoll.c b/src/string/strcoll.c similarity index 100% rename from src/libc/string/strcoll.c rename to src/string/strcoll.c diff --git a/src/libc/string/strcpy.c b/src/string/strcpy.c similarity index 100% rename from src/libc/string/strcpy.c rename to src/string/strcpy.c diff --git a/src/libc/string/strcspn.c b/src/string/strcspn.c similarity index 100% rename from src/libc/string/strcspn.c rename to src/string/strcspn.c diff --git a/src/libc/string/strdup.c b/src/string/strdup.c similarity index 100% rename from src/libc/string/strdup.c rename to src/string/strdup.c diff --git a/src/libc/string/strerror.c b/src/string/strerror.c similarity index 100% rename from src/libc/string/strerror.c rename to src/string/strerror.c diff --git a/src/libc/string/string_p.h b/src/string/string_p.h similarity index 100% rename from src/libc/string/string_p.h rename to src/string/string_p.h diff --git a/src/libc/string/strlen.c b/src/string/strlen.c similarity index 100% rename from src/libc/string/strlen.c rename to src/string/strlen.c diff --git a/src/libc/string/strncasecmp.c b/src/string/strncasecmp.c similarity index 100% rename from src/libc/string/strncasecmp.c rename to src/string/strncasecmp.c diff --git a/src/libc/string/strncat.c b/src/string/strncat.c similarity index 100% rename from src/libc/string/strncat.c rename to src/string/strncat.c diff --git a/src/libc/string/strncmp.c b/src/string/strncmp.c similarity index 100% rename from src/libc/string/strncmp.c rename to src/string/strncmp.c diff --git a/src/libc/string/strncpy.c b/src/string/strncpy.c similarity index 100% rename from src/libc/string/strncpy.c rename to src/string/strncpy.c diff --git a/src/libc/string/strndup.c b/src/string/strndup.c similarity index 100% rename from src/libc/string/strndup.c rename to src/string/strndup.c diff --git a/src/libc/string/strnlen.c b/src/string/strnlen.c similarity index 100% rename from src/libc/string/strnlen.c rename to src/string/strnlen.c diff --git a/src/libc/string/strpbrk.c b/src/string/strpbrk.c similarity index 100% rename from src/libc/string/strpbrk.c rename to src/string/strpbrk.c diff --git a/src/libc/string/strrchr.c b/src/string/strrchr.c similarity index 100% rename from src/libc/string/strrchr.c rename to src/string/strrchr.c diff --git a/src/libc/string/strspn.c b/src/string/strspn.c similarity index 100% rename from src/libc/string/strspn.c rename to src/string/strspn.c diff --git a/src/libc/string/strstr.c b/src/string/strstr.c similarity index 100% rename from src/libc/string/strstr.c rename to src/string/strstr.c diff --git a/src/libc/string/strstr_base.c b/src/string/strstr_base.c similarity index 100% rename from src/libc/string/strstr_base.c rename to src/string/strstr_base.c diff --git a/src/libc/string/strtok.c b/src/string/strtok.c similarity index 100% rename from src/libc/string/strtok.c rename to src/string/strtok.c diff --git a/src/libc/string/strxfrm.c b/src/string/strxfrm.c similarity index 100% rename from src/libc/string/strxfrm.c rename to src/string/strxfrm.c diff --git a/src/libc/string/target/sh-generic/memchr.S b/src/string/target/sh-generic/memchr.S similarity index 100% rename from src/libc/string/target/sh-generic/memchr.S rename to src/string/target/sh-generic/memchr.S diff --git a/src/libc/string/target/sh-generic/memcmp.S b/src/string/target/sh-generic/memcmp.S similarity index 100% rename from src/libc/string/target/sh-generic/memcmp.S rename to src/string/target/sh-generic/memcmp.S diff --git a/src/libc/string/target/sh-generic/memcpy.S b/src/string/target/sh-generic/memcpy.S similarity index 100% rename from src/libc/string/target/sh-generic/memcpy.S rename to src/string/target/sh-generic/memcpy.S diff --git a/src/libc/string/target/sh-generic/memmove.S b/src/string/target/sh-generic/memmove.S similarity index 100% rename from src/libc/string/target/sh-generic/memmove.S rename to src/string/target/sh-generic/memmove.S diff --git a/src/libc/string/target/sh-generic/memset.S b/src/string/target/sh-generic/memset.S similarity index 100% rename from src/libc/string/target/sh-generic/memset.S rename to src/string/target/sh-generic/memset.S diff --git a/src/libc/string/target/sh-generic/strlen.S b/src/string/target/sh-generic/strlen.S similarity index 100% rename from src/libc/string/target/sh-generic/strlen.S rename to src/string/target/sh-generic/strlen.S diff --git a/src/libc/time/asctime.c b/src/time/asctime.c similarity index 100% rename from src/libc/time/asctime.c rename to src/time/asctime.c diff --git a/src/libc/time/ctime.c b/src/time/ctime.c similarity index 100% rename from src/libc/time/ctime.c rename to src/time/ctime.c diff --git a/src/libc/time/difftime.c b/src/time/difftime.c similarity index 100% rename from src/libc/time/difftime.c rename to src/time/difftime.c diff --git a/src/libc/time/gmtime.c b/src/time/gmtime.c similarity index 100% rename from src/libc/time/gmtime.c rename to src/time/gmtime.c diff --git a/src/libc/time/localtime.c b/src/time/localtime.c similarity index 100% rename from src/libc/time/localtime.c rename to src/time/localtime.c diff --git a/src/libc/time/mktime.c b/src/time/mktime.c similarity index 100% rename from src/libc/time/mktime.c rename to src/time/mktime.c diff --git a/src/libc/time/strftime.c b/src/time/strftime.c similarity index 100% rename from src/libc/time/strftime.c rename to src/time/strftime.c diff --git a/src/libc/time/target/gint/clock.c b/src/time/target/gint/clock.c similarity index 100% rename from src/libc/time/target/gint/clock.c rename to src/time/target/gint/clock.c diff --git a/src/libc/time/target/gint/time.c b/src/time/target/gint/time.c similarity index 100% rename from src/libc/time/target/gint/time.c rename to src/time/target/gint/time.c diff --git a/src/libc/time/timeutil.h b/src/time/timeutil.h similarity index 100% rename from src/libc/time/timeutil.h rename to src/time/timeutil.h