Page MenuHomeFreeBSD

Add macros simplifying the fake preload setup
ClosedPublic

Authored by mhorne on May 19 2020, 1:08 AM.
Tags
None
Referenced Files
F102787483: D24910.id72364.diff
Sun, Nov 17, 4:58 AM
F102753462: D24910.id72364.diff
Sat, Nov 16, 5:30 PM
F102752720: D24910.id72080.diff
Sat, Nov 16, 5:13 PM
Unknown Object (File)
Tue, Nov 12, 11:41 PM
Unknown Object (File)
Mon, Nov 11, 7:03 PM
Unknown Object (File)
Tue, Oct 22, 11:37 AM
Unknown Object (File)
Sep 26 2024, 9:22 PM
Unknown Object (File)
Sep 25 2024, 11:16 AM

Details

Summary

This could have been done in r359673, but I didn't think I would return
to this function so soon. Lift these macros from arm64 so we don't need
to worry about the size when inserting new elements.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mhorne created this revision.
markj added inline comments.
sys/riscv/riscv/machdep.c
740 ↗(On Diff #71974)

I guess this is ok since in practice you don't have to worry about unaligned stores?

765 ↗(On Diff #71974)

Why did the second term change from KERNBASE + KERNENTRY to KERNBASE?

sys/riscv/riscv/machdep.c
740 ↗(On Diff #71974)

Yeah, safe in practice but it wouldn't hurt to round-up here as well.

765 ↗(On Diff #71974)

I discovered that KERNENTRY is useless, but forgot to remove it as I intended. Will update this shortly.

Remove KERNENTRY entirely. Call roundup in PRELOAD_PUSH_VALUE.

sys/riscv/riscv/machdep.c
770 ↗(On Diff #72080)

BTW, anyone have a clue how this code works on arm/arm64? It would be good to enable or just remove it here as appropriate.

sys/arm/include/elf.h has the following hint, but it's not clear enough to me:

/*
 * Magic number for the elf trampoline, chosen wisely to be an immediate
 * value.
 */
#define MAGIC_TRAMP_NUMBER     0x5c000003

That's a holdover from the a.out days. See D21099.

Seems ok to me aside from the comment.

sys/riscv/riscv/machdep.c
740 ↗(On Diff #71974)

I just forgot that riscv permits misaligned memory accesses. I'm not sure that the added roundup by 4 really helps anything?

This revision is now accepted and ready to land.May 21 2020, 6:12 PM
sys/riscv/riscv/machdep.c
740 ↗(On Diff #71974)

It permits it, but it may be emulated by M-mode if the hardware doesn't, so it should be avoided where possible as it will be orders of magnitude slower.

That's a holdover from the a.out days. See D21099.

Neat, did you find that somehow or were you already aware of its usage? I'll remove that section in a follow-up.

That's a holdover from the a.out days. See D21099.

Neat, did you find that somehow or were you already aware of its usage? I'll remove that section in a follow-up.

git blame on the definition in the header to find its introduction, then git log on elf_trampoline.c to find when that got GC'ed.

This revision was automatically updated to reflect the committed changes.
sys/riscv/riscv/machdep.c
740 ↗(On Diff #71974)

I dropped the rounding in the committed version, it did not change anything for the current set of preload data, and I intend on adding anything smaller than a uint32_t in there.