lx_kit: move setjmp/longjmp away from legacy

We use the architecture-specific setjmp/longjmp implementation without
modification in the newer lx_kit implementation as well. There is no
need for a duplication.

Ref genodelabs/genode#4411
This commit is contained in:
Stefan Kalkowski 2022-02-08 16:04:47 +01:00 committed by Norman Feske
parent ed1b8fb3f9
commit 1e41c6daa4
21 changed files with 21 additions and 164 deletions

View File

@ -1,5 +1,5 @@
SRC_S += setjmp.S
vpath %.S $(REP_DIR)/src/lib/legacy/lx_kit/spec/arm
vpath %.S $(REP_DIR)/src/lib/lx_kit/spec/arm
CC_CXX_WARN_STRICT =

View File

@ -1,5 +1,5 @@
SRC_S += setjmp.S
vpath %.S $(REP_DIR)/src/lib/legacy/lx_kit/spec/arm_64
vpath %.S $(REP_DIR)/src/lib/lx_kit/spec/arm_64
CC_CXX_WARN_STRICT =

View File

@ -1,5 +1,5 @@
SRC_S += setjmp.S
vpath %.S $(REP_DIR)/src/lib/legacy/lx_kit/spec/x86_32
vpath %.S $(REP_DIR)/src/lib/lx_kit/spec/x86_32
CC_CXX_WARN_STRICT =

View File

@ -1,5 +1,5 @@
SRC_S += setjmp.S
vpath %.S $(REP_DIR)/src/lib/legacy/lx_kit/spec/x86_64
vpath %.S $(REP_DIR)/src/lib/lx_kit/spec/x86_64
CC_CXX_WARN_STRICT =

View File

@ -8,7 +8,8 @@ MIRROR_FROM_REP_DIR := $(LIB_MK) \
src/drivers/nic/linux_network_session_base.h \
lib/import/import-fec_nic_include.mk \
src/include/legacy src/lib/legacy/lx_kit \
$(foreach SPEC,arm arm_64 arm_v7,src/include/spec/$(SPEC)/legacy) \
src/lib/lx_kit/spec \
$(foreach SPEC,arm arm_64 arm_v7,src/include/spec/$(SPEC)) \
$(shell cd $(REP_DIR); find src/drivers/nic/fec -type f)
MIRROR_FROM_PORT_DIR := $(shell cd $(PORT_DIR); find src/drivers/nic/fec -type f | grep -v ".git")

View File

@ -7,7 +7,8 @@ PORT_DIR := $(call port_dir,$(REP_DIR)/ports/dde_linux)
MIRROR_FROM_REP_DIR := $(LIB_MK) \
lib/import/import-intel_fb_include.mk \
src/include src/lib/legacy/lx_kit \
$(foreach SPEC,x86 x86_32 x86_64,src/include/spec/$(SPEC)/legacy) \
src/lib/lx_kit/spec \
$(foreach SPEC,x86 x86_32 x86_64,src/include/spec/$(SPEC)) \
$(shell cd $(REP_DIR); find src/drivers/framebuffer/intel -type f)
MIRROR_FROM_PORT_DIR := $(shell cd $(PORT_DIR); find src/drivers/framebuffer/intel -type f | grep -v ".git")

View File

@ -7,7 +7,8 @@ MIRROR_FROM_REP_DIR := $(LIB_MK) \
lib/import/import-usb_hid_include.mk \
lib/import/import-usb_arch_include.mk \
src/include/legacy src/lib/legacy/lx_kit \
$(foreach SPEC,arm arm_64 arm_v6 arm_v7 x86 x86_32 x86_64,src/include/spec/$(SPEC)/legacy) \
src/lib/lx_kit/spec \
$(foreach SPEC,arm arm_64 arm_v6 arm_v7 x86 x86_32 x86_64,src/include/spec/$(SPEC)) \
$(shell cd $(REP_DIR); find src/drivers/usb_hid -type f)
MIRROR_FROM_PORT_DIR := $(shell cd $(PORT_DIR); find src/drivers/usb_hid -type f | grep -v ".git")

