mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 03:06:39 +00:00
parent
1c77ea2b03
commit
38dcdeeb04
5
repos/dde_linux/lib/mk/spec/arm_64/lx_kit_setjmp.mk
Normal file
5
repos/dde_linux/lib/mk/spec/arm_64/lx_kit_setjmp.mk
Normal file
@ -0,0 +1,5 @@
|
||||
SRC_S += setjmp.S
|
||||
|
||||
vpath %.S $(REP_DIR)/src/lx_kit/spec/arm_64
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* \brief Platform_device implementation for ARM
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2016-04-25
|
||||
*
|
||||
* Note: Throw away when there exists a plaform device implementation for ARM
|
||||
* in generic code
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _ARM__PLATFORM_DEVICE__PLATFORM_DEVICE_H_
|
||||
#define _ARM__PLATFORM_DEVICE__PLATFORM_DEVICE_H_
|
||||
|
||||
|
||||
#include <lx_emul/extern_c_begin.h>
|
||||
#include <lx_emul/printf.h>
|
||||
#include <lx_emul/extern_c_end.h>
|
||||
|
||||
#include <lx_kit/malloc.h>
|
||||
#include <platform_device/device.h>
|
||||
|
||||
#include <irq_session/connection.h>
|
||||
#include <util/list.h>
|
||||
#include <util/reconstructible.h>
|
||||
|
||||
|
||||
namespace Platform { struct Device; }
|
||||
|
||||
struct Platform::Device : Platform::Abstract_device, Genode::List<Device>::Element
|
||||
{
|
||||
Genode::Env &env;
|
||||
|
||||
unsigned irq_num;
|
||||
Genode::Constructible<Genode::Irq_connection> irq_connection;
|
||||
|
||||
Device(Genode::Env &env, unsigned irq) : env(env), irq_num(irq) { }
|
||||
|
||||
unsigned vendor_id() { return ~0U; }
|
||||
unsigned device_id() { return ~0U; }
|
||||
|
||||
Genode::Irq_session_capability irq(Genode::uint8_t) override
|
||||
{
|
||||
irq_connection.construct(env, irq_num);
|
||||
return irq_connection->cap();
|
||||
}
|
||||
|
||||
Genode::Io_mem_session_capability io_mem(Genode::uint8_t,
|
||||
Genode::Cache_attribute,
|
||||
Genode::addr_t, Genode::size_t) override
|
||||
{
|
||||
lx_printf("%s: not implemented\n", __PRETTY_FUNCTION__);
|
||||
return Genode::Io_mem_session_capability();
|
||||
}
|
||||
|
||||
static Genode::List<Device> &list()
|
||||
{
|
||||
static Genode::List<Device> l;
|
||||
return l;
|
||||
}
|
||||
|
||||
static Device &create(Genode::Env &env, unsigned irq_num)
|
||||
{
|
||||
Device *d;
|
||||
for (d = list().first(); d; d = d->next())
|
||||
if (d->irq_num == irq_num)
|
||||
return *d;
|
||||
|
||||
d = new (Lx::Malloc::mem()) Device(env, irq_num);
|
||||
list().insert(d);
|
||||
|
||||
return *d;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _ARM__PLATFORM_DEVICE__PLATFORM_DEVICE_H_ */
|
@ -0,0 +1,6 @@
|
||||
REQUIRES = arm_64
|
||||
|
||||
include $(REP_DIR)/src/drivers/nic/fec/target.inc
|
||||
|
||||
# lx_kit
|
||||
INC_DIR += $(REP_DIR)/src/include/spec/arm_64
|
@ -0,0 +1,7 @@
|
||||
REQUIRES = arm_v7
|
||||
|
||||
include $(REP_DIR)/src/drivers/nic/fec/target.inc
|
||||
|
||||
# lx_kit
|
||||
INC_DIR += $(REP_DIR)/src/include/spec/arm
|
||||
INC_DIR += $(REP_DIR)/src/include/spec/arm_v7
|
@ -1,17 +1,12 @@
|
||||
REQUIRES = arm_v7
|
||||
|
||||
TARGET = fec_nic_drv
|
||||
LIBS = base lx_kit_setjmp fec_nic_include
|
||||
SRC_CC = main.cc platform.cc lx_emul.cc component.cc
|
||||
SRC_C += dummy.c lxc.c
|
||||
INC_DIR += $(PRG_DIR)
|
||||
INC_DIR += $(PRG_DIR)/../..
|
||||
|
||||
# lx_kit
|
||||
SRC_CC += env.cc irq.cc malloc.cc scheduler.cc timer.cc work.cc printf.cc
|
||||
INC_DIR += $(REP_DIR)/src/include
|
||||
INC_DIR += $(REP_DIR)/src/include/spec/arm
|
||||
INC_DIR += $(REP_DIR)/src/include/spec/arm_v7
|
||||
INC_DIR += $(REP_DIR)/src/drivers/usb/include/spec/arm
|
||||
|
||||
# contrib code
|
||||
LX_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/drivers/nic/fec
|
||||
@ -45,7 +40,8 @@ vpath %.c $(LX_CONTRIB_DIR)/drivers/net/ethernet/freescale
|
||||
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/phy
|
||||
vpath %.c $(LX_CONTRIB_DIR)/net/core
|
||||
vpath %.c $(LX_CONTRIB_DIR)/net/ethernet
|
||||
vpath %.cc $(PRG_DIR)
|
||||
vpath %.c $(PRG_DIR)/../..
|
||||
vpath %.cc $(PRG_DIR)/../..
|
||||
vpath %.cc $(REP_DIR)/src/lx_kit
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* \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_ */
|
108
repos/dde_linux/src/lx_kit/spec/arm_64/setjmp.S
Normal file
108
repos/dde_linux/src/lx_kit/spec/arm_64/setjmp.S
Normal file
@ -0,0 +1,108 @@
|
||||
/*-
|
||||
* 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)
|
Loading…
Reference in New Issue
Block a user