Software multitasking.
Posted: Tue Feb 07, 2006 2:21 pm
I have this code:
timer_s:
pusha
push ds
push es
push fs
push gs
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov eax, esp
push eax
mov eax, timer_call
call eax
pop eax
mov esp,eax
pop gs
pop fs
pop es
pop ds
popa
add esp, 8
iret
-----------------------
struct reg
{
unsigned int gs, fs, es, ds;
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
unsigned int int_no, err_code;
unsigned int eip, cs, eflags, useresp, ss;
};
void timer_call(struct reg *r){
//?
}
And what i must do here ?
I think, I must change registers.
How to change crX ?
I know , how to create process.I have correct GDT and working hw task switching, but i want software.
timer_s:
pusha
push ds
push es
push fs
push gs
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov eax, esp
push eax
mov eax, timer_call
call eax
pop eax
mov esp,eax
pop gs
pop fs
pop es
pop ds
popa
add esp, 8
iret
-----------------------
struct reg
{
unsigned int gs, fs, es, ds;
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
unsigned int int_no, err_code;
unsigned int eip, cs, eflags, useresp, ss;
};
void timer_call(struct reg *r){
//?
}
And what i must do here ?
I think, I must change registers.
How to change crX ?
I know , how to create process.I have correct GDT and working hw task switching, but i want software.