| 205 | */ |
| 206 | |
| 207 | u_int32_t |
| 208 | bios_sigsearch(u_int32_t start, u_char *sig, int siglen, int paralen, int sigofs) |
| 209 | { |
| 210 | u_char *sp, *end; |
| 211 | |
| 212 | /* compute the starting address */ |
| 213 | if ((start >= BIOS_START) && (start <= (BIOS_START + BIOS_SIZE))) { |
| 214 | sp = (char *)BIOS_PADDRTOVADDR(start); |
| 215 | } else if (start == 0) { |
| 216 | sp = (char *)BIOS_PADDRTOVADDR(BIOS_START); |
| 217 | } else { |
| 218 | return 0; /* bogus start address */ |
| 219 | } |
| 220 | |
| 221 | /* compute the end address */ |
| 222 | end = (u_char *)BIOS_PADDRTOVADDR(BIOS_START + BIOS_SIZE); |
| 223 | |
| 224 | /* loop searching */ |
| 225 | while ((sp + sigofs + siglen) < end) { |
| 226 | /* compare here */ |
| 227 | if (!bcmp(sp + sigofs, sig, siglen)) { |
| 228 | /* convert back to physical address */ |
| 229 | return((u_int32_t)BIOS_VADDRTOPADDR(sp)); |
| 230 | } |
| 231 | sp += paralen; |
| 232 | } |
| 233 | return(0); |
| 234 | } |
| 235 | |
| 236 | /* |
| 237 | * do not staticize, used by bioscall.s |
no outgoing calls
no test coverage detected