From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id D092D3850430 for ; Tue, 16 Mar 2021 14:39:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D092D3850430 Received: by mail-ot1-x32e.google.com with SMTP id h6-20020a0568300346b02901b71a850ab4so6957533ote.6 for ; Tue, 16 Mar 2021 07:39:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=knpWYGAhGgwOQJJ9LEh9MSXq0F5hZger9Wh9ODlaPi4=; b=Pt4bOldaxuAaJN2gfyDbksuhox5XyjYUMWkjeXoO8D2LOb8n/eP9TBRksHRfPF3dCd 9pgpp9vW3ILyPO0HMCDhCLb2UNGxk8BkZiEWWY3XeGHMV7VQomJEfdHQ/okn8wqu4+LW SO9TffvAg9RiyX/9dhJRcnN7Qin9sutzjzpGAQqQP2qxJPsH4CJZ5l68aIneOeX4+fF0 feMP64k2xm/AVH/E2P68UPuSqXLuu4kGVKiix1hqJNAu3GCPmA+PqrDNwks/UtqYkkYr 8y81n0UwfczA8zhlezEKdmPN2fSeQGRa2JDKwxOlnQjAEolewffPFSWYiMqtDsGqsUpb zDNw== X-Gm-Message-State: AOAM532j81QUqyR/DoMtBmcrDKDKSPNZe4fRXMgMHuM2VfgYAz7TGu/e YTKsCY/ScATXupxuJcHsz7pI4YQQL+YAMn2zehAfdzhVBx0= X-Google-Smtp-Source: ABdhPJy2Okx0SCpbv+J+FJckIrR2Vg0oo/c9DXzJYmQezejJ75lpIcPz9Gd5CvacjWEg34l99KJB6EJGmOYzuIW83HI= X-Received: by 2002:a9d:3a4b:: with SMTP id j69mr3916007otc.47.1615905587997; Tue, 16 Mar 2021 07:39:47 -0700 (PDT) MIME-Version: 1.0 From: Fengkai Sun Date: Tue, 16 Mar 2021 22:39:36 +0800 Message-ID: Subject: why don't setjmp save MXCSR register and x87 control word? To: libc-help@sourceware.org X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 14:39:50 -0000 Hi list, To the best of my knowledge, setjmp have to save all the callee-saved registers. According to Sys V ABI: > The control bits of the MXCSR register are callee-saved (preserved across calls), while the status bits are caller-saved (not preserved). > The x87 status word register is caller-saved, whereas the x87 control word is callee-saved. But in sysdeps/x86_64/setjmp.S, __sigsetjmp only saves rbx, rbp, r12-r15, rsp. I also found an example in FreeBSD, which makes more sense to me: https://svnweb.freebsd.org/base/head/lib/libc/amd64/gen/_setjmp.S?view=markup I don't know if there will be any problem if MXCSR and x87 control word are not saved and get clobbered . Best, Fengkai