aboutsummaryrefslogtreecommitdiff
path: root/sys/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* makesyscalls: handle arrays of pointersBrooks Davis2021-11-221-0/+12
| | | | | | | When the config variable abi_intptr_t is not "", transform arrays of pointers to arrays of abi_intptr_t. Reviewed by: kevans
* makesyscalls: handle longs in ABI compatBrooks Davis2021-11-221-0/+23
| | | | | | | | | | | | | | Replace long-derived types with their abi equivalent where required by the target ABI. There are two cases: - All pointers to types that go from 64-bit to 32-bit between the default ABI and the target ABI. - Signed arguments that go from 64-bit to 32-bit (these require sign-extension before passing to general kernel ABIs). This adds four new config variables: abi_long, semid_t, abi_size_t, and abi_u_long which default to long, size_t, and u_long respectively. Reviewed by: kevans
* makesyscalls.lua: Allow translation of intptr_t argumentsBrooks Davis2021-11-221-1/+6
| | | | | | | | 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
* makesyscalls: intptr_t arguments are pointersBrooks Davis2021-11-221-2/+2
| | | | | | | Match intptr_t arguments as pointers. Currently this is a no-op change to systrace_args.c. Reviewed by: kevans
* makesyscalls: Add a way to include per-ABI headersBrooks Davis2021-11-221-0/+11
| | | | | | | | | | | | When the string %%ABI_HEADERS%% is found in syscalls.master, replace it with the contents of the abi_headers config variable. This allows an ABI-specific syscalls.conf to add lines like: #include <compat/freebsd32/freebsd32.h> when working from a shared syscalls.master. Reviewed by: kevans
* makesyscalls: allow multiple expressions for each abi changeBrooks Davis2021-11-221-6/+16
| | | | | | | Limitations in lua patterns means we need to be able to match more than one possible expression. Reviewed by: kevans
* makesyscalls: Fix expression for time_t_sizeBrooks Davis2021-11-221-1/+1
| | | | Reviewed by: kevans
* makesyscalls: Remove _native suffix handlingBrooks Davis2021-11-221-1/+0
| | | | | | This supported a hack we used in CheriBSD which has been removed. Reviewed by: kevans
* makesyscalls: make strip_abi_prefix more robustBrooks Davis2021-11-171-0/+3
| | | | | | | Allow strip_abi_prefix() to be called with nil and return nil in that case. This simplifies handling of RESERVED entries. Reviewed by: kevans
* ipq4018: add TCSR definitions from Linux.Adrian Chadd2021-10-181-1/+1
| | | | | | | | | | | | | | | These are hardware configuration options which are required in the linux/openwrt device trees for the IPQ4018/IPQ4019 devices. Since this isn't obtained from linux upstream but instead from openwrt, this can't go in contrib; instead it is going in sys/dts/include/ . Obtained from: OpenWRT Tested: * IPQ4019 ASUS RT-AC58U AP, initial bootstrapping
* makesyscalls: sprinkle some assert() on standard function callsKyle Evans2021-09-251-30/+34
| | | | | | | | | | | Improves our error reporting, ensuring that we aren't just ignoring errors in the common case. Note specifically the boundary where we have to change up our error handling approach. It's fine to error() out up until we create the tempdir, then the rest should try to handle it gracefully and abort(). A future change will clean this up further by pcall'ing all of the bits that cannot currently error() without cleaning up.
* makesyscalls: rip out arbitrary command executionKyle Evans2021-09-251-33/+2
| | | | | | | | | | | | | | This was previously needed only for CloudABI, which used it to generate its capenabled from syscalls.master. CloudABI was removed in cf0ee8738e31, so we don't need to support this anymore. Others looking to do similar things should come up with a more integrated technique, such as a .conf flag or pattern/glob support. brooks suggests that it could be done in modern makesyscalls.lua by adding a config flag to specify always-on/initial flags (CAPENABLED). Reviewed by: brooks, imp MFC after: never Differential Revision: https://reviews.freebsd.org/D32095
* makesyscalls: stop trying to remove . and .. in cleanupKyle Evans2021-09-251-1/+3
| | | | | lfs.dir() will include these entries, but os.remove() cannot remove them for obvious reasons.
* Drop cloudabiKonstantin Belousov2021-09-211-4/+2
| | | | | | | | | | | | | According to https://github.com/NuxiNL/cloudlibc: CloudABI is no longer being maintained. It was an awesome experiment, but it never got enough traction to be sustainable. There is no reason to keep it in FreeBSD. Approved by: ed (private mail) Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31923
* makesyscalls.lua: add a CAPENABLED flagBrooks Davis2021-09-011-1/+3
| | | | | | | | | | The CAPENABLED flag indicates that the syscall can be used in capsicum capability mode. It is intended to replace capabilities.conf. Reviewed by: kevans, emaste MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D31349
* Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrightsEd Maste2021-08-081-1/+0
| | | | | | | These ones were unambiguous cases where the Foundation was the only listed copyright holder (in the associated license block). Sponsored by: The FreeBSD Foundation
* booti: Enable loading the kernel image to any address aligned to 2 MBMichal Meloun2021-07-281-1/+1
| | | | | | We've supported this for a long time, plus most u-boot setups quietly expect it. Otherwise they fail with different levels of memory overwrites. MFC after: 2 weeks
* makesyscalls.lua: improve generated file style(9) complianceEd Maste2021-05-131-4/+4
| | | | | | | | | | | | We generally like to avoid style changes when other changes are not planned. In this case there are some makesyscalls.lua changes in the pipeline, and this cleans up style nits in generated files that were highlighted by experiments with clang-format. Reviewed by: brooks, kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30235
* newbus: remove support for SINGLETONWarner Losh2021-04-261-9/+1
| | | | | | | | | | | | | | | | | | | | | | | Revert rest of de8dd262c43b since it's now unused. jhibbits@ introduced this to give powerpc MMU functions IFUNC like performance while retaining the kobj interface, speeding up operations 10-20%. Since there was only ever one instance of the mmu interface active at any given time, we could cache the looked up results more agressively. powerpc migrated to using IFUNCs to get an even larger performance boost in 45b69dd63e, deleting the two files it was added to in de8dd262c43b. However, there's few, if any, other potential applications of this to the tree today. It's now unused and undocumented. Retire it to eliminate this wart and to preclude the need to document it. Should a simmilar case arise in the future, the code is in git... Discusssed with: jhibbits@ Reviewed by: jhb@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29997
* syscalls.master: Add a new syscall type: RESERVEDBrooks Davis2021-01-261-8/+15
| | | | | | | | | RESERVED syscall number are reserved for local/vendor use. RESERVED is identical to UNIMPL except that comments are ignored. Reviewed by: kevans Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27988
* Switch to the new device-tree vendor treeEmmanuel Vadot2021-01-152-6/+4
| | | | | | | | | | | | | The old vendor tree was never fully merged and doing partial merge isn't supported with git subtree merge so a new one was created. Switch the build to use the new DTS from sys/contrib/device-tree This also bump the DTS used to be in sync with Linux 5.9 While here change the way to get the linux version, simply hardcode the value in sys/dts/freebsd-compatible.dts and use awk to get that to put it in the CFLAGS. As a bonus we now have the bindings docs available in sys/contrib/device-tree/Bindings/ so no need to link to the Linux repo or to the vendor tree.
* sys/tools: Add a tool for generating arm and arm64 kernel images.Michal Meloun2020-12-301-0/+190
| | | | | | | | This tool can generate kernel images without changing the offsets in the final executable. It replaces the ELF header by properly sized zeroed block then emits a relative jump to _start(for 'v7jump' or 'v8jump' option) or the booti header (for 'v8booti' option) to the beginning of the converted file. Submited by: ian
* Use a template assembly file for firmware object files.John Baldwin2020-12-171-2/+2
| | | | | | | | | | | | | | | | | | | | | Similar to r366897, this uses the .incbin directive to pull in a firmware file's contents into a .fwo file. The same scheme for computing symbol names from the filename is used as before to maximize compatiblity and not require rebuilding existing .fwo files for NO_CLEAN builds. Using ld -o binary requires extra hacks in linkers to either specify ABI options (e.g. soft- vs hard-float) or to ignore ABI incompatiblities when linking certain objects (e.g. object files with only data). Using the compiler driver avoids the need for these hacks as the compiler driver is able to set all the appropriate ABI options. Reviewed by: imp, markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27579 Notes: svn path=/head/; revision=368739
* Brand our DTS with the Linux version it was imported fromEmmanuel Vadot2020-10-101-1/+3
| | | | | | | | | | | | DTS must be synced with the kernel, add a freebsd,dts-version string in the root node of each DTS that we compile so we can later in the kernel check that it contain a correct value. Reviewed by: imp, mmel Differential Revision: https://reviews.freebsd.org/D26724 Notes: svn path=/head/; revision=366599
* Make makesyscalls.lua initialize 'struct sysent' entries using c99Edward Tomasz Napierala2020-09-251-10/+17
| | | | | | | | | | | | designated initializers. This makes it easier to modify 'struct sysent' layout. Reviewed by: kevans Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26530 Notes: svn path=/head/; revision=366145
* Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions.Michal Meloun2020-09-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | One problem with the bus_space_read_N() and bus_space_write_N() family of functions is that they provide no protection against exceptions which can occur when no physical hardware or device responds to the read or write cycles. In such a situation, the system typically would panic due to a kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() family of functions provide a mechanism to handle these exceptions gracefully without the risk of crashing the system. Typical example is access to PCI(e) configuration space in bus enumeration function on badly implemented PCI(e) root complexes (RK3399 or Neoverse N1 N1SDP and/or access to PCI(e) register when device is in deep sleep state. This commit adds a real implementation for arm64 only. The remaining architectures have bus_space_peek()/bus_space_poke() emulated by using bus_space_read()/bus_space_write() (without exception handling). MFC after: 1 month Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D25371 Notes: svn path=/head/; revision=365899
* makesyscalls.lua: improve syscall ordering validationKyle Evans2020-08-041-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two separate issues here: 1.) #if/#else wasn't taken into account at all for maxsyscall figures, but 2.) We didn't validate contiguous syscall numbers anyways... This kind of inconsistency is bad as we don't currently ensure explicit indexing of, e.g., the sysent array if one syscall is unimplemented/missing. This could be fixed and might be more robust, but it's also good to have the "documentation" that comes from being explicit as to what the missing syscalls are. The new version looks much like the awk version; stash off the current 'last highest syscall seen' if we hit an #if, restore to that if we hit an #else, and make sure that we're explicitly always defining the next syscall. The logic at the tail end of process_syscall_def that moves maxsyscall has been 'cleaned up' a little since we're now ensuring that it's monotonically increasing earlier in the function. At the moment I think it's unlikely we'd see range-definitions that are not UNIMPL, but there's no reason to specifically handle that case for bumping maxsyscall there. This change was provoked by reading the commit message for r363832 and realizing that this validation hadn't been included in the initial rewrite to lua. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D25945 Notes: svn path=/head/; revision=363869
* vfs: inline vops if there are no pre/post associated callsMateusz Guzik2020-07-301-1/+42
| | | | | | | | | | This removes a level of indirection from frequently used methods, most notably VOP_LOCK1 and VOP_UNLOCK1. Tested by: pho Notes: svn path=/head/; revision=363708
* vfs: stop null checking routines in vop wrappersMateusz Guzik2020-01-261-5/+7
| | | | | | | | | | | Calls to vop_bypass pass the same argument, but type casted to something else. Thus by replacing NULL routines with vop_bypass we avoid a runtime check. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23357 Notes: svn path=/head/; revision=357131
* Add a 'SINGLETON' directive to kobj interface definitionJustin Hibbits2020-01-181-1/+9
| | | | | | | | | | | | | | | | Summary: This makes the interface described in the definition file act like a pseudo-IFUNC service, by caching the found method locally. Applying this to the PowerPC MMU definitions, it yields a significant (15-20%) performance improvement, seen in both a 'make buildworld' and a parallel build of LLVM, on a POWER9 system. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D23245 Notes: svn path=/head/; revision=356860
* makesyscalls.lua: generate all files in /tmp, write into place at the endKyle Evans2020-01-101-13/+23
| | | | | | | | | | | | | | | | This makes makesyscalls.lua more parallel-friendly, or at least not as hostile to the idea. We get into situations where we're running parallel if we end up with MAKE_JOBS>1 entering any of the sysent targets, since each output file is recognized a distinct build step that needs to be executed. Another commit will add some .ORDER to further improve the situation. Reported by: jhb Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D23098 Notes: svn path=/head/; revision=356603
* vfs: allow tail call optimisation in vops in the common caseMateusz Guzik2019-12-161-7/+11
| | | | | | | | | | | | | | | Most frequently used vops boil down to checking SDT probes, doing the call and checking again. There is no vop_post/pre in their case but the check after the call prevents tail call optimisation from taking place. Instead, check once upfront. Kernels with debug or vops with non-empty vop_post still don't short circuit. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D22739 Notes: svn path=/head/; revision=355791
* vfs: flatten vop vectorsMateusz Guzik2019-12-161-5/+38
| | | | | | | | | | | | | | | This eliminates the following loop from all VOP calls: while(vop != NULL && \ vop->vop_spare2 == NULL && vop->vop_bypass == NULL) vop = vop->vop_default; Reviewed by: jeff Tesetd by: pho Differential Revision: https://reviews.freebsd.org/D22738 Notes: svn path=/head/; revision=355790
* makesyscalls.lua: trim trailing spaces/commas from argsKyle Evans2019-12-111-0/+1
| | | | | | | | | | | | | These are insignificant as far as declarations go, and we've historically allowed it. fhlinkat in ^/sys/kern/syscalls.master, for example, currently has a trailing comma after its final argument that this version of makesyscalls is ignoring (not by conscious decision). Fix it for now by actively stripping off trailing whitespace/commas until we decide to actively prohibit it. Notes: svn path=/head/; revision=355628
* makesyscalls.lua: improve config processingKyle Evans2019-12-061-8/+45
| | | | | | | | | | | | | | | | | | | The current version will strip out #include directives appearing inside strings, which is clearly wrong. Improve the processing entirely in the following ways: - Strip only whole-line comments on every single iteration - Abort if we see a malformed line that doesn't match the key=value format - For quoted (backtick or double quote) strings, we'll advance to the end of the key=value pair and make sure there's not extra stuff left over - For unquoted key=value pairs, we'll strip any trailing comments and verify there's no internal whitespace This has revealed the caveat that key/value pairs can't even include escaped quotes (and haven't been able to). I don't know if this is actually problematic, as we're usually looking at cases like "#include <foo>" or raw identifiers.The current version will strip out #include directives appearing inside strings, which is clearly wrong. Improve the processing entirely in the following ways: Reviewed and noticed by: brooks Differential Revision: https://reviews.freebsd.org/D22698 Notes: svn path=/head/; revision=355468
* Add makesyscalls.lua, a rewrite of makesyscalls.shKyle Evans2019-11-171-0/+1322
| | | | | | | | | | | | | | | | | | | | | This currently requires a suitable lua + luafilesystem + luaposix from the ports tree to build. Discussion is underway in D21893 to add a suitable lua to the base system, cleverly disguised and out of the way of normal consumers. makesyscalls.sh is a good target for rewrite into lua as it's currently a sh+sed+awk script that can be difficult to add on to, at times. For instance, adding a new COMPAT* option (that mimicks the behaivor of most other COMPAT* options) requires a fairly substantial amount of copy/paste; see r352693 for instance. Attempts to generate part of the awk script for COMPAT* handling was (very kindly) rejected with a desire to just rewrite the script in a single language that can handle all of it. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D21775 Notes: svn path=/head/; revision=354786
* fw_stub.awk: use @generated tag in generated filesEd Maste2019-09-111-1/+3
| | | | | | | | | | Multiple tools use @generated to identify generated files (for example, in a review Phabricator will by default hide diffs in enerated files). Use the @generated tag in makesyscalls.sh as we've done for other generated files. Notes: svn path=/head/; revision=352213
* Add SDIO support.Bjoern A. Zeeb2019-06-081-0/+265
| | | | | | | | | | | | | | | | | | | | Add a CAM-Newbus SDIO support module. This works provides a newbus infrastructure for device drivers wanting to use SDIO. On the lower end while it is connected by newbus to SDHCI, it talks CAM using the MMCCAM framework to get to it. This also duplicates the usbdevs framework to equally create sdiodev header files with #defines for "vendors" and "products". Submitted by: kibab (initial work, see https://reviews.freebsd.org/D12467) Reviewed by: kibab, imp (comments on earlier version) MFC after: 6 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19749 Notes: svn path=/head/; revision=348805
* Avoid literal @generated tag in file-generating scriptsEd Maste2019-05-082-2/+8
| | | | | | | | | | | We don't want the generator itself tagged as a generated file. Reviewed by: cem Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20182 Notes: svn path=/head/; revision=347328
* Use @generated tag in generated filesEd Maste2019-05-072-2/+2
| | | | | | | | | | | | Multiple tools use @generated to identify generated files (for example, in a review Phabricator will by default hide diffs in generated files). Use the @generated tag in makeobjops.awk and vnode_if.awk as we've done for other generated files. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=347224
* make_dtb.sh: Use $CPP instead of assuming that cpp is in $PATHAlex Richardson2018-12-142-10/+12
| | | | | | | | | | | | | This fixes building in CheriBSD with a strict tmp path since we don't bootstrap a cpp but pass the full path to clang-cpp instead. While touching this file also fix all shellcheck warnings in make_dtb.sh. Reviewed By: manu Differential Revision: https://reviews.freebsd.org/D18376 Notes: svn path=/head/; revision=342105
* Use ${ECHO} in dtb/dtbo build, pass in from dtb.mk for -sKyle Evans2018-11-092-2/+4
| | | | | | | | Reported by: sbruno MFC after: 3 days Notes: svn path=/head/; revision=340297
* embed_mfs.sh: replace some compound statements with conventional ifsEd Maste2018-11-021-3/+12
| | | | | | | Use the more readable form - there's no need to try being clever. Notes: svn path=/head/; revision=340082
* Only call sigdeferstop() for NFS.Konstantin Belousov2018-10-231-2/+3
| | | | | | | | | | | | | | | | | | | | Use bypass to catch any NFS VOP dispatch and route it through the wrapper which does sigdeferstop() and then dispatches original VOP. NFS does not need a bypass below it, which is not supported. The vop offset in the vop_vector is added since otherwise it is impossible to get vop_op_t from the internal table, and I did not wanted to create the layered fs only to wrap NFS VOPs. VFS_OP()s wrap is straightforward. Requested and reviewed by: mjg (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D17658 Notes: svn path=/head/; revision=339672
* make_dtb: Always add root directory in the include pathEmmanuel Vadot2018-08-231-2/+2
| | | | | | | | Some arch like arm and arm64 share DTS files, add the root dts directory to the include paths. Notes: svn path=/head/; revision=338246
* Add dtb overlays supportEmmanuel Vadot2018-03-241-0/+26
| | | | | | | | | | | | | | | | | | | | | | DTB Overlays are useful to change/add nodes to a dtb without the need to modify it. Add support for building dtbo during buildkernel. The goal of DTBO present in the FreeBSD source tree is to fill a gap in time when we submit changes upstream (Linux). Instead of waiting 2 to 4 months we can add a DTBO in tree in the meantime. This is not for adding DTBO for capes/hat/addon boards, those will be better to put in a ports. This is also not for enabling a i2c/spi/pwm controller on certain pins, each user have a different use case for those (which pins to use etc ...) and we cannot have all possible configuration. Add a dtbo for sun8i-h3-sid which add the SID node missing in upstream dts. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D14782 Notes: svn path=/head/; revision=331499
* Avoid using \$. It's an unknown escape sequence. Some awks warn aboutWarner Losh2018-01-281-8/+0
| | | | | | | | that. Instead, simply remove the sequence entirely because we never commit the generated files. Notes: svn path=/head/; revision=328507
* embed_mfs: correctly test grep return valueEd Maste2018-01-031-1/+1
| | | | | | | | | Reported by: br MFC with: r326992 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=327526
* Teach makeobjops.awk to accept PROLOG and EPILOG blocks beforeColin Percival2017-12-311-3/+21
| | | | | | | | | | | METHOD and STATICMETHOD declarations; that code will be inserted into the dispatch function before and after the method call. Use this functionality and the TSLOG framework to record DEVICE_ATTACH and DEVICE_PROBE entry/exit timestamps. Notes: svn path=/head/; revision=327428
* embed_mfs: support embedding mfs into loaderEd Maste2017-12-191-9/+32
| | | | | | | | | | | | | | | | | | The script originally supported embedding an mfs into ELF files or any other type of file, because it searched for magic strings to mark the beginning and end of the embeddable section. It was later modified to read the section offset and length via readelf, which made it work for ELF only. Restore the ability to update arbitrary file types by using the readelf technique for ELF, and the magic string technique for all others (including PE/COFF files like loader.efi). Submitted by: Zakary Nafziger <worldofzak@gmail.com> MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12746 Notes: svn path=/head/; revision=326992