flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Newbie Pmode Question

Author
Thread Post new topic Reply to topic
hendryten



Joined: 18 Apr 2005
Posts: 8
Location: Jakarta
hendryten 18 Apr 2005, 11:43
Hello all, I'm still new in OS development, but I'm pretty much interested.

I've code some 16Bit bootloader and kernel for my own OS and now I'm thinking of 32Bit protected mode.

I want to ask something about that

first, Pmode doesn't support BIOS (right?), so how could I change the graphic mode?? say, i want to change from textmode 80x25 to grpahic mode 320x200, in 16Bit we use int 10h. How can I do it ini protected mode?

second is, memory area for video is located at 0xA0000, if I somehow successfull in changing to graphic mode (not likely), does Protected mode still use that area?? If I want 1024x640 resolution 32Bit, with 4 byte per pixel, can they fit in there??
Post 18 Apr 2005, 11:43
View user's profile Send private message Yahoo Messenger Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 18 Apr 2005, 12:02
Hi Hendryten,

Here is a link to some information: http://my.execpc.com/CE/AC/geezer/osd/graphics/index.htm

From there there are some links to others who've worked with video in protected mode.

I hope that helps!
Post 18 Apr 2005, 12:02
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu 18 Apr 2005, 12:18
Hi,

Quote:

first, Pmode doesn't support BIOS (right?)


Right Wink

Quote:

so how could I change the graphic mode?? say, i want to change from textmode 80x25 to grpahic mode 320x200, in 16Bit we use int 10h. How can I do it ini protected mode?


You can:
1) setup it before switch to protected mode
2) code a driver for every video board available (long term)
3) briefly return to 16 bits BIOS for a change and go back to 32 bits as soon as possible.
4)code a V86 module for doing that

Quote:

second is, memory area for video is located at 0xA0000, if I somehow successfull in changing to graphic mode (not likely), does Protected mode still use that area??


Depends on the video mode but bassically NO.
The location of video memory is the Linear Frame Buffer variable that can be querried from the VESA BIOS. Usually this LFB is somewhere above the 2-3Giga area.

Quote:

If I want 1024x640 resolution 32Bit, with 4 byte per pixel, can they fit in there??


Obviousely they can NOT
Post 18 Apr 2005, 12:18
View user's profile Send private message Visit poster's website Reply with quote
hendryten



Joined: 18 Apr 2005
Posts: 8
Location: Jakarta
hendryten 18 Apr 2005, 15:27
Thanks,
these answer many troubling questions for me.

About the driver thing, I'm kinda interesting in such thing to...
I wonder how to make one in Windows...

Well, thx alot...

_________________
If you want everything, you'll end up with nothing
Post 18 Apr 2005, 15:27
View user's profile Send private message Yahoo Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 18 Apr 2005, 16:39
You can see a demo i made (i was called "ASHLEY4" then) which goes to pmode and goes back to realmode switchs mode and come back to pmode, it switch between text and vesa mode, you will need at least vesa 2 .
Comes with fasm code and a program to put it on a floppy.
A mini OS Wink .
Our OS's web site and forum: http://falconrybells.co.uk/
http://dex.7.forumer.com/


Description:
Download
Filename: DemoVesa.zip
Filesize: 108.34 KB
Downloaded: 592 Time(s)

Post 18 Apr 2005, 16:39
View user's profile Send private message Reply with quote
hendryten



Joined: 18 Apr 2005
Posts: 8
Location: Jakarta
hendryten 20 Apr 2005, 07:34
Ok, about video, I think I'm seeing light now...

I still have some question (well, quite many) about paging, memory allocation and such...

Why do we need paging, isn't it the same if we map/allocate the real address, make it protected, and give it to the right application?

Quote:
Usually this LFB is somewhere above the 2-3Giga area.


That 2-3Giga area is pointing somewhere at the real physical address of memory right?? so what's the point of it?? Wouldn't it be faster if we use the real address???

I read some of other topics as well and I can't figured out why should we use paging instead of real memory addressing???

Man, i really need explanation for these..

Thanks! Razz

_________________
If you want everything, you'll end up with nothing
Post 20 Apr 2005, 07:34
View user's profile Send private message Yahoo Messenger Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 602
Location: Germany
MCD 20 Apr 2005, 07:57
hendryten wrote:
I still have some question (well, quite many) about paging, memory allocation and such...

Why do we need paging, isn't it the same if we map/allocate the real address, make it protected, and give it to the right application?
Actually, there are quiet a lot of smaller OSes that perform so. You can completely (or partly, using larger 4MB pages) disable paging, for easier and (perhaps) a bit faster memory accesses (some older CPUs only).

Actually, the point of paging is to be able to guaranty that any allocated memory won't change it's addresses even if a lot of the memory allocation status is changed, e.g. de- or re-allocated.

In KISS: Prevent linear address fragmentation, whereas physical addresses may fragment, thus you don't need to move the memory in physical if you want all memory to keep linear defragmented.

hendryten wrote:

That 2-3Giga area is pointing somewhere at the real physical address of memory right?? so what's the point of it?? Wouldn't it be faster if we use the real address???
Well, it actually points into some physical memory, but it's not the usual memory on your mainboard, it's the memory on your graphics card, called video memory (which contains frame buffer + offscreen memory). Any writes in the frame buffer will manifest themselves if your PC is in a linear frame buffer mode and you've not forgotten to plug in your monitor correctly Wink

Usually, any remappings from linear address spaces to different physical hardware devices (memory mapped I/O and others) usually between 2-4GB are performed by some motherboard controllers or MTRRs, but not with the regular paging mechanism.

Think this should clarify it a bit.

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 20 Apr 2005, 07:57
View user's profile Send private message Reply with quote
hendryten



Joined: 18 Apr 2005
Posts: 8
Location: Jakarta
hendryten 20 Apr 2005, 08:11
I see... lets see what've I get
correct me if I wrong!

If my application is given space in memory at location 10000h (physical), I won't have to adjust my code to that 10000h right??? I just need to do some paging so that 10000h look like 0h right??


Thanks a lot!

_________________
If you want everything, you'll end up with nothing
Post 20 Apr 2005, 08:11
View user's profile Send private message Yahoo Messenger Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 602
Location: Germany
MCD 20 Apr 2005, 08:28
hendryten wrote:
I see... lets see what've I get
correct me if I wrong!

If my application is given space in memory at location 10000h (physical), I won't have to adjust my code to that 10000h right??? I just need to do some paging so that 10000h look like 0h right??

You're on the right way. paging doesn't move any data, it only makes the physical address 10000h (to keep your example) accessible by the linear address of 0. Naturally, you could chose any other linear address than 0 to actually access the physical 10000h.

Keep in mind that paging is performed by the CPU itself, whereas some of the other hardware I/O "remappings" are done by other devices (e.g. motherboard chipset...).

Also, paging is only available in protected modes, not in real modes. (16,32 and even 64 bit ones). furthermore, paging can only be changed in CPL 0.

I have no idea why I'm telling so much detailed stories about it, but I think if you wanna do some stuff into this direction, consider reading intel's docs about it http://www.intel.com/design/pentium4/manuals/index_new.htm, especially this one (system programming guide) ftp://download.intel.com/design/Pentium4/manuals/25366814.pdf

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 20 Apr 2005, 08:28
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.