flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > General protection fault at multitasking :-( |
Author |
|
BAiC 11 Nov 2012, 05:15
first off I'm still reading your code so excuse the partial response.
you should setup a stack before invoking the "int" instruction (or any other stack-using instruction). you can easily place at at the start of the boot sector (0x7C00). a tip (it's not a bug): you don't need to move esp (or a constant) into eax before you write it into memory: Code: mov eax,esp ; Dedicar un espacio en la pila sub esp,1024 ; 1K por debajo de la tarea inicial mov [tss1.esp],eax this will work just fine: Code: mov [tss1.esp],esp sub esp,1024 ; 1K por debajo de la tarea inicial this applies to constants as well but there are instruction-encoding caveats associated with that. BAiC _________________ byte me. |
|||
11 Nov 2012, 05:15 |
|
BAiC 11 Nov 2012, 05:44
it is highly recommended to use CLD (Clear Direction Flag), or STD (Set Direction Flag), prior to each invocation of the string instructions. this is from the "Print" function:
Code: mov ecx,(160*25-160)/4 mov esi,0xb8000+160 mov edi,0xb8000 repz movsd also, you don't need repz (repeat while zero/equal), nor should you use, for the movs instruction. the movs instruction is not dependent upon on the zero flag nor is the repeat prefix. the encoding for 'rep' is identical to 'repe'/'repz'. this particular code block needs the direction flag to be clear (execute a CLD). Code: mov edi,[pos] call Print mov [pos],edi I recommend putting the EDI-load and EDI-store instruction into the Print procedure. BAiC _________________ byte me. Last edited by BAiC on 11 Nov 2012, 08:13; edited 1 time in total |
|||
11 Nov 2012, 05:44 |
|
BAiC 11 Nov 2012, 06:49
[edited] I'm sorry but this wasn't the cause... I got ahead of myself.
BAiC _________________ byte me. Last edited by BAiC on 11 Nov 2012, 08:00; edited 2 times in total |
|||
11 Nov 2012, 06:49 |
|
BAiC 11 Nov 2012, 06:56
I forgot to mention... you don't provide an ESP at any point. you really should explicitly declare a Stack Pointer and preferably at the boot.
|
|||
11 Nov 2012, 06:56 |
|
flash 11 Nov 2012, 21:54
¡Hi BAiC! thank's for your all your considerations. There are a lot of "scrappy" things left behind on my translation from Christopher Giese tutorials. But none related to protection fault
Anyway, i am just interested on any kind of multitask/multithread. If you know about any other examples about hardware or software context switch i will glad to review it. The thing is i am trying to run James Molloy's Tutorial kernel but the mutitask is buggy And other examples here at the forum are to complex(Menuet, Kolibri...) or to simple or incomplete. ¡Thank's! |
|||
11 Nov 2012, 21:54 |
|
BAiC 12 Nov 2012, 01:49
Quote:
so what's your idea of "complete".. the definitions of 'simple' and 'complete' are very close to being mutually exclusive ideas. by the way; is the hardware mechanism something you really want? performing a task switch with an explicit software algorithm is more academically descriptive (easier to learn from). BAiC |
|||
12 Nov 2012, 01:49 |
|
flash 15 Dec 2012, 14:56
Hi BAiC, i am testing processor tss features, but it seems to shun me . Any way i just want to use tss to store data in order to make a task switch. As far as i know it's not possible to avoid it usage and i want to learn to merge tss with software switch.
|
|||
15 Dec 2012, 14:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.