Exposed SPARC iobus to userspace
[akaros.git] / kern / arch / sparc / env.c
index bb7aa60..7e5b98a 100644 (file)
@@ -91,7 +91,7 @@ restore_fp_state(ancillary_state_t* silly)
 
 // Flush all mapped pages in the user portion of the address space
 // TODO: only supports L3 user pages
-void
+int
 env_user_mem_walk(env_t* e, void* start, size_t len,
                   mem_walk_callback_t callback, void* arg)
 {
@@ -125,11 +125,14 @@ env_user_mem_walk(env_t* e, void* start, size_t len,
                                        L3X(start) : 0;
                        int l3x_end = l1x == l1x_end-1 && l2x == l2x_end-1 && L3X(end) ?
                                      L3X(end) : NL3ENTRIES;
-                       for(int l3x = l3x_start; l3x < l3x_end; l3x++)
+                       for(int l3x = l3x_start, ret; l3x < l3x_end; l3x++)
                                if(l3pt[l3x] & PTE_PTE)
-                                       callback(e,&l3pt[l3x],PGADDR(l1x,l2x,l3x,0),arg);
+                                       if((ret = callback(e,&l3pt[l3x],PGADDR(l1x,l2x,l3x,0),arg)))
+                                               return ret;
                }
        }
+
+       return 0;
 }
 
 void