System Page
The system page contains essential information about the system, including the system page's size, information about the hardware platform (including IRQs and the CPU), the cache size, and the location of kernel callouts in memory.
The system page is implemented by a data structure containing constants, references to other data structures, and a union shared by the different processor architectures that QNX OS supports.
One of the startup program's main tasks is to initialize the system page with the
information that the OS needs to run on the current hardware (see Startup tasks
in the Startup Programs
chapter).
After the startup program initializes the system page,
it populates this data structure with data that describes the current system and OS,
allowing applications to retrieve the information they need.
System page location
The standard location for header files, including sys/syspage.h, is on your host system in ${QNX_TARGET}/usr/include, where ${QNX_TARGET} is the directory that holds the target-related components. Architecture-specific header files are kept in ${QNX_TARGET}/usr/include/arch, where arch is the architecture of the target system. For example, ${QNX_TARGET}/usr/include/x86_64/syspage.h contains the architecture-specific definitions for x86 64-bit. Note, however, that the correct header file to include is the general one that contains definitions for all architectures and is stored in the standard header file location (e.g., /my_qnx_sdp/target/qnx/usr/include/sys/syspage.h).
A QNX SDP product patch or OS update can replace this and other header files (and other components such as binaries and libraries) with newer versions.
However, because QNX regularly updates header files between patches and updates, a specific BSP component often requires a newer version of a header file. When an updated header file is required, it is included with the BSP and the version in the QNX SDP exists independently. When you build the BSP, the build process automatically uses the version shipped with it. Any other coding operations you do outside the context of that specific BSP use the QNX SDP version of the header file.
System page contents
struct syspage_entry {
_Uint16t size;
_Uint16t total_size;
_Uint16t type;
_Uint16t num_cpu;
syspage_entry_info system_private;
_SP_OLD_ARRAY(asinfo);
syspage_entry_info DEPRECATED_SECTION_NAME(meminfo);
syspage_entry_info hwinfo;
_SP_OLD_ARRAY(cpuinfo);
_SP_OLD_ARRAY(cacheattr);
syspage_entry_info qtime;
syspage_entry_info callout;
syspage_entry_info callin;
syspage_entry_info typed_strings;
syspage_entry_info strings;
_SP_OLD_ARRAY(intrinfo);
syspage_entry_info smp;
syspage_entry_info pminfo;
_SP_OLD_ARRAY(mdriver);
_Uint32t spare0[1];
union {
struct {
_Uint32t __x86_spacer;
struct x86_syspage_entry x86;
};
struct {
_Uint32t __arm_spacer;
struct arm_syspage_entry arm;
};
struct x86_64_syspage_entry x86_64;
struct aarch64_syspage_entry aarch64;
_Uint64t filler[20];
} un;
_SP_NEW_ARRAY(asinfo);
_SP_NEW_ARRAY(cpuinfo);
_SP_NEW_ARRAY(cacheattr);
_SP_NEW_ARRAY(intrinfo);
_SP_NEW_ARRAY(mdriver);
};
- size
- The size of the system page entry. The startup library sets this member automatically.
- total_size
-
The size of the system page entry plus the referenced substructures; effectively the size of the entire system-page database.
The startup library sets this member automatically, but other library calls may adjust (grow) it later as required.
- type
-
The CPU family for determining which union member in the un element to use. It can be one of SYSPAGE_X86_64 or SYSPAGE_AARCH64, for the supported 64-bit architectures.
The library sets this member automatically.
- num_cpu
- The number of CPUs on the system. The startup library initializes it to the default value of 1. If additional CPUs are detected during startup, the startup program should call init_smp() to set this member to the correct value.
- system_private
- See system_private.
- asinfo
- See asinfo.
- meminfo
- Deprecated; do not use.
- hwinfo
- See hwinfo.
- cpuinfo
- See cpuinfo.
- cacheattr
- See cacheattr.
- qtime
- See qtime.
- callout
- See callout.
- callin
- For internal use.
- typed_strings
-
A literal pool used for typed strings. Each entry consists of a four-byte number and a NULL-terminated string. The number represents the string type and corresponds to a specific constant from the system header file <confname.h> (see the C library function confstr()).
Usually, the init_*() library functions populate the typed strings literal pool. However, if you need to add something, you can call the add_typed_string() function from the startup library.
- strings
-
A literal pool used for non-typed strings. To use one of these strings, specify the appropriate index in strings (e.g., cpuinfo's name member).
Usually, the init_*() library functions populate the non-typed strings literal pool. However, if you need to add something, you can call the add_string() function from the startup library.
- intrinfo
- See intrinfo.
- smp
- See smp.
- pminfo
- Not currently supported.
- un
- See un.
_SP_NEW_ARRAY
#define _SP_NEW_ARRAY(__sect) \
union { \
syspage_array_info new_##__sect; \
syspage_array_info __sect; \
}
_SP_OLD_ARRAY
#define _SP_OLD_ARRAY(__sect) syspage_entry_info old_##__sect
syspage_array_info
typedef struct {
_Uint16t entry_off;
_Uint16t entry_size;
_Uint16t element_size;
} syspage_array_info;
64-bit support
/*
* System page types
*/
enum {
SYSPAGE_X86,
SYSPAGE_PPC,
SYSPAGE_MIPS,
SYSPAGE_SPARE,
SYSPAGE_ARM,
SYSPAGE_SH,
/* additional 32 bit architectures go here */
SYSPAGE_64BIT = 0x100,
SYSPAGE_X86_64 = SYSPAGE_64BIT,
SYSPAGE_AARCH64,
/* additional 64 bit architectures go here */
};