Refactor handling of x86 CPUID instructions

John Naylor <john.naylor@postgresql.org>

Commit: be6a7494d2e387d1f5b7a5dcc6c2afcb403188d6
Author: John Naylor <john.naylor@postgresql.org>
Date: 2026-03-25T05:32:36Z
Refactor handling of x86 CPUID instructions

Introduce two helpers for CPUID, pg_cpuid and pg_cpuid_subleaf that wrap
the platform specific __get_cpuid/__cpuid and __get_cpuid_count/__cpuidex
functions.

Additionally, use macros to specify registers names (e.g. EAX) for clarity,
instead of numeric integers into the result array.

Author: Lukas Fittl <lukas@fittl.com>
Suggested-By: John Naylor <john.naylor@postgresql.org>
Discussion: https://postgr.es/m/CANWCAZZ+Crjt5za9YmFsURRMDW7M4T2mutDezd_3s1gTLnrzGQ@mail.gmail.com

Files

PathChange+/−
src/port/pg_cpu_x86.c modified +51 −25

Discussion