Home | History | Annotate | Line # | Download | only in arm32
kobj_machdep.c revision 1.9.4.1
      1  1.9.4.1    snj /*	$NetBSD: kobj_machdep.c,v 1.9.4.1 2014/11/14 08:16:56 snj Exp $	*/
      2      1.1     ad 
      3      1.1     ad /*-
      4      1.1     ad  * Copyright (c) 2008 The NetBSD Foundation, Inc.
      5      1.1     ad  * All rights reserved.
      6      1.1     ad  *
      7      1.1     ad  * Redistribution and use in source and binary forms, with or without
      8      1.1     ad  * modification, are permitted provided that the following conditions
      9      1.1     ad  * are met:
     10      1.1     ad  * 1. Redistributions of source code must retain the above copyright
     11      1.1     ad  *    notice, this list of conditions and the following disclaimer.
     12      1.1     ad  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1     ad  *    notice, this list of conditions and the following disclaimer in the
     14      1.1     ad  *    documentation and/or other materials provided with the distribution.
     15      1.1     ad  *
     16      1.1     ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17      1.1     ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18      1.1     ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19      1.1     ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20      1.1     ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21      1.1     ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22      1.1     ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23      1.1     ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24      1.1     ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25      1.1     ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26      1.1     ad  * POSSIBILITY OF SUCH DAMAGE.
     27      1.1     ad  */
     28      1.1     ad 
     29      1.1     ad /*-
     30      1.1     ad  * Copyright 1996-1998 John D. Polstra.
     31      1.1     ad  * All rights reserved.
     32      1.1     ad  *
     33      1.1     ad  * Redistribution and use in source and binary forms, with or without
     34      1.1     ad  * modification, are permitted provided that the following conditions
     35      1.1     ad  * are met:
     36      1.1     ad  * 1. Redistributions of source code must retain the above copyright
     37      1.1     ad  *    notice, this list of conditions and the following disclaimer.
     38      1.1     ad  * 2. Redistributions in binary form must reproduce the above copyright
     39      1.1     ad  *    notice, this list of conditions and the following disclaimer in the
     40      1.1     ad  *    documentation and/or other materials provided with the distribution.
     41      1.1     ad  *
     42      1.1     ad  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     43      1.1     ad  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     44      1.1     ad  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     45      1.1     ad  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     46      1.1     ad  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     47      1.1     ad  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     48      1.1     ad  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     49      1.1     ad  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     50      1.1     ad  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     51      1.1     ad  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     52      1.1     ad  */
     53      1.1     ad 
     54      1.1     ad #include <sys/cdefs.h>
     55  1.9.4.1    snj __KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.9.4.1 2014/11/14 08:16:56 snj Exp $");
     56      1.1     ad 
     57      1.1     ad #define	ELFSIZE		ARCH_ELFSIZE
     58      1.1     ad 
     59      1.1     ad #include <sys/param.h>
     60      1.1     ad #include <sys/systm.h>
     61      1.1     ad #include <sys/kobj.h>
     62      1.1     ad #include <sys/exec.h>
     63      1.1     ad #include <sys/exec_elf.h>
     64  1.9.4.1    snj #include <sys/kmem.h>
     65  1.9.4.1    snj #include <sys/ksyms.h>
     66  1.9.4.1    snj #include <sys/kobj_impl.h>
     67      1.1     ad 
     68      1.1     ad #include <arm/cpufunc.h>
     69  1.9.4.1    snj #include <arm/locore.h>
     70      1.1     ad 
     71      1.1     ad int
     72      1.1     ad kobj_reloc(kobj_t ko, uintptr_t relocbase, const void *data,
     73      1.1     ad 	   bool isrela, bool local)
     74      1.1     ad {
     75      1.1     ad 	Elf_Addr *where;
     76      1.1     ad 	Elf_Addr addr;
     77      1.1     ad 	Elf_Addr addend;
     78      1.1     ad 	Elf_Word rtype, symidx;
     79      1.1     ad 	const Elf_Rel *rel;
     80      1.1     ad 	const Elf_Rela *rela;
     81      1.1     ad 
     82      1.1     ad 	if (isrela) {
     83      1.1     ad 		rela = (const Elf_Rela *)data;
     84      1.1     ad 		where = (Elf_Addr *) (relocbase + rela->r_offset);
     85      1.1     ad 		addend = rela->r_addend;
     86      1.1     ad 		rtype = ELF_R_TYPE(rela->r_info);
     87      1.1     ad 		symidx = ELF_R_SYM(rela->r_info);
     88      1.1     ad 	} else {
     89      1.1     ad 		rel = (const Elf_Rel *)data;
     90      1.1     ad 		where = (Elf_Addr *) (relocbase + rel->r_offset);
     91      1.1     ad 		addend = *where;
     92      1.1     ad 		rtype = ELF_R_TYPE(rel->r_info);
     93      1.1     ad 		symidx = ELF_R_SYM(rel->r_info);
     94      1.1     ad 	}
     95      1.1     ad 
     96      1.1     ad 	switch (rtype) {
     97      1.1     ad 	case R_ARM_NONE:	/* none */
     98      1.4   matt 	case R_ARM_V4BX:	/* none */
     99      1.3    dsl 		return 0;
    100      1.1     ad 
    101      1.1     ad 	case R_ARM_ABS32:
    102      1.1     ad 		addr = kobj_sym_lookup(ko, symidx);
    103      1.1     ad 		if (addr == 0)
    104      1.3    dsl 			break;
    105      1.3    dsl 		*where = addr + addend;
    106      1.3    dsl 		return 0;
    107      1.1     ad 
    108      1.3    dsl 	case R_ARM_COPY:	/* none */
    109      1.3    dsl 		/* There shouldn't be copy relocations in kernel objects. */
    110      1.1     ad 		break;
    111      1.1     ad 
    112      1.1     ad 	case R_ARM_JUMP_SLOT:
    113      1.1     ad 		addr = kobj_sym_lookup(ko, symidx);
    114      1.3    dsl 		if (addr == 0)
    115      1.3    dsl 			break;
    116      1.3    dsl 		*where = addr;
    117      1.3    dsl 		return 0;
    118      1.1     ad 
    119      1.1     ad 	case R_ARM_RELATIVE:	/* A + B */
    120      1.1     ad 		addr = relocbase + addend;
    121      1.1     ad 		if (*where != addr)
    122      1.1     ad 			*where = addr;
    123      1.3    dsl 		return 0;
    124      1.3    dsl 
    125      1.8  skrll 	case R_ARM_MOVW_ABS_NC:	/* (S + A) | T */
    126      1.4   matt 	case R_ARM_MOVT_ABS:
    127      1.7   matt 		if ((*where & 0x0fb00000) != 0x03000000)
    128      1.7   matt 			break;
    129      1.4   matt 		addr = kobj_sym_lookup(ko, symidx);
    130      1.4   matt 		if (addr == 0)
    131      1.4   matt 			break;
    132      1.4   matt 		if (rtype == R_ARM_MOVT_ABS)
    133      1.4   matt 			addr >>= 16;
    134      1.4   matt 		*where = (*where & 0xfff0f000)
    135      1.4   matt 		    | ((addr << 4) & 0x000f0000) | (addr & 0x00000fff);
    136      1.4   matt 		return 0;
    137      1.4   matt 
    138      1.8  skrll 	case R_ARM_CALL:	/* ((S + A) | T) -  P */
    139      1.4   matt 	case R_ARM_JUMP24:
    140      1.8  skrll 	case R_ARM_PC24:	/* Deprecated */
    141      1.4   matt 		if (local && (*where & 0x00ffffff) != 0x00fffffe)
    142      1.3    dsl 			return 0;
    143      1.3    dsl 
    144      1.3    dsl 		/* Remove the instruction from the 24 bit offset */
    145      1.3    dsl 		addend &= 0x00ffffff;
    146      1.3    dsl 
    147      1.3    dsl 		/* Sign extend if necessary */
    148      1.3    dsl 		if (addend & 0x00800000)
    149      1.3    dsl 			addend |= 0xff000000;
    150      1.3    dsl 
    151      1.4   matt 		addend <<= 2;
    152      1.4   matt 
    153      1.3    dsl 		addr = kobj_sym_lookup(ko, symidx);
    154      1.3    dsl 		if (addr == 0)
    155      1.3    dsl 			break;
    156      1.3    dsl 
    157      1.6   matt 		addend += (uintptr_t)addr - (uintptr_t)where;
    158      1.3    dsl 
    159      1.4   matt 		if (addend & 3) {
    160      1.4   matt 			printf ("Relocation %x unaligned @ %p\n", addend, where);
    161      1.4   matt 			return -1;
    162      1.4   matt 		}
    163      1.4   matt 
    164      1.4   matt 		if ((addend & 0xfe000000) != 0x00000000 &&
    165      1.4   matt 		    (addend & 0xfe000000) != 0xfe000000) {
    166      1.3    dsl 			printf ("Relocation %x too far @ %p\n", addend, where);
    167      1.3    dsl 			return -1;
    168      1.3    dsl 		}
    169      1.4   matt 		*where = (*where & 0xff000000) | ((addend >> 2) & 0x00ffffff);
    170      1.3    dsl 		return 0;
    171      1.1     ad 
    172      1.8  skrll 	case R_ARM_REL32:	/* ((S + A) | T) -  P */
    173      1.8  skrll 		/* T = 0 for now */
    174      1.8  skrll 		addr = kobj_sym_lookup(ko, symidx);
    175      1.8  skrll 		if (addr == 0)
    176      1.8  skrll 			break;
    177      1.8  skrll 
    178      1.8  skrll 		addend += (uintptr_t)addr - (uintptr_t)where;
    179      1.8  skrll 		*where = addend;
    180      1.8  skrll 		return 0;
    181      1.8  skrll 
    182      1.8  skrll 	case R_ARM_PREL31:	/* ((S + A) | T) -  P */
    183      1.8  skrll 		/* Sign extend if necessary */
    184      1.8  skrll 		if (addend & 0x40000000)
    185      1.8  skrll 			addend |= 0xc0000000;
    186      1.8  skrll 		/* T = 0 for now */
    187      1.8  skrll 		addr = kobj_sym_lookup(ko, symidx);
    188      1.8  skrll 		if (addr == 0)
    189      1.8  skrll 			break;
    190      1.8  skrll 
    191      1.8  skrll 		addend += (uintptr_t)addr - (uintptr_t)where;
    192      1.8  skrll 
    193      1.8  skrll 		if ((addend & 0x80000000) != 0x00000000 &&
    194      1.8  skrll 		    (addend & 0x80000000) != 0x80000000) {
    195      1.8  skrll 			printf ("Relocation %x too far @ %p\n", addend, where);
    196      1.8  skrll 			return -1;
    197      1.8  skrll 		}
    198      1.8  skrll 
    199      1.8  skrll 		*where = (*where & 0x80000000) | (addend & 0x7fffffff);
    200      1.8  skrll 
    201      1.1     ad 	default:
    202      1.3    dsl 		break;
    203      1.1     ad 	}
    204      1.3    dsl 
    205      1.3    dsl 	printf("kobj_reloc: unexpected/invalid relocation type %d @ %p symidx %u\n",
    206      1.3    dsl 	    rtype, where, symidx);
    207      1.3    dsl 	return -1;
    208      1.1     ad }
    209      1.1     ad 
    210  1.9.4.1    snj #if __ARMEB__
    211  1.9.4.1    snj 
    212  1.9.4.1    snj enum be8_magic_sym_type {
    213  1.9.4.1    snj 	Other, ArmStart, ThumbStart, DataStart
    214  1.9.4.1    snj };
    215  1.9.4.1    snj 
    216  1.9.4.1    snj struct be8_marker {
    217  1.9.4.1    snj 	enum be8_magic_sym_type type;
    218  1.9.4.1    snj 	void *addr;
    219  1.9.4.1    snj };
    220  1.9.4.1    snj 
    221  1.9.4.1    snj struct be8_marker_list {
    222  1.9.4.1    snj 	size_t cnt;
    223  1.9.4.1    snj 	struct be8_marker *markers;
    224  1.9.4.1    snj };
    225  1.9.4.1    snj 
    226  1.9.4.1    snj /*
    227  1.9.4.1    snj  * See ELF for the ARM Architecture, Section 4.5.5: Mapping Symbols
    228  1.9.4.1    snj  * ARM reserves $a/$d/$t (and variants like $a.2) to mark start of
    229  1.9.4.1    snj  * arm/thumb code sections to allow conversion from ARM32-EB to -BE8
    230  1.9.4.1    snj  * format.
    231  1.9.4.1    snj  */
    232  1.9.4.1    snj static enum be8_magic_sym_type
    233  1.9.4.1    snj be8_sym_type(const char *name, int info)
    234  1.9.4.1    snj {
    235  1.9.4.1    snj 	if (ELF_ST_BIND(info) != STB_LOCAL)
    236  1.9.4.1    snj 		return Other;
    237  1.9.4.1    snj 	if (ELF_ST_TYPE(info) != STT_NOTYPE)
    238  1.9.4.1    snj 		return Other;
    239  1.9.4.1    snj 	if (name[0] != '$' || name[1] == '\0' ||
    240  1.9.4.1    snj 	    (name[2] != '\0' && name[2] != '.'))
    241  1.9.4.1    snj 		return Other;
    242  1.9.4.1    snj 
    243  1.9.4.1    snj 	switch (name[1]) {
    244  1.9.4.1    snj 	case 'a':
    245  1.9.4.1    snj 		return ArmStart;
    246  1.9.4.1    snj 	case 'd':
    247  1.9.4.1    snj 		return DataStart;
    248  1.9.4.1    snj 	case 't':
    249  1.9.4.1    snj 		return ThumbStart;
    250  1.9.4.1    snj 	default:
    251  1.9.4.1    snj 		return Other;
    252  1.9.4.1    snj 	}
    253  1.9.4.1    snj }
    254  1.9.4.1    snj 
    255  1.9.4.1    snj static int
    256  1.9.4.1    snj be8_ksym_count(const char *name, int symindex, void *value, uint32_t size,
    257  1.9.4.1    snj 	int info, void *cookie)
    258  1.9.4.1    snj {
    259  1.9.4.1    snj 	size_t *res = cookie;
    260  1.9.4.1    snj 	enum be8_magic_sym_type t = be8_sym_type(name, info);
    261  1.9.4.1    snj 
    262  1.9.4.1    snj 	if (t != Other)
    263  1.9.4.1    snj 		(*res)++;
    264  1.9.4.1    snj 	return 0;
    265  1.9.4.1    snj }
    266  1.9.4.1    snj 
    267  1.9.4.1    snj static int
    268  1.9.4.1    snj be8_ksym_add(const char *name, int symindex, void *value, uint32_t size,
    269  1.9.4.1    snj 	int info, void *cookie)
    270  1.9.4.1    snj {
    271  1.9.4.1    snj 	size_t ndx;
    272  1.9.4.1    snj 	struct be8_marker_list *list = cookie;
    273  1.9.4.1    snj 	enum be8_magic_sym_type t = be8_sym_type(name, info);
    274  1.9.4.1    snj 
    275  1.9.4.1    snj 	if (t == Other)
    276  1.9.4.1    snj 		return 0;
    277  1.9.4.1    snj 
    278  1.9.4.1    snj 	ndx = list->cnt++;
    279  1.9.4.1    snj 	list->markers[ndx].type = t;
    280  1.9.4.1    snj 	list->markers[ndx].addr = value;
    281  1.9.4.1    snj 
    282  1.9.4.1    snj 	return 0;
    283  1.9.4.1    snj }
    284  1.9.4.1    snj 
    285  1.9.4.1    snj static int
    286  1.9.4.1    snj be8_ksym_comp(const void *a, const void *b)
    287  1.9.4.1    snj {
    288  1.9.4.1    snj 	const struct be8_marker *ma = a, *mb = b;
    289  1.9.4.1    snj 	uintptr_t va = (uintptr_t)ma->addr, vb = (uintptr_t)mb->addr;
    290  1.9.4.1    snj 
    291  1.9.4.1    snj 	if (va == vb)
    292  1.9.4.1    snj 		return 0;
    293  1.9.4.1    snj 	if (va < vb)
    294  1.9.4.1    snj 		return -1;
    295  1.9.4.1    snj 	return 1;
    296  1.9.4.1    snj }
    297  1.9.4.1    snj 
    298  1.9.4.1    snj static void
    299  1.9.4.1    snj be8_ksym_swap(void *start, size_t size, const struct be8_marker_list *list)
    300  1.9.4.1    snj {
    301  1.9.4.1    snj 	uintptr_t va_end = (uintptr_t)start + size;
    302  1.9.4.1    snj 	size_t i;
    303  1.9.4.1    snj 	uint32_t *p32, *p32_end, v32;
    304  1.9.4.1    snj 	uint16_t *p16, *p16_end, v16;
    305  1.9.4.1    snj 
    306  1.9.4.1    snj 	/* find first relevant list entry */
    307  1.9.4.1    snj 	for (i = 0; i < list->cnt; i++)
    308  1.9.4.1    snj 		if (start <= list->markers[i].addr)
    309  1.9.4.1    snj 			break;
    310  1.9.4.1    snj 
    311  1.9.4.1    snj 	/* swap all arm and thumb code parts of this section */
    312  1.9.4.1    snj 	for ( ; i < list->cnt; i++) {
    313  1.9.4.1    snj 		switch (list->markers[i].type) {
    314  1.9.4.1    snj 		case ArmStart:
    315  1.9.4.1    snj 			p32 = (uint32_t*)list->markers[i].addr;
    316  1.9.4.1    snj 			p32_end = (uint32_t*)va_end;
    317  1.9.4.1    snj 			if (i+1 < list->cnt) {
    318  1.9.4.1    snj 				if ((uintptr_t)list->markers[i+1].addr
    319  1.9.4.1    snj 				    < va_end)
    320  1.9.4.1    snj 					p32_end = (uint32_t*)
    321  1.9.4.1    snj 						list->markers[i+1].addr;
    322  1.9.4.1    snj 			}
    323  1.9.4.1    snj 			while (p32 < p32_end) {
    324  1.9.4.1    snj 				v32 = bswap32(*p32);
    325  1.9.4.1    snj 				*p32++ = v32;
    326  1.9.4.1    snj 			}
    327  1.9.4.1    snj 			break;
    328  1.9.4.1    snj 		case ThumbStart:
    329  1.9.4.1    snj 			p16 = (uint16_t*)list->markers[i].addr;
    330  1.9.4.1    snj 			p16_end = (uint16_t*)va_end;
    331  1.9.4.1    snj 			if (i+1 < list->cnt) {
    332  1.9.4.1    snj 				if ((uintptr_t)list->markers[i+1].addr
    333  1.9.4.1    snj 				    < va_end)
    334  1.9.4.1    snj 					p16_end = (uint16_t*)
    335  1.9.4.1    snj 						list->markers[i+1].addr;
    336  1.9.4.1    snj 			}
    337  1.9.4.1    snj 			while (p16 < p16_end) {
    338  1.9.4.1    snj 				v16 = bswap16(*p16);
    339  1.9.4.1    snj 				*p16++ = v16;
    340  1.9.4.1    snj 			}
    341  1.9.4.1    snj 			break;
    342  1.9.4.1    snj 		default:
    343  1.9.4.1    snj 			break;
    344  1.9.4.1    snj 		}
    345  1.9.4.1    snj 	}
    346  1.9.4.1    snj }
    347  1.9.4.1    snj 
    348  1.9.4.1    snj static void
    349  1.9.4.1    snj kobj_be8_fixup(kobj_t ko)
    350  1.9.4.1    snj {
    351  1.9.4.1    snj 	size_t relsym_cnt = 0, i, msize;
    352  1.9.4.1    snj 	struct be8_marker_list list;
    353  1.9.4.1    snj 	struct be8_marker tmp;
    354  1.9.4.1    snj 
    355  1.9.4.1    snj 	/*
    356  1.9.4.1    snj 	 * Count all special relocations symbols
    357  1.9.4.1    snj 	 */
    358  1.9.4.1    snj 	ksyms_mod_foreach(ko->ko_name, be8_ksym_count, &relsym_cnt);
    359  1.9.4.1    snj 
    360  1.9.4.1    snj 	/*
    361  1.9.4.1    snj 	 * Provide storage for the address list and add the symbols
    362  1.9.4.1    snj 	 */
    363  1.9.4.1    snj 	list.cnt = 0;
    364  1.9.4.1    snj 	msize = relsym_cnt*sizeof(*list.markers);
    365  1.9.4.1    snj 	list.markers = kmem_alloc(msize, KM_SLEEP);
    366  1.9.4.1    snj 	ksyms_mod_foreach(ko->ko_name, be8_ksym_add, &list);
    367  1.9.4.1    snj 	KASSERT(list.cnt == relsym_cnt);
    368  1.9.4.1    snj 
    369  1.9.4.1    snj 	/*
    370  1.9.4.1    snj 	 * Sort symbols by ascending address
    371  1.9.4.1    snj 	 */
    372  1.9.4.1    snj 	if (kheapsort(list.markers, relsym_cnt, sizeof(*list.markers),
    373  1.9.4.1    snj 	    be8_ksym_comp, &tmp) != 0)
    374  1.9.4.1    snj 		panic("could not sort be8 marker symbols");
    375  1.9.4.1    snj 
    376  1.9.4.1    snj 	/*
    377  1.9.4.1    snj 	 * Apply swaps to the .text section (XXX we do not have the
    378  1.9.4.1    snj 	 * section header available any more, it has been jetisoned
    379  1.9.4.1    snj 	 * already, so we can not check for all PROGBIT sections).
    380  1.9.4.1    snj 	 */
    381  1.9.4.1    snj 	for (i = 0; i < ko->ko_nprogtab; i++) {
    382  1.9.4.1    snj 		if (strcmp(ko->ko_progtab[i].name, ".text") != 0)
    383  1.9.4.1    snj 			continue;
    384  1.9.4.1    snj 		be8_ksym_swap(ko->ko_progtab[i].addr,
    385  1.9.4.1    snj 		    (size_t)ko->ko_progtab[i].size,
    386  1.9.4.1    snj 		    &list);
    387  1.9.4.1    snj 	}
    388  1.9.4.1    snj 
    389  1.9.4.1    snj 	/*
    390  1.9.4.1    snj 	 * Done, free list
    391  1.9.4.1    snj 	 */
    392  1.9.4.1    snj 	kmem_free(list.markers, msize);
    393  1.9.4.1    snj }
    394  1.9.4.1    snj #endif
    395  1.9.4.1    snj 
    396      1.1     ad int
    397      1.1     ad kobj_machdep(kobj_t ko, void *base, size_t size, bool load)
    398      1.1     ad {
    399      1.1     ad 
    400      1.1     ad 	if (load) {
    401  1.9.4.1    snj #if __ARMEB__
    402  1.9.4.1    snj 		if (CPU_IS_ARMV7_P())
    403  1.9.4.1    snj 			kobj_be8_fixup(ko);
    404  1.9.4.1    snj #endif
    405      1.5   matt #ifndef _RUMPKERNEL
    406      1.7   matt 		cpu_idcache_wbinv_range((vaddr_t)base, size);
    407      1.1     ad 		cpu_tlb_flushID();
    408      1.5   matt #endif
    409      1.1     ad 	}
    410      1.1     ad 
    411      1.1     ad 	return 0;
    412      1.1     ad }
    413