mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 03:31:00 +00:00
qemu-common: Add missing string util functions
This commit is contained in:
parent
542f162b35
commit
cef0353be4
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_aarch64
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_aarch64
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_aarch64
|
||||
#define qemu_strnlen qemu_strnlen_aarch64
|
||||
#define qemu_strsep qemu_strsep_aarch64
|
||||
#define qemu_st_helpers qemu_st_helpers_aarch64
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_aarch64
|
||||
#define qemu_try_memalign qemu_try_memalign_aarch64
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_aarch64
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_aarch64
|
||||
#define string_input_visitor_new string_input_visitor_new_aarch64
|
||||
#define stristart stristart_aarch64
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_aarch64
|
||||
#define strpadcpy strpadcpy_aarch64
|
||||
#define strstart strstart_aarch64
|
||||
#define strtosz strtosz_aarch64
|
||||
#define strtosz_suffix strtosz_suffix_aarch64
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_aarch64eb
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_aarch64eb
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_aarch64eb
|
||||
#define qemu_strnlen qemu_strnlen_aarch64eb
|
||||
#define qemu_strsep qemu_strsep_aarch64eb
|
||||
#define qemu_st_helpers qemu_st_helpers_aarch64eb
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_aarch64eb
|
||||
#define qemu_try_memalign qemu_try_memalign_aarch64eb
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_aarch64eb
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_aarch64eb
|
||||
#define string_input_visitor_new string_input_visitor_new_aarch64eb
|
||||
#define stristart stristart_aarch64eb
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_aarch64eb
|
||||
#define strpadcpy strpadcpy_aarch64eb
|
||||
#define strstart strstart_aarch64eb
|
||||
#define strtosz strtosz_aarch64eb
|
||||
#define strtosz_suffix strtosz_suffix_aarch64eb
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_arm
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_arm
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_arm
|
||||
#define qemu_strnlen qemu_strnlen_arm
|
||||
#define qemu_strsep qemu_strsep_arm
|
||||
#define qemu_st_helpers qemu_st_helpers_arm
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_arm
|
||||
#define qemu_try_memalign qemu_try_memalign_arm
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_arm
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_arm
|
||||
#define string_input_visitor_new string_input_visitor_new_arm
|
||||
#define stristart stristart_arm
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_arm
|
||||
#define strpadcpy strpadcpy_arm
|
||||
#define strstart strstart_arm
|
||||
#define strtosz strtosz_arm
|
||||
#define strtosz_suffix strtosz_suffix_arm
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_armeb
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_armeb
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_armeb
|
||||
#define qemu_strnlen qemu_strnlen_armeb
|
||||
#define qemu_strsep qemu_strsep_armeb
|
||||
#define qemu_st_helpers qemu_st_helpers_armeb
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_armeb
|
||||
#define qemu_try_memalign qemu_try_memalign_armeb
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_armeb
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_armeb
|
||||
#define string_input_visitor_new string_input_visitor_new_armeb
|
||||
#define stristart stristart_armeb
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_armeb
|
||||
#define strpadcpy strpadcpy_armeb
|
||||
#define strstart strstart_armeb
|
||||
#define strtosz strtosz_armeb
|
||||
#define strtosz_suffix strtosz_suffix_armeb
|
||||
|
|
|
@ -2454,6 +2454,8 @@ symbols = (
|
|||
'qemu_ram_setup_dump',
|
||||
'qemu_ram_unset_idstr',
|
||||
'qemu_real_host_page_size',
|
||||
'qemu_strnlen',
|
||||
'qemu_strsep',
|
||||
'qemu_st_helpers',
|
||||
'qemu_tcg_init_vcpu',
|
||||
'qemu_try_memalign',
|
||||
|
@ -2643,7 +2645,9 @@ symbols = (
|
|||
'string_input_get_visitor',
|
||||
'string_input_visitor_cleanup',
|
||||
'string_input_visitor_new',
|
||||
'stristart',
|
||||
'strongarm_cp_reginfo',
|
||||
'strpadcpy',
|
||||
'strstart',
|
||||
'strtosz',
|
||||
'strtosz_suffix',
|
||||
|
|
|
@ -101,6 +101,9 @@ void pstrcpy(char *buf, int buf_size, const char *str);
|
|||
void strpadcpy(char *buf, int buf_size, const char *str, char pad);
|
||||
char *pstrcat(char *buf, int buf_size, const char *s);
|
||||
int strstart(const char *str, const char *val, const char **ptr);
|
||||
int stristart(const char *str, const char *val, const char **ptr);
|
||||
int qemu_strnlen(const char *s, int max_len);
|
||||
char *qemu_strsep(char **input, const char *delim);
|
||||
int qemu_fls(int i);
|
||||
|
||||
/*
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_m68k
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_m68k
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_m68k
|
||||
#define qemu_strnlen qemu_strnlen_m68k
|
||||
#define qemu_strsep qemu_strsep_m68k
|
||||
#define qemu_st_helpers qemu_st_helpers_m68k
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_m68k
|
||||
#define qemu_try_memalign qemu_try_memalign_m68k
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_m68k
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_m68k
|
||||
#define string_input_visitor_new string_input_visitor_new_m68k
|
||||
#define stristart stristart_m68k
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_m68k
|
||||
#define strpadcpy strpadcpy_m68k
|
||||
#define strstart strstart_m68k
|
||||
#define strtosz strtosz_m68k
|
||||
#define strtosz_suffix strtosz_suffix_m68k
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_mips
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_mips
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_mips
|
||||
#define qemu_strnlen qemu_strnlen_mips
|
||||
#define qemu_strsep qemu_strsep_mips
|
||||
#define qemu_st_helpers qemu_st_helpers_mips
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_mips
|
||||
#define qemu_try_memalign qemu_try_memalign_mips
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_mips
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_mips
|
||||
#define string_input_visitor_new string_input_visitor_new_mips
|
||||
#define stristart stristart_mips
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_mips
|
||||
#define strpadcpy strpadcpy_mips
|
||||
#define strstart strstart_mips
|
||||
#define strtosz strtosz_mips
|
||||
#define strtosz_suffix strtosz_suffix_mips
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_mips64
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_mips64
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_mips64
|
||||
#define qemu_strnlen qemu_strnlen_mips64
|
||||
#define qemu_strsep qemu_strsep_mips64
|
||||
#define qemu_st_helpers qemu_st_helpers_mips64
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_mips64
|
||||
#define qemu_try_memalign qemu_try_memalign_mips64
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_mips64
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_mips64
|
||||
#define string_input_visitor_new string_input_visitor_new_mips64
|
||||
#define stristart stristart_mips64
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_mips64
|
||||
#define strpadcpy strpadcpy_mips64
|
||||
#define strstart strstart_mips64
|
||||
#define strtosz strtosz_mips64
|
||||
#define strtosz_suffix strtosz_suffix_mips64
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_mips64el
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_mips64el
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_mips64el
|
||||
#define qemu_strnlen qemu_strnlen_mips64el
|
||||
#define qemu_strsep qemu_strsep_mips64el
|
||||
#define qemu_st_helpers qemu_st_helpers_mips64el
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_mips64el
|
||||
#define qemu_try_memalign qemu_try_memalign_mips64el
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_mips64el
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_mips64el
|
||||
#define string_input_visitor_new string_input_visitor_new_mips64el
|
||||
#define stristart stristart_mips64el
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_mips64el
|
||||
#define strpadcpy strpadcpy_mips64el
|
||||
#define strstart strstart_mips64el
|
||||
#define strtosz strtosz_mips64el
|
||||
#define strtosz_suffix strtosz_suffix_mips64el
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_mipsel
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_mipsel
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_mipsel
|
||||
#define qemu_strnlen qemu_strnlen_mipsel
|
||||
#define qemu_strsep qemu_strsep_mipsel
|
||||
#define qemu_st_helpers qemu_st_helpers_mipsel
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_mipsel
|
||||
#define qemu_try_memalign qemu_try_memalign_mipsel
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_mipsel
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_mipsel
|
||||
#define string_input_visitor_new string_input_visitor_new_mipsel
|
||||
#define stristart stristart_mipsel
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_mipsel
|
||||
#define strpadcpy strpadcpy_mipsel
|
||||
#define strstart strstart_mipsel
|
||||
#define strtosz strtosz_mipsel
|
||||
#define strtosz_suffix strtosz_suffix_mipsel
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_powerpc
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_powerpc
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_powerpc
|
||||
#define qemu_strnlen qemu_strnlen_powerpc
|
||||
#define qemu_strsep qemu_strsep_powerpc
|
||||
#define qemu_st_helpers qemu_st_helpers_powerpc
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_powerpc
|
||||
#define qemu_try_memalign qemu_try_memalign_powerpc
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_powerpc
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_powerpc
|
||||
#define string_input_visitor_new string_input_visitor_new_powerpc
|
||||
#define stristart stristart_powerpc
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_powerpc
|
||||
#define strpadcpy strpadcpy_powerpc
|
||||
#define strstart strstart_powerpc
|
||||
#define strtosz strtosz_powerpc
|
||||
#define strtosz_suffix strtosz_suffix_powerpc
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_sparc
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_sparc
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_sparc
|
||||
#define qemu_strnlen qemu_strnlen_sparc
|
||||
#define qemu_strsep qemu_strsep_sparc
|
||||
#define qemu_st_helpers qemu_st_helpers_sparc
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_sparc
|
||||
#define qemu_try_memalign qemu_try_memalign_sparc
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_sparc
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_sparc
|
||||
#define string_input_visitor_new string_input_visitor_new_sparc
|
||||
#define stristart stristart_sparc
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_sparc
|
||||
#define strpadcpy strpadcpy_sparc
|
||||
#define strstart strstart_sparc
|
||||
#define strtosz strtosz_sparc
|
||||
#define strtosz_suffix strtosz_suffix_sparc
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_sparc64
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_sparc64
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_sparc64
|
||||
#define qemu_strnlen qemu_strnlen_sparc64
|
||||
#define qemu_strsep qemu_strsep_sparc64
|
||||
#define qemu_st_helpers qemu_st_helpers_sparc64
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_sparc64
|
||||
#define qemu_try_memalign qemu_try_memalign_sparc64
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_sparc64
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_sparc64
|
||||
#define string_input_visitor_new string_input_visitor_new_sparc64
|
||||
#define stristart stristart_sparc64
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_sparc64
|
||||
#define strpadcpy strpadcpy_sparc64
|
||||
#define strstart strstart_sparc64
|
||||
#define strtosz strtosz_sparc64
|
||||
#define strtosz_suffix strtosz_suffix_sparc64
|
||||
|
|
|
@ -77,6 +77,56 @@ int strstart(const char *str, const char *val, const char **ptr)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int stristart(const char *str, const char *val, const char **ptr)
|
||||
{
|
||||
const char *p, *q;
|
||||
p = str;
|
||||
q = val;
|
||||
while (*q != '\0') {
|
||||
if (qemu_toupper(*p) != qemu_toupper(*q))
|
||||
return 0;
|
||||
p++;
|
||||
q++;
|
||||
}
|
||||
if (ptr)
|
||||
*ptr = p;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* XXX: use host strnlen if available ? */
|
||||
int qemu_strnlen(const char *s, int max_len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < max_len; i++) {
|
||||
if (s[i] == '\0') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
char *qemu_strsep(char **input, const char *delim)
|
||||
{
|
||||
char *result = *input;
|
||||
if (result != NULL) {
|
||||
char *p;
|
||||
|
||||
for (p = result; *p != '\0'; p++) {
|
||||
if (strchr(delim, *p)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*p == '\0') {
|
||||
*input = NULL;
|
||||
} else {
|
||||
*p = '\0';
|
||||
*input = p + 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int qemu_fls(int i)
|
||||
{
|
||||
return 32 - clz32(i);
|
||||
|
|
|
@ -2448,6 +2448,8 @@
|
|||
#define qemu_ram_setup_dump qemu_ram_setup_dump_x86_64
|
||||
#define qemu_ram_unset_idstr qemu_ram_unset_idstr_x86_64
|
||||
#define qemu_real_host_page_size qemu_real_host_page_size_x86_64
|
||||
#define qemu_strnlen qemu_strnlen_x86_64
|
||||
#define qemu_strsep qemu_strsep_x86_64
|
||||
#define qemu_st_helpers qemu_st_helpers_x86_64
|
||||
#define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_x86_64
|
||||
#define qemu_try_memalign qemu_try_memalign_x86_64
|
||||
|
@ -2637,7 +2639,9 @@
|
|||
#define string_input_get_visitor string_input_get_visitor_x86_64
|
||||
#define string_input_visitor_cleanup string_input_visitor_cleanup_x86_64
|
||||
#define string_input_visitor_new string_input_visitor_new_x86_64
|
||||
#define stristart stristart_x86_64
|
||||
#define strongarm_cp_reginfo strongarm_cp_reginfo_x86_64
|
||||
#define strpadcpy strpadcpy_x86_64
|
||||
#define strstart strstart_x86_64
|
||||
#define strtosz strtosz_x86_64
|
||||
#define strtosz_suffix strtosz_suffix_x86_64
|
||||
|
|
Loading…
Reference in a new issue