Fiasco.OC: enable SMP for L4Linux

This commit comprises the following changes to enable L4Linux to use several
CPUs:
* change default configuration for x86 and ARM
* add atomic cmpxchg operation to l4re library
* implement l4_sleep (per thread)
* enable setting affinity for VCPUs and IRQs
* move "per CPU" section within linker-script (x86 only)
* introduce SMP run-script for pandaboard
* deactivate direct scheduler (Fiasco.OC syscall) access by L4Linux
This commit is contained in:
Stefan Kalkowski 2012-09-04 13:11:28 +02:00 committed by Norman Feske
parent c63f3c07de
commit 760f37fc86
15 changed files with 884 additions and 321 deletions

View File

@ -8,7 +8,7 @@
#
CONFIG_L4=y
CONFIG_L4_LINUX=y
CONFIG_L4_OBJ_TREE="/open/build/genode/foc_panda/l4"
CONFIG_L4_OBJ_TREE="/home/kalle/pub/builds/genode/foc-panda/l4"
# CONFIG_L4_ARCH_X86 is not set
CONFIG_L4_ARCH_ARM=y
CONFIG_L4_VMLINUZ_SUFFIX=".arm"
@ -18,7 +18,6 @@ CONFIG_PHYSICAL_START=0x0
#
# Features
#
CONFIG_L4_ARM_UPAGE_TLS=y
# CONFIG_L4_SERVER is not set
#
@ -72,10 +71,10 @@ CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_KTIME_SCALAR=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
@ -95,7 +94,6 @@ CONFIG_HAVE_IRQ_WORK=y
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
CONFIG_LOCALVERSION=""
@ -129,9 +127,11 @@ CONFIG_GENERIC_IRQ_SHOW=y
#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
CONFIG_TREE_RCU=y
# CONFIG_PREEMPT_RCU is not set
# CONFIG_RCU_TRACE is not set
CONFIG_RCU_FANOUT=32
# CONFIG_RCU_FANOUT_EXACT is not set
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=15
@ -156,7 +156,7 @@ CONFIG_UID16=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_ALL is not set
# CONFIG_HOTPLUG is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
@ -187,6 +187,7 @@ CONFIG_HAVE_OPROFILE=y
# CONFIG_KPROBES is not set
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_USE_GENERIC_SMP_HELPERS=y
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
CONFIG_HAVE_CLK=y
CONFIG_HAVE_DMA_API_DEBUG=y
@ -203,6 +204,7 @@ CONFIG_MODULES=y
# CONFIG_MODULE_UNLOAD is not set
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_LBDAF=y
# CONFIG_BLK_DEV_BSG is not set
@ -348,8 +350,13 @@ CONFIG_CPU_HAS_PMU=y
# CONFIG_ARM_ERRATA_430973 is not set
# CONFIG_ARM_ERRATA_458693 is not set
# CONFIG_ARM_ERRATA_460075 is not set
# CONFIG_ARM_ERRATA_742230 is not set
# CONFIG_ARM_ERRATA_742231 is not set
# CONFIG_ARM_ERRATA_720789 is not set
# CONFIG_ARM_ERRATA_743622 is not set
# CONFIG_ARM_ERRATA_751472 is not set
# CONFIG_ARM_ERRATA_754322 is not set
# CONFIG_ARM_ERRATA_754327 is not set
CONFIG_DMABOUNCE=y
#
@ -358,6 +365,7 @@ CONFIG_DMABOUNCE=y
CONFIG_ARM_AMBA=y
# CONFIG_PCI_SYSCALL is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
# CONFIG_PCCARD is not set
#
# Kernel Features
@ -365,11 +373,16 @@ CONFIG_ARM_AMBA=y
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
# CONFIG_SMP is not set
CONFIG_SMP=y
CONFIG_SMP_ON_UP=y
CONFIG_HAVE_ARM_SCU=y
CONFIG_VMSPLIT_3G=y
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_1G is not set
CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_NR_CPUS=4
CONFIG_HOTPLUG_CPU=y
# CONFIG_LOCAL_TIMERS is not set
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
@ -394,7 +407,6 @@ CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
# CONFIG_KSM is not set
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_NEED_PER_CPU_KM=y
# CONFIG_CLEANCACHE is not set
CONFIG_FORCE_MAX_ZONEORDER=11
CONFIG_ALIGNMENT_TRAP=y
@ -448,6 +460,7 @@ CONFIG_BINFMT_MISC=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
# CONFIG_PM_RUNTIME is not set
CONFIG_PM=y
# CONFIG_PM_DEBUG is not set
@ -517,6 +530,9 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_NET_SCHED is not set
# CONFIG_DCB is not set
# CONFIG_BATMAN_ADV is not set
CONFIG_RPS=y
CONFIG_RFS_ACCEL=y
CONFIG_XPS=y
#
# Network testing
@ -541,6 +557,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
#
# Generic Driver Options
#
CONFIG_UEVENT_HELPER_PATH=""
# CONFIG_DEVTMPFS is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
@ -1027,11 +1045,13 @@ CONFIG_DEBUG_INFO=y
CONFIG_FRAME_POINTER=y
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_RCU_TORTURE_TEST is not set
CONFIG_RCU_CPU_STALL_TIMEOUT=60
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# CONFIG_DEBUG_PER_CPU_MAPS is not set
# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
# CONFIG_FAULT_INJECTION is not set
# CONFIG_LATENCYTOP is not set
CONFIG_SYSCTL_SYSCALL_CHECK=y
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_HAVE_FUNCTION_TRACER=y
@ -1080,6 +1100,7 @@ CONFIG_CRYPTO=y
# CONFIG_CRYPTO_MANAGER2 is not set
# CONFIG_CRYPTO_GF128MUL is not set
# CONFIG_CRYPTO_NULL is not set
# CONFIG_CRYPTO_PCRYPT is not set
# CONFIG_CRYPTO_CRYPTD is not set
# CONFIG_CRYPTO_AUTHENC is not set
# CONFIG_CRYPTO_TEST is not set
@ -1181,5 +1202,6 @@ CONFIG_GENERIC_ALLOCATOR=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CPU_RMAP=y
CONFIG_NLATTR=y
# CONFIG_AVERAGE is not set

View File

