xref: /netbsd-src/doc/TODO.compat-module (revision e8fde6bc8b4b5fa085a596ad1a166eb4eed6d2ec)
1*e8fde6bcSmrg/* $NetBSD: TODO.compat-module,v 1.5 2019/02/04 22:00:51 mrg Exp $ */
2d91f98a8Spgoyette
3d91f98a8SpgoyetteDONE
4d91f98a8Spgoyette----
5d91f98a8Spgoyette1.  Removed the building of the compat library - it is no longer needed.
6d91f98a8Spgoyette
7d91f98a8Spgoyette2.  Reverted some intentional auto-load breakage for loading the sysv_ipc
862cd9e18Spgoyette    module; the breakage was introduced as the fix for a build break.
9d91f98a8Spgoyette
10d91f98a8Spgoyette3.  Split the sysv_ipc compat routines into their own compat_sysv module.
11d91f98a8Spgoyette
12d91f98a8Spgoyette4.  Resolved some inter-module dependencies.
13d91f98a8Spgoyette
14d91f98a8Spgoyette5.  Extracted some net/if.c compat routines into the compat module, and
15d91f98a8Spgoyette    replaced the originals with indirect (vectored) function calls.
16d91f98a8Spgoyette
17d91f98a8Spgoyette6.  Reconfirmed existing compat-module dependencies, and update the
18d91f98a8Spgoyette    defopt/defflag lines in the config files* as needed, to insure that
19d91f98a8Spgoyette    built-in dependencies get resolved.
20d91f98a8Spgoyette
21d91f98a8Spgoyette7.  Fixed limits on the number of module dependencies and maximum
22d91f98a8Spgoyette    recursion level (for auto-loading) have been removed.  Previous code
23d91f98a8Spgoyette    for reporting module status to userland has been versioned and moved
24d91f98a8Spgoyette    to the (new) compat_80 module.
25d91f98a8Spgoyette
26d91f98a8Spgoyette8.  The old monolithic compat module has been broken into multiple
27d91f98a8Spgoyette    modules, one for each old NetBSD version.  The monolithic compat
28d91f98a8Spgoyette    module is no longer available.
29d91f98a8Spgoyette
30d91f98a8Spgoyette    Similarly, the compat_sysv and compat_netbsd32 modules have also
31d91f98a8Spgoyette    been split into several version-specific modules, and the mini-
32d91f98a8Spgoyette    monolithic versions of these modules are no longer provided.
33d91f98a8Spgoyette
34d91f98a8Spgoyette9.  syscalls.master has been updated to autoload the version-specific
35d91f98a8Spgoyette    compat modules rather than the monolithic modules.
36d91f98a8Spgoyette
37d91f98a8Spgoyette10. Separated COMPAT_BSDPTY stuff, allowing the COMPAT_60 module to be
38d91f98a8Spgoyette    built regardless.
39d91f98a8Spgoyette
40d91f98a8Spgoyette11. Implemented a MP-safe mechanism for installing and removing function
41d91f98a8Spgoyette    pointers, preventing them from being unloaded (via modunload) while
42d91f98a8Spgoyette    in use.  Thanks to riastradh@ for the template code.
43d91f98a8Spgoyette
44d91f98a8Spgoyette12. Finished splitting the vnd_30 and vnd_50 compat code into separate
45d91f98a8Spgoyette    modules.
46d91f98a8Spgoyette
47d91f98a8Spgoyette13. Cleaned up some previous vectored routines (related to if_43.c) to
48d91f98a8Spgoyette    use the MP-safe mechanism.
49d91f98a8Spgoyette
50d91f98a8Spgoyette14. Organized (some of) the netbsd32 machine-dependent code to fit a
51d91f98a8Spgoyette    common build framework, and split version-specific code from baseline
52d91f98a8Spgoyette    code as needed.  More work may be needed here (see #18 below).
53d91f98a8Spgoyette
54d91f98a8Spgoyette15. The rtsock.c code has been split into two separate source files,
55d91f98a8Spgoyette    one for use in -current and one which is shared with COMPAT_50 (the
56d91f98a8Spgoyette    code is shared with -current, but macros are used to define version-
57d91f98a8Spgoyette    specific routine names and variable types).  Version-specific parts
58d91f98a8Spgoyette    of rtsock.c for compat_14 and compat_70 have also been split out and
59d91f98a8Spgoyette    included in the relevant version-specific compat modules.
60d91f98a8Spgoyette
61d91f98a8SpgoyetteTODO - Not required for branch merge
62d91f98a8Spgoyette------------------------------------
63d91f98a8Spgoyette16. Audit the entire code base for any remaining embedded #ifdef's for
64d91f98a8Spgoyette    COMPAT_xx.  When found, move the actual compat code into the compat
65d91f98a8Spgoyette    hierarchy and replace originals with indirect (vectored) calls.
66d91f98a8Spgoyette
67d91f98a8Spgoyette17. The compat_60 module still needs some work for XEN systems.  We
68d91f98a8Spgoyette    probably need some build infrastructure changes to ensure that
69d91f98a8Spgoyette    XEN (and, for i386, XEN-PAE) modules are build with the correct
70d91f98a8Spgoyette    macros defined and with -I directories specified in the same order
71d91f98a8Spgoyette    as for building kernels. See PR port-xen/53130.  This currently
72d91f98a8Spgoyette    prevents loading of micro-code updates for amd64 processors running
73d91f98a8Spgoyette    XEN kernels.  This limitation also exists on HEAD.
74d91f98a8Spgoyette
75d91f98a8Spgoyette18. There seems to be quite a bit of MD compat_xx code, in the various
76d91f98a8Spgoyette    sys/arch/ directories.  I haven't yet looked at any of this.  But it
77d91f98a8Spgoyette    seems to me that the MI compat build infrastructure should have some
78d91f98a8Spgoyette    mechanism to "reach over" to the MD code, #include a Makefile.inc file,
79d91f98a8Spgoyette    and perhaps define something to enable the MI modcmd code to call a
80d91f98a8Spgoyette    compat_xx_MD_init() routine.
81d91f98a8Spgoyette
82d91f98a8Spgoyette    Note also that there are a few bits of MD code that is COMPAT_44
83d91f98a8Spgoyette    related.  (The only bit of MI COMPAT_44 code is in the single module
84d91f98a8Spgoyette    shared by COMPAT_43 and COMPAT_09.)  This affects the cesfic, hp300,
85d91f98a8Spgoyette    news68k, and x68k platforms, all in their respective machdep.c
86d91f98a8Spgoyette    source file.  Additionally, the zaurus platform defines COMPAT_44 in
87d91f98a8Spgoyette    its INSTALL kernel configuration - but no other configuration files!
88d91f98a8Spgoyette
89d91f98a8Spgoyette    As far as I can tell, none of the MD compat code is currently built
90d91f98a8Spgoyette    into the monolithic COMPAT module on HEAD.  Thus, its absence from
91d91f98a8Spgoyette    any of the version-specific modules is not a regression.
92d91f98a8Spgoyette
93d91f98a8Spgoyette19. For compat_50, there are some things in dev/gpio and dev/wscons/wsmux
94d91f98a8Spgoyette    that I haven't been able to cleanly separate.  These items are not
95d91f98a8Spgoyette    currently included in the monolithic COMPAT module on HEAD, so lack of
96d91f98a8Spgoyette    integration on the branch is not a regression.
97d91f98a8Spgoyette
98d91f98a8Spgoyette20. Find all the remaining dependencies on the compat_utils routines and
99d91f98a8Spgoyette    deal with them appropriately.  For now, we simply ensure that they
100d91f98a8Spgoyette    are included in every kernel via 'options COMPAT_UTILS' in file
101d91f98a8Spgoyette    sys/conf/std
102d91f98a8Spgoyette
103d91f98a8Spgoyette21. The netbsd32_machine32_hook should be moved out of the main kernel
104d91f98a8Spgoyette    and into the compat_netbsd32 module.  Unfortunately there are some
105d91f98a8Spgoyette    machines which include the consumer of this hook but do not have a
106d91f98a8Spgoyette    compat_netbsd32 module (specifically, i386 and sgimips).  This
107d91f98a8Spgoyette    should be sorted out sometime soon, but does not block merging.
108d91f98a8Spgoyette
109d91f98a8Spgoyette22. Note that the MPSAFE kernel option is currently not specified for
110d91f98a8Spgoyette    building modules, nor is it included in any standard kernel
111d91f98a8Spgoyette    configuration files.  If you build a custom kernel with the MPSAFE
112d91f98a8Spgoyette    option set, and you also use modules (especially those modules for
113d91f98a8Spgoyette    network interface device drivers), you'll need to build custom
114d91f98a8Spgoyette    modules, too.  The MPSAFE stuff needs to be extracted out and made
115d91f98a8Spgoyette    into "hooks".
11640d6bcebSpgoyette
11740d6bcebSpgoyette23. The raidframe-netbsd32 compat code needs to be better separated
11840d6bcebSpgoyette    from the main raidframe module.  The current mechanism requires us
119*e8fde6bcSmrg    to include compat/netbsd32/netbsd32.h in rf_netbsdkintf.c to get
120*e8fde6bcSmrg    various structure definitions.  This should all be handled in the
121*e8fde6bcSmrg    compat module, but requires that the code in the ioctl switch be
122*e8fde6bcSmrg    moved into a function so the compat code can call it directly and
123*e8fde6bcSmrg    handle the ioctl commands entirely.
124