42 #include "arch/isa_traits.hh" 43 #include "config/the_isa.hh" 62 const size_t max_length = end -
base;
65 if (max_length <
sizeof(de)) {
66 warn(
"Malformed dmesg entry\n");
70 memcpy(&de, base,
sizeof(de));
75 if (de.
len <
sizeof(de) ||
76 max_length < de.
len ||
79 warn(
"Malformed dmesg entry:\n");
80 warn(
"\tMax length: %i\n", max_length);
87 os.write((
char *)base +
sizeof(de), de.
text_len);
101 Addr addr_lb = 0, addr_lb_len = 0, addr_first = 0, addr_next = 0;
102 const bool found_symbols =
105 symtab->
findAddress(
"log_first_idx", addr_first) &&
108 if (!found_symbols) {
109 warn(
"Failed to find kernel dmesg symbols.\n");
113 uint32_t log_buf_len =
115 uint32_t log_first_idx =
117 uint32_t log_next_idx =
120 if (log_first_idx >= log_buf_len || log_next_idx >= log_buf_len) {
121 warn(
"dmesg pointers/length corrupted\n");
128 if (log_first_idx < log_next_idx) {
129 length = log_next_idx - log_first_idx;
130 if (length < 0 || length > log_buf.size()) {
131 warn(
"Unexpected dmesg buffer length\n");
136 const int length_2 = log_buf_len - log_first_idx;
137 if (length_2 < 0 || length_2 + log_next_idx > log_buf.size()) {
138 warn(
"Unexpected dmesg buffer length\n");
141 length = log_buf_len;
142 proxy.
readBlob(addr_lb + log_first_idx, log_buf.data(), length_2);
143 proxy.
readBlob(addr_lb, log_buf.data() + length_2, log_next_idx);
147 const uint8_t *cur = log_buf.data(), *end = log_buf.data() +
length;
void ccprintf(cp::Print &print)
virtual System * getSystemPtr()=0
T gtoh(T value, ByteOrder guest_byte_order)
struct DmesgEntry M5_ATTR_PACKED
void dumpDmesg(ThreadContext *tc, std::ostream &os)
Dump Linux's dmesg log buffer to the an output stream.
static int dumpDmesgEntry(const uint8_t *base, const uint8_t *end, const ByteOrder bo, std::ostream &os)
virtual PortProxy & getVirtProxy()=0
T read(Addr address) const
Read sizeof(T) bytes from address and return as object T.
ByteOrder getGuestByteOrder() const
Get the guest byte order.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
const ByteOrder GuestByteOrder
bool findAddress(const std::string &symbol, Addr &address) const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
SymbolTable * kernelSymtab
kernel symbol table
void readBlob(Addr addr, void *p, int size) const
Higher level interfaces based on the above.
This object is a proxy for a port or other object which implements the functional response protocol...
TranslatingPortProxy Object Declaration for FS.