Subject: port-dreamcast/35022: Too much memory is cleared in the initialization code in dreamcast/dev/g2/aica.c
To: None <port-dreamcast-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <anders@gavare.se>
List: netbsd-bugs
Date: 11/09/2006 05:40:00
>Number:         35022
>Category:       port-dreamcast
>Synopsis:       Too much memory is cleared in the initialization code in dreamcast/dev/g2/aica.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-dreamcast-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 09 05:40:00 +0000 2006
>Originator:     Anders Gavare
>Release:        bug present in all releases until today (?)
>Organization:
>Environment:
Dreamcast
>Description:
The initialization code in dreamcast/dev/g2/aica.c fills the sound RAM area with zeroes.

         /* load microcode, and clear memory */
         bus_space_set_region_4(sc->sc_memt, sc->sc_aica_memh,
             0, 0, AICA_RAM_SIZE);

However, the count should not be AICA_RAM_SIZE, but rather AICA_RAM_SIZE/4. The current code overwrites memory beyond the sound RAM area.

>How-To-Repeat:
Boot a NetBSD/dreamcast in e.g. an emulator/simulator or debugger, which shows warning messages for memory accesses to addresses where there is no memory mapped device. NetBSD clears the sound RAM area, and 6 more MBs after that.

>Fix:
Add a "/4" to the count parameter.