9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 618b81f6e4d73e773be6ecdf3730393bd74e3dd7
parent f1f5ff5c6a7c02a15d189188a9ecece5d1d5899c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 22 Aug 2020 20:08:28 +0200

hosted: Add getcontext()

This function was lost in hosted mode.

Change-Id: I6c2b932ee9b6972c2759afd524c7f9bab81ab794

Diffstat:
Msrc/kernel/arch/hosted/arch.c | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/kernel/arch/hosted/arch.c b/src/kernel/arch/hosted/arch.c @@ -1,6 +1,7 @@ #include <setjmp.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <9os/9os.h> @@ -13,6 +14,12 @@ noreturn void longjmp(jmp_buf env, int val); Context *(*getframe)(void); int halted; +Context * +getcontext(Context *ctx) +{ + return memcpy(ctx, (*getframe)(), sizeof(*ctx)); +} + void dohalt(void) {