joshua stein wrote:
> +int
> +cb_parse_table(paddr_t addr)
> +{
> + int i, j;
> +
> + for (i = 0; i < (4 * 1024); i += 16) {
> + struct cb_header *cbh;
> + struct cb_entry *cbe;
> + void *cbtable;
> +
> + cbh = (struct cb_header *)(PMAP_DIRECT_MAP(addr + i));
> + if (memcmp(cbh->signature, "LBIO", 4) != 0)
> + continue;
> +
> + if (!cbh->header_bytes)
> + continue;
> +
> + if (cb_checksum(cbh, sizeof(*cbh)) != 0)
> + return (-1);
> +
> + cbtable = (void *)PMAP_DIRECT_MAP(addr + i + cbh->header_bytes);
> +
> + for (j = 0; j < cbh->table_bytes; j += cbe->size) {
> + cbe = (struct cb_entry *)((char *)cbtable + j);
A small matter, but you can avoid a few casts here by making cbtable vaddr_t.
That is the type returned by PMAP_DIRECT_MAP and supports arithmetic.