Hi,<div><br></div><div>I found that x86_32&#39;s modify_flags in pmap_target is not yet implemented (NYI). But my project happen to need this utility. As I saw no special difficulty in it, especially when x86_64 already has an implementation, so I don&#39;t know why it&#39;s still NYI. Are there any special concerns?</div>

<div><br></div><div>Anyway, I ported the modify_flags in x86_64 to x86_32 arch, with two small modifications:</div><div><br></div><div>- change all X86_64 to X86_32 (of course)</div><div>- chage find_ptable fuction call to get_ptable</div>

<div><br></div><div>No problems occur so far and my program run happily with this modify_flags. But can anyone confirm that this is good?</div><div><br></div><div>Thanks,</div><div>Jinghao</div><div><br></div><div>Here is my patch, FYI.</div>

<div><br></div><div><div>--- a/lib/barrelfish/target/x86_32/pmap_target.c<span class="Apple-tab-span" style="white-space:pre">        </span>Wed May 09 19:32:01 2012 +0800</div><div>+++ b/lib/barrelfish/target/x86_32/pmap_target.c<span class="Apple-tab-span" style="white-space:pre">        </span>Wed May 09 19:32:34 2012 +0800</div>

<div>@@ -417,7 +417,47 @@</div><div> static errval_t modify_flags(struct pmap *pmap, genvaddr_t vaddr, size_t size,</div><div>                              vregion_flags_t flags, size_t *retsize)</div><div> {</div><div>-    USER_PANIC(&quot;NYI&quot;);</div>

<div>+    errval_t err, ret;</div><div>+    struct pmap_x86 *x86 = (struct pmap_x86 *)pmap;</div><div>+    size = ROUND_UP(size, X86_32_BASE_PAGE_SIZE);</div><div>+</div><div>+    for (size_t i = 0; i &lt; size; i += X86_32_BASE_PAGE_SIZE) {</div>

<div>+        // Find the page table</div><div>+        struct vnode *ptable ;</div><div>+        err = get_ptable(x86, vaddr + i, &amp;ptable);</div><div>+        if (err_is_fail(err) || ptable == NULL) { // not mapped</div>

<div>+            ret = LIB_ERR_PMAP_FIND_VNODE;</div><div>+            continue;</div><div>+        }</div><div>+</div><div>+        // Find the page</div><div>+        struct vnode *vn = find_vnode(ptable, X86_32_PTABLE_BASE(vaddr + i));</div>

<div>+        if (vn == NULL) { // not mapped</div><div>+            ret = LIB_ERR_PMAP_FIND_VNODE;</div><div>+            continue;</div><div>+        }</div><div>+</div><div>+        // Unmap it in the kernel</div><div>

+        err = vnode_unmap(ptable-&gt;u.vnode.cap, vn-&gt;entry);</div><div>+        if (err_is_fail(err)) {</div><div>+            return err_push(err, LIB_ERR_VNODE_UNMAP);</div><div>+        }</div><div>+</div><div>+        // Remap with changed flags</div>

<div>+        paging_x86_32_flags_t pmap_flags = vregion_to_pmap_flag(flags);</div><div>+        err = vnode_map(ptable-&gt;u.vnode.cap, vn-&gt;u.frame.cap, vn-&gt;entry,</div><div>+                        pmap_flags, vn-&gt;u.frame.offset);</div>

<div>+        if (err_is_fail(err)) {</div><div>+            return err_push(err, LIB_ERR_VNODE_MAP);</div><div>+        }</div><div>+</div><div>+        vn-&gt;u.frame.flags = flags;</div><div>+    }</div><div>+</div><div>

+    if (retsize) {</div><div>+        *retsize = size;</div><div>+    }</div><div>+</div><div>     return SYS_ERR_OK;</div><div> }</div></div><div><br></div><div><br></div><div><br></div>