9.6 Maintenance and Portability Issues

If you decide to use nonportable, architecture-dependent asm statements, encapsulating these statements within macros or functions can aid in maintenance and porting. Placing all these macros in one file and documenting them will ease porting to a different architecture, something that occurs with surprising frequency even for "throw-away" programs. Thus, the programmer will need to rewrite only one file for the different architecture.

For example, most asm statements in the Linux source code are grouped into /usr/src/linux/include/asm and /usr/src/linux/include/asm-i386 header files, and /usr/src/linux/arch/i386/ and /usr/src/linux/drivers/ source files.