summaryrefslogtreecommitdiffstats
path: root/libc/string
Commit message (Collapse)AuthorAgeFilesLines
* Fix strtok for previous tokens being NULLBalbir singh2018-05-241-1/+4
| | | | | | | | Caught by scan-build. If the stored token nxtTok is already NULL, don't dereference src Signed-off-by: Balbir singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* build: use thin archives rather than incremental linkingNicholas Piggin2018-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | This changes to build system to use thin archives rather than incremental linking for built-in.o, similar to recent change to Linux. built-in.o is renamed to built-in.a, and is created as a thin archive with no index, for speed and size. All built-in.a are aggregated into a skiboot.tmp.a which is a thin archive built with an index, making it suitable or linking. This is input into the final link. The advantags of build size and linker code placement flexibility are not as great with skiboot as a bigger project like Linux, but it's a conceptually better way to build, and is more compatible with link time optimisation in toolchains which might be interesting for skiboot particularly for size reductions. Size of build tree before this patch is 34.4MB, afterwards 23.1MB. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* libc: add strnlen()Oliver O'Halloran2017-09-151-0/+13
| | | | | | | Sometimes handy. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* libc : Changes variable data type where return value of strlen() stored from ↵Mukesh Ojha2016-10-112-2/+2
| | | | | | | | | | | | | int to size_t Reason of the change as integer value may overflow, and it can give negative value for the length. This patch also changes the data type of variable which is compared with strlen() as the comparison also has to be done on the same level. Signed-off-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* libc/string: add memcpy_from_ci()Claudio Carvalho2016-10-052-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds memcpy_from_ci, a cache inhibited version of memcpy, required by secure boot. The secure boot verification code is stored in a secure ROM and the logic that contains the ROM within the processor is implemented in a way that it only responds to CI (cache inhibited) operations. Due to performance issues we copy the verification code from the secure ROM to RAM and we use memcpy_ci for that. What makes memcpy_ci vs ordinary memcpy? memcpy copies data like in the example below and the compiler translates that to load instructions that are not cache inhibited (e.g. lbzx - load byte and zero indexed). In other words, the data is cached. a[i] = b[i] memcpy_ci copies data using the cache inhibited version of load instructions: in_8() and in_be32(), both defined in include/io.h. These functions use lbzcix and lwzcix assembly instructions, respectively. In this case, the data is not cached as required by the logic that contains the ROM. *((uint8_t*) destp) = in_8((uint8_t*)srcp); *((uint32_t*) destp) = in_be32((uint32_t*)srcp) Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* strlen: use size_t for lenStewart Smith2016-09-021-1/+1
| | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Reviewed-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>
* libc: Use 8-bytes stores for non-0 memset tooBenjamin Herrenschmidt2016-08-181-1/+8
| | | | | | | | Memory poisoning hammers this, so let's be a bit smart about it and avoid falling back to byte stores when the data is not 0 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Optimized memset() implementation for POWERStewart Smith2015-06-011-0/+22
| | | | | | | | | | | | This uses the dcbz instruction to clear cacheline at a time rather than byte at a time. This means that even without high levels of optimization, we *dramatically* improve boot performance with SKIBOOT_GCOV=1 and probably ever so slightly speed things up for normal builds. We currently just hard-code 128 as cacheline size as all CPUs that skiboot currently boots on have 128 byte cachelines. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Initial commit of Open Source releaseBenjamin Herrenschmidt2014-07-0218-0/+536
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
OpenPOWER on IntegriCloud