Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Nov 2021 22:37:50 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b85fb3904712 - main - makesyscalls.lua: Allow translation of intptr_t arguments
Message-ID:  <202111222237.1AMMboqH047289@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=b85fb39047123185707ade51bd6294bd404ff413

commit b85fb39047123185707ade51bd6294bd404ff413
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-11-22 22:36:57 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-22 22:36:57 +0000

    makesyscalls.lua: Allow translation of intptr_t arguments
    
    Translate instances of intptr_t to the config value abi_intptr_t
    (defaults to "intptr_t").  Used in CheriABI to translate intptr_t
    to intcap_t for hybrid kernels.
    
    Reviewed by:    kevans
---
 sys/tools/makesyscalls.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua
index f967bd84fa87..1023e2faa0e6 100644
--- a/sys/tools/makesyscalls.lua
+++ b/sys/tools/makesyscalls.lua
@@ -61,6 +61,7 @@ local config = {
 	abi_flags = "",
 	abi_flags_mask = 0,
 	abi_headers = "",
+	abi_intptr_t = "intptr_t",
 	ptr_intptr_t_cast = "intptr_t",
 }
 
@@ -398,9 +399,11 @@ local function write_line_pfile(tmppat, line)
 	end
 end
 
+-- Check both literal intptr_t and the abi version because this needs
+-- to work both before and after the substitution
 local function isptrtype(type)
 	return type:find("*") or type:find("caddr_t") or
-	    type:find("intptr_t")
+	    type:find("intptr_t") or type:find(config['abi_intptr_t'])
 end
 
 local process_syscall_def
@@ -599,6 +602,8 @@ local function process_args(args)
 			goto out
 		end
 
+		argtype = argtype:gsub("intptr_t", config["abi_intptr_t"])
+
 		-- XX TODO: Forward declarations? See: sysstubfwd in CheriBSD
 		if abi_change then
 			local abi_type_suffix = config["abi_type_suffix"]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111222237.1AMMboqH047289>