In der init.c:
struct task* task = init_task(test_task_1);
struct cpu_state* cpu = task->cpu_state;
debug(cpu, 0, "Task 1:");
Hier noch den Deklaration der Funktion Test Task:
void test_task_1(void);
Und an anderer Stelle die Funktion selbst:
void test_task_1(void)
{
while(1) {
kputs("A");
}
}
Bei Task 2 ist es dasselbe nur mit "B".
Hier noch der Code von debug.c die über eine Headerdatei in der init.c eingebunden ist:
#include "console.h"
#include "debug.h"
#include "task.h"
void debug(struct cpu_state* cpu, int verbose_level, char text[]) {
kputs(text);
kputs("\n");
if(verbose_level == 0) {
kputs("\n Register eip: ");
kputn(cpu->eip, 16);
kputs("\n Register cs: ");
kputn(cpu->cs, 16);
kputs("\n Register esp: ");
kputn(cpu->esp, 16);
}
if(verbose_level == 1) {
kputs("\n Register eax: ");
kputn(cpu->eax, 16);
kputs("\n Register ebx: ");
kputn(cpu->ebx, 16);
kputs("\n Register ecx: ");
kputn(cpu->ecx, 16);
kputs("\n Register edx: ");
kputn(cpu->edx, 16);
kputs("\n Register esi: ");
kputn(cpu->esi, 16);
kputs("\n Register edi: ");
kputn(cpu->edi, 16);
kputs("\n Register ebp: ");
kputn(cpu->ebp, 16);
kputs("\n Register eip: ");
kputn(cpu->eip, 16);
kputs("\n Register cs: ");
kputn(cpu->cs, 16);
kputs("\n Register eflags: ");
kputn(cpu->eflags, 16);
kputs("\n Register esp: ");
kputn(cpu->esp, 16);
kputs("\n Register ss: ");
kputn(cpu->ss, 16);
}
}