Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18070dd6 authored by Mike Frysinger's avatar Mike Frysinger
Browse files

Blackfin: cleanup traps decode_address() a bit



Unify the address display to shrink the code, and add missing decoding of
a few special Blackfin-specific regions (L1 ROM and MMRs).

Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent f4e12939
Loading
Loading
Loading
Loading
+30 −18
Original line number Original line Diff line number Diff line
@@ -100,7 +100,11 @@ static void decode_address(char *buf, unsigned long address)
	char *modname;
	char *modname;
	char *delim = ":";
	char *delim = ":";
	char namebuf[128];
	char namebuf[128];
#endif

	buf += sprintf(buf, "<0x%08lx> ", address);


#ifdef CONFIG_KALLSYMS
	/* look up the address and see if we are in kernel space */
	/* look up the address and see if we are in kernel space */
	symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
	symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);


@@ -108,23 +112,33 @@ static void decode_address(char *buf, unsigned long address)
		/* yeah! kernel space! */
		/* yeah! kernel space! */
		if (!modname)
		if (!modname)
			modname = delim = "";
			modname = delim = "";
		sprintf(buf, "<0x%p> { %s%s%s%s + 0x%lx }",
		sprintf(buf, "{ %s%s%s%s + 0x%lx }",
		              (void *)address, delim, modname, delim, symname,
		        delim, modname, delim, symname,
		        (unsigned long)offset);
		        (unsigned long)offset);
		return;
		return;

	}
	}
#endif
#endif


	/* Problem in fixed code section? */
	if (address >= FIXED_CODE_START && address < FIXED_CODE_END) {
	if (address >= FIXED_CODE_START && address < FIXED_CODE_END) {
		sprintf(buf, "<0x%p> /* Maybe fixed code section */", (void *)address);
		/* Problem in fixed code section? */
		strcat(buf, "/* Maybe fixed code section */");
		return;
		return;
	}


	} else if (address < CONFIG_BOOT_LOAD) {
		/* Problem somewhere before the kernel start address */
		/* Problem somewhere before the kernel start address */
	if (address < CONFIG_BOOT_LOAD) {
		strcat(buf, "/* Maybe null pointer? */");
		sprintf(buf, "<0x%p> /* Maybe null pointer? */", (void *)address);
		return;

	} else if (address >= COREMMR_BASE) {
		strcat(buf, "/* core mmrs */");
		return;

	} else if (address >= SYSMMR_BASE) {
		strcat(buf, "/* system mmrs */");
		return;

	} else if (address >= L1_ROM_START && address < L1_ROM_START + L1_ROM_LENGTH) {
		strcat(buf, "/* on-chip L1 ROM */");
		return;
		return;
	}
	}


@@ -172,18 +186,16 @@ static void decode_address(char *buf, unsigned long address)
						offset = (address - vma->vm_start) +
						offset = (address - vma->vm_start) +
							 (vma->vm_pgoff << PAGE_SHIFT);
							 (vma->vm_pgoff << PAGE_SHIFT);


					sprintf(buf, "<0x%p> [ %s + 0x%lx ]",
					sprintf(buf, "[ %s + 0x%lx ]", name, offset);
						(void *)address, name, offset);
				} else
				} else
					sprintf(buf, "<0x%p> [ %s vma:0x%lx-0x%lx]",
					sprintf(buf, "[ %s vma:0x%lx-0x%lx]",
						(void *)address, name,
						name, vma->vm_start, vma->vm_end);
						vma->vm_start, vma->vm_end);


				if (!in_atomic)
				if (!in_atomic)
					mmput(mm);
					mmput(mm);


				if (!strlen(buf))
				if (buf[0] == '\0')
					sprintf(buf, "<0x%p> [ %s ] dynamic memory", (void *)address, name);
					sprintf(buf, "[ %s ] dynamic memory", name);


				goto done;
				goto done;
			}
			}
@@ -193,7 +205,7 @@ static void decode_address(char *buf, unsigned long address)
	}
	}


	/* we were unable to find this address anywhere */
	/* we were unable to find this address anywhere */
	sprintf(buf, "<0x%p> /* kernel dynamic memory */", (void *)address);
	sprintf(buf, "/* kernel dynamic memory */");


done:
done:
	write_unlock_irqrestore(&tasklist_lock, flags);
	write_unlock_irqrestore(&tasklist_lock, flags);