From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564279; cv=none; d=zohomail.com; s=zohoarc; b=PHnjI9juMWKVGSUaVNqCe4zX4D4ofsXJykBvch1FFspjhsn5v6y08L3FMLNSwyhyF9peqPRCFjMcEtQxYHfkHElCvupBWMmidVpDz2R/bSLJHClkQ6K/FhQ/U0wDvxuEOCN/320laY73suQ3ApYKwRuien8FWq09YluxYbm3Xy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564279; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=K/qkTBQDwDBx59odk0rUl2QA3V5gIm0hniACs5M4QEw=; b=k3kajkklZ2dIYc20WYWDqy6IDC/qYDy5bLawDRsM6pLRA/vSOYU5BFQEWconRcYVBGid9XvKq4zWfKJdrxx+JPdvyaoocOoNQDK+2AY9prZkj1ua73kVlQBLkg2MECOk2k/HrR6w4ai7pn68W9UaZsFbEi1MULaDuoEry+U0T8U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626564279505539.2884728429208; Sat, 17 Jul 2021 16:24:39 -0700 (PDT) Received: from localhost ([::1]:37196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4tfi-0000kX-Gx for importer@patchew.org; Sat, 17 Jul 2021 19:24:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcL-0001cM-Cf for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:09 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:41808) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcJ-0000gK-LU for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:09 -0400 Received: by mail-wr1-x430.google.com with SMTP id k4so16461218wrc.8 for ; Sat, 17 Jul 2021 16:21:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K/qkTBQDwDBx59odk0rUl2QA3V5gIm0hniACs5M4QEw=; b=wLwG+LSFFKKP4181fDmmx6oCjie8Mj0Qyov/A8GdA+VPEVdIRfeyZd0tjGJDX7+L+P M+3ykMfrMYYZwNXfbSWo3A4O0Vzc4Jj/VdML7KqynP8xobfNmwdgZLFG4pD9wIyuWe2j RTVddOvrriwddQrG45wG1joVLQaaBJh1zCCzQdbakRcRlQpTpsGQzdOy2AiBOholi4VY R1WEXlEXryyIAYiVK228D2xfP7cyLiWT39JUHuyXmAtrSv5/m1JG/fYEagsUBGWipWD3 HqU9Q5mQDL1Bq//Xzzi1A2AWJSzY8fl8k23h3Vdpo7qr787auEGoyVavL2Rw+Pu5gr2A PXHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K/qkTBQDwDBx59odk0rUl2QA3V5gIm0hniACs5M4QEw=; b=kjMjt9fsYSBK0NCf03+ZqsZ+eHQQtNt2Aqspqdm2JCSFPfze/+EWnRbJHr+LmLFsmF tpC6ToPbDPZM7DeGpciaWmaKB9f/vhUzgURF3ChFvMg8Hm/rARspaBX1pG8rfOa3QDhg ea4fjm/G5XLAvLcekLgh1B9bB5qbecyO+ny8byF3slSGwriD60ySXMg7MDnfK2MuHFLt sc66arnMDTs355oM4ZcyoQfr78+Wd0ZIyKcG0+S54Isx6TBJGEt9+PWnk+p13kmgcDhj QMHSfai+TGPXQGRo/Ms0ypj89mBay/I7lgPR2ydH15Qvyfw396aHUJti+lqsn1DMkZ68 Uatg== X-Gm-Message-State: AOAM532rY2c6bCHmnIebLYftl9w43Ec0dN7TPC01IMzmKM1k+23RYgow jRaDZwgJFqN39dJl2lKdSaUP1/XtKxfWSA== X-Google-Smtp-Source: ABdhPJyh4RKtABcqCTQRH2dS2u9maqRi5zDo2KYC4gykGvqASnzLE50HqgXRIICXsexwSNmJdDDoQQ== X-Received: by 2002:a5d:6d88:: with SMTP id l8mr13116314wrs.301.1626564066125; Sat, 17 Jul 2021 16:21:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 01/10] linux-user: Fix coding style nits in qemu.h Date: Sun, 18 Jul 2021 00:20:54 +0100 Message-Id: <20210717232103.18047-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564281032100001 Content-Type: text/plain; charset="utf-8" We're about to move a lot of the code in qemu.h out into different header files; fix the coding style nits first so that checkpatch is happy with the pure code-movement patches. This is mostly block-comment style but also a few whitespace issues. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- I didn't clean the whole file; some parts I know I don't need to move (the user-access functions and macros) I left alone. --- linux-user/qemu.h | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 3b0b6b75fe8..34b975ba502 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -15,12 +15,14 @@ #include "target_syscall.h" #include "exec/gdbstub.h" =20 -/* This is the size of the host kernel's sigset_t, needed where we make +/* + * This is the size of the host kernel's sigset_t, needed where we make * direct system calls that take a sigset_t pointer and a size. */ #define SIGSET_T_SIZE (_NSIG / 8) =20 -/* This struct is used to hold certain information about the image. +/* + * This struct is used to hold certain information about the image. * Basically, it replicates in user space what would be certain * task_struct fields in the kernel */ @@ -48,13 +50,13 @@ struct image_info { abi_ulong env_strings; abi_ulong file_string; uint32_t elf_flags; - int personality; + int personality; abi_ulong alignment; =20 /* The fields below are used in FDPIC mode. */ abi_ulong loadmap_addr; uint16_t nsegs; - void *loadsegs; + void *loadsegs; abi_ulong pt_dynamic_addr; abi_ulong interpreter_loadmap_addr; abi_ulong interpreter_pt_dynamic_addr; @@ -98,8 +100,10 @@ struct emulated_sigtable { target_siginfo_t info; }; =20 -/* NOTE: we force a big alignment so that the stack stored after is - aligned too */ +/* + * NOTE: we force a big alignment so that the stack stored after is + * aligned too + */ typedef struct TaskState { pid_t ts_tid; /* tid (or pid) of this task */ #ifdef TARGET_ARM @@ -134,20 +138,23 @@ typedef struct TaskState { =20 struct emulated_sigtable sync_signal; struct emulated_sigtable sigtab[TARGET_NSIG]; - /* This thread's signal mask, as requested by the guest program. + /* + * This thread's signal mask, as requested by the guest program. * The actual signal mask of this thread may differ: * + we don't let SIGSEGV and SIGBUS be blocked while running guest c= ode * + sometimes we block all signals to avoid races */ sigset_t signal_mask; - /* The signal mask imposed by a guest sigsuspend syscall, if we are + /* + * The signal mask imposed by a guest sigsuspend syscall, if we are * currently in the middle of such a syscall */ sigset_t sigsuspend_mask; /* Nonzero if we're leaving a sigsuspend and sigsuspend_mask is valid.= */ int in_sigsuspend; =20 - /* Nonzero if process_pending_signals() needs to do something (either + /* + * Nonzero if process_pending_signals() needs to do something (either * handle a pending signal or unblock signals). * This flag is written from a signal handler so should be accessed via * the qatomic_read() and qatomic_set() functions. (It is not accessed @@ -168,8 +175,10 @@ extern unsigned long mmap_min_addr; =20 /* ??? See if we can avoid exposing so much of the loader internals. */ =20 -/* Read a good amount of data initially, to hopefully get all the - program headers loaded. */ +/* + * Read a good amount of data initially, to hopefully get all the + * program headers loaded. + */ #define BPRM_BUF_SIZE 1024 =20 /* @@ -184,7 +193,7 @@ struct linux_binprm { int argc, envc; char **argv; char **envp; - char * filename; /* Name of binary */ + char *filename; /* Name of binary */ int (*core_dump)(int, const CPUArchState *); /* coredump routine */ }; =20 @@ -212,10 +221,11 @@ void do_init_thread(struct target_pt_regs *regs, stru= ct image_info *infop); abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, abi_ulong stringp, int push_ptr); int loader_exec(int fdexec, const char *filename, char **argv, char **envp, - struct target_pt_regs * regs, struct image_info *infop, + struct target_pt_regs *regs, struct image_info *infop, struct linux_binprm *); =20 -/* Returns true if the image uses the FDPIC ABI. If this is the case, +/* + * Returns true if the image uses the FDPIC ABI. If this is the case, * we have to provide some information (loadmap, pt_dynamic_info) such * that the program can be relocated adequately. This is also useful * when handling signals. @@ -283,7 +293,8 @@ void probe_guest_base(const char *image_name, * with any of the host errno values.) */ =20 -/* A guide to using safe_syscall() to handle interactions between guest +/* + * A guide to using safe_syscall() to handle interactions between guest * syscalls and guest signals: * * Guest syscalls come in two flavours: @@ -392,7 +403,8 @@ extern long safe_syscall_base(int *pending, long number= , ...); =20 #else =20 -/* Fallback for architectures which don't yet provide a safe-syscall assem= bly +/* + * Fallback for architectures which don't yet provide a safe-syscall assem= bly * fragment; note that this is racy! * This should go away when all host architectures have been updated. */ @@ -736,7 +748,8 @@ static inline int regpairs_aligned(void *cpu_env, int n= um) { return 0; } */ void preexit_cleanup(CPUArchState *env, int code); =20 -/* Include target-specific struct and function definitions; +/* + * Include target-specific struct and function definitions; * they may need access to the target-independent structures * above, so include them last. */ --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564155; cv=none; d=zohomail.com; s=zohoarc; b=Q7v0/0kovr2INyQvN6uN+xTUlhoR6v0HRmdZbVYmBPfDD3b8K+O/lMgAfna6cuisswFxmAL+BiYAKOJcFg7EhbBqubrjxthhclHPO0+GcU8yrZtfwfSLqFswt+Qj7PKmfm5MWE+fyW+CbwgY9t/melUV2nKQpXuzvxsc2XGAclQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564155; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ueTdIGLbNp6Z/QM8B2gYfbg3TXSSIVPakVhr/L2xIog=; b=SMSzV21vbQ3iB2abmPPdJHMHoclNaVMQUWzg2zLloOnrNNufLjRQ48w+zJ9Sq+KKqyJYsiPs5ZiVjHStLJ/V9s7jr/fdN9InWeD9lwP7B2OG2/XnrLuC4OxCS97QbYihqURHEjBt4X29aiuAQTgwuqM2l9bOJB2ti6WJEPuFVZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16265641554381005.6432383471382; Sat, 17 Jul 2021 16:22:35 -0700 (PDT) Received: from localhost ([::1]:57864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4tdi-0004C8-2Y for importer@patchew.org; Sat, 17 Jul 2021 19:22:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcM-0001cj-MR for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:10 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:40544) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcK-0000gf-Va for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:10 -0400 Received: by mail-wm1-x329.google.com with SMTP id f8-20020a1c1f080000b029022d4c6cfc37so9097962wmf.5 for ; Sat, 17 Jul 2021 16:21:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ueTdIGLbNp6Z/QM8B2gYfbg3TXSSIVPakVhr/L2xIog=; b=xK4SCDSj6/TOItttPD9LEVftR8WOAtzQfPoTHfNKisiaclP5Y8f/zN9Ogl0e81yF9I YFK94xFIJMWsV5kP47y92haRmMiORRdkAMJVHJmFrjUdwuPKgrr0b9gdI65nSs69b900 IYbFkTC3zZ/qeQ5zpR0V6m8aM5xjIIs8cE7gF27jxveYp5jT1H3/z1w//fxi28zEfCwy 0/B5DqLSuf9KxHxK/8kRvvC3uZx5eafOgEkOkfABsS1Gm4yyFwKkySG2S/gDpFwx4iis REUxh52wbsdY0JGDhgSyawVSPa/blQ48QSJ+qOxIIV2HuHT0g6L75VOk4uz2Os53vefv xQVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ueTdIGLbNp6Z/QM8B2gYfbg3TXSSIVPakVhr/L2xIog=; b=RrD7YNkNrSJAtmyKLVeecdh8nLfV78RsadHw9ItwGDhbJOt2O4E7LykkO+lOjT+pvc 2lYxyfUpDoxoTW1cSZDho5naG6cz99VieBqzO3JmuvOJxA1M4oYeGWu4JXWQUOua0E/6 9f+3UmfL0BLWZdhryM+TqynfLUbgOJP5kqM2RxhL+GzTMm2HOb+arYXjsHO03dh75+dw vFsHGZ7Pw4WjxMrpTrUaJCsIkU9garsz5B0jFowm7uXE7ATTyrJziekXAXsBPSW7NxW5 USw3SZzqNuDTp5V/d981cOIl/xiDdNMss7Isxb7ZjDhnipIaamAZai9D4v5C3tguGfgL nCjA== X-Gm-Message-State: AOAM5325qLo3EoK6Oio1vseA7TES4lXTmvA97LshXUMgNLIxZnH+e3e3 ut1LGlHmbaUU/zFVJCLP05Hd/mjU742m1w== X-Google-Smtp-Source: ABdhPJyTWR5osfWUhhP5mKKOJcnqG8aXbMIfki86nVPX5npkrIeG5KXp+rs6RsdsYnTNEBTgjjQIsg== X-Received: by 2002:a05:600c:6d8:: with SMTP id b24mr24701878wmn.111.1626564066764; Sat, 17 Jul 2021 16:21:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 02/10] linux-user: Split strace prototypes into strace.h Date: Sun, 18 Jul 2021 00:20:55 +0100 Message-Id: <20210717232103.18047-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564156758100002 Content-Type: text/plain; charset="utf-8" The functions implemented in strace.c are only used in a few files in linux-user; split them out of qemu.h and into a new strace.h header which we include in the places that need it. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/qemu.h | 18 ------------------ linux-user/strace.h | 38 ++++++++++++++++++++++++++++++++++++++ linux-user/signal.c | 1 + linux-user/strace.c | 2 ++ linux-user/syscall.c | 1 + 5 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 linux-user/strace.h diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 34b975ba502..ad2d49fed9f 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -415,24 +415,6 @@ extern long safe_syscall_base(int *pending, long numbe= r, ...); /* syscall.c */ int host_to_target_waitstatus(int status); =20 -/* strace.c */ -void print_syscall(void *cpu_env, int num, - abi_long arg1, abi_long arg2, abi_long arg3, - abi_long arg4, abi_long arg5, abi_long arg6); -void print_syscall_ret(void *cpu_env, int num, abi_long ret, - abi_long arg1, abi_long arg2, abi_long arg3, - abi_long arg4, abi_long arg5, abi_long arg6); -/** - * print_taken_signal: - * @target_signum: target signal being taken - * @tinfo: target_siginfo_t which will be passed to the guest for the sign= al - * - * Print strace output indicating that this signal is being taken by the g= uest, - * in a format similar to: - * --- SIGSEGV {si_signo=3DSIGSEGV, si_code=3DSI_KERNEL, si_addr=3D0} --- - */ -void print_taken_signal(int target_signum, const target_siginfo_t *tinfo); - /* signal.c */ void process_pending_signals(CPUArchState *cpu_env); void signal_init(void); diff --git a/linux-user/strace.h b/linux-user/strace.h new file mode 100644 index 00000000000..1e232d07fc8 --- /dev/null +++ b/linux-user/strace.h @@ -0,0 +1,38 @@ +/* + * strace.h: prototypes for linux-user builtin strace handling + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef LINUX_USER_STRACE_H +#define LINUX_USER_STRACE_H + +void print_syscall(void *cpu_env, int num, + abi_long arg1, abi_long arg2, abi_long arg3, + abi_long arg4, abi_long arg5, abi_long arg6); +void print_syscall_ret(void *cpu_env, int num, abi_long ret, + abi_long arg1, abi_long arg2, abi_long arg3, + abi_long arg4, abi_long arg5, abi_long arg6); +/** + * print_taken_signal: + * @target_signum: target signal being taken + * @tinfo: target_siginfo_t which will be passed to the guest for the sign= al + * + * Print strace output indicating that this signal is being taken by the g= uest, + * in a format similar to: + * --- SIGSEGV {si_signo=3DSIGSEGV, si_code=3DSI_KERNEL, si_addr=3D0} --- + */ +void print_taken_signal(int target_signum, const target_siginfo_t *tinfo); + +#endif /* LINUX_USER_STRACE_H */ diff --git a/linux-user/signal.c b/linux-user/signal.c index a8faea6f090..ee1934947ac 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -22,6 +22,7 @@ #include =20 #include "qemu.h" +#include "strace.h" #include "trace.h" #include "signal-common.h" =20 diff --git a/linux-user/strace.c b/linux-user/strace.c index cce0a5d1e35..ee3429fae82 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" + #include #include #include @@ -14,6 +15,7 @@ #include #include #include "qemu.h" +#include "strace.h" =20 struct syscallname { int nr; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 376629c6891..4932eebd5e5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -127,6 +127,7 @@ #include "uname.h" =20 #include "qemu.h" +#include "strace.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564169; cv=none; d=zohomail.com; s=zohoarc; b=gIkqWzvTyWnI2mLylvgj566Yyl25rbHdqJgVjGl/Lbcu+g7bdMtICJqTmGXmevt347V0I91R94/36pnIkKO8l5c2azhc6GoPtEj9d712ySr3tqnuIOBvTrjmt5XcNwJY8RJFW6R6ynULKT1Non/3YyFN52+cAbcp9GHuLz3ylD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564169; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ndl+zZXziO/4kEyeYe5L5/rATAXmmolk95+4TmPUIF8=; b=SOWv9QPDhLs10niDwTW4DN8eR5A3eLZCnmZfkjmD4YBsDIGP2u/OEiaPLNzJ6Itk1AA1uFEISflDZwzDOe6dt2M3bRqXfsbYNzM6xv3ITi5oGQIVo2h0kDfBHUV75iUvjo8X2+W5UNAxAGcGM0Sxiz3+PSwPpHOumSx1+3YdwSc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162656416928728.50705380373404; Sat, 17 Jul 2021 16:22:49 -0700 (PDT) Received: from localhost ([::1]:58220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4tdw-0004RG-6s for importer@patchew.org; Sat, 17 Jul 2021 19:22:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcN-0001e5-W5 for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:12 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:37804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcL-0000gm-5D for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:11 -0400 Received: by mail-wm1-x335.google.com with SMTP id y21-20020a7bc1950000b02902161fccabf1so10422334wmi.2 for ; Sat, 17 Jul 2021 16:21:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ndl+zZXziO/4kEyeYe5L5/rATAXmmolk95+4TmPUIF8=; b=o28XfSleMljKczJ8p+oaQYjOwflbHdUZxCusmQaCcgF7MfempHsvv+b9j8dF//Lkcl 9jNgvO0WjtfH+ukJqOOgEdAxk4hhLobe6MYphi8HwlGjpM3cgDK79HyiL5bMmgwaT+81 zPmYL7O/JeD6zt0+Gzvlp11ZcCeE0SvwdYbuy+Ej9s4sgfgM7DTRMaxZ0DmANP5mdV9y XEwkvBywvTj6taz1t2C05HPReoAfE0EpHjwBKTxJcXEq0a2+q8lvmf8ojRgf8UTuaFYW lxg1UAP7fzmjS/GVMrkJnw9SwYSc1pFLeqjMPdPfZk/bq7pceDGypyuODG8qQTMRWj3J 3SCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ndl+zZXziO/4kEyeYe5L5/rATAXmmolk95+4TmPUIF8=; b=HmPwrjZfDJFZWhNfkeZCIH5KCld2HcQYzYQft4v45c/SyH3mU+Ky2zzlSBl6mpUy/g Jf70UiCK/d7Xu/O5Jut/6/6jrdHPsR9sneVdVKjFnBgsT9e8v6WsO/1vHb3cF36HAp/O RbeJL5v22KzBBNAZnTUc1pfYAp30c9+uXUEWbQBPKbYwvHmTAZ0XzCTPt1GQKOKu5Po/ o7HKcgsSlh+Q14+KRKvPNcmSwfJE1RkhMu1JkaitMKYojJBTXiZx73WNZ1cQIQL4nlwu Qx/+ZUYqOb2qkv2P0KEvtAAolqzVryHOA265IrToKwDg2gEy4iIM1LC2fbR5655ibSZm T3BA== X-Gm-Message-State: AOAM53034vVYk0nnn4uIugLQqZIEvh1rD96chEOBQHA1pfQ3+5QyGlTJ K2d8RCY2FzQNd10dIhi5oziv5Q5jdn1CuQ== X-Google-Smtp-Source: ABdhPJzXd9VPdNS8Se1TI2kIIJ9CWohuH7TtJZBA3qQrlkyXZhrzOX3AZJ6DABuLHTAocwjXz5PQvg== X-Received: by 2002:a05:600c:4856:: with SMTP id j22mr24123331wmo.126.1626564067736; Sat, 17 Jul 2021 16:21:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 03/10] linux-user: Split signal-related prototypes into sighandling.h Date: Sun, 18 Jul 2021 00:20:56 +0100 Message-Id: <20210717232103.18047-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564170820100001 Content-Type: text/plain; charset="utf-8" Split the signal related prototypes into a new header file sighandling.h, and include it in those places that require it. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/qemu.h | 36 -------------------- linux-user/sighandling.h | 56 ++++++++++++++++++++++++++++++++ linux-user/aarch64/cpu_loop.c | 1 + linux-user/aarch64/signal.c | 1 + linux-user/alpha/cpu_loop.c | 1 + linux-user/alpha/signal.c | 1 + linux-user/arm/cpu_loop.c | 1 + linux-user/arm/signal.c | 1 + linux-user/cris/cpu_loop.c | 1 + linux-user/cris/signal.c | 1 + linux-user/fd-trans.c | 1 + linux-user/hexagon/cpu_loop.c | 1 + linux-user/hexagon/signal.c | 1 + linux-user/hppa/cpu_loop.c | 1 + linux-user/hppa/signal.c | 1 + linux-user/i386/cpu_loop.c | 1 + linux-user/i386/signal.c | 1 + linux-user/m68k/cpu_loop.c | 1 + linux-user/m68k/signal.c | 1 + linux-user/main.c | 1 + linux-user/microblaze/cpu_loop.c | 1 + linux-user/microblaze/signal.c | 1 + linux-user/mips/cpu_loop.c | 1 + linux-user/mips/signal.c | 1 + linux-user/nios2/cpu_loop.c | 1 + linux-user/nios2/signal.c | 1 + linux-user/openrisc/cpu_loop.c | 1 + linux-user/openrisc/signal.c | 1 + linux-user/ppc/cpu_loop.c | 1 + linux-user/ppc/signal.c | 1 + linux-user/riscv/cpu_loop.c | 1 + linux-user/riscv/signal.c | 1 + linux-user/s390x/cpu_loop.c | 1 + linux-user/s390x/signal.c | 1 + linux-user/sh4/cpu_loop.c | 1 + linux-user/sh4/signal.c | 1 + linux-user/signal.c | 1 + linux-user/sparc/cpu_loop.c | 1 + linux-user/sparc/signal.c | 1 + linux-user/syscall.c | 1 + linux-user/xtensa/cpu_loop.c | 1 + linux-user/xtensa/signal.c | 1 + 42 files changed, 96 insertions(+), 36 deletions(-) create mode 100644 linux-user/sighandling.h diff --git a/linux-user/qemu.h b/linux-user/qemu.h index ad2d49fed9f..76d3f5e7eb9 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -415,42 +415,6 @@ extern long safe_syscall_base(int *pending, long numbe= r, ...); /* syscall.c */ int host_to_target_waitstatus(int status); =20 -/* signal.c */ -void process_pending_signals(CPUArchState *cpu_env); -void signal_init(void); -int queue_signal(CPUArchState *env, int sig, int si_type, - target_siginfo_t *info); -void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info= ); -void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo= ); -int target_to_host_signal(int sig); -int host_to_target_signal(int sig); -long do_sigreturn(CPUArchState *env); -long do_rt_sigreturn(CPUArchState *env); -abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, - CPUArchState *env); -int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset); -abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, - abi_ulong unew_ctx, abi_long ctx_size); -/** - * block_signals: block all signals while handling this guest syscall - * - * Block all signals, and arrange that the signal mask is returned to - * its correct value for the guest before we resume execution of guest cod= e. - * If this function returns non-zero, then the caller should immediately - * return -TARGET_ERESTARTSYS to the main loop, which will take the pending - * signal and restart execution of the syscall. - * If block_signals() returns zero, then the caller can continue with - * emulation of the system call knowing that no signals can be taken - * (and therefore that no race conditions will result). - * This should only be called once, because if it is called a second time - * it will always return non-zero. (Think of it like a mutex that can't - * be recursively locked.) - * Signals will be unblocked again by process_pending_signals(). - * - * Return value: non-zero if there was a pending signal, zero if not. - */ -int block_signals(void); /* Returns non zero if signal pending */ - #ifdef TARGET_I386 /* vm86.c */ void save_v86_state(CPUX86State *env); diff --git a/linux-user/sighandling.h b/linux-user/sighandling.h new file mode 100644 index 00000000000..8da369b0381 --- /dev/null +++ b/linux-user/sighandling.h @@ -0,0 +1,56 @@ +/* + * sighandling.h: prototypes for linux-user signal handling + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +#ifndef LINUX_USER_SIGHANDLING_H +#define LINUX_USER_SIGHANDLING_H + +/* signal.c */ +void process_pending_signals(CPUArchState *cpu_env); +void signal_init(void); +int queue_signal(CPUArchState *env, int sig, int si_type, + target_siginfo_t *info); +void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info= ); +void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo= ); +int target_to_host_signal(int sig); +int host_to_target_signal(int sig); +long do_sigreturn(CPUArchState *env); +long do_rt_sigreturn(CPUArchState *env); +abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, + CPUArchState *env); +int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset); +abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, + abi_ulong unew_ctx, abi_long ctx_size); +/** + * block_signals: block all signals while handling this guest syscall + * + * Block all signals, and arrange that the signal mask is returned to + * its correct value for the guest before we resume execution of guest cod= e. + * If this function returns non-zero, then the caller should immediately + * return -TARGET_ERESTARTSYS to the main loop, which will take the pending + * signal and restart execution of the syscall. + * If block_signals() returns zero, then the caller can continue with + * emulation of the system call knowing that no signals can be taken + * (and therefore that no race conditions will result). + * This should only be called once, because if it is called a second time + * it will always return non-zero. (Think of it like a mutex that can't + * be recursively locked.) + * Signals will be unblocked again by process_pending_signals(). + * + * Return value: non-zero if there was a pending signal, zero if not. + */ +int block_signals(void); /* Returns non zero if signal pending */ + +#endif /* LINUX_USER_SIGHANDLING_H */ diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index ee72a1c20f0..459efdf2ec2 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" #include "qemu/guest-random.h" #include "semihosting/common-semi.h" #include "target/arm/syndrome.h" diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 662bcd1c4e5..75073dd3ec6 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index 7ce2461a028..2939ef5c845 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 void cpu_loop(CPUAlphaState *env) { diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index 1129ffeea1d..7f5dd3eef2f 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 69632d15be1..7a66079fd9c 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -22,6 +22,7 @@ #include "qemu.h" #include "elf.h" #include "cpu_loop-common.h" +#include "sighandling.h" #include "semihosting/common-semi.h" =20 #define get_user_code_u32(x, gaddr, env) \ diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index 32b68ee302b..bd0f29b3016 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index 334edddd1e2..00c652b9a56 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 void cpu_loop(CPUCRISState *env) { diff --git a/linux-user/cris/signal.c b/linux-user/cris/signal.c index 1e02194377b..093a9758423 100644 --- a/linux-user/cris/signal.c +++ b/linux-user/cris/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c index 86b6f484d30..8cdb97b81d1 100644 --- a/linux-user/fd-trans.c +++ b/linux-user/fd-trans.c @@ -28,6 +28,7 @@ #endif #include "qemu.h" #include "fd-trans.h" +#include "sighandling.h" =20 enum { QEMU_IFLA_BR_UNSPEC, diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index bc34f5d7c30..aeddb91526d 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" #include "internal.h" =20 void cpu_loop(CPUHexagonState *env) diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index 85eab5e9438..58ff2caa7e3 100644 --- a/linux-user/hexagon/signal.c +++ b/linux-user/hexagon/signal.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 3aaaf3337cb..3ddaa4155c4 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 static abi_ulong hppa_lws(CPUHPPAState *env) { diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index 0e266f472d5..4e08a3d74bb 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index f813e87294a..db6dbf40cdc 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 /***********************************************************/ /* CPUX86 core interface */ diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 8701774e379..79a81f4e7c7 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 /* from the Linux kernel - /arch/x86/include/uapi/asm/sigcontext.h */ diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index c7a500b58c4..cbbcce729da 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 void cpu_loop(CPUM68KState *env) { diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index d06230655e9..c3a1c99d6d5 100644 --- a/linux-user/m68k/signal.c +++ b/linux-user/m68k/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { diff --git a/linux-user/main.c b/linux-user/main.c index 37ed50d98e2..c10e3ccf135 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -49,6 +49,7 @@ #include "cpu_loop-common.h" #include "crypto/init.h" #include "fd-trans.h" +#include "sighandling.h" =20 #ifndef AT_FLAGS_PRESERVE_ARGV0 #define AT_FLAGS_PRESERVE_ARGV0_BIT 0 diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_l= oop.c index c3396a6e09b..3549ebe08bc 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 void cpu_loop(CPUMBState *env) { diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index 4c483bd8c60..ba04c3cc588 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 9d813ece4e7..929e29f60f1 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" #include "elf.h" #include "internal.h" #include "fpu_helper.h" diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index e6be807a81a..fa242536315 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 # if defined(TARGET_ABI_MIPSO32) diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index 9869083fa19..d3c042b8d0a 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 void cpu_loop(CPUNios2State *env) { diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index cc3872f11da..fb8ae7b4f92 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 #define MCONTEXT_VERSION 2 diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index b33fa777187..7d24d3891d8 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 void cpu_loop(CPUOpenRISCState *env) { diff --git a/linux-user/openrisc/signal.c b/linux-user/openrisc/signal.c index 5c5640a2848..62f85d18e4d 100644 --- a/linux-user/openrisc/signal.c +++ b/linux-user/openrisc/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 typedef struct target_sigcontext { diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index fa91ea0eed9..61367d53b74 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 static inline uint64_t cpu_ppc_get_tb(CPUPPCState *env) { diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index edfad28a375..d9a41723a0f 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 /* Size of dummy stack frame allocated when calling signal handler. diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index 74a9628dc9b..d6a5d2d8975 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -22,6 +22,7 @@ #include "qemu/error-report.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" #include "elf.h" #include "semihosting/common-semi.h" =20 diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index 9405c7fd9af..29a93d28932 100644 --- a/linux-user/riscv/signal.c +++ b/linux-user/riscv/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 /* Signal handler invocation must be transparent for the code being diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index f2d1215fb1b..f3d345986d8 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 /* s390x masks the fault address it reports in si_addr for SIGSEGV and SIG= BUS */ #define S390X_FAIL_ADDR_MASK -4096LL diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index bf8a8fbfe9f..4f900fee422 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 #define __NUM_GPRS 16 diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index 222ed1c670c..059c7420eea 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 void cpu_loop(CPUSH4State *env) { diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index 0451e65806a..df78a2032fe 100644 --- a/linux-user/sh4/signal.c +++ b/linux-user/sh4/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 /* diff --git a/linux-user/signal.c b/linux-user/signal.c index ee1934947ac..bbfe250baa3 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -23,6 +23,7 @@ =20 #include "qemu.h" #include "strace.h" +#include "sighandling.h" #include "trace.h" #include "signal-common.h" =20 diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 02532f198df..9b633029a92 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 #define SPARC64_STACK_BIAS 2047 =20 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 0cc3db5570e..c2b6ba88ad2 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 /* A Sparc register window */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4932eebd5e5..e2dd799134e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -128,6 +128,7 @@ =20 #include "qemu.h" #include "strace.h" +#include "sighandling.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index 64831c91996..a0710ed044a 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "sighandling.h" =20 static void xtensa_rfw(CPUXtensaState *env) { diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 72771e1294b..32d666f2523 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "sighandling.h" #include "linux-user/trace.h" =20 struct target_sigcontext { --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564401; cv=none; d=zohomail.com; s=zohoarc; b=h0X/FpDhsssmSI4723UHbM2iaZ3Pt6Ho5Hc6uAZCroldhN7W1PFxHnbw8Z7DIexjR5ZXgZqTvyJI6HsnJ2eu5EUS9UEbElxcVPwffT5ambzQBwDxtzxhn6Pzs1AaBzoWxfzITBTKrkZR03ojtjw+GOkrK0URPno3gHzAZTwiC8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564401; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XbAAYE6Aac70j4yIiLHKaxeoua1xFwIBoeMXuqVsKZg=; b=mT/I2Ko2cmXJUnbt3yfetFAcM26oPRb3t41ZHSO0wmzqfDTGTflKzwCeLz6Yas8oC7MqJ3cOVIaMh2qhPJtSQROpDWgS4IJ4XB/GcfZL4GHYQwyTIM5l7JGBNILVR73C2rLxnphCTn8GX9l4gFqL3lpZdz8JyETJmY6EidyZ5AA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626564401011924.8392705329695; Sat, 17 Jul 2021 16:26:41 -0700 (PDT) Received: from localhost ([::1]:43760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4thg-00058V-05 for importer@patchew.org; Sat, 17 Jul 2021 19:26:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcP-0001h1-50 for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:13 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:33519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcL-0000hh-SV for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:12 -0400 Received: by mail-wr1-x42f.google.com with SMTP id d2so16558963wrn.0 for ; Sat, 17 Jul 2021 16:21:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XbAAYE6Aac70j4yIiLHKaxeoua1xFwIBoeMXuqVsKZg=; b=om0feABhM2wU2LWP7j9hPmaI8/9v1RPy0emiBAr+2Jrdtjk6btswltzhh3y+H+Stym icySxoTyv+/2A+qVcABP0Z8LETwP66JZlF0nStdP7QYaqRVsknrH48lfrG7tM4mLOhNF RPCGRCG1SZaE+P0/CfQAgzcyfP3ssBRpav/+WRhpHmNjumJ7VavmpL4d9X1Wu5y3FLEY WSPEGaN8wCEsKFcvMFth6ci7WdJSAQdHZN15a6ig98ezRw/a03C8nDGFhqSnSLarZw9N uC4yK/IY7KaQtPjd7TQcSi5x8vOf+cExhuDy4S/oNelK4ZI85HkwtZ6/KebWUusi3UGX liqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XbAAYE6Aac70j4yIiLHKaxeoua1xFwIBoeMXuqVsKZg=; b=cxXYA5rLI9P6LwgwdvgLMhvRq94s2nDd5xc/K83TVn5mwhIvAYcCUoxV9xovIWGop1 l1asae6nwUV5Cuwh5GmcYR5NqVCRjcDYlnPbiTrZ5k+fOOH4zaKTK7swQlauCRQihVKE HYqsNS03XYdMjgtB9e1a65Q6eyJorCd8B74WQvfRmnJdFgTL/Lyj6T6d4KdWfyC5NJJE 4jUJ6i0PlLXOZlvnHEUjxSKBujatIT+5+qe6P6byL/09wq04MO63ANL+worNfg0RA0IQ 896mtfjlBZoLwCDXJ6Pi0Nn5faK1ZlodtrsAqg/4uT+c8B++w9bcZje8rV6AIVnBu87p dmmw== X-Gm-Message-State: AOAM533dSzXqthSraiPMEZ8Ssn/J5TecXwjmEYr9oZw35qFRnJoH4yKe +Q8jjETX7cLFpUK7093YVF4KYMBasPP2hQ== X-Google-Smtp-Source: ABdhPJyrcp7Xy8+Fc+Vb9aaS06m5fUdKk5GAxAYiKBmAnW7at8FaY7unLcZ5mwTxCfIm/gxwU37p3w== X-Received: by 2002:a5d:414b:: with SMTP id c11mr21677452wrq.162.1626564068523; Sat, 17 Jul 2021 16:21:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 04/10] linux-user: Split loader-related prototypes into loader.h Date: Sun, 18 Jul 2021 00:20:57 +0100 Message-Id: <20210717232103.18047-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564402443100003 Content-Type: text/plain; charset="utf-8" Split guest-binary loader prototypes out into a new header loader.h which we include only where required. Signed-off-by: Peter Maydell --- linux-user/loader.h | 59 ++++++++++++++++++++++++++++++++++++++++++ linux-user/qemu.h | 34 ------------------------ linux-user/elfload.c | 1 + linux-user/flatload.c | 1 + linux-user/linuxload.c | 1 + linux-user/main.c | 1 + linux-user/signal.c | 1 + linux-user/syscall.c | 1 + 8 files changed, 65 insertions(+), 34 deletions(-) create mode 100644 linux-user/loader.h diff --git a/linux-user/loader.h b/linux-user/loader.h new file mode 100644 index 00000000000..f375ee0679b --- /dev/null +++ b/linux-user/loader.h @@ -0,0 +1,59 @@ +/* + * loader.h: prototypes for linux-user guest binary loader + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef LINUX_USER_LOADER_H +#define LINUX_USER_LOADER_H + +/* + * Read a good amount of data initially, to hopefully get all the + * program headers loaded. + */ +#define BPRM_BUF_SIZE 1024 + +/* + * This structure is used to hold the arguments that are + * used when loading binaries. + */ +struct linux_binprm { + char buf[BPRM_BUF_SIZE] __attribute__((aligned)); + abi_ulong p; + int fd; + int e_uid, e_gid; + int argc, envc; + char **argv; + char **envp; + char *filename; /* Name of binary */ + int (*core_dump)(int, const CPUArchState *); /* coredump routine */ +}; + +void do_init_thread(struct target_pt_regs *regs, struct image_info *infop); +abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, + abi_ulong stringp, int push_ptr); +int loader_exec(int fdexec, const char *filename, char **argv, char **envp, + struct target_pt_regs *regs, struct image_info *infop, + struct linux_binprm *); + +uint32_t get_elf_eflags(int fd); +int load_elf_binary(struct linux_binprm *bprm, struct image_info *info); +int load_flt_binary(struct linux_binprm *bprm, struct image_info *info); + +abi_long memcpy_to_target(abi_ulong dest, const void *src, + unsigned long len); + +extern unsigned long guest_stack_size; + +#endif /* LINUX_USER_LOADER_H */ diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 76d3f5e7eb9..9e700d3af18 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -173,30 +173,6 @@ void stop_all_tasks(void); extern const char *qemu_uname_release; extern unsigned long mmap_min_addr; =20 -/* ??? See if we can avoid exposing so much of the loader internals. */ - -/* - * Read a good amount of data initially, to hopefully get all the - * program headers loaded. - */ -#define BPRM_BUF_SIZE 1024 - -/* - * This structure is used to hold the arguments that are - * used when loading binaries. - */ -struct linux_binprm { - char buf[BPRM_BUF_SIZE] __attribute__((aligned)); - abi_ulong p; - int fd; - int e_uid, e_gid; - int argc, envc; - char **argv; - char **envp; - char *filename; /* Name of binary */ - int (*core_dump)(int, const CPUArchState *); /* coredump routine */ -}; - typedef struct IOCTLEntry IOCTLEntry; =20 typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp, @@ -217,13 +193,6 @@ extern IOCTLEntry ioctl_entries[]; #define IOC_W 0x0002 #define IOC_RW (IOC_R | IOC_W) =20 -void do_init_thread(struct target_pt_regs *regs, struct image_info *infop); -abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, - abi_ulong stringp, int push_ptr); -int loader_exec(int fdexec, const char *filename, char **argv, char **envp, - struct target_pt_regs *regs, struct image_info *infop, - struct linux_binprm *); - /* * Returns true if the image uses the FDPIC ABI. If this is the case, * we have to provide some information (loadmap, pt_dynamic_info) such @@ -440,9 +409,6 @@ abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong= ); void mmap_fork_start(void); void mmap_fork_end(int child); =20 -/* main.c */ -extern unsigned long guest_stack_size; - /* user access */ =20 #define VERIFY_READ PAGE_READ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 42ef2a11485..d56e00c18b4 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -6,6 +6,7 @@ #include =20 #include "qemu.h" +#include "loader.h" #include "disas/disas.h" #include "qemu/bitops.h" #include "qemu/path.h" diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 3e5594cf894..7484a4a3543 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -36,6 +36,7 @@ #include "qemu/osdep.h" =20 #include "qemu.h" +#include "loader.h" #include "flat.h" #include "target_flat.h" =20 diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index 9d4eb5e94b9..27be7090d8f 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -2,6 +2,7 @@ =20 #include "qemu/osdep.h" #include "qemu.h" +#include "loader.h" =20 #define NGROUPS 32 =20 diff --git a/linux-user/main.c b/linux-user/main.c index c10e3ccf135..4ec0e2ad55d 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -50,6 +50,7 @@ #include "crypto/init.h" #include "fd-trans.h" #include "sighandling.h" +#include "loader.h" =20 #ifndef AT_FLAGS_PRESERVE_ARGV0 #define AT_FLAGS_PRESERVE_ARGV0_BIT 0 diff --git a/linux-user/signal.c b/linux-user/signal.c index bbfe250baa3..7abcec9166e 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -24,6 +24,7 @@ #include "qemu.h" #include "strace.h" #include "sighandling.h" +#include "loader.h" #include "trace.h" #include "signal-common.h" =20 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e2dd799134e..d6019b1c4c2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -129,6 +129,7 @@ #include "qemu.h" #include "strace.h" #include "sighandling.h" +#include "loader.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564280; cv=none; d=zohomail.com; s=zohoarc; b=JKgJM07gMSonIhzq8xobluz0R+DbVed1jgRjBecAs7r4Xaf/boIMan6+Gh3D21GihB1a9MSucwI4PTHL/UQqc76ZoMYWQV/OZUS+J9+EI/IxC6w29ldZYqlC+/2jftV0XPELIJL5L3CMoEcAIJOAlnnmpuN5EeTXeTjW684R5Xc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564280; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i8y5R85+M8+6PdkH9oStWkg2AYTRr/oyBaoRFz3LQCk=; b=ScCE05VQBiNwXCODc3GKdLyCwyDuV8MR6CJlNvUnKOVoVesqZGmiGXrhNOL5sEgvZ85aF6QvlYK7431Nz+WXdI9gnD3xVSt1Xy/ESOWu57R8gHrkBm4FGdzyrdN3ZFeOTaiHFQ8yd0oMlPd9tOQb3MqSt+QyN01cS4+52kWsKU0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626564280775476.11991871374005; Sat, 17 Jul 2021 16:24:40 -0700 (PDT) Received: from localhost ([::1]:37286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4tfj-0000oI-Qt for importer@patchew.org; Sat, 17 Jul 2021 19:24:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcO-0001f3-DO for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:12 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:40547) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcM-0000iF-IK for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:12 -0400 Received: by mail-wm1-x32c.google.com with SMTP id f8-20020a1c1f080000b029022d4c6cfc37so9097990wmf.5 for ; Sat, 17 Jul 2021 16:21:10 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i8y5R85+M8+6PdkH9oStWkg2AYTRr/oyBaoRFz3LQCk=; b=cIHlhZqScnRppIt+Mcc0e1WpUqd2BANu6HJXQnqFSG9KmsXW5aTYCc67oa+96XsUPU sLfEA+Qokd34oX/pFXyYYZPKzCwCiQwd4LL/5E7tD/QhYI1i+VkRXJSBV0RA4XvxFrva Qp+1MHZPNyj2KaifNil+i22RvjkBssQYBiPXzXiFF9b00hrYJtyIQ22Fu470U9sYysxZ ri+6qHax70+ZcyyTK0i2te/zLdOHBkcvuK0iIlsl2+8Tb6f+KSzcFB6fP8lO9tNBf+uP L5IE6Ko8Od5Nntxw8j1Tr3j0KbLTFHoKbeEdGtOU/fxqNXrmsbMSSYKX54aVFPGp/Z99 nHgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i8y5R85+M8+6PdkH9oStWkg2AYTRr/oyBaoRFz3LQCk=; b=X+6JaWt/EdU7wMbcXO0Xfi5hRl1rmX1/CnIJ56tJWfD9jk+4J9TokdU2xoO2cQa25x E1+8RcY3vEroGPjHs0kJXDsOqaINqP+aXddP+dhg9+TeSX4mcOe55ikn+amWv/4bKMu/ wR1KFFSDVuXFuFGyOvPhoFIqwiyFPb6XkAW1JlY42QnYLKuwUlJbmPNAbx9rM2A7bbPO 7KVIHGZZxRmOBN5+opLd6tHS8wq323ZVil4vp7KQ9MsIere76gfoC7ZV+cwMfClnBsb4 dc0AsYbL1AbYrbemlkGg+flJrm4cmb7dtMKiqWCD3Je3LZ+HXCdMOp3K2VdgKL2eNh7/ totg== X-Gm-Message-State: AOAM530eYo8EV7cCzbb8Zlc4zo2a6iwhox6hwRknUZstn1Zbxuqo5nQ/ /F8JZONGFe3C8haMn4b72mQWH01vpg87Lg== X-Google-Smtp-Source: ABdhPJwP6fQWnNhw4u2fUEzss/M4XSnAdwXVgBGGEm/t2UYVVEvfrjaCfP55saZcjQaVnTLbipUyOA== X-Received: by 2002:a7b:c30f:: with SMTP id k15mr24610623wmj.128.1626564069236; Sat, 17 Jul 2021 16:21:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 05/10] linux-user: Split mmap prototypes into user-mmap.h Date: Sun, 18 Jul 2021 00:20:58 +0100 Message-Id: <20210717232103.18047-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564282954100003 Content-Type: text/plain; charset="utf-8" Split out the mmap prototypes into a new header user-mmap.h which we only include where required. Signed-off-by: Peter Maydell --- linux-user/qemu.h | 20 -------------------- linux-user/user-mmap.h | 34 ++++++++++++++++++++++++++++++++++ linux-user/elfload.c | 1 + linux-user/flatload.c | 1 + linux-user/i386/cpu_loop.c | 1 + linux-user/main.c | 1 + linux-user/mmap.c | 1 + linux-user/syscall.c | 1 + 8 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 linux-user/user-mmap.h diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 9e700d3af18..0cb79990579 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -201,12 +201,6 @@ extern IOCTLEntry ioctl_entries[]; */ int info_is_fdpic(struct image_info *info); =20 -uint32_t get_elf_eflags(int fd); -int load_elf_binary(struct linux_binprm *bprm, struct image_info *info); -int load_flt_binary(struct linux_binprm *bprm, struct image_info *info); - -abi_long memcpy_to_target(abi_ulong dest, const void *src, - unsigned long len); void target_set_brk(abi_ulong new_brk); abi_long do_brk(abi_ulong new_brk); void syscall_init(void); @@ -395,20 +389,6 @@ void sparc64_set_context(CPUSPARCState *env); void sparc64_get_context(CPUSPARCState *env); #endif =20 -/* mmap.c */ -int target_mprotect(abi_ulong start, abi_ulong len, int prot); -abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, - int flags, int fd, abi_ulong offset); -int target_munmap(abi_ulong start, abi_ulong len); -abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, - abi_ulong new_size, unsigned long flags, - abi_ulong new_addr); -extern unsigned long last_brk; -extern abi_ulong mmap_next_start; -abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong); -void mmap_fork_start(void); -void mmap_fork_end(int child); - /* user access */ =20 #define VERIFY_READ PAGE_READ diff --git a/linux-user/user-mmap.h b/linux-user/user-mmap.h new file mode 100644 index 00000000000..e94fbd10433 --- /dev/null +++ b/linux-user/user-mmap.h @@ -0,0 +1,34 @@ +/* + * loader.h: prototypes for linux-user guest binary loader + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef LINUX_USER_USER_MMAP_H +#define LINUX_USER_USER_MMAP_H + +int target_mprotect(abi_ulong start, abi_ulong len, int prot); +abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, + int flags, int fd, abi_ulong offset); +int target_munmap(abi_ulong start, abi_ulong len); +abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, + abi_ulong new_size, unsigned long flags, + abi_ulong new_addr); +extern unsigned long last_brk; +extern abi_ulong mmap_next_start; +abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong); +void mmap_fork_start(void); +void mmap_fork_end(int child); + +#endif /* LINUX_USER_USER_MMAP_H */ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index d56e00c18b4..f770de31672 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -7,6 +7,7 @@ =20 #include "qemu.h" #include "loader.h" +#include "user-mmap.h" #include "disas/disas.h" #include "qemu/bitops.h" #include "qemu/path.h" diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 7484a4a3543..99550061db8 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -37,6 +37,7 @@ =20 #include "qemu.h" #include "loader.h" +#include "user-mmap.h" #include "flat.h" #include "target_flat.h" =20 diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index db6dbf40cdc..fca0a75d8a1 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -22,6 +22,7 @@ #include "qemu.h" #include "cpu_loop-common.h" #include "sighandling.h" +#include "user-mmap.h" =20 /***********************************************************/ /* CPUX86 core interface */ diff --git a/linux-user/main.c b/linux-user/main.c index 4ec0e2ad55d..dfcdd80a563 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -51,6 +51,7 @@ #include "fd-trans.h" #include "sighandling.h" #include "loader.h" +#include "user-mmap.h" =20 #ifndef AT_FLAGS_PRESERVE_ARGV0 #define AT_FLAGS_PRESERVE_ARGV0_BIT 0 diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 0e103859fed..4b182444bbd 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -20,6 +20,7 @@ #include "trace.h" #include "exec/log.h" #include "qemu.h" +#include "user-mmap.h" =20 static pthread_mutex_t mmap_mutex =3D PTHREAD_MUTEX_INITIALIZER; static __thread int mmap_lock_count; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d6019b1c4c2..1dd285972f7 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -130,6 +130,7 @@ #include "strace.h" #include "sighandling.h" #include "loader.h" +#include "user-mmap.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564494; cv=none; d=zohomail.com; s=zohoarc; b=J0Xu1rJzj66iFu9G6g0k5g9+BI4yZfVZvHUHNOTY+bmAlNAS1zFn4/KIkViVODLIJQ/YKg7I0JR/5zj5mZAF3OCS7Z/1u+fiI617idthAoGj/hncvzYOSCE+LHZXrfEBxJkpSA/SGSGNdrZIVNuPZFi67xypqstiM7hlEBFQbQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564494; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=szfiIr1wHpAefQTph7B0pDZga35OoaD+hjqhVEelIQM=; b=jvwd7pRQRh3QxeDySz7FKHl/dbcPV89OlVDYgf4851dIABIgvWLXXzH9Y3eb8paH5SsAl7f3QEoOI7Oox5NGsyIoO3ii5OgcPgGk0rP9D/RsJ9/IyaMg/reHI7Se2riM2UgNGR+WQoXKkBA4VqIoSdP3Oj5zMDlQQX/cxCmNhOk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16265644944381001.9417150843914; Sat, 17 Jul 2021 16:28:14 -0700 (PDT) Received: from localhost ([::1]:49222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4tjA-0000Gs-Qi for importer@patchew.org; Sat, 17 Jul 2021 19:28:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcQ-0001ki-G7 for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:14 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:33524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcN-0000j0-U2 for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:14 -0400 Received: by mail-wr1-x434.google.com with SMTP id d2so16559003wrn.0 for ; Sat, 17 Jul 2021 16:21:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=szfiIr1wHpAefQTph7B0pDZga35OoaD+hjqhVEelIQM=; b=cF7ANdWTzdHcCGzaqench3qbcJXKM+O2mSFvdpInSlcSWuZB/y3sUl/7XcNXY9J3EL N37lD65K7uBGVOEi+d7NzRuj5T1Nu6i0vxjFqSF0N9suctSa5dxSe0Li2p/t9073dcFr lZwEROcPGkX2Q1t7FuKdHR0wLXEyshQ+ZtPuEQVm2p2GfHD4g8fDryWwRYo5JQ+4aK0C cfaoYAZg5BrcES2SZor7IAoSqovffJ652J4opbNeIfp9FYXm1TT3Zofjolu9GMH0EU1j 7z3b7r4w89RigrUqgktQ99TvE6IqFHCX9e4kIEUxELiPt3Q+tqGn5ng4XTu++28sKPzC OORA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=szfiIr1wHpAefQTph7B0pDZga35OoaD+hjqhVEelIQM=; b=IytY2Ew2hyEO//x3uyq9Rz9rQrLdxx/URqTm4/uW25y0tTf/cp4x8QDUVi2ZD/HiGQ iXzl+IjIpmwHyoRXgONowKVnPIpedG0B1aJcjIFonMrG12RDp5gAaosCcUv3TD9Sx+OC KTHgOla/4rD9gw2raJHTXEVYy4q98lm8lm9kkRkfAASua784oOCugqGRg3Zzssh1ypDI J/RUW+DH3UwSC5DvWaaSmRYX3Xk9qLKGBpiheNqr0nbAinXpsRte1PcPvVa7etBqUJM3 3FPkkWJMArP2BPMYA7bDttnBtAlNoxLkaQ6yG/IgMLl6wIt1r1LJiGTQUxDuyyDRsRCx nosg== X-Gm-Message-State: AOAM533WZ+kOPJzojj52ypMt0P+AimohXfcASye9LFoLSfsg3cVSnalG dqt+ukDyuOdKHN4ileF55ceUBd4JfZrqpw== X-Google-Smtp-Source: ABdhPJyCZnpMgVFBebCKuMu8C3PpA+QmYER1BtMqykGb05B8I15ivUOjUVNcXgvO1u6tEZPkzrzIsA== X-Received: by 2002:adf:dc8e:: with SMTP id r14mr21097318wrj.240.1626564070099; Sat, 17 Jul 2021 16:21:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 06/10] linux-user: Split safe-syscall macro into its own header Date: Sun, 18 Jul 2021 00:20:59 +0100 Message-Id: <20210717232103.18047-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564495026100001 Content-Type: text/plain; charset="utf-8" Split the safe-syscall macro from qemu.h into a new safe-syscall.h. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/qemu.h | 135 --------------------------------- linux-user/safe-syscall.h | 154 ++++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 1 + 3 files changed, 155 insertions(+), 135 deletions(-) create mode 100644 linux-user/safe-syscall.h diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 0cb79990579..a82a46236e6 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -240,141 +240,6 @@ void probe_guest_base(const char *image_name, =20 #include "qemu/log.h" =20 -/* safe_syscall.S */ - -/** - * safe_syscall: - * @int number: number of system call to make - * ...: arguments to the system call - * - * Call a system call if guest signal not pending. - * This has the same API as the libc syscall() function, except that it - * may return -1 with errno =3D=3D TARGET_ERESTARTSYS if a signal was pend= ing. - * - * Returns: the system call result, or -1 with an error code in errno - * (Errnos are host errnos; we rely on TARGET_ERESTARTSYS not clashing - * with any of the host errno values.) - */ - -/* - * A guide to using safe_syscall() to handle interactions between guest - * syscalls and guest signals: - * - * Guest syscalls come in two flavours: - * - * (1) Non-interruptible syscalls - * - * These are guest syscalls that never get interrupted by signals and - * so never return EINTR. They can be implemented straightforwardly in - * QEMU: just make sure that if the implementation code has to make any - * blocking calls that those calls are retried if they return EINTR. - * It's also OK to implement these with safe_syscall, though it will be - * a little less efficient if a signal is delivered at the 'wrong' moment. - * - * Some non-interruptible syscalls need to be handled using block_signals() - * to block signals for the duration of the syscall. This mainly applies - * to code which needs to modify the data structures used by the - * host_signal_handler() function and the functions it calls, including - * all syscalls which change the thread's signal mask. - * - * (2) Interruptible syscalls - * - * These are guest syscalls that can be interrupted by signals and - * for which we need to either return EINTR or arrange for the guest - * syscall to be restarted. This category includes both syscalls which - * always restart (and in the kernel return -ERESTARTNOINTR), ones - * which only restart if there is no handler (kernel returns -ERESTARTNOHA= ND - * or -ERESTART_RESTARTBLOCK), and the most common kind which restart - * if the handler was registered with SA_RESTART (kernel returns - * -ERESTARTSYS). System calls which are only interruptible in some - * situations (like 'open') also need to be handled this way. - * - * Here it is important that the host syscall is made - * via this safe_syscall() function, and *not* via the host libc. - * If the host libc is used then the implementation will appear to work - * most of the time, but there will be a race condition where a - * signal could arrive just before we make the host syscall inside libc, - * and then then guest syscall will not correctly be interrupted. - * Instead the implementation of the guest syscall can use the safe_syscall - * function but otherwise just return the result or errno in the usual - * way; the main loop code will take care of restarting the syscall - * if appropriate. - * - * (If the implementation needs to make multiple host syscalls this is - * OK; any which might really block must be via safe_syscall(); for those - * which are only technically blocking (ie which we know in practice won't - * stay in the host kernel indefinitely) it's OK to use libc if necessary. - * You must be able to cope with backing out correctly if some safe_syscall - * you make in the implementation returns either -TARGET_ERESTARTSYS or - * EINTR though.) - * - * block_signals() cannot be used for interruptible syscalls. - * - * - * How and why the safe_syscall implementation works: - * - * The basic setup is that we make the host syscall via a known - * section of host native assembly. If a signal occurs, our signal - * handler checks the interrupted host PC against the addresse of that - * known section. If the PC is before or at the address of the syscall - * instruction then we change the PC to point at a "return - * -TARGET_ERESTARTSYS" code path instead, and then exit the signal handler - * (causing the safe_syscall() call to immediately return that value). - * Then in the main.c loop if we see this magic return value we adjust - * the guest PC to wind it back to before the system call, and invoke - * the guest signal handler as usual. - * - * This winding-back will happen in two cases: - * (1) signal came in just before we took the host syscall (a race); - * in this case we'll take the guest signal and have another go - * at the syscall afterwards, and this is indistinguishable for the - * guest from the timing having been different such that the guest - * signal really did win the race - * (2) signal came in while the host syscall was blocking, and the - * host kernel decided the syscall should be restarted; - * in this case we want to restart the guest syscall also, and so - * rewinding is the right thing. (Note that "restart" semantics mean - * "first call the signal handler, then reattempt the syscall".) - * The other situation to consider is when a signal came in while the - * host syscall was blocking, and the host kernel decided that the syscall - * should not be restarted; in this case QEMU's host signal handler will - * be invoked with the PC pointing just after the syscall instruction, - * with registers indicating an EINTR return; the special code in the - * handler will not kick in, and we will return EINTR to the guest as - * we should. - * - * Notice that we can leave the host kernel to make the decision for - * us about whether to do a restart of the syscall or not; we do not - * need to check SA_RESTART flags in QEMU or distinguish the various - * kinds of restartability. - */ -#ifdef HAVE_SAFE_SYSCALL -/* The core part of this function is implemented in assembly */ -extern long safe_syscall_base(int *pending, long number, ...); - -#define safe_syscall(...) \ - ({ \ - long ret_; \ - int *psp_ =3D &((TaskState *)thread_cpu->opaque)->signal_pending; \ - ret_ =3D safe_syscall_base(psp_, __VA_ARGS__); \ - if (is_error(ret_)) { \ - errno =3D -ret_; \ - ret_ =3D -1; \ - } \ - ret_; \ - }) - -#else - -/* - * Fallback for architectures which don't yet provide a safe-syscall assem= bly - * fragment; note that this is racy! - * This should go away when all host architectures have been updated. - */ -#define safe_syscall syscall - -#endif - /* syscall.c */ int host_to_target_waitstatus(int status); =20 diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h new file mode 100644 index 00000000000..6bc03902628 --- /dev/null +++ b/linux-user/safe-syscall.h @@ -0,0 +1,154 @@ +/* + * safe-syscall.h: prototypes for linux-user signal-race-safe syscalls + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef LINUX_USER_SAFE_SYSCALL_H +#define LINUX_USER_SAFE_SYSCALL_H + +/** + * safe_syscall: + * @int number: number of system call to make + * ...: arguments to the system call + * + * Call a system call if guest signal not pending. + * This has the same API as the libc syscall() function, except that it + * may return -1 with errno =3D=3D TARGET_ERESTARTSYS if a signal was pend= ing. + * + * Returns: the system call result, or -1 with an error code in errno + * (Errnos are host errnos; we rely on TARGET_ERESTARTSYS not clashing + * with any of the host errno values.) + */ + +/* + * A guide to using safe_syscall() to handle interactions between guest + * syscalls and guest signals: + * + * Guest syscalls come in two flavours: + * + * (1) Non-interruptible syscalls + * + * These are guest syscalls that never get interrupted by signals and + * so never return EINTR. They can be implemented straightforwardly in + * QEMU: just make sure that if the implementation code has to make any + * blocking calls that those calls are retried if they return EINTR. + * It's also OK to implement these with safe_syscall, though it will be + * a little less efficient if a signal is delivered at the 'wrong' moment. + * + * Some non-interruptible syscalls need to be handled using block_signals() + * to block signals for the duration of the syscall. This mainly applies + * to code which needs to modify the data structures used by the + * host_signal_handler() function and the functions it calls, including + * all syscalls which change the thread's signal mask. + * + * (2) Interruptible syscalls + * + * These are guest syscalls that can be interrupted by signals and + * for which we need to either return EINTR or arrange for the guest + * syscall to be restarted. This category includes both syscalls which + * always restart (and in the kernel return -ERESTARTNOINTR), ones + * which only restart if there is no handler (kernel returns -ERESTARTNOHA= ND + * or -ERESTART_RESTARTBLOCK), and the most common kind which restart + * if the handler was registered with SA_RESTART (kernel returns + * -ERESTARTSYS). System calls which are only interruptible in some + * situations (like 'open') also need to be handled this way. + * + * Here it is important that the host syscall is made + * via this safe_syscall() function, and *not* via the host libc. + * If the host libc is used then the implementation will appear to work + * most of the time, but there will be a race condition where a + * signal could arrive just before we make the host syscall inside libc, + * and then then guest syscall will not correctly be interrupted. + * Instead the implementation of the guest syscall can use the safe_syscall + * function but otherwise just return the result or errno in the usual + * way; the main loop code will take care of restarting the syscall + * if appropriate. + * + * (If the implementation needs to make multiple host syscalls this is + * OK; any which might really block must be via safe_syscall(); for those + * which are only technically blocking (ie which we know in practice won't + * stay in the host kernel indefinitely) it's OK to use libc if necessary. + * You must be able to cope with backing out correctly if some safe_syscall + * you make in the implementation returns either -TARGET_ERESTARTSYS or + * EINTR though.) + * + * block_signals() cannot be used for interruptible syscalls. + * + * + * How and why the safe_syscall implementation works: + * + * The basic setup is that we make the host syscall via a known + * section of host native assembly. If a signal occurs, our signal + * handler checks the interrupted host PC against the addresse of that + * known section. If the PC is before or at the address of the syscall + * instruction then we change the PC to point at a "return + * -TARGET_ERESTARTSYS" code path instead, and then exit the signal handler + * (causing the safe_syscall() call to immediately return that value). + * Then in the main.c loop if we see this magic return value we adjust + * the guest PC to wind it back to before the system call, and invoke + * the guest signal handler as usual. + * + * This winding-back will happen in two cases: + * (1) signal came in just before we took the host syscall (a race); + * in this case we'll take the guest signal and have another go + * at the syscall afterwards, and this is indistinguishable for the + * guest from the timing having been different such that the guest + * signal really did win the race + * (2) signal came in while the host syscall was blocking, and the + * host kernel decided the syscall should be restarted; + * in this case we want to restart the guest syscall also, and so + * rewinding is the right thing. (Note that "restart" semantics mean + * "first call the signal handler, then reattempt the syscall".) + * The other situation to consider is when a signal came in while the + * host syscall was blocking, and the host kernel decided that the syscall + * should not be restarted; in this case QEMU's host signal handler will + * be invoked with the PC pointing just after the syscall instruction, + * with registers indicating an EINTR return; the special code in the + * handler will not kick in, and we will return EINTR to the guest as + * we should. + * + * Notice that we can leave the host kernel to make the decision for + * us about whether to do a restart of the syscall or not; we do not + * need to check SA_RESTART flags in QEMU or distinguish the various + * kinds of restartability. + */ +#ifdef HAVE_SAFE_SYSCALL +/* The core part of this function is implemented in assembly */ +extern long safe_syscall_base(int *pending, long number, ...); + +#define safe_syscall(...) \ + ({ \ + long ret_; \ + int *psp_ =3D &((TaskState *)thread_cpu->opaque)->signal_pending; \ + ret_ =3D safe_syscall_base(psp_, __VA_ARGS__); \ + if (is_error(ret_)) { \ + errno =3D -ret_; \ + ret_ =3D -1; \ + } \ + ret_; \ + }) + +#else + +/* + * Fallback for architectures which don't yet provide a safe-syscall assem= bly + * fragment; note that this is racy! + * This should go away when all host architectures have been updated. + */ +#define safe_syscall syscall + +#endif + +#endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1dd285972f7..913761d16e2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -131,6 +131,7 @@ #include "sighandling.h" #include "loader.h" #include "user-mmap.h" +#include "safe-syscall.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564179; cv=none; d=zohomail.com; s=zohoarc; b=EVC5o0RxGOFqRsRFadXGUdcRugU6vjBMPfAYCTo2fSKbRCkMAYa6hpmMreuBEvUc1BKChFDCPD+0nAYwzUUw4gyFxMfiSiR/TVI/sr2BmbyQZKxWzzxw7h0exLu6tiExdi/rpNZGSAxQZtlSHHZcqb/nJCriFZIyJnTwa5XYQoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564179; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7xrqCHIReux/ltyywe/O+adH4mu57w6rfCAz7uRcwHA=; b=JCeqR0xfhWj1Y8fsGa7IzVIkN3duLbIv85G0Hisqvvb+ZMMeK0dMlk/p3tk7Y78bvdVKcfDU5TLAEfpxcQsJ5KyYPldVs4BFJFSSB71QyWMG9gI+PuOavx18LHyDYMUTDccsnBPz8bmyDrFzLN255jl95+9x8A7pXnRE4ABA0xw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626564179659875.6727976169175; Sat, 17 Jul 2021 16:22:59 -0700 (PDT) Received: from localhost ([::1]:58604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4te6-0004gx-Dr for importer@patchew.org; Sat, 17 Jul 2021 19:22:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcU-0001p1-DK for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:18 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:44715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcO-0000jI-S4 for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:18 -0400 Received: by mail-wm1-x335.google.com with SMTP id f10-20020a05600c4e8ab029023e8d74d693so3047000wmq.3 for ; Sat, 17 Jul 2021 16:21:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7xrqCHIReux/ltyywe/O+adH4mu57w6rfCAz7uRcwHA=; b=Q9Lyvi0fK+AMVLQ5mnBGs257omEEMSyr1KrUxkajAiZkCUe9Rqxg5sbRn/gOf90C4x FVimpcYwV1iAOGfcjxn8ezf6M+1/UcCusLtMKeK+dNcSjPhkDHlYFuVneFLSCN2OiZ6q MBuEuiSvfJBEtf8oYEnrOeCrNBpVo7E1kbPTWvMrm0d4NTylK1JJmdNZ6E1z04Axt5uG nJE772bq0rT4la2jH/tZi0UHHmKeWSrd8dJ0NcFfjqsF5VdTrVCxyHmOM9eoS0pjM8+I HM2Fm1MRiQamqi1AodgA6jmSICy50YWSQnm9cKDiOu+QzBJotSoOK0qL0S6PbUH7HvJb Cllg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7xrqCHIReux/ltyywe/O+adH4mu57w6rfCAz7uRcwHA=; b=FDn47gOSvOzEGt/zSyhWEmaR1KwSdZChedwF+HLNdic5ANxVpn8HDfU6+5/IVc49JQ LQUapT0uVAb7pDJgzFe8SgVY8Ip4dBbqnmIHx2ht2mo609J9s/GawJf85Vi0X5jg3IYa dVk/nlFkSTHHEA/E/yNWzn+UiSgRAeOlWNNEbsYlBmstNM8mLUnB5NnT7cQpTFtWREaN 0k5orvey84YMbqMdSOLf/N9QU1SVXNpZ7QtOEz4qcwgwLPl5cjAF0raJdCV8xof8hte+ 9tm/xNL8Ogjs9nwgXU19B+4s9Xf1dMRQPads5dzSoGKf6mR3xPiKpX4IucvX8O3YU0Hb aSgA== X-Gm-Message-State: AOAM532nfz+UrPXCvzgI16Ct43CNwhDFh00iWCi6O2gGlii1er6yC2H+ 5rJkIpb+Sa4bUoIPhzYTXeySRtyNwWQkSA== X-Google-Smtp-Source: ABdhPJy1gtifyq+DGmjqhFwAdYdN46K68SAUWH5eLe4IPtT2mhEiReVd9o7WG0VACioB2eE02aCaJA== X-Received: by 2002:a7b:c84d:: with SMTP id c13mr24870600wml.30.1626564071244; Sat, 17 Jul 2021 16:21:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 07/10] linux-user: Split linux-user internals out of qemu.h Date: Sun, 18 Jul 2021 00:21:00 +0100 Message-Id: <20210717232103.18047-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564180841100001 Content-Type: text/plain; charset="utf-8" qemu.h is included in various non-linux-user files (which mostly want the TaskState struct and the functions for doing usermode access to guest addresses like lock_user(), unlock_user(), get_user*(), etc). Split out the parts that are only used in linux-user itself into a new user-internals.h. This leaves qemu.h with basically three things: * the definition of the TaskState struct * the user-access functions and macros * do_brk() all of which are needed by code outside linux-user that includes qemu.h. The addition of all the extra #include lines was done with sed -i '/include.*qemu\.h/a #include "user-internals.h"' $(git grep -l 'i= nclude.*qemu\.h' linux-user) (and then undoing the change to fpa11.h). Signed-off-by: Peter Maydell --- linux-user/qemu.h | 164 +-------------------------- linux-user/user-internals.h | 184 +++++++++++++++++++++++++++++++ linux-user/aarch64/cpu_loop.c | 1 + linux-user/aarch64/signal.c | 1 + linux-user/alpha/cpu_loop.c | 1 + linux-user/alpha/signal.c | 1 + linux-user/arm/cpu_loop.c | 1 + linux-user/arm/signal.c | 1 + linux-user/cris/cpu_loop.c | 1 + linux-user/cris/signal.c | 1 + linux-user/elfload.c | 1 + linux-user/exit.c | 1 + linux-user/fd-trans.c | 1 + linux-user/flatload.c | 1 + linux-user/hexagon/cpu_loop.c | 1 + linux-user/hexagon/signal.c | 1 + linux-user/hppa/cpu_loop.c | 1 + linux-user/hppa/signal.c | 1 + linux-user/i386/cpu_loop.c | 1 + linux-user/i386/signal.c | 1 + linux-user/linuxload.c | 1 + linux-user/m68k/cpu_loop.c | 1 + linux-user/m68k/signal.c | 1 + linux-user/main.c | 1 + linux-user/microblaze/cpu_loop.c | 1 + linux-user/microblaze/signal.c | 1 + linux-user/mips/cpu_loop.c | 1 + linux-user/mips/signal.c | 1 + linux-user/mmap.c | 1 + linux-user/nios2/cpu_loop.c | 1 + linux-user/nios2/signal.c | 1 + linux-user/openrisc/cpu_loop.c | 1 + linux-user/openrisc/signal.c | 1 + linux-user/ppc/cpu_loop.c | 1 + linux-user/ppc/signal.c | 1 + linux-user/riscv/cpu_loop.c | 1 + linux-user/riscv/signal.c | 1 + linux-user/s390x/cpu_loop.c | 1 + linux-user/s390x/signal.c | 1 + linux-user/semihost.c | 1 + linux-user/sh4/cpu_loop.c | 1 + linux-user/sh4/signal.c | 1 + linux-user/signal.c | 1 + linux-user/sparc/cpu_loop.c | 1 + linux-user/sparc/signal.c | 1 + linux-user/strace.c | 1 + linux-user/syscall.c | 1 + linux-user/uaccess.c | 1 + linux-user/uname.c | 1 + linux-user/vm86.c | 1 + linux-user/xtensa/cpu_loop.c | 1 + linux-user/xtensa/signal.c | 1 + 52 files changed, 235 insertions(+), 163 deletions(-) create mode 100644 linux-user/user-internals.h diff --git a/linux-user/qemu.h b/linux-user/qemu.h index a82a46236e6..92290a55c0d 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -1,7 +1,6 @@ #ifndef QEMU_H #define QEMU_H =20 -#include "hostdep.h" #include "cpu.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" @@ -10,7 +9,6 @@ =20 #include "exec/user/abitypes.h" =20 -#include "exec/user/thunk.h" #include "syscall_defs.h" #include "target_syscall.h" #include "exec/gdbstub.h" @@ -166,93 +164,9 @@ typedef struct TaskState { struct target_sigaltstack sigaltstack_used; } __attribute__((aligned(16))) TaskState; =20 -extern char *exec_path; -void init_task_state(TaskState *ts); -void task_settid(TaskState *); -void stop_all_tasks(void); -extern const char *qemu_uname_release; -extern unsigned long mmap_min_addr; - -typedef struct IOCTLEntry IOCTLEntry; - -typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp, - int fd, int cmd, abi_long arg); - -struct IOCTLEntry { - int target_cmd; - unsigned int host_cmd; - const char *name; - int access; - do_ioctl_fn *do_ioctl; - const argtype arg_type[5]; -}; - -extern IOCTLEntry ioctl_entries[]; - -#define IOC_R 0x0001 -#define IOC_W 0x0002 -#define IOC_RW (IOC_R | IOC_W) - -/* - * Returns true if the image uses the FDPIC ABI. If this is the case, - * we have to provide some information (loadmap, pt_dynamic_info) such - * that the program can be relocated adequately. This is also useful - * when handling signals. - */ -int info_is_fdpic(struct image_info *info); - -void target_set_brk(abi_ulong new_brk); -abi_long do_brk(abi_ulong new_brk); -void syscall_init(void); -abi_long do_syscall(void *cpu_env, int num, abi_long arg1, - abi_long arg2, abi_long arg3, abi_long arg4, - abi_long arg5, abi_long arg6, abi_long arg7, - abi_long arg8); -extern __thread CPUState *thread_cpu; -void cpu_loop(CPUArchState *env); -const char *target_strerror(int err); -int get_osversion(void); -void init_qemu_uname_release(void); -void fork_start(void); -void fork_end(int child); - -/** - * probe_guest_base: - * @image_name: the executable being loaded - * @loaddr: the lowest fixed address in the executable - * @hiaddr: the highest fixed address in the executable - * - * Creates the initial guest address space in the host memory space. - * - * If @loaddr =3D=3D 0, then no address in the executable is fixed, - * i.e. it is fully relocatable. In that case @hiaddr is the size - * of the executable. - * - * This function will not return if a valid value for guest_base - * cannot be chosen. On return, the executable loader can expect - * - * target_mmap(loaddr, hiaddr - loaddr, ...) - * - * to succeed. - */ -void probe_guest_base(const char *image_name, - abi_ulong loaddr, abi_ulong hiaddr); - #include "qemu/log.h" =20 -/* syscall.c */ -int host_to_target_waitstatus(int status); - -#ifdef TARGET_I386 -/* vm86.c */ -void save_v86_state(CPUX86State *env); -void handle_vm86_trap(CPUX86State *env, int trapno); -void handle_vm86_fault(CPUX86State *env); -int do_vm86(CPUX86State *env, long subfunction, abi_ulong v86_addr); -#elif defined(TARGET_SPARC64) -void sparc64_set_context(CPUSPARCState *env); -void sparc64_get_context(CPUSPARCState *env); -#endif +abi_long do_brk(abi_ulong new_brk); =20 /* user access */ =20 @@ -437,80 +351,4 @@ void *lock_user_string(abi_ulong guest_addr); unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0) =20 #include - -static inline int is_error(abi_long ret) -{ - return (abi_ulong)ret >=3D (abi_ulong)(-4096); -} - -#if TARGET_ABI_BITS =3D=3D 32 -static inline uint64_t target_offset64(uint32_t word0, uint32_t word1) -{ -#ifdef TARGET_WORDS_BIGENDIAN - return ((uint64_t)word0 << 32) | word1; -#else - return ((uint64_t)word1 << 32) | word0; -#endif -} -#else /* TARGET_ABI_BITS =3D=3D 32 */ -static inline uint64_t target_offset64(uint64_t word0, uint64_t word1) -{ - return word0; -} -#endif /* TARGET_ABI_BITS !=3D 32 */ - -void print_termios(void *arg); - -/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers= */ -#ifdef TARGET_ARM -static inline int regpairs_aligned(void *cpu_env, int num) -{ - return ((((CPUARMState *)cpu_env)->eabi) =3D=3D 1) ; -} -#elif defined(TARGET_MIPS) && (TARGET_ABI_BITS =3D=3D 32) -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } -#elif defined(TARGET_PPC) && !defined(TARGET_PPC64) -/* - * SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pa= irs - * of registers which translates to the same as ARM/MIPS, because we start= with - * r3 as arg1 - */ -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } -#elif defined(TARGET_SH4) -/* SH4 doesn't align register pairs, except for p{read,write}64 */ -static inline int regpairs_aligned(void *cpu_env, int num) -{ - switch (num) { - case TARGET_NR_pread64: - case TARGET_NR_pwrite64: - return 1; - - default: - return 0; - } -} -#elif defined(TARGET_XTENSA) -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } -#elif defined(TARGET_HEXAGON) -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } -#else -static inline int regpairs_aligned(void *cpu_env, int num) { return 0; } -#endif - -/** - * preexit_cleanup: housekeeping before the guest exits - * - * env: the CPU state - * code: the exit code - */ -void preexit_cleanup(CPUArchState *env, int code); - -/* - * Include target-specific struct and function definitions; - * they may need access to the target-independent structures - * above, so include them last. - */ -#include "target_cpu.h" -#include "target_structs.h" - #endif /* QEMU_H */ diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h new file mode 100644 index 00000000000..1729a8b62e1 --- /dev/null +++ b/linux-user/user-internals.h @@ -0,0 +1,184 @@ +/* + * user-internals.h: prototypes etc internal to the linux-user implementat= ion + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef LINUX_USER_USER_INTERNALS_H +#define LINUX_USER_USER_INTERNALS_H + +#include "hostdep.h" +#include "exec/user/thunk.h" + +extern char *exec_path; +void init_task_state(TaskState *ts); +void task_settid(TaskState *); +void stop_all_tasks(void); +extern const char *qemu_uname_release; +extern unsigned long mmap_min_addr; + +typedef struct IOCTLEntry IOCTLEntry; + +typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp, + int fd, int cmd, abi_long arg); + +struct IOCTLEntry { + int target_cmd; + unsigned int host_cmd; + const char *name; + int access; + do_ioctl_fn *do_ioctl; + const argtype arg_type[5]; +}; + +extern IOCTLEntry ioctl_entries[]; + +#define IOC_R 0x0001 +#define IOC_W 0x0002 +#define IOC_RW (IOC_R | IOC_W) + +/* + * Returns true if the image uses the FDPIC ABI. If this is the case, + * we have to provide some information (loadmap, pt_dynamic_info) such + * that the program can be relocated adequately. This is also useful + * when handling signals. + */ +int info_is_fdpic(struct image_info *info); + +void target_set_brk(abi_ulong new_brk); +void syscall_init(void); +abi_long do_syscall(void *cpu_env, int num, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5, abi_long arg6, abi_long arg7, + abi_long arg8); +extern __thread CPUState *thread_cpu; +void cpu_loop(CPUArchState *env); +const char *target_strerror(int err); +int get_osversion(void); +void init_qemu_uname_release(void); +void fork_start(void); +void fork_end(int child); + +/** + * probe_guest_base: + * @image_name: the executable being loaded + * @loaddr: the lowest fixed address in the executable + * @hiaddr: the highest fixed address in the executable + * + * Creates the initial guest address space in the host memory space. + * + * If @loaddr =3D=3D 0, then no address in the executable is fixed, + * i.e. it is fully relocatable. In that case @hiaddr is the size + * of the executable. + * + * This function will not return if a valid value for guest_base + * cannot be chosen. On return, the executable loader can expect + * + * target_mmap(loaddr, hiaddr - loaddr, ...) + * + * to succeed. + */ +void probe_guest_base(const char *image_name, + abi_ulong loaddr, abi_ulong hiaddr); + +/* syscall.c */ +int host_to_target_waitstatus(int status); + +#ifdef TARGET_I386 +/* vm86.c */ +void save_v86_state(CPUX86State *env); +void handle_vm86_trap(CPUX86State *env, int trapno); +void handle_vm86_fault(CPUX86State *env); +int do_vm86(CPUX86State *env, long subfunction, abi_ulong v86_addr); +#elif defined(TARGET_SPARC64) +void sparc64_set_context(CPUSPARCState *env); +void sparc64_get_context(CPUSPARCState *env); +#endif + +static inline int is_error(abi_long ret) +{ + return (abi_ulong)ret >=3D (abi_ulong)(-4096); +} + +#if TARGET_ABI_BITS =3D=3D 32 +static inline uint64_t target_offset64(uint32_t word0, uint32_t word1) +{ +#ifdef TARGET_WORDS_BIGENDIAN + return ((uint64_t)word0 << 32) | word1; +#else + return ((uint64_t)word1 << 32) | word0; +#endif +} +#else /* TARGET_ABI_BITS =3D=3D 32 */ +static inline uint64_t target_offset64(uint64_t word0, uint64_t word1) +{ + return word0; +} +#endif /* TARGET_ABI_BITS !=3D 32 */ + +void print_termios(void *arg); + +/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers= */ +#ifdef TARGET_ARM +static inline int regpairs_aligned(void *cpu_env, int num) +{ + return ((((CPUARMState *)cpu_env)->eabi) =3D=3D 1) ; +} +#elif defined(TARGET_MIPS) && (TARGET_ABI_BITS =3D=3D 32) +static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } +#elif defined(TARGET_PPC) && !defined(TARGET_PPC64) +/* + * SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pa= irs + * of registers which translates to the same as ARM/MIPS, because we start= with + * r3 as arg1 + */ +static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } +#elif defined(TARGET_SH4) +/* SH4 doesn't align register pairs, except for p{read,write}64 */ +static inline int regpairs_aligned(void *cpu_env, int num) +{ + switch (num) { + case TARGET_NR_pread64: + case TARGET_NR_pwrite64: + return 1; + + default: + return 0; + } +} +#elif defined(TARGET_XTENSA) +static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } +#elif defined(TARGET_HEXAGON) +static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } +#else +static inline int regpairs_aligned(void *cpu_env, int num) { return 0; } +#endif + +/** + * preexit_cleanup: housekeeping before the guest exits + * + * env: the CPU state + * code: the exit code + */ +void preexit_cleanup(CPUArchState *env, int code); + +/* + * Include target-specific struct and function definitions; + * they may need access to the target-independent structures + * above, so include them last. + */ +#include "target_cpu.h" +#include "target_structs.h" + +#endif diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 459efdf2ec2..e4484778681 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" #include "qemu/guest-random.h" diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 75073dd3ec6..56d4b4460f3 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index 2939ef5c845..3082dbf7b15 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index 7f5dd3eef2f..207162a92cc 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 7a66079fd9c..1b26bda9969 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "elf.h" #include "cpu_loop-common.h" #include "sighandling.h" diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index bd0f29b3016..7c779701e01 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index 00c652b9a56..c499ab6dc53 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/cris/signal.c b/linux-user/cris/signal.c index 093a9758423..a09be6fc6b7 100644 --- a/linux-user/cris/signal.c +++ b/linux-user/cris/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/elfload.c b/linux-user/elfload.c index f770de31672..f2c5d857d12 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -6,6 +6,7 @@ #include =20 #include "qemu.h" +#include "user-internals.h" #include "loader.h" #include "user-mmap.h" #include "disas/disas.h" diff --git a/linux-user/exit.c b/linux-user/exit.c index 70b344048c0..371a0803ece 100644 --- a/linux-user/exit.c +++ b/linux-user/exit.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #ifdef CONFIG_GPROF #include #endif diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c index 8cdb97b81d1..629446a6f96 100644 --- a/linux-user/fd-trans.c +++ b/linux-user/fd-trans.c @@ -27,6 +27,7 @@ #include #endif #include "qemu.h" +#include "user-internals.h" #include "fd-trans.h" #include "sighandling.h" =20 diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 99550061db8..e4c2f89a226 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -36,6 +36,7 @@ #include "qemu/osdep.h" =20 #include "qemu.h" +#include "user-internals.h" #include "loader.h" #include "user-mmap.h" #include "flat.h" diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index aeddb91526d..900b44c5cb4 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -20,6 +20,7 @@ =20 #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" #include "internal.h" diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index 58ff2caa7e3..9b95f60648f 100644 --- a/linux-user/hexagon/signal.c +++ b/linux-user/hexagon/signal.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 3ddaa4155c4..42e175d963e 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -19,6 +19,7 @@ =20 #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index 4e08a3d74bb..27074382c5d 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index fca0a75d8a1..bdcb2eccba4 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" #include "user-mmap.h" diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 79a81f4e7c7..821b5645762 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index 27be7090d8f..2ed5fc45ed8 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -2,6 +2,7 @@ =20 #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "loader.h" =20 #define NGROUPS 32 diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index cbbcce729da..3fefe1528e2 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index c3a1c99d6d5..ea4e58e815b 100644 --- a/linux-user/m68k/signal.c +++ b/linux-user/m68k/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/main.c b/linux-user/main.c index dfcdd80a563..21fe674de3d 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -30,6 +30,7 @@ =20 #include "qapi/error.h" #include "qemu.h" +#include "user-internals.h" #include "qemu/path.h" #include "qemu/queue.h" #include "qemu/config-file.h" diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_l= oop.c index 3549ebe08bc..3b00047321a 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index ba04c3cc588..1f1aa479e32 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 929e29f60f1..01ea7e00e69 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" #include "elf.h" diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index fa242536315..d7e953d7d03 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 4b182444bbd..c125031b904 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -20,6 +20,7 @@ #include "trace.h" #include "exec/log.h" #include "qemu.h" +#include "user-internals.h" #include "user-mmap.h" =20 static pthread_mutex_t mmap_mutex =3D PTHREAD_MUTEX_INITIALIZER; diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index d3c042b8d0a..c724156964c 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -19,6 +19,7 @@ =20 #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index fb8ae7b4f92..9fd3189ae38 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index 7d24d3891d8..9e951565e4d 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/openrisc/signal.c b/linux-user/openrisc/signal.c index 62f85d18e4d..1d05f1f7adf 100644 --- a/linux-user/openrisc/signal.c +++ b/linux-user/openrisc/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index 61367d53b74..91e4e33bb52 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index d9a41723a0f..9725c5b2a30 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index d6a5d2d8975..4825750320f 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu/error-report.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" #include "elf.h" diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index 29a93d28932..52470c2a750 100644 --- a/linux-user/riscv/signal.c +++ b/linux-user/riscv/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index f3d345986d8..1b32b9b8ad0 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 4f900fee422..e84703e9bdb 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/semihost.c b/linux-user/semihost.c index f53ab526fba..17f074ac565 100644 --- a/linux-user/semihost.c +++ b/linux-user/semihost.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "semihosting/console.h" #include "qemu.h" +#include "user-internals.h" #include =20 int qemu_semihosting_console_outs(CPUArchState *env, target_ulong addr) diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index 059c7420eea..e383ad2f702 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index df78a2032fe..ae688dcea7c 100644 --- a/linux-user/sh4/signal.c +++ b/linux-user/sh4/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/signal.c b/linux-user/signal.c index 7abcec9166e..7c14f17fb2c 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -22,6 +22,7 @@ #include =20 #include "qemu.h" +#include "user-internals.h" #include "strace.h" #include "sighandling.h" #include "loader.h" diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 9b633029a92..289f72f953e 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index c2b6ba88ad2..d7fab06247a 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" diff --git a/linux-user/strace.c b/linux-user/strace.c index ee3429fae82..2cdbf030ba4 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -15,6 +15,7 @@ #include #include #include "qemu.h" +#include "user-internals.h" #include "strace.h" =20 struct syscallname { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 913761d16e2..ecda82668b7 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -127,6 +127,7 @@ #include "uname.h" =20 #include "qemu.h" +#include "user-internals.h" #include "strace.h" #include "sighandling.h" #include "loader.h" diff --git a/linux-user/uaccess.c b/linux-user/uaccess.c index 6a5b029607c..425cbf677f7 100644 --- a/linux-user/uaccess.c +++ b/linux-user/uaccess.c @@ -3,6 +3,7 @@ #include "qemu/cutils.h" =20 #include "qemu.h" +#include "user-internals.h" =20 void *lock_user(int type, abi_ulong guest_addr, ssize_t len, bool copy) { diff --git a/linux-user/uname.c b/linux-user/uname.c index a09ffe1ea7b..1d82608c100 100644 --- a/linux-user/uname.c +++ b/linux-user/uname.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" =20 #include "qemu.h" +#include "user-internals.h" //#include "qemu-common.h" #include "uname.h" =20 diff --git a/linux-user/vm86.c b/linux-user/vm86.c index 4412522c4c4..c2facf3fc2d 100644 --- a/linux-user/vm86.c +++ b/linux-user/vm86.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" =20 #include "qemu.h" +#include "user-internals.h" =20 //#define DEBUG_VM86 =20 diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index a0710ed044a..ba414c8b161 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -19,6 +19,7 @@ =20 #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "cpu_loop-common.h" #include "sighandling.h" =20 diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 32d666f2523..6d7c8698963 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu.h" +#include "user-internals.h" #include "signal-common.h" #include "sighandling.h" #include "linux-user/trace.h" --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564357; cv=none; d=zohomail.com; s=zohoarc; b=C2LvcnndcKfxyL3K4bW68D/25jDO2AYtPGya3dUSGvJYYPbzjQ5aR2TAfo4WvojV8yuWtQ/jmBrEa++USwt0AgOgZlR0gI7/jUcVyWlniPUY6SAVMzCHJsOX7hNxaHta34o/GrCdtCDwYHL/viYa9PIlPHc4qnYua2WXpoRRN8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564357; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NyzpfK1WCrk/eJzlVhQMae9mDkY1H1hE1WXMP7wH75I=; b=NvqZSIBbo8BF0jQM3m0i//qKlHRVL48lLxLSWlyfCbuiA8qQLwPgaAQkQFwwEk8DRx9A68WHOpxTWfqh9yE3Af2+lBIRQ+b+DAN36rk67tmJQfkyMCLJ0EPIm30Eq+wLidcyOZoR7VpdwYKWRm7ns1ex5i89PEza28P+aD47NeQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626564357866778.72381459193; Sat, 17 Jul 2021 16:25:57 -0700 (PDT) Received: from localhost ([::1]:40058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4tgy-0002dv-Ra for importer@patchew.org; Sat, 17 Jul 2021 19:25:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcS-0001mD-8P for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:16 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:42536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcP-0000jQ-BH for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:16 -0400 Received: by mail-wm1-x330.google.com with SMTP id a23-20020a05600c2257b0290236ec98bebaso5635668wmm.1 for ; Sat, 17 Jul 2021 16:21:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NyzpfK1WCrk/eJzlVhQMae9mDkY1H1hE1WXMP7wH75I=; b=Eh86BrTun3iECHMeGUPOSZ45ZEd74fk5MyFYBtgMUaXS3iCH/TsF672XrJjHi1+WYG C3tajFgRDTKgnYeNZ2vAWjtXOLSnbIhKZTB2MbgViXBXNhd5ST3SFZgB0ov3kzN5qAi2 50vaqaHPQQDT1IvTyclGzueGSlJxyKRdog+Ji0R+HMgCZLyrKkNfQFaqVMJueFLdYEfe lLFpSr5oUS/WMJ+iQ2YuJa/XCrhNRzslxby7ZJ8S4X5gNdRSPrqX6Jv1Z67jrMFC5i8Z GYAZMZ8DSU2p8JYZBIrcuGf8hOsvEgMI2kj+ewlSpmte8nmpw2RNFvFSS7rQ4u0WPUzu zX7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NyzpfK1WCrk/eJzlVhQMae9mDkY1H1hE1WXMP7wH75I=; b=ewhtJOavMXWvzB95kdSiHcRict7DhvjjFgi2oYoQyQ1XJsyuQMr/4NshvnIR5z9t2L kuAyar/mc/WZFmFe/Nf/0GDdyOz11C6M9NoCSZhRAzfk5AV1tggcntJZ9xj/QMQut13S qjRAifZ3oIOLmzOEb2kcVxNdQms+qd40dUgaF8Het8racC7/iAVK4FuBH54N6imuE5bo hBDo0/ZuiCCS6+QTqUUB3zL4Ne75hFRkUZPON86fDgC60Ml7PNhdrB4flG6LW2/rvVOP BPFDmlXD4x9lijgouwFvBwX9GXI73PxEAVuhQ+XYJ/lDmUg5UNonEB9SEPtRYjq164Rp /9jQ== X-Gm-Message-State: AOAM533tQ4zob2qR7B2fH4wCyxcfxR9v7FJ2Nl7H/gZxoZigQODqjxm4 VqFMfHmM7I36AEJiNcIq+3k1U/8pH7CU/w== X-Google-Smtp-Source: ABdhPJyi4h27mGSWsJrXFPWQibUUS0x7kNrzTMTHOmIEUmY0JRjLEO7Mz+AXowpRVZ5E8I1end7Mlg== X-Received: by 2002:a1c:c90f:: with SMTP id f15mr24453800wmb.142.1626564072055; Sat, 17 Jul 2021 16:21:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 08/10] linux-user: Don't include gdbstub.h in qemu.h Date: Sun, 18 Jul 2021 00:21:01 +0100 Message-Id: <20210717232103.18047-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564359247100001 Content-Type: text/plain; charset="utf-8" Currently the linux-user qemu.h pulls in gdbstub.h. There's no real reason why it should do this; include it directly from the C files which require it, and drop the include line in qemu.h. (Note that several of the C files previously relying on this indirect include were going out of their way to only include gdbstub.h conditionally on not CONFIG_USER_ONLY!) Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/qemu.h | 1 - gdbstub.c | 2 +- linux-user/exit.c | 1 + linux-user/main.c | 1 + linux-user/signal.c | 2 ++ semihosting/arm-compat-semi.c | 2 +- target/m68k/m68k-semi.c | 2 +- target/nios2/nios2-semi.c | 2 +- 8 files changed, 8 insertions(+), 5 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 92290a55c0d..fda90fc28d6 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -11,7 +11,6 @@ =20 #include "syscall_defs.h" #include "target_syscall.h" -#include "exec/gdbstub.h" =20 /* * This is the size of the host kernel's sigset_t, needed where we make diff --git a/gdbstub.c b/gdbstub.c index 52bde5bdc97..480745152b8 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -31,13 +31,13 @@ #include "qemu/cutils.h" #include "qemu/module.h" #include "trace/trace-root.h" +#include "exec/gdbstub.h" #ifdef CONFIG_USER_ONLY #include "qemu.h" #else #include "monitor/monitor.h" #include "chardev/char.h" #include "chardev/char-fe.h" -#include "exec/gdbstub.h" #include "hw/cpu/cluster.h" #include "hw/boards.h" #endif diff --git a/linux-user/exit.c b/linux-user/exit.c index 371a0803ece..9f78be5feda 100644 --- a/linux-user/exit.c +++ b/linux-user/exit.c @@ -17,6 +17,7 @@ * along with this program; if not, see . */ #include "qemu/osdep.h" +#include "exec/gdbstub.h" #include "qemu.h" #include "user-internals.h" #ifdef CONFIG_GPROF diff --git a/linux-user/main.c b/linux-user/main.c index 21fe674de3d..8157a208efc 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -40,6 +40,7 @@ #include "qemu/module.h" #include "qemu/plugin.h" #include "exec/exec-all.h" +#include "exec/gdbstub.h" #include "tcg/tcg.h" #include "qemu/timer.h" #include "qemu/envlist.h" diff --git a/linux-user/signal.c b/linux-user/signal.c index 7c14f17fb2c..ca2f585b082 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -18,6 +18,8 @@ */ #include "qemu/osdep.h" #include "qemu/bitops.h" +#include "exec/gdbstub.h" + #include #include =20 diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 1c29146dcfa..01badea99c8 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -37,12 +37,12 @@ #include "semihosting/console.h" #include "semihosting/common-semi.h" #include "qemu/timer.h" +#include "exec/gdbstub.h" #ifdef CONFIG_USER_ONLY #include "qemu.h" =20 #define COMMON_SEMI_HEAP_SIZE (128 * 1024 * 1024) #else -#include "exec/gdbstub.h" #include "qemu/cutils.h" #ifdef TARGET_ARM #include "hw/arm/boot.h" diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c index d919245e4f8..44ec7e4612c 100644 --- a/target/m68k/m68k-semi.c +++ b/target/m68k/m68k-semi.c @@ -20,11 +20,11 @@ #include "qemu/osdep.h" =20 #include "cpu.h" +#include "exec/gdbstub.h" #if defined(CONFIG_USER_ONLY) #include "qemu.h" #define SEMIHOSTING_HEAP_SIZE (128 * 1024 * 1024) #else -#include "exec/gdbstub.h" #include "exec/softmmu-semi.h" #include "hw/boards.h" #endif diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c index e508b2fafce..fe5598bae4d 100644 --- a/target/nios2/nios2-semi.c +++ b/target/nios2/nios2-semi.c @@ -24,11 +24,11 @@ #include "qemu/osdep.h" =20 #include "cpu.h" +#include "exec/gdbstub.h" #if defined(CONFIG_USER_ONLY) #include "qemu.h" #else #include "qemu-common.h" -#include "exec/gdbstub.h" #include "exec/softmmu-semi.h" #endif #include "qemu/log.h" --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564399; cv=none; d=zohomail.com; s=zohoarc; b=bw/AkifcLf9gOF7IDH8Z1gJRNVLJxdnrfUyVvrTqkupYh4bbCOKtnG3BjI9cTlLyJxE3M6/A0eBUnlsf3zQu5SbTNkLDVkt1S3/RZ2YXILMflvHUoRkt8pwmkkMr2jHoS7PTCmInFkoeiQxYb2hblFJONIgRofTNeMyaqgNBiIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564399; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/MAEIGkxboaQ7/sKH4/N7ZsnrjiQlrtgLB/5WpkDnOs=; b=NX42aTcG0lvoTWVocjq7q1mxMaD9g377dgns+fS1GRsnBk6uY+0dZWiH1mYvYX8A6UHoSO5q8/buS2QS9h0ieIzDPuukcFQ0t6wv2v+a55/NCWQfRD1SIlK9M5iHrU4QNZAUdEL1L6b+EQFgQF/POC8/Wky+U+HNm9MLBhjUwtY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626564399824932.8026699654155; Sat, 17 Jul 2021 16:26:39 -0700 (PDT) Received: from localhost ([::1]:43692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4the-00055v-QF for importer@patchew.org; Sat, 17 Jul 2021 19:26:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcS-0001mT-Cx for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:16 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:46945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcQ-0000kl-2d for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:16 -0400 Received: by mail-wm1-x334.google.com with SMTP id o30-20020a05600c511eb029022e0571d1a0so8062856wms.5 for ; Sat, 17 Jul 2021 16:21:13 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/MAEIGkxboaQ7/sKH4/N7ZsnrjiQlrtgLB/5WpkDnOs=; b=cqY1oFqGRGwvHn34Quim+J2Q1f6p6XxaH0Xh7IRjLZfYsvM1K2tWplrNPIF9aeo/oV Ugoy7oJJQR9LMY4brG6wrHf+S5vqJWKfbkSNF7kTKP69zhEpJ44PZAamVegGkFui+w9Z BcIWiwsOuHMg+4FooKKvscqk9wW5Aa4oiCzOAaB844nWnhqVzCCa+w+WVhMndMC3qycZ 9eblLz+Of+KkTy8ULSTkor+AKr1ZDsrP3KjLHIOTfjTR8rgYgl4Kk8Kx1VHMcQ+RbZ1F jx5PrNSiD91DILFjl6LLjhVQ2fbx6rCTFSFnDL9l0abDIR0ZSzKGu4q8DgnVYoMRFstj kOhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/MAEIGkxboaQ7/sKH4/N7ZsnrjiQlrtgLB/5WpkDnOs=; b=YWiJ9Hq0DhPJ8o2ZScFkIarWIIpuznQdk+NRR52yFBot8RuVuyVNV+vp5gZqfJlD/l ReYiI8zRHR6eJE46gS2powpDD/K0BhKsAsRJD1UYlvchSPVe9puAuQNWtfXT7A+l1Gt1 YcvBKgFNQ6Izbp+DKuLx7Ke8jIpGaVixSu8wYjZVhPSN1m/5V36fWW7blBtOquOBf4ei FpOdCiQlT2pPHuJjdHRg1q8QNQBlpVJ5fF8PMuoNZx07Sn2B9lW38N8v+RvekT9QzJru B3c0bk3SBx3uOBtvLV+8aMheV0xVNV/2zxKESATX6s5QNwoC2QxNLdAXS3m0ngof89j0 +Pxg== X-Gm-Message-State: AOAM5308hOemiWF0buKbupYr7Xa/F1Y48HE4L0iC4PJtb06Fg2Ls+794 MyzknImanX2zl5wFFmyzLYt8UOfVLBekKQ== X-Google-Smtp-Source: ABdhPJwVZFu7N6AxjUoRuVJARUUu0uYDAN1pCizZ7U8j3dn1TyHYr09Eoz38qU/sLFm/GYqQVQkbJQ== X-Received: by 2002:a7b:cb91:: with SMTP id m17mr23836061wmi.159.1626564072785; Sat, 17 Jul 2021 16:21:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 09/10] linux-user: Drop unneeded includes from qemu.h Date: Sun, 18 Jul 2021 00:21:02 +0100 Message-Id: <20210717232103.18047-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564400422100001 Content-Type: text/plain; charset="utf-8" Trim down the #includes in qemu.h where we can, either by dropping unneeded headers or by moving them to user-internals.h. This includes deleting a couple of #includes that appear at weird points midway through the header file. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/qemu.h | 4 ---- linux-user/user-internals.h | 2 ++ thunk.c | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index fda90fc28d6..5c713fa8ab2 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -2,7 +2,6 @@ #define QEMU_H =20 #include "cpu.h" -#include "exec/exec-all.h" #include "exec/cpu_ldst.h" =20 #undef DEBUG_REMAP @@ -163,8 +162,6 @@ typedef struct TaskState { struct target_sigaltstack sigaltstack_used; } __attribute__((aligned(16))) TaskState; =20 -#include "qemu/log.h" - abi_long do_brk(abi_ulong new_brk); =20 /* user access */ @@ -349,5 +346,4 @@ void *lock_user_string(abi_ulong guest_addr); #define unlock_user_struct(host_ptr, guest_addr, copy) \ unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0) =20 -#include #endif /* QEMU_H */ diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h index 1729a8b62e1..661612a088b 100644 --- a/linux-user/user-internals.h +++ b/linux-user/user-internals.h @@ -20,6 +20,8 @@ =20 #include "hostdep.h" #include "exec/user/thunk.h" +#include "exec/exec-all.h" +#include "qemu/log.h" =20 extern char *exec_path; void init_task_state(TaskState *ts); diff --git a/thunk.c b/thunk.c index fc5be1a502e..dac4bf11c65 100644 --- a/thunk.c +++ b/thunk.c @@ -17,6 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/log.h" =20 #include "qemu.h" #include "exec/user/thunk.h" --=20 2.20.1 From nobody Sat May 11 09:57:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1626564436; cv=none; d=zohomail.com; s=zohoarc; b=beouklvhfKP98CsquttY4+1OyzAnmYRmtX30jMJb3vRJd7IUIJyPW2QZ9coYxuNtTKuPsWgYOvLGGzoeF/dOYEXNpTt/JnUBKMoS8ILXaP0x3pW+IsaB81cDw0v013zKHlDO/JXpgKt8gPTo9hwK4GLX4kZiHYen2uyQ/ewm31A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626564436; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=za/qVhXBTOOMGm/fSlxijFTtDoalddnYqbJh5v7Hspk=; b=UWmlWRXW4La56qVwYhikWE/f0aOKGJTbVdEP47Cg/V03IRGOGT5222zRCR3HxuP8tqL0cSrawvHLAjvD9qgGsYGEn0DV2AV5G0KFiDLNj3kt7lO74Ed3xJ2K5rYyeekdoZnp2XgVPOp5PTvh2G1EkAGmsJeuijgvGn0oAOKkGnU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626564436838322.9310971527989; Sat, 17 Jul 2021 16:27:16 -0700 (PDT) Received: from localhost ([::1]:46458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4tiF-0006t3-SR for importer@patchew.org; Sat, 17 Jul 2021 19:27:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4tcT-0001nk-A7 for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:18 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:38576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4tcR-0000lP-Vv for qemu-devel@nongnu.org; Sat, 17 Jul 2021 19:21:17 -0400 Received: by mail-wm1-x32c.google.com with SMTP id b14-20020a1c1b0e0000b02901fc3a62af78so10398550wmb.3 for ; Sat, 17 Jul 2021 16:21:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o15sm7082517wmh.40.2021.07.17.16.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 16:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=za/qVhXBTOOMGm/fSlxijFTtDoalddnYqbJh5v7Hspk=; b=Q42/H4TyUcJUNT0kaDMf7YVooSdRHqt4rXQWTihq3ACMul+OxFsdBmPp4zSqDJ9rip JBReggu7dWw1kNjq3vJEJWyYbx4fRD31MfcNLbMRPxHyCa1cyBCIsWqD9//75OUCyP7i M1LE/722B+uBHbXPvQi5OElM64rRiXduaSFgzLPam4xk+3O768Gs7VuRkqPrvYS+yYzH KkCZAHrXsCCdA8C53egYWaNo+qvcf5w74OYs8UU99XoY7wGBzt3rccDQk6JnGZIZ1Y/L ygqOfGwPc24mIp21SohDW595qC+AlRxvIa7autIjWaPChwGIqvRFB6/Clqt4tn1DDUyQ mTVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=za/qVhXBTOOMGm/fSlxijFTtDoalddnYqbJh5v7Hspk=; b=Fm73RE+vQHQPzj6y8GaSXP3zj/3yc5GGo6AqnG648cYKx57xPK/oJkgBYXOflY2kEc +6s34jiNcnmIo+TZgwlyCgXYpUTf4R4SdmXMQVMGK9YKSBhQNUzpNZYslOLk3OVUispE 8OwmtowTzqWO/9/68fpVzA/IG16rx+NXoIguq4wfUizOV3kJxQM5XDIoRi4qEjF8eZRt 8bwPvVmSMJQbuUT/4LGGp0GQnGYVobSv+GwGC4Se7moWiP12TPGB7peNbidFCy7I1UMW 8vEOkP1ekkwXEKkX6XkX6niZdnWzA268hxX8Ag8EARqf60UGaArgsEU/Da+iL3v5SjB3 V4vg== X-Gm-Message-State: AOAM533+LjnmblIqS9DHJ071sJ96wFFBRNLShd7MKypzyStb0+MJFIxc Vh0qndG55pIloZbS/VQ5zeJQAE+rXdhlEA== X-Google-Smtp-Source: ABdhPJx1vvw5PkaIzh6DsU1bfxE90gz/bYm3v5HDoFgWsxjklr2EAAZJnQKv+DYJlueqDlEDcC5NQg== X-Received: by 2002:a7b:cbd5:: with SMTP id n21mr24661176wmi.2.1626564073400; Sat, 17 Jul 2021 16:21:13 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 10/10] linux-user: Move DEBUG_REMAP undef to uaccess.c Date: Sun, 18 Jul 2021 00:21:03 +0100 Message-Id: <20210717232103.18047-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210717232103.18047-1-peter.maydell@linaro.org> References: <20210717232103.18047-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1626564437361100001 Content-Type: text/plain; charset="utf-8" Since commit 687ca797893ca1e853, the code that looks at the debug define DEBUG_REMAP is all in uaccess.c; move the #undef line to there from qemu.h (thus reducing significantly the amount of code that gets recompiled if you need to turn the debug on). Signed-off-by: Peter Maydell --- linux-user/qemu.h | 3 --- linux-user/uaccess.c | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 5c713fa8ab2..acc215b1a48 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -3,9 +3,6 @@ =20 #include "cpu.h" #include "exec/cpu_ldst.h" - -#undef DEBUG_REMAP - #include "exec/user/abitypes.h" =20 #include "syscall_defs.h" diff --git a/linux-user/uaccess.c b/linux-user/uaccess.c index 425cbf677f7..56fb4358d4f 100644 --- a/linux-user/uaccess.c +++ b/linux-user/uaccess.c @@ -5,6 +5,8 @@ #include "qemu.h" #include "user-internals.h" =20 +#undef DEBUG_REMAP + void *lock_user(int type, abi_ulong guest_addr, ssize_t len, bool copy) { void *host_addr; --=20 2.20.1