From fb5946b69c376f6f9d9f8268c8e9d5a000f8b70a Mon Sep 17 00:00:00 2001 From: Adrian-Ken Rueegsegger Date: Fri, 20 Feb 2015 16:09:39 +0100 Subject: [PATCH] hw_x86_64: Save client register values to context Point stack to client context region and save registers using push instructions. Note that since the push instruction first increments the stack pointer and then stores the value on the stack, the RSP has to point one field past RBP before pushing the first register value. --- .../src/core/spec/x86_64/mode_transition.s | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/repos/base-hw/src/core/spec/x86_64/mode_transition.s b/repos/base-hw/src/core/spec/x86_64/mode_transition.s index c76f229cf..1eb28abaa 100644 --- a/repos/base-hw/src/core/spec/x86_64/mode_transition.s +++ b/repos/base-hw/src/core/spec/x86_64/mode_transition.s @@ -90,6 +90,24 @@ popq FLAGS_OFFSET(%rax) popq SP_OFFSET(%rax) + /* Save register values to client context */ + lea ERRCODE_OFFSET(%rax), %rsp + pushq %rbp + pushq %rsi + pushq %rdi + pushq %rdx + pushq %rcx + pushq %rbx + pushq _mt_buffer + pushq %r15 + pushq %r14 + pushq %r13 + pushq %r12 + pushq %r11 + pushq %r10 + pushq %r9 + pushq %r8 + 1: jmp 1b .global _mt_user_entry_pic