Commit Graph

85 Commits

Author SHA1 Message Date
Yann MAGNIN 996b2b8ded fxlibc - v1.4.1 : update Vhex stdlib
@update
> malloc  : do not use syscall, involve kmalloc
> realloc : do not use syscall, involve krealloc
> free    : do not use syscall, involve kfree

@fix
> _Exit : remove syscall
2022-05-14 11:49:08 +02:00
Lephenixnoir d50e44c563
C++ __restrict__, update STATUS, minor formatting 2022-03-31 10:12:01 +01:00
Alice Rozengarden 3f5989ceab Add getline(3) & getdelim(3) 2022-03-30 23:49:44 +02:00
Lephenixnoir 3c29639988
string: fix a bug in SuperH memset 2022-03-26 15:19:15 +00:00
Lephenixnoir 71866ed769
stdio: stdin/stdout/stderr, perror, final adjustments
Support for <stdio.h> will stop here for now.
2022-01-14 18:38:48 +01:00
Lephenixnoir ed873a652e
stdio: fgetc(), fgets(), tests for fputc() and fputs() (DONE) 2022-01-14 17:16:04 +01:00
Lephenixnoir f1512125d0
stdio: initial versions of fputc() and fputs() (TEST) 2022-01-13 21:21:23 +01:00
Lephenixnoir 6ec0c24e2d
stdio: ungetc(), update (+) and append (a) modes (DONE) 2022-01-12 10:20:30 +01:00
Lephenixnoir 06b66252c9
stdio: line buffering, test fgetpos and fsetpos (DONE) 2022-01-10 21:32:24 +01:00
Lephenixnoir 0c2f81e5bb
string: add and test a naive memrchr (DONE) 2022-01-10 21:21:03 +01:00
Lephenixnoir 909c7df815
stdio: fixes for initial fread() et fwrite() (TEST) 2022-01-10 17:10:49 +01:00
Lephenixnoir 4461bdb96a
stdio: basic fread/fwrite (WIP) 2022-01-05 21:26:06 +01:00
Lephenixnoir b6dbdf321d
stdio: error handling and positioning functions (WIP) 2022-01-02 22:09:06 +01:00
Lephenixnoir a12b84f1ef
stdio: opening primitives for FILE (WIP) 2022-01-02 19:22:43 +01:00
Lephenixnoir 51528170bb
stdio: FILE barebones with buffering model (WIP) 2022-01-02 19:22:42 +01:00
Lephenixnoir b53078776d
stdio: enable dprintf() and vdprintf() 2022-01-02 19:22:42 +01:00
Lephenixnoir 3046304497
stdlib: set errno=ENOMEM after failed malloc() 2022-01-02 19:22:42 +01:00
Lephenixnoir f7b85f18bd
time: do not depend on gint headers
They're usually not installed yet
2021-12-31 19:48:43 +01:00
Lephenixnoir dbfefe5172
errno: add ENOTEMPTY for rmdir() 2021-12-30 18:18:54 +01:00
Lephenixnoir e479393a9c
unistd, dirent: definitions for directory functions 2021-12-21 18:55:23 +01:00
Lephenixnoir c2feb94710
fcntl, unistd: declarations for the Unix file API 2021-12-13 18:37:04 +01:00
Lephenixnoir 92ccd8b1db
time: add support for C99 <time.h> (DONE) 2021-12-04 22:02:23 +01:00
Lephenixnoir e71f9867e2
support for shared libgcc in vhex 2021-11-07 18:05:33 +01:00
Lephenixnoir df4c13b007
stdlib: fix bad memset in calloc() 2021-09-25 15:16:24 +02:00
Lephenixnoir a0ceeefaf4
string: fix strtok detecting NUL only after separators 2021-08-17 17:30:21 +02:00
Lephenixnoir ea35c18c41
stdlib: add qsort (TEST) 2021-06-28 23:54:43 +02:00
Lephenixnoir 518a866750
use __restrict__ in headers for g++ compatibility 2021-06-13 18:17:40 +02:00
Lephenixnoir dcaf203f46
stdio: improve printf extension API and type size support 2021-06-08 10:32:08 +02:00
Lephenixnoir 009a2eef6e
stdlib: add TinyMT-based rand, and malloc/etc for gint 2021-06-07 22:00:41 +02:00
Lephenixnoir 625a6af459
stdio: add asprintf and vasprintf 2021-06-07 19:09:55 +02:00
Lephenixnoir f52e0923bc
stdio: move the printf implementation from gint 2021-06-07 18:57:11 +02:00
Lephenixnoir cd7fe7a329
signal: simple implementation (DONE)
This version of signal (which does not rely on a notion of userland
processes and is thus excluded from Vhex) follows C99 semantics but does
not generate any signals by default.