@ -8,7 +8,7 @@
#
CONFIG_L4=y
CONFIG_L4_LINUX=y
CONFIG_L4_OBJ_TREE=""
CONFIG_L4_OBJ_TREE="/home/kalle/pub/builds/genode/foc_x86_32/l4"
CONFIG_L4_ARCH_X86=y
# CONFIG_L4_ARCH_ARM is not set
CONFIG_L4_VMLINUZ_SUFFIX=""
@ -78,6 +78,7 @@ CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
@ -109,8 +110,12 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
# CONFIG_AUDIT_ARCH is not set
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_X86_32_SMP=y
CONFIG_X86_HT=y
CONFIG_X86_32_LAZY_GS=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-ecx -fcall-saved-edx"
CONFIG_KTIME_SCALAR=y
CONFIG_ARCH_CPU_PROBE_RELEASE=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_HAVE_IRQ_WORK=y
CONFIG_IRQ_WORK=y
@ -119,7 +124,6 @@ CONFIG_IRQ_WORK=y
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
CONFIG_LOCALVERSION=""
@ -140,14 +144,10 @@ CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
# CONFIG_FHANDLE is not set
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_FHANDLE=y
# CONFIG_TASKSTATS is not set
CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_WATCH=y
CONFIG_AUDIT_TREE=y
# CONFIG_AUDIT is not set
CONFIG_HAVE_GENERIC_HARDIRQS=y
#
@ -157,15 +157,18 @@ CONFIG_GENERIC_HARDIRQS=y
CONFIG_HAVE_SPARSE_IRQ=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_IRQ_FORCED_THREADING=y
# CONFIG_SPARSE_IRQ is not set
#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
CONFIG_TREE_RCU=y
# CONFIG_PREEMPT_RCU is not set
# CONFIG_RCU_TRACE is not set
CONFIG_RCU_FANOUT=32
# CONFIG_RCU_FANOUT_EXACT is not set
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=17
@ -173,8 +176,9 @@ CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
# CONFIG_CGROUPS is not set
# CONFIG_NAMESPACES is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
# CONFIG_RELAY is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
@ -210,13 +214,12 @@ CONFIG_HAVE_PERF_EVENTS=y
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
CONFIG_PERF_COUNTERS=y
# CONFIG_PERF_COUNTERS is not set
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
# CONFIG_VM_EVENT_COUNTERS is not set
# CONFIG_SLUB_DEBUG is not set
# CONFIG_COMPAT_BRK is not set
# CONFIG_SLAB is not set
CONFIG_SLUB=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_COMPAT_BRK=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
# CONFIG_PROFILING is not set
CONFIG_HAVE_OPROFILE=y
@ -229,6 +232,7 @@ CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_OPTPROBES=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_ATTRS=y
CONFIG_USE_GENERIC_SMP_HELPERS=y
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
CONFIG_HAVE_DMA_API_DEBUG=y
CONFIG_HAVE_HW_BREAKPOINT=y
@ -242,6 +246,7 @@ CONFIG_HAVE_ARCH_JUMP_LABEL=y
#
# CONFIG_GCOV_KERNEL is not set
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
@ -249,6 +254,7 @@ CONFIG_MODULES=y
# CONFIG_MODULE_UNLOAD is not set
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
# CONFIG_LBDAF is not set
CONFIG_BLK_DEV_BSG=y
@ -292,7 +298,7 @@ CONFIG_INLINE_WRITE_UNLOCK=y
# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
# CONFIG_MUTEX_SPIN_ON_OWNER is not set
CONFIG_MUTEX_SPIN_ON_OWNER=y
# CONFIG_FREEZER is not set
#
@ -301,10 +307,14 @@ CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
# CONFIG_SMP is not set
# CONFIG_X86_EXTENDED_PLATFORM is not set
CONFIG_SMP=y
CONFIG_X86_MPPARSE=y
# CONFIG_X86_BIGSMP is not set
CONFIG_X86_EXTENDED_PLATFORM=y
# CONFIG_X86_RDC321X is not set
# CONFIG_X86_32_NON_STANDARD is not set
# CONFIG_X86_32_IRIS is not set
# CONFIG_SCHED_OMIT_FRAME_POINTER is not set
CONFIG_SCHED_OMIT_FRAME_POINTER=y
# CONFIG_PARAVIRT_GUEST is not set
CONFIG_NO_BOOTMEM=y
# CONFIG_MEMTEST is not set
@ -333,18 +343,17 @@ CONFIG_M686=y
# CONFIG_MVIAC7 is not set
# CONFIG_MCORE2 is not set
# CONFIG_MATOM is not set
CONFIG_X86_GENERIC=y
CONFIG_X86_INTERNODE_CACHE_SHIFT=6
# CONFIG_X86_GENERIC is not set
CONFIG_X86_INTERNODE_CACHE_SHIFT=5
CONFIG_X86_CMPXCHG=y
CONFIG_CMPXCHG_LOCAL=y
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_L1_CACHE_SHIFT=5
CONFIG_X86_XADD=y
# CONFIG_X86_PPRO_FENCE is not set
CONFIG_X86_PPRO_FENCE=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_TSC=y
CONFIG_X86_CMPXCHG64=y
@ -362,12 +371,16 @@ CONFIG_CPU_SUP_UMC_32=y
# CONFIG_DMI is not set
# CONFIG_IOMMU_HELPER is not set
# CONFIG_IOMMU_API is not set
CONFIG_NR_CPUS=1
CONFIG_NR_CPUS=8
# CONFIG_SCHED_SMT is not set
CONFIG_SCHED_MC=y
# CONFIG_IRQ_TIME_ACCOUNTING is not set
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
# CONFIG_X86_UP_APIC is not set
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set
# CONFIG_X86_MCE is not set
# CONFIG_VM86 is not set
# CONFIG_TOSHIBA is not set
@ -409,14 +422,13 @@ CONFIG_VIRT_TO_BUS=y
# CONFIG_KSM is not set
CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
# CONFIG_TRANSPARENT_HUGEPAGE is not set
CONFIG_NEED_PER_CPU_KM=y
# CONFIG_CLEANCACHE is not set
# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set
CONFIG_X86_RESERVE_LOW=64
# CONFIG_MATH_EMULATION is not set
# CONFIG_MTRR is not set
CONFIG_SECCOMP=y
CONFIG_CC_STACKPROTECTOR=y
# CONFIG_CC_STACKPROTECTOR is not set
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
@ -425,7 +437,8 @@ CONFIG_HZ_250=y
# CONFIG_KEXEC is not set
# CONFIG_RELOCATABLE is not set
CONFIG_PHYSICAL_ALIGN=0x100000
# CONFIG_COMPAT_VDSO is not set
CONFIG_HOTPLUG_CPU=y
CONFIG_COMPAT_VDSO=y
# CONFIG_CMDLINE_BOOL is not set
#
@ -502,7 +515,6 @@ CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
# CONFIG_IPV6 is not set
# CONFIG_NETLABEL is not set
# CONFIG_NETWORK_SECMARK is not set
# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
# CONFIG_NETFILTER is not set
@ -526,8 +538,10 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_IEEE802154 is not set
# CONFIG_NET_SCHED is not set
# CONFIG_DCB is not set
# CONFIG_DNS_RESOLVER is not set
# CONFIG_BATMAN_ADV is not set
CONFIG_RPS=y
CONFIG_RFS_ACCEL=y
CONFIG_XPS=y
#
# Network testing
@ -996,8 +1010,9 @@ CONFIG_EXT2_FS=y
# CONFIG_BTRFS_FS is not set
# CONFIG_NILFS2_FS is not set
CONFIG_FS_POSIX_ACL=y
CONFIG_EXPORTFS=y
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
# CONFIG_FSNOTIFY is not set
# CONFIG_DNOTIFY is not set
# CONFIG_INOTIFY_USER is not set
# CONFIG_FANOTIFY is not set
@ -1076,7 +1091,7 @@ CONFIG_SCHED_DEBUG=y
CONFIG_SCHEDSTATS=y
CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_SLUB_STATS is not set
# CONFIG_DEBUG_SLAB is not set
# CONFIG_DEBUG_KMEMLEAK is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
@ -1107,10 +1122,13 @@ CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_RCU_TORTURE_TEST is not set
CONFIG_RCU_CPU_STALL_TIMEOUT=60
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# CONFIG_DEBUG_PER_CPU_MAPS is not set
# CONFIG_LKDTM is not set
# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
# CONFIG_FAULT_INJECTION is not set
CONFIG_LATENCYTOP=y
CONFIG_SYSCTL_SYSCALL_CHECK=y
@ -1164,23 +1182,12 @@ CONFIG_OPTIMIZE_INLINING=y
#
# Security options
#
CONFIG_KEYS=y
# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
# CONFIG_KEYS is not set
# CONFIG_SECURITY_DMESG_RESTRICT is not set
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
# CONFIG_SECURITY_NETWORK_XFRM is not set
CONFIG_SECURITY_PATH=y
# CONFIG_SECURITY_SELINUX is not set
CONFIG_SECURITY_TOMOYO=y
CONFIG_SECURITY_APPARMOR=y
CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE=1
# CONFIG_IMA is not set
# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
CONFIG_DEFAULT_SECURITY_APPARMOR=y
# CONFIG_DEFAULT_SECURITY_DAC is not set
CONFIG_DEFAULT_SECURITY="apparmor"
# CONFIG_SECURITY is not set
# CONFIG_SECURITYFS is not set
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_DEFAULT_SECURITY=""
CONFIG_CRYPTO=y
#
@ -1203,6 +1210,7 @@ CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
CONFIG_CRYPTO_GF128MUL=m
CONFIG_CRYPTO_NULL=m
# CONFIG_CRYPTO_PCRYPT is not set
CONFIG_CRYPTO_WORKQUEUE=y
CONFIG_CRYPTO_CRYPTD=m
CONFIG_CRYPTO_AUTHENC=m
@ -1312,7 +1320,6 @@ CONFIG_CRC_ITU_T=y
CONFIG_CRC32=y
CONFIG_CRC7=y
CONFIG_LIBCRC32C=y
CONFIG_AUDIT_GENERIC=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=m
CONFIG_LZO_COMPRESS=m
@ -1323,5 +1330,6 @@ CONFIG_DECOMPRESS_GZIP=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CPU_RMAP=y
CONFIG_NLATTR=y
# CONFIG_AVERAGE is not set

View File

