OSDev.org

The Place to Start for Operating System Developers
It is currently Fri May 17, 2024 10:14 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: cannot address more than 1 mb
PostPosted: Sat Oct 25, 2008 1:40 am 
Offline

Joined: Sun Oct 05, 2008 4:33 am
Posts: 14
first of all to begin this is my code that enables A20.


Code:
/* to enable the A20 address line inorder to address more than 1MB of memory */
        call    empty_8042
        movb    $0xd1,%al
        out     %al,$0x64
        call    empty_8042
        movb    $0xdf,%al
        out     %al,$0x60
        call    empty_8042
   jmp   A20ENABLED


/* this function repeatedly checks the keyboard controller 8042 */
empty_8042:
   .word   0x00eb,0x00eb
        in      $0x64,%al
        test    $0x2,%al
        jnz     empty_8042
        ret


the qemu shows that A20 has been enabled.
now this is my GDT
Code:
gdtstructure:
   .2byte   0x27      /* limit of the gdt */
   .4byte   gdtstart   /* base address of gdt */

gdtstart:

   /* null descriptor to ensure that no segment registers get loaded with value 0 */
   /* causes "GENERAL PROTECTION FAULT" if we try to access this gdt entry */
   .4byte   0
   .4byte   0

   /* code segment for our bootloader */
   .2byte   0xFFFF, 0
   .byte   0, 0x9A, 0x4F, 0

   /* data segment for our bootloader */
   .2byte   0xFFFF, 0
   .byte   0, 0x92, 0x4F, 0   

   /* code segment for our kernel */
   .2byte   0xFFFF, 0000
   .byte   10, 0x9A, 0x4F, 0

   /* data segment for our kernel */
   .2byte   0xFFFF, 0
   .byte   10, 0x92, 0x4F, 0



but i cannot access the memory in the fifth entry of GDT.this what i was trying to do.i didn't enable paging.

Code:
   mov $0x20,%eax
     mov %ds,%ebx
    mov %eax,%ds
    movb $'A',0x8000
    movb 0x8000,%al
    movb %al,0xb8000
    movb $0x1e,0xb8001
mov %ebx,%ds



when i tried to print the character that i had written, i am not getting the result.

is the problem because A20 was not enabled properly.
should i need to do anything more


Top
 Profile  
 
 Post subject: Re: cannot address more than 1 mb
PostPosted: Sat Oct 25, 2008 4:47 am 
Offline
Member
Member

Joined: Fri Nov 16, 2007 1:59 pm
Posts: 612
The last two descriptors contain segment base 0xA0000. Therefore to write the character to the address 0xB8000 you must use the displacement 0x18000 (0xB8000=0xA0000+0x18000).

_________________
If you have seen bad English in my words, tell me what's wrong, please.


Top
 Profile  
 
 Post subject: Re: cannot address more than 1 mb
PostPosted: Sat Oct 25, 2008 11:14 am 
Offline

Joined: Sun Oct 05, 2008 4:33 am
Posts: 14
thanks friend...actually i meant base address as 0x100000...i completely forgot that "0x" that made it read as hexadecimal..sorry everyone..really a stupid one..


Top
 Profile  
 
 Post subject: Re: cannot address more than 1 mb
PostPosted: Sun Oct 26, 2008 4:31 am 
Offline
Member
Member
User avatar

Joined: Sun Nov 07, 2004 12:00 am
Posts: 148
osmosys wrote:
thanks friend...actually i meant base address as 0x100000...i completely forgot that "0x" that made it read as hexadecimal..sorry everyone..really a stupid one..


no question is stupid untill it has an answer :)

_________________
Magneto OS ver 0.2
OS Dev Begineers Guide
My New Home


Top
 Profile  
 
 Post subject: Re: cannot address more than 1 mb
PostPosted: Mon Oct 27, 2008 4:26 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
Quote:
mov $0x20,%eax
mov %ds,%ebx

Where is this being executed? real mode, unreal mode, protected mode, long mode? what is the code size at that point?

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: cannot address more than 1 mb
PostPosted: Mon Oct 27, 2008 8:10 pm 
Offline
Member
Member

Joined: Sun Jul 06, 2008 7:50 pm
Posts: 151
Location: New Zealand
It could be that you not have setout your protected mode right. You know 32 bit. That what could be the problem


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], Xeno and 5 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group