Page 1 of 1

the saga continues.... More Questions (yay!)

Posted: Fri Aug 23, 2002 10:33 pm
by Matt
i'm sure everybody's getting tired of my questions so I'll keep it short.
In your bootloader, instead of doing a jmp to the kernel that it loads, instead, would it work if I changed the cs and eip registers to point to the program? (or would that just screw up the code that is trying to load the kernel (like if you changed the offset before the segment, it would'nt execute the code that changes the segment)
And if you are wondering why I want to do this, its because so I can get a hang of how I would set up a multitaskign system...
another question: whats the deal with the CR0 (or some other number) bit that you are suppose to do something with in multitasking. I've read somewhere that you have to change some CR(what number?) bit in your taskswitcher, but I've never found out what that is (or what it does).

[glow=red,2,300]Thanks (once again :D)[/glow]

Re:the saga continues.... More Questions (yay!)

Posted: Sat Aug 24, 2002 7:11 am
by Tim
You could directly update the CS:EIP registers using a special variant of the MOV instruction... called JMP :). That is, JMP seg:off is the only direct way of updating CS:EIP. An alternative is IRET, which is how you update CS:EIP in a multitasking system.

If you're using software switching the processor doesn't need to know about it. The only processor stuff you use then is stack switching (MOV ESP, new_stack) and the TSS (CPU loads the kernel SS:ESP from the TSS when an interrupt occurs).

Re:the saga continues.... More Questions (yay!)

Posted: Sat Aug 24, 2002 9:03 am
by Matt
Lol, Ok. I might almost be ready to make a task switcher without copying somebody elses source code ;)