clean up and standardize types across the codebase, unify atomic operations, improve UTF-8 handling throughout the system, remove obsolete input and named queue interfaces, redesign process preparation and creation, tighten IPC and service boundaries, improve error handling and reliability, minor documentation cleanup, fix doom surfaces, fix panic in ini parsing.
This commit is contained in:
1 parent
899225f551
commit
c0ad63c27f
226 files changed
+6562
-4147
No files matched your search
@@ -1,5 +1,6 @@
|
||||
// HAL serial output endpoint. This file owns polling COM1 writes and subscribes serial to HAL text streams.
|
||||
|
||||
#include <ntlite/atomic.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <intrin.h>
|
||||
@@ -17,8 +18,8 @@
|
||||
#define HAL_SERIAL_TIMER_SPIN_CAP 65536u
|
||||
#define HAL_SERIAL_EARLY_SPINS 4096u
|
||||
|
||||
static volatile long gSerialWriteLock;
|
||||
static volatile long gSerialPresent;
|
||||
static volatile int32_t gSerialWriteLock;
|
||||
static volatile int32_t gSerialPresent;
|
||||
|
||||
// Probes the 16550 scratch register without relying on line-status values from an absent port.
|
||||
static bool HalSerialProbeCom1(void) {
|
||||
@@ -69,20 +70,20 @@ static bool HalSerialWriteByte(uint8_t value) {
|
||||
|
||||
// Acquires the normal serial writer lock.
|
||||
static void HalSerialAcquireWriteLock(void) {
|
||||
while (_InterlockedCompareExchange(&gSerialWriteLock, 1, 0) != 0)
|
||||
while (NtlAtomicCompareExchange32(&gSerialWriteLock, 1, 0) != 0)
|
||||
_mm_pause();
|
||||
}
|
||||
|
||||
// Releases the normal serial writer lock.
|
||||
static void HalSerialReleaseWriteLock(void) {
|
||||
_InterlockedExchange(&gSerialWriteLock, 0);
|
||||
NtlAtomicExchange32(&gSerialWriteLock, 0);
|
||||
}
|
||||
|
||||
// Writes one output record through polling COM1.
|
||||
static void HalSerialWriteRecord(void* context, const HAL_OUTPUT_RECORD* record) {
|
||||
(void)context;
|
||||
if (!record || !record->Buffer ||
|
||||
_InterlockedCompareExchange(&gSerialPresent, 0, 0) == 0)
|
||||
NtlAtomicLoad32(&gSerialPresent) == 0)
|
||||
return;
|
||||
|
||||
bool emergency = (record->Flags & HAL_OUTPUT_WRITE_EMERGENCY) != 0;
|
||||
@@ -102,7 +103,7 @@ static void HalSerialWriteRecord(void* context, const HAL_OUTPUT_RECORD* record)
|
||||
}
|
||||
|
||||
if (!responsive)
|
||||
_InterlockedExchange(&gSerialPresent, 0);
|
||||
NtlAtomicExchange32(&gSerialPresent, 0);
|
||||
|
||||
if (!emergency) {
|
||||
HalSerialReleaseWriteLock();
|
||||
|
||||
Reference in new issue
Block a user