1 //! Implementations for the MIPS architecture.
2 
3 use crate::arch::Arch;
4 use crate::arch::RegId;
5 
6 pub mod reg;
7 
8 /// Implements `Arch` for 32-bit MIPS.
9 ///
10 /// Check out the [module level docs](../index.html#whats-with-regidimpl) for
11 /// more info about the `RegIdImpl` type parameter.
12 pub enum Mips<RegIdImpl: RegId = reg::id::MipsRegId<u32>> {
13     #[doc(hidden)]
14     _Marker(core::marker::PhantomData<RegIdImpl>),
15 }
16 
17 /// Implements `Arch` for 64-bit MIPS.
18 ///
19 /// Check out the [module level docs](../index.html#whats-with-regidimpl) for
20 /// more info about the `RegIdImpl` type parameter.
21 pub enum Mips64<RegIdImpl: RegId = reg::id::MipsRegId<u64>> {
22     #[doc(hidden)]
23     _Marker(core::marker::PhantomData<RegIdImpl>),
24 }
25 
26 /// Implements `Arch` for 32-bit MIPS with the DSP feature enabled.
27 pub enum MipsWithDsp {}
28 
29 /// Implements `Arch` for 64-bit MIPS with the DSP feature enabled.
30 pub enum Mips64WithDsp {}
31 
32 impl<RegIdImpl: RegId> Arch for Mips<RegIdImpl> {
33     type Usize = u32;
34     type Registers = reg::MipsCoreRegs<u32>;
35     type RegId = RegIdImpl;
36 
target_description_xml() -> Option<&'static str>37     fn target_description_xml() -> Option<&'static str> {
38         Some(r#"<target version="1.0"><architecture>mips</architecture></target>"#)
39     }
40 }
41 
42 impl<RegIdImpl: RegId> Arch for Mips64<RegIdImpl> {
43     type Usize = u64;
44     type Registers = reg::MipsCoreRegs<u64>;
45     type RegId = RegIdImpl;
46 
target_description_xml() -> Option<&'static str>47     fn target_description_xml() -> Option<&'static str> {
48         Some(r#"<target version="1.0"><architecture>mips64</architecture></target>"#)
49     }
50 }
51 
52 impl Arch for MipsWithDsp {
53     type Usize = u32;
54     type Registers = reg::MipsCoreRegsWithDsp<u32>;
55     type RegId = reg::id::MipsRegId<u32>;
56 
target_description_xml() -> Option<&'static str>57     fn target_description_xml() -> Option<&'static str> {
58         Some(
59             r#"<target version="1.0"><architecture>mips</architecture><feature name="org.gnu.gdb.mips.dsp"></feature></target>"#,
60         )
61     }
62 }
63 
64 impl Arch for Mips64WithDsp {
65     type Usize = u64;
66     type Registers = reg::MipsCoreRegsWithDsp<u64>;
67     type RegId = reg::id::MipsRegId<u64>;
68 
target_description_xml() -> Option<&'static str>69     fn target_description_xml() -> Option<&'static str> {
70         Some(
71             r#"<target version="1.0"><architecture>mips64</architecture><feature name="org.gnu.gdb.mips.dsp"></feature></target>"#,
72         )
73     }
74 }
75