trace: conserve gd register on RISC-V
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 15 Oct 2020 10:30:09 +0000 (12:30 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 27 Oct 2020 20:13:15 +0000 (21:13 +0100)
An UEFI application may change the value of the register that gd lives in.
But some of our functions like get_ticks() access this register. So we
have to set the gd register to the U-Boot value when entering a trace
point and set it back to the application value when exiting the trace
point.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/trace.c

index 831283c..defc971 100644 (file)
@@ -57,7 +57,7 @@ static inline uintptr_t __attribute__((no_instrument_function))
        return offset / FUNC_SITE_SIZE;
 }
 
-#if defined(CONFIG_EFI_LOADER) && defined(CONFIG_ARM)
+#if defined(CONFIG_EFI_LOADER) && (defined(CONFIG_ARM) || defined(CONFIG_RISCV))
 
 /**
  * trace_gd - the value of the gd register