This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]