aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/io/io_memmap.c
diff options
context:
space:
mode:
authorDouglas Raillard <douglas.raillard@arm.com>2017-01-26 15:54:44 +0000
committerDouglas Raillard <douglas.raillard@arm.com>2017-02-06 17:01:39 +0000
commit32f0d3c6c3fb1fb9353ec0b82ddb099281b9328c (patch)
tree2df3f2994752b3c23e269920026a40a5b8d11bb6 /drivers/io/io_memmap.c
parent308d359b260d888f024a2d26c76cd4a50789e432 (diff)
downloadplatform_external_arm-trusted-firmware-32f0d3c6c3fb1fb9353ec0b82ddb099281b9328c.tar.gz
platform_external_arm-trusted-firmware-32f0d3c6c3fb1fb9353ec0b82ddb099281b9328c.tar.bz2
platform_external_arm-trusted-firmware-32f0d3c6c3fb1fb9353ec0b82ddb099281b9328c.zip
Replace some memset call by zeromem
Replace all use of memset by zeromem when zeroing moderately-sized structure by applying the following transformation: memset(x, 0, sizeof(x)) => zeromem(x, sizeof(x)) As the Trusted Firmware is compiled with -ffreestanding, it forbids the compiler from using __builtin_memset and forces it to generate calls to the slow memset implementation. Zeromem is a near drop in replacement for this use case, with a more efficient implementation on both AArch32 and AArch64. Change-Id: Ia7f3a90e888b96d056881be09f0b4d65b41aa79e Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
Diffstat (limited to 'drivers/io/io_memmap.c')
-rw-r--r--drivers/io/io_memmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/io/io_memmap.c b/drivers/io/io_memmap.c
index fe39652bd..53af4f68f 100644
--- a/drivers/io/io_memmap.c
+++ b/drivers/io/io_memmap.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -33,6 +33,7 @@
#include <io_driver.h>
#include <io_storage.h>
#include <string.h>
+#include <utils.h>
/* As we need to be able to keep state for seek, only one file can be open
* at a time. Make this a structure and point to the entity->info. When we
@@ -231,7 +232,7 @@ static int memmap_block_close(io_entity_t *entity)
entity->info = 0;
/* This would be a mem free() if we had malloc.*/
- memset((void *)&current_file, 0, sizeof(current_file));
+ zeromem((void *)&current_file, sizeof(current_file));
return 0;
}