| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 1/2] xen/arm32: Introduce alternative runtime patching
 On 03/17/2017 06:35 AM, Wei Chen wrote: Hi Julien, Hi Wei, Sorry for the late answer, I missed that e-mail. On 2017/3/17 6:24, Julien Grall wrote:On 03/16/2017 09:53 AM, Wei Chen wrote: [...] 
 I don't think this is really important. I looked at the ARM64 counterpart (see aarch64_set_branch_offset) and we don't do the check. About the message can we change to: "Target ARM32 instructions must be placed on word aligned addresses?" That would be ok. [...] /* diff --git a/xen/include/asm-arm/arm32/insn.h b/xen/include/asm-arm/arm32/insn.h new file mode 100644 index 0000000..045acc3 --- /dev/null +++ b/xen/include/asm-arm/arm32/insn.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2017 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#ifndef __ARCH_ARM_ARM32_INSN +#define __ARCH_ARM_ARM32_INSN + +#include <xen/types.h> + +#define __AARCH32_INSN_FUNCS(abbr, mask, val) \ +static always_inline bool_t aarch32_insn_is_##abbr(uint32_t code) \ +{ \ + return (code & (mask)) == (val); \ +} + +__AARCH32_INSN_FUNCS(b, 0x0F000000, 0x0A000000)Looking at the ARM ARM (A8.8.18 in DDI406C.c) when cond = 0b1111, this will be a bx. Thankfully we also want to catch them. I think this needs to be spelled out in the code to help the reader understand how bx is handled.Sorry, I am not very clear about this comment. I read the (A5.7 in DDI406C.c) and could not find bx unconditional instructions list. Did you mean the unconditional bl/blx? I meant blx rather than bx in my previous e-mail. Sorry. Anyhow I think your concern is right. We have to cover the condition field. Some unconditional instructions may have a conflicted op field as conditional branch instructions. The only unconditional instruction with the same encoding is blx. So it is fine. But this either need to be: 
        1) properly documented
        2) introducing a blx macro
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
 
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |