Nugget
Loading...
Searching...
No Matches
mips.hh
Go to the documentation of this file.
1/*
2
3MIT License
4
5Copyright (c) 2025 PCSX-Redux authors
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26
27#pragma once
28
29#include <stdint.h>
30
31namespace Mips {
32
33// clang-format off
34enum class Reg {
35 R0, AT, V0, V1, A0, A1, A2, A3, // 00 to 07
36 T0, T1, T2, T3, T4, T5, T6, T7, // 08 to 0f
37 S0, S1, S2, S3, S4, S5, S6, S7, // 10 to 17
38 T8, T9, K0, K1, GP, SP, S8, RA, // 18 to 1f
39};
40// clang-format on
41
42typedef union {
43 struct {
44 uint32_t r0, at, v0, v1, a0, a1, a2, a3;
45 uint32_t t0, t1, t2, t3, t4, t5, t6, t7;
46 uint32_t s0, s1, s2, s3, s4, s5, s6, s7;
47 uint32_t t8, t9, k0, k1, gp, sp, s8, ra;
49 } n;
50 uint32_t r[34]; /* Lo, Hi in r[32] and r[33] */
51} GPRRegs;
52
53} // namespace Mips
54
55// Make sure no packing is inserted anywhere
56static_assert(sizeof(Mips::GPRRegs) == 34 * sizeof(uint32_t), "GPRRegs size mismatch");
uint32_t r
Definition cpu.c:222
int32_t lo
Definition cpu.c:154
Definition decoder.hh:33
Reg
Definition mips.hh:34
static const char * s2
Definition syscalls.h:91
void uint32_t(classId, spec)
Definition mips.hh:42
uint32_t t0
Definition mips.hh:45
uint32_t a0
Definition mips.hh:44
uint32_t gp
Definition mips.hh:47
uint32_t s0
Definition mips.hh:46
uint32_t hi
Definition mips.hh:48