1 pragma Task_Dispatching_Policy (FIFO_Within_Priorities);
\r
3 with Text_IO; use Text_IO;
\r
4 with Ada.Unchecked_Conversion;
\r
6 with Basic_Integer_Types; use Basic_Integer_Types;
\r
7 -- with Processor_Registers;
\r
9 with System.Machine_Code; use System.Machine_Code;
\r
11 procedure Non_Local_Jump_Test is
\r
13 pragma Linker_Options("eat_20.o");
\r
16 pragma Import (C, Eat_20, "eat_20");
\r
18 pragma Priority (10);
\r
20 -- package PR renames Processor_Registers;
\r
21 package PR renames Non_Local_Jump;
\r
23 Cont : Integer := 0;
\r
24 pragma Volatile (Cont);
\r
26 TCB : System.Address := System.Null_Address;
\r
27 pragma Volatile (TCB);
\r
29 function Pthread_Self return System.Address;
\r
30 pragma Import (C, Pthread_Self, "pthread_self");
\r
32 Jmp_Buff : aliased PR.Jmp_Context;
\r
33 pragma Volatile (Jmp_Buff);
\r
35 procedure Por_Fastidiar2 (C : Integer) is
\r
39 Put_Line (Integer'Image (C));
\r
41 --for I in 1 .. 20_000_000 loop
\r
47 procedure Por_Fastidiar1 (C : Integer) is
\r
52 -- tarea q se cambia su dirección de retorno
\r
54 pragma Priority (5);
\r
57 task body Saltarina is
\r
60 TCB := Pthread_Self;
\r
62 PR.Save_Context(Jmp_Buff'Access);
\r
63 -- Asm ("int $3", No_Output_Operands, No_Input_Operands, "", True);
\r
64 if PR.After_Jump (Jmp_Buff'Access) = 1 then
\r
65 Put_Line ("---After Jump---");
\r
67 Por_Fastidiar1 (Cont);
\r
68 Put_Line ("---Not After Jump---");
\r
71 Put_Line(" Cont:" & Integer'Image (Cont));
\r
76 Put_Line ("Exception in Saltarina");
\r
82 exit when Cont >= 5;
\r
84 Put_Line ("Antes de cambiar retorno 3");
\r
85 PR.Restore_Context (TCB, Jmp_Buff'Access);
\r
86 Put_Line ("Desp de cambiar retorno 3");
\r
89 Put_Line (Integer'Image (Jmp_Buff'Size/8));
\r
91 end Non_Local_Jump_Test;
\r