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
This commit is contained in:
Brooks Davis 2021-11-22 22:36:57 +00:00
parent f0cfbffc36
commit b85fb39047

View File

@ -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"]