It's been suggested that I should provide some more details on this
particular problem, so here goes :)
The sample code I have is from "IXP1200 Programming" by Erik J. Johnson and
Aaron R. Kunze. It's chapter 5's sample, the single-threaded packet counter.
This is an excerpt of the uC compiler output.
// My comments will in C++ style
// Initialize the cntr variable, as GPR a0
;****** cntr = (__declspec(scratch) unsigned int *)0;
immed[cntr_109$2$4:a0, 0, <<0]
// Write "0" into the scratchpad memory
;****** *cntr = 0;
immed[$0, 0, <<0]
scratch[write, $0, cntr_109$2$4:a0, 0, 1], ctx_swap
// Call the receive_packet function. Load the return address into a0
;****** buf_handle = receive_packet(0, 5, &cur_pkt_len);
immed[port_num_100_V$ca$2$5:b2, 0, <<0]
immed[rfifo_num_100_V$cb$2$5:a2, 5, <<0]
br[_receive_packet#], defer[1]
load_addr[a0, l_55#]
// Increment the packet count in scratch memory. Notice, however, that a0,
// the pointer to scratch memory a0 now contains the return address of
// label 1_55#, and not a valid pointer into scratch memory.
l_55#:
;****** scratch_incr(cntr, no_signal);
scratch[incr, --, cntr_109$2$4:a0, 0, 1], no_signal
--
Francis