Page 3 of 3

Re:I need more about creating a task/process

Posted: Mon Aug 22, 2005 1:10 am
by distantvoices
Slow now. Breathe. Seek your center and stay there for a while. Empty your brain from all thoughts. Enjoy the silence.

There now?

Look, there are several debugging techniques. I'll show you one or two ere you start chasing your own tail eh?

First: Put the scheduling stuff in the keyboard isr (irq 1). Shut off the timer irq. We don't need it at this stage. You issue an interrupt willingly by pressing a key. More control.

Second: put prints around the crucial and non crucial parts of the scheduler and task switching code - it's always good to know where the code is. It often reveals the hidden pitfalls in the path of execution to have visual tracing at hands. In asm stubs, simply move chars to given positions in vram.

Third: Have you by any chance enabled paging? If so, zero out all your page dirs and page tables. This is very important for any crap in the page tables gets translated into addresses - and this brings biiig trouble.

Fourth: Welcome to debug sessions darker than night! mwaaahahahahaaa

Re:I need more about creating a task/process

Posted: Mon Aug 22, 2005 1:49 am
by Kim
Or you could use bochs and gdb/insight and just step from line to line in your source code. Use -g switch to make sure your kernel has debugging information.

Re:I need more about creating a task/process

Posted: Mon Aug 22, 2005 2:10 am
by distantvoices
That's a possibility too.

Other one: mark the eip shown by bochs in the failure log, then objdump -d the kernel image (hopefully not stripped of all the symbols) and look the address up. By this means one can nail a bug down to a given function and examine this function (& passed parameters)

Re:I need more about creating a task/process

Posted: Mon Aug 22, 2005 2:34 pm
by calpis
Aha, thanks guys~! I got it fixed and my multitasking is on with tasks switching round robin style. Now, I am just wondering what I can do with it. Any simple and useful ideas?

Also to beyond infinity. Good advise about the clear my head...It worked and later i find that my scheduler was the one that screws up everything which I thought it worked in the first place.

I have paging enabled, and have a phyical page_allocator to work with. About zero ing all the page directory, I don't really have a clue what do I need to do, because I am having big problems understanding the phyical address, logical address, and virtual address. So I am only using the first page directory.

About the debugging....I uses a cross compiler on a mac, and my bochs is a precompiled dmg with no gdb. I tried to compile it, but it just gives lots of errors and no gui interface to click to...so my only debugging tools are kprintf and dump_regs at any exceptions and interrupts. Its like working in a dark room with no lights.... I read about using a cross compiler to compile but my cross compiler is the naked one with no header support and all the rest of it. So I don't know what to do with it really.

Thanks for the advices anyway. To kim too.