Page 1 of 1

Printf on paggin mode.

Posted: Wed Mar 17, 2004 3:03 pm
by Balroj
Hi,

I have my paggin mode working. It's only a simple paggin mode, and very basic. Only when i'm trying to print something on screen my os reboots. Any idea?


Thanks

Re:Printf on paggin mode.

Posted: Wed Mar 17, 2004 3:22 pm
by Ozguxxx
I have some idea but for just not wasting memory for which people pay, I wont say things that will create a chaos in your mind. So: How do you map memory?

Re:Printf on paggin mode.

Posted: Wed Mar 17, 2004 3:53 pm
by Balroj
I only have my kernel loaded on to 3Gb mem pos.

Re:Printf on paggin mode.

Posted: Wed Mar 17, 2004 4:07 pm
by Pype.Clicker
it sounds like you have no working page fault handler and for some reason, accessing the video memory triggers a PF.

Did you make sure the kernel code is still mapped in a consistent fashion with non-mapped addresses ?

Re:Printf on paggin mode.

Posted: Thu Mar 18, 2004 3:08 am
by Balroj
Did you make sure the kernel code is still mapped in a consistent fashion with non-mapped addresses ?
Sorry Pype i didn't understand well what you are asking for.

In the other hand, how many video memory should i map? 512k? 256Mb? better do it dinamycally?

Re:Printf on paggin mode.

Posted: Thu Mar 18, 2004 3:29 am
by xfryj
edit: irrelevant questions removed by moderator.

Re:Printf on paggin mode.

Posted: Thu Mar 18, 2004 3:45 am
by aladdin
try to use all the 4G for your kernel, if this works then the problem is due to a wrong memory mapping (video ram pages are not mapped).

check that memory from A000:0000 (video RAM base) to 1Mb is correctly mapped and not ysed by the kernel.

try also to use an identity mapping of the first 4Mb of RAM (this seems to be a convention).

Re:Printf on paggin mode.

Posted: Thu Mar 18, 2004 3:46 am
by aladdin
try to use all the 4G for your kernel, if this works then the problem is due to a wrong memory mapping (video ram pages are not mapped).

check that memory from A000:0000 (video RAM base) to 1Mb is correctly mapped and not ysed by the kernel.

try also to use an identity mapping of the first 4Mb of RAM (this seems to be a convention).

Re:Printf on paggin mode.

Posted: Thu Mar 18, 2004 4:00 am
by bubach
if it crashes, why does it reboot itself ?
it could remain frozen
if you had done some os programming yourself instead of making stupid comments, like "are u sure that u watch the right monitor", you would know why the computer resets itself on a crash.

Re:Printf on paggin mode.

Posted: Thu Mar 18, 2004 5:24 am
by distantvoices
@bubach: Ach, don't pay too much attention to that git. Maybe he's got problems with his ma 'n' da and now has a go at each and every one coz he canna bear it.

@balroj: map your kernel adress space in this way: virtual adress 0x0 = physical adress 0x0, and so forth. take care that virtual 0xa0000 is also mapped to physical 0xa0000 and virt. 0xb8000 to phys. 0xb8000. You map in ranges of 4k. Take this into consideration. Write some handler for exception 0x14.

stay safe.

Re:Printf on paggin mode.

Posted: Thu Mar 18, 2004 11:00 am
by Pype.Clicker
beyond infinity wrote: Write some handler for exception 0x14.
hum, afaik, this is exception 0x0e , not 0x14 ... and that's certainly a mandatory step before you activate paging ...

And just for the tip: i used to switch the background colour or the overscan color of the screen before and after a 'cruxial' operation of pmode set up so that i can always get a trace of what was wrong even if video memory access is screwed up.

Check out VGA registers to be sure, but iirc it looks something like

Code: Select all

    setbg 0,0,63
    now_try_something_nasty
    setbg 0,0,0


%macro setbg 3
    xor al,al
    mov dx,0x3c8
    out dx,al ; select color 0 (background)
    inc dx
    mov al,%1
    out dx,al ; red value
    mov al,%2
    out dx,al ; green value
    mov al,%3
    out dx,al ; blue value
%endmacro
check http://www.inversereality.org/tutorials ... tting.html for details ...

Re:Printf on paggin mode.

Posted: Thu Mar 18, 2004 11:18 am
by BI lazy
@pype: thanks for correcting, that's a plain typo. Writing 0x and thinking in decimal is not the most recommendable way to write a tip.

*feels ashamed for that ...*