IXP1200 Programming: The Microengine Coding Guide for the Intel IXP1200 Network Processor Family

The goal of this chapter is to discuss tips and tricks that we either learned first hand, or have been learned by other IXP12xx programmers.
The tips and tricks in this chapter fall under one or more of the general-categories of debugging, optimizing, or pitfalls. Depending on your background and previous involvement with the IXP12xx, some of the tips and tricks might seem obvious, while others may surprise you. Most of the tips and tricks apply to writing in microengine C, but some are specific to writing in microcode. So feel free to skip around through this chapter to suit your needs.
To help you quickly understand the tip or trick, a summary note is placed at the beginning of each section. You can scan these summaries to determine if the information is useful to you. These tips and tricks can be read in any order.
Summary: The IXP12xx hardware stops the execution of the current thread if a ctx_arb[kill] instruction is prefetched. The solution is to pad any calls to ctx_arb[kill] following a branch with preceding NOPs. The microengine C compiler inserts these NOPs automatically.
The ctx_wait intrinsic blocks the calling thread until the given signal-is received. When given a signal type of kill , the calling thread is blocked until the next reset of the microengine. Developers can make use of ctx_wait(kill) for debugging, as we show in the tip with the same name. The microengine C compiler uses ctx_wait(kill) to shut down threads...