* Find the successor of a map_entry, using a reader to dereference pointers. * '*clone' is a copy of a vm_map entry. 'reader' is used to copy a map entry * at some address into '*clone'. Change *clone to a copy of the next map * entry, and return the address of that entry, or NULL if copying has failed. * * This function is made available to user-space code that needs to traverse * map ent
| 436 | * map entries. |
| 437 | */ |
| 438 | static inline vm_map_entry_t |
| 439 | vm_map_entry_read_succ(void *token, struct vm_map_entry *const clone, |
| 440 | vm_map_entry_reader reader) |
| 441 | { |
| 442 | vm_map_entry_t after, backup; |
| 443 | vm_offset_t start; |
| 444 | |
| 445 | after = clone->right; |
| 446 | start = clone->start; |
| 447 | if (!reader(token, after, clone)) |
| 448 | return (NULL); |
| 449 | backup = clone->left; |
| 450 | if (!reader(token, backup, clone)) |
| 451 | return (NULL); |
| 452 | if (clone->start > start) { |
| 453 | do { |
| 454 | after = backup; |
| 455 | backup = clone->left; |
| 456 | if (!reader(token, backup, clone)) |
| 457 | return (NULL); |
| 458 | } while (clone->start != start); |
| 459 | } |
| 460 | if (!reader(token, after, clone)) |
| 461 | return (NULL); |
| 462 | return (after); |
| 463 | } |
| 464 | #endif /* ! _KERNEL */ |
| 465 | |
| 466 | #ifdef _KERNEL |