Kernel callout start and end macros

The build process recognizes that the code between CALLOUT_START and CALLOUT_END is a kernel callout that needs to be saved to a safe place in memory.

At the start of the source code (below the copyright boilerplate text and the comments) kernel callout source code has one of the following:

#include "callout.ah"


.include "callout.ah"

The assembly syntax determines whether the callout uses #include or .include.

The included file defines the following macros:


The CALLOUT_START macro marks the start of a kernel callout. Its three parameters are:

  1. name of the kernel callout routine
  2. the address of a four-byte variable that contains the amount of read/write storage the kernel callout needs (see Allocating read/write storage in this chapter)
  3. the address of a patcher routine, or 0 (zero) if no patching is needed (see Patching the kernel callout code in this chapter)
The CALLOUT_END macro indicates the end of the kernel callout routine source. It takes one argument, which has to be the same as the first argument in the preceding CALLOUT_START macro.

If this code is the only version of this kernel callout available, or if the discovery process selects this routine to be used by the kernel, the startup library copies the code between CALLOUT_START and CALLOUT_END to a safe place in memory where it will be available for the kernel to use after the memory which was allocated for the startup code has been overwritten.

The syntax of the two macros depends on the assembly used in the source code. The following examples are two common versions (this code and all assembly code in this document uses GNU Assembler (GAS) syntax):

CALLOUT_START(timer_load_8254, 0, 0)


CALLOUT_START timer_load_8254, 0, 0
CALLOUT_END timer_load_8254

Keep whatever syntax is used in the file you started from, and replace the sections of code from the original file with code that works with your hardware.