mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
parent
081b878bbd
commit
c049aed44f
@ -44,12 +44,18 @@ ifeq ($(filter-out $(SPECS),x86_32),)
|
||||
LX_ARCH := x86
|
||||
GEN_ARCH := x86
|
||||
SPEC_ARCH := x86_32
|
||||
|
||||
# temporarily add the following include path for x86 platform_session wrapper
|
||||
INC_DIR += $(DDE_LINUX_DIR)/src/include/spec/x86/lx_kit
|
||||
endif
|
||||
|
||||
ifeq ($(filter-out $(SPECS),x86_64),)
|
||||
LX_ARCH := x86
|
||||
GEN_ARCH := x86
|
||||
SPEC_ARCH := x86_64
|
||||
|
||||
# temporarily add the following include path for x86 platform_session wrapper
|
||||
INC_DIR += $(DDE_LINUX_DIR)/src/include/spec/x86/lx_kit
|
||||
endif
|
||||
|
||||
ifeq ($(filter-out $(SPECS),arm),)
|
||||
@ -70,20 +76,17 @@ else
|
||||
TARGET_SOURCE_LIST := $(PRG_DIR)/source.list
|
||||
endif
|
||||
|
||||
SHADOW_INC_DIR := $(DDE_LINUX_DIR)/src/include/lx_emul/shadow
|
||||
GEN_SHADOW_INC_DIR := $(DDE_LINUX_DIR)/src/include/spec/$(GEN_ARCH)/lx_emul/shadow
|
||||
SPEC_SHADOW_INC_DIR := $(DDE_LINUX_DIR)/src/include/spec/$(SPEC_ARCH)/lx_emul/shadow
|
||||
SHADOW_INC_DIR := $(DDE_LINUX_DIR)/src/include/lx_emul/shadow/include
|
||||
SPEC_SHADOW_INC_DIR := $(DDE_LINUX_DIR)/src/include/lx_emul/shadow/arch/$(LX_ARCH)/include
|
||||
|
||||
SRC_C += lx_emul/spec/$(GEN_ARCH)/irqchip.c
|
||||
SRC_C += lx_emul/spec/$(GEN_ARCH)/start.c
|
||||
SRC_S += lx_kit/spec/$(SPEC_ARCH)/setjmp.S
|
||||
|
||||
INC_DIR += $(DDE_LINUX_DIR)/src/include/spec/$(GEN_ARCH)/lx_kit
|
||||
INC_DIR += $(DDE_LINUX_DIR)/src/include/spec/$(SPEC_ARCH)
|
||||
INC_DIR += $(DDE_LINUX_DIR)/src/include/spec/x86
|
||||
INC_DIR += $(DDE_LINUX_DIR)/src/include
|
||||
INC_DIR += $(SPEC_SHADOW_INC_DIR)
|
||||
INC_DIR += $(GEN_SHADOW_INC_DIR)
|
||||
INC_DIR += $(SHADOW_INC_DIR)
|
||||
|
||||
vpath % $(DDE_LINUX_DIR)/src/lib
|
||||
@ -186,9 +189,6 @@ gen_crc32table: $(LX_SRC_DIR)/lib/gen_crc32table.c
|
||||
GLOBAL_DEPS += $(wildcard $(addsuffix /linux/*.h,$(SHADOW_INC_DIR))) \
|
||||
$(wildcard $(addsuffix /asm/*.h,$(SHADOW_INC_DIR)))
|
||||
|
||||
GLOBAL_DEPS += $(wildcard $(addsuffix /linux/*.h,$(GEN_SHADOW_INC_DIR))) \
|
||||
$(wildcard $(addsuffix /asm/*.h,$(GEN_SHADOW_INC_DIR)))
|
||||
|
||||
GLOBAL_DEPS += $(wildcard $(addsuffix /linux/*.h,$(SPEC_SHADOW_INC_DIR))) \
|
||||
$(wildcard $(addsuffix /asm/*.h,$(SPEC_SHADOW_INC_DIR)))
|
||||
|
||||
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* \brief Shadows Linux kernel arch/arm/include/asm/spinlock.h
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2021-03-16
|
||||
*
|
||||
* We run single-core, cooperatively scheduled. We should never spin.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_SPINLOCK_H
|
||||
#define __ASM_SPINLOCK_H
|
||||
|
||||
#include <linux/prefetch.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#include <lx_emul/debug.h>
|
||||
|
||||
|
||||
static inline int arch_spin_is_locked(arch_spinlock_t *lock)
|
||||
{
|
||||
return (atomic_read(&lock->slock)) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_spin_lock(arch_spinlock_t *lock)
|
||||
{
|
||||
if (arch_spin_is_locked(lock)) {
|
||||
printk("Error: spinlock contention!");
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
atomic_set(&lock->slock, 1);
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_spin_unlock(arch_spinlock_t *lock)
|
||||
{
|
||||
atomic_set(&lock->slock, 0);
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_spin_trylock(arch_spinlock_t *lock)
|
||||
{
|
||||
if (arch_spin_is_locked(lock))
|
||||
return 0;
|
||||
|
||||
arch_spin_lock(lock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_write_trylock(arch_rwlock_t *rw)
|
||||
{
|
||||
if (rw->lock)
|
||||
return 0;
|
||||
|
||||
rw->lock = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_write_lock(arch_rwlock_t *rw)
|
||||
{
|
||||
if (rw->lock) {
|
||||
printk("Error: rwlock contention!");
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
rw->lock = 1;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_write_unlock(arch_rwlock_t *rw)
|
||||
{
|
||||
rw->lock = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_read_lock(arch_rwlock_t *rw)
|
||||
{
|
||||
arch_write_lock(rw);
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_read_unlock(arch_rwlock_t *rw)
|
||||
{
|
||||
arch_write_unlock(rw);
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_read_trylock(arch_rwlock_t *rw)
|
||||
{
|
||||
return arch_write_trylock(rw);
|
||||
}
|
||||
|
||||
|
||||
#endif /* __ASM_SPINLOCK_H */
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* \brief Shadows Linux kernel arch/arm/include/asm/spinlock.h
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2021-03-16
|
||||
*
|
||||
* We run single-core, cooperatively scheduled. We should never spin.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_SPINLOCK_H
|
||||
#define __ASM_SPINLOCK_H
|
||||
|
||||
#include <linux/prefetch.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#include <lx_emul/debug.h>
|
||||
|
||||
|
||||
static inline int arch_spin_is_locked(arch_spinlock_t *lock)
|
||||
{
|
||||
return (atomic_read(&lock->val)) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_spin_lock(arch_spinlock_t *lock)
|
||||
{
|
||||
if (arch_spin_is_locked(lock)) {
|
||||
printk("Error: spinlock contention!");
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
atomic_set(&lock->val, 1);
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_spin_unlock(arch_spinlock_t *lock)
|
||||
{
|
||||
atomic_set(&lock->val, 0);
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_spin_trylock(arch_spinlock_t *lock)
|
||||
{
|
||||
if (arch_spin_is_locked(lock))
|
||||
return 0;
|
||||
|
||||
arch_spin_lock(lock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_write_trylock(arch_rwlock_t *rw)
|
||||
{
|
||||
if (rw->wlocked)
|
||||
return 0;
|
||||
|
||||
rw->wlocked = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_write_lock(arch_rwlock_t *rw)
|
||||
{
|
||||
if (rw->wlocked) {
|
||||
printk("Error: rwlock contention!");
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
rw->wlocked = 1;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_write_unlock(arch_rwlock_t *rw)
|
||||
{
|
||||
rw->wlocked = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_read_lock(arch_rwlock_t *rw)
|
||||
{
|
||||
arch_write_lock(rw);
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_read_unlock(arch_rwlock_t *rw)
|
||||
{
|
||||
arch_write_unlock(rw);
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_read_trylock(arch_rwlock_t *rw)
|
||||
{
|
||||
return arch_write_trylock(rw);
|
||||
}
|
||||
|
||||
|
||||
#endif /* __ASM_SPINLOCK_H */
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* \brief Shadows Linux kernel arch/arm/include/asm/spinlock.h
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2021-03-16
|
||||
*
|
||||
* We run single-core, cooperatively scheduled. We should never spin.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_SPINLOCK_H
|
||||
#define __ASM_SPINLOCK_H
|
||||
|
||||
#include <linux/prefetch.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#include <lx_emul/debug.h>
|
||||
|
||||
|
||||
static inline int arch_spin_is_locked(arch_spinlock_t *lock)
|
||||
{
|
||||
return (atomic_read(&lock->val)) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_spin_lock(arch_spinlock_t *lock)
|
||||
{
|
||||
if (arch_spin_is_locked(lock)) {
|
||||
printk("Error: spinlock contention!");
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
atomic_set(&lock->val, 1);
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_spin_unlock(arch_spinlock_t *lock)
|
||||
{
|
||||
atomic_set(&lock->val, 0);
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_spin_trylock(arch_spinlock_t *lock)
|
||||
{
|
||||
if (arch_spin_is_locked(lock))
|
||||
return 0;
|
||||
|
||||
arch_spin_lock(lock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_write_trylock(arch_rwlock_t *rw)
|
||||
{
|
||||
if (rw->wlocked)
|
||||
return 0;
|
||||
|
||||
rw->wlocked = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_write_lock(arch_rwlock_t *rw)
|
||||
{
|
||||
if (rw->wlocked) {
|
||||
printk("Error: rwlock contention!");
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
rw->wlocked = 1;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_write_unlock(arch_rwlock_t *rw)
|
||||
{
|
||||
rw->wlocked = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_read_lock(arch_rwlock_t *rw)
|
||||
{
|
||||
arch_write_lock(rw);
|
||||
}
|
||||
|
||||
|
||||
static inline void arch_read_unlock(arch_rwlock_t *rw)
|
||||
{
|
||||
arch_write_unlock(rw);
|
||||
}
|
||||
|
||||
|
||||
static inline int arch_read_trylock(arch_rwlock_t *rw)
|
||||
{
|
||||
return arch_write_trylock(rw);
|
||||
}
|
||||
|
||||
|
||||
#endif /* __ASM_SPINLOCK_H */
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* \brief Architecture-specific accessors to spinlock types for lx_emul
|
||||
* \author Johannes Schlatow
|
||||
* \date 2022-04-04
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _LX_EMUL__ARCH_SPINLOCK_H_
|
||||
#define _LX_EMUL__ARCH_SPINLOCK_H_
|
||||
|
||||
#define SPINLOCK_VALUE_PTR(lock) (atomic_t*)&lock->raw_lock.slock
|
||||
#define RWLOCK_VALUE(lock) lock->raw_lock.lock
|
||||
|
||||
#endif /*_LX_EMUL__ARCH_SPINLOCK_H_ */
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* \brief Architecture-specific accessors to spinlock types for lx_emul
|
||||
* \author Johannes Schlatow
|
||||
* \date 2022-04-04
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _LX_EMUL__ARCH_SPINLOCK_H_
|
||||
#define _LX_EMUL__ARCH_SPINLOCK_H_
|
||||
|
||||
#define SPINLOCK_VALUE_PTR(lock) &lock->raw_lock.val
|
||||
#define RWLOCK_VALUE(lock) lock->raw_lock.wlocked
|
||||
|
||||
#endif /*_LX_EMUL__ARCH_SPINLOCK_H_ */
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* \brief Architecture-specific accessors to spinlock types for lx_emul
|
||||
* \author Johannes Schlatow
|
||||
* \date 2022-04-04
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _LX_EMUL__ARCH_SPINLOCK_H_
|
||||
#define _LX_EMUL__ARCH_SPINLOCK_H_
|
||||
|
||||
#define SPINLOCK_VALUE_PTR(lock) &lock->raw_lock.val
|
||||
#define RWLOCK_VALUE(lock) lock->raw_lock.wlocked
|
||||
|
||||
#endif /*_LX_EMUL__ARCH_SPINLOCK_H_ */
|
@ -15,19 +15,15 @@
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/rwlock_api_smp.h>
|
||||
#include <asm/spinlock.h>
|
||||
|
||||
#include <lx_emul/debug.h>
|
||||
#include <lx_emul/task.h>
|
||||
|
||||
#include <lx_emul/arch_spinlock.h>
|
||||
|
||||
void __lockfunc _raw_spin_lock(raw_spinlock_t * lock)
|
||||
{
|
||||
if (atomic_read(SPINLOCK_VALUE_PTR(lock))) {
|
||||
printk("Error: spinlock contention!");
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
atomic_set(SPINLOCK_VALUE_PTR(lock), 1);
|
||||
arch_spin_lock(&lock->raw_lock);
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +38,7 @@ unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t * lock)
|
||||
|
||||
void __lockfunc _raw_spin_unlock(raw_spinlock_t * lock)
|
||||
{
|
||||
atomic_set(SPINLOCK_VALUE_PTR(lock), 0);
|
||||
arch_spin_unlock(&lock->raw_lock);
|
||||
}
|
||||
|
||||
|
||||
@ -68,26 +64,17 @@ void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t * lock)
|
||||
|
||||
int __lockfunc _raw_spin_trylock(raw_spinlock_t * lock)
|
||||
{
|
||||
|
||||
if (atomic_read(SPINLOCK_VALUE_PTR(lock)))
|
||||
return 0;
|
||||
|
||||
_raw_spin_lock(lock);
|
||||
return 1;
|
||||
return arch_spin_trylock(&lock->raw_lock);
|
||||
}
|
||||
|
||||
|
||||
void __lockfunc _raw_write_lock(rwlock_t * lock)
|
||||
{
|
||||
if (RWLOCK_VALUE(lock)) {
|
||||
printk("Error: rwlock contention!");
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
RWLOCK_VALUE(lock) = 1;
|
||||
arch_write_lock(&(lock)->raw_lock);
|
||||
}
|
||||
|
||||
|
||||
void __lockfunc _raw_write_unlock(rwlock_t * lock)
|
||||
{
|
||||
RWLOCK_VALUE(lock) = 0;
|
||||
arch_write_unlock(&(lock)->raw_lock);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <lx_emul.h>
|
||||
#include <lx_emul/io_mem.h>
|
||||
#include <lx_emul/page_virt.h>
|
||||
|
||||
#include <linux/dma-fence.h>
|
||||
#include <linux/fs.h>
|
||||
|
Loading…
Reference in New Issue
Block a user