@@ -2097,7 +2097,7 @@ impl HubrisArchive {
20972097 core. halt ( ) ?;
20982098 let result = self . is_pc_within_archive ( core) ;
20992099 core. run ( ) ?;
2100- if let Ok ( ( false , pc ) ) = result {
2100+ if let Ok ( PcResult :: NotInArchive { pc } ) = result {
21012101 bail ! ( "image ID matches but PC at 0x{pc:x} is not part of any \
21022102 module. Maybe this is an incorrect A/B archive, or \
21032103 bootloader or ROM code is running?") ;
@@ -2182,12 +2182,12 @@ impl HubrisArchive {
21822182 pub fn is_pc_within_archive (
21832183 & self ,
21842184 core : & mut dyn crate :: core:: Core ,
2185- ) -> Result < ( bool , u32 ) > {
2185+ ) -> Result < PcResult > {
21862186 let pc = core. read_reg ( ARMRegister :: PC ) ?;
21872187 if self . instr_mod ( pc) . is_none ( ) {
2188- Ok ( ( false , pc ) )
2188+ Ok ( PcResult :: NotInArchive { pc } )
21892189 } else {
2190- Ok ( ( true , pc ) )
2190+ Ok ( PcResult :: InArchive )
21912191 }
21922192 }
21932193
@@ -6450,6 +6450,16 @@ pub enum HubrisValidate {
64506450 Booted ,
64516451}
64526452
6453+ #[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
6454+ pub enum PcResult {
6455+ /// The program counter is within the range of instruction addresses
6456+ /// defined by this archive
6457+ InArchive ,
6458+ /// The program counter is NOT within the range of instruction addresses
6459+ /// defined by this archive, and is instead at the given address
6460+ NotInArchive { pc : u32 } ,
6461+ }
6462+
64536463//
64546464// We want to track our external regions because we want to be able to identify
64556465// them, but this requires us knowing what addresses our external regions map
0 commit comments