8643 Fix misuse of _KMEMUSER in i86pc

Review Request #658 — Created Sept. 8, 2017 and submitted

gwr
illumos-gate
8643
general

8643 Fix misuse of _KMEMUSER in i86pc

There was some discussion of this on the developers list. See the subject:
Request 417: 8007 uts: sysmacros.h should allow offsetof for early boot

Basically, some time (long ago) someone apparently hacked their way around
some kind of symbol exposure problem by adding -D_KMEMUSER in places that
really are not what that define was meant for, which is:
User-level code that needs to compile with some structures (etc.)
that would otherwise only be exposed when building kernel components.

Kernel components normally build with -D_KERNEL so in headers,
when defining structures etc, those are often inside an:

 #if defined(_KERNEL) || defined(_KMEMUSRER)

On the other hand, function prototypes etc. normall are in just:

 #if defined(_KERNEL)

Also relevant to this is "stand-alone" boot programs, which also
use many of the system heders with -D_BOOT which works similarly
to -D_KERNEL but may expose a different subset of things.

For that reason, many system headers have #if conditionals like:

 #if defined(_KERNEL) || defined(_KMEMUSRER) || defined(_BOOT)

Anyway, that's the normal purpose of all those defines.
As you can see in the diff shown here, the -D_KMEMUSER
define was mis-used in somewhat odd ways.

I compared the workspace (using wsdiff) before and after this change.
There were no differences other than the expected few things like
dtrace object sections, and executables that compile-in dates.

andy_js
  1. Worth filing a bug for I think.

    1. Are you a reviewer on this?

  2. usr/src/uts/common/sys/param.h (Diff revision 1)
     
     
    Is there any reason to keep the outside parenthesis?
    1. Nah, just didn't think to remove them.
      Will be happy to do so.

  3. 
      
gwr
gwr
igork
  1. Ship It!
  2. 
      
tsoome
  1. Ship It!
  2. 
      
gwr
tsoome
  1. 
      
  2. usr/src/uts/common/sys/param.h (Diff revisions 1 - 2)
     
     

    I have seen some diff noises about NBPW in nightly.log time to time, I think, related to genassym I think, could this update interfere there?

    1. This (hopefully) fixes that noise.
      ASM can't use sizeof (int) so it
      has it's own NBWP in mach param.

  3. 
      
gwr
Review request changed

Status: Closed (submitted)

Loading...