Date: Sat, 21 Jan 2006 20:26:41 GMT From: Tanaka Akira <akr@m17n.org> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/92110: setcontext restore the carry flag Message-ID: <200601212026.k0LKQfk1097826@www.freebsd.org> Resent-Message-ID: <200601212030.k0LKU41a038440@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 92110 >Category: misc >Synopsis: setcontext restore the carry flag >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 21 20:30:03 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Tanaka Akira >Release: FreeBSD 5.4 >Organization: AIST >Environment: FreeBSD freebsd54.vmw 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun May 8 10:21:06 UTC 2005 root@harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: On Pentium, getcontext saves EFLAGS and setcontext restores it. When CF is set in EFLAGS, setcontext treats it as an system call error. >How-To-Repeat: % cat t.c #include <stdlib.h> #include <stdio.h> #include <ucontext.h> ucontext_t c; int first; volatile int carry_set; int main() { first = 1; carry_set = ~0; carry_set += 1; if (getcontext(&c) != 0) { perror("getcontext"); exit(1); } printf("first:%d\n", first); if (first == 0) exit(0); first = 0; if (setcontext(&c) != 0) { perror("setcontext"); exit(1); } printf("setcontext returns\n"); exit(1); } % gcc -march=pentium4 t.c % ./a.out first:1 setcontext: Unknown error: 0 If "carry_set += 1" is changed to "carry_set -= 1", it works fine: % ./a.out first:1 first:0 >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601212026.k0LKQfk1097826>