]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/plr/patches/fiasco_ud2yield.diff
update
[l4.git] / l4 / pkg / plr / patches / fiasco_ud2yield.diff
1 diff --git a/src/kern/ia32/thread-ia32.cpp b/src/kern/ia32/thread-ia32.cpp
2 index d6fb000..7be482b 100644
3 --- a/src/kern/ia32/thread-ia32.cpp
4 +++ b/src/kern/ia32/thread-ia32.cpp
5 @@ -30,6 +30,7 @@ EXTENSION class Thread
6  {
7  private:
8    static int  (*int3_handler)(Trap_state*);
9 +  static int  (*int42_handler)(Trap_state*);
10  };
11  
12  
13 @@ -196,6 +197,26 @@ Thread::handle_slow_trap(Trap_state *ts)
14           ts->_err    = 0;
15          }
16  
17 +      if (ts->_trapno == 6)
18 +        {
19 +         LOG_MSG_3VAL(current(), "UD2", dbg_id(), ts->ip(), 0);
20 +         ts->ip(ts->ip()+2);
21 +         //Sched_context::rq.current().invalidate_sched();
22 +         switch_sched(sched(), &Sched_context::rq.current());
23 +         schedule();
24 +         goto success;
25 +        }
26 +
27 +      if (ts->_trapno == 13 && ts->_err == 530 /* INT 0x42 */)
28 +        {
29 +         /*printf("Replica %lx bailout @ %lx\n", dbg_id(), ts->ip());*/
30 +         ts->_trapno = 3;
31 +         ts->ip(ts->ip()+2);
32 +         if (int42_handler && int42_handler(ts))
33 +           goto success;
34 +         goto generic_debug;
35 +        }
36 +
37        if (send_exception(ts))
38         goto success;
39      }
40 @@ -517,6 +538,7 @@ IMPLEMENTATION[ia32 || amd64]:
41  #include "terminate.h"
42  
43  int (*Thread::int3_handler)(Trap_state*);
44 +int (*Thread::int42_handler)(Trap_state*);
45  DEFINE_PER_CPU Per_cpu<Thread::Dbg_stack> Thread::dbg_stack;
46  
47  STATIC_INITIALIZER_P (int3_handler_init, KDB_INIT_PRIO);
48 @@ -526,6 +548,7 @@ void
49  int3_handler_init()
50  {
51    Thread::set_int3_handler(Thread::handle_int3);
52 +  Thread::set_int42_handler(Thread::handle_int3);
53  }
54  
55  IMPLEMENT static inline NEEDS ["gdt.h"]
56 @@ -575,6 +598,13 @@ Thread::set_int3_handler(int (*handler)(Trap_state *ts))
57    int3_handler = handler;
58  }
59  
60 +
61 +PUBLIC static inline
62 +void
63 +Thread::set_int42_handler(int (*handler)(Trap_state *ts))
64 +{
65 +  int42_handler = handler;
66 +}
67  /**
68   * Default handle for int3 extensions if JDB is disabled. If the JDB is
69   * available, Jdb::handle_int3_threadctx is called instead.