|
59 | 59 | #define OS UNKNOWN_
|
60 | 60 | #endif
|
61 | 61 |
|
| 62 | +#define X86_64_ "x86_64\0\0\0\0\0\0" |
| 63 | +#define I386_ "i386\0\0\0\0\0\0\0\0" |
| 64 | +#define AARCH64_ "aarch64\0\0\0\0\0" |
| 65 | +#define ARM_ "arm\0\0\0\0\0\0\0\0\0" |
| 66 | +#define PPC64_ "ppc64\0\0\0\0\0\0\0" |
| 67 | +#define PPC64LE_ "ppc64le\0\0\0\0\0" |
| 68 | +#define PPC_ "ppc\0\0\0\0\0\0\0\0\0" |
| 69 | +#define S390X_ "s390x\0\0\0\0\0\0\0" |
| 70 | +#define RISCV64_ "riscv64\0\0\0\0\0" |
| 71 | +#define RISCV32_ "riscv32\0\0\0\0\0" |
| 72 | + |
| 73 | +#if defined(__x86_64__) |
| 74 | +#define ARCH_NAME X86_64_ |
| 75 | +#elif defined(__i386__) |
| 76 | +#define ARCH_NAME I386_ |
| 77 | +#elif defined(__aarch64__) |
| 78 | +#define ARCH_NAME AARCH64_ |
| 79 | +#elif defined(__ARMEL__) |
| 80 | +#define ARCH_NAME ARM_ |
| 81 | +#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) |
| 82 | +#define ARCH_NAME PPC64LE_ |
| 83 | +#elif defined(__powerpc64__) |
| 84 | +#define ARCH_NAME PPC64_ |
| 85 | +#elif defined(__powerpc__) |
| 86 | +#define ARCH_NAME PPC_ |
| 87 | +#elif defined(__s390x__) |
| 88 | +#define ARCH_NAME S390X_ |
| 89 | +#elif defined(__riscv) && __riscv_xlen == 64 |
| 90 | +#define ARCH_NAME RISCV64_ |
| 91 | +#elif defined(__riscv) && __riscv_xlen == 32 |
| 92 | +#define ARCH_NAME RISCV32_ |
| 93 | +#else |
| 94 | +#define ARCH_NAME UNKNOWN_ |
| 95 | +#endif |
| 96 | + |
62 | 97 | void OpCpuid(P) {
|
63 | 98 | u32 ax, bx, cx, dx, jit;
|
64 | 99 | if (m->trapcpuid) {
|
@@ -88,6 +123,11 @@ void OpCpuid(P) {
|
88 | 123 | cx = Read32((const u8 *)OS + 4);
|
89 | 124 | dx = Read32((const u8 *)OS + 8);
|
90 | 125 | break;
|
| 126 | + case 0x40031338: |
| 127 | + bx = Read32((const u8 *)ARCH_NAME + 0); |
| 128 | + cx = Read32((const u8 *)ARCH_NAME + 4); |
| 129 | + dx = Read32((const u8 *)ARCH_NAME + 8); |
| 130 | + break; |
91 | 131 | case 1:
|
92 | 132 | cx |= 1 << 0; // sse3
|
93 | 133 | cx |= 1 << 1; // pclmulqdq
|
|
0 commit comments