Accessing the kernel

Top  Previous  Next

Low-level handlers may use only two kernel services, k_event_set and k_sema_signal_n. These functions are accessed through pointers held in the kernel structure addressed by a11:

 


Word offset from a11

Contents


-2

address of k_sema_signal_n


-1

address of k_event_set

 

k_signal_sema_n

 

stand-alone

This service signals a semaphore N times. Up to N threads waiting on the semaphore are made ready to execute.

 

Dragons003Do not confuse the low-level function k_sema_signal_n with the high-level function i_sema_signal_n.

 

The following registers are used:

 


Register

value on entry

value on return


a0

return address

unchanged


a2

contents of first word of semaphore

unknown


a4

unimportant

unknown


a3

address of semaphore

unknown


b0


unknown


b1

N

unknown


b3

unimportant

unknown


b4

unimportant

unknown

 

For example:

 

     ; this assumes that a2 contains the address of the semaphore.

     

     ldw  *+a11[-2], b3 ; address of k_sema_signal_n

     mv    a2,       a3 ; address of semaphore

     nop   3

     b     b3           ; call k_sema_signal_n

     ldw  *a3, a2       ; load first word of semaphore

     mvkl  Next, a0     ; return address

     mvkh  Next, a0

     mvk   1,    b1     ; N = 1

     nop

Next:

 

Dragons003The loading of a2, a3, and b1 must have completed by the time control passes to k_sema_signal_n

k_event_set

 

stand-alone

This service sets an event. Any threads waiting on the event are made ready to execute.

 

Dragons003Do not confuse the low-level function k_event_set with the high-level function i_event_set.

 

The following registers are used:

 


Register

value on entry

value on return


a1

unimportant

unknown


a4

address of event

unknown


b0

contents of event

unknown


b3

return address

unchanged


b4

unimportant

unknown

 

For example:

 

     ;this assumes that a2 contains the address of the event to set.

     ldw  *+a11[-1], b3 ; address of k_event set

     nop   4

     b     b3           ; call k_event set

     ldw  *a2,       b0 ; load event word

     mv    a2,       a4 ; set address of event word

     mvkl  Next,     b3 ; return address

     mvkh  Next,     b3

     nop

Next:

 

 

Dragons003The loading of b0 and a4 must have completed by the time control reaches k_event_set.