[PATCH v2 12/22] sim/erc32: Use memory_iread() function for instruction fetching.
Mike Frysinger
vapier@gentoo.org
Sun Feb 22 20:54:00 GMT 2015
On 19 Feb 2015 23:31, Jiri Gaisler wrote:
> --- a/sim/erc32/erc32.c
> +++ b/sim/erc32/erc32.c
>
> int
> +memory_iread(addr, data, ws)
> + uint32 addr;
> + uint32 *data;
> + int32 *ws;
use the proper new function prototype style
> + if ((addr >= mem_ramstart) && (addr < (mem_ramstart + mem_ramsz))) {
> + *data = *((uint32 *) & (ramb[addr & mem_rammask & ~3]));
> + *ws = mem_ramr_ws;
> + return (0);
> + } else if (addr < mem_romsz) {
> + *data = *((uint32 *) & (romb[addr & ~3]));
> + *ws = mem_romr_ws;
> + return (0);
> + }
pretty sure you should use memcpy here instead of casts
drop the paren around the return value
> + printf("Memory exception at %x (illegal address)\n", addr);
space before the (
> + if (sregs.psr & 0x080) asi = 9; else asi = 8;
uncuddle this statement
> + set_sfsr(UIMP_ACC, addr, asi, 1);
space before the (
> + return (1);
drop the paren
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20150222/24a5471b/attachment.sig>
More information about the Gdb-patches
mailing list