From nobody Mon Feb 9 01:17:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492722158429764.5283837378831; Thu, 20 Apr 2017 14:02:38 -0700 (PDT) Received: from localhost ([::1]:55986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1JDp-0002Ii-4T for importer@patchew.org; Thu, 20 Apr 2017 17:02:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1J80-0005ej-UM for qemu-devel@nongnu.org; Thu, 20 Apr 2017 16:56:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1J7x-0004zz-OR for qemu-devel@nongnu.org; Thu, 20 Apr 2017 16:56:36 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:30614) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1J7x-0004nx-EH; Thu, 20 Apr 2017 16:56:33 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 335367456F9; Thu, 20 Apr 2017 22:56:17 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id C6F4A7456B8; Thu, 20 Apr 2017 22:56:16 +0200 (CEST) Message-Id: <3c5b0d9bcf770cb87f84cb5649d7119b37647355.1492721026.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Date: Thu, 20 Apr 2017 22:43:46 +0200 To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:738:2001:2001::2001 Subject: [Qemu-devel] [PATCH v5 05/13] sm501: Get rid of base address in draw_hwc_line X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Magnus Damm , Aurelien Jarno , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Do not use the base address to access data in local memory. This is in preparation to allow chip connected via PCI where base address depends on where the BAR is mapped so it will be unknown. Signed-off-by: BALATON Zoltan Reviewed-by: Peter Maydell --- hw/display/sm501.c | 6 ++---- hw/display/sm501_template.h | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 571a7e6..09c023d 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -461,7 +461,6 @@ typedef struct SM501State { QemuConsole *con; =20 /* status & internal resources */ - hwaddr base; uint32_t local_mem_size_index; uint8_t *local_mem; MemoryRegion local_mem_region; @@ -1432,10 +1431,9 @@ static void sm501_reset(SM501State *s) s->twoD_control =3D 0; } =20 -static void sm501_init(SM501State *s, DeviceState *dev, uint32_t base, +static void sm501_init(SM501State *s, DeviceState *dev, uint32_t local_mem_bytes) { - s->base =3D base; s->local_mem_size_index =3D get_local_mem_size_index(local_mem_bytes); SM501_DPRINTF("sm501 local mem size=3D%x. index=3D%d\n", get_local_mem= _size(s), s->local_mem_size_index); @@ -1489,7 +1487,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Er= ror **errp) SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); DeviceState *usb_dev; =20 - sm501_init(&s->state, dev, s->base, s->vram_size); + sm501_init(&s->state, dev, s->vram_size); if (get_local_mem_size(&s->state) !=3D s->vram_size) { error_setg(errp, "Invalid VRAM size, nearest valid size is %" PRIu= 32, get_local_mem_size(&s->state)); diff --git a/hw/display/sm501_template.h b/hw/display/sm501_template.h index 16e500b..832ee61 100644 --- a/hw/display/sm501_template.h +++ b/hw/display/sm501_template.h @@ -103,13 +103,13 @@ static void glue(draw_hwc_line_, PIXEL_NAME)(SM501Sta= te *s, int crt, uint8_t *palette, int c_y, uint8_t *d, int width) { int x, i; - uint8_t bitset =3D 0; + uint8_t *pixval, bitset =3D 0; =20 /* get hardware cursor pattern */ uint32_t cursor_addr =3D get_hwc_address(s, crt); assert(0 <=3D c_y && c_y < SM501_HWC_HEIGHT); cursor_addr +=3D SM501_HWC_WIDTH * c_y / 4; /* 4 pixels per byte */ - cursor_addr +=3D s->base; + pixval =3D s->local_mem + cursor_addr; =20 /* get cursor position */ x =3D get_hwc_x(s, crt); @@ -120,8 +120,8 @@ static void glue(draw_hwc_line_, PIXEL_NAME)(SM501State= *s, int crt, =20 /* get pixel value */ if (i % 4 =3D=3D 0) { - bitset =3D ldub_phys(&address_space_memory, cursor_addr); - cursor_addr++; + bitset =3D ldub_p(pixval); + pixval++; } v =3D bitset & 3; bitset >>=3D 2; --=20 2.7.4