Page MenuHomeFreeBSD

Remove struct __s trick from amd64 pcpu.h.
Needs ReviewPublic

Authored by kib on Dec 25 2018, 2:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 3, 6:35 PM
Unknown Object (File)
Sat, Oct 3, 6:24 PM
Unknown Object (File)
Thu, Oct 1, 7:46 AM
Unknown Object (File)
Fri, Sep 25, 7:09 AM
Unknown Object (File)
Fri, Sep 25, 6:41 AM
Unknown Object (File)
Fri, Sep 25, 4:52 AM
Unknown Object (File)
Aug 28 2026, 6:14 PM
Unknown Object (File)
Aug 26 2026, 6:46 PM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

It causes clang to generate single-byte access to the target memory with byte mask.

Example of the current asm generated from the fork_exit()

	sched_fork_exit(td);
	if ((dtd = PCPU_GET(deadthread))) {
		PCPU_SET(deadthread, NULL);
		thread_stash(dtd);
	}

fragment for PCPU_SET:

XXX

The same line after the patch:

0xffffffff80370bb6 <+118>:   mov    %rbx,%rdi
0xffffffff80370bb9 <+121>:   callq  0xffffffff803dc100 <sched_fork_exit>
0xffffffff80370bbe <+126>:   mov    %gs:0x18,%rdi
0xffffffff80370bc7 <+135>:   test   %rdi,%rdi
0xffffffff80370bca <+138>:   je     0xffffffff80370bdc <fork_exit+156>
0xffffffff80370bcc <+140>:   xor    %eax,%eax
0xffffffff80370bce <+142>:   mov    %rax,%gs:0x18
0xffffffff80370bd7 <+151>:   callq  0xffffffff803bf5a0 <thread_stash>
0xffffffff80370bdc <+156>:   mov    (%rbx),%rdi

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 21727