11809ef78SKonstantin Belousov /*-
24d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
31809ef78SKonstantin Belousov *
41809ef78SKonstantin Belousov * Copyright (c) 2019 The FreeBSD Foundation
51809ef78SKonstantin Belousov *
61809ef78SKonstantin Belousov * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
71809ef78SKonstantin Belousov * under sponsorship from the FreeBSD Foundation.
81809ef78SKonstantin Belousov *
91809ef78SKonstantin Belousov * Redistribution and use in source and binary forms, with or without
101809ef78SKonstantin Belousov * modification, are permitted provided that the following conditions
111809ef78SKonstantin Belousov * are met:
121809ef78SKonstantin Belousov * 1. Redistributions of source code must retain the above copyright
131809ef78SKonstantin Belousov * notice, this list of conditions and the following disclaimer.
141809ef78SKonstantin Belousov * 2. Redistributions in binary form must reproduce the above copyright
151809ef78SKonstantin Belousov * notice, this list of conditions and the following disclaimer in the
161809ef78SKonstantin Belousov * documentation and/or other materials provided with the distribution.
171809ef78SKonstantin Belousov *
181809ef78SKonstantin Belousov * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
191809ef78SKonstantin Belousov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201809ef78SKonstantin Belousov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211809ef78SKonstantin Belousov * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
221809ef78SKonstantin Belousov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231809ef78SKonstantin Belousov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
241809ef78SKonstantin Belousov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251809ef78SKonstantin Belousov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
261809ef78SKonstantin Belousov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271809ef78SKonstantin Belousov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281809ef78SKonstantin Belousov * SUCH DAMAGE.
291809ef78SKonstantin Belousov */
301809ef78SKonstantin Belousov
311809ef78SKonstantin Belousov #include <sys/param.h>
321809ef78SKonstantin Belousov #include <sys/kernel.h>
331809ef78SKonstantin Belousov #include <sys/lock.h>
341809ef78SKonstantin Belousov #include <sys/pctrie.h>
351809ef78SKonstantin Belousov #include <sys/rangeset.h>
361809ef78SKonstantin Belousov #include <vm/uma.h>
371809ef78SKonstantin Belousov
381809ef78SKonstantin Belousov #ifdef DIAGNOSTIC
391809ef78SKonstantin Belousov static void rangeset_check(struct rangeset *rs);
401809ef78SKonstantin Belousov #else
411809ef78SKonstantin Belousov #define rangeset_check(rs)
421809ef78SKonstantin Belousov #endif
431809ef78SKonstantin Belousov
441809ef78SKonstantin Belousov static uma_zone_t rs_node_zone;
451809ef78SKonstantin Belousov
461809ef78SKonstantin Belousov static void
rs_rangeset_init(void * arg __unused)471809ef78SKonstantin Belousov rs_rangeset_init(void *arg __unused)
481809ef78SKonstantin Belousov {
491809ef78SKonstantin Belousov
501809ef78SKonstantin Belousov rs_node_zone = uma_zcreate("rangeset pctrie nodes",
511809ef78SKonstantin Belousov pctrie_node_size(), NULL, NULL, pctrie_zone_init, NULL,
521809ef78SKonstantin Belousov UMA_ALIGN_PTR, 0);
531809ef78SKonstantin Belousov }
541809ef78SKonstantin Belousov SYSINIT(rs, SI_SUB_LOCK, SI_ORDER_ANY, rs_rangeset_init, NULL);
551809ef78SKonstantin Belousov
561809ef78SKonstantin Belousov static void *
rs_node_alloc(struct pctrie * ptree)571809ef78SKonstantin Belousov rs_node_alloc(struct pctrie *ptree)
581809ef78SKonstantin Belousov {
591809ef78SKonstantin Belousov struct rangeset *rs;
601809ef78SKonstantin Belousov
611809ef78SKonstantin Belousov rs = __containerof(ptree, struct rangeset, rs_trie);
621809ef78SKonstantin Belousov return (uma_zalloc(rs_node_zone, rs->rs_alloc_flags));
631809ef78SKonstantin Belousov }
641809ef78SKonstantin Belousov
651809ef78SKonstantin Belousov static void
rs_node_free(struct pctrie * ptree __unused,void * node)661809ef78SKonstantin Belousov rs_node_free(struct pctrie *ptree __unused, void *node)
671809ef78SKonstantin Belousov {
681809ef78SKonstantin Belousov
691809ef78SKonstantin Belousov uma_zfree(rs_node_zone, node);
701809ef78SKonstantin Belousov }
711809ef78SKonstantin Belousov
7215047a65SDoug Moore PCTRIE_DEFINE(RANGESET, rs_el, re_start, rs_node_alloc, rs_node_free);
7315047a65SDoug Moore
741809ef78SKonstantin Belousov void
rangeset_init(struct rangeset * rs,rs_dup_data_t dup_data,rs_free_data_t free_data,void * data_ctx,u_int alloc_flags)751809ef78SKonstantin Belousov rangeset_init(struct rangeset *rs, rs_dup_data_t dup_data,
761809ef78SKonstantin Belousov rs_free_data_t free_data, void *data_ctx, u_int alloc_flags)
771809ef78SKonstantin Belousov {
781809ef78SKonstantin Belousov
791809ef78SKonstantin Belousov pctrie_init(&rs->rs_trie);
801809ef78SKonstantin Belousov rs->rs_dup_data = dup_data;
811809ef78SKonstantin Belousov rs->rs_free_data = free_data;
821809ef78SKonstantin Belousov rs->rs_data_ctx = data_ctx;
831809ef78SKonstantin Belousov rs->rs_alloc_flags = alloc_flags;
841809ef78SKonstantin Belousov }
851809ef78SKonstantin Belousov
861809ef78SKonstantin Belousov void
rangeset_fini(struct rangeset * rs)871809ef78SKonstantin Belousov rangeset_fini(struct rangeset *rs)
881809ef78SKonstantin Belousov {
891809ef78SKonstantin Belousov
901809ef78SKonstantin Belousov rangeset_check(rs);
911809ef78SKonstantin Belousov rangeset_remove_all(rs);
921809ef78SKonstantin Belousov }
931809ef78SKonstantin Belousov
941809ef78SKonstantin Belousov bool
rangeset_check_empty(struct rangeset * rs,uint64_t start,uint64_t end)951809ef78SKonstantin Belousov rangeset_check_empty(struct rangeset *rs, uint64_t start, uint64_t end)
961809ef78SKonstantin Belousov {
971809ef78SKonstantin Belousov struct rs_el *r;
981809ef78SKonstantin Belousov
991809ef78SKonstantin Belousov rangeset_check(rs);
10015047a65SDoug Moore r = RANGESET_PCTRIE_LOOKUP_LE(&rs->rs_trie, end);
10115047a65SDoug Moore return (r == NULL || r->re_end <= start);
1021809ef78SKonstantin Belousov }
1031809ef78SKonstantin Belousov
1041809ef78SKonstantin Belousov int
rangeset_insert(struct rangeset * rs,uint64_t start,uint64_t end,void * data)1051809ef78SKonstantin Belousov rangeset_insert(struct rangeset *rs, uint64_t start, uint64_t end,
1061809ef78SKonstantin Belousov void *data)
1071809ef78SKonstantin Belousov {
1081809ef78SKonstantin Belousov struct rs_el *r;
1091809ef78SKonstantin Belousov int error;
1101809ef78SKonstantin Belousov
1111809ef78SKonstantin Belousov rangeset_check(rs);
1121809ef78SKonstantin Belousov error = rangeset_remove(rs, start, end);
1131809ef78SKonstantin Belousov if (error != 0)
1141809ef78SKonstantin Belousov return (error);
1151809ef78SKonstantin Belousov r = data;
1161809ef78SKonstantin Belousov r->re_start = start;
1171809ef78SKonstantin Belousov r->re_end = end;
11815047a65SDoug Moore error = RANGESET_PCTRIE_INSERT(&rs->rs_trie, r);
1191809ef78SKonstantin Belousov rangeset_check(rs);
1201809ef78SKonstantin Belousov return (error);
1211809ef78SKonstantin Belousov }
1221809ef78SKonstantin Belousov
1231809ef78SKonstantin Belousov int
rangeset_remove_pred(struct rangeset * rs,uint64_t start,uint64_t end,rs_pred_t pred)1241809ef78SKonstantin Belousov rangeset_remove_pred(struct rangeset *rs, uint64_t start, uint64_t end,
1251809ef78SKonstantin Belousov rs_pred_t pred)
1261809ef78SKonstantin Belousov {
1271809ef78SKonstantin Belousov struct rs_el *r, *rn;
1281809ef78SKonstantin Belousov int error;
1291809ef78SKonstantin Belousov
1301809ef78SKonstantin Belousov rangeset_check(rs);
1311809ef78SKonstantin Belousov error = 0;
1321809ef78SKonstantin Belousov for (; end > 0 && start < end;) {
13315047a65SDoug Moore r = RANGESET_PCTRIE_LOOKUP_LE(&rs->rs_trie, end - 1);
13415047a65SDoug Moore if (r == NULL)
1351809ef78SKonstantin Belousov break;
1361809ef78SKonstantin Belousov
1371809ef78SKonstantin Belousov /*
1381809ef78SKonstantin Belousov * ------============================--|-------|----
1391809ef78SKonstantin Belousov * rs re s e
1401809ef78SKonstantin Belousov */
1411809ef78SKonstantin Belousov if (r->re_end <= start)
1421809ef78SKonstantin Belousov break;
1431809ef78SKonstantin Belousov
1441809ef78SKonstantin Belousov if (r->re_end <= end) {
1451809ef78SKonstantin Belousov if (r->re_start < start) {
1461809ef78SKonstantin Belousov /*
1471809ef78SKonstantin Belousov * ------========|==============-------|----
1481809ef78SKonstantin Belousov * rs s re e
1491809ef78SKonstantin Belousov */
1501809ef78SKonstantin Belousov if (pred(rs->rs_data_ctx, r))
1511809ef78SKonstantin Belousov r->re_end = start;
1521809ef78SKonstantin Belousov break;
1531809ef78SKonstantin Belousov }
1541809ef78SKonstantin Belousov
1551809ef78SKonstantin Belousov /*
1561809ef78SKonstantin Belousov * ------|--------===================----------|----
1571809ef78SKonstantin Belousov * s rs re e
1581809ef78SKonstantin Belousov */
1591809ef78SKonstantin Belousov end = r->re_start;
1601809ef78SKonstantin Belousov if (pred(rs->rs_data_ctx, r)) {
16115047a65SDoug Moore RANGESET_PCTRIE_REMOVE(&rs->rs_trie,
16215047a65SDoug Moore r->re_start);
1631809ef78SKonstantin Belousov rs->rs_free_data(rs->rs_data_ctx, r);
1641809ef78SKonstantin Belousov }
1651809ef78SKonstantin Belousov continue;
1661809ef78SKonstantin Belousov }
1671809ef78SKonstantin Belousov
1681809ef78SKonstantin Belousov /*
1691809ef78SKonstantin Belousov * ------|--------====================|==========----
1701809ef78SKonstantin Belousov * s rs e re
1711809ef78SKonstantin Belousov */
1721809ef78SKonstantin Belousov if (r->re_start >= start) {
1731809ef78SKonstantin Belousov if (pred(rs->rs_data_ctx, r)) {
17415047a65SDoug Moore RANGESET_PCTRIE_REMOVE(&rs->rs_trie,
17515047a65SDoug Moore r->re_start);
1761809ef78SKonstantin Belousov r->re_start = end;
17715047a65SDoug Moore error = RANGESET_PCTRIE_INSERT(&rs->rs_trie, r);
1781809ef78SKonstantin Belousov /*
1791809ef78SKonstantin Belousov * The insert above must succeed
1801809ef78SKonstantin Belousov * because rs_node zone is marked
1811809ef78SKonstantin Belousov * nofree and we freed one element
1821809ef78SKonstantin Belousov * just before.
1831809ef78SKonstantin Belousov */
1841809ef78SKonstantin Belousov MPASS(error == 0);
1851809ef78SKonstantin Belousov } else {
1861809ef78SKonstantin Belousov end = r->re_start;
1871809ef78SKonstantin Belousov }
1881809ef78SKonstantin Belousov continue;
1891809ef78SKonstantin Belousov }
1901809ef78SKonstantin Belousov
1911809ef78SKonstantin Belousov /*
1921809ef78SKonstantin Belousov * ------=========|===================|==========----
1931809ef78SKonstantin Belousov * rs s e re
1941809ef78SKonstantin Belousov */
1951809ef78SKonstantin Belousov if (pred(rs->rs_data_ctx, r)) {
1961809ef78SKonstantin Belousov /*
1971809ef78SKonstantin Belousov * Split. Can only happen once, and then if
1981809ef78SKonstantin Belousov * any allocation fails, the rangeset is kept
1991809ef78SKonstantin Belousov * intact.
2001809ef78SKonstantin Belousov */
2011809ef78SKonstantin Belousov rn = rs->rs_dup_data(rs->rs_data_ctx, r);
2021809ef78SKonstantin Belousov if (rn == NULL) {
2031809ef78SKonstantin Belousov error = ENOMEM;
2041809ef78SKonstantin Belousov break;
2051809ef78SKonstantin Belousov }
2061809ef78SKonstantin Belousov rn->re_start = end;
2071809ef78SKonstantin Belousov rn->re_end = r->re_end;
20815047a65SDoug Moore error = RANGESET_PCTRIE_INSERT(&rs->rs_trie, rn);
2091809ef78SKonstantin Belousov if (error != 0) {
2101809ef78SKonstantin Belousov rs->rs_free_data(rs->rs_data_ctx, rn);
2111809ef78SKonstantin Belousov break;
2121809ef78SKonstantin Belousov }
2131809ef78SKonstantin Belousov r->re_end = start;
2141809ef78SKonstantin Belousov }
2151809ef78SKonstantin Belousov break;
2161809ef78SKonstantin Belousov }
2171809ef78SKonstantin Belousov rangeset_check(rs);
2181809ef78SKonstantin Belousov return (error);
2191809ef78SKonstantin Belousov }
2201809ef78SKonstantin Belousov
2211809ef78SKonstantin Belousov static bool
rangeset_true_pred(void * ctx __unused,void * r __unused)2221809ef78SKonstantin Belousov rangeset_true_pred(void *ctx __unused, void *r __unused)
2231809ef78SKonstantin Belousov {
2241809ef78SKonstantin Belousov
2251809ef78SKonstantin Belousov return (true);
2261809ef78SKonstantin Belousov }
2271809ef78SKonstantin Belousov
2281809ef78SKonstantin Belousov int
rangeset_remove(struct rangeset * rs,uint64_t start,uint64_t end)2291809ef78SKonstantin Belousov rangeset_remove(struct rangeset *rs, uint64_t start, uint64_t end)
2301809ef78SKonstantin Belousov {
2311809ef78SKonstantin Belousov
2321809ef78SKonstantin Belousov return (rangeset_remove_pred(rs, start, end, rangeset_true_pred));
2331809ef78SKonstantin Belousov }
2341809ef78SKonstantin Belousov
235a7f67ebdSDoug Moore static void
rangeset_remove_leaf(struct rs_el * r,void * rsv)2362a21cfe6SDoug Moore rangeset_remove_leaf(struct rs_el *r, void *rsv)
237a7f67ebdSDoug Moore {
238a7f67ebdSDoug Moore struct rangeset *rs = rsv;
239a7f67ebdSDoug Moore
240a7f67ebdSDoug Moore rs->rs_free_data(rs->rs_data_ctx, r);
241a7f67ebdSDoug Moore }
242a7f67ebdSDoug Moore
2431809ef78SKonstantin Belousov void
rangeset_remove_all(struct rangeset * rs)2441809ef78SKonstantin Belousov rangeset_remove_all(struct rangeset *rs)
2451809ef78SKonstantin Belousov {
246a7f67ebdSDoug Moore RANGESET_PCTRIE_RECLAIM_CALLBACK(&rs->rs_trie,
247a7f67ebdSDoug Moore rangeset_remove_leaf, rs);
2481809ef78SKonstantin Belousov }
2491809ef78SKonstantin Belousov
2501809ef78SKonstantin Belousov void *
rangeset_containing(struct rangeset * rs,uint64_t place)251*8aa2cd9dSDoug Moore rangeset_containing(struct rangeset *rs, uint64_t place)
2521809ef78SKonstantin Belousov {
2531809ef78SKonstantin Belousov struct rs_el *r;
2541809ef78SKonstantin Belousov
2551809ef78SKonstantin Belousov rangeset_check(rs);
25615047a65SDoug Moore r = RANGESET_PCTRIE_LOOKUP_LE(&rs->rs_trie, place);
257*8aa2cd9dSDoug Moore if (r != NULL && place < r->re_end)
2581809ef78SKonstantin Belousov return (r);
259*8aa2cd9dSDoug Moore return (NULL);
260*8aa2cd9dSDoug Moore }
261*8aa2cd9dSDoug Moore
262*8aa2cd9dSDoug Moore bool
rangeset_empty(struct rangeset * rs,uint64_t start,uint64_t end)263*8aa2cd9dSDoug Moore rangeset_empty(struct rangeset *rs, uint64_t start, uint64_t end)
264*8aa2cd9dSDoug Moore {
265*8aa2cd9dSDoug Moore struct rs_el *r;
266*8aa2cd9dSDoug Moore
267*8aa2cd9dSDoug Moore r = RANGESET_PCTRIE_LOOKUP_GE(&rs->rs_trie, start + 1);
268*8aa2cd9dSDoug Moore return (r == NULL || r->re_start >= end);
2691809ef78SKonstantin Belousov }
2701809ef78SKonstantin Belousov
2712c10bacdSDoug Moore void *
rangeset_beginning(struct rangeset * rs,uint64_t place)272*8aa2cd9dSDoug Moore rangeset_beginning(struct rangeset *rs, uint64_t place)
2732c10bacdSDoug Moore {
2742c10bacdSDoug Moore
2752c10bacdSDoug Moore rangeset_check(rs);
276*8aa2cd9dSDoug Moore return (RANGESET_PCTRIE_LOOKUP(&rs->rs_trie, place));
2772c10bacdSDoug Moore }
2782c10bacdSDoug Moore
2791809ef78SKonstantin Belousov int
rangeset_copy(struct rangeset * dst_rs,struct rangeset * src_rs)2801809ef78SKonstantin Belousov rangeset_copy(struct rangeset *dst_rs, struct rangeset *src_rs)
2811809ef78SKonstantin Belousov {
2821809ef78SKonstantin Belousov struct rs_el *src_r, *dst_r;
28315047a65SDoug Moore uint64_t cursor;
2841809ef78SKonstantin Belousov int error;
2851809ef78SKonstantin Belousov
2861809ef78SKonstantin Belousov MPASS(pctrie_is_empty(&dst_rs->rs_trie));
2871809ef78SKonstantin Belousov rangeset_check(src_rs);
2881809ef78SKonstantin Belousov MPASS(dst_rs->rs_dup_data == src_rs->rs_dup_data);
2891809ef78SKonstantin Belousov
2901809ef78SKonstantin Belousov error = 0;
2911809ef78SKonstantin Belousov for (cursor = 0;; cursor = src_r->re_start + 1) {
29215047a65SDoug Moore src_r = RANGESET_PCTRIE_LOOKUP_GE(&src_rs->rs_trie, cursor);
29315047a65SDoug Moore if (src_r == NULL)
2941809ef78SKonstantin Belousov break;
2951809ef78SKonstantin Belousov dst_r = dst_rs->rs_dup_data(dst_rs->rs_data_ctx, src_r);
2961809ef78SKonstantin Belousov if (dst_r == NULL) {
2971809ef78SKonstantin Belousov error = ENOMEM;
2981809ef78SKonstantin Belousov break;
2991809ef78SKonstantin Belousov }
30015047a65SDoug Moore error = RANGESET_PCTRIE_INSERT(&dst_rs->rs_trie, dst_r);
3011809ef78SKonstantin Belousov if (error != 0)
3021809ef78SKonstantin Belousov break;
3031809ef78SKonstantin Belousov }
3041809ef78SKonstantin Belousov if (error != 0)
3051809ef78SKonstantin Belousov rangeset_remove_all(dst_rs);
3061809ef78SKonstantin Belousov return (error);
3071809ef78SKonstantin Belousov }
3081809ef78SKonstantin Belousov
3091809ef78SKonstantin Belousov #ifdef DIAGNOSTIC
3101809ef78SKonstantin Belousov static void
rangeset_check(struct rangeset * rs)3111809ef78SKonstantin Belousov rangeset_check(struct rangeset *rs)
3121809ef78SKonstantin Belousov {
3131809ef78SKonstantin Belousov struct rs_el *r, *rp;
31415047a65SDoug Moore uint64_t cursor;
3151809ef78SKonstantin Belousov
3161809ef78SKonstantin Belousov for (cursor = 0, rp = NULL;; cursor = r->re_start + 1, rp = r) {
31715047a65SDoug Moore r = RANGESET_PCTRIE_LOOKUP_GE(&rs->rs_trie, cursor);
31815047a65SDoug Moore if (r == NULL)
3191809ef78SKonstantin Belousov break;
3201809ef78SKonstantin Belousov KASSERT(r->re_start < r->re_end,
3211809ef78SKonstantin Belousov ("invalid interval rs %p elem %p (%#jx, %#jx)",
3221809ef78SKonstantin Belousov rs, r, (uintmax_t)r->re_start, (uintmax_t)r->re_end));
3231809ef78SKonstantin Belousov if (rp != NULL) {
3241809ef78SKonstantin Belousov KASSERT(rp->re_end <= r->re_start,
3251809ef78SKonstantin Belousov ("non-ascending neighbors rs %p "
3261809ef78SKonstantin Belousov "prev elem %p (%#jx, %#jx) elem %p (%#jx, %#jx)",
3271809ef78SKonstantin Belousov rs, rp, (uintmax_t)rp->re_start,
3281809ef78SKonstantin Belousov (uintmax_t)rp->re_end, r, (uintmax_t)r->re_start,
3291809ef78SKonstantin Belousov (uintmax_t)r->re_end));
3301809ef78SKonstantin Belousov }
3311809ef78SKonstantin Belousov }
3321809ef78SKonstantin Belousov }
3331809ef78SKonstantin Belousov #endif
3341809ef78SKonstantin Belousov
3351809ef78SKonstantin Belousov #include "opt_ddb.h"
3361809ef78SKonstantin Belousov #ifdef DDB
3371809ef78SKonstantin Belousov #include <sys/kernel.h>
3381809ef78SKonstantin Belousov #include <ddb/ddb.h>
3391809ef78SKonstantin Belousov
DB_SHOW_COMMAND(rangeset,rangeset_show_fn)3401809ef78SKonstantin Belousov DB_SHOW_COMMAND(rangeset, rangeset_show_fn)
3411809ef78SKonstantin Belousov {
3421809ef78SKonstantin Belousov struct rangeset *rs;
3431809ef78SKonstantin Belousov struct rs_el *r;
34415047a65SDoug Moore uint64_t cursor;
3451809ef78SKonstantin Belousov
3461809ef78SKonstantin Belousov if (!have_addr) {
3471809ef78SKonstantin Belousov db_printf("show rangeset addr\n");
3481809ef78SKonstantin Belousov return;
3491809ef78SKonstantin Belousov }
3501809ef78SKonstantin Belousov
3511809ef78SKonstantin Belousov rs = (struct rangeset *)addr;
3521809ef78SKonstantin Belousov db_printf("rangeset %p\n", rs);
3531809ef78SKonstantin Belousov for (cursor = 0;; cursor = r->re_start + 1) {
35415047a65SDoug Moore r = RANGESET_PCTRIE_LOOKUP_GE(&rs->rs_trie, cursor);
35515047a65SDoug Moore if (r == NULL)
3561809ef78SKonstantin Belousov break;
3571809ef78SKonstantin Belousov db_printf(" el %p start %#jx end %#jx\n",
3581809ef78SKonstantin Belousov r, r->re_start, r->re_end);
3591809ef78SKonstantin Belousov }
3601809ef78SKonstantin Belousov }
3611809ef78SKonstantin Belousov #endif
362