* Walk through the preloaded module list */
| 120 | * Walk through the preloaded module list |
| 121 | */ |
| 122 | caddr_t |
| 123 | preload_search_next_name(caddr_t base) |
| 124 | { |
| 125 | caddr_t curp; |
| 126 | uint32_t *hdr; |
| 127 | int next; |
| 128 | |
| 129 | if (preload_metadata != NULL) { |
| 130 | /* Pick up where we left off last time */ |
| 131 | if (base) { |
| 132 | /* skip to next field */ |
| 133 | curp = base; |
| 134 | hdr = (uint32_t *)curp; |
| 135 | next = sizeof(uint32_t) * 2 + hdr[1]; |
| 136 | next = roundup(next, sizeof(u_long)); |
| 137 | curp += next; |
| 138 | } else |
| 139 | curp = preload_metadata; |
| 140 | |
| 141 | for (;;) { |
| 142 | hdr = (uint32_t *)curp; |
| 143 | if (hdr[0] == 0 && hdr[1] == 0) |
| 144 | break; |
| 145 | |
| 146 | /* Found a new record? */ |
| 147 | if (hdr[0] == MODINFO_NAME) |
| 148 | return curp; |
| 149 | |
| 150 | /* skip to next field */ |
| 151 | next = sizeof(uint32_t) * 2 + hdr[1]; |
| 152 | next = roundup(next, sizeof(u_long)); |
| 153 | curp += next; |
| 154 | } |
| 155 | } |
| 156 | return(NULL); |
| 157 | } |
| 158 | |
| 159 | /* |
| 160 | * Given a preloaded module handle (mod), return a pointer |
no outgoing calls
no test coverage detected