ZCOM Tables and Data Structures
Differences in 32-bit and 64-bit Data Structures
Differences in 32-bit and 64-bit Data
Structures
HP-UX supports 64-bit mode using the LP64 model. This means the long and pointer fields are 64-bits in length. The ZCOM memory data structures are designed to be 32/64-bit neutral by using conditional padding fields. For example, a pointer field is defined as a 64-bit pointer in 64-bit mode. But when the same field is used in the 32-bit kernel, it is
a32-bit pointer prefixed with a 32-bit padding field (the padding is inserted in front of the field). The data structures hence are the same sizes in both 32 and 64-bit modes. This gives better control over data alignment in the data structures, and allows 32-bit utilities to manipulate both the 32and 64-bit data structures easily.
But this still does not give full transparency to 32-bit programs that access ZCOM kernel tables on a 64-bit system. When a 32-bit program manipulates a 64-bit long or pointer field in a data structure, the program should consider whether the data structure comes from a 32-bit or 64-bit kernel, even though it has the same size and layout. The program should treat the padding fields as hidden fields (same as the data structure alignment gaps inserted by the compiler) and should not reference them directly.
Another side-effect is the ‘shifting’ of the long or pointer fields. Although the overall layout is the same, the location offset of a long or pointer field within a data structure is different in 32-bit and 64-bit modes. When used in 32-bit mode, due to the presence of the 32-bit padding, the position of a long or pointer field will be shifted 4-bytes towards the end, compared to the same field when used in 64-bit mode.
Some of the data fields are of fixed 64-bit (e.g. hssoff in zheader_type) in both 32/64 modes. If a 32-bit program is to manipulate these 64-bit fields, it is recommended that the program should be compiled with the option -Ae (extended ANSI) or -Ac(K&R C mode), so as to enable the ‘long long’ type for 64-bit integer.
The following sections describe the ZCOM data structures in 64-bit mode. Hence the conditional padding fields are suppressed. If they are used in a 32-bit environment, the long and pointer fields will become 32-bit, and the 32-bit padding will be present.