diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-09-28 10:59:41 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-09-28 10:59:41 +0200 |
commit | c7970c8c39736732bc964b62e17a4f1e386af7bb (patch) | |
tree | 3614ee7a8a6fe06fb1df60da33e16b08af323d37 /xen/arch/x86/domain.c | |
parent | 1443c44067837f77cbd89fcac64cdde3fd337ef4 (diff) | |
download | xen-c7970c8c39736732bc964b62e17a4f1e386af7bb.tar.gz xen-c7970c8c39736732bc964b62e17a4f1e386af7bb.tar.bz2 xen-c7970c8c39736732bc964b62e17a4f1e386af7bb.zip |
x86: replace literal numbers
In various cases, 256 was being used instead of NR_VECTORS or a derived
ARRAY_SIZE() expression. In one case (guest_has_trap_callback()), a
wrong (unrelated) constant was used instead of NR_VECTORS.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/domain.c')
-rw-r--r-- | xen/arch/x86/domain.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index d0c516a3ee..58766ba029 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -374,8 +374,9 @@ int switch_compat(struct domain *d) static inline bool_t standalone_trap_ctxt(struct vcpu *v) { - BUILD_BUG_ON(256 * sizeof(*v->arch.pv_vcpu.trap_ctxt) > PAGE_SIZE); - return 256 * sizeof(*v->arch.pv_vcpu.trap_ctxt) + sizeof(*v) > PAGE_SIZE; + BUILD_BUG_ON(NR_VECTORS * sizeof(*v->arch.pv_vcpu.trap_ctxt) > PAGE_SIZE); + return NR_VECTORS * sizeof(*v->arch.pv_vcpu.trap_ctxt) + sizeof(*v) + > PAGE_SIZE; } int vcpu_initialise(struct vcpu *v) @@ -432,7 +433,7 @@ int vcpu_initialise(struct vcpu *v) } else v->arch.pv_vcpu.trap_ctxt = (void *)v + PAGE_SIZE - - 256 * sizeof(*v->arch.pv_vcpu.trap_ctxt); + NR_VECTORS * sizeof(*v->arch.pv_vcpu.trap_ctxt); /* PV guests by default have a 100Hz ticker. */ v->periodic_period = MILLISECS(10); @@ -702,7 +703,7 @@ int arch_set_info_guest( fixup_guest_stack_selector(d, c.nat->kernel_ss); fixup_guest_code_selector(d, c.nat->user_regs.cs); - for ( i = 0; i < 256; i++ ) + for ( i = 0; i < ARRAY_SIZE(c.nat->trap_ctxt); i++ ) { if ( !is_canonical_address(c.nat->trap_ctxt[i].address) ) return -EINVAL; @@ -725,7 +726,7 @@ int arch_set_info_guest( fixup_guest_code_selector(d, c.cmp->event_callback_cs); fixup_guest_code_selector(d, c.cmp->failsafe_callback_cs); - for ( i = 0; i < 256; i++ ) + for ( i = 0; i < ARRAY_SIZE(c.cmp->trap_ctxt); i++ ) fixup_guest_code_selector(d, c.cmp->trap_ctxt[i].cs); /* LDT safety checks. */ |