|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v2 8/9] plat/common: Add functionality to save and restore extended (x86) registers
On 12/19/18 3:58 PM, Yuri Volchkov wrote: Hi, see my notes inline -Yuri. Florian Schmidt <florian.schmidt@xxxxxxxxx> writes:On creation of a sw_ctx struct, allocate an area sufficiently large to save all extended registers. On context switch, use the appropriate CPU instruction to save and restore those registers to/from that area. Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx> --- plat/common/include/sw_ctx.h | 9 +++++-- plat/common/include/x86/cpu.h | 49 +++++++++++++++++++++++++++++++++++ plat/common/sw_ctx.c | 14 ++++++++-- 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/plat/common/include/sw_ctx.h b/plat/common/include/sw_ctx.h index fae96beb..1b279b25 100644 --- a/plat/common/include/sw_ctx.h +++ b/plat/common/include/sw_ctx.h @@ -38,8 +38,13 @@ #include <uk/plat/thread.h>struct sw_ctx {- unsigned long sp; /* Stack pointer */ - unsigned long ip; /* Instruction pointer */ + unsigned long sp; /* Stack pointer */ + unsigned long ip; /* Instruction pointer */ + unsigned char extregs[]; /* NB, this will typically NOT point to + * the beginning of the extregs area, + * because the extregs area needs to + * be aligned. + */ Hm, yeah, I might do that. I honestly can't remember whether I did it like this originally. Your suggestion seems simpler, and probably ever so slightly more efficient, because we don't need to calculate the start of the memory area on each {save,restore}_extregs. I think the only downside to the pointer way is that we "waste" another sizeof(uintptr_t) bytes in the struct. However, due to the alignment requirements (64 bytes for modern CPUs), this memory area is unused anyway. So I'm gonna try out this solution and go with it if I don't see any other issue. };void sw_ctx_callbacks_init(struct ukplat_ctx_callbacks *ctx_cbs);diff --git a/plat/common/include/x86/cpu.h b/plat/common/include/x86/cpu.h index fbc229d9..f2a8f0d5 100644 --- a/plat/common/include/x86/cpu.h +++ b/plat/common/include/x86/cpu.h @@ -32,6 +32,7 @@#include <uk/arch/types.h>#include <x86/cpu_defs.h> +#include <sw_ctx.h> #include <stdint.h>void halt(void); Will do. return ctx;} @@ -85,6 +90,11 @@ extern void asm_sw_ctx_switch(void *prevctx, void *nextctx);static void sw_ctx_switch(void *prevctx, void *nextctx) -- Dr. Florian Schmidt フローリアン・シュミット Research Scientist, Systems and Machine Learning Group NEC Laboratories Europe Kurfürsten-Anlage 36, D-69115 Heidelberg Tel. +49 (0)6221 4342-265 Fax: +49 (0)6221 4342-155 e-mail: florian.schmidt@xxxxxxxxx ============================================================ Registered at Amtsgericht Mannheim, Germany, HRB728558 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |