From eb9eda393f6416d97b1107e1fb34a535f31f8ce9 Mon Sep 17 00:00:00 2001 From: Amneesh Singh Date: Mon, 23 Sep 2024 12:31:54 +0530 Subject: [PATCH] kernel/freertos: add support for Xen - portable/portASM.s: add linux zImage kernel header for Xen - dpl/common: print to Xen/PV console when Xen is enabled Signed-off-by: Amneesh Singh --- .../freertos/dpl/common/DebugP_freertos.c | 11 ++++++++++ .../freertos/portable/GCC/ARM_CA53/portASM.S | 21 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/source/kernel/freertos/dpl/common/DebugP_freertos.c b/source/kernel/freertos/dpl/common/DebugP_freertos.c index b51674eea..02d2223e8 100755 --- a/source/kernel/freertos/dpl/common/DebugP_freertos.c +++ b/source/kernel/freertos/dpl/common/DebugP_freertos.c @@ -34,6 +34,9 @@ #include #include #include +#ifdef XEN_ENABLED +#include +#endif int32_t _DebugP_log(char *format, ...); extern uint32_t gDebugLogZone; @@ -62,7 +65,11 @@ void _DebugP_logZone(uint32_t logZone, char *format, ...) SemaphoreP_pend(&gDebugLogLockObj, SystemP_WAIT_FOREVER); va_start(va, format); +#ifdef XEN_ENABLED + Xen_printk(format, va); +#else vprintf_(format, va); +#endif va_end(va); SemaphoreP_post(&gDebugLogLockObj); } @@ -89,7 +96,11 @@ int32_t _DebugP_log(char *format, ...) SemaphoreP_pend(&gDebugLogLockObj, SystemP_WAIT_FOREVER); va_start(va, format); +#ifdef XEN_ENABLED + Xen_printk(format, va); +#else vprintf_(format, va); +#endif va_end(va); SemaphoreP_post(&gDebugLogLockObj); } diff --git a/source/kernel/freertos/portable/GCC/ARM_CA53/portASM.S b/source/kernel/freertos/portable/GCC/ARM_CA53/portASM.S index fddd7a6ae..a5cbdd0c8 100644 --- a/source/kernel/freertos/portable/GCC/ARM_CA53/portASM.S +++ b/source/kernel/freertos/portable/GCC/ARM_CA53/portASM.S @@ -68,6 +68,8 @@ .extern ullCriticalNesting .extern ullPortYieldRequired + .global gnu_targets_arm_rtsv8A_startupAsm + .global HwiP_IRQ_Handler .global HwiP_SVC_Handler .global vPortRestoreTaskContext @@ -281,6 +283,25 @@ .align 11 HwiP_gicv3Vectors: +#ifdef XEN_ENABLED + /* Xen requires the 64 bit linux kernel header */ + + ldr x16, =gnu_targets_arm_rtsv8A_startupAsm /* Executable code */ + br x16 /* Executable code */ + + .dword 0 /* Image load offset, little endian */ + .dword 0 /* Effective Image size, little endian */ + .dword 8 /* kernel flags, little endian */ + + .dword 0 /* reserved */ + .dword 0 /* resrerved */ + .dword 0 /* reserved */ + + .dword 0x644d5241 /* Magic number, little endian, "ARM\x64" */ + .dword 0 /* reserved (used for PE COFF offset) */ + +#endif + /* ************************************************************************* * Exception from currentEL, using SP0