From nobody@FreeBSD.org  Thu Jun 30 23:44:29 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AF4DC1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 30 Jun 2011 23:44:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F67C8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 30 Jun 2011 23:44:29 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5UNiTBi055672
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 30 Jun 2011 23:44:29 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p5UNiTXv055671;
	Thu, 30 Jun 2011 23:44:29 GMT
	(envelope-from nobody)
Message-Id: <201106302344.p5UNiTXv055671@red.freebsd.org>
Date: Thu, 30 Jun 2011 23:44:29 GMT
From: Marcel Moolenaar <marcel@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [ia64] Epilog counter (ar.ec) needs to be saved and restored for exceptions
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         158547
>Category:       ia64
>Synopsis:       [ia64] Epilog counter (ar.ec) needs to be saved and restored for exceptions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ia64
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 30 23:50:04 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Marcel Moolenaar
>Release:        -CURRENT
>Organization:
>Environment:
FreeBSD eris.freebsd.org 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r223702M: Thu Jun 30 23:04:04 UTC 2011     marcel@eris.freebsd.org:/usr/obj/tank/usr/src/sys/ERIS  ia64
>Description:
The epilog counter (ar.ec) is implicitly saved and restored across function calls. The counter is saved in the previous frame register. Consequently, synchronous context switches do not need to save/restore this register.

For asynchronous context switches this is obviously not the case. Currently we do not save ar.ec in "exception_save" and we do not restore ar.ec in "exception_restore". SInce the GCC version in the source tree does not generate modulo-scheduled loops with the default options, ar.ec is typically not used. But as soon as GCC generates these loops are a different compiler is used, programs will misbehave and generally fail unless we save and restore ar.ec.

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
