feat: aarch64 port - fix build system obstacles, add exception handling, page tables
This commit is contained in:
1 parent
aae4db01ad
commit
8b6379fb7e
19 files changed
+1207
-77
No files matched your search
@@ -37,6 +37,14 @@ namespace Kt {
|
||||
// ANSI escape sequence filter state
|
||||
static bool g_ansiEscape = false;
|
||||
|
||||
static SerialSink g_serialSink = nullptr;
|
||||
|
||||
static void SerialPutchar(char c) {
|
||||
if (g_serialSink == nullptr) return;
|
||||
if (c == '\n') g_serialSink('\r');
|
||||
g_serialSink(c);
|
||||
}
|
||||
|
||||
static void RingBufferAppend(char c) {
|
||||
// Strip ANSI escape sequences
|
||||
if (c == '\033') {
|
||||
@@ -209,17 +217,19 @@ namespace Kt {
|
||||
// framebuffer terminal below; storing it in the ring makes file
|
||||
// consumers treat one logical newline as two line breaks.
|
||||
RingBufferAppend(c);
|
||||
SerialPutchar(c);
|
||||
|
||||
if (g_suppressKernelLog) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Once a graphical app takes over, suppress ALL flanterm writes
|
||||
// (SYS_PRINT from user processes, etc.) to avoid painting text
|
||||
// over the GUI framebuffer.
|
||||
if (g_suppressKernelLog && g_kernelLogDepth == 0) {
|
||||
return;
|
||||
} else {
|
||||
// Once a graphical app takes over, suppress ALL flanterm writes
|
||||
// (SYS_PRINT from user processes, etc.) to avoid painting text
|
||||
// over the GUI framebuffer.
|
||||
if (g_suppressKernelLog) {
|
||||
return;
|
||||
}
|
||||
SerialPutchar(c);
|
||||
}
|
||||
|
||||
if (c == '\n') {
|
||||
@@ -235,6 +245,18 @@ namespace Kt {
|
||||
}
|
||||
}
|
||||
|
||||
void AttachSerialConsole(SerialSink sink) {
|
||||
g_termLock.Acquire();
|
||||
uint64_t start = g_klogCount < KLOG_BUF_SIZE ? 0 : g_klogHead;
|
||||
for (uint64_t i = 0; i < g_klogCount; i++) {
|
||||
char c = g_klogBuf[(start + i) % KLOG_BUF_SIZE];
|
||||
if (c == '\n') sink('\r');
|
||||
sink(c);
|
||||
}
|
||||
g_serialSink = sink;
|
||||
g_termLock.Release();
|
||||
}
|
||||
|
||||
void SuppressKernelLog() {
|
||||
g_suppressKernelLog = true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user