Handle cli/sti in scheduler: fake i flag with id flag.
This commit is contained in:
parent
0d07b5810f
commit
90d1aaaccc
@ -6,13 +6,15 @@
|
||||
|
||||
sigjmp_buf trampoline;
|
||||
|
||||
|
||||
__attribute__((__stdcall__))
|
||||
uint32_t umka_sched_add_thread(appdata_t *app) {
|
||||
fprintf(stderr, "umka_new_sys_threads before\n");
|
||||
fprintf(stderr, "kos_task_count: %d\n", kos_task_count);
|
||||
if (!sigsetjmp(trampoline, 1)) {
|
||||
__asm__ __inline__ __volatile__ (
|
||||
"pushfd;"
|
||||
"bts dword ptr [esp], 21;"
|
||||
"popfd;"
|
||||
"mov esp, eax"
|
||||
:
|
||||
: "a"(app->saved_esp)
|
||||
|
23
umka.asm
23
umka.asm
@ -41,7 +41,18 @@ public kos_acpi_ssdt_size
|
||||
public stack_init
|
||||
public net_add_device
|
||||
|
||||
cli equ nop
|
||||
macro cli {
|
||||
pushfd
|
||||
btr dword[esp], 21
|
||||
popfd
|
||||
}
|
||||
|
||||
macro sti {
|
||||
pushfd
|
||||
bts dword[esp], 21
|
||||
popfd
|
||||
}
|
||||
|
||||
iretd equ retd
|
||||
|
||||
lang fix en
|
||||
@ -287,8 +298,6 @@ public umka_os
|
||||
proc umka_os uses ebx esi edi
|
||||
call kos_init
|
||||
|
||||
; mov [fdd_motor_status], 0
|
||||
|
||||
mov eax, -1
|
||||
mov edi, thr_slot_map+4
|
||||
mov [edi-4], dword 0xFFFFFFF8
|
||||
@ -365,14 +374,6 @@ proc umka_os uses ebx esi edi
|
||||
ret
|
||||
endp
|
||||
|
||||
; in: edx -> APPDATA for OS/IDLE slot
|
||||
; in: ebx = stack base
|
||||
proc s2etup_os_slot
|
||||
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
extrn pci_read
|
||||
proc pci_read_reg uses ebx esi edi
|
||||
mov ecx, eax
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <setjmp.h>
|
||||
#define __USE_GNU
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
@ -7,17 +8,23 @@
|
||||
|
||||
struct itimerval timeout = {.it_value = {.tv_sec = 0, .tv_usec = 10000}};
|
||||
|
||||
|
||||
void scheduler(int signo, siginfo_t *info, void *context) {
|
||||
(void)signo;
|
||||
(void)info;
|
||||
(void)context;
|
||||
// printf("##### switching from task %u\n", kos_current_task);
|
||||
ucontext_t *ctx = context;
|
||||
if (!sigsetjmp(*kos_slot_base[kos_current_task].fpu_state, 1)) {
|
||||
// printf("##### saved\n");
|
||||
if (ctx->uc_mcontext.__gregs[REG_EFL] & (1 << 21)) {
|
||||
kos_current_task += 1;
|
||||
if (kos_current_task == kos_task_count) {
|
||||
kos_current_task = 1;
|
||||
}
|
||||
} else {
|
||||
printf("########## cli ############\n");
|
||||
}
|
||||
kos_current_slot = kos_slot_base + kos_current_task;
|
||||
printf("##### kos_current_task: %u\n", kos_current_task);
|
||||
setitimer(ITIMER_PROF, &timeout, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user