diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2016-06-20 14:39:49 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2016-06-20 14:39:49 +0100 |
commit | 37bb0d0fb30a3548173253b0f19861a7ee4f8fce (patch) | |
tree | ee2e89b4a804e4bcaca76c0f38a359c1f5bab3c0 /src/kern/linux/helpers.hh | |
parent | 60fb5e79f358b7d0784e4cfae4df9ec196e47f19 (diff) | |
download | gem5-37bb0d0fb30a3548173253b0f19861a7ee4f8fce.tar.xz |
kern, arm: Dump dmesg on kernel panic/oops
Add helper functions to dump the guest kernel's dmesg buffer to a text
file in m5out. This functionality is split into two parts. First, a
dmesg dump function that can be used in other places:
void Linux::dumpDmesg(ThreadContext *, std::ostream &)
This function is used to implement two PCEvents: DmesgDumpEvent and
KernelPanic event. The only difference between the two is that the
latter produces a gem5 panic instead of a warning in addition to
dumping the kernel log.
Change-Id: I6d2af1d666ace57124089648ea906f6c787ac63c
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Gabor Dozsa <gabor.dozsa@arm.com>
Diffstat (limited to 'src/kern/linux/helpers.hh')
-rw-r--r-- | src/kern/linux/helpers.hh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/kern/linux/helpers.hh b/src/kern/linux/helpers.hh new file mode 100644 index 000000000..cebda7da1 --- /dev/null +++ b/src/kern/linux/helpers.hh @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Andreas Sandberg + */ + +#ifndef __KERN_LINUX_HELPERS_HH__ +#define __KERN_LINUX_HELPERS_HH__ + +#include <ostream> + +class ThreadContext; + +namespace Linux { + +/** + * Dump Linux's dmesg log buffer to the an output stream. + * + * @warn This assumes that the kernel address mappings are available + * to the translating proxy. + */ +void dumpDmesg(ThreadContext *tc, std::ostream &os); + +} // namespace Linux + +#endif // __KERN_LINUX_HELPERS_HH__ |