target/arm: Move compare_u64 to helper.c
We will use this function beyond kvm.c. Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
363e612c2e
commit
5a8af95cb3
3 changed files with 14 additions and 11 deletions
|
|
@ -40,6 +40,17 @@
|
|||
|
||||
static void switch_mode(CPUARMState *env, int mode);
|
||||
|
||||
int compare_u64(const void *a, const void *b)
|
||||
{
|
||||
if (*(uint64_t *)a > *(uint64_t *)b) {
|
||||
return 1;
|
||||
}
|
||||
if (*(uint64_t *)a < *(uint64_t *)b) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t raw_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
||||
{
|
||||
assert(ri->fieldoffset);
|
||||
|
|
|
|||
|
|
@ -2004,4 +2004,7 @@ void vfp_clear_float_status_exc_flags(CPUARMState *env);
|
|||
void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask);
|
||||
bool arm_pan_enabled(CPUARMState *env);
|
||||
|
||||
/* Compare uint64_t for qsort and bsearch. */
|
||||
int compare_u64(const void *a, const void *b);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -718,17 +718,6 @@ void kvm_arm_register_device(MemoryRegion *mr, uint64_t devid, uint64_t group,
|
|||
memory_region_ref(kd->mr);
|
||||
}
|
||||
|
||||
static int compare_u64(const void *a, const void *b)
|
||||
{
|
||||
if (*(uint64_t *)a > *(uint64_t *)b) {
|
||||
return 1;
|
||||
}
|
||||
if (*(uint64_t *)a < *(uint64_t *)b) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* cpreg_values are sorted in ascending order by KVM register ID
|
||||
* (see kvm_arm_init_cpreg_list). This allows us to cheaply find
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue