5export module arch.s390x.cpu.processor;
6export import arch.s390x.cpu.types;
7import zxfoundation.base.types;
8import arch.s390x.cpu.ctlreg;
9import arch.s390x.cpu.diag;
14namespace arch::s390x::cpu::processor {
17 struct alignas(8) [[gnu::packed]] cpuid {
24 auto get_cpuid(cpuid *id) ->
void {
25 __asm__ volatile(
"stidp %0" :
"=m" (*id));
30 auto is_hypervisor()
noexcept ->
bool {
33 return id.version == 0xff;
37 [[nodiscard]]
inline auto get_current_sp()
noexcept -> u64 {
39 __asm__ volatile (
"stg %%r15, %0" :
"=Q"(sp));
45 [[deprecated(
"STPX is expensive — use lowcore::get_current() on the hot path")]]
46 [[gnu::no_stack_protector]]
auto get_prefix()
noexcept -> u32 {
48 __asm__ volatile (
"stpx %0" :
"=Q"(prefix) : :
"memory");
54 auto set_prefix(
const u32 prefix)
noexcept ->
void {
55 __asm__ volatile (
"spx %0" ::
"m" (prefix) :
"memory");
60 auto cpu_addr()
noexcept -> u16 {
62 __asm__ volatile (
"stap %0" :
"=m" (addr));