Page 1 of 1

Unable to display on screen after enabling paging

Posted: Mon Aug 29, 2011 10:01 am
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.

Re: Unable to display on screen after enabling paging

Posted: Mon Aug 29, 2011 3:27 pm
by Nessphoro
Change SCREEN_MEM_ADDR to 0xC00B8000

Re: Unable to display on screen after enabling paging

Posted: Mon Aug 29, 2011 5:42 pm
by Nessphoro
You never know.

Re: Unable to display on screen after enabling paging

Posted: Tue Aug 30, 2011 12:53 am
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.

Re: Unable to display on screen after enabling paging

Posted: Tue Aug 30, 2011 2:13 am
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.

Re: Unable to display on screen after enabling paging

Posted: Tue Aug 30, 2011 4:19 am
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.