From patchwork Mon May 13 11:35:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 796548 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1957516wra; Mon, 13 May 2024 04:35:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVo7wR/gV4ba3iToVXMvGb5KVzMgum2R996yasn+q3YXooXkNr+xA2RlBndTj6hL5S79DfrRktHkVKnRCUhayjp X-Google-Smtp-Source: AGHT+IHY6kmhANbKq0rb+E5iNAfrmVhwdJNRg3sPgr/uI6bSPZrOe71OHfQfikWIG8DfkEnqC8KL X-Received: by 2002:ac8:7e83:0:b0:43a:f0a3:815 with SMTP id d75a77b69052e-43dfdb807ebmr118281161cf.42.1715600144066; Mon, 13 May 2024 04:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715600144; cv=none; d=google.com; s=arc-20160816; b=SsABVxY8CJEO4po1m6/0RRNV2erqW9KWolaWkjl2EwdOVj7vRE9b0YUIBDtrBzDVX7 jByuMN1EXBZ0yNc3seXBICctFA0syrHS/WxE2T9M9zAw3bVmBGeMmF2JXVqcAEeA5Zii ZGB81NXSZn/5KKhNmYf5Cm/+X2ezP1XJUG186R0uyX1z3xcTh+rBYYPi878ZY5zfLaQn 6L44YJ5A5aEQGOBnRXKn+L6ppT/+VtuEVdRd79WqIZRJNtkRbvHVATCqu/bm4LGnyy5W LiOoukXY5FAXr+qV+zyqUc576W2gQThjwoaChbV15ZHLssmxqYlT1AdkrQ2HSVEiWXGP RFOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+bpzsiTQ+FU6Gt5FKC4227ayMzpXN9CSi3lSLOCpI+I=; fh=7ACP6O9wC7GFSApcN3rAjcSzzA5b5waVMeKpDczaxgw=; b=DBuMeotuT7GiNvaFV7FiaLvvoL78yqL2UYQPi/UrcQyje6OGQBQ6b8vP8pvEtNYETQ xQ2rJ4C0it45tI3dF6mslykqAeZREC1SLEtAzatMwkNVQyrwZJWMs2vbczUG07AoXSOU vJxbc0SWB1NgKC6lQq//eQ+0Ek37mWxTECNuf+vq75EpuauPYy/1r5ik2v7GTc8wYPak 6kATHEBH13NGBCWdbPAoVhePlkgJwXuD5sRLORLQZFDaPDL+6ksxskMXJBP+StDOXRL9 rsvc2T8cn078NnOxMeb8X3GJNsS4HsCxnm+0SP/5Nf7QtPUjoAXZ4Ld5E8tMvvdd2LU4 ZgyQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BlQE/N0V"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df5670998si94724211cf.370.2024.05.13.04.35.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2024 04:35:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BlQE/N0V"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6Txv-0005KD-4c; Mon, 13 May 2024 07:35:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6Txh-0005AP-Ax for qemu-devel@nongnu.org; Mon, 13 May 2024 07:35:21 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6Txe-0001QT-EP for qemu-devel@nongnu.org; Mon, 13 May 2024 07:35:21 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2df83058d48so55161941fa.1 for ; Mon, 13 May 2024 04:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715600115; x=1716204915; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+bpzsiTQ+FU6Gt5FKC4227ayMzpXN9CSi3lSLOCpI+I=; b=BlQE/N0VyiXgchighd1VEj4pNlJCjPTxjzpEsifPRLEYEuV4CB7upwIIV5KIc/VSWp Fd58T0HjiGuO2/GaZUYgpnxUDUUwIgiYKfWq5ouHXOMj1Q68+aaN0HRyRJ3WaJqwxC+1 U5osT1KrzOhb0W62tsqiL25nAi723P70PA0hE3amTbiz66T1uU2R5j7hhwvUGzeUmfd0 bu/DbWrfwcV8EbKky2rJrpYyD6nHImzDp5pCrEtvnWnMGFfW9TPGdD/k9FBW6Um9jmQb deJlqKPR3bB7glb7Tj7L6sHI31DzFuY2rumUnclaORXtrYfwV7SmymLbnMnzUeGHNXQk 7lWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715600115; x=1716204915; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+bpzsiTQ+FU6Gt5FKC4227ayMzpXN9CSi3lSLOCpI+I=; b=gs/KvdWnNGPlr5rEbJm/ECQNomm/2JTQNZRt/i6/QnYt8Rawv7hBTudTvRPGItbWZb nLZjlxrADcf1eflINQ2NuJwy8aL/XZzvAlt183GeoFCvlFWLtoJiQDyoXfNbkmhXOxWc zuEEYTp0ADHdRi/ZQiNaqoqhKXSlCJUenTEVGz5aQTzrhFmnWbuYiSYZTaZFWcRcNC4u eVc5+x4sZ5/1IVIrzCGZmQrVeHXU2UrP/NAM3Vtbkog2nS0A/o1+kkK3eHoMkcb00c00 XPIiZMYlOiEt3E71XvnMvW0sgfOeMd0X6OJ7HdmAfe0uIgUinQXCM5f9n+ZWzv6ywj4r b4xw== X-Gm-Message-State: AOJu0YwHORrzsCzq1awK4Oq6UbIyZUkkMB4ZSusJwBxo8gchf5boRdQ3 ndMrdSOXSPZXO/TYGZSGWqts4nq4/EmEPmqsE6ZS1kwVmJZAWkQ3wVlyatBc9wY= X-Received: by 2002:a2e:97d0:0:b0:2e3:6ef5:d567 with SMTP id 38308e7fff4ca-2e51ff4d239mr57211281fa.30.1715600115329; Mon, 13 May 2024 04:35:15 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35045583669sm9317707f8f.106.2024.05.13.04.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 04:35:14 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 5DC5C5F8C8; Mon, 13 May 2024 12:35:13 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: Peter Maydell Cc: qemu-devel@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [Semihosting Tests PATCH 1/3] .editorconfig: add code conventions for tooling Date: Mon, 13 May 2024 12:35:11 +0100 Message-Id: <20240513113513.640007-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240513113513.640007-1-alex.bennee@linaro.org> References: <20240513113513.640007-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=alex.bennee@linaro.org; helo=mail-lj1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org It's a pain when you come back to a code base you haven't touched in a while and realise whatever indent settings you were using having carried over. Add an editorconfig and be done with it. Signed-off-by: Alex Bennée --- .editorconfig | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e1540ae --- /dev/null +++ b/.editorconfig @@ -0,0 +1,28 @@ +# EditorConfig is a file format and collection of text editor plugins +# for maintaining consistent coding styles between different editors +# and IDEs. Most popular editors support this either natively or via +# plugin. +# +# Check https://editorconfig.org for details. +# +# Emacs: you need https://github.com/10sr/editorconfig-custom-majormode-el +# to automatically enable the appropriate major-mode for your files +# that aren't already caught by your existing config. +# + +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 + +[Makefile*] +indent_style = tab +indent_size = 8 +emacs_mode = makefile + +[*.{c,h}] +indent_style = space +indent_size = 4 +emacs_mode = c From patchwork Mon May 13 11:35:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 796549 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1957636wra; Mon, 13 May 2024 04:36:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtSNFGVlI2IV3UKF4GewubFKr6XTjV/3uQ6IgRaXftkdxq5rWXWLTogOlzMq6h6+zJa2/kClqw9+GTFfms+x2E X-Google-Smtp-Source: AGHT+IGzVw0P4/Dj4g1WD/rJbXxW8UjrmVPfa6N/r3ej2NbkWPR1+vTqqeP8eU82Q2t+jGOY1c8F X-Received: by 2002:a81:ac21:0:b0:61b:16d9:47cd with SMTP id 00721157ae682-622aff90091mr89933747b3.11.1715600161580; Mon, 13 May 2024 04:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715600161; cv=none; d=google.com; s=arc-20160816; b=azw8Fifcby2AnIEur7rVtIzAjx89GbjuRj8lRbhGcpJ92myNGx3Vpef9CHjhJuMc6W s1LY9dtS1xfTAWi/klBfbUM6H05f0qtbiVio3VPGiSs0vGOCBiG7GD6zxcVZ0CPuTNCT IFTjM4zJpp6PUFFl4qa9tO0q7UWQ386D6fTbxUnQIcJwT/egKrpX4WqV3o3LKDkRZR9U iHTx507l5/ZPGD/y87YujHICVlFlSVWuSCBgTcipL/0sVkV+fQHDyy2XKCFF7eCV2rzd K/fnljLRzubBxcamxSRuAVvTUDZDd2UEsYOT4F0FVP2oXZCWBwjD65y8M2ve4heSx+wH wiAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kP0ehDJwQwNPc3oCtX0Yl2I4Rx2QZwnqfx2D/w2BPys=; fh=7ACP6O9wC7GFSApcN3rAjcSzzA5b5waVMeKpDczaxgw=; b=hs71Q4ISVO5Da2+C7JeeuxUjUl5bIZJLzGHGSvk2GmszJw+7IFTt2l5qVT55nEh5rr ibRHnN6+W05nh22L166yHTO0wILtBQMb8jWQKTgcGAtYtKO4He2sB6OtWQLJjNlrkSSZ AAtP+0sidgwXlTs/mQGE4YOYowTcDArBEcl4MCWjGeyhmn7iBL8+XYR8QV0XXlDBbvYM DZw8wEHvR+KuM+SpqqW95coZdFhpEi5IZmQhM7CzMzBx4nf6yPjCyP5S69NiKbYtI9/L SmpVVXUIbwWFs+pa8MecJu1uLA3pIEVnhsZQcM+81G8NFGC9IprLeMuOAFwjGqtuujQv +j2A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EYd1/tov"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43e1f077a48si7963291cf.497.2024.05.13.04.36.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2024 04:36:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EYd1/tov"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6Ty1-0005PB-U3; Mon, 13 May 2024 07:35:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6Txi-0005CX-VP for qemu-devel@nongnu.org; Mon, 13 May 2024 07:35:28 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6Txg-0001Qp-Sx for qemu-devel@nongnu.org; Mon, 13 May 2024 07:35:22 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-51f174e316eso5006273e87.0 for ; Mon, 13 May 2024 04:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715600119; x=1716204919; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kP0ehDJwQwNPc3oCtX0Yl2I4Rx2QZwnqfx2D/w2BPys=; b=EYd1/tovwwEWLou00wYaNiRj3rTLY0WpVyqyukwfnkfyupuEvb0HxT6cSvIQXVoJ4t ylWBCzj+759q9qqBmbY2fKfJjYtSFKfNwuwlXV67R1rae30O28eFSqjL3m987YWFfCwB dZNI03vHGBvmkxzNVDNNmj7TBZuxrTLPsrju6hm6Rfr42QkXCMkb9QGZzgjuvPOybOJS azHOF0LDrlT4eXWydG5LX4YPBmaiF74+dPT3vqzFAW0C2s4HBCeiFai35pwgz7MWYTee BnMN2JGaLrS6ZKdrEWYgRUUj/g7eG1XrXVl+Xoip3VgOL95Nc4MzFLU3pC1OprwR/aLv 7Kdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715600119; x=1716204919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kP0ehDJwQwNPc3oCtX0Yl2I4Rx2QZwnqfx2D/w2BPys=; b=dxBkyNqRRPQGfHet0+CtGNW8JX917OiUfus1WawgRKVjoep5IMNwPeQOLwxFRbHqbP J2PtbxYMjNevoo0FcC+AcOVw43pwt6rCMRWwnMCICj6shj3RkD8L8iEYmvO6NR1YTMLL HumXfU00sN4ejamUucMRSpqs8Wu/hE4IfD6lfgSLGD/0jwrf+hd+3zVQBQYY7EFvogl9 2YC+WysNZojNzeTiKwA9nnE8E0p9qdadAHMT8AyJLUpWIKCx9JaJesIhSOQZXdW8laSu p2jUzuwVIAqO5vQH1UCDuJUo2fbJC8Uv0+4LtLG6jww2I393i1VWsbPb+woLDL3dJfBr 4THw== X-Gm-Message-State: AOJu0YzFx0152L1s2ozWEWuXui2tiZL872moAVoxDCqzSFldMUxQaNM0 rvlkZwzawUQqIjaAdAstmqT2b/gXCjFV3txPdEIj+suZ38JdW4l73Abaig3Jewi/ID5EhD33J65 Q X-Received: by 2002:a05:6512:2003:b0:51e:25d2:453f with SMTP id 2adb3069b0e04-5220ff72f1dmr4540795e87.68.1715600119097; Mon, 13 May 2024 04:35:19 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502b79bc0asm10987188f8f.1.2024.05.13.04.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 04:35:14 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 6B30D5FA15; Mon, 13 May 2024 12:35:13 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: Peter Maydell Cc: qemu-devel@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [Semihosting Tests PATCH 2/3] update includes for bare metal compiling Date: Mon, 13 May 2024 12:35:12 +0100 Message-Id: <20240513113513.640007-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240513113513.640007-1-alex.bennee@linaro.org> References: <20240513113513.640007-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We shouldn't use for our own implementation. Also the base types we need live in as doesn't exist for the bare metal compilers. Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell --- semihosting.c | 4 ++-- semihosting.h | 2 +- string.c | 2 +- usertest.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/semihosting.c b/semihosting.c index 7a0ee0c..27dafbe 100644 --- a/semihosting.c +++ b/semihosting.c @@ -16,8 +16,8 @@ * from this software without specific prior written permission. */ -#include -#include +#include +#include "string.h" #include "semihosting.h" int semi_open(char const *filename, int mode) diff --git a/semihosting.h b/semihosting.h index 06cda8d..68344fb 100644 --- a/semihosting.h +++ b/semihosting.h @@ -19,7 +19,7 @@ #ifndef SEMIHOSTING_H #define SEMIHOSTING_H -#include +#include #define SYS_OPEN 1 #define OPEN_RDONLY 1 diff --git a/string.c b/string.c index 045d71b..c289aa1 100644 --- a/string.c +++ b/string.c @@ -16,7 +16,7 @@ * from this software without specific prior written permission. */ -#include +#include "string.h" static void *__memmove_down(void *__dest, __const void *__src, size_t __n) { diff --git a/usertest.c b/usertest.c index ce0f61d..5df95f3 100644 --- a/usertest.c +++ b/usertest.c @@ -20,7 +20,7 @@ * from this software without specific prior written permission. */ -#include +#include "string.h" #include "semihosting.h" #include "printf/printf.h" From patchwork Mon May 13 11:35:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 796550 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp1957699wra; Mon, 13 May 2024 04:36:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUF/SioBa+Tt+8tXlnr5Exq7XTcxAgIL5qEJ6663mXVziQilcwJ+x++xYQty5gcvvXKIZ1Jdv7nuYJYeudVwoHH X-Google-Smtp-Source: AGHT+IEFBLaGFSTJc5lb4vShH3lQUZu/bxUr8bSj+cgBCTz6ESS+dsFmpZDc+fzVghLwE1aQsqE7 X-Received: by 2002:a05:6830:18f4:b0:6f0:e833:17e6 with SMTP id 46e09a7af769-6f0e9137c9dmr11136913a34.17.1715600172574; Mon, 13 May 2024 04:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715600172; cv=none; d=google.com; s=arc-20160816; b=BFEsqxtFLQFkB7VxBg86/xAWg5CCogyWpsZ8rBPV+vUK3EAzxWvtE1KYMAh24Bsa2d ILRgjcg5jIBcNBTLiwJYWBMK2cIoD/EqEhxgIROm3p42+UTE/epky8jVZsiVRjJWhlHw qg50DR7fmL8zcbhX4PJPPl+QEBICRrWJ4G4t2bElW5YpJ8l+G8XU6BfQLuPXKRC5diMF aQYiuZDR0aFHfvQkLctnfwnUgLuT9ixXg31ESeim+jvOY0GwRm+XiUD19LeAq6OqziCw 5DXb23bDqZBkhj8BewXnfN3wSB1d4bTFnX/ws8jGcTJJNfIAPno7DIebdbUtCWNTE4In cGIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FwAfCWJvmUAGzEmOykyRdNZT3QAGaq1DLOi5VTUI8GE=; fh=7ACP6O9wC7GFSApcN3rAjcSzzA5b5waVMeKpDczaxgw=; b=vJv9tVtOLbl3fYQpy/KC2czVSfv2QeYvjfVJG297Ps/sizyoAqSJIu2rvlnotcCl2N 2LpZZGnO+z2+yTRsBH2ONVnRdnv3E/reaFbZrvxj14lw8k1nhDvjs0t1HwQryT9bICvt So1N8RY1bm9D7iV9SsQ62kxeMfyWIcAit6H+Rppl4mSjR+EjbuDBvbtlOBAzQuKjnJd9 LTVFq1sYWGksMT0BWn3CI0drZxjwI6l0C20IyBdvrioX7UFtueGz8hS+P/pZ5u2Da20i eypD2hjmxlvV3O0jRSPCirAL+SuVtxgPsluHpcnVzWPW57/+F41A/kSzYOLA4fb6BlNu avfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m5TcLArg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792df358fc1si227803085a.111.2024.05.13.04.36.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2024 04:36:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m5TcLArg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6Ty3-0005U6-Ip; Mon, 13 May 2024 07:35:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6Txp-0005JQ-Cx for qemu-devel@nongnu.org; Mon, 13 May 2024 07:35:30 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6Txk-0001RE-CL for qemu-devel@nongnu.org; Mon, 13 May 2024 07:35:29 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-51f1bf83f06so5162319e87.1 for ; Mon, 13 May 2024 04:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715600121; x=1716204921; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FwAfCWJvmUAGzEmOykyRdNZT3QAGaq1DLOi5VTUI8GE=; b=m5TcLArgU2T4dvBGN9dtSV1kQK7WjzjpLuWMN83RW5WOkYqvX17qwYkjn/On3+8ZH3 0IPnJghfzIqbayOupD/ZOTWUKn1r/7R26O7SqodM/PWw6lfjwp85CjpACW2zR5SDTykx fGBUy3WkhZVi1liD9tr78h116LHeDBhBv8Jt1WjEaBjdN/tTlH7QwskBXZtND3hcHrbJ YENX3nSGhl8md12wvaGrxmJL6A4nzdXg21KSW4/m1pJCplzzar7BJdQ65likDri1nFEA Ho/f85BTnmioWXmbeSWLe+c+1vhNI+QHxJB+/SHd1Rx3+tCLdpR8sMThgioHLOJyFuuR VSgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715600121; x=1716204921; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FwAfCWJvmUAGzEmOykyRdNZT3QAGaq1DLOi5VTUI8GE=; b=F7pfIZRPPnMf2DtpSj+fSZ1yjDfwkq0dWIzAyiGnPuUXnoRDiNtbQax4EK00o7YOUe nsK/XcfU3WlohX9db5v2lhDu7ZSahPahDtx1IyAxbTXDc9Fnx+Zu6wir6i9ku+6qmJVT cEDKKGcTC/Echku0d8rlvjS9T6cOpNWgwnVA2OY4I0gvpExHu0G8862l+r2+kq6sGdlU 0aJMAlIOiOQSb93BrA/fn/BKMDO3wyQCwDbeGOSYjuFPP6I855HNAARzwHGY3WyE9f9g CUd1FgXVnw6F2nYS8zd3HlAT+7Owrxfl9kzjfyMy4iagcfotw1dw+DhvlntBR3Do6z25 lRVA== X-Gm-Message-State: AOJu0YxrtsqJueaDDuRGwGKVgL+0oszc/wkaXH2+bMpEAmzp56Qc9hxL 8XlBRd2scpUuog8tajqFJOIl9XoufDAICasheFY1sJ3LJWWa2D6+9uWzG1XGo1+55shzMVd6njg Y X-Received: by 2002:a05:6512:158e:b0:51d:68fb:5d73 with SMTP id 2adb3069b0e04-5220fb768fcmr8585591e87.8.1715600119547; Mon, 13 May 2024 04:35:19 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502baad0absm10869226f8f.69.2024.05.13.04.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 04:35:14 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 77DE85FA17; Mon, 13 May 2024 12:35:13 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: Peter Maydell Cc: qemu-devel@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [Semihosting Tests PATCH 3/3] add SYS_GET_CMDLINE test Date: Mon, 13 May 2024 12:35:13 +0100 Message-Id: <20240513113513.640007-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240513113513.640007-1-alex.bennee@linaro.org> References: <20240513113513.640007-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x134.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We actually had the stubs to implement this. The main pain is getting the binary name into the program so we can validate the result. Signed-off-by: Alex Bennée --- Makefile | 22 +++++++++++----------- usertest.c | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 59fd831..f77665f 100644 --- a/Makefile +++ b/Makefile @@ -85,37 +85,37 @@ systest-srcs = start.S string.c $(usertest-srcs) microbit-systest-srcs = start-microbit.S string.c $(usertest-srcs) usertest-a32: $(usertest-srcs) - $(A32GCC) --static -o $@ $^ + $(A32GCC) -DBINARY_NAME="\"$@\"" --static -o $@ $^ usertest-t32: $(usertest-srcs) - $(T32GCC) --static -o $@ $^ + $(T32GCC) -DBINARY_NAME="\"$@\"" --static -o $@ $^ usertest-a32-hlt: $(usertest-srcs) - $(A32GCC) -DUSE_HLT --static -o $@ $^ + $(A32GCC) -DBINARY_NAME="\"$@\"" -DUSE_HLT --static -o $@ $^ usertest-t32-hlt: $(usertest-srcs) - $(T32GCC) -DUSE_HLT --static -o $@ $^ + $(T32GCC) -DBINARY_NAME="\"$@\"" -DUSE_HLT --static -o $@ $^ usertest-a64: $(usertest-srcs) - $(A64GCC) --static -o $@ $^ + $(A64GCC) -DBINARY_NAME="\"$@\"" --static -o $@ $^ systest-a32.axf: $(systest-srcs) - $(A32GCC) -o $@ $^ $(A32LINKOPTS) + $(A32GCC) -DBINARY_NAME="\"$@\"" -o $@ $^ $(A32LINKOPTS) systest-t32.axf: $(systest-srcs) - $(T32GCC) -o $@ $^ $(A32LINKOPTS) + $(T32GCC) -DBINARY_NAME="\"$@\"" -o $@ $^ $(A32LINKOPTS) systest-a32-hlt.axf: $(systest-srcs) - $(A32GCC) -DUSE_HLT -o $@ $^ $(A32LINKOPTS) + $(A32GCC) -DBINARY_NAME="\"$@\"" -DUSE_HLT -o $@ $^ $(A32LINKOPTS) systest-t32-hlt.axf: $(systest-srcs) - $(T32GCC) -DUSE_HLT -o $@ $^ $(A32LINKOPTS) + $(T32GCC) -DBINARY_NAME="\"$@\"" -DUSE_HLT -o $@ $^ $(A32LINKOPTS) systest-t32-bkpt.axf: $(microbit-systest-srcs) - $(V7MGCC) -DUSE_BKPT -o $@ $^ $(AV7MLINKOPTS) + $(V7MGCC) -DBINARY_NAME="\"$@\"" -DUSE_BKPT -o $@ $^ $(AV7MLINKOPTS) systest-a64.axf: $(systest-srcs) - $(A64GCC) -nostdlib -o $@ $^ $(A64LINKOPTS) + $(A64GCC) -DBINARY_NAME="\"$@\"" -nostdlib -o $@ $^ $(A64LINKOPTS) run-usertest-a32: usertest-a32 $(QEMU_ARM) usertest-a32 diff --git a/usertest.c b/usertest.c index 5df95f3..268a9d9 100644 --- a/usertest.c +++ b/usertest.c @@ -315,6 +315,26 @@ static int test_feature_detect(void) return 0; } +static int test_cmdline(void) +{ + char cmdline[256]; + int actual; + const char *s, *c; + + if (semi_get_cmdline(&cmdline[0], sizeof(cmdline), &actual)) { + semi_write0("FAIL could recover command line\n"); + return 1; + } + + if (strcmp(&cmdline[0], BINARY_NAME) != 0) { + semi_write0("FAIL unexpected command line:"); + semi_write0(&cmdline[0]); + } + + semi_write0("PASS command line test\n"); + return 0; +} + int main(void) { void *bufp; @@ -366,6 +386,10 @@ int main(void) return 1; } + if (test_cmdline()) { + return 1; + } + semi_write0("ALL TESTS PASSED\n"); /* If we have EXIT_EXTENDED then use it */