add a realtime scheduler class and priority-inheritance mutexes with timeouts and abandonment, add an HDA audio driver and a SYS_AUDIO_* syscall family, flesh out kernel32 with Win32 threads, events, mutexes, critical sections, and condition variables, add SYS_RESUME_THREAD for suspended thread creation, add KeInitializeMemoryTypes to reprogram MTRRs and install a canonical PAT for WB/WC/UC control, rework the display pipeline with a pitched present path and console output flush, bring back disk.vhd with mtools since vvfat fucking sucks, harden AHCI with serialized cache flush, USB mass storage with SCSI sense-data decoding, and xHCI with cleaner DMA teardown, fix the last stray for(;;) in HalStopProcessor to while(true), pile on smoke tests for audio, win32 sync primitives, and thread suspend, implement AHCI timeout, kill readahead since it was desperetaly trying to murder me, fix doom sound x2.
This commit is contained in:
1 parent
8b254f84f4
commit
4add6789ba
177 files changed
+22565
-3070
No files matched your search
@@ -117,19 +117,14 @@ u32_t sys_arch_sem_wait(sys_sem_t* sem, u32_t timeout) {
|
||||
u32_t start = sys_now();
|
||||
|
||||
if (timeout == 0) {
|
||||
KSTATUS st = KeWaitSemaphore((*sem)->Sem);
|
||||
KSTATUS st = KeWaitSemaphore((*sem)->Sem, KE_WAIT_INFINITE);
|
||||
return KSUCCESS(st) ? (u32_t)(sys_now() - start) : SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (KSUCCESS(KeTrySemaphore((*sem)->Sem)))
|
||||
return (u32_t)(sys_now() - start);
|
||||
|
||||
if ((u32_t)(sys_now() - start) >= timeout)
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
|
||||
KeYield();
|
||||
}
|
||||
KSTATUS status = KeWaitSemaphore((*sem)->Sem, timeout);
|
||||
return KSUCCESS(status)
|
||||
? (u32_t)(sys_now() - start)
|
||||
: SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
|
||||
// Implements the sys sem free operation.
|
||||
@@ -165,7 +160,7 @@ err_t sys_mutex_new(sys_mutex_t* mutex) {
|
||||
// Implements the sys mutex lock operation.
|
||||
void sys_mutex_lock(sys_mutex_t* mutex) {
|
||||
if (mutex && *mutex && (*mutex)->Sem)
|
||||
(void)KeWaitSemaphore((*mutex)->Sem);
|
||||
(void)KeWaitSemaphore((*mutex)->Sem, KE_WAIT_INFINITE);
|
||||
}
|
||||
|
||||
// Implements the sys mutex unlock operation.
|
||||
@@ -279,28 +274,23 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t* mbox, void** msg, u32_t timeout) {
|
||||
u32_t start = sys_now();
|
||||
|
||||
if (timeout == 0) {
|
||||
KSTATUS st = KeWaitSemaphore((*mbox)->Items);
|
||||
KSTATUS st = KeWaitSemaphore((*mbox)->Items, KE_WAIT_INFINITE);
|
||||
if (!KSUCCESS(st))
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
return LwipMboxPopAfterItem(mbox, msg, (u32_t)(sys_now() - start));
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (KSUCCESS(KeTrySemaphore((*mbox)->Items)))
|
||||
return LwipMboxPopAfterItem(mbox, msg, (u32_t)(sys_now() - start));
|
||||
|
||||
if ((u32_t)(sys_now() - start) >= timeout)
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
|
||||
KeYield();
|
||||
}
|
||||
KSTATUS status = KeWaitSemaphore((*mbox)->Items, timeout);
|
||||
if (!KSUCCESS(status))
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
return LwipMboxPopAfterItem(mbox, msg, (u32_t)(sys_now() - start));
|
||||
}
|
||||
|
||||
u32_t sys_arch_mbox_tryfetch(sys_mbox_t* mbox, void** msg) {
|
||||
if (!mbox || !*mbox || !(*mbox)->Valid)
|
||||
return SYS_MBOX_EMPTY;
|
||||
|
||||
if (!KSUCCESS(KeTrySemaphore((*mbox)->Items)))
|
||||
if (!KSUCCESS(KeWaitSemaphore((*mbox)->Items, 0)))
|
||||
return SYS_MBOX_EMPTY;
|
||||
|
||||
return LwipMboxPopAfterItem(mbox, msg, 0);
|
||||
@@ -347,9 +337,10 @@ sys_thread_t sys_thread_new(const char* name, lwip_thread_fn thread, void* arg,
|
||||
// function pointer that lwIP supplied, with exactly the argument it supplied.
|
||||
|
||||
THREAD* t = 0;
|
||||
const KE_THREAD_CREATE_PARAMETERS parameters = KE_THREAD_CREATE_NORMAL(kp);
|
||||
KSTATUS st = KeCreateKernelThread((uintptr_t)thread,
|
||||
(uintptr_t)arg,
|
||||
kp,
|
||||
¶meters,
|
||||
&t);
|
||||
if (!KSUCCESS(st))
|
||||
KePanic(KE_PANIC_CODE_DRIVER, "lwIP: failed to create kernel thread: 0x%x\n", st);
|
||||
|
||||
Reference in new issue
Block a user