40 #include "arch/isa_traits.hh" 41 #include "config/the_isa.hh" 60 const size_t max_length = end -
base;
63 if (max_length <
sizeof(de)) {
64 warn(
"Malformed dmesg entry\n");
68 memcpy(&de, base,
sizeof(de));
73 if (de.
len <
sizeof(de) ||
74 max_length < de.
len ||
77 warn(
"Malformed dmesg entry:\n");
78 warn(
"\tMax length: %i\n", max_length);
85 os.write((
char *)base +
sizeof(de), de.
text_len);
99 auto lb = symtab->find(
"__log_buf");
100 auto lb_len = symtab->find(
"log_buf_len");
101 auto first = symtab->find(
"log_first_idx");
102 auto next = symtab->find(
"log_next_idx");
104 auto end_it = symtab->end();
106 if (lb == end_it || lb_len == end_it ||
107 first == end_it || next == end_it) {
108 warn(
"Failed to find kernel dmesg symbols.\n");
112 uint32_t log_buf_len =
114 uint32_t log_first_idx =
116 uint32_t log_next_idx =
119 if (log_first_idx >= log_buf_len || log_next_idx >= log_buf_len) {
120 warn(
"dmesg pointers/length corrupted\n");
127 if (log_first_idx < log_next_idx) {
128 length = log_next_idx - log_first_idx;
129 if (length < 0 || length > log_buf.size()) {
130 warn(
"Unexpected dmesg buffer length\n");
133 proxy.
readBlob(lb->address + log_first_idx, log_buf.data(),
length);
135 const int length_2 = log_buf_len - log_first_idx;
136 if (length_2 < 0 || length_2 + log_next_idx > log_buf.size()) {
137 warn(
"Unexpected dmesg buffer length\n");
140 length = log_buf_len;
141 proxy.
readBlob(lb->address + log_first_idx, log_buf.data(), length_2);
142 proxy.
readBlob(lb->address, log_buf.data() + length_2, log_next_idx);
146 const uint8_t *cur = log_buf.data(), *end = log_buf.data() +
length;
void ccprintf(cp::Print &print)
virtual System * getSystemPtr()=0
virtual const Loader::SymbolTable * symtab(ThreadContext *tc)=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...
PortProxy Object Declaration.
Workload * workload
OS kernel.
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...
const ByteOrder GuestByteOrder