flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Understanding structure of Paging descriptor

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7577
Location: Kraków, Poland
Tomasz Grysztar
It seems you forgot to map your code into memory, you have only mapped a single page at address 0.
Post 06 Feb 2020, 12:25
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 80
Fulgurance
...Hum, if i understand, i have forget to map since 0x1000 address ? Is it that ?


Last edited by Fulgurance on 06 Feb 2020, 13:22; edited 2 times in total
Post 06 Feb 2020, 13:16
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7577
Location: Kraków, Poland
Tomasz Grysztar
Yes, if your code is at address 0x1000, then you need to actually map the memory containing that code there, otherwise CPU is not going to have anything to execute.
Post 06 Feb 2020, 13:21
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 80
Fulgurance
I have doing this, but this don't work. I think i'm tired Rolling Eyes

Code:
PageDirectory:
dd PageTable + 111b
dd 1023 dup 0x0

PageTable:
dd 0x0B8000 + 111b
dd 0x001000 + 111b
dd 1022 dup 0x0    
Post 06 Feb 2020, 13:30
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7577
Location: Kraków, Poland
Tomasz Grysztar
Remember that all page tables need to have addresses of form 0XXXXX000h, what you can ensure with ALIGN directive:
Code:
align 1000h

PageDirectory:
dd PageTable + 111b
dd 1023 dup 0x0

PageTable:
dd 0x0B8000 + 111b
dd 0x001000 + 111b
dd 1022 dup 0x0    
Post 06 Feb 2020, 13:59
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 80
Fulgurance
Oh yes ... Thanks for your help Very Happy

Just little question. I'm tired to always calculate the good size of my size to have always multipe of 512 bytes.

Are there any solution to calculate the appropriate size ?
For example if my file after compilation have size of 6000 bytes, if i would like to calculate how many 512 sectors i need, is it possible to test the result when the result is decimal number ?

(6000 / 512 = 11.71865) -> i need 12 sectors (for make floppy image)
Post 06 Feb 2020, 14:35
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7577
Location: Kraków, Poland
Tomasz Grysztar
You can use ALIGN to find out the nearest boundary and then pad with a filling of your choice:
Code:
virtual
        align 512
        PADDING = $ - $$
end virtual
db PADDING dup 0    
If you use just plain ALIGN at the end of file, it makes a reserved data which is cut off, but there is also a trick to enforce its initialization with a single STORE:
Code:
align 512
store byte 90h at $-1    
Post 06 Feb 2020, 15:42
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 80
Fulgurance
Hum interesting, i don't know this command. And i have finally found other way to do that. I have seen FASM support conditionnal instruction. Thanks you very much for your help !
Post 06 Feb 2020, 15:57
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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-2020, Tomasz Grysztar.

Powered by rwasa.