1 ------------------------------------------------------------------------------
\r
2 -- ------------------ M a R T E O S ------------------- --
\r
3 ------------------------------------------------------------------------------
\r
10 -- File 'context.adb' By MAR
\r
12 -- Processor context for non-local jumps
\r
14 -- IMPORTANT: it must be compiled without any optimization!!
\r
16 -- {MARTE_COPYRIGHT}
\r
18 ------------------------------------------------------------------------------
\r
21 -- 02-08-07:version operativa.
\r
23 -- {MAR>} -------------------------------------------------------------------
\r
24 with Text_IO; use Text_IO;
\r
25 with Marte.Integer_Types;
\r
26 with Non_Local_Jump;
\r
29 use type Marte.Integer_Types.Unsigned_32;
\r
31 package body Context is
\r
33 Jmp_Buff : aliased Non_Local_Jump.Jmp_Context;
\r
34 pragma Volatile (Jmp_Buff);
\r
36 TCB : System.Address := System.Null_Address;
\r
37 pragma Volatile (TCB);
\r
39 function Pthread_Self return System.Address;
\r
40 pragma Import (C, Pthread_Self, "pthread_self");
\r
42 function Execute_Work(Work : Work_Acc) return Integer is
\r
44 Put_Line ("Start work");
\r
45 TCB := Pthread_Self;
\r
46 Non_Local_Jump.Save_Context(Jmp_Buff'Access);
\r
47 if Non_Local_Jump.After_Jump (Jmp_Buff'Access) = 0 then
\r
48 Put_Line ("---Not After Jump---");
\r
52 Put_Line ("---After Jump---");
\r
57 procedure Restore_Work is
\r
59 Non_Local_Jump.Restore_Context (TCB, Jmp_Buff'Access);
\r