Unable to display on screen after enabling paging

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.
Post Reply
tushs
Member
Member
Posts: 28
Joined: Mon Aug 02, 2010 7:43 am

Unable to display on screen after enabling paging

Post by tushs »

Hi
Following are the constants, of load addr and virtual addr,

Code: Select all

#define KERNEL_VIRTUAL_ADDR 0xC0000000   /* This is 3 GB */
#define KERNEL_LOAD_ADDR 0x01000000   /* This is 16 MB */
#define PAGE_SIZE 4096
#define SCREEN_MAX_X 80
#define SCREEN_MAX_Y 24
#define SCREEN_MEM_ADDR (0xB8000 ) 
I am trying to write on address SCREEN_MEM_ADDR which is identity maped after enabling paging but its not working. when I write all zeros on above memory it was not got cleared. it still displays grub command line messages.
I thought because of TLB there may be problem, so after removing mapping of 4 table and added mapping to 0 table I reloaded cr3 with same dir address. but still its not working. there is no page fault Identity map was successful. following is clear screen function.

Code: Select all

void kcls()
{
        int i; 
        volatile char *v = (volatile char *) SCREEN_MEM_ADDR;
        for(i = 0; i < (SCREEN_MAX_X * SCREEN_MAX_Y * 2); i++)
        {
                v[i] = 0;
        }
        screen_x = screen_y = 0;
        update_curssor();
}
Please help.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: Unable to display on screen after enabling paging

Post by Nessphoro »

Change SCREEN_MEM_ADDR to 0xC00B8000
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: Unable to display on screen after enabling paging

Post by Nessphoro »

You never know.
tushs
Member
Member
Posts: 28
Joined: Mon Aug 02, 2010 7:43 am

Re: Unable to display on screen after enabling paging

Post by tushs »

How SCREEN_MEM_ADDR to 0xC00B8000 will work since, address 0xB8000 is identity mapped. is writing at physical address 0xB8000 will display it to screen? if yes why cant virtual address 0xB8000 which is mapped to same physical address will not work?
Well, instead of randomly changing variables "info tables" from bochs would be helpful to start.
You never know
.
I am not getting it, what is info tables?
One more thing this code works well before enabling paging.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Unable to display on screen after enabling paging

Post by Combuster »

I am not getting it
That's because "info tables" is not documented, while "info tab" is. And I think berkus meant the latter.
"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 ]
tushs
Member
Member
Posts: 28
Joined: Mon Aug 02, 2010 7:43 am

Re: Unable to display on screen after enabling paging

Post by tushs »

Thank u :) I solved it. Paging address was not physical my mistake. without knowledge of info tab it will be impossible to figure out.

One more thing how can I initialize PAE page tables? can I use unsigned long long [where sizeof(long) is 4] that is uint64_t *p = table_add;
p[index] = uint64_t (physical_address);
When I used it it failed, when I traced memory using bochs x command all address are assigned to first 4 byte, for example,
0x00AABBCC 0x00000000 [where 0xaabbcc is some physical address]
This may not be expected by paging unit bytes from address+4 should be valid. so my question in how can i use 8 byte variable in paging structure ? Do I need to use long *p and
p[0] = 0;
p[1] = physical addr | 0x03; in this way?
This will be too difficult to address memory greater then 4 gb.
Post Reply