Hi,<div><br></div><div>I found that x86_32'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't know why it'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("NYI");</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 < 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, &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->u.vnode.cap, vn->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->u.vnode.cap, vn->u.frame.cap, vn->entry,</div><div>+ pmap_flags, vn->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->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>