diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 37f6a724dee1..b6d3bcd16e22 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94"; #include #include #include +#include #include @@ -433,7 +434,7 @@ _kvm_nlist(kvm_t *kd, struct nlist *nl, int initialize) if (error > 0 && _kvm_dpcpu_initialized(kd, initialize)) error = kvm_fdnlist_prefix(kd, nl, error, - "pcpu_entry_", _kvm_dpcpu_validaddr); + DPCPU_SYMPREFIX, _kvm_dpcpu_validaddr); return (error); } @@ -473,7 +474,7 @@ _kvm_nlist(kvm_t *kd, struct nlist *nl, int initialize) p->n_value = _kvm_vnet_validaddr(kd, lookup.symvalue); else if (_kvm_dpcpu_initialized(kd, initialize) && - !strcmp(prefix, "pcpu_entry_")) + !strcmp(prefix, DPCPU_SYMPREFIX)) p->n_value = _kvm_dpcpu_validaddr(kd, lookup.symvalue); else @@ -495,7 +496,7 @@ _kvm_nlist(kvm_t *kd, struct nlist *nl, int initialize) } if (error && _kvm_dpcpu_initialized(kd, initialize) && !tried_dpcpu) { tried_dpcpu = 1; - prefix = "pcpu_entry_"; + prefix = DPCPU_SYMPREFIX; goto again; } diff --git a/lib/libkvm/kvm_pcpu.c b/lib/libkvm/kvm_pcpu.c index 484d2ea48505..d896c4f036e9 100644 --- a/lib/libkvm/kvm_pcpu.c +++ b/lib/libkvm/kvm_pcpu.c @@ -197,9 +197,9 @@ _kvm_dpcpu_init(kvm_t *kd) { struct nlist nl[] = { #define NLIST_START_SET_PCPU 0 - { "___start_set_pcpu" }, + { "___start_" DPCPU_SETNAME }, #define NLIST_STOP_SET_PCPU 1 - { "___stop_set_pcpu" }, + { "___stop_" DPCPU_SETNAME }, #define NLIST_DPCPU_OFF 2 { "_dpcpu_off" }, #define NLIST_MP_MAXCPUS 3 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 = "<>"; 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 #include +#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.