@ -14,4 +14,18 @@
#ifndef _L4__UTIL__ATOMIC_H_
#define _L4__UTIL__ATOMIC_H_
#include <l4/sys/compiler.h>
#include <l4/sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
L4_CV int l4util_cmpxchg(volatile l4_umword_t * dest,
l4_umword_t cmp_val, l4_umword_t new_val);
#ifdef __cplusplus
}
#endif
#endif /* _L4__UTIL__ATOMIC_H_ */

View File

@ -17,6 +17,7 @@ SRC_CC += env.cc \
l4_re_c_rm.cc \
l4_re_c_util_cap.cc \
l4_re_env.cc \
l4_util_atomic.cc \
l4_util_cpu.cc \
l4_util_kip.cc \
l4_util_util.cc \

View File

@ -171,6 +171,18 @@ index a5711ea..db5d812 100644
+#define L4_EXTERNAL_FUNC(func) ;
#endif /* __INCLUDE__ASM_L4__GENERIC__L4LIB_H__ */
diff --git a/arch/l4/include/asm/l4lxapi/thread.h b/arch/l4/include/asm/l4lxapi/thread.h
index db02c8c..0f75ba9 100644
--- a/arch/l4/include/asm/l4lxapi/thread.h
+++ b/arch/l4/include/asm/l4lxapi/thread.h
@@ -15,6 +15,7 @@
* \ingroup l4lxapi
*/
+void l4lx_thread_alloc_irq(l4_cap_idx_t c);
/**
* \brief Initialize thread handling.
diff --git a/arch/l4/kernel/arch-arm/traps.c b/arch/l4/kernel/arch-arm/traps.c
index d6a3b4f..a44f5eb 100644
--- a/arch/l4/kernel/arch-arm/traps.c
@ -349,7 +361,7 @@ index 169f257..4e25408 100644
/* L4: Add NOTES so that .note.gnu.build-id is caught, because we do
diff --git a/arch/l4/kernel/arch-x86/vmlinux.lds.S b/arch/l4/kernel/arch-x86/vmlinux.lds.S
index 42ee2bc..1bbf018 100644
index 42ee2bc..2e1e1db 100644
--- a/arch/l4/kernel/arch-x86/vmlinux.lds.S
+++ b/arch/l4/kernel/arch-x86/vmlinux.lds.S
@@ -33,7 +33,7 @@ OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT)
@ -413,7 +425,7 @@ index 42ee2bc..1bbf018 100644
/* bootstrapping code */
HEAD_TEXT
#ifdef CONFIG_X86_32
@@ -112,14 +128,28 @@ SECTIONS
@@ -112,19 +128,55 @@ SECTIONS
ENTRY_TEXT
IRQENTRY_TEXT
*(.fixup)
@ -445,7 +457,34 @@ index 42ee2bc..1bbf018 100644
#if defined(CONFIG_DEBUG_RODATA)
/* .text should occupy whole number of pages */
@@ -152,9 +182,33 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
#endif
+
+ /*
+ * because in Genode we collect all data.* entries in the data section
+ * we have to put the per_cpu section before defining the data section
+ * otherwise it's symbols would end up in the data section too.
+ */
+#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
+ PERCPU_SECTION(INTERNODE_CACHE_BYTES)
+#endif
+
+ /*
+ * smp_locks might be freed after init
+ * start/end must be page aligned
+ */
+ . = ALIGN(PAGE_SIZE);
+ .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
+ __smp_locks = .;
+ *(.smp_locks)
+ . = ALIGN(PAGE_SIZE);
+ __smp_locks_end = .;
+ }
+
X64_ALIGN_DEBUG_RODATA_BEGIN
RO_DATA(PAGE_SIZE)
X64_ALIGN_DEBUG_RODATA_END
@@ -152,9 +204,33 @@ SECTIONS
/* rarely changed data like cpu maps */
READ_MOSTLY_DATA(INTERNODE_CACHE_BYTES)
@ -480,7 +519,37 @@ index 42ee2bc..1bbf018 100644
#ifdef CONFIG_X86_64
@@ -366,6 +420,7 @@ SECTIONS
@@ -331,10 +407,6 @@ SECTIONS
EXIT_DATA
}
-#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
- PERCPU_SECTION(INTERNODE_CACHE_BYTES)
-#endif
-
. = ALIGN(PAGE_SIZE);
/* freed after init ends here */
@@ -342,18 +414,6 @@ SECTIONS
__init_end = .;
}
- /*
- * smp_locks might be freed after init
- * start/end must be page aligned
- */
- . = ALIGN(PAGE_SIZE);
- .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
- __smp_locks = .;
- *(.smp_locks)
- . = ALIGN(PAGE_SIZE);
- __smp_locks_end = .;
- }
-
#ifdef CONFIG_X86_64
.data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
NOSAVE_DATA
@@ -366,6 +426,7 @@ SECTIONS
__bss_start = .;
*(.bss..page_aligned)
*(.bss)
@ -488,7 +557,7 @@ index 42ee2bc..1bbf018 100644
. = ALIGN(PAGE_SIZE);
__bss_stop = .;
}
@@ -378,6 +433,7 @@ SECTIONS
@@ -378,6 +439,7 @@ SECTIONS
__brk_limit = .;
}
@ -555,7 +624,7 @@ index 302d211..8a8e96c 100644
.p2align 12
ENTRY(swapper_pg_dir)
diff --git a/arch/l4/kernel/main.c b/arch/l4/kernel/main.c
index d71a2b9..e1deb9b 100644
index d71a2b9..59c512c 100644
--- a/arch/l4/kernel/main.c
+++ b/arch/l4/kernel/main.c
@@ -305,7 +305,7 @@ static void l4x_configuration_sanity_check(const char *cmdline)
@ -567,20 +636,34 @@ index d71a2b9..e1deb9b 100644
if (strstr(cmdline, "console=ttyLv")) {
LOG_printf("Console output set to ttyLvx but driver not compiled in.\n");
enter_kdebug("L4 serial driver not enabled");
@@ -363,6 +363,12 @@ static void l4x_virt_to_phys_show(void)
@@ -363,6 +363,26 @@ static void l4x_virt_to_phys_show(void)
}
}
+static spinlock_t migrate_lock;
+
+void l4x_irq_save(unsigned long flags) { local_irq_save(flags); }
+void l4x_irq_restore(unsigned long flags) { local_irq_restore(flags); }
+unsigned long l4x_hz(void) { return HZ; }
+int l4x_nr_irqs(void) { return NR_IRQS; }
+void l4x_migrate_lock(unsigned long flags) { spin_lock_irqsave(&migrate_lock, flags); }
+void l4x_migrate_unlock(unsigned long flags) { spin_unlock_irqrestore(&migrate_lock, fla
+
+unsigned l4x_target_cpu(const struct cpumask *dest)
+{
+ if (!cpumask_intersects(dest, cpu_online_mask))
+ return (unsigned) -1;
+ return cpumask_any_and(dest, cpu_online_mask);
+}
+
+void l4x_cpumask_copy(struct irq_data *data, const struct cpumask *dest) {
+ cpumask_copy(data->affinity, dest); }
+
+
unsigned long l4x_virt_to_phys(volatile void * address)
{
int i;
@@ -375,14 +381,14 @@ unsigned long l4x_virt_to_phys(volatile void * address)
@@ -375,14 +395,14 @@ unsigned long l4x_virt_to_phys(volatile void * address)
+ l4x_phys_virt_addrs[i].phys;
}
@ -598,7 +681,7 @@ index d71a2b9..e1deb9b 100644
return __pa(address);
}
@@ -414,7 +420,7 @@ void *l4x_phys_to_virt(unsigned long address)
@@ -414,7 +434,7 @@ void *l4x_phys_to_virt(unsigned long address)
/* Debugging check: don't miss a translation, can give nasty
* DMA problems */
@ -607,7 +690,7 @@ index d71a2b9..e1deb9b 100644
__func__, address);
WARN_ON(1);
@@ -532,7 +538,7 @@ int l4x_re_resolve_name(const char *name, l4_cap_idx_t *cap)
@@ -532,7 +552,7 @@ int l4x_re_resolve_name(const char *name, l4_cap_idx_t *cap)
r = l4re_ns_query_srv(entry->cap, n + 1, *cap);
if (r) {
@ -616,7 +699,7 @@ index d71a2b9..e1deb9b 100644
name, l4sys_errtostr(r), r);
L4XV_U(f);
return -ENOENT;
@@ -713,6 +719,7 @@ static const int at_exit_nr_of_functions
@@ -713,6 +733,7 @@ static const int at_exit_nr_of_functions
= sizeof(at_exit_functions) / sizeof(at_exit_functions[0]);
static int __current_exititem;
@ -624,7 +707,7 @@ index d71a2b9..e1deb9b 100644
static struct cxa_atexit_item *__next_atexit(void)
{
if (__current_exititem >= at_exit_nr_of_functions) {
@@ -721,20 +728,9 @@ static struct cxa_atexit_item *__next_atexit(void)
@@ -721,20 +742,9 @@ static struct cxa_atexit_item *__next_atexit(void)
}
return &at_exit_functions[__current_exititem++];
}
@ -647,7 +730,7 @@ index d71a2b9..e1deb9b 100644
void __cxa_finalize(void *dso_handle)
{
@@ -790,9 +786,19 @@ static inline int l4x_is_writable_area(unsigned long a)
@@ -790,9 +800,19 @@ static inline int l4x_is_writable_area(unsigned long a)
}
static int l4x_forward_pf(l4_umword_t addr, l4_umword_t pc, int extra_write)
{
@ -667,7 +750,7 @@ index d71a2b9..e1deb9b 100644
do {
l4_msg_regs_t *mr = l4_utcb_mr_u(u);
@@ -815,6 +821,7 @@ static int l4x_forward_pf(l4_umword_t addr, l4_umword_t pc, int extra_write)
@@ -815,6 +835,7 @@ static int l4x_forward_pf(l4_umword_t addr, l4_umword_t pc, int extra_write)
// unresolvable page fault, we're supposed to trigger an
// exception
return 0;
@ -675,7 +758,7 @@ index d71a2b9..e1deb9b 100644
return 1;
}
@@ -1054,7 +1061,7 @@ static void l4x_register_pointer_section(void *p_in_addr,
@@ -1054,7 +1075,7 @@ static void l4x_register_pointer_section(void *p_in_addr,
addr = (l4_addr_t)p_in_addr;
size = 1;
if (l4re_rm_find(&addr, &size, &off, &flags, &ds)) {
@ -684,7 +767,7 @@ index d71a2b9..e1deb9b 100644
l4re_rm_show_lists();
enter_kdebug("l4re_rm_find failed");
return;
@@ -1254,7 +1261,7 @@ void __init l4x_setup_memory(char *cmdl,
@@ -1254,7 +1275,7 @@ void __init l4x_setup_memory(char *cmdl,
0, "Main memory");
/* Reserve some part of the virtual address space for vmalloc */
@ -693,7 +776,7 @@ index d71a2b9..e1deb9b 100644
if (l4re_rm_reserve_area(&l4x_vmalloc_memory_start,
#ifdef CONFIG_X86_32
__VMALLOC_RESERVE,
@@ -1381,6 +1388,10 @@ unsigned long l4x_get_isa_dma_memory_end(void)
@@ -1381,6 +1402,10 @@ unsigned long l4x_get_isa_dma_memory_end(void)
static void l4x_create_ugate(l4_cap_idx_t forthread, unsigned cpu)
{
@ -704,7 +787,7 @@ index d71a2b9..e1deb9b 100644
l4_msgtag_t r;
l4x_user_gate[cpu] = l4x_cap_alloc();
@@ -1401,6 +1412,7 @@ static void l4x_create_ugate(l4_cap_idx_t forthread, unsigned cpu)
@@ -1401,6 +1426,7 @@ static void l4x_create_ugate(l4_cap_idx_t forthread, unsigned cpu)
l4_debugger_set_object_name(l4x_user_gate[cpu], n);
#endif
}
@ -712,7 +795,23 @@ index d71a2b9..e1deb9b 100644
}
#ifdef CONFIG_HOTPLUG_CPU
@@ -1890,11 +1902,11 @@ static inline void l4x_repnop_init(void) {}
@@ -1607,11 +1633,15 @@ void l4x_cpu_ipi_setup(unsigned cpu)
l4x_exit_l4linux();
}
+#if 0
t = l4_factory_create_irq(l4re_env()->factory, c);
if (l4_error(t)) {
LOG_printf("Failed to create IRQ\n");
l4x_exit_l4linux();
}
+#else
+ l4lx_thread_alloc_irq(c);
+#endif
#ifdef CONFIG_L4_DEBUG_REGISTER_NAMES
l4_debugger_set_object_name(c, s);
@@ -1890,11 +1920,11 @@ static inline void l4x_repnop_init(void) {}
static int l4x_cpu_virt_phys_map_init(const char *boot_command_line)
{
@ -726,7 +825,27 @@ index d71a2b9..e1deb9b 100644
char overbooking = 0;
char *p;
@@ -1964,6 +1976,8 @@ static int l4x_cpu_virt_phys_map_init(const char *boot_command_line)
@@ -1907,9 +1937,10 @@ static int l4x_cpu_virt_phys_map_init(const char *boot_command_line)
}
}
-
+#if 0
if (l4_error(l4_scheduler_info(l4re_env()->scheduler,
&max_cpus, &cs)) == L4_EOK) {
+#endif
if ((p = strstr(boot_command_line, "l4x_cpus_map="))) {
// l4x_cpus_map=0,1,2,3,4,...
// the list specifies the physical CPU for each
@@ -1958,12 +1989,16 @@ static int l4x_cpu_virt_phys_map_init(const char *boot_command_line)
l4x_nr_cpus = v;
}
+#if 0
}
+#endif
#ifndef CONFIG_L4_VCPU
l4x_tamed_set_mapping(0, l4x_cpu_physmap_get_id(0));
#endif
#else /* UP */
@ -735,7 +854,7 @@ index d71a2b9..e1deb9b 100644
if (l4_error(l4_scheduler_info(l4re_env()->scheduler,
&max_cpus, &cs)) == L4_EOK) {
@@ -1973,6 +1987,8 @@ static int l4x_cpu_virt_phys_map_init(const char *boot_command_line)
@@ -1973,6 +2008,8 @@ static int l4x_cpu_virt_phys_map_init(const char *boot_command_line)
l4x_cpu_physmap[0].phys_id = p;
}
#endif
@ -744,7 +863,7 @@ index d71a2b9..e1deb9b 100644
LOG_printf("CPU mapping (l:p)[%d]: ", l4x_nr_cpus);
for (i = 0; i < l4x_nr_cpus; i++)
@@ -2018,6 +2034,7 @@ static long l4x_blink(int state)
@@ -2018,6 +2055,7 @@ static long l4x_blink(int state)
printk("panic: going to sleep forever, bye\n");
L4XV_L(f);
LOG_printf("panic: going to sleep forever, bye\n");
@ -752,7 +871,7 @@ index d71a2b9..e1deb9b 100644
l4_sleep_forever();
return 0;
}
@@ -2298,7 +2315,7 @@ static void l4x_scan_hw_resources(void)
@@ -2298,7 +2336,7 @@ static void l4x_scan_hw_resources(void)
}
}
@ -761,7 +880,7 @@ index d71a2b9..e1deb9b 100644
{
l4lx_thread_t main_id;
extern char _end[];
@@ -2410,10 +2427,13 @@ int __init_refok L4_CV main(int argc, char **argv)
@@ -2410,10 +2448,13 @@ int __init_refok L4_CV main(int argc, char **argv)
l4x_start_thread_id = l4re_env()->main_thread;
@ -775,7 +894,7 @@ index d71a2b9..e1deb9b 100644
#ifndef CONFIG_L4_VCPU
#ifdef CONFIG_L4_TAMED
@@ -3180,6 +3200,10 @@ static inline int l4x_handle_pagefault(unsigned long pfa, unsigned long ip,
@@ -3180,6 +3221,10 @@ static inline int l4x_handle_pagefault(unsigned long pfa, unsigned long ip,
/* Not resolvable: Ooops */
LOG_printf("Non-resolvable page fault at %lx, ip %lx.\n", pfa, ip);
// will trigger an oops in caller
@ -786,7 +905,7 @@ index d71a2b9..e1deb9b 100644
return 0;
}
@@ -3560,7 +3584,9 @@ module_init(l4x_power_mgmt_init);
@@ -3560,7 +3605,9 @@ module_init(l4x_power_mgmt_init);
void exit(int code)
{
__cxa_finalize(0);

View File

@ -1,27 +1,3 @@
Index: arch/l4/Kconfig
===================================================================
--- arch/l4/Kconfig (revision 23)
+++ arch/l4/Kconfig (working copy)
@@ -394,7 +394,19 @@
config L4_USE_L4SHMC
bool
+config SCREEN_GENODE
+ bool
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ default y
+config SERIAL_GENODE
+ bool
+ default y
+ select SERIAL_CORE
+ select SERIAL_CORE_CONSOLE
+
# some delimiter (for .config)
comment ""
source "arch/l4/Kconfig.arch"
Index: arch/l4/kernel/dispatch.c
===================================================================
--- arch/l4/kernel/dispatch.c (revision 23)
@ -44,168 +20,6 @@ Index: arch/l4/kernel/dispatch.c
}
}
}
Index: arch/l4/kernel/arch-x86/vmlinux.lds.S
===================================================================
--- arch/l4/kernel/arch-x86/vmlinux.lds.S (revision 23)
+++ arch/l4/kernel/arch-x86/vmlinux.lds.S (working copy)
@@ -33,7 +33,7 @@
#ifdef CONFIG_X86_32
OUTPUT_ARCH(i386)
-ENTRY(phys_startup_32)
+ENTRY(_start)
jiffies = jiffies_64;
#else
OUTPUT_ARCH(i386:x86-64)
@@ -67,17 +67,10 @@
#endif
-PHDRS {
- text PT_LOAD FLAGS(5); /* R_E */
- data PT_LOAD FLAGS(6); /* RW_ */
-#ifdef CONFIG_X86_64
- user PT_LOAD FLAGS(5); /* R_E */
-#ifdef CONFIG_SMP
- percpu PT_LOAD FLAGS(6); /* RW_ */
-#endif
- init PT_LOAD FLAGS(7); /* RWE */
-#endif
- note PT_NOTE FLAGS(0); /* ___ */
+PHDRS
+{
+ ro PT_LOAD;
+ rw PT_LOAD;
}
SECTIONS
@@ -97,6 +90,29 @@
/*_stext = .;*/
.text : AT(ADDR(.text) - LOAD_OFFSET) {
_text = .;
+ _prog_img_beg = .;
+
+ /*
+ * Leave space for parent capability parameters at start of data
+ * section. The protection domain creator is reponsible for storing
+ * sane values here.
+ */
+ _parent_cap = .;
+ _parent_cap_thread_id = .;
+ LONG(0xffffffff);
+ _parent_cap_local_name = .;
+ LONG(0xffffffff);
+
+ /*
+ * Platform-specific entry for Fiasco.OC.
+ *
+ * PIC-code compiled for Fiasco.OC, needs some PIC-compatible
+ * way to enter the kernel, the fixed address of the kernel
+ * entry code address needs to be found here.
+ */
+ __l4sys_invoke_indirect = .;
+ LONG(0xeacff000);
+
/* bootstrapping code */
HEAD_TEXT
#ifdef CONFIG_X86_32
@@ -112,14 +128,28 @@
ENTRY_TEXT
IRQENTRY_TEXT
*(.fixup)
+ *(.text.*) /* put all Genode .text entries in here */
*(.gnu.warning)
+
+ . = ALIGN(0x08);
+
+ _ctors_start = .;
+ KEEP (*(.ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.init_array)) /* list of constructors specific for ARM eabi */
+ _ctors_end = .;
+ _dtors_start = .;
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ _dtors_end = .;
+
/* End of text section */
_etext = .;
- } :text = 0x9090
+ } : rw
- NOTES :text :note
+ NOTES :rw
- EXCEPTION_TABLE(16) :text = 0x9090
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
#if defined(CONFIG_DEBUG_RODATA)
/* .text should occupy whole number of pages */
@@ -152,10 +182,34 @@
/* rarely changed data like cpu maps */
READ_MOSTLY_DATA(INTERNODE_CACHE_BYTES)
+ *(.data.*) /* put all Genode .data entries in here */
+
+
/* End of data section */
_edata = .;
- } :data
+ } : rw
+ EXCEPTION_TABLE(16) : rw
+
+ /* exception frames for C++ */
+ .eh_frame : {
+ __eh_frame_start__ = .;
+ KEEP (*(.eh_frame))
+ LONG(0)
+ } : rw
+
+ .init_array : {
+ __init_array_start = .;
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ __init_array_end = .;
+ }
+
+ .gcc_except_table : {
+ KEEP(*(.gcc_except_table))
+ KEEP(*(.gcc_except_table.*))
+ }
+
#ifdef CONFIG_X86_64
#ifdef CONFIG_L4
@@ -366,6 +420,7 @@
__bss_start = .;
*(.bss..page_aligned)
*(.bss)
+ *(.bss.*) /* put all Genode .bss entries in here */
. = ALIGN(PAGE_SIZE);
__bss_stop = .;
}
@@ -378,6 +433,7 @@
__brk_limit = .;
}
+ _prog_img_end = .;
_end = .;
STABS_DEBUG
Index: arch/l4/kernel/arch-x86/x86_init.c
===================================================================
--- arch/l4/kernel/arch-x86/x86_init.c (revision 23)
+++ arch/l4/kernel/arch-x86/x86_init.c (working copy)
@@ -38,7 +38,7 @@
struct x86_init_ops x86_init __initdata = {
.resources = {
- .probe_roms = probe_roms,
+ .probe_roms = x86_init_noop,
.reserve_resources = reserve_standard_io_resources,
.memory_setup = l4x_memory_setup,
},
Index: arch/l4/kernel/arch-arm/dispatch.c
===================================================================
--- arch/l4/kernel/arch-arm/dispatch.c (revision 23)
@ -397,6 +211,225 @@ Index: arch/l4/kernel/arch-arm/traps.c
}
#endif
Index: arch/l4/kernel/arch-x86/x86_init.c
===================================================================
--- arch/l4/kernel/arch-x86/x86_init.c (revision 23)
+++ arch/l4/kernel/arch-x86/x86_init.c (working copy)
@@ -38,7 +38,7 @@
struct x86_init_ops x86_init __initdata = {
.resources = {
- .probe_roms = probe_roms,
+ .probe_roms = x86_init_noop,
.reserve_resources = reserve_standard_io_resources,
.memory_setup = l4x_memory_setup,
},
Index: arch/l4/kernel/arch-x86/vmlinux.lds.S
===================================================================
--- arch/l4/kernel/arch-x86/vmlinux.lds.S (revision 23)
+++ arch/l4/kernel/arch-x86/vmlinux.lds.S (working copy)
@@ -33,7 +33,7 @@
#ifdef CONFIG_X86_32
OUTPUT_ARCH(i386)
-ENTRY(phys_startup_32)
+ENTRY(_start)
jiffies = jiffies_64;
#else
OUTPUT_ARCH(i386:x86-64)
@@ -67,17 +67,10 @@
#endif
-PHDRS {
- text PT_LOAD FLAGS(5); /* R_E */
- data PT_LOAD FLAGS(6); /* RW_ */
-#ifdef CONFIG_X86_64
- user PT_LOAD FLAGS(5); /* R_E */
-#ifdef CONFIG_SMP
- percpu PT_LOAD FLAGS(6); /* RW_ */
-#endif
- init PT_LOAD FLAGS(7); /* RWE */
-#endif
- note PT_NOTE FLAGS(0); /* ___ */
+PHDRS
+{
+ ro PT_LOAD;
+ rw PT_LOAD;
}
SECTIONS
@@ -97,6 +90,29 @@
/*_stext = .;*/
.text : AT(ADDR(.text) - LOAD_OFFSET) {
_text = .;
+ _prog_img_beg = .;
+
+ /*
+ * Leave space for parent capability parameters at start of data
+ * section. The protection domain creator is reponsible for storing
+ * sane values here.
+ */
+ _parent_cap = .;
+ _parent_cap_thread_id = .;
+ LONG(0xffffffff);
+ _parent_cap_local_name = .;
+ LONG(0xffffffff);
+
+ /*
+ * Platform-specific entry for Fiasco.OC.
+ *
+ * PIC-code compiled for Fiasco.OC, needs some PIC-compatible
+ * way to enter the kernel, the fixed address of the kernel
+ * entry code address needs to be found here.
+ */
+ __l4sys_invoke_indirect = .;
+ LONG(0xeacff000);
+
/* bootstrapping code */
HEAD_TEXT
#ifdef CONFIG_X86_32
@@ -112,19 +128,55 @@
ENTRY_TEXT
IRQENTRY_TEXT
*(.fixup)
+ *(.text.*) /* put all Genode .text entries in here */
*(.gnu.warning)
+
+ . = ALIGN(0x08);
+
+ _ctors_start = .;
+ KEEP (*(.ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.init_array)) /* list of constructors specific for ARM eabi */
+ _ctors_end = .;
+ _dtors_start = .;
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ _dtors_end = .;
+
/* End of text section */
_etext = .;
- } :text = 0x9090
+ } : rw
- NOTES :text :note
+ NOTES :rw
- EXCEPTION_TABLE(16) :text = 0x9090
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
#if defined(CONFIG_DEBUG_RODATA)
/* .text should occupy whole number of pages */
. = ALIGN(PAGE_SIZE);
#endif
+
+ /*
+ * because in Genode we collect all data.* entries in the data section
+ * we have to put the per_cpu section before defining the data section
+ * otherwise it's symbols would end up in the data section too.
+ */
+#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
+ PERCPU_SECTION(INTERNODE_CACHE_BYTES)
+#endif
+
+ /*
+ * smp_locks might be freed after init
+ * start/end must be page aligned
+ */
+ . = ALIGN(PAGE_SIZE);
+ .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
+ __smp_locks = .;
+ *(.smp_locks)
+ . = ALIGN(PAGE_SIZE);
+ __smp_locks_end = .;
+ }
+
X64_ALIGN_DEBUG_RODATA_BEGIN
RO_DATA(PAGE_SIZE)
X64_ALIGN_DEBUG_RODATA_END
@@ -152,10 +204,34 @@
/* rarely changed data like cpu maps */
READ_MOSTLY_DATA(INTERNODE_CACHE_BYTES)
+ *(.data.*) /* put all Genode .data entries in here */
+
+
/* End of data section */
_edata = .;
- } :data
+ } : rw
+ EXCEPTION_TABLE(16) : rw
+
+ /* exception frames for C++ */
+ .eh_frame : {
+ __eh_frame_start__ = .;
+ KEEP (*(.eh_frame))
+ LONG(0)
+ } : rw
+
+ .init_array : {
+ __init_array_start = .;
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ __init_array_end = .;
+ }
+
+ .gcc_except_table : {
+ KEEP(*(.gcc_except_table))
+ KEEP(*(.gcc_except_table.*))
+ }
+
#ifdef CONFIG_X86_64
#ifdef CONFIG_L4
@@ -331,10 +407,6 @@
EXIT_DATA
}
-#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
- PERCPU_SECTION(INTERNODE_CACHE_BYTES)
-#endif
-
. = ALIGN(PAGE_SIZE);
/* freed after init ends here */
@@ -342,18 +414,6 @@
__init_end = .;
}
- /*
- * smp_locks might be freed after init
- * start/end must be page aligned
- */
- . = ALIGN(PAGE_SIZE);
- .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
- __smp_locks = .;
- *(.smp_locks)
- . = ALIGN(PAGE_SIZE);
- __smp_locks_end = .;
- }
-
#ifdef CONFIG_X86_64
.data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
NOSAVE_DATA
@@ -366,6 +426,7 @@
__bss_start = .;
*(.bss..page_aligned)
*(.bss)
+ *(.bss.*) /* put all Genode .bss entries in here */
. = ALIGN(PAGE_SIZE);
__bss_stop = .;
}
@@ -378,6 +439,7 @@
__brk_limit = .;
}
+ _prog_img_end = .;
_end = .;
STABS_DEBUG
Index: arch/l4/kernel/head.S
===================================================================
--- arch/l4/kernel/head.S (revision 23)
@ -433,19 +466,34 @@ Index: arch/l4/kernel/main.c
if (strstr(cmdline, "console=ttyLv")) {
LOG_printf("Console output set to ttyLvx but driver not compiled in.\n");
enter_kdebug("L4 serial driver not enabled");
@@ -363,6 +363,11 @@
@@ -363,6 +363,26 @@
}
}
+static spinlock_t migrate_lock;
+
+void l4x_irq_save(unsigned long flags) { local_irq_save(flags); }
+void l4x_irq_restore(unsigned long flags) { local_irq_restore(flags); }
+unsigned long l4x_hz(void) { return HZ; }
+int l4x_nr_irqs(void) { return NR_IRQS; }
+void l4x_migrate_lock(unsigned long flags) { spin_lock_irqsave(&migrate_lock, flags); }
+void l4x_migrate_unlock(unsigned long flags) { spin_unlock_irqrestore(&migrate_lock, flags);}
+
+unsigned l4x_target_cpu(const struct cpumask *dest)
+{
+ if (!cpumask_intersects(dest, cpu_online_mask))
+ return (unsigned) -1;
+ return cpumask_any_and(dest, cpu_online_mask);
+}
+
+void l4x_cpumask_copy(struct irq_data *data, const struct cpumask *dest) {
+ cpumask_copy(data->affinity, dest); }
+
+
unsigned long l4x_virt_to_phys(volatile void * address)
{
int i;
@@ -375,14 +380,14 @@
@@ -375,14 +395,14 @@
+ l4x_phys_virt_addrs[i].phys;
}
@ -463,7 +511,7 @@ Index: arch/l4/kernel/main.c
return __pa(address);
}
@@ -414,7 +419,7 @@
@@ -414,7 +434,7 @@
/* Debugging check: don't miss a translation, can give nasty
* DMA problems */
@ -472,7 +520,7 @@ Index: arch/l4/kernel/main.c
__func__, address);
WARN_ON(1);
@@ -532,7 +537,7 @@
@@ -532,7 +552,7 @@
r = l4re_ns_query_srv(entry->cap, n + 1, *cap);
if (r) {
@ -481,7 +529,7 @@ Index: arch/l4/kernel/main.c
name, l4sys_errtostr(r), r);
L4XV_U(f);
return -ENOENT;
@@ -713,6 +718,7 @@
@@ -713,6 +733,7 @@
= sizeof(at_exit_functions) / sizeof(at_exit_functions[0]);
static int __current_exititem;
@ -489,7 +537,7 @@ Index: arch/l4/kernel/main.c
static struct cxa_atexit_item *__next_atexit(void)
{
if (__current_exititem >= at_exit_nr_of_functions) {
@@ -721,21 +727,10 @@
@@ -721,21 +742,10 @@
}
return &at_exit_functions[__current_exititem++];
}
@ -513,7 +561,7 @@ Index: arch/l4/kernel/main.c
void __cxa_finalize(void *dso_handle)
{
register int i = __current_exititem;
@@ -790,10 +785,20 @@
@@ -790,10 +800,20 @@
}
static int l4x_forward_pf(l4_umword_t addr, l4_umword_t pc, int extra_write)
{
@ -534,7 +582,7 @@ Index: arch/l4/kernel/main.c
do {
l4_msg_regs_t *mr = l4_utcb_mr_u(u);
mr->mr[0] = addr | (extra_write ? 2 : 0);
@@ -815,6 +820,7 @@
@@ -815,6 +835,7 @@
// unresolvable page fault, we're supposed to trigger an
// exception
return 0;
@ -542,7 +590,7 @@ Index: arch/l4/kernel/main.c
return 1;
}
@@ -1054,7 +1060,7 @@
@@ -1054,7 +1075,7 @@
addr = (l4_addr_t)p_in_addr;
size = 1;
if (l4re_rm_find(&addr, &size, &off, &flags, &ds)) {
@ -551,7 +599,7 @@ Index: arch/l4/kernel/main.c
l4re_rm_show_lists();
enter_kdebug("l4re_rm_find failed");
return;
@@ -1254,7 +1260,7 @@
@@ -1254,7 +1275,7 @@
0, "Main memory");
/* Reserve some part of the virtual address space for vmalloc */
@ -560,7 +608,7 @@ Index: arch/l4/kernel/main.c
if (l4re_rm_reserve_area(&l4x_vmalloc_memory_start,
#ifdef CONFIG_X86_32
__VMALLOC_RESERVE,
@@ -1381,6 +1387,10 @@
@@ -1381,6 +1402,10 @@
static void l4x_create_ugate(l4_cap_idx_t forthread, unsigned cpu)
{
@ -571,7 +619,7 @@ Index: arch/l4/kernel/main.c
l4_msgtag_t r;
l4x_user_gate[cpu] = l4x_cap_alloc();
@@ -1401,6 +1411,7 @@
@@ -1401,6 +1426,7 @@
l4_debugger_set_object_name(l4x_user_gate[cpu], n);
#endif
}
@ -579,7 +627,23 @@ Index: arch/l4/kernel/main.c
}
#ifdef CONFIG_HOTPLUG_CPU
@@ -1890,8 +1901,10 @@
@@ -1607,11 +1633,15 @@
l4x_exit_l4linux();
}
+#if 0
t = l4_factory_create_irq(l4re_env()->factory, c);
if (l4_error(t)) {
LOG_printf("Failed to create IRQ\n");
l4x_exit_l4linux();
}
+#else
+ l4lx_thread_alloc_irq(c);
+#endif
#ifdef CONFIG_L4_DEBUG_REGISTER_NAMES
l4_debugger_set_object_name(c, s);
@@ -1890,8 +1920,10 @@
static int l4x_cpu_virt_phys_map_init(const char *boot_command_line)
{
@ -590,7 +654,40 @@ Index: arch/l4/kernel/main.c
unsigned i;
#ifdef CONFIG_SMP
@@ -1964,6 +1977,8 @@
@@ -1907,9 +1939,10 @@
}
}
-
+#if 0
if (l4_error(l4_scheduler_info(l4re_env()->scheduler,
&max_cpus, &cs)) == L4_EOK) {
+#endif
if ((p = strstr(boot_command_line, "l4x_cpus_map="))) {
// l4x_cpus_map=0,1,2,3,4,...
// the list specifies the physical CPU for each
@@ -1931,10 +1964,12 @@
LOG_printf("ERROR: Error parsing l4x_cpus_map option\n");
return 1;
}
+#if 0
if (!l4x_cpu_check_pcpu(pcpu, max_cpus)) {
LOG_printf("ERROR: pCPU%d not found\n", pcpu);
return 1;
}
+#endif
l4x_cpu_physmap[l4x_nr_cpus].phys_id = pcpu;
for (i = 0; i < l4x_nr_cpus; ++i)
overbooking |=
@@ -1958,12 +1993,16 @@
l4x_nr_cpus = v;
}
+#if 0
}
+#endif
#ifndef CONFIG_L4_VCPU
l4x_tamed_set_mapping(0, l4x_cpu_physmap_get_id(0));
#endif
#else /* UP */
@ -599,7 +696,7 @@ Index: arch/l4/kernel/main.c
if (l4_error(l4_scheduler_info(l4re_env()->scheduler,
&max_cpus, &cs)) == L4_EOK) {
@@ -1973,6 +1988,8 @@
@@ -1973,6 +2012,8 @@
l4x_cpu_physmap[0].phys_id = p;
}
#endif
@ -608,7 +705,7 @@ Index: arch/l4/kernel/main.c
LOG_printf("CPU mapping (l:p)[%d]: ", l4x_nr_cpus);
for (i = 0; i < l4x_nr_cpus; i++)
@@ -2018,6 +2035,7 @@
@@ -2018,6 +2059,7 @@
printk("panic: going to sleep forever, bye\n");
L4XV_L(f);
LOG_printf("panic: going to sleep forever, bye\n");
@ -616,7 +713,7 @@ Index: arch/l4/kernel/main.c
l4_sleep_forever();
return 0;
}
@@ -2298,7 +2316,7 @@
@@ -2298,7 +2340,7 @@
}
}
@ -625,7 +722,7 @@ Index: arch/l4/kernel/main.c
{
l4lx_thread_t main_id;
extern char _end[];
@@ -2410,10 +2428,13 @@
@@ -2410,10 +2452,13 @@
l4x_start_thread_id = l4re_env()->main_thread;
@ -639,7 +736,7 @@ Index: arch/l4/kernel/main.c
#ifndef CONFIG_L4_VCPU
#ifdef CONFIG_L4_TAMED
@@ -3180,6 +3201,10 @@
@@ -3180,6 +3225,10 @@
/* Not resolvable: Ooops */
LOG_printf("Non-resolvable page fault at %lx, ip %lx.\n", pfa, ip);
// will trigger an oops in caller
@ -650,7 +747,7 @@ Index: arch/l4/kernel/main.c
return 0;
}
@@ -3560,7 +3585,9 @@
@@ -3560,7 +3609,9 @@
void exit(int code)
{
__cxa_finalize(0);
@ -660,6 +757,64 @@ Index: arch/l4/kernel/main.c
LOG_printf("Still alive, going zombie???\n");
l4_sleep_forever();
}
Index: arch/l4/Kconfig
===================================================================
--- arch/l4/Kconfig (revision 23)
+++ arch/l4/Kconfig (working copy)
@@ -394,7 +394,19 @@
config L4_USE_L4SHMC
bool
+config SCREEN_GENODE
+ bool
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ default y
+config SERIAL_GENODE
+ bool
+ default y
+ select SERIAL_CORE
+ select SERIAL_CORE_CONSOLE
+
# some delimiter (for .config)
comment ""
source "arch/l4/Kconfig.arch"
Index: arch/l4/include/asm/generic/l4lib.h
===================================================================
--- arch/l4/include/asm/generic/l4lib.h (revision 23)
+++ arch/l4/include/asm/generic/l4lib.h (working copy)
@@ -3,6 +3,7 @@
#include <linux/stringify.h>
+#if 0
#ifdef ARCH_arm
#define L4_EXTERNAL_FUNC(func) \
asm(".section \".data.l4externals.str\" \n" \
@@ -58,5 +59,8 @@
".previous \n" \
)
#endif
+#endif
+#define L4_EXTERNAL_FUNC(func) ;
+
#endif /* __INCLUDE__ASM_L4__GENERIC__L4LIB_H__ */
Index: arch/l4/include/asm/l4lxapi/thread.h
===================================================================
--- arch/l4/include/asm/l4lxapi/thread.h (revision 23)
+++ arch/l4/include/asm/l4lxapi/thread.h (working copy)
@@ -24,6 +24,8 @@
*/
void l4lx_thread_init(void);
+void l4lx_thread_alloc_irq(l4_cap_idx_t c);
+
/**
* \brief Create a thread.
* \ingroup thread
Index: arch/l4/boot/Makefile
===================================================================
--- arch/l4/boot/Makefile (revision 23)
@ -826,27 +981,6 @@ Index: arch/l4/Makefile
server:
$(Q)$(MAKE) $(build)=arch/l4/server
Index: arch/l4/include/asm/generic/l4lib.h
===================================================================
--- arch/l4/include/asm/generic/l4lib.h (revision 23)
+++ arch/l4/include/asm/generic/l4lib.h (working copy)
@@ -3,6 +3,7 @@
#include <linux/stringify.h>
+#if 0
#ifdef ARCH_arm
#define L4_EXTERNAL_FUNC(func) \
asm(".section \".data.l4externals.str\" \n" \
@@ -58,5 +59,8 @@
".previous \n" \
)
#endif
+#endif
+#define L4_EXTERNAL_FUNC(func) ;
+
#endif /* __INCLUDE__ASM_L4__GENERIC__L4LIB_H__ */
Index: drivers/tty/serial/l4ser.c
===================================================================
--- drivers/tty/serial/l4ser.c (revision 23)

