diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 081f663dc983..68c60d8d62db 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -350,7 +350,7 @@ link_elf_link_preload(linker_class_t cls, const char *filename, ef->progtab[pb].addr = dpcpu; #ifdef VIMAGE } else if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, "set_vnet")) { + !strcmp(ef->progtab[pb].name, VNET_SETNAME)) { void *vnet_data; vnet_data = vnet_data_alloc(shdr[i].sh_size); @@ -756,7 +756,7 @@ link_elf_load_file(linker_class_t cls, const char *filename, dpcpu_alloc(shdr[i].sh_size); #ifdef VIMAGE else if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, "set_vnet")) + !strcmp(ef->progtab[pb].name, VNET_SETNAME)) ef->progtab[pb].addr = vnet_data_alloc(shdr[i].sh_size); #endif @@ -789,7 +789,7 @@ link_elf_load_file(linker_class_t cls, const char *filename, #ifdef VIMAGE else if (ef->progtab[pb].addr != (void *)mapbase && - !strcmp(ef->progtab[pb].name, "set_vnet")) + !strcmp(ef->progtab[pb].name, VNET_SETNAME)) vnet_data_copy(ef->progtab[pb].addr, shdr[i].sh_size); #endif @@ -909,7 +909,7 @@ link_elf_unload_file(linker_file_t file) dpcpu_free(ef->progtab[i].addr, ef->progtab[i].size); #ifdef VIMAGE - else if (!strcmp(ef->progtab[i].name, "set_vnet")) + else if (!strcmp(ef->progtab[i].name, VNET_SETNAME)) vnet_data_free(ef->progtab[i].addr, ef->progtab[i].size); #endif diff --git a/sys/net/vnet.h b/sys/net/vnet.h index e44d422b9146..23f0a331d5f1 100644 --- a/sys/net/vnet.h +++ b/sys/net/vnet.h @@ -37,19 +37,26 @@ #ifndef _NET_VNET_H_ #define _NET_VNET_H_ +#if defined(_KERNEL) || defined(_WANT_VNET) + +#define VNET_SETNAME "set_vnet" +#define VNET_SYMPREFIX "vnet_entry_" + +#endif + #ifdef _KERNEL #ifdef VIMAGE #if defined(__arm__) -__asm__(".section set_vnet, \"aw\", %progbits"); +__asm__(".section " VNET_SETNAME ", \"aw\", %progbits"); #else -__asm__(".section set_vnet, \"aw\", @progbits"); +__asm__(".section " VNET_SETNAME ", \"aw\", @progbits"); #endif __asm__(".previous"); #define VNET_NAME(n) vnet_entry_##n #define VNET_DECLARE(t, n) extern t VNET_NAME(n) -#define VNET_DEFINE(t, n) t VNET_NAME(n) __section("set_vnet") __used +#define VNET_DEFINE(t, n) t VNET_NAME(n) __section(VNET_SETNAME) __used #define _VNET_PTR(b, n) (__typeof(VNET_NAME(n))*) \ ((b) + (uintptr_t)&VNET_NAME(n))