View File

@ -6,7 +6,8 @@ PORT_DIR := $(call port_dir,$(REP_DIR)/ports/dde_linux)
MIRROR_FROM_REP_DIR := $(LIB_MK) \
lib/import/import-usb_host_include.mk \
src/include/legacy src/lib/legacy/lx_kit \
$(foreach SPEC,arm arm_64 arm_v6 arm_v7 x86 x86_32 x86_64,src/include/spec/$(SPEC)/legacy) \
src/lib/lx_kit/spec \
$(foreach SPEC,arm arm_64 arm_v6 arm_v7 x86 x86_32 x86_64,src/include/spec/$(SPEC)) \
$(shell cd $(REP_DIR); find src/drivers/usb_host -type f)
MIRROR_FROM_PORT_DIR := $(shell cd $(PORT_DIR); find src/drivers/usb_host -type f | grep -v ".git")

View File

@ -2,13 +2,14 @@ PORT_DIR := $(call port_dir,$(REP_DIR)/ports/dde_linux)
MIRROR_FROM_REP_DIR := src/drivers/usb_modem \
src/lib/legacy/lx_kit \
src/lib/lx_kit/spec \
src/include/legacy \
lib/import/import-usb_modem_include.mk \
lib/import/import-usb_arch_include.mk \
lib/mk/usb_modem_include.mk \
$(foreach SPEC, \
arm arm_64 arm_v6 arm_v7 x86 x86_32 x86_64, \
src/include/spec/$(SPEC)/legacy) \
src/include/spec/$(SPEC)) \
$(foreach SPEC, \
arm arm_64 x86_32 x86_64, \
lib/mk/spec/$(SPEC)/lx_kit_setjmp.mk)

View File

@ -4,13 +4,14 @@ MIRROR_FROM_REP_DIR := src/drivers/usb_net \
src/drivers/nic/linux_network_session_base.cc \
src/drivers/nic/linux_network_session_base.h \
src/lib/legacy/lx_kit \
src/lib/lx_kit/spec \
src/include/legacy \
lib/import/import-usb_net_include.mk \
lib/import/import-usb_arch_include.mk \
lib/mk/usb_net_include.mk \
$(foreach SPEC, \
arm arm_64 arm_v6 arm_v7 x86 x86_32 x86_64, \
src/include/spec/$(SPEC)/legacy) \
src/include/spec/$(SPEC)) \
$(foreach SPEC, \
arm arm_64 x86_32 x86_64, \
lib/mk/spec/$(SPEC)/lx_kit_setjmp.mk)

View File

@ -6,9 +6,10 @@ PORT_DIR := $(call port_dir,$(REP_DIR)/ports/dde_linux)
MIRROR_FROM_REP_DIR := $(LIB_MK) \
lib/import/import-lxip_include.mk \
include/lxip src/include/legacy src/lib/legacy/lx_kit \
src/lib/lx_kit/spec \
$(foreach SPEC, \
arm arm_64 arm_v6 arm_v7 x86 x86_32 x86_64, \
src/include/spec/$(SPEC)/legacy) \
src/include/spec/$(SPEC)) \
$(shell cd $(REP_DIR); find src/lib/lxip -type f) \
$(shell cd $(REP_DIR); find src/lib/vfs -type f)

View File

@ -12,8 +12,9 @@ MIRROR_FROM_REP_DIR := $(LIB_MK) \
lib/import/import-libnl_include.mk \
lib/import/import-libnl.mk \
include/wifi src/include/legacy src/lib/legacy/lx_kit \
src/lib/lx_kit/spec \
$(foreach SPEC, x86 x86_32 x86_64, \
src/include/spec/$(SPEC)/legacy) \
src/include/spec/$(SPEC)) \
$(shell cd $(REP_DIR); find src/drivers/wifi -type f) \
$(shell cd $(REP_DIR); find src/lib/libnl -type f) \
$(shell cd $(REP_DIR); find src/lib/wifi -type f) \

