From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1WIjHs-0002sP-50 for mharc-grub-devel@gnu.org; Wed, 26 Feb 2014 13:32:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIjHh-0002Yu-Rz for grub-devel@gnu.org; Wed, 26 Feb 2014 13:32:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIjHY-0001PW-Ud for grub-devel@gnu.org; Wed, 26 Feb 2014 13:32:45 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:38863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIjHY-0001OZ-P7 for grub-devel@gnu.org; Wed, 26 Feb 2014 13:32:36 -0500 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Feb 2014 11:32:36 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Feb 2014 11:32:33 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 1F8181FF001A for ; Wed, 26 Feb 2014 11:32:33 -0700 (MST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by b03cxnp08025.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s1QIWXaq10813924 for ; Wed, 26 Feb 2014 19:32:33 +0100 Received: from d03av02.boulder.ibm.com (localhost [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s1QIWWZ8019233 for ; Wed, 26 Feb 2014 11:32:32 -0700 Received: from ram.oc3035372033.ibm.com.com (sig-9-65-83-23.mts.ibm.com [9.65.83.23]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s1QIVZLm014663; Wed, 26 Feb 2014 11:32:30 -0700 From: Ram Pai To: grub-devel@gnu.org Subject: [RFC PATCH 23/23] Optional: Power7 VSX instructions workaround. Date: Wed, 26 Feb 2014 10:31:22 -0800 Message-Id: <1393439482-20341-24-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1393439482-20341-1-git-send-email-linuxram@us.ibm.com> References: <1393439482-20341-1-git-send-email-linuxram@us.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14022618-6688-0000-0000-000007007F73 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.110.153 Cc: tonyb@au1.ibm.com, anton@au1.ibm.com, linuxram@us.ibm.com, tlfalcon@linux.vnet.ibm.com, tbberry@us.ibm.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Feb 2014 18:32:55 -0000 Power7 cannot handle VSX instructions correctly. It segfaults. This patch is applicable only for power7 systems. Signed-off-by: Ram Pai --- grub-core/fs/fshelp.c | 10 ++++++++++ grub-core/kern/term.c | 11 +++++++++++ grub-core/normal/term.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/grub-core/fs/fshelp.c b/grub-core/fs/fshelp.c index 42bd542..bd610df 100644 --- a/grub-core/fs/fshelp.c +++ b/grub-core/fs/fshelp.c @@ -207,12 +207,22 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode, read_symlink_func read_symlink, enum grub_fshelp_filetype expecttype) { +#ifdef __powerpc64le__ + // workaround for a problem on power7 in LE. + struct grub_fshelp_find_file_ctx ctx; + ctx.path = path; + ctx.rootnode = rootnode; + ctx.foundtype = GRUB_FSHELP_DIR; + ctx.symlinknest = 0; +#else struct grub_fshelp_find_file_ctx ctx = { .path = path, .rootnode = rootnode, .foundtype = GRUB_FSHELP_DIR, .symlinknest = 0 }; +#endif + grub_err_t err; if (!path || path[0] != '/') diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c index 07720ee..4ff3886 100644 --- a/grub-core/kern/term.c +++ b/grub-core/kern/term.c @@ -40,6 +40,16 @@ static void grub_putcode_dumb (grub_uint32_t code, struct grub_term_output *term) { +#ifdef __powerpc64le__ + // this hack is needed for powerpc64le on power7 cpu only + // segfaults on VSX instructions generated by the compiler + struct grub_unicode_glyph c; + c.base = code; + c.variant = 0; + c.attributes = 0; + c.ncomb = 0; + c.estimated_width = 1; +#else struct grub_unicode_glyph c = { .base = code, @@ -48,6 +58,7 @@ grub_putcode_dumb (grub_uint32_t code, .ncomb = 0, .estimated_width = 1 }; +#endif if (code == '\t' && term->getxy) { diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index 4c2238b..adddcf9 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -224,6 +224,14 @@ grub_puts_terminal (const char *str, struct grub_term_output *term) { for (; *str; str++) { +#ifdef __powerpc64le__ + struct grub_unicode_glyph c; + c.variant = 0; + c.attributes = 0; + c.ncomb = 0; + c.estimated_width = 1; + c.base = *str; +#else struct grub_unicode_glyph c = { .variant = 0, @@ -232,6 +240,7 @@ grub_puts_terminal (const char *str, struct grub_term_output *term) .estimated_width = 1, .base = *str }; +#endif FOR_ACTIVE_TERM_OUTPUTS(term) { @@ -417,6 +426,13 @@ static void putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term, int fixed_tab) { +#ifdef __powerpc64le__ + struct grub_unicode_glyph c2; + c2.variant = 0; + c2.attributes = 0; + c2.ncomb = 0; + c2.estimated_width = 1; +#else struct grub_unicode_glyph c2 = { .variant = 0, @@ -424,6 +440,7 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term, .ncomb = 0, .estimated_width = 1 }; +#endif if (c->base == '\t' && fixed_tab) { @@ -500,6 +517,13 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term, static void putcode_real (grub_uint32_t code, struct grub_term_output *term, int fixed_tab) { +#ifdef __powerpc64le__ + struct grub_unicode_glyph c; + c.variant = 0; + c.attributes = 0; + c.ncomb = 0; + c.estimated_width = 1; +#else struct grub_unicode_glyph c = { .variant = 0, @@ -507,6 +531,7 @@ putcode_real (grub_uint32_t code, struct grub_term_output *term, int fixed_tab) .ncomb = 0, .estimated_width = 1 }; +#endif c.base = map_code (code, term); putglyph (&c, term, fixed_tab); @@ -527,12 +552,20 @@ static grub_ssize_t get_maxwidth (struct grub_term_output *term, int margin_left, int margin_right) { +#ifdef __powerpc64le__ + struct grub_unicode_glyph space_glyph; + space_glyph.base = ' '; + space_glyph.variant = 0; + space_glyph.attributes = 0; + space_glyph.ncomb = 0; +#else struct grub_unicode_glyph space_glyph = { .base = ' ', .variant = 0, .attributes = 0, .ncomb = 0, }; +#endif return (grub_term_width (term) - grub_term_getcharwidth (term, &space_glyph) * (margin_left + margin_right) - 1); @@ -1021,6 +1054,14 @@ grub_xnputs (const char *str, grub_size_t msg_len) { for (; msg_len--; str++, msg_len++) { + #ifdef __powerpc64le__ + struct grub_unicode_glyph c; + c.variant = 0; + c.attributes = 0; + c.ncomb = 0; + c.estimated_width = 1; + c.base = *str; + #else /* __powerpc64le__ */ struct grub_unicode_glyph c = { .variant = 0, @@ -1029,6 +1070,7 @@ grub_xnputs (const char *str, grub_size_t msg_len) .estimated_width = 1, .base = *str }; + #endif /* __powerpc64le__ */ FOR_ACTIVE_TERM_OUTPUTS(term) { -- 1.8.5.3