View File

@ -89,7 +89,7 @@ append_if [have_spec lan9118] config {
append config {
<start name="l4linux">
<resource name="RAM" quantum="128M"/>
<config args="mem=64M console=ttyS0 l4x_rd=initrd.gz"/>
<config args="mem=64M console=ttyS0 l4x_rd=initrd.gz l4x_cpus=2 l4x_cpus_map=0,0"/>
</start>
</config>}
@ -122,6 +122,7 @@ build_boot_image [join $boot_modules " "]
# Qemu
#
append qemu_args " -m 128 -nographic "
append qemu_args " -smp 2,cores=2 "
append qemu_args " -serial unix:/tmp/qemu-pipe,server,nowait "
append qemu_args " -serial mon:stdio "
append_if [have_spec x86] qemu_args " -net nic,model=e1000 -net user "

View File

@ -0,0 +1,168 @@
assert_spec foc
assert_spec platform_panda
#
# Build
#
build {
core
init
drivers/timer
drivers/framebuffer
drivers/usb
server/nitpicker
server/nit_fb
server/terminal
server/terminal_log
l4linux
}
create_boot_directory
#
# Config
#
set config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="SIGNAL"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="fb_drv">
<binary name="omap4_fb_drv"/>
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
</start>
<start name="usb_drv">
<resource name="RAM" quantum="10M"/>
<provides>
<service name="Input"/>
<service name="Nic"/>
</provides>
<config>
<hid/>
<nic mac="2e:60:90:0c:4e:01" />
</config>
</start>
<start name="nitpicker">
<resource name="RAM" quantum="2M"/>
<provides><service name="Nitpicker"/></provides>
<route>
<service name="Input"> <child name="usb_drv"/> </service>
<service name="Framebuffer"> <child name="fb_drv"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="linux">
<binary name="nit_fb"/>
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Framebuffer"/>
<service name="Input"/>
</provides>
<config xpos="1" ypos="0" width="510" height="382"/>
</start>
<start name="ttyS0_fb">
<binary name="nit_fb"/>
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Framebuffer"/>
<service name="Input"/>
</provides>
<config xpos="513" ypos="0" width="510" height="758"/>
</start>
<start name="debug_fb">
<binary name="nit_fb"/>
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Framebuffer"/>
<service name="Input"/>
</provides>
<config xpos="1" ypos="385" width="510" height="376"/>
</start>
<start name="debug_term">
<binary name="terminal"/>
<resource name="RAM" quantum="1M"/>
<provides><service name="Terminal"/></provides>
<route>
<service name="Input"> <child name="debug_fb"/> </service>
<service name="Framebuffer"> <child name="debug_fb"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="debug_log">
<binary name="terminal_log" />
<resource name="RAM" quantum="1M"/>
<provides><service name="LOG"/></provides>
<route>
<service name="Terminal"> <child name="debug_term"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="ttyS0">
<binary name="terminal"/>
<resource name="RAM" quantum="1M"/>
<provides><service name="Terminal"/></provides>
<route>
<service name="Input"> <child name="ttyS0_fb"/> </service>
<service name="Framebuffer"> <child name="ttyS0_fb"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="l4linux">
<resource name="RAM" quantum="96M"/>
<config args="mem=54M l4x_rd=initrd.gz l4x_cpus=2 l4x_cpus_map=0,1"/>
<route>
<service name="Input"> <child name="linux"/> </service>
<service name="Framebuffer"> <child name="linux"/> </service>
<service name="LOG"> <child name="debug_log"/> </service>
<service name="Terminal"> <child name="ttyS0"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>}
install_config $config
#
# Boot modules
#
set boot_modules {
core
init
timer
l4linux
initrd.gz
omap4_fb_drv
usb_drv
terminal
terminal_log
nitpicker
nit_fb
}
set uri "https://github.com/downloads/skalk/genode/busybox-initrd-arm-20120710.gz"
if {![file exists bin/initrd.gz]} {
puts "Download initramfs ..."
exec >& /dev/null wget -c -O bin/initrd.gz $uri
}
build_boot_image [join $boot_modules " "]

