From nobody Thu Jan 16 21:52:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYxRY0ngqz5kyl9; Thu, 16 Jan 2025 21:52:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYxRY00Jjz45HZ; Thu, 16 Jan 2025 21:52:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737064345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+sa7KL/GXqxUUbCVl1l54kvoBmcE5pIpSzJNGfIHsr4=; b=q2R84O5jrgBmk+xZlPubQUvGuqrur4lS+ZeANvcbogrIcSdzgu25zcoP3svkM0RVXTLGnF fCQh6FSdQVyKg9Lx24q4uCTRMel1yGgi1eC7PHoL5bdaQU1zoYllBugq/4gz30SiaALkK9 WvX6ESHq1TJ8Z6jyYK+g7tZ/dzE+Y3wnycbGT46QQ/fUL6Nr1XF/YzrQOlz6QEakpevr5V NVLczfhVLLsJVu4BdzcQIEIh51vtNLQSxWl1RMIjHSFAQk1XMrN7IQ3WR++9eTdLQdPoXe kjVQekB9H9cvjgcAYN0JXyTI9bY4jjagqc+pym6c/tfs6NhYbV1tZsRcn0A0mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737064345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+sa7KL/GXqxUUbCVl1l54kvoBmcE5pIpSzJNGfIHsr4=; b=VkZ+ECCemzmxXWHFpvv5xDj8fb+f3qP56o8nE6DhALWnvg/s0ruF7H8psf+lAMcO2gEg0L GGvqm4/RbCOA9bZ20BADERZSr58r1y0fIgKGm9xuaRTDjulcyvW/nOQK3TjpymQTVfhbfz 0FhA+FMFwgVg+QYTLIO5zEiBvd0G4KptL2ukHlP0YGUl8PkYtlKwokcxcf2F27aXO8SE6E UVpUuDu3mbxssEhwyij2+SMymbm7yNRFlhAGZZw9LyK2OvMp068qugyFgK4zIx8hCJjj95 33yKZmub5gprKgt/8iqCJguiEx9nbM/aWINXldXhFfWLo/4o57lmY7mAQFx32Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737064345; a=rsa-sha256; cv=none; b=Ln9MLrKbadjruJvlfxS6lzyDExEMb/kb0EzEc2k1rL8IirJ7CyY5w0rZMo45No3b7dgwh8 OLywhzBGaI9sleJqvbBWMraU3fTvv1ErWkEEjXiiKzS/q9bh9pqnSyyH/eUWxTWSaoEAL0 dCwLkpQuvLBfxjgOg8cQ6b6m163kJYDor0vYB5a9n6oTjdU6FkwUDysSdW4kVwrpGxC9De Yu3azfZ7aXrs2Ha5txr1NIjznW6RAVcmqX8ZolAx+liNkCOoNYnXGmLXrmG97NhXmlLV60 Dikks3X0XKvaBZNjrj/1j72IX2aLwTo4ivnQmml4DCOZiaGAd43oTf61aifxYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YYxRX27Nrz10W3; Thu, 16 Jan 2025 21:52:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <25a28def-fbfd-49df-a2bf-dc4ef6609440@FreeBSD.org> Date: Thu, 16 Jan 2025 15:52:22 -0600 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 9ded074e875c - main - Refactor makesyscalls.lua into a library To: Brooks Davis , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org, Warner Losh References: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> Content-Language: en-US From: Kyle Evans In-Reply-To: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/30/24 16:08, Brooks Davis wrote: > The branch main has been updated by brooks: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9ded074e875c29cb92d5f643801990d7bb23cca4 > > commit 9ded074e875c29cb92d5f643801990d7bb23cca4 > Author: agge3 > AuthorDate: 2024-10-21 21:42:13 +0000 > Commit: Brooks Davis > CommitDate: 2024-10-30 21:04:30 +0000 > > Refactor makesyscalls.lua into a library > > * main.lua replicates the functionality of makesyscalls.lua > * Individual files are generated by their associated module > * Modules can be called as standalone scripts to generate a specific > file > * Data and procedures are performed by objects instead of procedual code > * Bitmasks are replaced by declarative types > * Temporary files are no longer produced, writing is stored in memory > * Comments provide explanation to functions and semantics > > Google Summer of Code 2024 Final Work Product > > Co-authored-by: Warner Losh > Co-authored-by: Kyle Evans > Co-authored-by: Brooks Davis > Sponsored by: Google (GSoC 24) > Pull Request: https://github.com/freebsd/freebsd-src/pull/1362 > Signed-off-by: agge3 > --- > sys/tools/syscalls/README.md | 49 +++ > sys/tools/syscalls/config.lua | 312 +++++++++++++++++ > sys/tools/syscalls/core/freebsd-syscall.lua | 147 ++++++++ > sys/tools/syscalls/core/scarg.lua | 163 +++++++++ > sys/tools/syscalls/core/scret.lua | 45 +++ > sys/tools/syscalls/core/syscall.lua | 497 +++++++++++++++++++++++++++ > sys/tools/syscalls/main.lua | 64 ++++ > sys/tools/syscalls/scripts/init_sysent.lua | 193 +++++++++++ > sys/tools/syscalls/scripts/libsys_h.lua | 111 ++++++ > sys/tools/syscalls/scripts/syscall_h.lua | 97 ++++++ > sys/tools/syscalls/scripts/syscall_mk.lua | 90 +++++ > sys/tools/syscalls/scripts/syscalls.lua | 109 ++++++ > sys/tools/syscalls/scripts/syscalls_map.lua | 74 ++++ > sys/tools/syscalls/scripts/sysproto_h.lua | 242 +++++++++++++ > sys/tools/syscalls/scripts/systrace_args.lua | 268 +++++++++++++++ > sys/tools/syscalls/tools/generator.lua | 113 ++++++ > sys/tools/syscalls/tools/util.lua | 194 +++++++++++ > 17 files changed, 2768 insertions(+) > > [...] > diff --git a/sys/tools/syscalls/core/freebsd-syscall.lua b/sys/tools/syscalls/core/freebsd-syscall.lua > new file mode 100644 > index 000000000000..193b1e43563c > --- /dev/null > +++ b/sys/tools/syscalls/core/freebsd-syscall.lua > @@ -0,0 +1,147 @@ > [...] > +function FreeBSDSyscall:parseSysfile() > + local file = self.sysfile > + local config = self.config > + local commentExpr = "^%s*;.*" > + > + if file == nil then > + return nil, "No file given" > + end > + > + self.syscalls = {} > + > + local fh, msg = io.open(file) > + if fh == nil then > + return nil, msg > + end > + > + local incs = "" > + local defs = "" > + local s > + for line in fh:lines() do > + line = line:gsub(commentExpr, "") -- Strip any comments. > + -- NOTE: Can't use pure pattern matching here because of > + -- the 's' test and this is shorter than a generic pattern > + -- matching pattern. > + if line == nil or line == "" then > + goto skip -- Blank line, skip this line. > + elseif s ~= nil then > + -- If we have a partial system call object s, > + -- then feed it one more line. > + if s:add(line) then > + -- Append to system call list. > + for t in s:iter() do > + if t:validate(t.num - 1) then > + table.insert(self.syscalls, t) > + else > + util.abort(1, > + "Skipped system call " .. > + "at number " .. t.num) > + end > + end > + s = nil > + end > + elseif line:match("^#%s*include") then > + incs = incs .. line .. "\n" > + elseif line:match("%%ABI_HEADERS%%") then > + local h = self.config.abi_headers > + if h ~= nil and h ~= "" then > + incs = incs .. h .. "\n" > + end > + elseif line:match("^#%s*define") then > + defs = defs .. line.. "\n" > + elseif line:match("^#") then > + util.abort(1, "Unsupported cpp op " .. line) This specifically is kind of a huge regression, and I don't really know how to cope with it. We've guaranteed for years that we'll copy preprocessor directives through to all output files. We don't use that upstream in FreeBSD, but we work with downstreams/vendors that make extensive use of it in their syscall definitions. I don't really know what the answer is to this, but we probably shouldn't have dropped it without some discussion first. This is going to be a bit of a headache... > [...] Thanks, Kyle Evans