Page MenuHomeFreeBSD

Add macros simplifying the fake preload setup
ClosedPublic

Authored by mhorne on May 19 2020, 1:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 23, 10:11 AM
Unknown Object (File)
Tue, Apr 23, 10:11 AM
Unknown Object (File)
Tue, Apr 23, 10:07 AM
Unknown Object (File)
Tue, Apr 23, 10:07 AM
Unknown Object (File)
Sat, Apr 20, 11:23 PM
Unknown Object (File)
Feb 22 2024, 12:35 PM
Unknown Object (File)
Feb 16 2024, 5:38 AM
Unknown Object (File)
Feb 16 2024, 5:38 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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31170
Build 28833: arc lint + arc unit

Event Timeline

mhorne created this revision.
markj added inline comments.
sys/riscv/riscv/machdep.c
740

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

765

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

sys/riscv/riscv/machdep.c
740

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

765

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
769

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

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

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

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.