Page tables, 4 bytes?

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.
MrXon

Page tables, 4 bytes?

Post by MrXon »

There?s something I dont understand about page tables, or the page table descriptors. Each descriptor is 4 bytes long. and it should hold two things; the physicall address And some attributes. But how can this be done with only 4 bytes (since you mabye need 32 bits to point the page to an physical address, and then you also need some bits to set some attributes)
MrXon

Re:Page tables, 4 bytes?

Post by MrXon »

OR can I just "point" a page to a physicall adress that looks like:
4096 * x (x = arbitrary number)
and with a number like this, the "lowest bits" will never change (always be zero) and therefore used to set attributes (the CPU believes that the lowest bits wont matter and simply work as they are all zeros)
Curufir

Re:Page tables, 4 bytes?

Post by Curufir »

Because the pages are aligned on 4k boundaries, so you don't need all the bits to determine the start address of a page.
MrXon

Re:Page tables, 4 bytes?

Post by MrXon »

You mean like I wrote some seconds before you answered me? So it doesnt make any difference if I point a page to
0x3000 and 0x3005 (but the attributes will change)?
Curufir

Re:Page tables, 4 bytes?

Post by Curufir »

MrXon wrote: You mean like I wrote some seconds before you answered me?
Oddly enough I'm not sufficiently clairvoyant to guess that you're writing a response to your own question whilst writing a response of my own.

From the Intel manual (Describing page table entries).

Code: Select all

Page base address, bits 12 through 32
(Page-table entries for 4-KByte pages.) Specifies the physical address of the
first byte of a 4-KByte page. The bits in this field are interpreted as the 20 mostsignificant
bits of the physical address, which forces pages to be aligned on
4-KByte boundaries.
ONLY the 20 most significant bits are relevant. The others are assumed 0 as pages MUST be aligned on a 4k boundary. You CANNOT make a page's base address non-aligned.
MrXon

Re:Page tables, 4 bytes?

Post by MrXon »

Thank you :)
Hee-Hee I thought that if I?ve figured the answer out by myself it would be to bad to let someone write a long explanation if all I needed was an "yes", and since I?m no member yet it was impossible for me to just edit my first message.
Curufir

Re:Page tables, 4 bytes?

Post by Curufir »

Yeah, sorry about that. Maybe I should try decaff :).
MrXon

Re:Page tables, 4 bytes?

Post by MrXon »

No, dont do so, I though OS:es were built of caffein? ;D
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:Page tables, 4 bytes?

Post by Pype.Clicker »

MrXon wrote: No, dont do so, I though OS:es were built of caffein? ;D
Clicker is 100% minth-thee. No caffeine involved (except in old craps in ASM that were tossed as soon as i get rid of CocaCola addiction :) )
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Page tables, 4 bytes?

Post by distantvoices »

Hmmm ... blueillusion is buildt on 100 % pure coffee. Don't drink Coca Cola for thats way too sweet - et par ailleurs (it's long ago I've used *this* word the last time), moi, etant d'origin viennoise, is coffee addict per se. It's in our viennese blood to be more or less coffee addict *gg*

erm, Pype - are you sure you don't have relatives in some british stone circle village Asterix has paid a visit to in another century? minth-tea sounds so toroughly british ];-> ;)
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
MrXon

Re:Page tables, 4 bytes?

Post by MrXon »

Doesnt tee contains caffein? Then I?ve wasted lots and lots of time one that drink :)

beyond infinity: sweet?s the right word, I?ve lost almost 10 kg (22 pounds) during thi summer after gettin out of my cola addiction :)
Curufir

Re:Page tables, 4 bytes?

Post by Curufir »

Coffee and tea are pretty much equivalent in terms of caffeine.

Of course how strong you take it, and what variety is used can make a lot of difference, but you really shouldn't think of tea as being significantly lower in caffeine.

As for coca-cola...the dentists call it "liquid candy" and I tend to agree. It is entirely too sickly sweet for my taste.

I'm also a tea person. Earl Grey or Darjeeling :).
MrXon

Re:Page tables, 4 bytes?

Post by MrXon »

The taste of Coke is a gift from God but it?s not good for you :)
BI lazy

Re:Page tables, 4 bytes?

Post by BI lazy »

A gift from the gods?

Nah, then the gods themselves have bad taste *rofl* and you should look up the translation of 'gift' from german to english *dg*

At worst it is, when the damned stuff gets warm *igitt*
MrXon

Re:Page tables, 4 bytes?

Post by MrXon »

Hehe what does gift mean in german? In Sweden, gift?s the word for poison :)

Yes it should be enjoyed ice cold. And an opened bottle will only remain drinkable (spelling?) for one day or so, then the carbonate is gone
Post Reply