[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 1/2] plat: Use position independent code (PIC) in thread_start.S



Hey Razvan,

this patch looks good to me. I am going to upstream it.
Thanks a lot.

Simon

Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>

On 23.03.20 16:08, Razvan Deaconescu wrote:
Use RIP-relative addressing for PIC.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@xxxxxxxxx>
---
  plat/common/x86/thread_start.S | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/plat/common/x86/thread_start.S b/plat/common/x86/thread_start.S
index b23666a..61f4f1c 100644
--- a/plat/common/x86/thread_start.S
+++ b/plat/common/x86/thread_start.S
@@ -36,7 +36,7 @@ ENTRY(asm_thread_starter)
        pushq $0
        xorq %rbp,%rbp
        call *%rbx
-       call uk_sched_thread_exit
+       call *uk_sched_thread_exit@GOTPCREL(%rip)
ENTRY(asm_ctx_start)
        mov %rdi, %rsp      /* set SP */
@@ -52,10 +52,11 @@ ENTRY(asm_sw_ctx_switch)
        pushq %r15
        movq %rsp, OFFSETOF_SW_CTX_SP(%rdi)       /* save ESP */
        movq OFFSETOF_SW_CTX_SP(%rsi), %rsp       /* restore ESP */
-       movq $1f, OFFSETOF_SW_CTX_IP(%rdi)        /* save EIP */
+        lea .Lreturn(%rip), %rbx
+        movq %rbx, OFFSETOF_SW_CTX_IP(%rdi)       /* save EIP */
        pushq OFFSETOF_SW_CTX_IP(%rsi)            /* restore EIP */
        ret
-1:
+.Lreturn:
        popq %r15
        popq %r14
        popq %r13




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.