From patchwork Sun Jun 10 03:01:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138127 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2594786lji; Sat, 9 Jun 2018 20:40:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLQeR9BIb9xp8sKoyVhZNCXEgUV+oitEPTmSWYtxtvJ/NwlLhuCPZlrNfVBVDO3IwD1JJhN X-Received: by 2002:a0c:d5a6:: with SMTP id g35-v6mr10843763qvi.197.1528602048788; Sat, 09 Jun 2018 20:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528602048; cv=none; d=google.com; s=arc-20160816; b=ba6eK3V3qH3Xd82nxRIcmfb5raajiZhh70qHGLtqBZaNZxPAWTm2gGCte9w/4rIrO7 lXhx2urImBss0fXmVvF5b44rfXF5+INNG7aJ3tG3Tb7Ln4g6/akHuoJlJa9zwnVWcqL7 16BOfE0sRBFtE8/fcHJwIdBV7qCcLWOHy2+pJLEL0lSZeZ1wCBm88ZCHGlkB6kk//+Sg KRyiOgIn5lwuQUuVoOuu+fex76Dgs2PuOH0gDdTE/epqdiVB4X+p6xO8GQHO94gAbXO+ A083xhFWc4pqPh0W0da4EYns6tJi0llgGut3w4ZfBCR+O3Ijr+KypRDTDNtmAZTdM43v gZXw== 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:arc-authentication-results; bh=a6qGN8OS/+bW0TBXAGBHrcNC1tMVFe+4yj1F5DXUrHM=; b=mHOX5g/2rJ2xOEy0BXiOG5482en0e4C+kkYEF2txbTujIuzNR8KxIcItoOAmb47cDu F/ul+ebWJQsl5DL8+JTVF3fiWJPuSY5Ggqz0qn4BIpnGwhPXqdZc9eezpBuHkRKoDsM4 mSpv93Vy3diuzKpeiZP4z2SyRlP27nFhY8DZxLjepYjNkRUlaVXS6isKJOZUklg8CA6n 8vy69ujHpKg+DP7h5qbcyk6VCF2Ns2W9AvtPqbUqavVOoLJrTM5wp3124zADxIj0AmBG fmNM7qdz8N3C/wBCTYfE8KbEBYSBfhwyWdrGZ5SBpDFEha1JKmMrJpk2U66lp/P/VjIl JpwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SEcTNx88; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b185-v6si3917833qka.52.2018.06.09.20.40.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:40:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SEcTNx88; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:42383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrDk-0002DZ-8v for patch@linaro.org; Sat, 09 Jun 2018 23:40:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqeg-0003Kb-32 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqef-0003pF-2Y for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:34 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:42384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqee-0003ow-Tw for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:33 -0400 Received: by mail-pf0-x241.google.com with SMTP id w7-v6so8478858pfn.9 for ; Sat, 09 Jun 2018 20:04:32 -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=a6qGN8OS/+bW0TBXAGBHrcNC1tMVFe+4yj1F5DXUrHM=; b=SEcTNx886xSA0WemdmPmClKxyJpemMVkJeOpU5rGRPiciu+wHj7bJDeJFvcumty72B o3ACFqYnA1fz9b1kCb7f8Z9vHZWbloYgWVp4Im7L1tP/MdQpIOnLelcGzSiJO98JHvXb hdmzlGMl83ADuGDo/uT+Hpb5zvFkpSq5XV1IM= 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=a6qGN8OS/+bW0TBXAGBHrcNC1tMVFe+4yj1F5DXUrHM=; b=Ehaj7xp24xH01QnpaLBSm1hCTDhGJpV4pe2GYU9HFGk7d1+VNTZ5/tx1bssIVcxWPm GsDDx4c3CXdzJ5HhFeTf7DBHLLUsUSeHS6HjcpQUquBs1eU+UTbPQjIKGeyMnS7W9nh0 DCV4W3iNb01Dy443PBGDQfi0WwLR85YUWVH8uEmkNXUXAs1AE2aFKa7f+3cr6DHCvd1e JhJv5GCwH5luACv76ukf/j/TPIfFHJtkm7K2pPXDxohEjURkHTilF8OKp7ikkCNXCR49 El/pYPa8hrBijxFTucildrLQ5G8petzxvssBmm14giLcb19P/uPEghp13RPaUu5MPwuc q1/Q== X-Gm-Message-State: APt69E2JZZ+/A7wn8AtaTTqLKEYTBqlSJA/WMcA8rgpGp1Kw4yCNVZ/D JJ1f1BYJf+3b6RTmOe7WL7xRn+gcVfw= X-Received: by 2002:a63:721d:: with SMTP id n29-v6mr10169069pgc.194.1528599871722; Sat, 09 Jun 2018 20:04:31 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.04.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:04:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:30 -1000 Message-Id: <20180610030220.3777-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PATCH v2 058/108] linux-user: Split out adjtimex, clock_adjtime, vm86 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" All targets define clock_adjtime; remove the ifdef. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 85 +++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 36 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4967b84f21..7ff05dd33c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7669,6 +7669,23 @@ IMPL(acct) } } +IMPL(adjtimex) +{ + struct timex host_buf; + abi_long ret; + + if (target_to_host_timex(&host_buf, arg1) != 0) { + return -TARGET_EFAULT; + } + ret = get_errno(adjtimex(&host_buf)); + if (!is_error(ret)) { + if (host_to_target_timex(arg1, &host_buf) != 0) { + return -TARGET_EFAULT; + } + } + return ret; +} + #ifdef TARGET_NR_alarm IMPL(alarm) { @@ -7729,6 +7746,23 @@ IMPL(chroot) return ret; } +#ifdef CONFIG_CLOCK_ADJTIME +IMPL(clock_adjtime) +{ + struct timex htx; + abi_long ret; + + if (target_to_host_timex(&htx, arg2)) { + return -TARGET_EFAULT; + } + ret = get_errno(clock_adjtime(arg1, &htx)); + if (!is_error(ret) && host_to_target_timex(arg2, &htx)) { + return -TARGET_EFAULT; + } + return ret; +} +#endif + IMPL(clone) { /* Linux manages to have three different orderings for its @@ -10324,6 +10358,14 @@ IMPL(vhangup) return get_errno(vhangup()); } +#if defined(TARGET_I386) && !defined(TARGET_X86_64) +/* ??? Other TARGET_NR_vm86 should be deleted. */ +IMPL(vm86) +{ + return do_vm86(cpu_env, arg1, arg2); +} +#endif + IMPL(wait4) { int status; @@ -10420,42 +10462,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#if defined(TARGET_I386) && !defined(TARGET_X86_64) - case TARGET_NR_vm86: - return do_vm86(cpu_env, arg1, arg2); -#endif - case TARGET_NR_adjtimex: - { - struct timex host_buf; - - if (target_to_host_timex(&host_buf, arg1) != 0) { - return -TARGET_EFAULT; - } - ret = get_errno(adjtimex(&host_buf)); - if (!is_error(ret)) { - if (host_to_target_timex(arg1, &host_buf) != 0) { - return -TARGET_EFAULT; - } - } - } - return ret; -#if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME) - case TARGET_NR_clock_adjtime: - { - struct timex htx, *phtx = &htx; - - if (target_to_host_timex(phtx, arg2) != 0) { - return -TARGET_EFAULT; - } - ret = get_errno(clock_adjtime(arg1, phtx)); - if (!is_error(ret) && phtx) { - if (host_to_target_timex(arg2, phtx) != 0) { - return -TARGET_EFAULT; - } - } - } - return ret; -#endif case TARGET_NR_getpgid: return get_errno(getpgid(arg1)); case TARGET_NR_fchdir: @@ -12881,6 +12887,7 @@ static impl_fn *syscall_table(unsigned num) #endif SYSCALL(accept4); SYSCALL(acct); + SYSCALL(adjtimex); #ifdef TARGET_NR_alarm SYSCALL(alarm); #endif @@ -12888,6 +12895,9 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(bind); #endif SYSCALL(brk); +#ifdef CONFIG_CLOCK_ADJTIME + SYSCALL(clock_adjtime); +#endif SYSCALL(clone); SYSCALL(close); SYSCALL(chdir); @@ -13201,6 +13211,9 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(utimes); #endif SYSCALL(vhangup); +#if defined(TARGET_I386) && !defined(TARGET_X86_64) + SYSCALL(vm86); +#endif SYSCALL(wait4); SYSCALL(waitid); #ifdef TARGET_NR_waitpid