flat assembler
Message board for the users of flat assembler.

Index > OS Construction > [ask] How to access memory more than 1 MB in pmode

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
egos



Joined: 10 Feb 2009
Posts: 144
egos 27 May 2011, 18:31
Code:
  mov eax,FLAT_DATA_SEGMENT_SELECTOR
  mov ds,ax
  mov al,[1fffffffh]
    

Very Happy
Post 27 May 2011, 18:31
View user's profile Send private message Reply with quote
christiandy



Joined: 03 Mar 2011
Posts: 25
Location: 101
christiandy 28 May 2011, 05:54
neville wrote:
christiandy wrote:
Can you give me an example like how to access memory 1fffffff ?
Code:
push 0
pop ds
mov al,[1fffffffh]    

Its that easy if you set up unreal mode or flat real mode first. You don't need pmode.

So the ds value refer to base address on GDT right?
if we can jus mov al,[1fffffffh] it's like real mode right?
Post 28 May 2011, 05:54
View user's profile Send private message AIM Address Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 28 May 2011, 08:13
Quote:
So the ds value refer to base address on GDT right?

Yep. DS value is index to descriptor in GDT. So for example if GDT has three descriptors (each is 8 bytes), then index to first is 0, index to second is 8, and index to third is 16. Now if first descriptor in GDT has base 0, then preceding code would access linear address 1fffffffh. If descriptor had base address 10000000h, then ds:[0fffffffh] would access same linear address. etc. However these days, base address 0 is always used except for some special cases.

Do you have intel manuals? Make sure to read them. They are bit harder to grasp at first, but one most definitively has to learn working with them, if you plan to go into protected mode.
Post 28 May 2011, 08:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 28 May 2011, 16:22
vid wrote:
Quote:
So the ds value refer to base address on GDT right?

Yep. DS value is index to descriptor in GDT. So for example if GDT has three descriptors (each is 8 bytes), then index to first is 0, index to second is 8, and index to third is 16. Now if first descriptor in GDT has base 0, then preceding code would access linear address 1fffffffh. If descriptor had base address 10000000h, then ds:[0fffffffh] would access same linear address. etc. However these days, base address 0 is always used except for some special cases.

Do you have intel manuals? Make sure to read them. They are bit harder to grasp at first, but one most definitively has to learn working with them, if you plan to go into protected mode.


Remeber the base is usually zero, but the index is not, as you leave the first one zero.
So your first index is 8h
Code:
gdt:        dw    0x0000, 0x0000, 0x0000, 0x0000
 ; left zero, not used
sys_data:   dw    0xFFFF, 0x0000, 0x9200, 0x00CF
 ; 8h
sys_code:   dw    0xFFFF, 0x0000, 0x9800, 0x00CF
 ;10h decimal (16)  
gdt_end:
    
Post 28 May 2011, 16:22
View user's profile Send private message Reply with quote
egos



Joined: 10 Feb 2009
Posts: 144
egos 28 May 2011, 22:37
Or typically 0x9A00 (readable/executable).

_________________
If you have seen bad English in my words, tell me what's wrong, please.
Post 28 May 2011, 22:37
View user's profile Send private message Reply with quote
christiandy



Joined: 03 Mar 2011
Posts: 25
Location: 101
christiandy 29 May 2011, 09:54
Thanks all, for replying very helping.
now I run on protected mode but i can't try it on DOS BOX. anw can someone explain me why multi tasking only run on protected mode?
Post 29 May 2011, 09:54
View user's profile Send private message AIM Address Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 29 May 2011, 22:18
Multitasking can be done in 2 ways.

1) With hardware, using built-in functionality.
2) With software, using time-slice scheduling.

In the near future we will have true mutitasking,
where each cpu core could have its own task.
Post 29 May 2011, 22:18
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 29 May 2011, 22:57
bitshifter wrote:

In the near future we will have true mutitasking,
where each cpu core could have its own task.

I have been tell people this for years, when they go on about multi-tasking.
I tell them your just sharing a bit of the cpu, that was done when processor's were very expensive.
Wait until every task is given a core, then we will be multi-tasking.

And thats the day my OS will be multi-tasking.
Post 29 May 2011, 22:57
View user's profile Send private message Reply with quote
christiandy



Joined: 03 Mar 2011
Posts: 25
Location: 101
christiandy 30 May 2011, 08:56
sorry I mean time slicing multitasking ( round robin algorithm cmiiw) why does protected mode can provide software multitasking
Post 30 May 2011, 08:56
View user's profile Send private message AIM Address Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 30 May 2011, 17:40
Basically software and hardware multitasking work the same way.
Starting with 16bit x80286 intel provides instructions to help do it.

So since were talking about 32bit pmode MT lets try some tutorials...
These were the ones i learned from, they are written in NASM but
with little change can be ported to FASM.
In this set there are examples of hardware and software MT under 32bit pmode.
http://geezer.osdevbrasil.net/os/pm.zip

If you get BOOTPROG you can use it as bootloader for this series.
It works very nicely and saves a bunch of time having to write one.
This is intended for FAT12 floppy or FAT16 hard disks only.
http://alexfru.chat.ru/programming/bootprog.zip

I can help make the two work under FASM if you cant do it yourself.
Feel free to drop me a line...
Post 30 May 2011, 17:40
View user's profile Send private message Reply with quote
christiandy



Joined: 03 Mar 2011
Posts: 25
Location: 101
christiandy 31 May 2011, 04:50
Dear bitshifter,
thanks for helping.
Can you please give me an example of multitasking like.
running cli and update clock every 60 detik?
Post 31 May 2011, 04:50
View user's profile Send private message AIM Address 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.