From patchwork Fri Feb 9 19:47:32 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: 771336 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp1036650wre; Fri, 9 Feb 2024 11:49:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRbk1dRywgGf4/nMgUxY8X0P1h9YDnIfMSSa5rBVXXjLoq85spcNYl6AltsKRjB/04fwf6 X-Received: by 2002:a05:620a:211c:b0:784:71a6:f8df with SMTP id l28-20020a05620a211c00b0078471a6f8dfmr70161qkl.44.1707508147498; Fri, 09 Feb 2024 11:49:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707508147; cv=none; d=google.com; s=arc-20160816; b=NAnZxT7h86EE2jsi91MX3climr9tuKek9wlvt0/aQR3iVSIvEiOg4lnUwFyYX3nO8H FhEgvk+zXWwkHOqjKQTpiOl+boXZduBQUjWkcRnekKNMlk3VnCu1m49PTM8S0YkSiQO+ qCFioQzUXzk9xESc1DarwWimcsLoTrB78He0nnhSn5C3L+1ulYLCWOiJfukOfZguJlVP oIfLJEdAOPcHTTPGmJu1Eb+IwYnRFQsLlDpWBzzfoLrz9CXoifynUWOPgQS2xyQnO/0D FVTSRx99HEPQYv/pR0wi3p6VJcm+FRw5Vog0MShBgtR5P8ix7hFOWC0GrZoXsGfBAMSK Tt4A== 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=Wtk9GiV3W2xXFlYcJpJzbgDy4P/9SBqVnzDNRkRcVpY=; fh=dYN7x08IrTyS64rEMnxwAmlstbId7/8zyonUMdjaYUM=; b=xvl1TbAdBpA+l70kuf/yUY7+rfaQ0DxwLbKZbWyq7l8Q2+DRIxDuivU4wg6ASUSKIS heg9MJDbwLXQ+Et9OSe3khBpzq/5ZFZWB+AO4fbjorm1m4F3GxaFdaVaDFt5lYm4h7Mz hAPNGXz0/H5A6Puxr+18fxEYRMq/ZvnNBzD5bIjBdvkpBWj5Bp3ba21Da7wsaK8AKxDh iMYQN5qPqrgWqznpdwz2ZgnC00kMrsFIyfaaYlYbPWCU5qLlx1jkyGHrI7n7fnBzMdlg 2uPIpchul2WVsjY3u5msySn2hjgxAKt0rwXryt6Bm4wgNdOCm/vArqftLU7xnYbiQktf zYbg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ayRKH+ZY; 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 X-Forwarded-Encrypted: i=1; AJvYcCUPz77USW8HaG/vkyElGJRhDEhmbNiT+cyk6X/gaNa69tPX0bJOSgAQ+sUN3JfkOqyldvw4DqHNMlXTJEuYwik5 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s19-20020a05620a16b300b0078599afd89fsi147325qkj.164.2024.02.09.11.49.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Feb 2024 11:49:07 -0800 (PST) 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=ayRKH+ZY; 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 1rYWre-0006qp-Fh; Fri, 09 Feb 2024 14:48:46 -0500 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 1rYWqi-0005Y7-GK for qemu-devel@nongnu.org; Fri, 09 Feb 2024 14:47:49 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYWqc-0005Bn-LJ for qemu-devel@nongnu.org; Fri, 09 Feb 2024 14:47:45 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40fd2f7ef55so14305385e9.0 for ; Fri, 09 Feb 2024 11:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707508061; x=1708112861; 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=Wtk9GiV3W2xXFlYcJpJzbgDy4P/9SBqVnzDNRkRcVpY=; b=ayRKH+ZYMpOf+Q2W/eQr7tot9IviVxXXcO1gKOimc8oZq9sL98l5D5kSExgf7RMSxz uPfIQYqAY01Uk0o52ozJnHwI1xLdcieGJp28p96dhpxceTtyKNJfEK9V51Z7wxpOraEN G/jK9XgwAyF9l01FQZkR6p6FDkcjgQSRN2li7QiVOCwDmClg0dcu23hZc6dRRBT+5zIi 4oeYPG3LSGYcGlA81iezOwuZBCWVSvsDrEEFYV5E1jkMIKAIQHW8qmiws5t/3mKM9dyH 672uTiBQKnzR/hw2rRBaS/u0edgK+CMSO97tWUyoLQBoQQNQQqjeAVRd1S5IcwK5tjZ4 90+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707508061; x=1708112861; 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=Wtk9GiV3W2xXFlYcJpJzbgDy4P/9SBqVnzDNRkRcVpY=; b=juUgfvsxtyG+BmoPelCuEUt74A4Jzady1yswM3VBhDUuAP10cQUY4uTjPwkHosfDf9 Zsu4F2deJEdFkqnmnvBSCsqKXSVum65tdbvzRKUwoMaQkI9f7JvJFn3d0crem4Ot+0hs hm3RJUQsThhhcM9AJB8yf9XMt8fgqmQYtduWzZVjbaYBYK+7jndDZ4kvHH66CTx84YBR v9FL1ecz06w6/X1YbC9Dm4XiEiEhSa+BsPydhoDQb9u+titp5sYTsoNA9/0qqkws+QeS yAdn3JA+rR8iHMfSicO4LIBddgxYIDqiX1wQXzGWt/v9aLgAoro+wGo2Qi6ZDAERLRLD VIVw== X-Gm-Message-State: AOJu0YxB6hRnEVnebXORRxWPwko6/w/rDGukqRLFcV5CaRwkYUAURcnH 1RWfLs2iZCkQHpmQAgQ6/NbF2AUpmyZJ807mAkBirq1HrFUlzFJNPiM3uTwCjYI= X-Received: by 2002:a5d:67cf:0:b0:33a:eb4b:c702 with SMTP id n15-20020a5d67cf000000b0033aeb4bc702mr1881597wrw.3.1707508061055; Fri, 09 Feb 2024 11:47:41 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV5oQwO/y1n7kDtfr4IPMQ/fwVunD2t7OHpvyurlz+5oPtWUULUQOVQikRRUXeW5j0P0j3WOAG4ypOw6tR8XHaVTWnVp8G24tDmXdKc4wWIAuRd9Ct+Fh4b4BJfHaldFq75mXQXPqaenCC4j/jb Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bq26-20020a5d5a1a000000b0033b4335dce5sm43840wrb.85.2024.02.09.11.47.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 11:47:37 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 755835F7D7; Fri, 9 Feb 2024 19:47:35 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Riku Voipio Subject: [PULL 08/10] gdbstub: Add syscall entry/return hooks Date: Fri, 9 Feb 2024 19:47:32 +0000 Message-Id: <20240209194734.3424785-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240209194734.3424785-1-alex.bennee@linaro.org> References: <20240209194734.3424785-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-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 From: Ilya Leoshkevich The upcoming syscall catchpoint support needs to get control on syscall entry and return. Provide the necessary hooks for that, which are no-ops for now. Signed-off-by: Ilya Leoshkevich Message-Id: <20240202152506.279476-4-iii@linux.ibm.com> Signed-off-by: Alex Bennée Message-Id: <20240207163812.3231697-13-alex.bennee@linaro.org> diff --git a/include/gdbstub/user.h b/include/gdbstub/user.h index 1fc43e04af5..68b6534130c 100644 --- a/include/gdbstub/user.h +++ b/include/gdbstub/user.h @@ -51,5 +51,18 @@ void gdb_signalled(CPUArchState *as, int sig); */ void gdbserver_fork(CPUState *cs); +/** + * gdb_syscall_entry() - inform gdb of syscall entry and yield control to it + * @cs: CPU + * @num: syscall number + */ +void gdb_syscall_entry(CPUState *cs, int num); + +/** + * gdb_syscall_entry() - inform gdb of syscall return and yield control to it + * @cs: CPU + * @num: syscall number + */ +void gdb_syscall_return(CPUState *cs, int num); #endif /* GDBSTUB_USER_H */ diff --git a/include/user/syscall-trace.h b/include/user/syscall-trace.h index 557f881a79b..b48b2b2d0ae 100644 --- a/include/user/syscall-trace.h +++ b/include/user/syscall-trace.h @@ -11,6 +11,7 @@ #define SYSCALL_TRACE_H #include "exec/user/abitypes.h" +#include "gdbstub/user.h" #include "qemu/plugin.h" #include "trace/trace-root.h" @@ -20,7 +21,7 @@ * could potentially unify the -strace code here as well. */ -static inline void record_syscall_start(void *cpu, int num, +static inline void record_syscall_start(CPUState *cpu, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6, @@ -29,11 +30,13 @@ static inline void record_syscall_start(void *cpu, int num, qemu_plugin_vcpu_syscall(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + gdb_syscall_entry(cpu, num); } -static inline void record_syscall_return(void *cpu, int num, abi_long ret) +static inline void record_syscall_return(CPUState *cpu, int num, abi_long ret) { qemu_plugin_vcpu_syscall_ret(cpu, num, ret); + gdb_syscall_return(cpu, num); } diff --git a/gdbstub/user.c b/gdbstub/user.c index 63edca131ab..2ba01c17faf 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -502,3 +502,11 @@ void gdb_syscall_handling(const char *syscall_packet) gdb_put_packet(syscall_packet); gdb_handlesig(gdbserver_state.c_cpu, 0); } + +void gdb_syscall_entry(CPUState *cs, int num) +{ +} + +void gdb_syscall_return(CPUState *cs, int num) +{ +}