<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>P {MARGIN-TOP: 0mm; MARGIN-BOTTOM: 0mm}</style>
</head>
<body>
<div style="FONT-FAMILY: Arial; FONT-SIZE: 10pt" id="ezFormProc_div">
<div style="FONT-FAMILY: Arial" id="msgbody">
<div>
<div style="LINE-HEIGHT: 15pt"><br>
Hi, folks,</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">While I was trying to open a shell on the LCD, I found printk from inside the kernel and printf from user side busybox
<br>
use the same frame buffer driver (and eventually bit blitting functions) as my previous email said.</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">I later found the reason printf doesn't work in my case is that the page table is not correctly setup for context 1 which
<br>
the bit blitting function is in while accessing the frame buffer memory for printf. When doing the printk, the context is 0.
</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">I used srmmu_swprobe function to check the page table entry for the frame buffer address. I can get the physical address
<br>
corresponding to the virtual address.(by the way, I think the address for pixel data is a dma address which should bypass
<br>
cache, and it still needs virtual-physical address translation..)</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">When srmmu_swprobe probes the page table, it bypasses the mmu translation of course. The context table base and
<br>
current context value are kept in MMU registers (in 0x100 and 0x200 each)</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">What I found : when in context 0 and context 1<br>
context table address was the same 0x60540800. and then I just found while blitting the printk text, the current context value is 0
<br>
and all the entries in the context table is 0x6054001.(I checked for context 0,1,2 entries). They are all the same!<br>
But while doing printf, (current context was 1), all the entries in the context table was 0x6054a41. (also checked for context 0,1,2)</div>
<div style="LINE-HEIGHT: 15pt">in context 0, the level 0 table starts at 0x60540000 and for context 1 it starts at 0x6054a400. (first level table has 1024 bytes,<br>
so the pointer is interpreted as pointing 1024 byte chunks, so right 4 bits are masked off and it is 4 bit left shifted,= 256 words)</div>
<div style="LINE-HEIGHT: 15pt"><br>
Q1 : I previously thought the context table should remain the same and be added an entry as new context is added but
<br>
why has the pointer for context 0 been changed after busybox loading?</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">Q2 : and in context 1 case,(where I can't access the frame buffer), when I read the address pointed to by the context 1 pointer,<br>
it reads zero. so something is wrong. It should contain either PTE or PTD. When does the OS setup the page table? I guess
<br>
it does so while loading a program using sys_execve. somebody please confirm.. where in the code should I look?</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">Q3 : when reading the value pointed to by the context table entry, the code below is used.
<br>
&nbsp;&nbsp;&nbsp;&nbsp; (I'm using a sparc processor designed in our team.)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr = (pgd &amp; SRMMU_PTD_PMASK) &lt;&lt; 4;&nbsp; // SRMMU_PTD_PMASK is 0xffff fff0 in our case.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr &#43;= ((((vaddr) &gt;&gt; SNAKE_PGD_SH) &amp; SNAKE_PGD_M) * 4);&nbsp; // SNAKE_PGD_SH is 24 and SNAKE_PGD_M is 0xff in our case<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pmd = SNAKE_BYPASS_LOAD_PA(ptr);&nbsp; // pmd reads 0 when in context 1 (read bypasses mmu translation here)<br>
in the second line, the 8 bit index from the virtual address is multiplied by 4 to make it point to 1024 byte chunks. (The first level<br>
table is of size 1024 by the SPARC reference MMU). But in the first line, why is it 4 bit left shfited? This may take any alignment,<br>
but is there any reason? </div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">I know I have to read more (and some part again) about the linux memory management but hope to hear some explanations or hints.</div>
<div style="LINE-HEIGHT: 15pt"><br>
best regards,<br>
Chan<br>
<br>
</div>
<div style="LINE-HEIGHT: 15pt" id="MailSign"></div>
<div style="LINE-HEIGHT: 15pt"><br>
</div>
</div>
</div>
</div>
</body>
</html>