00001
00002
00003 #ifndef tb_entry_h
00004 #define tb_entry_h
00005
00006 #include "initcalls.h"
00007
00008 #include "l4_types.h"
00009
00010
00011
00012
00013
00014
00015 class Context;
00016 class Space;
00017 class Space;
00018 class Sched_context;
00019 class Sys_ipc_frame;
00020 class Sys_ex_regs_frame;
00021 class Sys_task_new_frame;
00022 class Trap_state;
00023
00024 enum {
00025 Tbuf_unused = 0,
00026 Tbuf_pf = 1,
00027 Tbuf_ipc = 2,
00028 Tbuf_ipc_res = 3,
00029 Tbuf_ipc_trace = 4,
00030 Tbuf_ke = 5,
00031 Tbuf_ke_reg = 6,
00032 Tbuf_unmap = 7,
00033 Tbuf_shortcut_failed = 8,
00034 Tbuf_shortcut_succeeded = 9,
00035 Tbuf_context_switch = 10,
00036 Tbuf_exregs = 11,
00037 Tbuf_breakpoint = 12,
00038 Tbuf_trap = 13,
00039 Tbuf_pf_res = 14,
00040 Tbuf_sched = 15,
00041 Tbuf_preemption = 16,
00042 Tbuf_lipc = 17,
00043 Tbuf_jean1 = 18,
00044 Tbuf_task_new = 19,
00045 Tbuf_max = 32,
00046 Tbuf_hidden = 0x20,
00047 };
00048
00049 class Tb_entry
00050 {
00051 protected:
00052 Mword _number;
00053 Address _ip;
00054 Context *_ctx;
00055 Unsigned64 _tsc;
00056 Unsigned32 _pmc1;
00057 Unsigned32 _pmc2;
00058 Unsigned32 _kclock;
00059 Unsigned8 _type;
00060 static Mword (*rdcnt1)();
00061 static Mword (*rdcnt2)();
00062 private:
00063
00064 public:
00065 enum
00066 {
00067 Tb_entry_size = 64,
00068 };
00069
00070 public:
00071 static void set_rdcnt(int num, Mword (*f)());
00072
00073 inline void clear();
00074
00075 inline void hide();
00076
00077 inline void unhide();
00078
00079 inline Address ip() const;
00080
00081 inline Context* ctx() const;
00082
00083 inline Unsigned8 type() const;
00084
00085 inline int hidden() const;
00086
00087 inline Mword number() const;
00088
00089 inline void number(Mword number);
00090
00091 inline void rdpmc1();
00092
00093 inline void rdpmc2();
00094
00095 inline Unsigned32 kclock() const;
00096
00097 inline Unsigned64 tsc() const;
00098
00099 inline Unsigned32 pmc1() const;
00100
00101 inline Unsigned32 pmc2() const;
00102
00103 inline void rdtsc();
00104
00105 protected:
00106 inline void set_global(char type, Context *ctx, Address ip);
00107
00108 private:
00109 static Mword dummy_read_pmc();
00110 } __attribute__((packed));
00111
00112 class Tb_entry_fit : public Tb_entry
00113 {
00114 private:
00115 char _reserved[Tb_entry_size-sizeof(Tb_entry)];
00116
00117 public:
00118 static FIASCO_INIT void init();
00119
00120 static FIASCO_INIT void init_arch();
00121 };
00122
00124 class Tb_entry_ipc : public Tb_entry
00125 {
00126 private:
00127 L4_snd_desc _snd_desc;
00128 L4_rcv_desc _rcv_desc;
00129 Mword _dword[2];
00130 Global_id _dst;
00131 L4_timeout _timeout;
00132
00133 public:
00134 inline void set(Context *ctx, Mword ip, Sys_ipc_frame *ipc_regs, Unsigned64 left);
00135
00136 inline void set_irq(Context *ctx, Mword ip, Mword irq);
00137
00138 inline void set_sc(Context *ctx, Mword ip, Sys_ipc_frame *ipc_regs, Unsigned64 left);
00139
00140 inline L4_snd_desc snd_desc() const;
00141
00142 inline L4_rcv_desc rcv_desc() const;
00143
00144 inline Global_id dst() const;
00145
00146 inline L4_timeout timeout() const;
00147
00148 inline Mword dword(unsigned index) const;
00149 };
00150
00152 class Tb_entry_ipc_res : public Tb_entry
00153 {
00154 private:
00155 Unsigned8 _have_snd;
00156 Unsigned8 _is_np;
00157 Mword _dword[2];
00158 L4_msgdope _result;
00159 Global_id _rcv_src;
00160 L4_rcv_desc _rcv_desc;
00161 Mword _pair_event;
00162
00163 public:
00164 inline void set(Context *ctx, Mword ip, Sys_ipc_frame *ipc_regs, Mword result, Mword pair_event, Unsigned8 have_snd, Unsigned8 is_np);
00165
00166 inline int have_snd() const;
00167
00168 inline int is_np() const;
00169
00170 inline L4_rcv_desc rcv_desc() const;
00171
00172 inline L4_msgdope result() const;
00173
00174 inline Global_id rcv_src() const;
00175
00176 inline Mword dword(unsigned index) const;
00177
00178 inline Mword pair_event() const;
00179 };
00180
00182 class Tb_entry_ipc_trace : public Tb_entry
00183 {
00184 private:
00185 Unsigned8 _snd_desc;
00186 Unsigned8 _rcv_desc;
00187 L4_msgdope _result;
00188 Unsigned64 _snd_tsc;
00189 Global_id _snd_dst;
00190 Global_id _rcv_dst;
00191
00192 public:
00193 inline void set(Context *ctx, Mword ip, Unsigned64 snd_tsc, Global_id snd_dst, Global_id rcv_dst, L4_msgdope result, Unsigned8 snd_desc, Unsigned8 rcv_desc);
00194 };
00195
00197 class Tb_entry_ipc_sfl : public Tb_entry
00198 {
00199 private:
00200 L4_snd_desc _snd_desc;
00201 L4_rcv_desc _rcv_desc;
00202 L4_timeout _timeout;
00203 Global_id _dst;
00204 Unsigned8 _is_irq, _snd_lst, _dst_ok, _dst_lck, _preempt;
00205
00206 public:
00207 inline void set(Context *ctx, Mword ip, L4_snd_desc snd_desc, L4_rcv_desc rcv_desc, L4_timeout timeout, Global_id dst, Unsigned8 is_irq, Unsigned8 snd_lst, Unsigned8 dst_ok, Unsigned8 dst_lck, Unsigned8 preempt);
00208
00209 inline L4_timeout timeout() const;
00210
00211 inline L4_snd_desc snd_desc() const;
00212
00213 inline L4_rcv_desc rcv_desc() const;
00214
00215 inline Global_id dst() const;
00216
00217 inline Unsigned8 is_irq() const;
00218
00219 inline Unsigned8 snd_lst() const;
00220
00221 inline Unsigned8 dst_ok() const;
00222
00223 inline Unsigned8 dst_lck() const;
00224
00225 inline Unsigned8 preempt() const;
00226 };
00227
00229 class Tb_entry_pf : public Tb_entry
00230 {
00231 private:
00232 Address _pfa;
00233 Mword _error;
00234 Space *_space;
00235
00236 public:
00237 inline void set(Context *ctx, Address ip, Address pfa, Mword error, Space *spc);
00238
00239 inline Mword error() const;
00240
00241 inline Address pfa() const;
00242
00243 inline Space* space() const;
00244 };
00245
00247 class Tb_entry_pf_res : public Tb_entry
00248 {
00249 private:
00250 Address _pfa;
00251 Ipc_err _err;
00252 Ipc_err _ret;
00253
00254 public:
00255 inline void set(Context *ctx, Address ip, Address pfa, Ipc_err err, Ipc_err ret);
00256
00257 inline Address pfa() const;
00258
00259 inline Ipc_err err() const;
00260
00261 inline Ipc_err ret() const;
00262 };
00263
00265 class Tb_entry_ke : public Tb_entry
00266 {
00267 private:
00268 char _msg[31];
00269
00270 public:
00271 inline void set(Context *ctx, Address ip);
00272
00273 inline void set_const(Context *ctx, Address ip, const char * const msg);
00274
00275 inline void set_buf(unsigned i, char c);
00276
00277 inline void term_buf(unsigned i);
00278
00279 inline const char * msg() const;
00280 };
00281
00283 class Tb_entry_unmap : public Tb_entry
00284 {
00285 private:
00286 L4_fpage _fpage;
00287 Mword _mask;
00288 bool _result;
00289
00290 public:
00291 inline void set(Context *ctx, Address ip, L4_fpage fpage, Mword mask, bool result);
00292
00293 inline L4_fpage fpage() const;
00294
00295 inline Mword mask() const;
00296
00297 inline bool result() const;
00298 };
00299
00301 class Tb_entry_ex_regs : public Tb_entry
00302 {
00303 private:
00304 Mword _lthread;
00305 Mword _task;
00306 Address _old_sp;
00307 Address _new_sp;
00308 Address _old_ip;
00309 Address _new_ip;
00310 Mword _failed;
00311
00312 public:
00313 inline void set(Context *ctx, Address ip, Sys_ex_regs_frame *regs, Address old_sp, Address old_ip, Mword failed);
00314
00315 inline Mword lthread() const;
00316
00317 inline Mword task() const;
00318
00319 inline Address old_sp() const;
00320
00321 inline Address new_sp() const;
00322
00323 inline Address old_ip() const;
00324
00325 inline Address new_ip() const;
00326
00327 inline Mword failed() const;
00328 };
00329
00331 class Tb_entry_task_new : public Tb_entry
00332 {
00333 private:
00334 Global_id _task;
00335 Global_id _pager;
00336 Address _new_sp;
00337 Address _new_ip;
00338 Mword _mcp_or_chief;
00339
00340 public:
00341 inline void set(Context *ctx, Address ip, Sys_task_new_frame *regs);
00342
00343 inline Global_id task();
00344
00345 inline Global_id pager();
00346
00347 inline Address new_sp();
00348
00349 inline Address new_ip();
00350
00351 inline Mword mcp_or_chief();
00352 };
00353
00355 class Tb_entry_bp : public Tb_entry
00356 {
00357 private:
00358 Address _address;
00359 int _len;
00360 Mword _value;
00361 int _mode;
00362
00363 public:
00364 inline void set(Context *ctx, Address ip, int mode, int len, Mword value, Address address);
00365
00366 inline int mode() const;
00367
00368 inline int len() const;
00369
00370 inline Mword value() const;
00371
00372 inline Address addr() const;
00373 };
00374
00376 class Tb_entry_ctx_sw : public Tb_entry
00377 {
00378 private:
00379 Context *_dst;
00380 Context *_dst_orig;
00381 Address _kernel_ip;
00382 Mword _lock_cnt;
00383 Space *_from_space;
00384 Sched_context *_from_sched;
00385 Mword _from_prio;
00386
00387 public:
00388 inline void set(Context *ctx, Space *from_space, Address ip, Context *dst, Context *dst_orig, Mword lock_cnt, Sched_context *from_sched, Mword from_prio, Address kernel_ip);
00389
00390 inline Space* from_space() const;
00391
00392 inline Address kernel_ip() const;
00393
00394 inline Mword lock_cnt() const;
00395
00396 inline Context* dst() const;
00397
00398 inline Context* dst_orig() const;
00399
00400 inline Mword from_prio() const;
00401
00402 inline Sched_context* from_sched() const;
00403 };
00404
00406 class Tb_entry_sched : public Tb_entry
00407 {
00408 private:
00409 unsigned short _mode;
00410 Context *_owner;
00411 unsigned short _id;
00412 unsigned short _prio;
00413 signed long _left;
00414 unsigned long _quantum;
00415
00416 public:
00417 inline void set(Context *ctx, Address ip, unsigned short mode, Context *owner, unsigned short id, unsigned short prio, signed long left, unsigned long quantum);
00418
00419 inline unsigned short mode() const;
00420
00421 inline Context * owner() const;
00422
00423 inline unsigned short id() const;
00424
00425 inline unsigned short prio() const;
00426
00427 inline unsigned long quantum() const;
00428
00429 inline signed long left() const;
00430 };
00431
00433 class Tb_entry_preemption : public Tb_entry
00434 {
00435 private:
00436 Context *_preempter;
00437
00438 public:
00439 inline void set(Context *ctx, Context *preempter, Address ip);
00440
00441 inline Context* preempter() const;
00442 };
00443
00445 class Tb_entry_lipc : public Tb_entry
00446 {
00447 private:
00448 short int _type;
00449 Global_id _old;
00450 Global_id _new;
00451 Address _c_utcb_ptr;
00452
00453 public:
00454 inline void set(Context *tid, Address ip, unsigned short type, Global_id old_thread, Global_id new_thread, Address current_utcb_ptr);
00455
00456 inline unsigned short type() const;
00457
00458 inline Global_id old_thread() const;
00459
00460 inline Global_id new_thread() const;
00461
00462 inline Address c_utcb_ptr() const;
00463 };
00464
00465 class Tb_entry_jean1 : public Tb_entry
00466 {
00467 private:
00468 Context *_sched_owner1;
00469 Context *_sched_owner2;
00470
00471 public:
00472 inline void set(Context *tid, Address ip, Context *sched_owner1, Context *sched_owner2);
00473
00474 inline Context* sched_owner1();
00475
00476 inline Context* sched_owner2();
00477 };
00478
00480 class Tb_entry_ke_reg : public Tb_entry
00481 {
00482 private:
00483 char _msg[19];
00484 Mword _eax, _ecx, _edx;
00485
00486 public:
00487 inline void set(Context *ctx, Mword eip, Mword v1, Mword v2, Mword v3);
00488
00489 inline void set(Context *ctx, Mword eip, Trap_state *ts);
00490
00491 inline void set_const(Context *ctx, Mword eip, const char * const msg, Mword eax, Mword ecx, Mword edx);
00492
00493 inline void set_buf(unsigned i, char c);
00494
00495 inline void term_buf(unsigned i);
00496
00497 inline const char * msg() const;
00498
00499 inline Mword val1() const;
00500
00501 inline Mword val2() const;
00502
00503 inline Mword val3() const;
00504 };
00505
00507 class Tb_entry_trap : public Tb_entry
00508 {
00509 private:
00510 char _trapno;
00511 Unsigned16 _errno;
00512 Mword _ebp, _edx, _cr2, _eax, _eflags, _esp;
00513 Unsigned16 _cs, _ds;
00514
00515 public:
00516 inline void set(Context *ctx, Mword eip, Trap_state *ts);
00517
00518 inline void set(Context *ctx, Mword eip, Mword trapno);
00519
00520 inline char trapno() const;
00521
00522 inline Unsigned16 errno() const;
00523
00524 inline Mword eax() const;
00525
00526 inline Mword cr2() const;
00527
00528 inline Mword edx() const;
00529
00530 inline Mword ebp() const;
00531
00532 inline Unsigned16 cs() const;
00533
00534 inline Unsigned16 ds() const;
00535
00536 inline Mword sp() const;
00537
00538 inline Mword flags() const;
00539 };
00540
00541
00542
00543
00544
00545
00546 #include <cstring>
00547
00548 #include "entry_frame.h"
00549 #include "kip.h"
00550 #include "trap_state.h"
00551
00552 #include "cpu.h"
00553
00554
00555
00556
00557
00558
00559
00560
00561 inline void
00562 Tb_entry::clear()
00563 { _type = Tbuf_unused; }
00564
00565
00566
00567 inline void
00568 Tb_entry::hide()
00569 { _type |= Tbuf_hidden; }
00570
00571
00572
00573 inline void
00574 Tb_entry::unhide()
00575 { _type &= ~Tbuf_hidden; }
00576
00577
00578
00579 inline Address
00580 Tb_entry::ip() const
00581 { return _ip; }
00582
00583
00584
00585 inline Context*
00586 Tb_entry::ctx() const
00587 { return _ctx; }
00588
00589
00590
00591 inline Unsigned8
00592 Tb_entry::type() const
00593 { return _type & (Tbuf_max-1); }
00594
00595
00596
00597 inline int
00598 Tb_entry::hidden() const
00599 { return _type & Tbuf_hidden; }
00600
00601
00602
00603 inline Mword
00604 Tb_entry::number() const
00605 { return _number; }
00606
00607
00608
00609 inline void
00610 Tb_entry::number(Mword number)
00611 { _number = number; }
00612
00613
00614
00615 inline void
00616 Tb_entry::rdpmc1()
00617 { _pmc1 = rdcnt1(); }
00618
00619
00620
00621 inline void
00622 Tb_entry::rdpmc2()
00623 { _pmc2 = rdcnt2(); }
00624
00625
00626
00627 inline Unsigned32
00628 Tb_entry::kclock() const
00629 { return _kclock; }
00630
00631
00632
00633 inline Unsigned64
00634 Tb_entry::tsc() const
00635 { return _tsc; }
00636
00637
00638
00639 inline Unsigned32
00640 Tb_entry::pmc1() const
00641 { return _pmc1; }
00642
00643
00644
00645 inline Unsigned32
00646 Tb_entry::pmc2() const
00647 { return _pmc2; }
00648
00649
00650
00651 inline void
00652 Tb_entry::rdtsc()
00653 { _tsc = Cpu::rdtsc(); }
00654
00655
00656
00657 inline void
00658 Tb_entry::set_global(char type, Context *ctx, Address ip)
00659 {
00660 _type = type;
00661 _ctx = ctx;
00662 _ip = ip;
00663 _kclock = (Unsigned32)Kip::k()->clock;
00664 }
00665
00666
00667
00668 inline void
00669 Tb_entry_ipc::set(Context *ctx, Mword ip, Sys_ipc_frame *ipc_regs,
00670 Unsigned64 left)
00671 {
00672 set_global(Tbuf_ipc, ctx, ip);
00673 _snd_desc = ipc_regs->snd_desc();
00674 _rcv_desc = ipc_regs->rcv_desc();
00675 _dst = ipc_regs->snd_dst();
00676 _timeout = ipc_regs->timeout();
00677 if (_dst.next_period())
00678 {
00679 _dword[0] = (Unsigned32)(left & 0xffffffff);
00680 _dword[1] = (Unsigned32)(left >> 32);
00681 }
00682 else
00683 {
00684
00685 register Mword tmp0 = ipc_regs->msg_word(0);
00686 register Mword tmp1 = ipc_regs->msg_word(1);
00687 _dword[0] = tmp0;
00688 _dword[1] = tmp1;
00689 }
00690 }
00691
00692
00693
00694 inline void
00695 Tb_entry_ipc::set_irq(Context *ctx, Mword ip, Mword irq)
00696 {
00697 set_global(Tbuf_ipc, ctx, ip);
00698 _snd_desc = L4_snd_desc(0);
00699 _rcv_desc = L4_rcv_desc(0);
00700 _dst = Global_id::irq(irq);
00701 }
00702
00703
00704
00705 inline void
00706 Tb_entry_ipc::set_sc(Context *ctx, Mword ip, Sys_ipc_frame *ipc_regs,
00707 Unsigned64 left)
00708 {
00709 set_global(Tbuf_shortcut_succeeded, ctx, ip);
00710 _snd_desc = ipc_regs->snd_desc();
00711 _rcv_desc = ipc_regs->rcv_desc();
00712 _dst = ipc_regs->snd_dst();
00713 _timeout = ipc_regs->timeout();
00714 if (_dst.next_period())
00715 {
00716 _dword[0] = (Unsigned32)(left & 0xffffffff);
00717 _dword[1] = (Unsigned32)(left >> 32);
00718 }
00719 else
00720 {
00721
00722 register Mword tmp0 = ipc_regs->msg_word(0);
00723 register Mword tmp1 = ipc_regs->msg_word(1);
00724 _dword[0] = tmp0;
00725 _dword[1] = tmp1;
00726 }
00727 }
00728
00729
00730
00731 inline L4_snd_desc
00732 Tb_entry_ipc::snd_desc() const
00733 { return _snd_desc; }
00734
00735
00736
00737 inline L4_rcv_desc
00738 Tb_entry_ipc::rcv_desc() const
00739 { return _rcv_desc; }
00740
00741
00742
00743 inline Global_id
00744 Tb_entry_ipc::dst() const
00745 { return _dst; }
00746
00747
00748
00749 inline L4_timeout
00750 Tb_entry_ipc::timeout() const
00751 { return _timeout; }
00752
00753
00754
00755 inline Mword
00756 Tb_entry_ipc::dword(unsigned index) const
00757 { return _dword[index]; }
00758
00759
00760
00761 inline void
00762 Tb_entry_ipc_res::set(Context *ctx, Mword ip, Sys_ipc_frame *ipc_regs,
00763 Mword result, Mword pair_event, Unsigned8 have_snd,
00764 Unsigned8 is_np)
00765 {
00766 set_global(Tbuf_ipc_res, ctx, ip);
00767
00768 register Mword tmp0 = ipc_regs->msg_word(0);
00769 register Mword tmp1 = ipc_regs->msg_word(1);
00770 _dword[0] = tmp0;
00771 _dword[1] = tmp1;
00772 _pair_event = pair_event;
00773 _result = result;
00774 _rcv_desc = ipc_regs->rcv_desc();
00775 _rcv_src = ipc_regs->rcv_src();
00776 _have_snd = have_snd;
00777 _is_np = is_np;
00778 }
00779
00780
00781
00782 inline int
00783 Tb_entry_ipc_res::have_snd() const
00784 { return _have_snd; }
00785
00786
00787
00788 inline int
00789 Tb_entry_ipc_res::is_np() const
00790 { return _is_np; }
00791
00792
00793
00794 inline L4_rcv_desc
00795 Tb_entry_ipc_res::rcv_desc() const
00796 { return _rcv_desc; }
00797
00798
00799
00800 inline L4_msgdope
00801 Tb_entry_ipc_res::result() const
00802 { return _result; }
00803
00804
00805
00806 inline Global_id
00807 Tb_entry_ipc_res::rcv_src() const
00808 { return _rcv_src; }
00809
00810
00811
00812 inline Mword
00813 Tb_entry_ipc_res::dword(unsigned index) const
00814 { return _dword[index]; }
00815
00816
00817
00818 inline Mword
00819 Tb_entry_ipc_res::pair_event() const
00820 { return _pair_event; }
00821
00822
00823
00824 inline void
00825 Tb_entry_ipc_trace::set(Context *ctx, Mword ip, Unsigned64 snd_tsc,
00826 Global_id snd_dst, Global_id rcv_dst,
00827 L4_msgdope result, Unsigned8 snd_desc,
00828 Unsigned8 rcv_desc)
00829 {
00830 set_global(Tbuf_ipc_trace, ctx, ip);
00831 _snd_tsc = snd_tsc;
00832 _snd_dst = snd_dst;
00833 _rcv_dst = rcv_dst;
00834 _result = result;
00835 _snd_desc = snd_desc;
00836 _rcv_desc = rcv_desc;
00837 }
00838
00839
00840
00841 inline void
00842 Tb_entry_ipc_sfl::set(Context *ctx, Mword ip,
00843 L4_snd_desc snd_desc, L4_rcv_desc rcv_desc,
00844 L4_timeout timeout, Global_id dst,
00845 Unsigned8 is_irq, Unsigned8 snd_lst,
00846 Unsigned8 dst_ok, Unsigned8 dst_lck,
00847 Unsigned8 preempt)
00848 {
00849 set_global(Tbuf_shortcut_failed, ctx, ip);
00850 _snd_desc = snd_desc;
00851 _rcv_desc = rcv_desc;
00852 _timeout = timeout;
00853 _dst = dst;
00854 _is_irq = is_irq;
00855 _snd_lst = snd_lst;
00856 _dst_ok = dst_ok;
00857 _dst_lck = dst_lck;
00858 _preempt = preempt;
00859 }
00860
00861
00862
00863 inline L4_timeout
00864 Tb_entry_ipc_sfl::timeout() const
00865 { return _timeout; }
00866
00867
00868
00869 inline L4_snd_desc
00870 Tb_entry_ipc_sfl::snd_desc() const
00871 { return _snd_desc; }
00872
00873
00874
00875 inline L4_rcv_desc
00876 Tb_entry_ipc_sfl::rcv_desc() const
00877 { return _rcv_desc; }
00878
00879
00880
00881 inline Global_id
00882 Tb_entry_ipc_sfl::dst() const
00883 { return _dst; }
00884
00885
00886
00887 inline Unsigned8
00888 Tb_entry_ipc_sfl::is_irq() const
00889 { return _is_irq; }
00890
00891
00892
00893 inline Unsigned8
00894 Tb_entry_ipc_sfl::snd_lst() const
00895 { return _snd_lst; }
00896
00897
00898
00899 inline Unsigned8
00900 Tb_entry_ipc_sfl::dst_ok() const
00901 { return _dst_ok; }
00902
00903
00904
00905 inline Unsigned8
00906 Tb_entry_ipc_sfl::dst_lck() const
00907 { return _dst_lck; }
00908
00909
00910
00911 inline Unsigned8
00912 Tb_entry_ipc_sfl::preempt() const
00913 { return _preempt; }
00914
00915
00916
00917 inline void
00918 Tb_entry_pf::set(Context *ctx, Address ip, Address pfa,
00919 Mword error, Space *spc)
00920 {
00921 set_global(Tbuf_pf, ctx, ip);
00922 _pfa = pfa;
00923 _error = error;
00924 _space = spc;
00925 }
00926
00927
00928
00929 inline Mword
00930 Tb_entry_pf::error() const
00931 { return _error; }
00932
00933
00934
00935 inline Address
00936 Tb_entry_pf::pfa() const
00937 { return _pfa; }
00938
00939
00940
00941 inline Space*
00942 Tb_entry_pf::space() const
00943 { return _space; }
00944
00945
00946
00947 inline void
00948 Tb_entry_pf_res::set(Context *ctx, Address ip, Address pfa,
00949 Ipc_err err, Ipc_err ret)
00950 {
00951 set_global(Tbuf_pf_res, ctx, ip);
00952 _pfa = pfa;
00953 _err = err;
00954 _ret = ret;
00955 }
00956
00957
00958
00959 inline Address
00960 Tb_entry_pf_res::pfa() const
00961 { return _pfa; }
00962
00963
00964
00965 inline Ipc_err
00966 Tb_entry_pf_res::err() const
00967 { return _err; }
00968
00969
00970
00971 inline Ipc_err
00972 Tb_entry_pf_res::ret() const
00973 { return _ret; }
00974
00975
00976
00977 inline void
00978 Tb_entry_ke::set(Context *ctx, Address ip)
00979 { set_global(Tbuf_ke, ctx, ip); }
00980
00981
00982
00983 inline void
00984 Tb_entry_ke::set_const(Context *ctx, Address ip, const char * const msg)
00985 {
00986 set_global(Tbuf_ke, ctx, ip);
00987 _msg[0] = 0; _msg[1] = 1;
00988 *(char const ** const)(_msg + 3) = msg;
00989 }
00990
00991
00992
00993 inline void
00994 Tb_entry_ke::set_buf(unsigned i, char c)
00995 {
00996 if (i < sizeof(_msg)-1)
00997 _msg[i] = c >= ' ' ? c : '.';
00998 }
00999
01000
01001
01002 inline void
01003 Tb_entry_ke::term_buf(unsigned i)
01004 { _msg[i < sizeof(_msg)-1 ? i : sizeof(_msg)-1] = '\0'; }
01005
01006
01007
01008 inline const char *
01009 Tb_entry_ke::msg() const
01010 {
01011 return _msg[0] == 0 && _msg[1] == 1
01012 ? *(char const ** const)(_msg + 3) : _msg;
01013 }
01014
01015
01016
01017 inline void
01018 Tb_entry_unmap::set(Context *ctx, Address ip,
01019 L4_fpage fpage, Mword mask, bool result)
01020 {
01021 set_global(Tbuf_unmap, ctx, ip);
01022 _fpage = fpage;
01023 _mask = mask;
01024 _result = result;
01025 }
01026
01027
01028
01029 inline L4_fpage
01030 Tb_entry_unmap::fpage() const
01031 { return _fpage; }
01032
01033
01034
01035 inline Mword
01036 Tb_entry_unmap::mask() const
01037 { return _mask; }
01038
01039
01040
01041 inline bool
01042 Tb_entry_unmap::result() const
01043 { return _result; }
01044
01045
01046
01047 inline void
01048 Tb_entry_ex_regs::set(Context *ctx, Address ip, Sys_ex_regs_frame *regs,
01049 Address old_sp, Address old_ip, Mword failed)
01050 {
01051 set_global(Tbuf_exregs, ctx, ip);
01052 _lthread = regs->lthread();
01053 _task = regs->task();
01054 _old_sp = old_sp; _new_sp = regs->sp();
01055 _old_ip = old_ip; _new_ip = regs->ip();
01056 _failed = failed;
01057 }
01058
01059
01060
01061 inline Mword
01062 Tb_entry_ex_regs::lthread() const
01063 { return _lthread; }
01064
01065
01066
01067 inline Mword
01068 Tb_entry_ex_regs::task() const
01069 { return _task; }
01070
01071
01072
01073 inline Address
01074 Tb_entry_ex_regs::old_sp() const
01075 { return _old_sp; }
01076
01077
01078
01079 inline Address
01080 Tb_entry_ex_regs::new_sp() const
01081 { return _new_sp; }
01082
01083
01084
01085 inline Address
01086 Tb_entry_ex_regs::old_ip() const
01087 { return _old_ip; }
01088
01089
01090
01091 inline Address
01092 Tb_entry_ex_regs::new_ip() const
01093 { return _new_ip; }
01094
01095
01096
01097 inline Mword
01098 Tb_entry_ex_regs::failed() const
01099 { return _failed; }
01100
01101
01102
01103 inline void
01104 Tb_entry_task_new::set(Context *ctx, Address ip, Sys_task_new_frame *regs)
01105 {
01106 set_global (Tbuf_task_new, ctx, ip);
01107 _task = regs->dst();
01108 _pager = regs->pager();
01109 _new_sp = regs->sp();
01110 _new_ip = regs->ip();
01111 _mcp_or_chief = regs->mcp();
01112 }
01113
01114
01115
01116 inline Global_id
01117 Tb_entry_task_new::task()
01118 { return _task; }
01119
01120
01121
01122 inline Global_id
01123 Tb_entry_task_new::pager()
01124 { return _pager; }
01125
01126
01127
01128 inline Address
01129 Tb_entry_task_new::new_sp()
01130 { return _new_sp; }
01131
01132
01133
01134 inline Address
01135 Tb_entry_task_new::new_ip()
01136 { return _new_ip; }
01137
01138
01139
01140 inline Mword
01141 Tb_entry_task_new::mcp_or_chief()
01142 { return _mcp_or_chief; }
01143
01144
01145
01146 inline void
01147 Tb_entry_bp::set(Context *ctx, Address ip,
01148 int mode, int len, Mword value, Address address)
01149 {
01150 set_global(Tbuf_breakpoint, ctx, ip);
01151 _mode = mode;
01152 _len = len;
01153 _value = value;
01154 _address = address;
01155 }
01156
01157
01158
01159 inline int
01160 Tb_entry_bp::mode() const
01161 { return _mode; }
01162
01163
01164
01165 inline int
01166 Tb_entry_bp::len() const
01167 { return _len; }
01168
01169
01170
01171 inline Mword
01172 Tb_entry_bp::value() const
01173 { return _value; }
01174
01175
01176
01177 inline Address
01178 Tb_entry_bp::addr() const
01179 { return _address; }
01180
01181
01182
01183 inline void
01184 Tb_entry_ctx_sw::set(Context *ctx, Space *from_space, Address ip,
01185 Context *dst, Context *dst_orig, Mword lock_cnt,
01186 Sched_context *from_sched, Mword from_prio,
01187 Address kernel_ip)
01188 {
01189 set_global(Tbuf_context_switch, ctx, ip);
01190 _kernel_ip = kernel_ip;
01191 _dst = dst;
01192 _dst_orig = dst_orig;
01193 _lock_cnt = lock_cnt;
01194 _from_space = from_space;
01195 _from_sched = from_sched;
01196 _from_prio = from_prio;
01197 }
01198
01199
01200
01201 inline Space*
01202 Tb_entry_ctx_sw::from_space() const
01203 { return _from_space; }
01204
01205
01206
01207 inline Address
01208 Tb_entry_ctx_sw::kernel_ip() const
01209 { return _kernel_ip; }
01210
01211
01212
01213 inline Mword
01214 Tb_entry_ctx_sw::lock_cnt() const
01215 { return _lock_cnt; }
01216
01217
01218
01219 inline Context*
01220 Tb_entry_ctx_sw::dst() const
01221 { return _dst; }
01222
01223
01224
01225 inline Context*
01226 Tb_entry_ctx_sw::dst_orig() const
01227 { return _dst_orig; }
01228
01229
01230
01231 inline Mword
01232 Tb_entry_ctx_sw::from_prio() const
01233 { return _from_prio; }
01234
01235
01236
01237 inline Sched_context*
01238 Tb_entry_ctx_sw::from_sched() const
01239 { return _from_sched; }
01240
01241
01242
01243 inline void
01244 Tb_entry_sched::set(Context *ctx, Address ip, unsigned short mode,
01245 Context *owner, unsigned short id, unsigned short prio,
01246 signed long left, unsigned long quantum)
01247 {
01248 set_global (Tbuf_sched, ctx, ip);
01249 _mode = mode;
01250 _owner = owner;
01251 _id = id;
01252 _prio = prio;
01253 _left = left;
01254 _quantum = quantum;
01255 }
01256
01257
01258
01259 inline unsigned short
01260 Tb_entry_sched::mode() const
01261 { return _mode; }
01262
01263
01264
01265 inline Context *
01266 Tb_entry_sched::owner() const
01267 { return _owner; }
01268
01269
01270
01271 inline unsigned short
01272 Tb_entry_sched::id() const
01273 { return _id; }
01274
01275
01276
01277 inline unsigned short
01278 Tb_entry_sched::prio() const
01279 { return _prio; }
01280
01281
01282
01283 inline unsigned long
01284 Tb_entry_sched::quantum() const
01285 { return _quantum; }
01286
01287
01288
01289 inline signed long
01290 Tb_entry_sched::left() const
01291 { return _left; }
01292
01293
01294
01295 inline void
01296 Tb_entry_preemption::set(Context *ctx, Context *preempter, Address ip)
01297 {
01298 set_global (Tbuf_preemption, ctx, ip);
01299 _preempter = preempter;
01300 };
01301
01302
01303
01304 inline Context*
01305 Tb_entry_preemption::preempter() const
01306 { return _preempter; }
01307
01308
01309
01310 inline void
01311 Tb_entry_lipc::set(Context *tid, Address ip, unsigned short type,
01312 Global_id old_thread, Global_id new_thread,
01313 Address current_utcb_ptr)
01314 {
01315 set_global(Tbuf_lipc, tid, ip);
01316 _type = type;
01317 _new = new_thread;
01318 _old = old_thread;
01319 _c_utcb_ptr = current_utcb_ptr;
01320 }
01321
01322
01323
01324 inline unsigned short
01325 Tb_entry_lipc::type() const
01326 { return _type; }
01327
01328
01329
01330 inline Global_id
01331 Tb_entry_lipc::old_thread() const
01332 { return _old; }
01333
01334
01335
01336 inline Global_id
01337 Tb_entry_lipc::new_thread() const
01338 { return _new; }
01339
01340
01341
01342 inline Address
01343 Tb_entry_lipc::c_utcb_ptr() const
01344 { return _c_utcb_ptr; }
01345
01346
01347
01348 inline void
01349 Tb_entry_jean1::set(Context *tid, Address ip,
01350 Context *sched_owner1, Context *sched_owner2)
01351 {
01352 set_global(Tbuf_jean1, tid, ip);
01353 _sched_owner1 = sched_owner1;
01354 _sched_owner2 = sched_owner2;
01355 }
01356
01357
01358
01359 inline Context*
01360 Tb_entry_jean1::sched_owner1()
01361 { return _sched_owner1; }
01362
01363
01364
01365 inline Context*
01366 Tb_entry_jean1::sched_owner2()
01367 { return _sched_owner2; }
01368
01369
01370
01371 inline void
01372 Tb_entry_ke_reg::set(Context *ctx, Mword eip, Mword v1, Mword v2, Mword v3)
01373 {
01374 set_global(Tbuf_ke_reg, ctx, eip);
01375 _eax = v1; _ecx = v2; _edx = v3;
01376 }
01377
01378
01379
01380 inline void
01381 Tb_entry_ke_reg::set(Context *ctx, Mword eip, Trap_state *ts)
01382 { set(ctx, eip, ts->eax, ts->ecx, ts->edx); }
01383
01384
01385
01386 inline void
01387 Tb_entry_ke_reg::set_const(Context *ctx, Mword eip, const char * const msg,
01388 Mword eax, Mword ecx, Mword edx)
01389 {
01390 set(ctx, eip, eax, ecx, edx);
01391 _msg[0] = 0; _msg[1] = 1;
01392 *(char const ** const)(_msg + 3) = msg;
01393 }
01394
01395
01396
01397 inline void
01398 Tb_entry_ke_reg::set_buf(unsigned i, char c)
01399 {
01400 if (i < sizeof(_msg)-1)
01401 _msg[i] = c >= ' ' ? c : '.';
01402 }
01403
01404
01405
01406 inline void
01407 Tb_entry_ke_reg::term_buf(unsigned i)
01408 { _msg[i < sizeof(_msg)-1 ? i : sizeof(_msg)-1] = '\0'; }
01409
01410
01411
01412 inline const char *
01413 Tb_entry_ke_reg::msg() const
01414 {
01415 return _msg[0] == 0 && _msg[1] == 1
01416 ? *(char const ** const)(_msg + 3) : _msg;
01417 }
01418
01419
01420
01421 inline Mword
01422 Tb_entry_ke_reg::val1() const
01423 { return _eax; }
01424
01425
01426
01427 inline Mword
01428 Tb_entry_ke_reg::val2() const
01429 { return _ecx; }
01430
01431
01432
01433 inline Mword
01434 Tb_entry_ke_reg::val3() const
01435 { return _edx; }
01436
01437
01438
01439 inline void
01440 Tb_entry_trap::set(Context *ctx, Mword eip, Trap_state *ts)
01441 {
01442 set_global(Tbuf_trap, ctx, eip);
01443 _trapno = ts->trapno;
01444 _errno = ts->err;
01445 _edx = ts->edx;
01446 _cr2 = ts->cr2;
01447 _eax = ts->eax;
01448 _cs = (Unsigned16)ts->cs;
01449 _ds = (Unsigned16)ts->ds;
01450 _esp = ts->esp;
01451 _eflags = ts->eflags;
01452 }
01453
01454
01455
01456 inline void
01457 Tb_entry_trap::set(Context *ctx, Mword eip, Mword trapno)
01458 {
01459 set_global(Tbuf_trap, ctx, eip);
01460 _trapno = trapno | 0x80;
01461 }
01462
01463
01464
01465 inline char
01466 Tb_entry_trap::trapno() const
01467 { return _trapno; }
01468
01469
01470
01471 inline Unsigned16
01472 Tb_entry_trap::errno() const
01473 { return _errno; }
01474
01475
01476
01477 inline Mword
01478 Tb_entry_trap::eax() const
01479 { return _eax; }
01480
01481
01482
01483 inline Mword
01484 Tb_entry_trap::cr2() const
01485 { return _cr2; }
01486
01487
01488
01489 inline Mword
01490 Tb_entry_trap::edx() const
01491 { return _edx; }
01492
01493
01494
01495 inline Mword
01496 Tb_entry_trap::ebp() const
01497 { return _ebp; }
01498
01499
01500
01501 inline Unsigned16
01502 Tb_entry_trap::cs() const
01503 { return _cs; }
01504
01505
01506
01507 inline Unsigned16
01508 Tb_entry_trap::ds() const
01509 { return _ds; }
01510
01511
01512
01513 inline Mword
01514 Tb_entry_trap::sp() const
01515 { return _esp; }
01516
01517
01518
01519 inline Mword
01520 Tb_entry_trap::flags() const
01521 { return _eflags; }
01522
01523 #endif // tb_entry_h