From patchwork Sat Apr 22 16:19:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajeet Singh X-Patchwork-Id: 13221066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB1D8C7618E for ; Sat, 22 Apr 2023 17:29:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqH2b-0006vz-DC; Sat, 22 Apr 2023 13:28:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqFy0-00023j-8S for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:04 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqFxw-0007G4-2y for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:02 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b57c49c4cso2759502b3a.3 for ; Sat, 22 Apr 2023 09:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682180388; x=1684772388; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=y0/W3cxH1hrq6ZsVgVTx66VqcjfJ692sb4HPppqAWsg=; b=Chf45JII1eCv+etCJRyWGorpM5JgxMxcmsyx/v+cJsc9UWryVYC0LcAyV3cm/YE+nq CGjoEgwzYoCVzpbwDgbugSc+16Xku5vBRd60bXDPpybHAzrAXpiUaACfHgmfkkG8/vx8 hCBA3ddmyABUh9aTOo6+7NHu7paWt0fGodp50413oWlm61v5kU2xuWxK2zgn5xV0XXVT e6hTteGQp5z75PbSSrnt0/okBEGEsfeukTkGJ4oVs1YS7FzEksKfoMPlaHL4025sVY5Q 5lpVPv6YayWfqDJI4kq/kynsgrKm5RTsCgZKG1gAZbtxQSxSpZDGp/mxKonEfVqhRG0a lDkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682180388; x=1684772388; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=y0/W3cxH1hrq6ZsVgVTx66VqcjfJ692sb4HPppqAWsg=; b=Am0utiVMSkoqoIeSNEwy0rJf/+5YQ0SsDU76U1QhW9MJzr8ahOP8+c1A3qVijq4faQ WUeqALolrw1oYQdhDgftLT57dVY0MbHft6/jQdAifNSxFfzjvs43XCC+PxLwIZevix1h K5uO0EnhRB2loNxUK7Y8kf2UjurBbuKkEb4586YJpi9aCNYSfeFhAGGXuIzius97kb9l c3CxJ4KdkbpEW+kfTEdDr2OfYsUjYndQAIo+6sFt3a4bcv8ZtkxGh0pSA24H90ZpS9IG ZG68HvEPM2iA9ypkyo7LmUPiQnJeqR8NmirO73T6hY0BWdJw1pCZDmUUX/FsNZPx25Ed vPVw== X-Gm-Message-State: AAQBX9dyC909UmdH6ghfr5ws6MkOUlgBt62SM145LFy7fQNGK4MF60bl u6uXCf++dA3v9fg3DNlo3RU= X-Google-Smtp-Source: AKy350YwCSTLDUFR0a6clj/8/5bNkdKPDXZJS1FVwwvMxAFAHJEYd9gZtRAv+hh822vKwwDBZFPWpg== X-Received: by 2002:a05:6a00:c88:b0:638:7e00:3737 with SMTP id a8-20020a056a000c8800b006387e003737mr12492487pfv.23.1682180388522; Sat, 22 Apr 2023 09:19:48 -0700 (PDT) Received: from apple.localdomain ([182.65.27.4]) by smtp.gmail.com with ESMTPSA id i14-20020a655b8e000000b0051f14839bf3sm4241667pgr.34.2023.04.22.09.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 09:19:48 -0700 (PDT) From: Ajeets6 To: itachis6234@gmail.com, qemu-devel@nongnu.org Cc: imp@bsdimp.com, Stacey Son Subject: [PATCH 1/7] Create os-time.c and add t2h_freebsd_timeval Date: Sat, 22 Apr 2023 21:49:28 +0530 Message-Id: <20230422161934.2311-1-itachis6234@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 22 Apr 2023 13:28:49 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stacey Son os-time.c contains various functions to convert FreeBSD-specific time structure between host and guest formats Signed-off-by: Ajeets6 Signed-off-by: Stacey Son --- bsd-user/freebsd/os-time.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 bsd-user/freebsd/os-time.c diff --git a/bsd-user/freebsd/os-time.c b/bsd-user/freebsd/os-time.c new file mode 100644 index 0000000000..ec9f59ded7 --- /dev/null +++ b/bsd-user/freebsd/os-time.c @@ -0,0 +1,41 @@ +/* + * FreeBSD time related system call helpers + * + * Copyright (c) 2013-15 Stacey D. Son + * + * 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 . + */ + +/* + * FreeBSD time conversion functions + */ +#include +#include +#include +#include "qemu.h" + + +abi_long t2h_freebsd_timeval(struct timeval *tv, abi_ulong target_tv_addr) +{ + struct target_freebsd_timeval *target_tv; + + if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 0)) { + return -TARGET_EFAULT; + } + __get_user(tv->tv_sec, &target_tv->tv_sec); + __get_user(tv->tv_usec, &target_tv->tv_usec); + unlock_user_struct(target_tv, target_tv_addr, 1); + + return 0; +} \ No newline at end of file From patchwork Sat Apr 22 16:19:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajeet Singh X-Patchwork-Id: 13221070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B777AC6FD18 for ; Sat, 22 Apr 2023 17:29:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqH2Y-0006uK-7k; Sat, 22 Apr 2023 13:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqFy0-00023h-7i for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:04 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqFxw-0007HR-2x for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:02 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-63b5ce4f069so4061906b3a.1 for ; Sat, 22 Apr 2023 09:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682180390; x=1684772390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gQ7nCVVeSs6mi7VEnq3MPlZQcrsUsxYhe+Yoh3gzbp8=; b=gXSsM0Ghss1wzuQHZ2z6SOjzBJDbWzqYOEzBqgZVuHggsHcX0eqD5pIMwmTHH63ZCU OtZz50zcsAn9cDrZlwpuyiv177kW0OJ4WdOBJtYeObrxa1p/eQ9VPbB1BDiRwbeNtBjH Ho15mi5lbA+T9Xp/4JZ0Tb1ExssdHBYMglID9b8j+Tc/xmrBrYtupfcozSQ0in4sUHhs m39P3GLyBUfiwgGSvcaH/5w1nWyPk6tSMp5Ej5hJcg+t7UxuB4D1qtpdF4LMlhGDBDVE jQhCrKDXIs/AYs5J2ZIKUVGQ7X6o6Lj8NZNm8VlF7VIhRDob4jyPszlkuZo0EfoXq+gy Oy0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682180390; x=1684772390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gQ7nCVVeSs6mi7VEnq3MPlZQcrsUsxYhe+Yoh3gzbp8=; b=LWhtmV8YOxIhNqYeMHqlIOLD/lu+zXkRkTVMmZdsTiR/OFNfxsQ0Upp5GWxX2QCOFt Jvvrt/aLAODsMjtERIJJwYV9GhxDLjg4geBkaDPtZz5SU9Z16DBtcRMOWxUZiNe3VaCA jhyvWmUykN7FlI9z9T51IhsEPOTHCPcbCzuIOj+KIEenkjlseMWlzVoL/oBHZ7jSBpko 9s0/8Qhs0qoPdX4EJnMkEs5fhv9A3ZvKmqpxyt+LQAI0NZ/FOppY+47E8n1z1cBh8o28 e+zS6t+fMp5C15dZDi8aipd6QvV9X3Ypm2Qa51F/KvuXa+B0MBRYfExexWj+PvU0p0RD tvBw== X-Gm-Message-State: AAQBX9fPgojX0/GG8AXa6JCD4qmYK8htwrlHSa4byS7Mlr6MYVd++xOx K4DN1syHU5T1V797+QJPFfg= X-Google-Smtp-Source: AKy350bAhiTd0meE6bVyIEsMYJH1R+0nSKUlAOAGzHp8YH5Z3/2hfVwqC/GjtnKb+S6crOacYBs/sQ== X-Received: by 2002:a05:6a20:748f:b0:d9:27f7:8c4a with SMTP id p15-20020a056a20748f00b000d927f78c4amr11386774pzd.0.1682180390618; Sat, 22 Apr 2023 09:19:50 -0700 (PDT) Received: from apple.localdomain ([182.65.27.4]) by smtp.gmail.com with ESMTPSA id i14-20020a655b8e000000b0051f14839bf3sm4241667pgr.34.2023.04.22.09.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 09:19:50 -0700 (PDT) From: Ajeets6 To: itachis6234@gmail.com, qemu-devel@nongnu.org Cc: imp@bsdimp.com, Stacey Son , Kyle Evans Subject: [PATCH 2/7] Create os-time.h and modify os-time.c Date: Sat, 22 Apr 2023 21:49:29 +0530 Message-Id: <20230422161934.2311-2-itachis6234@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230422161934.2311-1-itachis6234@gmail.com> References: <20230422161934.2311-1-itachis6234@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 22 Apr 2023 13:28:49 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stacey Son +add nanosleep(2) in os-time.h +add t2h_freebsd_timeval and h2t_freebsd_timeval time conversion functions -remove t2h_freebsd_timeval in os-time.c Co-Authored-By: Kyle Evans Signed-off-by: Ajeets6 Signed-off-by: Kyle Evans Signed-off-by: Stacey Son --- bsd-user/freebsd/os-time.c | 29 ++++++++++++++++++------- bsd-user/freebsd/os-time.h | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 bsd-user/freebsd/os-time.h diff --git a/bsd-user/freebsd/os-time.c b/bsd-user/freebsd/os-time.c index ec9f59ded7..e71eed6519 100644 --- a/bsd-user/freebsd/os-time.c +++ b/bsd-user/freebsd/os-time.c @@ -20,22 +20,35 @@ /* * FreeBSD time conversion functions */ -#include +#include "qemu/osdep.h" #include -#include #include "qemu.h" -abi_long t2h_freebsd_timeval(struct timeval *tv, abi_ulong target_tv_addr) +abi_long t2h_freebsd_timespec(struct timespec *ts, abi_ulong target_ts_addr) { - struct target_freebsd_timeval *target_tv; + struct target_freebsd_timespec *target_ts; - if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 0)) { + if (!lock_user_struct(VERIFY_READ, target_ts, target_ts_addr, 0)) { return -TARGET_EFAULT; } - __get_user(tv->tv_sec, &target_tv->tv_sec); - __get_user(tv->tv_usec, &target_tv->tv_usec); - unlock_user_struct(target_tv, target_tv_addr, 1); + __get_user(ts->tv_sec, &target_ts->tv_sec); + __get_user(ts->tv_nsec, &target_ts->tv_nsec); + unlock_user_struct(target_ts, target_ts_addr, 1); + + return 0; +} + +abi_long h2t_freebsd_timespec(abi_ulong target_ts_addr, struct timespec *ts) +{ + struct target_freebsd_timespec *target_ts; + + if (!lock_user_struct(VERIFY_WRITE, target_ts, target_ts_addr, 0)) { + return -TARGET_EFAULT; + } + __put_user(ts->tv_sec, &target_ts->tv_sec); + __put_user(ts->tv_nsec, &target_ts->tv_nsec); + unlock_user_struct(target_ts, target_ts_addr, 1); return 0; } \ No newline at end of file diff --git a/bsd-user/freebsd/os-time.h b/bsd-user/freebsd/os-time.h new file mode 100644 index 0000000000..18c9e1dd12 --- /dev/null +++ b/bsd-user/freebsd/os-time.h @@ -0,0 +1,44 @@ +/* + * FreeBSD time related system call shims + * + * Copyright (c) 2013-2015 Stacey Son + * + * 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 FREEBSD_OS_TIME_H +#define FREEBSD_OS_TIME_H + + +#include "qemu.h" + + + + +/* nanosleep(2) */ +static inline abi_long do_freebsd_nanosleep(abi_long arg1, abi_long arg2) +{ + abi_long ret; + struct timespec req, rem; + + ret = t2h_freebsd_timespec(&req, arg1); + if (!is_error(ret)) { + ret = get_errno(safe_nanosleep(&req, &rem)); + if (ret == -TARGET_EINTR && arg2) { + h2t_freebsd_timespec(arg2, &rem); + } + } + + return ret; +} From patchwork Sat Apr 22 16:19:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajeet Singh X-Patchwork-Id: 13221065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA119C77B76 for ; Sat, 22 Apr 2023 17:29:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqH2a-0006vU-RE; Sat, 22 Apr 2023 13:28:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqFxy-00023I-8V for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:02 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqFxw-0007HV-2w for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:01 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2472a3bfd23so2145610a91.3 for ; Sat, 22 Apr 2023 09:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682180392; x=1684772392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xJuOJ6VH++PAQzzFCf+AgyYeqIW4I0RKMTPwWjaO9sw=; b=KoFXuEt2E4lVmaeLv4i75Rp5EoCsGHfmjw1vDeYfRfmlxS5UvfFvOKJgAf7T9sbjcK rQoMU+xrOamTUSnvhmEadqf68uQNFMMCPNICTMgmuvMxYxTTUrsddBkbyLu24cMa4Vev 6xrCXX+HqE+OrpXm1KTBBBMlDWCgaDPZwnpTfPDo3AZ7YHkxpZ38FBVL44ZFN/e15Nwf FRZFyD/O2ebM0COYFLBGfcWk5y+vtfsXJXDGavTjnoKJwVabrY60E6ppdLOKVfFdjywB UkDQsGHtwOqDoMyC9BigcD17qqFOWPEHFrOc5B3hiXdA6A4rOJPRR9GelUyAc6G+6Nce dQ9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682180392; x=1684772392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xJuOJ6VH++PAQzzFCf+AgyYeqIW4I0RKMTPwWjaO9sw=; b=J0el8Y2rohWPKZj1J5tr8U2imL6+I3h2nKLlPUqWNLMbEHe6lDqWlLmMC0rRAKgDe3 35P91+W0hHK1Sc3p8BIm2Nrge+4rkXtYpToI2VpejLF6yXFeidWqk7ukGyNDbEzmXRGD lt5gzrlsXrxzj6HYzoRcSW1ENZvsqwxpaz0fcqf9u++YScLNrJeMw2JZEijgQGFyLJG0 BByStmDu7Xc4//UpTd6F4TbvBbKHVfJFIVNMslxZi29SeVT5CBHBe5tYOHFFXF/c+60F 2A2u1VSkFoDCYp4l4CUajpHH2XhanwRCeeOp6DJ5IdImhwJm+NG+F/HU8dyYiInBWCta W+fg== X-Gm-Message-State: AAQBX9dBO0w6dI8Qt/43LND5YFcTEtBcm+n4iOv3DTcck34pPCUP8eon 3x7mBa69YGoj83DhBsDMfrNYrHRrkNZKgAAd X-Google-Smtp-Source: AKy350Yd1h2Js4mcnWJiOEzt1y74grWRQnFhvbakEJQoRfngRQFZ6cbJ2YkdHfzXTd1hznjkjdBmLg== X-Received: by 2002:a17:90a:72c5:b0:23f:e4b7:afb3 with SMTP id l5-20020a17090a72c500b0023fe4b7afb3mr8835388pjk.9.1682180392471; Sat, 22 Apr 2023 09:19:52 -0700 (PDT) Received: from apple.localdomain ([182.65.27.4]) by smtp.gmail.com with ESMTPSA id i14-20020a655b8e000000b0051f14839bf3sm4241667pgr.34.2023.04.22.09.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 09:19:52 -0700 (PDT) From: Ajeets6 To: itachis6234@gmail.com, qemu-devel@nongnu.org Cc: imp@bsdimp.com, Kyle Evans Subject: [PATCH 3/7] Add clock_nanosleep Date: Sat, 22 Apr 2023 21:49:30 +0530 Message-Id: <20230422161934.2311-3-itachis6234@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230422161934.2311-1-itachis6234@gmail.com> References: <20230422161934.2311-1-itachis6234@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=itachis6234@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 22 Apr 2023 13:28:49 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Kyle Evans +Add clock_nanosleep(2) Provide sleep interval in nanoseconds and allows to choose which clock to measure it against. Signed-off-by: Ajeets6 Signed-off-by: Kyle Evans --- bsd-user/freebsd/os-time.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bsd-user/freebsd/os-time.h b/bsd-user/freebsd/os-time.h index 18c9e1dd12..29d2c8d02a 100644 --- a/bsd-user/freebsd/os-time.h +++ b/bsd-user/freebsd/os-time.h @@ -42,3 +42,24 @@ static inline abi_long do_freebsd_nanosleep(abi_long arg1, abi_long arg2) return ret; } +/* clock_nanosleep(2) */ +static inline abi_long do_freebsd_clock_nanosleep(abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4) +{ + struct timespec req, rem; + abi_long ret; + int clkid, flags; + + clkid = arg1; + /* XXX Translate? */ + flags = arg2; + ret = t2h_freebsd_timespec(&req, arg3); + if (!is_error(ret)) { + ret = get_errno(safe_clock_nanosleep(clkid, flags, &req, &rem)); + if (ret == -TARGET_EINTR && arg4) { + h2t_freebsd_timespec(arg4, &rem); + } + } + + return ret; +} From patchwork Sat Apr 22 16:19:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajeet Singh X-Patchwork-Id: 13221067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C858C6FD18 for ; Sat, 22 Apr 2023 17:29:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqH2Y-0006uP-FM; Sat, 22 Apr 2023 13:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqFy0-00023i-7q for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:04 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqFxw-0007Hc-2v for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:02 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-24b3451b2fcso2252257a91.3 for ; Sat, 22 Apr 2023 09:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682180394; x=1684772394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mDPdeLBQukeDnq85V7V0rxAb4+em9pAzyCAxjlswg6M=; b=W4+CVHtgIkZrbMr2uR8aJG98bLQSgD9i/qEU0V/DUvfyXKpy1eP3d2BPn/EyOFEU40 6TqE27c+pp3LSDSA69CND2AW2ksNGoawUucbe9uXIJJdQJYDwerngrp/U56rJJv362mw /yOmXt+3Oh8ROAybUZB+qVtw+hTYZGvT+N6H/9y1FQAO+H94/bGDdAxsiKbHeRPzklEM whiSFcjgO+38UpdIcBFG3nLZpseXsKnKhlqYVbPA+JeBlxyRUMUCzATde65xDN9wjv4p krAcnTD+THmJAvSvsoK06N6Dps2EMcLQYBkV4AGHNbveoGr1Xcm2hY3CfftKi9np5lwl W4Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682180394; x=1684772394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mDPdeLBQukeDnq85V7V0rxAb4+em9pAzyCAxjlswg6M=; b=Wo6gwNckugodduZEPiamD2iRPHpqHyvovLVl8w0dB9cnxn8ycAGY6AcGqQt1S5g7or Di8lrENxFxBdL4Y4SCOCR84PC1IHSVEgOfitEbBtt4XiaOGmfR/ZJ35Qu6BRe1HCBQdz TYaVb4ijuWvRtnoXmDTL42A/HrcRazleKLjxW5T4LFNjHYTCTVlD2ClWWBK0qQOB0x9e iTMgG98l9JO9ak8SYUgg/VZivXlSt5sWp5TFSFwpQWUz4l0Rxw30gFPRvq+Wnj8SiYOQ XAHabYm/tPfMttolZR1e6ow+wx2o8zRJiugm9zftD8kxYtqHNfOfM72llJg+SUhkCXnu lDjQ== X-Gm-Message-State: AAQBX9c7Vza5D08OUSJaGR3ex9a9sxTlRog0Rdefl8NUkk7vEU9Z4Ozm ECqtuMu8Ko/ztd7N9U09wEA= X-Google-Smtp-Source: AKy350bU4XOvC0UPvrAZcTESjwlcm7BJLs9vT9imAyjX4BA05stUtjpV6ZENnB6+TI9g2JKLa15mjA== X-Received: by 2002:a17:90a:e556:b0:247:4ad1:f69b with SMTP id ei22-20020a17090ae55600b002474ad1f69bmr8531894pjb.26.1682180394424; Sat, 22 Apr 2023 09:19:54 -0700 (PDT) Received: from apple.localdomain ([182.65.27.4]) by smtp.gmail.com with ESMTPSA id i14-20020a655b8e000000b0051f14839bf3sm4241667pgr.34.2023.04.22.09.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 09:19:54 -0700 (PDT) From: Ajeets6 To: itachis6234@gmail.com, qemu-devel@nongnu.org Cc: imp@bsdimp.com, Stacey Son Subject: [PATCH 4/7] Added clock_gettime(2) and clock_getres(2) Date: Sat, 22 Apr 2023 21:49:31 +0530 Message-Id: <20230422161934.2311-4-itachis6234@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230422161934.2311-1-itachis6234@gmail.com> References: <20230422161934.2311-1-itachis6234@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=itachis6234@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 22 Apr 2023 13:28:49 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stacey Son +Added clock_gettime(2) which gets the time +Added clock_getres(2) which finds the resoultion of the specidfied clock Signed-off-by: Ajeets6 Signed-off-by: Stacey Son --- bsd-user/freebsd/os-time.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/bsd-user/freebsd/os-time.h b/bsd-user/freebsd/os-time.h index 29d2c8d02a..f76744e808 100644 --- a/bsd-user/freebsd/os-time.h +++ b/bsd-user/freebsd/os-time.h @@ -63,3 +63,35 @@ static inline abi_long do_freebsd_clock_nanosleep(abi_long arg1, abi_long arg2, return ret; } + +/* clock_gettime(2) */ +static inline abi_long do_freebsd_clock_gettime(abi_long arg1, abi_long arg2) +{ + abi_long ret; + struct timespec ts; + + ret = get_errno(clock_gettime(arg1, &ts)); + if (!is_error(ret)) { + if (h2t_freebsd_timespec(arg2, &ts)) { + return -TARGET_EFAULT; + } + } + + return ret; +} + +/* clock_getres(2) */ +static inline abi_long do_freebsd_clock_getres(abi_long arg1, abi_long arg2) +{ + abi_long ret; + struct timespec ts; + + ret = get_errno(clock_getres(arg1, &ts)); + if (!is_error(ret)) { + if (h2t_freebsd_timespec(arg2, &ts)) { + return -TARGET_EFAULT; + } + } + + return ret; +} \ No newline at end of file From patchwork Sat Apr 22 16:19:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajeet Singh X-Patchwork-Id: 13221068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B549FC6FD18 for ; Sat, 22 Apr 2023 17:29:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqH2X-0006tO-Lg; Sat, 22 Apr 2023 13:28:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqFy0-00023k-8D for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:04 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqFxw-0007Hh-2w for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:02 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-63b5c4c769aso4346833b3a.3 for ; Sat, 22 Apr 2023 09:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682180396; x=1684772396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2YrUREgFu0MlYo7oSaAiYG4SU5g6cj18IVt3rdxu9ZI=; b=n21jdN5jMJY2x8OizhyArjqZ/dAnb9WPQNVJbKbzFWNMqPr/HV257leLMqAm20ZMvt yo1dKhuvU85z6inTEI1P5XPWjm/rm4FuBuIYZpwDQ442GApBD7tDU+83/0zrg1qLFwBL uBTLaELZ2SB9OhuE3aumRhx/uht6RYb+fc4MXekG+pdH/6m78m+rmqK9cSjx/eD8KDX8 sSqb8e3wqfon2CrpwJd1MRAKXGJJnd2TdSVc5ctbX43Lp7xVC7ztY2WlKMcpa8EF4I4a +y65Kp3WHr5T6ToaF0I+7IU0ZMPf1ifhUPyTH5gpt9F8iQ8lNQzboRkl8IqaSbF2zmWH 1+JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682180396; x=1684772396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2YrUREgFu0MlYo7oSaAiYG4SU5g6cj18IVt3rdxu9ZI=; b=aE1ousPCfnGozknTvo6LxG3xckoZwL99sbNlVCe++uh9XEbFNUTw1MQW6Dh++ej6Rg nc2NrV8QDyLklClBpfGib/aBAwTzr+MD0XU2zLUuMpNsiC8gpufiwaJeOSU/QNv9raV1 cKa2C88QN8TkgwPO7RA0tLejZ8Ig9hXWs5gXKX0EIwAbZmXEeYI3XaaQncMQ4qguiPqZ xUU76+dU7vz2pqyVAHHd/fkUoJPXWwJGHPkF5MmXA/6Rhnc4Sy4LDrr4X+BFOVIUJNF9 vqTgCLrYqrUpbQXjF1HwATaeJFfLJKdM1pstPvgQldoiOW6h1qjPA8vhm951hlujxf0w AAUA== X-Gm-Message-State: AAQBX9eDQWHQXLFaDDOQ9koDAw9kW5WW8lGxCHc52BBz9DaovmgW/OnT PY+RvhxFrhu2L2ZPrdIqGJE= X-Google-Smtp-Source: AKy350aQe485Vjpiddo4sj7DDpNdtgeY4J217ZBhnnhlFOI+2AU+lMjoTVUXWVk64Bp9D5SIiS+W4g== X-Received: by 2002:a05:6a20:c88d:b0:ee:777b:782b with SMTP id hb13-20020a056a20c88d00b000ee777b782bmr9731514pzb.9.1682180396244; Sat, 22 Apr 2023 09:19:56 -0700 (PDT) Received: from apple.localdomain ([182.65.27.4]) by smtp.gmail.com with ESMTPSA id i14-20020a655b8e000000b0051f14839bf3sm4241667pgr.34.2023.04.22.09.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 09:19:56 -0700 (PDT) From: Ajeets6 To: itachis6234@gmail.com, qemu-devel@nongnu.org Cc: imp@bsdimp.com, Stacey Son Subject: [PATCH 5/7] Created qemu-os.h for function prototype Date: Sat, 22 Apr 2023 21:49:32 +0530 Message-Id: <20230422161934.2311-5-itachis6234@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230422161934.2311-1-itachis6234@gmail.com> References: <20230422161934.2311-1-itachis6234@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 22 Apr 2023 13:28:49 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stacey Son +Added t2h_freebsd_timespec and h2t_freebsd_timespec function protype in qemu-is.h +included qemu-os.h in os-time.c and os-time.h Signed-off-by: Stacey Son Signed-off-by: Ajeets6 --- bsd-user/freebsd/os-time.c | 2 ++ bsd-user/freebsd/os-time.h | 5 ++++- bsd-user/freebsd/qemu-os.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 bsd-user/freebsd/qemu-os.h diff --git a/bsd-user/freebsd/os-time.c b/bsd-user/freebsd/os-time.c index e71eed6519..5c88e1f13d 100644 --- a/bsd-user/freebsd/os-time.c +++ b/bsd-user/freebsd/os-time.c @@ -23,6 +23,8 @@ #include "qemu/osdep.h" #include #include "qemu.h" +#include "qemu-os.h" + abi_long t2h_freebsd_timespec(struct timespec *ts, abi_ulong target_ts_addr) diff --git a/bsd-user/freebsd/os-time.h b/bsd-user/freebsd/os-time.h index f76744e808..bd995c8a7b 100644 --- a/bsd-user/freebsd/os-time.h +++ b/bsd-user/freebsd/os-time.h @@ -22,6 +22,7 @@ #include "qemu.h" +#include "qemu-os.h" @@ -94,4 +95,6 @@ static inline abi_long do_freebsd_clock_getres(abi_long arg1, abi_long arg2) } return ret; -} \ No newline at end of file +} + +#endif /* FREEBSD_OS_TIME_H */ diff --git a/bsd-user/freebsd/qemu-os.h b/bsd-user/freebsd/qemu-os.h new file mode 100644 index 0000000000..0c502ff0e5 --- /dev/null +++ b/bsd-user/freebsd/qemu-os.h @@ -0,0 +1,30 @@ +/* + * FreeBSD conversion extern declarations + * + * Copyright (c) 2013 Stacey D. Son + * + * 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 QEMU_OS_H +#define QEMU_OS_H + +#include + +/* os-time.c */ +abi_long t2h_freebsd_timespec(struct timespec *ts, abi_ulong target_ts_addr); +abi_long h2t_freebsd_timespec(abi_ulong target_ts_addr, struct timespec *ts); + + +#endif /* QEMU_OS_H */ \ No newline at end of file From patchwork Sat Apr 22 16:19:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajeet Singh X-Patchwork-Id: 13221071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7CE22C6FD18 for ; Sat, 22 Apr 2023 17:30:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqH2Y-0006up-OE; Sat, 22 Apr 2023 13:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqFy0-00023g-7D for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:04 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqFxw-0007Hp-2z for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:02 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-63b5fca48bcso2776813b3a.0 for ; Sat, 22 Apr 2023 09:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682180398; x=1684772398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ITt+UCVgKvfDuYsMDU+9rWKh+df6bOSVt/sSZdvwKnQ=; b=ldSUBa+GGyCTtCzQhjDubeu5oKVy9W05hH422irCQ+N6tSw12n1MIJ6xW19OdDQIkl QpRnRqYgcwlJnm2M1Q8SadqNBJe1l9vLUNXAsgpUEN/DVECg4AHo+nGKIAubxUdgfOg3 i1tuyweG9hAtZsMbaScmRHnEnDMtB1IhqTTWhrVdFHC0WO+4appJkzNFx+bYecxGj28E /DyXhynY0peeCJpU89wEt5Os8FrUlz6XUwsV4RIuEWDw2Ihk4FXQlwJEmzjmPHD5weOm nxrqkpHGQocU2qIZjpnfLacngo8r61qcF7wZ14mUzerI7EbYJEB6JKieWpwOsXVvMHZn UgWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682180398; x=1684772398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ITt+UCVgKvfDuYsMDU+9rWKh+df6bOSVt/sSZdvwKnQ=; b=QDFez6+BXs94NDS1QZ3+oJGVYkL0Q8PbfSldKrvCrYAQZPW0LC9t+wlYVVF9dB8vmo lWQRrnuJwmCBryar3LpTxeDp6UzIqwXQ6zutgOWcJWYWhNdhDvQnj8XoJgwS04SVUPO/ e0FEmuDeqUt/QzF1QuqE3NoxgL7TN2CAaLz4y6VxEj5qgMe9UWaWNuTQwbaOWCSmuA9V +l/jC8cXajN1KonbxGQdrmiB2QWDPRL60QXoc8nJV/Sax7+nw52MBGgqC8mjLdxBrcVb Gu2g0r3OLX6vraM2xokP+UiRD6+eGlVIGs3Hn2ay9s+TqhPXTZY6LhI4Iup4J1aTwmh1 nG9g== X-Gm-Message-State: AAQBX9e4f+eIOpi6BMmU5JttpTNK6uMyKq//b2drZOr8H4XCEeWZUV/2 jKixZUvpz0g8+s3n9N0kbnE= X-Google-Smtp-Source: AKy350axvmWzGQPl8udaPbErz+cSbE8dIkub9giSvYOJJU9tDTMb73JMG/58UFj9G1rAJ7EXpppS6A== X-Received: by 2002:a05:6a21:6d85:b0:f2:ba78:3d50 with SMTP id wl5-20020a056a216d8500b000f2ba783d50mr5602548pzb.12.1682180397923; Sat, 22 Apr 2023 09:19:57 -0700 (PDT) Received: from apple.localdomain ([182.65.27.4]) by smtp.gmail.com with ESMTPSA id i14-20020a655b8e000000b0051f14839bf3sm4241667pgr.34.2023.04.22.09.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 09:19:57 -0700 (PDT) From: Ajeets6 To: itachis6234@gmail.com, qemu-devel@nongnu.org Cc: imp@bsdimp.com Subject: [PATCH 6/7] Added case staements for time functions Date: Sat, 22 Apr 2023 21:49:33 +0530 Message-Id: <20230422161934.2311-6-itachis6234@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230422161934.2311-1-itachis6234@gmail.com> References: <20230422161934.2311-1-itachis6234@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 22 Apr 2023 13:28:49 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Warner Losh +Added cases for nanosleep(2),clock_nanosleep(2),clock_gettime(2) and clock_getres(2) +Updated meson.build Signed-off-by: Warner Losh Signed-off-by: Ajeets6 --- bsd-user/freebsd/meson.build | 1 + bsd-user/freebsd/os-syscall.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/bsd-user/freebsd/meson.build b/bsd-user/freebsd/meson.build index f87c788e84..2eb0ed4d96 100644 --- a/bsd-user/freebsd/meson.build +++ b/bsd-user/freebsd/meson.build @@ -1,4 +1,5 @@ bsd_user_ss.add(files( 'os-sys.c', 'os-syscall.c', + 'os-time.c', )) diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index c8f998ecec..8fd6eb05cb 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -46,6 +46,8 @@ #include "bsd-file.h" #include "bsd-proc.h" +/* *BSD dependent syscall shims */ +#include "os-time.h" /* I/O */ safe_syscall3(int, open, const char *, path, int, flags, mode_t, mode); @@ -507,6 +509,24 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, case TARGET_FREEBSD_NR_sysarch: /* sysarch(2) */ ret = do_freebsd_sysarch(cpu_env, arg1, arg2); break; + /* + * time related system calls. + */ + case TARGET_FREEBSD_NR_nanosleep: /* nanosleep(2) */ + ret = do_freebsd_nanosleep(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_clock_nanosleep: /* clock_nanosleep(2) */ + ret = do_freebsd_clock_nanosleep(arg1, arg2, arg3, arg4); + break; + + case TARGET_FREEBSD_NR_clock_gettime: /* clock_gettime(2) */ + ret = do_freebsd_clock_gettime(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_clock_getres: /* clock_getres(2) */ + ret = do_freebsd_clock_getres(arg1, arg2); + break; default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); From patchwork Sat Apr 22 16:19:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajeet Singh X-Patchwork-Id: 13221069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAD44C77B7C for ; Sat, 22 Apr 2023 17:29:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqH2b-0006wE-Uv; Sat, 22 Apr 2023 13:28:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqFy0-00023l-9B for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:04 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqFxx-0007Hu-1l for qemu-devel@nongnu.org; Sat, 22 Apr 2023 12:20:03 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-63f273b219eso713900b3a.1 for ; Sat, 22 Apr 2023 09:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682180399; x=1684772399; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KoCP+9WwtWsdfQgiwJlHFCougdvA0L39h6Ol8wVVnj8=; b=cDIOm5saxJrc+/tlYgiXYkODl5DY5S4BgTIcffQrySNqknkcTxfoZHi3QsLgRIqJs3 Wv4sfGdEbBuKRUGijSiGtAfBIcOKwH8h/4vVaJEjhSRmW1RbQ02ExzzaLKqbcmh3NGGI KZLRzQame+EyBEhBIfEJ0w7WYlve/0/UFhp5R7QP+R3/aPpSedVc5rtgA1RAMHoF310e ehg0zxpIEsP/4UO4BvNRNQ3spA7yn3oN2rTLycOvqjoJzyGr+OCTVil84dnalTpG4mcI Y+i4xYaUFWhzykM18Yu6/Aq3a7R8VB0J6NmJq+yDYQo9xnh2b30IwSYWS0n3F0Nf4lPO egVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682180399; x=1684772399; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KoCP+9WwtWsdfQgiwJlHFCougdvA0L39h6Ol8wVVnj8=; b=aOI+Tx4MvQVUvHQFsK0Oj7ZwvG/gN+0EbJheIIJwbF/80x1G7LFv9Ia9DjTjEQvgr/ 0EEWsTLoXOPCnYRThEn2epCSLLS2pOW4lGt/k7cjC+jlsYKgOGlKgy6Brk2cMPQZFmLc vXo0PAlFFrOQ31Ss4fKamnhsr3F1k3AWBLQFdwvyHfo8kxJQobmw/18riP6/FYqROVtI r/MbxI8e7qEUOwyfCuL+gAeNuz7nIJ5z1jjzlFoddThgJRvjDTub1uAnSJ0fDfjckfsJ 6/NcSgbrUMDS5Mq9c1qjTJ6xz4QYLwHBNITleJxZ0kPjwgBJAoJhW9gs2FyhQOMgOjVe bUDA== X-Gm-Message-State: AAQBX9dSOWRTzGVufS85avHw0u/BRLBBoIOFI95hbxtFvAAcrkjURMFh PIFNacHzHOVsy01/f9n6upg= X-Google-Smtp-Source: AKy350ZP2816kRnqZGIzRFSjEnKz6X3Gdy6oelw23rBaMA49qJO9PA4B+Ubu0q4fRnhOpd1tcJ9Q/A== X-Received: by 2002:a05:6a00:1801:b0:638:edbc:74ca with SMTP id y1-20020a056a00180100b00638edbc74camr13114362pfa.0.1682180399603; Sat, 22 Apr 2023 09:19:59 -0700 (PDT) Received: from apple.localdomain ([182.65.27.4]) by smtp.gmail.com with ESMTPSA id i14-20020a655b8e000000b0051f14839bf3sm4241667pgr.34.2023.04.22.09.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 09:19:59 -0700 (PDT) From: Ajeets6 To: itachis6234@gmail.com, qemu-devel@nongnu.org Cc: imp@bsdimp.com Subject: [PATCH 7/7] Added safe_syscalls for time functions. Date: Sat, 22 Apr 2023 21:49:34 +0530 Message-Id: <20230422161934.2311-7-itachis6234@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230422161934.2311-1-itachis6234@gmail.com> References: <20230422161934.2311-1-itachis6234@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x430.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 22 Apr 2023 13:28:49 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Warner Losh +Added safe_syscalls Signed-off-by: Warner Losh Signed-off-by: Ajeets6 --- bsd-user/freebsd/os-syscall.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index 8fd6eb05cb..3d56aff0fd 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -49,6 +49,16 @@ /* *BSD dependent syscall shims */ #include "os-time.h" +/* used in os-time */ +safe_syscall2(int, nanosleep, const struct timespec *, rqtp, struct timespec *, + rmtp); +safe_syscall4(int, clock_nanosleep, clockid_t, clock_id, int, flags, + const struct timespec *, rqtp, struct timespec *, rmtp); + +safe_syscall6(int, kevent, int, kq, const struct kevent *, changelist, + int, nchanges, struct kevent *, eventlist, int, nevents, + const struct timespec *, timeout); + /* I/O */ safe_syscall3(int, open, const char *, path, int, flags, mode_t, mode); safe_syscall4(int, openat, int, fd, const char *, path, int, flags, mode_t,