diff --git a/repos/dde_linux/lib/import/import-lx_emul_common.inc b/repos/dde_linux/lib/import/import-lx_emul_common.inc index 0bf6618429..3b1c409389 100644 --- a/repos/dde_linux/lib/import/import-lx_emul_common.inc +++ b/repos/dde_linux/lib/import/import-lx_emul_common.inc @@ -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))) diff --git a/repos/dde_linux/src/include/spec/arm/lx_emul/shadow/asm/irqflags.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/irqflags.h similarity index 100% rename from repos/dde_linux/src/include/spec/arm/lx_emul/shadow/asm/irqflags.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/irqflags.h diff --git a/repos/dde_linux/src/include/spec/arm/lx_emul/shadow/asm/memory.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/memory.h similarity index 100% rename from repos/dde_linux/src/include/spec/arm/lx_emul/shadow/asm/memory.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/memory.h diff --git a/repos/dde_linux/src/include/spec/arm/lx_emul/shadow/asm/page.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/page.h similarity index 100% rename from repos/dde_linux/src/include/spec/arm/lx_emul/shadow/asm/page.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/page.h diff --git a/repos/dde_linux/src/include/spec/arm/lx_emul/shadow/asm/pgtable.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/pgtable.h similarity index 100% rename from repos/dde_linux/src/include/spec/arm/lx_emul/shadow/asm/pgtable.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/pgtable.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/spinlock.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/asm/spinlock.h new file mode 100644 index 0000000000..df4a4339a4 --- /dev/null +++ b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm/include/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 +#include +#include + +#include + + +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 */ diff --git a/repos/dde_linux/src/include/spec/arm_64/lx_emul/shadow/asm/irqflags.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/irqflags.h similarity index 100% rename from repos/dde_linux/src/include/spec/arm_64/lx_emul/shadow/asm/irqflags.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/irqflags.h diff --git a/repos/dde_linux/src/include/spec/arm_64/lx_emul/shadow/asm/memory.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/memory.h similarity index 100% rename from repos/dde_linux/src/include/spec/arm_64/lx_emul/shadow/asm/memory.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/memory.h diff --git a/repos/dde_linux/src/include/spec/arm_64/lx_emul/shadow/asm/page.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/page.h similarity index 100% rename from repos/dde_linux/src/include/spec/arm_64/lx_emul/shadow/asm/page.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/page.h diff --git a/repos/dde_linux/src/include/spec/arm_64/lx_emul/shadow/asm/pgtable.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/pgtable.h similarity index 100% rename from repos/dde_linux/src/include/spec/arm_64/lx_emul/shadow/asm/pgtable.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/pgtable.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/spinlock.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/asm/spinlock.h new file mode 100644 index 0000000000..67ab77d23f --- /dev/null +++ b/repos/dde_linux/src/include/lx_emul/shadow/arch/arm64/include/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 +#include +#include + +#include + + +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 */ diff --git a/repos/dde_linux/src/include/spec/x86_32/lx_emul/shadow/asm/atomic64_32.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/atomic64_32.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86_32/lx_emul/shadow/asm/atomic64_32.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/atomic64_32.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/cpufeature.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/cpufeature.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/cpufeature.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/cpufeature.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/debugreg.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/debugreg.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/debugreg.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/debugreg.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/io.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/io.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/io.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/io.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/irqflags.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/irqflags.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/irqflags.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/irqflags.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/memory_model.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/memory_model.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/memory_model.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/memory_model.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/page.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/page.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/page.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/page.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/page_64.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/page_64.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/page_64.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/page_64.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/pgtable.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/pgtable.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/pgtable.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/pgtable.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/sections.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/sections.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/sections.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/sections.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/special_insns.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/special_insns.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/special_insns.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/special_insns.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/spinlock.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/spinlock.h new file mode 100644 index 0000000000..67ab77d23f --- /dev/null +++ b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/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 +#include +#include + +#include + + +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 */ diff --git a/repos/dde_linux/src/include/spec/x86_32/lx_emul/shadow/asm/string_32.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/string_32.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86_32/lx_emul/shadow/asm/string_32.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/string_32.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/switch_to.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/switch_to.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/switch_to.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/switch_to.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/sync_core.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/sync_core.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/sync_core.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/sync_core.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/uaccess.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/uaccess.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/uaccess.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/uaccess.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/uaccess_32.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/uaccess_32.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/uaccess_32.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/uaccess_32.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/uaccess_64.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/uaccess_64.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/asm/uaccess_64.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/asm/uaccess_64.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/linux/pci.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/linux/pci.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/linux/pci.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/linux/pci.h diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/shadow/linux/swapops.h b/repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/linux/swapops.h similarity index 100% rename from repos/dde_linux/src/include/spec/x86/lx_emul/shadow/linux/swapops.h rename to repos/dde_linux/src/include/lx_emul/shadow/arch/x86/include/linux/swapops.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/asm/bug.h b/repos/dde_linux/src/include/lx_emul/shadow/include/asm/bug.h similarity index 100% rename from repos/dde_linux/src/include/lx_emul/shadow/asm/bug.h rename to repos/dde_linux/src/include/lx_emul/shadow/include/asm/bug.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/asm/current.h b/repos/dde_linux/src/include/lx_emul/shadow/include/asm/current.h similarity index 100% rename from repos/dde_linux/src/include/lx_emul/shadow/asm/current.h rename to repos/dde_linux/src/include/lx_emul/shadow/include/asm/current.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/asm/percpu.h b/repos/dde_linux/src/include/lx_emul/shadow/include/asm/percpu.h similarity index 100% rename from repos/dde_linux/src/include/lx_emul/shadow/asm/percpu.h rename to repos/dde_linux/src/include/lx_emul/shadow/include/asm/percpu.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/linux/compiler-gcc.h b/repos/dde_linux/src/include/lx_emul/shadow/include/linux/compiler-gcc.h similarity index 100% rename from repos/dde_linux/src/include/lx_emul/shadow/linux/compiler-gcc.h rename to repos/dde_linux/src/include/lx_emul/shadow/include/linux/compiler-gcc.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/linux/init.h b/repos/dde_linux/src/include/lx_emul/shadow/include/linux/init.h similarity index 100% rename from repos/dde_linux/src/include/lx_emul/shadow/linux/init.h rename to repos/dde_linux/src/include/lx_emul/shadow/include/linux/init.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/linux/of.h b/repos/dde_linux/src/include/lx_emul/shadow/include/linux/of.h similarity index 100% rename from repos/dde_linux/src/include/lx_emul/shadow/linux/of.h rename to repos/dde_linux/src/include/lx_emul/shadow/include/linux/of.h diff --git a/repos/dde_linux/src/include/lx_emul/shadow/linux/pgtable.h b/repos/dde_linux/src/include/lx_emul/shadow/include/linux/pgtable.h similarity index 100% rename from repos/dde_linux/src/include/lx_emul/shadow/linux/pgtable.h rename to repos/dde_linux/src/include/lx_emul/shadow/include/linux/pgtable.h diff --git a/repos/dde_linux/src/include/spec/arm/lx_emul/arch_spinlock.h b/repos/dde_linux/src/include/spec/arm/lx_emul/arch_spinlock.h deleted file mode 100644 index 746db770e9..0000000000 --- a/repos/dde_linux/src/include/spec/arm/lx_emul/arch_spinlock.h +++ /dev/null @@ -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_ */ diff --git a/repos/dde_linux/src/include/spec/arm_64/lx_emul/arch_spinlock.h b/repos/dde_linux/src/include/spec/arm_64/lx_emul/arch_spinlock.h deleted file mode 100644 index eacf850362..0000000000 --- a/repos/dde_linux/src/include/spec/arm_64/lx_emul/arch_spinlock.h +++ /dev/null @@ -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_ */ diff --git a/repos/dde_linux/src/include/spec/x86/lx_emul/arch_spinlock.h b/repos/dde_linux/src/include/spec/x86/lx_emul/arch_spinlock.h deleted file mode 100644 index eacf850362..0000000000 --- a/repos/dde_linux/src/include/spec/x86/lx_emul/arch_spinlock.h +++ /dev/null @@ -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_ */ diff --git a/repos/dde_linux/src/lib/lx_emul/shadow/kernel/locking/spinlock.c b/repos/dde_linux/src/lib/lx_emul/shadow/kernel/locking/spinlock.c index 0b3553aef6..2e3104d54c 100644 --- a/repos/dde_linux/src/lib/lx_emul/shadow/kernel/locking/spinlock.c +++ b/repos/dde_linux/src/lib/lx_emul/shadow/kernel/locking/spinlock.c @@ -15,19 +15,15 @@ #include #include +#include #include #include -#include 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); } diff --git a/repos/pc/src/drivers/framebuffer/intel/pc/lx_emul.c b/repos/pc/src/drivers/framebuffer/intel/pc/lx_emul.c index e9752e4cef..afb1f8ec99 100644 --- a/repos/pc/src/drivers/framebuffer/intel/pc/lx_emul.c +++ b/repos/pc/src/drivers/framebuffer/intel/pc/lx_emul.c @@ -13,6 +13,7 @@ #include #include +#include #include #include