summaryrefslogtreecommitdiffstats
path: root/libc/include
diff options
context:
space:
mode:
authorClaudio Carvalho <cclaudio@linux.vnet.ibm.com>2016-09-28 05:01:03 -0300
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-10-05 14:42:26 +1100
commit26a1d0c487d6b61afb0a338189d98c91bb481ee9 (patch)
tree773b093c58dc954b37a728790e0507407bdd127d /libc/include
parent6ef40b5999aad01379daf19689d264f9e3d518d7 (diff)
downloadtalos-skiboot-26a1d0c487d6b61afb0a338189d98c91bb481ee9.tar.gz
talos-skiboot-26a1d0c487d6b61afb0a338189d98c91bb481ee9.zip
libc/string: add memcpy_from_ci()
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>
Diffstat (limited to 'libc/include')
-rw-r--r--libc/include/string.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/include/string.h b/libc/include/string.h
index 890ffc29..e4b4fac9 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation
+ * Copyright (c) 2004, 2016 IBM Corporation
* All rights reserved.
* This program and the accompanying materials
* are made available under the terms of the BSD License
@@ -32,6 +32,7 @@ char *strdup(const char *src);
void *memset(void *s, int c, size_t n);
void *memchr(const void *s, int c, size_t n);
void *memcpy(void *dest, const void *src, size_t n);
+void *memcpy_from_ci(void *destpp, const void *srcpp, size_t len);
void *memmove(void *dest, const void *src, size_t n);
int memcmp(const void *s1, const void *s2, size_t n);
OpenPOWER on IntegriCloud