| 5810998e | 15-Oct-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: sys/queue.h: add STAILQ_FOREACH_SAFE()
Import macro STAILQ_FOREACH_SAFE from FreeBSD.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@l
libutils: sys/queue.h: add STAILQ_FOREACH_SAFE()
Import macro STAILQ_FOREACH_SAFE from FreeBSD.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| bde8a250 | 02-Oct-2018 |
Joakim Bech <joakim.bech@linaro.org> |
pager: enable BestFit allocation when using the pager
When running xtest 6018 we have got panics because of TEE_ERROR_OUT_OF_MEMORY errors when trying to allocate memory (using malloc and calloc). T
pager: enable BestFit allocation when using the pager
When running xtest 6018 we have got panics because of TEE_ERROR_OUT_OF_MEMORY errors when trying to allocate memory (using malloc and calloc). The reason for this seems to be a fragmented heap when running with the pager enabled. By enabling the BestFit algorithm in bget we have seen a much improved use of the heap with a lot less fragmentation. We have been running xtest on QEMU v8 and HiKey 6220 and the performance difference seems to be negligible.
Fixes: https://github.com/OP-TEE/optee_os/issues/2580
Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Tested-by: Joakim Bech <joakim.bech@linaro.org> (HiKey 6220, QEMU v8) Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0fe671d3 | 24-May-2018 |
Volodymyr Babchuk <vlad.babchuk@gmail.com> |
trace: get thread_id right in print_thread_id()
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> |
| a920a741 | 24-May-2018 |
Volodymyr Babchuk <vlad.babchuk@gmail.com> |
trace: check for CFG_MSG_LONG_PREFIX_MASK only once per message
There is no need for repeated checks for every portion of extended prefix.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
trace: check for CFG_MSG_LONG_PREFIX_MASK only once per message
There is no need for repeated checks for every portion of extended prefix.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 64fad262 | 23-May-2018 |
Volodymyr Babchuk <vlad.babchuk@gmail.com> |
trace: print core id if in atomic context
If (D|E|I|F)MSG is called with foreign interrupts masked we can report core ID. "?" will be printed instead, if foreign interrupts aren't masked.
With this
trace: print core id if in atomic context
If (D|E|I|F)MSG is called with foreign interrupts masked we can report core ID. "?" will be printed instead, if foreign interrupts aren't masked.
With this patch log looks like this:
D/TC:2 0 core_mmu_set_user_map:940 0xe181b88 0xeee8003 D/TC:? 0 __wq_rpc:40 wake thread 1 0xe16f028 -3 D/TC:1 thread_handle_std_smc:612 a7: 2 D/TC:3 0 core_mmu_set_user_map:940 0x0 0x0
Where first digit shows core id and second - thread id.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 8a076f79 | 20-Jun-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
Use inttypes.h over stdint.h on some .h files
Uses inttypes.h over stdint.h on some .h files to be nice to U-boot.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wikla
Use inttypes.h over stdint.h on some .h files
Uses inttypes.h over stdint.h on some .h files to be nice to U-boot.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0135712b | 02-Feb-2018 |
Volodymyr Babchuk <vlad.babchuk@gmail.com> |
bget: remove unused parameter for bufdump()
bufdump() function does not need poolset to work
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@li
bget: remove unused parameter for bufdump()
bufdump() function does not need poolset to work
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cf1dc544 | 27-Jun-2018 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutils: introduce MAX_UNSAFE() and MIN_UNSAFE()
This change allows one to use MAX_UNSAFE() and MIN_UNSAFE() macros in particular conditions where MAX()/MIN() macros fail to build from C source fil
libutils: introduce MAX_UNSAFE() and MIN_UNSAFE()
This change allows one to use MAX_UNSAFE() and MIN_UNSAFE() macros in particular conditions where MAX()/MIN() macros fail to build from C source file implementation with error traces as below:
In file included from core/arch/arm/include/arm.h:8:0, from core/arch/arm/include/kernel/thread.h:11, from core/arch/arm/kernel/asm-defines.c:7: lib/libutils/ext/include/util.h:24:16: error: missing binary operator before token "(" (__extension__({ __typeof__(a) _a = (a); \ ^ core/arch/arm/plat-stm/./platform_config.h:190:25: note: in expansion of macro ‘MAX’ #define STM_SECDDR_END MAX(TZSRAM_BASE + TZSRAM_SIZE, \ ^~~ core/arch/arm/plat-stm/./platform_config.h:204:6: note: in expansion of macro ‘STM_SECDDR_END’ #if (STM_SECDDR_END < 0x80000000ULL) ^~~~~~~~~~~~~~ make: *** [out/core/include/generated/.asm-defines.s] Error 1
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 433c4257 | 07-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
Add rand() for TA usage
Adds rand() by declaring it in stdlib.h where it's expected to be found. Implementation is provided in libutee since it depends on TEE_GenerateRandom().
Reviewed-by: Joakim
Add rand() for TA usage
Adds rand() by declaring it in stdlib.h where it's expected to be found. Implementation is provided in libutee since it depends on TEE_GenerateRandom().
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9668cb1e | 07-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
stdint.h: include limits.h
The define SIZE_MAX uses ULONG_MAX, which is provided in limits.h.
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.o
stdint.h: include limits.h
The define SIZE_MAX uses ULONG_MAX, which is provided in limits.h.
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 5b01430c | 07-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: import strcpy() and strncpy()
Imports strcpy() and strncpy() from newlib with license added
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@
libutils: import strcpy() and strncpy()
Imports strcpy() and strncpy() from newlib with license added
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 03368b7b | 07-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: import strstr() from newlib
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.
libutils: import strstr() from newlib
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 5aa6e234 | 07-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: time.h: typedef time_t
Typedefs time_t as a int64_t
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklande
libutils: time.h: typedef time_t
Typedefs time_t as a int64_t
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| dc0f4ec2 | 16-May-2018 |
Etienne Carriere <etienne.carriere@st.com> |
Remove license notice from STMicroelectronics files
Since a while the source files license info are defined by SPDX identifiers. We can safely remove the verbose license text from the files that are
Remove license notice from STMicroelectronics files
Since a while the source files license info are defined by SPDX identifiers. We can safely remove the verbose license text from the files that are owned by either only STMicroelectronics or only both Linaro and STMicroelectronics.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| a94eb7ef | 15-May-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
util: remove unused macros
After commit 9a8117de1263 ("util: update fallback ADD_OVERFLOW() macro") and commit ecdedc94e720 ("util: update fallback SUB_OVERFLOW() macro"), the following macros are n
util: remove unused macros
After commit 9a8117de1263 ("util: update fallback ADD_OVERFLOW() macro") and commit ecdedc94e720 ("util: update fallback SUB_OVERFLOW() macro"), the following macros are not used anymore. Remove them.
__INTOF_HALF_MAX_SIGNED(type) __INTOF_MAX_SIGNED(type) __INTOF_MIN_SIGNED(type) __INTOF_MIN(type) __INTOF_MAX(type)
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| ecdedc94 | 14-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
util: update fallback SUB_OVERFLOW() macro
Updates the fallback SUB_OVERFLOW() macro to better support mixed types in the arguments.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-b
util: update fallback SUB_OVERFLOW() macro
Updates the fallback SUB_OVERFLOW() macro to better support mixed types in the arguments.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9a8117de | 14-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
util: update fallback ADD_OVERFLOW() macro
Updates the fallback ADD_OVERFLOW() macro to better support mixed types in the arguments.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-b
util: update fallback ADD_OVERFLOW() macro
Updates the fallback ADD_OVERFLOW() macro to better support mixed types in the arguments.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2770e242 | 14-May-2018 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutils: MIN/MAX macros for assembly code
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> |
| 2b38f7fd | 04-May-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: bget_malloc.c: fix overflow tests
The overflow tests in raw_calloc(), raw_realloc() and raw_malloc() are wrong. They don't work as expected when hdr_size and ftr_size are both zero. The bu
libutils: bget_malloc.c: fix overflow tests
The overflow tests in raw_calloc(), raw_realloc() and raw_malloc() are wrong. They don't work as expected when hdr_size and ftr_size are both zero. The bug is exposed by commit 96c1d8c56cde ("ta: TEE_Malloc() and friend: skips layers") which causes xtest 8033 to fail because TEE_Malloc(0, TEE_MALLOC_FILL_ZERO) now returns NULL.
In addition, the allocation functions in bget.c (bget(), bgetz() and bgetr()) take a parameter of type bufsize for the allocation size. This happens to be a (signed) long. On the other hand, raw_malloc(), raw_calloc() and raw_realloc() take a size_t parameter which is unsigned long. Therefore, large size values are incorrectly interpreted as being negative by the bget code, which then asserts. When run in the context of a TA, this causes a TA panic instead of a TEE_ERROR_OUT_OF_MEMORY error. This bug is also exposed by commit 96c1d8c56cde ("ta: TEE_Malloc() and friend: skips layers") and makes xtest 8034 and 8042 fail. 8034 is TEE_Malloc(0xFFFFFFFE, TEE_MALLOC_FILL_ZERO) while 8042 is TEE_Realloc(ptr, 0xFFFFFFFE).
Rework the raw_calloc(), raw_realloc() and raw_malloc() functions to use the MUL_OVERFLOW() and ADD_OVERFLOW() macros instead, operating on the proper types.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 86ab9ffe | 08-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
util: fix fallback SUB_OVERFLOW() macro
This only applies when the compiler doesn't provide the __builtin_sub_overflow() function (before GCC 5.1).
Fixes problem due to integer promotion in overflo
util: fix fallback SUB_OVERFLOW() macro
This only applies when the compiler doesn't provide the __builtin_sub_overflow() function (before GCC 5.1).
Fixes problem due to integer promotion in overflow macros when result is a signed type and the subtrahend is an unsigned type with a low value.
SUB_OVERFLOW() still doesn't handle all combinations of signed and unsigned types in the parameters.
Fixes: ce0d8e2da340 ("util: add macros for arithmetics with overflow checking") Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2b304337 | 07-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
util: fix fallback ADD_OVERFLOW() macro
This only applies when the compiler doesn't provide the __builtin_add_overflow() function (before GCC 5.1).
Fixes problem due to integer promotion in overflo
util: fix fallback ADD_OVERFLOW() macro
This only applies when the compiler doesn't provide the __builtin_add_overflow() function (before GCC 5.1).
Fixes problem due to integer promotion in overflow macros when result is a signed type and the second addend is an unsigned type with value 0.
ADD_OVERFLOW() still doesn't handle all combinations of signed and unsigned types in the parameters.
Fixes: ce0d8e2da340 ("util: add macros for arithmetics with overflow checking") Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| d815ab47 | 27-Apr-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: isoc: implement tolower(), isdigit() and isxdigit()
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim B
libutils: isoc: implement tolower(), isdigit() and isxdigit()
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| fb30cafd | 27-Apr-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
Prevent unused warnings in speculation_barrier.h
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim Bech <joakim.b
Prevent unused warnings in speculation_barrier.h
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| 6aca2c8e | 27-Apr-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: import speculation_barrier.h
Import speculation_barrier.h from [1]. This file implements a set of wrapper macros for the __builtin_load_no_speculate builtin function detailed at [2]. This
libutils: import speculation_barrier.h
Import speculation_barrier.h from [1]. This file implements a set of wrapper macros for the __builtin_load_no_speculate builtin function detailed at [2]. This builtin function defines a speculation barrier, which can be used to limit the conditions under which a value which has been loaded can be used under specualtive execution.
The header file provided here allows a migration path to using the builtin function for users who are unable to immediately upgrade to a compiler which supports the builtin.
(Description taken from the README.md file of the speculation_barrier project by Arm on GitHub [3])
Link: [1] https://raw.githubusercontent.com/ARM-software/speculation-barrier/80e65cd830b321ff676941c2fab773da450e6dae/speculation_barrier.h Link: [2] https://www.arm.com/security-update Link: [3] https://github.com/ARM-software/speculation-barrier Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| 621a56cf | 26-Apr-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutil: provide non-stubbed ctypes.h
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@
libutil: provide non-stubbed ctypes.h
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|