summaryrefslogtreecommitdiff
path: root/services/spd
diff options
context:
space:
mode:
authorVarun Wadekar <vwadekar@nvidia.com>2017-02-16 18:14:37 -0800
committerVarun Wadekar <vwadekar@nvidia.com>2017-03-06 08:47:56 -0800
commit8e5906249ad2cf599150865e7a0b76f3d66a2ea8 (patch)
tree07efeae61df0e4d128527edbff1c4683f9ffde0f /services/spd
parent0e1f9e3155c164f12910fe0f32f6cbf2d37177c8 (diff)
spd: trusty: save context starting from the stack end
This patch uses the stack end to start saving the CPU context during world switch. The previous logic, used the stack start to save the context, thus overwriting the other members of the context. Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Diffstat (limited to 'services/spd')
-rw-r--r--services/spd/trusty/trusty.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/spd/trusty/trusty.c b/services/spd/trusty/trusty.c
index 976087c9..b386b3b8 100644
--- a/services/spd/trusty/trusty.c
+++ b/services/spd/trusty/trusty.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-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:
@@ -50,6 +50,7 @@
struct trusty_stack {
uint8_t space[PLATFORM_STACK_SIZE] __aligned(16);
+ uint32_t end;
};
struct trusty_cpu_ctx {
@@ -326,7 +327,7 @@ static int32_t trusty_init(void)
cm_set_next_eret_context(SECURE);
ctx->saved_security_state = ~0; /* initial saved state is invalid */
- trusty_init_context_stack(&ctx->saved_sp, &ctx->secure_stack);
+ trusty_init_context_stack(&ctx->saved_sp, &ctx->secure_stack.end);
trusty_context_switch_helper(&ctx->saved_sp, &zero_args);