Re: [PATCH v2 12/22] sim/erc32: Use memory_iread() function for instruction fetching.

Mike Frysinger
2015-02-22T20:54:58Z

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]