Skip to content

Commit

Permalink
kernel/freertos: add support for Xen
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
natto1784 committed Sep 23, 2024
1 parent 922cbfe commit 6602803
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/kernel/freertos/dpl/common/DebugP_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include <kernel/dpl/SemaphoreP.h>
#include <kernel/dpl/HwiP.h>
#include <kernel/nortos/dpl/common/printf.h>
#ifdef XEN_ENABLED
#include <drivers/xen/xen_console.h>
#else

int32_t _DebugP_log(char *format, ...);
extern uint32_t gDebugLogZone;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
21 changes: 21 additions & 0 deletions source/kernel/freertos/portable/GCC/ARM_CA53/portASM.S
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
.extern ullCriticalNesting
.extern ullPortYieldRequired

.global gnu_targets_arm_rtsv8A_startupAsm

.global HwiP_IRQ_Handler
.global HwiP_SVC_Handler
.global vPortRestoreTaskContext
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6602803

Please sign in to comment.