提交 068abdc8 编写于 作者: J j_mayer

Fix inconsistent end conditions in ppc_find_xxx functions.

  (crash reported by Andreas Farber when using default CPU).


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3293 c046a42c-6fe2-441c-8c8c-71466251a162
上级 8a84de23
......@@ -5872,11 +5872,12 @@ int cpu_ppc_register (CPUPPCState *env, ppc_def_t *def)
int ppc_find_by_name (const unsigned char *name, ppc_def_t **def)
{
int i, ret;
int i, max, ret;
ret = -1;
*def = NULL;
for (i = 0; strcmp(ppc_defs[i].name, "default") != 0; i++) {
max = sizeof(ppc_defs) / sizeof(ppc_def_t);
for (i = 0; i < max; i++) {
if (strcasecmp(name, ppc_defs[i].name) == 0) {
*def = &ppc_defs[i];
ret = 0;
......@@ -5889,11 +5890,12 @@ int ppc_find_by_name (const unsigned char *name, ppc_def_t **def)
int ppc_find_by_pvr (uint32_t pvr, ppc_def_t **def)
{
int i, ret;
int i, max, ret;
ret = -1;
*def = NULL;
for (i = 0; ppc_defs[i].name != NULL; i++) {
max = sizeof(ppc_defs) / sizeof(ppc_def_t);
for (i = 0; i < max; i++) {
if ((pvr & ppc_defs[i].pvr_mask) ==
(ppc_defs[i].pvr & ppc_defs[i].pvr_mask)) {
*def = &ppc_defs[i];
......@@ -5907,12 +5909,11 @@ int ppc_find_by_pvr (uint32_t pvr, ppc_def_t **def)
void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
{
int i;
int i, max;
for (i = 0; ; i++) {
max = sizeof(ppc_defs) / sizeof(ppc_def_t);
for (i = 0; i < max; i++) {
(*cpu_fprintf)(f, "PowerPC %-16s PVR %08x\n",
ppc_defs[i].name, ppc_defs[i].pvr);
if (strcmp(ppc_defs[i].name, "default") == 0)
break;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册