From patchwork Sun May 19 20:37:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164564 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4818106ili; Sun, 19 May 2019 14:36:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqz81pQOzY6001T6gH89Al03qui5TYz/T70ApQ3evpDDE/BlRp003eJaSZFfrvZ93A2sgo41 X-Received: by 2002:a17:906:31d4:: with SMTP id f20mr13732247ejf.275.1558301798129; Sun, 19 May 2019 14:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558301798; cv=none; d=google.com; s=arc-20160816; b=PkEynBlhmreRTayZa5TOPsdwzuaDoIfUqEsSD1sJTaVLxFF9+ey2qMJMBDOOO71gi6 fFv7QSx4s0Q+47Rv4DFNb70C1e64CnYduKwwbYqUpImZgrWBO6qnKUXezG5pWRogerH3 hpGjlqP0ldqT7yVCvuv48sKoZIXK/aY8PftArm73TzQxELIRFPWxXn9ZXyZK9muuNyY4 OiUkqZ3ukpNKB2Tja2F1JiDVMBZDWy+E8fsgoAPWtpY/1UjBOvzTJfHbXaaKt46I2lVU 9OeoKAWnNYqNexH368v0oInZ7bZWrwTse7PzLQdB+g6D/3iYPaV+42bSQ/o/LSvwEV8r WQjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=fHCmInnpNa2F4K91jX190NfL9NDB7tdazRZM5/cuyRM=; b=ZnWKPfaYQqKHSR+mJLTbL+aNQfW0diZOTGXLewglXR+Kpm50lrJJL2XwdQkNlgBao8 15Rs6DuZtwprnkpkpKhu2qTdNNoI2xKFfKJM3HijbdqdhSpR137MJhZKnCeAnv637UnW EFwUyKOcI6/RtbcQ2CdL+bVi0MuL/m98fUQQ0SS3UPy49rQ21IMj8HdPzJv+Fg8nXqzB pAmZ5K366NoOFlo45uI4dH3TZFl1R3vwhL8EQ0NmcVgKDVmM5r1fJ1IW3MH8BBP1Kt31 eHeIYxaD58K5d4d3QPOcYB5bU5wFjavPI3dvWvsEhpiQQBZ1yjUtEIL81SLKeeEtaZL7 7H7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sTKWJdqs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h11si10747260edb.126.2019.05.19.14.36.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:36:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sTKWJdqs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:54024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTTx-0003LE-3C for patch@linaro.org; Sun, 19 May 2019 17:36:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSaC-00049G-Ch for qemu-devel@nongnu.org; Sun, 19 May 2019 16:39:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSaB-00058F-Cm for qemu-devel@nongnu.org; Sun, 19 May 2019 16:39:00 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:38185) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSaB-00057F-6n for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:59 -0400 Received: by mail-pg1-x544.google.com with SMTP id j26so5741282pgl.5 for ; Sun, 19 May 2019 13:38:59 -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; bh=fHCmInnpNa2F4K91jX190NfL9NDB7tdazRZM5/cuyRM=; b=sTKWJdqst8ArJHRiRxt07TQwIJU6RCXBO228h/fitWQRQV+gAWRLw3XhJUQFXbt3OO EDh2ENMmYnXniUJJiSmTmPll/n5NHAa/GA+ZwCcsA/Ifhpx9W+f1AvCG9hz1NdUd+a1L e8GAFapdATIWLxV3+lUTI8X4WN2qs14xRnJ6TMxsbyd3UTQA3Xgb0nbHF8nIRhisImh8 kUZNpS2NOoctyHTVHXuSGff1miHNnutSWM/8yHMOdUdp7/nLJWNh2o3NtyJV7CppKxNL VaaBMCwSwAKiQvSXUkIw5gMtxYqRhTIxXLtFpHVd01+nbxWxYtWvUBspZwzGIB3olzKa oebw== 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; bh=fHCmInnpNa2F4K91jX190NfL9NDB7tdazRZM5/cuyRM=; b=Kzj+cFPwwQpSoYfOpkveRmQiI3wY74CqcZWen0edC8JOnKqastfGT4o9Gq3qqw6MrF Y6IsEFDHq8G/WYkL3xNqa9vevOMNn+O2VHq726llD5HzjvITD+XKkVTlYQwkIhGO0Tt4 m8lw2j3OXcGHUtATJnbD/FoywHeivUQAKh7DnWBIo87VNvYbs617yqJqN9WilA0R0jRP BSmjhZvaO6xsoNOl2xyX7ll8e7dSkCnVjI5TnJ4O7md6L4/jTE2YVuzDEx+3pyYfvtqE cKMsAZiOs6HzfoXebKu9fQg7IMaFA7NVFsHiXKUF2kdm7j/3OKwbqtkdtQ2szStIlWRq 3Rrg== X-Gm-Message-State: APjAAAUHJFmcJ77GaHV6PqXhvjeZWRCuAo3pMQrJNtAYAXB0NwJ4uIDe QZmL0iWiEYDhkAc8AgH09P51LOX6bmQ= X-Received: by 2002:a65:52c3:: with SMTP id z3mr18674927pgp.56.1558298338013; Sun, 19 May 2019 13:38:58 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:37:24 -0700 Message-Id: <20190519203726.20729-73-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v7 72/74] linux-user: Split out reboot X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 18 ++++++++++++++++++ linux-user/syscall.c | 13 ------------- linux-user/strace.list | 3 --- 4 files changed, 19 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 34e799d206..67c908448d 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -188,6 +188,7 @@ SYSCALL_DEF(readlink, ARG_STR, ARG_PTR, ARG_DEC); #ifdef TARGET_NR_readlinkat SYSCALL_DEF(readlinkat, ARG_ATDIRFD, ARG_STR, ARG_PTR, ARG_DEC); #endif +SYSCALL_DEF(reboot, ARG_HEX, ARG_HEX, ARG_DEC, ARG_PTR); #ifdef TARGET_NR_rename SYSCALL_DEF(rename, ARG_STR, ARG_STR); #endif diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c index bf9e278bf0..408e96a834 100644 --- a/linux-user/syscall-proc.inc.c +++ b/linux-user/syscall-proc.inc.c @@ -532,6 +532,24 @@ SYSCALL_IMPL(nice) } #endif +SYSCALL_IMPL(reboot) +{ + abi_long ret; + + if (arg3 == LINUX_REBOOT_CMD_RESTART2) { + /* arg4 must be ignored in all other cases */ + char *p = lock_user_string(arg4); + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(reboot(arg1, arg2, arg3, p)); + unlock_user(p, arg4, 0); + } else { + ret = get_errno(reboot(arg1, arg2, arg3, NULL)); + } + return ret; +} + SYSCALL_IMPL(sethostname) { void *p = lock_user_string(arg1); diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ead2e5c2b8..80e8b360a9 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4158,19 +4158,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_reboot: - if (arg3 == LINUX_REBOOT_CMD_RESTART2) { - /* arg4 must be ignored in all other cases */ - p = lock_user_string(arg4); - if (!p) { - return -TARGET_EFAULT; - } - ret = get_errno(reboot(arg1, arg2, arg3, p)); - unlock_user(p, arg4, 0); - } else { - ret = get_errno(reboot(arg1, arg2, arg3, NULL)); - } - return ret; #ifdef TARGET_NR_truncate case TARGET_NR_truncate: if (!(p = lock_user_string(arg1))) diff --git a/linux-user/strace.list b/linux-user/strace.list index 3d2e398439..3326541f17 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -866,9 +866,6 @@ #ifdef TARGET_NR_readdir { TARGET_NR_readdir, "readdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_reboot -{ TARGET_NR_reboot, "reboot" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_recv { TARGET_NR_recv, "recv" , NULL, NULL, NULL }, #endif