Commit 8e590624 authored by Varun Wadekar's avatar Varun Wadekar
Browse files

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: default avatarVarun Wadekar <vwadekar@nvidia.com>
parent 0e1f9e31
/* /*
* 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 * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
struct trusty_stack { struct trusty_stack {
uint8_t space[PLATFORM_STACK_SIZE] __aligned(16); uint8_t space[PLATFORM_STACK_SIZE] __aligned(16);
uint32_t end;
}; };
struct trusty_cpu_ctx { struct trusty_cpu_ctx {
...@@ -326,7 +327,7 @@ static int32_t trusty_init(void) ...@@ -326,7 +327,7 @@ static int32_t trusty_init(void)
cm_set_next_eret_context(SECURE); cm_set_next_eret_context(SECURE);
ctx->saved_security_state = ~0; /* initial saved state is invalid */ 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); trusty_context_switch_helper(&ctx->saved_sp, &zero_args);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment