00001
00002
00003 #ifndef jdb_ptab_i_h
00004 #define jdb_ptab_i_h
00005
00006 #include <cstdio>
00007
00008 #include "config.h"
00009 #include "jdb.h"
00010 #include "jdb_module.h"
00011 #include "jdb_screen.h"
00012 #include "jdb_table.h"
00013 #include "kernel_console.h"
00014 #include "kmem.h"
00015 #include "keycodes.h"
00016 #include "space.h"
00017 #include "static_init.h"
00018 #include "types.h"
00019
00020 #include "paging.h"
00021
00022 class Jdb_ptab_m : public Jdb_module
00023 {
00024 Task_num task;
00025 static char first_char;
00026
00027 public:
00028 Jdb_module::Action_code action(int cmd, void *&args, char const *&fmt, int &next_char);
00029
00030 Jdb_module::Cmd const *const cmds() const;
00031
00032 int const num_cmds() const;
00033
00034 Jdb_ptab_m();
00035 };
00036
00037 class Jdb_ptab : public Jdb_table
00038 {
00039 Address base;
00040 Address virt_base;
00041 int level;
00042 Task_num task;
00043 unsigned entries;
00044 unsigned char cur_pt_level;
00045 char dump_raw;
00046
00047 static unsigned max_pt_level;
00048
00049 static unsigned entry_valid(Mword entry, unsigned level);
00050 static unsigned entry_is_pt_ptr(Mword entry, unsigned level,
00051 unsigned *entries, unsigned *next_level);
00052 static Address entry_phys(Mword entry, unsigned level);
00053 static unsigned first_level_entries();
00054
00055 void print_entry(Mword entry, unsigned level);
00056
00057
00058 public:
00059
00060 Jdb_ptab(void *pt_base, Task_num task, unsigned char pt_level = 0, unsigned entries = 0, Address virt_base = 0, int level = 0);
00061
00062 unsigned col_width(unsigned) const;
00063
00064 unsigned cols() const;
00065
00066 void draw_entry(unsigned row, unsigned col);
00067
00068 void print_statline(unsigned row, unsigned col);
00069
00070 unsigned key_pressed(int c, unsigned &row, unsigned &col);
00071
00072 unsigned rows() const;
00073
00074 private:
00075 unsigned disp_virt_to_r(Address v);
00076
00077 unsigned disp_virt_to_c(Address v);
00078
00079 Address disp_virt(unsigned row, unsigned col);
00080
00081 Address virt(unsigned row, unsigned col);
00082 };
00083
00084
00085 typedef Mword My_pte;
00086
00087
00088
00089
00090
00091
00092
00093
00094 inline unsigned
00095 Jdb_ptab::entry_valid(Mword entry, unsigned)
00096 { return entry & Pt_entry::Valid; }
00097
00098
00099
00100 inline unsigned
00101 Jdb_ptab::entry_is_pt_ptr(Mword entry, unsigned level,
00102 unsigned *entries, unsigned *next_level)
00103 {
00104 if (level > 0 || entry & Pd_entry::Superpage)
00105 return 0;
00106 *entries = 1024;
00107 *next_level = 1;
00108 return 1;
00109 }
00110
00111
00112
00113 inline Address
00114 Jdb_ptab::entry_phys(Mword entry, unsigned)
00115 { return entry & Pt_entry::Pfn; }
00116
00117
00118
00119 inline unsigned
00120 Jdb_ptab::first_level_entries()
00121 { return 1024; }
00122
00123 #endif // jdb_ptab_i_h