Printf on paggin mode.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Balroj

Printf on paggin mode.

Post 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
Ozguxxx

Re:Printf on paggin mode.

Post 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?
Balroj

Re:Printf on paggin mode.

Post by Balroj »

I only have my kernel loaded on to 3Gb mem pos.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Printf on paggin mode.

Post 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 ?
Balroj

Re:Printf on paggin mode.

Post 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?
xfryj

Re:Printf on paggin mode.

Post by xfryj »

edit: irrelevant questions removed by moderator.
aladdin

Re:Printf on paggin mode.

Post 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).
aladdin

Re:Printf on paggin mode.

Post 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).
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Printf on paggin mode.

Post 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.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Printf on paggin mode.

Post 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.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Printf on paggin mode.

Post 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 ...
BI lazy

Re:Printf on paggin mode.

Post 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 ...*
Post Reply