Op zondag 24 mei 2020 18:48:52 UTC+2 schreef Arne Vajhøj:
I had a hunch that this might be possible in python, and it is!
Grab cpuid.py from
https://github.com/flababah/cpuid.py, and use the following python program to perform a basic test. Note: there may be requirements that I missed, so don't hang me if this test says yes, but VMS doesn't boot. This is literally a five-minute solution to your question. The following appears to work on Windows, Linux, and Mac OS X.
# -*- coding: utf-8 -*-
#
# Quick test to see if a cpu might be capable of running
# VSI OpenVMS 9.x for x86-64.
#
# by Camiel Vanderhoeven
#
# Based on example.py for cpuid.py, which is
# Copyright (c) 2014 Anders Høst
#
from __future__ import print_function
import struct
import cpuid
def cpu_vendor(cpu):
_, b, c, d = cpu(0)
return struct.pack("III", b, d, c).decode("utf-8")
def cpu_name(cpu):
return "".join((struct.pack("IIII", *cpu(0x80000000 + i)).decode("utf-8")
for i in range(2, 5))).strip()
"""
@param {leaf} %eax
@param {sublead} %ecx, 0 in most cases
@param {reg_idx} idx of [%eax, %ebx, %ecx, %edx], 0-based
@param {bit} bit of reg selected by {reg_idx}, 0-based
"""
def is_set(cpu, leaf, subleaf, reg_idx, bit):
regs = cpu(leaf, subleaf)
if (1 << bit) & regs[reg_idx]:
return "Yes"
else:
return "--"
if __name__ == "__main__":
cpu = cpuid.CPUID()
print()
print("OpenVMS 9.x compatibility quick-check")
print()
print("Vendor ID : %s" % cpu_vendor(cpu))
print("CPU name : %s" % cpu_name(cpu))
print()
print("Necessary for OpenVMS 9.x:")
print("XSAVE : %s" % is_set(cpu, 1, 0, 2, 26))
print("TSC : %s" % is_set(cpu, 1, 0, 3, 4))
print("APIC : %s" % is_set(cpu, 1, 0, 3, 9))
print("MTTR : %s" % is_set(cpu, 1, 0, 3, 12))
print("Optional for OpenVMS 9.x:")
print("PCID : %s" % is_set(cpu, 1, 0, 2, 17))
print("X2APIC : %s" % is_set(cpu, 1, 0, 2, 21))
print("XSAVEOPT : %s" % is_set(cpu, 0xd, 1, 0, 0))