File tree Expand file tree Collapse file tree
submodules/patcher/src/arm64_inst Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,13 +25,13 @@ int32_t decode_imm19(uint32_t raw) {
2525 int32_t imm19 = (int32_t )((raw >> 5 ) & 0x7FFFF );
2626 if (imm19 & 0x40000 )
2727 imm19 |= (int32_t )0xFFF80000 ; // sign extend bit 18 -> bit 31
28- return imm19 << 2 ;
28+ return ( int32_t )(( uint32_t ) imm19 << 2 ) ;
2929}
3030uint32_t read_instr (const char * buf , int32_t off ) {
3131 return (uint8_t )buf [off ]
32- | ((uint8_t )buf [off + 1 ] << 8 )
33- | ((uint8_t )buf [off + 2 ] << 16 )
34- | ((uint8_t )buf [off + 3 ] << 24 );
32+ | ((uint32_t )( uint8_t )buf [off + 1 ] << 8 )
33+ | ((uint32_t )( uint8_t )buf [off + 2 ] << 16 )
34+ | ((uint32_t )( uint8_t )buf [off + 3 ] << 24 );
3535}
3636
3737void write_instr (char * buf , int32_t off , uint32_t val ) {
@@ -180,7 +180,7 @@ bool decode_inst_adrp(uint32_t raw, DecodedInst* out) {
180180 uint64_t immhi = (raw >> 5 ) & 0x7FFFF ;
181181 int64_t imm = (int64_t )((immhi << 2 ) | immlo );
182182 if (imm & (1LL << 20 )) imm |= ~((1LL << 21 ) - 1 );
183- out -> simm = (int32_t )(imm << 12 ); /* page-granular signed offset */
183+ out -> simm = (int32_t )(( uint64_t ) imm << 12 ); /* page-granular signed offset */
184184 return true;
185185}
186186
You can’t perform that action at this time.
0 commit comments