aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2010-11-14 20:14:25 +0000
committerDimitry Andric <dim@FreeBSD.org>2010-11-14 20:14:25 +0000
commit5f67450d3ad3e3a3b3452fd91a7511d9e75fa74f (patch)
treee7ef401664063000bd5a4405863bbb31f320b00d /sys
parent10895c82f2ebb0485413766360d7aeb2f2902f7e (diff)
downloadsrc-5f67450d3ad3e3a3b3452fd91a7511d9e75fa74f.tar.gz
src-5f67450d3ad3e3a3b3452fd91a7511d9e75fa74f.zip
Similar to sys/net/vnet.h, define the linker set name for sys/sys/pcpu.h
as a macro, and use it instead of literal strings.
Notes
Notes: svn path=/head/; revision=215315
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/link_elf_obj.c8
-rw-r--r--sys/sys/pcpu.h5
2 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index c18885218691..e8e32a201dbc 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -336,7 +336,7 @@ link_elf_link_preload(linker_class_t cls, const char *filename,
ef->progtab[pb].name =
ef->shstrtab + shdr[i].sh_name;
if (ef->progtab[pb].name != NULL &&
- !strcmp(ef->progtab[pb].name, "set_pcpu")) {
+ !strcmp(ef->progtab[pb].name, DPCPU_SETNAME)) {
void *dpcpu;
dpcpu = dpcpu_alloc(shdr[i].sh_size);
@@ -757,7 +757,7 @@ link_elf_load_file(linker_class_t cls, const char *filename,
else
ef->progtab[pb].name = "<<NOBITS>>";
if (ef->progtab[pb].name != NULL &&
- !strcmp(ef->progtab[pb].name, "set_pcpu"))
+ !strcmp(ef->progtab[pb].name, DPCPU_SETNAME))
ef->progtab[pb].addr =
dpcpu_alloc(shdr[i].sh_size);
#ifdef VIMAGE
@@ -789,7 +789,7 @@ link_elf_load_file(linker_class_t cls, const char *filename,
}
/* Initialize the per-cpu or vnet area. */
if (ef->progtab[pb].addr != (void *)mapbase &&
- !strcmp(ef->progtab[pb].name, "set_pcpu"))
+ !strcmp(ef->progtab[pb].name, DPCPU_SETNAME))
dpcpu_copy(ef->progtab[pb].addr,
shdr[i].sh_size);
#ifdef VIMAGE
@@ -911,7 +911,7 @@ link_elf_unload_file(linker_file_t file)
continue;
if (ef->progtab[i].name == NULL)
continue;
- if (!strcmp(ef->progtab[i].name, "set_pcpu"))
+ if (!strcmp(ef->progtab[i].name, DPCPU_SETNAME))
dpcpu_free(ef->progtab[i].addr,
ef->progtab[i].size);
#ifdef VIMAGE
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index b029e1213d45..ad1cf33e05b2 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -42,6 +42,9 @@
#include <sys/resource.h>
#include <machine/pcpu.h>
+#define DPCPU_SETNAME "set_pcpu"
+#define DPCPU_SYMPREFIX "pcpu_entry_"
+
#ifdef _KERNEL
/*
@@ -72,7 +75,7 @@ extern uintptr_t dpcpu_off[];
*/
#define DPCPU_NAME(n) pcpu_entry_##n
#define DPCPU_DECLARE(t, n) extern t DPCPU_NAME(n)
-#define DPCPU_DEFINE(t, n) t DPCPU_NAME(n) __section("set_pcpu") __used
+#define DPCPU_DEFINE(t, n) t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
/*
* Accessors with a given base.