From nobody Fri Oct 18 06:21:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org ARC-Seal: i=1; a=rsa-sha256; t=1622574483; cv=none; d=zohomail.com; s=zohoarc; b=g5gcJs8jcEMyNqjhlPK5OR3aGcD19DKP8S3xk/Bv/DEw2tfV8LCnW36WDsxr/NoaayvfLKoK1Vh/f279nsoLEy4wt2hpuNfWOrSPvfo3HpeOaDAPk6IKpDDnNx0w1iP1sly0mlzmsAljujfLbRWnSXUp2laOwIZ1HvcvBYfvfvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622574483; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=hjrQNX0Zeai5DuYHJoIKIsnlC8k8McgH6A8LEHIrttU=; b=VPW80yigE65zw5fIOx7/h9oiW75+pSnikLRSC906WmGHyXQ+RUdMSZLAuA93QugPhyOCOWQDqlOsNSKV6p8J1dZ+ygyWN5oWrcJaNf8EOFKKRQzphNYE/Vo6gEl1CYkFv+/PVd2px5auw2ZOvrmKxztGJL1DQ9wYVkVvm0RMz2A= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1622574483626327.9936826962452; Tue, 1 Jun 2021 12:08:03 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id F01B410619E6; Tue, 1 Jun 2021 19:07:59 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 2D0BC10619E1 for ; Tue, 1 Jun 2021 19:07:46 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mailout10.t-online.de (Postfix) with SMTP id 742A972525; Tue, 1 Jun 2021 21:07:01 +0200 (CEST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1lo9j6-4ZFkTA0; Tue, 1 Jun 2021 21:06:56 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 3A1242000A0; Tue, 1 Jun 2021 21:06:56 +0200 (CEST) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Kevin O'Connor Date: Tue, 1 Jun 2021 21:06:54 +0200 Message-Id: <20210601190656.7162-1-vr_qemu@t-online.de> In-Reply-To: <6bff0709-f229-c180-e91f-52c7c3fea5ac@t-online.de> References: <6bff0709-f229-c180-e91f-52c7c3fea5ac@t-online.de> MIME-Version: 1.0 X-ID: bHh+vuZfZh+DiffbqjCPjRXW-+AS3a0ewO-xYk8WB4mD1T8apYcWeYAgh8Y2ORSQOI X-TOI-EXPURGATEID: 150726::1622574416-000121E1-23BEF011/0/0 CLEAN NORMAL X-TOI-MSGID: 28333c42-cf7c-44ee-a0eb-13441c7c31ad Message-ID-Hash: P7QDMTTXQOMCRACNCPDGZKAIH5ZUHB6B X-Message-ID-Hash: P7QDMTTXQOMCRACNCPDGZKAIH5ZUHB6B X-MailFrom: volker.ruemelin@t-online.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: seabios@seabios.org X-Mailman-Version: 3.3.4 Precedence: list Subject: [SeaBIOS] [PATCH v3 1/3] stacks: fix asm constraints in run_thread() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ The variables data, func, thread and cur are input operands for the asm statement in run_thread(). The assembly code clobbers these inputs. From the gcc documentation chapter Extended-Asm, Input Operands: "It is not possible to use clobbers to inform the compiler that the values in these inputs are changing. One common work-around is to tie the changing input variable to an output variable that never gets used." Add unused output variables and fix the asm constraints in run_thread(). Signed-off-by: Volker R=C3=BCmelin --- src/stacks.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/stacks.c b/src/stacks.c index 2fe1bfb..ef0aba1 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -565,6 +565,7 @@ run_thread(void (*func)(void*), void *data) thread->stackpos =3D (void*)thread + THREADSTACKSIZE; struct thread_info *cur =3D getCurThread(); hlist_add_after(&thread->node, &cur->node); + u32 unused_a, unused_b, unused_c, unused_d; asm volatile( // Start thread " pushl $1f\n" // store return pc @@ -576,14 +577,15 @@ run_thread(void (*func)(void*), void *data) // End thread " movl %%ebx, %%eax\n" // %eax =3D thread " movl 4(%%ebx), %%ebx\n" // %ebx =3D thread->node.next - " movl (%5), %%esp\n" // %esp =3D MainThread.stackpos - " calll %4\n" // call __end_thread(thread) + " movl (%9), %%esp\n" // %esp =3D MainThread.stackpos + " calll %8\n" // call __end_thread(thread) " movl -4(%%ebx), %%esp\n" // %esp =3D next->stackpos " popl %%ebp\n" // restore %ebp " retl\n" // restore pc "1:\n" - : "+a"(data), "+c"(func), "+b"(thread), "+d"(cur) - : "m"(*(u8*)__end_thread), "m"(MainThread) + : "=3Da"(unused_a), "=3Dc"(unused_c), "=3Db"(unused_b), "=3Dd"(unu= sed_d) + : "0"(data), "1"(func), "2"(thread), "3"(cur), + "m"(*(u8*)__end_thread), "m"(MainThread) : "esi", "edi", "cc", "memory"); return; =20 --=20 2.26.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org