Lines Matching +full:gen +full:- +full:2

2 --
3 -- SPDX-License-Identifier: BSD-2-Clause
4 --
5 -- Copyright (c) 2024 Tyler Baxter <agge@FreeBSD.org>
6 -- Copyright (c) 2019 Kyle Evans <kevans@FreeBSD.org>
7 --
9 -- Setup to be a module, or ran as its own script.
11 local script = not pcall(debug.getlocal, 4, 1) -- TRUE if script.
13 -- Add library root to the package path.
18 local FreeBSDSyscall = require("core.freebsd-syscall")
21 -- File has not been decided yet; config will decide file. Default defined as
22 -- /dev/null.
26 -- Grab the master system calls table.
29 -- Bind the generator to the parameter file.
30 local gen = generator:new({}, fh)
31 gen.storage_levels = {} -- make sure storage is clear
33 -- Write the generated preamble.
34 gen:preamble("System call prototypes.")
36 -- Write out all the preprocessor directives.
37 gen:write(string.format([[
57 0 : sizeof(syscallarg_t) - sizeof(t))
69 -- 64-bit padding preprocessor directive.
70 gen:pad64(config.abiChanges("pair_64bit"))
72 --
73 -- Storing each compat entry requires storing multiple levels of file
74 -- generation; compat entries are given ranges of 10 instead to cope
75 -- with this. For example, 13 is indexed as 130; 131 is the second
76 -- storage level of 13.
77 --
79 -- Store all the compat #ifdef from compat_options at their zero index.
81 -- Tag an extra newline to the end, so it doesn't have to be
82 -- worried about later.
83 gen:store(string.format("\n#ifdef %s\n\n", v.definition),
90 -- Audit defines are stored at an arbitrarily large number so
91 -- that they're always at the last storage level, and compat
92 -- entries can be indexed by their compat level (more
93 -- intuitive).
94 local audit_idx = 10000 -- this should do
96 gen:write(v.prolog)
97 gen:store(v.prolog, 1)
99 gen:store(v.prolog, w.compatlevel * 10)
102 -- Handle non-compat:
104 -- All these negation conditions are because (in
105 -- general) these are cases where code for sysproto.h
106 -- is not generated.
110 gen:write(string.format(
117 gen:write("#ifdef PAD64_REQUIRED\n")
120 gen:write(string.format([[
131 gen:write("#endif\n")
134 gen:write("};\n")
136 gen:write(string.format(
149 gen:store(string.format(
153 gen:store(string.format(
159 -- Handle compat (everything >= FREEBSD3):
165 gen:store(string.format(
168 gen:store(string.format([[
175 gen:store("};\n", idx)
177 -- Not stored, written on the first run.
178 gen:write(string.format([[
187 gen:store(string.format([[
192 gen:store(string.format([[
199 -- Do nothing for obsolete, unimplemented, and reserved.
202 -- Append #endif to the end of each compat option.
204 -- Based on how they're indexed, 9 is the last index.
206 -- Need an extra newline after #endif.
207 gen:store(string.format("\n#endif /* %s */\n\n", v.definition),
211 gen:write(tbl.epilog)
212 gen:store(tbl.epilog, 1)
214 gen:store(tbl.epilog, w.compatlevel * 10)
217 if gen.storage_levels ~= nil then
218 gen:writeStorage()
221 -- After storage has been unrolled, tag on the ending bits.
222 gen:write(string.format([[
232 -- Entry of script:
236 if #arg < 1 or #arg > 2 then
240 local sysfile, configfile = arg[1], arg[2]
245 -- The parsed system call table.
248 sysproto_h.file = config.sysproto -- change file here
252 -- Return the module.