[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/hvm: Use for_each_set_bit() in hvm_emulate_writeback()
commit e7e0d485e993e97b1c816adcfc610e7c7258ce96 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Tue Jun 11 20:03:32 2024 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Mon Mar 17 16:08:34 2025 +0000 x86/hvm: Use for_each_set_bit() in hvm_emulate_writeback() ... which is more consise than the opencoded form, and more efficient when compiled. Furthermore, now that find_{first,next}_bit() are no longer in use, the seg_reg_{accessed,dirty} fields aren't forced to be unsigned long, although they do need to remain unsigned int because of __set_bit() elsewhere. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/hvm/emulate.c | 15 ++++----------- xen/arch/x86/include/asm/hvm/emulate.h | 4 ++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 1db14642b3..dbf6b5543a 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -3022,18 +3022,11 @@ void hvm_emulate_init_per_insn( void hvm_emulate_writeback( struct hvm_emulate_ctxt *hvmemul_ctxt) { - enum x86_segment seg; - - seg = find_first_bit(&hvmemul_ctxt->seg_reg_dirty, - ARRAY_SIZE(hvmemul_ctxt->seg_reg)); + struct vcpu *curr = current; + unsigned int dirty = hvmemul_ctxt->seg_reg_dirty; - while ( seg < ARRAY_SIZE(hvmemul_ctxt->seg_reg) ) - { - hvm_set_segment_register(current, seg, &hvmemul_ctxt->seg_reg[seg]); - seg = find_next_bit(&hvmemul_ctxt->seg_reg_dirty, - ARRAY_SIZE(hvmemul_ctxt->seg_reg), - seg+1); - } + for_each_set_bit ( seg, dirty ) + hvm_set_segment_register(curr, seg, &hvmemul_ctxt->seg_reg[seg]); } /* diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h index d61eacfaa7..c7a2d2a5be 100644 --- a/xen/arch/x86/include/asm/hvm/emulate.h +++ b/xen/arch/x86/include/asm/hvm/emulate.h @@ -37,8 +37,8 @@ struct hvm_emulate_ctxt { unsigned int insn_buf_bytes; struct segment_register seg_reg[10]; - unsigned long seg_reg_accessed; - unsigned long seg_reg_dirty; + unsigned int seg_reg_accessed; + unsigned int seg_reg_dirty; /* * MFNs behind temporary mappings in the write callback. The length is -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |