From owner-svn-src-stable@FreeBSD.ORG Mon Apr 26 19:19:29 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D06341065670; Mon, 26 Apr 2010 19:19:29 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE4678FC0A; Mon, 26 Apr 2010 19:19:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3QJJTP5076186; Mon, 26 Apr 2010 19:19:29 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3QJJTo4076184; Mon, 26 Apr 2010 19:19:29 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201004261919.o3QJJTo4076184@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 26 Apr 2010 19:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207245 - stable/8/sys/dev/fb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Apr 2010 19:19:30 -0000 Author: jkim Date: Mon Apr 26 19:19:29 2010 New Revision: 207245 URL: http://svn.freebsd.org/changeset/base/207245 Log: MFC: r206384 Allocate memory for VBE info block with malloc(9), not as static local. Modified: stable/8/sys/dev/fb/vesa.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/dev/fb/vesa.c ============================================================================== --- stable/8/sys/dev/fb/vesa.c Mon Apr 26 19:19:01 2010 (r207244) +++ stable/8/sys/dev/fb/vesa.c Mon Apr 26 19:19:29 2010 (r207245) @@ -763,8 +763,8 @@ vesa_get_bpscanline(struct vesa_mode *vm static int vesa_bios_init(void) { - static struct vesa_info buf; struct vesa_mode vmode; + struct vesa_info *buf; video_info_t *p; x86regs_t regs; size_t bsize; @@ -800,7 +800,7 @@ vesa_bios_init(void) x86bios_init_regs(®s); regs.R_AX = 0x4f00; - vmbuf = x86bios_alloc(&offs, sizeof(buf)); + vmbuf = x86bios_alloc(&offs, sizeof(*buf)); if (vmbuf == NULL) return (1); @@ -813,23 +813,23 @@ vesa_bios_init(void) if (regs.R_AX != 0x004f || bcmp("VESA", vmbuf, 4) != 0) goto fail; - bcopy(vmbuf, &buf, sizeof(buf)); + vesa_adp_info = buf = malloc(sizeof(*buf), M_DEVBUF, M_WAITOK); + bcopy(vmbuf, buf, sizeof(*buf)); - vesa_adp_info = &buf; if (bootverbose) { printf("VESA: information block\n"); - hexdump(&buf, sizeof(buf), NULL, HD_OMIT_CHARS); + hexdump(buf, sizeof(*buf), NULL, HD_OMIT_CHARS); } - vers = buf.v_version = le16toh(buf.v_version); - buf.v_oemstr = le32toh(buf.v_oemstr); - buf.v_flags = le32toh(buf.v_flags); - buf.v_modetable = le32toh(buf.v_modetable); - buf.v_memsize = le16toh(buf.v_memsize); - buf.v_revision = le16toh(buf.v_revision); - buf.v_venderstr = le32toh(buf.v_venderstr); - buf.v_prodstr = le32toh(buf.v_prodstr); - buf.v_revstr = le32toh(buf.v_revstr); + vers = buf->v_version = le16toh(buf->v_version); + buf->v_oemstr = le32toh(buf->v_oemstr); + buf->v_flags = le32toh(buf->v_flags); + buf->v_modetable = le32toh(buf->v_modetable); + buf->v_memsize = le16toh(buf->v_memsize); + buf->v_revision = le16toh(buf->v_revision); + buf->v_venderstr = le32toh(buf->v_venderstr); + buf->v_prodstr = le32toh(buf->v_prodstr); + buf->v_revstr = le32toh(buf->v_revstr); if (vers < 0x0102) { printf("VESA: VBE version %d.%d is not supported; " @@ -839,21 +839,21 @@ vesa_bios_init(void) return (1); } - VESA_STRCPY(vesa_oemstr, buf.v_oemstr); + VESA_STRCPY(vesa_oemstr, buf->v_oemstr); if (vers >= 0x0200) { - VESA_STRCPY(vesa_venderstr, buf.v_venderstr); - VESA_STRCPY(vesa_prodstr, buf.v_prodstr); - VESA_STRCPY(vesa_revstr, buf.v_revstr); + VESA_STRCPY(vesa_venderstr, buf->v_venderstr); + VESA_STRCPY(vesa_prodstr, buf->v_prodstr); + VESA_STRCPY(vesa_revstr, buf->v_revstr); } is_via_cle266 = strncmp(vesa_oemstr, VESA_VIA_CLE266, sizeof(VESA_VIA_CLE266)) == 0; - if (buf.v_modetable == 0) + if (buf->v_modetable == 0) goto fail; - msize = (size_t)buf.v_memsize * 64 * 1024; + msize = (size_t)buf->v_memsize * 64 * 1024; - vesa_vmodetab = x86bios_offset(BIOS_SADDRTOLADDR(buf.v_modetable)); + vesa_vmodetab = x86bios_offset(BIOS_SADDRTOLADDR(buf->v_modetable)); for (i = 0, modes = 0; (i < (M_VESA_MODE_MAX - M_VESA_BASE + 1)) && (vesa_vmodetab[i] != 0xffff); ++i) { @@ -1016,12 +1016,16 @@ vesa_bios_init(void) if (!has_vesa_bios) goto fail; - x86bios_free(vmbuf, sizeof(buf)); + x86bios_free(vmbuf, sizeof(*buf)); return (0); fail: if (vmbuf != NULL) x86bios_free(vmbuf, sizeof(buf)); + if (vesa_adp_info != NULL) { + free(vesa_adp_info, M_DEVBUF); + vesa_adp_info = NULL; + } if (vesa_oemstr != NULL) { free(vesa_oemstr, M_DEVBUF); vesa_oemstr = NULL; @@ -1875,6 +1879,8 @@ vesa_unload(void) } splx(s); + if (vesa_adp_info != NULL) + free(vesa_adp_info, M_DEVBUF); if (vesa_oemstr != NULL) free(vesa_oemstr, M_DEVBUF); if (vesa_venderstr != NULL)