Avoid calls to bzero() before ireloc.

Evaluate cpu_stdext_feature early to have moved link_elf_ireloc() see
correct flags, most important is SMAP.

Tested by:	mjg
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D15367
This commit is contained in:
Konstantin Belousov 2018-05-09 14:39:24 +00:00
parent 603bbd0631
commit 55c9d75e6b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=333411
2 changed files with 19 additions and 9 deletions

View File

@ -1556,18 +1556,23 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
TSRAW(&thread0, TS_ENTER, __func__, NULL);
/*
* This may be done better later if it gets more high level
* components in it. If so just link td->td_proc here.
*/
proc_linkup0(&proc0, &thread0);
kmdp = init_ops.parse_preload_data(modulep);
identify_cpu1();
identify_hypervisor();
/*
* hw.cpu_stdext_disable is ignored by the call, it will be
* re-evaluted by the below call to finishidentcpu().
*/
identify_cpu2();
/* link_elf_ireloc(kmdp); */
link_elf_ireloc(kmdp);
/*
* This may be done better later if it gets more high level
* components in it. If so just link td->td_proc here.
*/
proc_linkup0(&proc0, &thread0);
/* Init basic tunables, hz etc */
init_param1();
@ -1753,7 +1758,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
cninit();
amd64_kdb_init();
}
link_elf_ireloc(kmdp);
getmemsize(kmdp, physfree);
init_param2(physmem);

View File

@ -1692,9 +1692,15 @@ link_elf_ireloc(caddr_t kmdp)
{
struct elf_file eff;
elf_file_t ef;
volatile char *c;
size_t i;
ef = &eff;
bzero(ef, sizeof(*ef));
/* Do not use bzero/memset before ireloc is done. */
for (c = (char *)ef, i = 0; i < sizeof(*ef); i++)
c[i] = 0;
ef->modptr = kmdp;
ef->dynamic = (Elf_Dyn *)&_DYNAMIC;
parse_dynamic(ef);