View File

@ -31,6 +31,7 @@ extern "C" {
FASTCALL Fiasco::l4_cap_idx_t l4x_cpu_thread_get_cap(int cpu);
FASTCALL void l4lx_thread_init(void);
FASTCALL void l4lx_thread_alloc_irq(Fiasco::l4_cap_idx_t c);
FASTCALL l4lx_thread_t l4lx_thread_create(L4_CV void (*thread_func)(void *data),
unsigned cpu_nr,
void *stack_pointer,

View File

@ -24,9 +24,15 @@ extern "C" {
FASTCALL void l4x_irq_save(unsigned long flags);
FASTCALL void l4x_irq_restore(unsigned long flags);
FASTCALL void l4x_migrate_lock(unsigned long flags);
FASTCALL void l4x_migrate_unlock(unsigned long flags);
FASTCALL unsigned long l4x_hz();
FASTCALL int l4x_nr_irqs(void);
FASTCALL unsigned l4x_cpu_physmap_get_id(unsigned);
FASTCALL unsigned l4x_target_cpu(const struct cpumask*);
FASTCALL void l4x_cpumask_copy(struct irq_data*, const struct cpumask*);
#define IRQ_SAFE(x) do { \
unsigned long flags = 0; \
l4x_irq_save(flags); \

View File

@ -20,6 +20,7 @@
#include <base/thread.h>
#include <base/cap_map.h>
#include <foc_cpu_session/connection.h>
#include <timer_session/connection.h>
namespace Fiasco {
#include <l4/sys/utcb.h>
@ -37,6 +38,7 @@ namespace L4lx {
void (*_func)(void *data);
void *_data;
Genode::addr_t _vcpu_state;
Timer::Connection _timer;
static void _startup()
{
@ -103,6 +105,11 @@ namespace L4lx {
}
Fiasco::l4_utcb_t *utcb() { return _context->utcb; };
Timer::Connection* timer() { return &_timer; }
void set_affinity(unsigned i) {
vcpu_connection()->affinity(_thread_cap, i); }
};
}

View File

@ -0,0 +1,30 @@
/*
* \brief L4Re functions needed by L4Linux.
* \author Stefan Kalkowski
* \date 2012-08-31
*/
/*
* Copyright (C) 2012 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#include <cpu/atomic.h>
namespace Fiasco {
#include <l4/util/atomic.h>
}
using namespace Fiasco;
extern "C" {
int l4util_cmpxchg(volatile l4_umword_t * dest,
l4_umword_t cmp_val, l4_umword_t new_val)
{
return Genode::cmpxchg((volatile int*)dest, cmp_val, new_val);
}
}

View File

@ -12,6 +12,7 @@
*/
#include <base/printf.h>
#include <vcpu.h>
namespace Fiasco {
#include <l4/util/util.h>
@ -23,7 +24,13 @@ extern "C" {
void l4_sleep(int ms)
{
PWRN("%s: Not implemented yet!", __func__);
L4lx::Vcpu *vcpu = static_cast<L4lx::Vcpu*>(Genode::Thread_base::myself());
if (vcpu)
vcpu->timer()->msleep(ms);
else {
static Timer::Connection timer;
timer.msleep(ms);
}
}

View File

@ -198,8 +198,45 @@ void l4lx_irq_dev_unmask(struct irq_data *data)
int l4lx_irq_dev_set_affinity(struct irq_data *data,
const struct cpumask *dest, bool force)
{
NOT_IMPLEMENTED;
return 0;
struct l4x_irq_desc_private *p =
(struct l4x_irq_desc_private*) irq_get_chip_data(data->irq);;
if (!p->irq_cap)
return 0;
unsigned target_cpu = l4x_target_cpu(dest);
if ((int)target_cpu == -1)
return 1;
if (target_cpu == p->cpu)
return 0;
unsigned long flags;
l4x_migrate_lock(flags);
{
Linux::Irq_guard guard;
if (l4_error(l4_irq_detach(p->irq_cap)))
PWRN("%02d: Unable to detach from IRQ\n", data->irq);
}
l4x_cpumask_copy(data, dest);
p->cpu = target_cpu;
PDBG("switched irq %d to cpu %d", data->irq, target_cpu);
{
Linux::Irq_guard guard;
l4_msgtag_t ret = l4_irq_attach(p->irq_cap, data->irq << 2,
l4x_cpu_thread_get_cap(p->cpu));
if (l4_error(ret))
PWRN("Attach to irq %lx failed with error %ld!", p->irq_cap, l4_error(ret));
}
if (p->enabled)
l4_irq_unmask(p->irq_cap);
l4x_migrate_unlock(flags);
return 0;
}

View File

@ -92,6 +92,12 @@ void l4lx_thread_name_set(l4_cap_idx_t thread, const char *name)
void l4lx_thread_init(void) { }
void l4lx_thread_alloc_irq(l4_cap_idx_t c)
{
Genode::Native_capability cap = L4lx::vcpu_connection()->alloc_irq();
l4_task_map(L4_BASE_TASK_CAP, L4_BASE_TASK_CAP,
l4_obj_fpage(cap.dst(), 0, L4_FPAGE_RWX), c | L4_ITEM_MAP);
}
l4lx_thread_t l4lx_thread_create(L4_CV void (*thread_func)(void *data),
unsigned cpu_nr,
@ -121,7 +127,9 @@ l4lx_thread_t l4lx_thread_create(L4_CV void (*thread_func)(void *data),
Vcpu *vc = new (Genode::env()->heap()) Vcpu(name, thread_func,
stack_data, 1024 * 64,
(Genode::addr_t)addr);
vcpus[thread_id(vc->utcb())] = vc;
vc->set_affinity(l4x_cpu_physmap_get_id(cpu_nr));
return vc->utcb();
}