Lines Matching refs:chunk

75 	struct trampchunk *chunk;
93 * Allocate virtual memory for the trampoline chunk. The returned
101 KINST_LOG("trampoline chunk allocation failed: %d", error);
111 /* Allocate a tracker for this chunk. */
112 chunk = malloc(sizeof(*chunk), M_KINST, M_WAITOK);
113 chunk->addr = (void *)trampaddr;
114 BIT_FILL(KINST_TRAMPS_PER_CHUNK, &chunk->free);
116 TAILQ_INSERT_HEAD(&kinst_trampchunks, chunk, next);
118 return (chunk);
122 kinst_trampchunk_free(struct trampchunk *chunk)
126 TAILQ_REMOVE(&kinst_trampchunks, chunk, next);
127 kmem_unback(kernel_object, (vm_offset_t)chunk->addr,
129 (void)vm_map_remove(kernel_map, (vm_offset_t)chunk->addr,
130 (vm_offset_t)(chunk->addr + KINST_TRAMPCHUNK_SIZE));
131 free(chunk, M_KINST);
137 struct trampchunk *chunk;
143 TAILQ_FOREACH(chunk, &kinst_trampchunks, next) {
144 /* All trampolines from this chunk are already allocated. */
145 if ((off = BIT_FFS(KINST_TRAMPS_PER_CHUNK, &chunk->free)) == 0)
151 if (chunk == NULL) {
155 if ((chunk = kinst_trampchunk_alloc()) == NULL) {
176 BIT_CLR(KINST_TRAMPS_PER_CHUNK, off, &chunk->free);
177 tramp = chunk->addr + off * KINST_TRAMP_SIZE;
195 struct trampchunk *chunk;
203 TAILQ_FOREACH(chunk, &kinst_trampchunks, next) {
205 if (chunk->addr + off * KINST_TRAMP_SIZE == tramp) {
208 &chunk->free);
211 &chunk->free))
212 kinst_trampchunk_free(chunk);
217 panic("%s: did not find trampoline chunk for %p", __func__, tramp);
322 struct trampchunk *chunk, *tmp;
341 TAILQ_FOREACH_SAFE(chunk, &kinst_trampchunks, next, tmp)
342 kinst_trampchunk_free(chunk);
345 struct trampchunk *chunk, *tmp;
348 TAILQ_FOREACH_SAFE(chunk, &kinst_trampchunks, next, tmp)
349 kinst_trampchunk_free(chunk);