Move arch code around

This commit is contained in:
Gary Guo 2021-08-26 12:35:20 +01:00
parent 1e46c7ea3a
commit 62878b5995
5 changed files with 21 additions and 12 deletions

View File

@ -1,4 +1,17 @@
#[cfg(target_arch = "x86_64")]
mod x86_64;
mod x86_64 {
use gimli::{Register, X86_64};
pub struct Arch;
#[allow(unused)]
impl Arch {
pub const SP: Register = X86_64::RSP;
pub const RA: Register = X86_64::RA;
pub const UNWIND_DATA_REG: (Register, Register) = (X86_64::RAX, X86_64::RDX);
pub const UNWIND_PRIVATE_DATA_SIZE: usize = 6;
}
}
#[cfg(target_arch = "x86_64")]
pub use x86_64::*;

4
src/unwinder/arch/mod.rs Normal file
View File

@ -0,0 +1,4 @@
#[cfg(target_arch = "x86_64")]
mod x86_64;
#[cfg(target_arch = "x86_64")]
pub use x86_64::*;

View File

@ -11,17 +11,6 @@ pub struct Context {
pub fcw: usize,
}
pub struct Arch;
#[allow(unused)]
impl Arch {
pub const SP: Register = X86_64::RSP;
pub const RA: Register = X86_64::RA;
pub const UNWIND_DATA_REG: (Register, Register) = (X86_64::RAX, X86_64::RDX);
pub const UNWIND_PRIVATE_DATA_SIZE: usize = 6;
}
impl fmt::Debug for Context {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut fmt = fmt.debug_struct("Context");

View File

@ -6,6 +6,7 @@ use gimli::{
use super::find_fde::{self, FDEFinder, FDESearchResult};
use crate::abi::PersonalityRoutine;
use crate::arch::*;
use super::arch::*;
use crate::util::*;
#[derive(Debug)]

View File

@ -1,3 +1,4 @@
mod arch;
mod find_fde;
mod frame;
@ -8,6 +9,7 @@ use gimli::Register;
use crate::abi::*;
use crate::arch::*;
use crate::util::*;
use arch::*;
use find_fde::FDEFinder;
use frame::Frame;