x86: unify common parts of segment.h