Basically, the signal function sets up function pointers and the signal
function calls them. Termination signals call exit() while other signals
call _Exit(), which is a quicker program termination similar to abort().

C99 allows programs to long jump out of signal handlers (!) which is
unbelievably scary because it would bypass stack switching code in Vhex
as well as normal interrupt handler termination in gint.
2021-05-30 15:09:33 +02:00
Lephenixnoir 4b90740d3b
stdlib: add exit() based on target-provided _Exit()
This is implemented for gint only currently; on Vhex, _Exit() is likely
just going to be a syscall. For CASIOWIN, this is slightly more
difficult, as there is no native exit syscall.
2021-05-29 16:45:35 +02:00
Lephenixnoir 73d6b2eb7c
setjmp: do not disable interrupts (#1) (DONE)
SR.BL=1 could cause problems if setjmp or longjmp is loader over a page
boundary and the second page is not loaded when interrupts are masked.

SR.IMASK=15 is another option, but it seems unnecessary per #1.

Blocking interrupts in longjmp did not make too much sense because the
blocked SR was immediately replaced by the restored one.
2021-05-29 11:18:02 +02:00
Lephenixnoir 13c3390b22
setjmp: expose setjmp and longjmp to sh-generic
... instead of vhex-generic, where it doesn't really belong because Vhex
might run on other architectures.
2021-05-29 09:56:47 +02:00
Lephenixnoir 1e7e2c656b
string: add and test strtok (DONE) 2021-05-24 10:25:32 +02:00
Lephenixnoir 3a9a60db78
stdlib: formatting on the strto* functions
* Name the private function __strto_{int,fp} (with leading double
  underscores) to avoid name conflicts
* Fix comments of the wrong style
* Fix missing leading double underscores in stdlib_p.h
2021-05-24 10:07:48 +02:00
Lephenixnoir df9073e6ff
string: add and test str[n]casecmp and KMP str[case]str (DONE) 2021-05-24 10:04:54 +02:00
Lephenixnoir 8ffc104798
string: add and test strpbrk (DONE) 2021-05-23 18:11:12 +02:00
Lephenixnoir d105b1d60a
string: add stubs for strcoll and strxfrm (TEST)
These extend the stub locale; strcoll is simply strcmp and strxfrm is
simply strncpy.
2021-05-23 18:07:36 +02:00
Lephenixnoir cda27ac2db
string: add and test strspn and strcspn (DONE) 2021-05-23 18:02:38 +02:00
Lephenixnoir 8368ba70fd
string: split and fix strdup and strndup (DONE) 2021-05-23 17:58:04 +02:00
Lephenixnoir b78cec4f6d
string: add and test strerror (DONE) 2021-05-23 17:44:37 +02:00
Lephenixnoir 3792bbd9d1
string: split strcat and strncat (DONE) 2021-05-23 17:28:48 +02:00
Lephenixnoir 5d345b8da2
string: split and fix strcpy and strncpy (DONE) 2021-05-23 17:28:20 +02:00
Lephenixnoir d5ef8298ae
string: split strcmp and strncmp (DONE) 2021-05-23 17:27:58 +02:00
Lephenixnoir ab8bcc6928
string: use gint's (not-so-optimized-yet) memmove (DONE) 2021-05-23 16:52:39 +02:00
Lephenixnoir fd0d67191c
string: add memchr, memcmp, memmove for non-SuperH (TEST) 2021-05-23 16:52:39 +02:00
Lephenixnoir 5cfd2a7d85
string: use gint's optimized memcmp (DONE) 2021-05-23 16:52:35 +02:00
Lephenixnoir a354e38ccf
string: use gint's optimized memcpy (DONE) 2021-05-23 16:52:33 +02:00