Errors while entering protected 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.
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

Re: Errors while entering protected mode

Post by bigbob »

yee1 wrote:All of you were saying about real mode. I want to have my OS running in protected mode where as far as I know there is also 0xB8000 address available for video memory, right ?
As far as I know 0xB8000 is the Text-Screen-Memory regardless if you are in real or protected mode.
In protected mode you can't use BIOS so you need to write directly to that memory region.
What you write there will appear on the screen. So you are right.
In graphical mode e.g. 1024*768*24 (VESA 2) the video memory is mapped to e.g. 0xE0000000, so you need to write there.
This address (and the available modes, i.e. resolutions) can be retrieved with BIOS, so in real mode.

EDIT: Maybe you can use the Text-Screen-memory region in graphical mode for storing your data just like normal memory regions but I have never tried that.
yee1
Member
Member
Posts: 42
Joined: Sun Feb 10, 2013 4:02 pm

Re: Errors while entering protected mode

Post by yee1 »

bigbob wrote:
yee1 wrote:All of you were saying about real mode. I want to have my OS running in protected mode where as far as I know there is also 0xB8000 address available for video memory, right ?
As far as I know 0xB8000 is the Text-Screen-Memory regardless if you are in real or protected mode.
In protected mode you can't use BIOS so you need to write directly to that memory region.
What you write there will appear on the screen. So you are right.
In graphical mode e.g. 1024*768*24 (VESA 2) the video memory is mapped to e.g. 0xE0000000, so you need to write there.
This address (and the available modes, i.e. resolutions) can be retrieved with BIOS, so in real mode.

EDIT: Maybe you can use the Text-Screen-memory region in graphical mode for storing your data just like normal memory regions but I have never tried that.
Ok, but I still don't understand one important thing. There are some restricted memory spaces where I should not put my data, but you have just told me I am able to use only 1 Mb of memory. I know my kernel and sample apps will be small and it will be lower than 1 Mb, but I am curious how is it implemented and used in well developed operating systems like linux or windows. They use more that 1 Mb of memory for sure, how to they gain such amount of memory when there are many restricted areas ?
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

Re: Errors while entering protected mode

Post by bigbob »

yee1 wrote: Ok, but I still don't understand one important thing. There are some restricted memory spaces where I should not put my data, but you have just told me I am able to use only 1 Mb of memory. I know my kernel and sample apps will be small and it will be lower than 1 Mb, but I am curious how is it implemented and used in well developed operating systems like linux or windows. They use more that 1 Mb of memory for sure, how to they gain such amount of memory when there are many restricted areas ?
You must have misunderstood us. :)
In protected mode you can address 4Gb memory (in 32-bits). This means, that you can read/write it.
However there are some regions of this 4Gb-memory which make no sense to write to. For example storing data e.g. in the video-memory (unless you want it to appear on the screen) or the memory-region of other memory-mapped devices.
About the 1Mb: There are still some old devices that use the 1Mb memory at 15Mb, so that 1Mb memory-region shouldn't be used either. The "Memory Map" shows which parts of the memory(4Gb !) is free to use.
If you have 4 Gbs of RAM then you can use for your own purposes the memory e.g. from 2.5Gb-3Gb unless it is "taken" (e.g. used by a device).
Post Reply