Here's a nice checkpoint... this gets us the rough equivalent to what we have now (plus some stuff mixed in from CheriBSD that's mostly untested), so we can start quibbling over architecture and other fun stuff...
To start, I've included a diff of the generated files. There's a diff for these reasons:
- I've integrated Cheri's isptrtype and how it uses it (I thin k faithfully), so some systrace bits get extra casts because we didn't consider them pointers
- The new approach screws with whitespace much less, and I've tried to preserve it as faithfully as possible (because it's easier in many regards)
- I didn't understand how the comments are supposed to work and got annoyed at the awk bits, so the comments(?) got sucked into various C comments (e.g. "resuba (BSD/OS 2.x)" vs. "resuba") because the format description broke down in my head around this point, where it seemed like resuba should be function name and (BSD/OS 2.x) the comment.
For now, this has some other major problems:
1.) It's a monolithic lua script, and can probably be broken up
2.) Lua is hacked in, assuming one has the lua53 port installed and the location is specified in share/mk/src.sys.mk... need to work out where we want to put the in-tree lua, and how to plumb that through to these various Makefiles
3.) Diagnostics are crap, dumping out the entire syscall line in most cases when it hits a failure but no line numbers or other fun stuff
Most importantly, I'm unsure if it's even close to structured how we want or what we even want here. The current approach is basically:
- Grab capabilities.conf entries
- Setup stuff
- Process the syscall file; effectively run each line through pattern_table. This part either ignores the line, writes it to sysinc (#include), buffers the line as-is (other preprocessor directives), or collapses lines until it reaches another syscall looking definition (line starts with a number) stripping out any trailing escapes along the way
- Then it processes the buffer, each line of which is either a preprocessor directive to be written out as-is or a standardized (fro m a whitespace/newline perspective) syscall definition
I think this is at least a good discussion piece, and we can rewrite all of it as many times as we need to.