Date: Mon, 20 Jul 2009 07:50:50 +0000 (UTC) From: Robert Watson <rwatson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r195778 - in head/sys: kern net Message-ID: <200907200750.n6K7ooPM070050@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rwatson Date: Mon Jul 20 07:50:50 2009 New Revision: 195778 URL: http://svn.freebsd.org/changeset/base/195778 Log: Add macros VNET_SETNAME and VNET_SYMPREFIX, and expose to userspace if _WANT_VNET is defined. This way we don't need separate definitions in libkvm. Reviewed by: bz Approved by: re (vimage blanket) Modified: head/sys/kern/link_elf_obj.c head/sys/net/vnet.h Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Mon Jul 20 06:12:23 2009 (r195777) +++ head/sys/kern/link_elf_obj.c Mon Jul 20 07:50:50 2009 (r195778) @@ -350,7 +350,7 @@ link_elf_link_preload(linker_class_t cls 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, c 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, c #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 Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Mon Jul 20 06:12:23 2009 (r195777) +++ head/sys/net/vnet.h Mon Jul 20 07:50:50 2009 (r195778) @@ -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))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907200750.n6K7ooPM070050>