Page MenuHomeFreeBSD

Add macros simplifying the fake preload setup
AcceptedPublic

Authored by mhorne on Tue, May 19, 1:08 AM.

Details

Reviewers
kp
br
markj
Group Reviewers
riscv
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 OK
Unit
No Unit Test Coverage
Build Status
Buildable 31218
Build 28873: arc lint + arc unit

Event Timeline

mhorne requested review of this revision.Tue, May 19, 1:08 AM
mhorne created this revision.
nick added a subscriber: nick.Wed, May 20, 6:55 AM
markj added a subscriber: markj.Thu, May 21, 3:53 PM
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?

mhorne added inline comments.Thu, May 21, 4:23 PM
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.

mhorne updated this revision to Diff 72080.Thu, May 21, 5:16 PM

Remove KERNENTRY entirely. Call roundup in PRELOAD_PUSH_VALUE.

mhorne added inline comments.Thu, May 21, 5:36 PM
sys/riscv/riscv/machdep.c
770

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
jrtc27 added a subscriber: jrtc27.Thu, May 21, 6:00 PM

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

markj accepted this revision as: markj.Thu, May 21, 6:12 PM

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.Thu, May 21, 6:12 PM
jrtc27 added inline comments.Thu, May 21, 6:19 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.