View File

@ -23,7 +23,7 @@
/* Linux emulation environment includes */
#include <legacy/lx_kit/internal/list.h>
#include <legacy/lx_kit/internal/arch_execute.h>
#include <lx_kit/arch_execute.h>
namespace Lx {

View File

@ -1,43 +0,0 @@
/**
* \brief Platform specific code
* \author Christian Prochaska
* \date 2019-07-01
*/
/*
* Copyright (C) 2019 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#ifndef _ARCH_EXECUTE_H_
#define _ARCH_EXECUTE_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _JBLEN 31
typedef struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1];
void _longjmp(jmp_buf, int);
int _setjmp(jmp_buf);
#ifdef __cplusplus
}
#endif
static inline
void arch_execute(void *sp, void *func, void *arg)
{
asm volatile ("mov x0, %2;" /* set arg */
"mov sp, %0;" /* set stack */
"mov x29, xzr;" /* clear frame pointer */
"br %1;" /* call func */
""
: : "r"(sp), "r"(func), "r"(arg) : "r0");
}
#endif /* _ARCH_EXECUTE_H_ */

View File

@ -1,108 +0,0 @@
/*-
* Copyright (c) 2014 Andrew Turner
* Copyright (c) 2014 The FreeBSD Foundation
* All rights reserved.
*
* Portions of this software were developed by Andrew Turner
* under sponsorship from the FreeBSD Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/* needed parts from <machine/asm.h> */
#define __FBSDID(x)
#define ENTRY(sym) .text; .globl sym; .align 2; .type sym,#function; sym:
#define END(sym) .size sym, . - sym
/* end of <machine/asm.h> */
__FBSDID("$FreeBSD: releng/12.0/lib/libc/aarch64/gen/setjmp.S 313146 2017-02-03 11:51:06Z andrew $");
/* needed parts from <machine/setjmp.h> */
#define _JB_SIGMASK 22
#define _JB_MAGIC__SETJMP 0xfb5d25837d7ff700
/* end of <machine/asm.h> */
ENTRY(_setjmp)
/* Store the magic value and stack pointer */
ldr x8, .Lmagic
mov x9, sp
stp x8, x9, [x0], #16
/* Store the general purpose registers and lr */
stp x19, x20, [x0], #16
stp x21, x22, [x0], #16
stp x23, x24, [x0], #16
stp x25, x26, [x0], #16
stp x27, x28, [x0], #16
stp x29, lr, [x0], #16
#ifndef _STANDALONE
/* Store the vfp registers */
stp d8, d9, [x0], #16
stp d10, d11, [x0], #16
stp d12, d13, [x0], #16
stp d14, d15, [x0]
#endif
/* Return value */
mov x0, #0
ret
.align 3
.Lmagic:
.quad _JB_MAGIC__SETJMP
END(_setjmp)
ENTRY(_longjmp)
/* Check the magic value */
ldr x8, [x0], #8
ldr x9, .Lmagic
cmp x8, x9
b.ne botch
/* Restore the stack pointer */
ldr x8, [x0], #8
mov sp, x8
/* Restore the general purpose registers and lr */
ldp x19, x20, [x0], #16
ldp x21, x22, [x0], #16
ldp x23, x24, [x0], #16
ldp x25, x26, [x0], #16
ldp x27, x28, [x0], #16
ldp x29, lr, [x0], #16
#ifndef _STANDALONE
/* Restore the vfp registers */
ldp d8, d9, [x0], #16
ldp d10, d11, [x0], #16
ldp d12, d13, [x0], #16
ldp d14, d15, [x0]
#endif
/* Load the return value */
mov x0, x1
ret
botch:
b botch
END(_longjmp)