Run net stack, jump to the osloop. Compiles, doesn't crash.

This commit is contained in:
2020-05-09 05:15:57 +03:00
parent dad581883c
commit 0d07b5810f
6 changed files with 250 additions and 98 deletions

View File

@@ -8,26 +8,20 @@ sigjmp_buf trampoline;
__attribute__((__stdcall__))
uint32_t umka_new_sys_threads(void (*func)(void), void *stack, int type) {
(void)type;
(void)func;
uint32_t umka_sched_add_thread(appdata_t *app) {
fprintf(stderr, "umka_new_sys_threads before\n");
// kos_slot_base[kos_task_count].fpu_state = malloc(4096);
fprintf(stderr, "kos_task_count: %d\n", kos_task_count);
if (!sigsetjmp(trampoline, 1)) {
__asm__ __inline__ __volatile__ (
"mov esp, eax;"
"push ecx"
"mov esp, eax"
:
: "a"(stack),
"c"(func)
: "a"(app->saved_esp)
: "memory");
if (!sigsetjmp(*kos_slot_base[kos_task_count++].fpu_state, 1)) {
if (!sigsetjmp(*app->fpu_state, 1)) {
longjmp(trampoline, 1);
} else {
__asm__ __inline__ __volatile__ (
"pop ecx;"
"call ecx"
"ret"
:
:
: "memory");