blob: 3dbe475764f3cbfef1b2e388f41c8c281b743ef2 [file] [log] [blame]
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdint.h>
#include <string>
#include <utility>
#include <base/files/file_path.h>
namespace vm_tools {
namespace pstore_dump {
// From fs/pstore/ram_core.c
* struct persistent_ram_buffer - persistent circular RAM buffer
* @sig:
* signature to indicate header (PERSISTENT_RAM_SIG xor PRZ-type value)
* @start:
* offset into @data where the beginning of the stored bytes begin
* @size:
* number of valid bytes stored in @data
struct persistent_ram_buffer {
uint32_t sig;
uint32_t start;
uint32_t size;
uint8_t data[0];
// From fs/pstore/ram_core.c
#define PERSISTENT_RAM_SIG (0x43474244) /* DBGC */
const persistent_ram_buffer* FindPersistentRamBufferForConsoleOutput(
const void* pstore, size_t pstore_size);
bool GetPersistentRamBufferContent(const persistent_ram_buffer* buf,
size_t buf_capacity,
std::string* out_content);
bool HandlePstore(const base::FilePath& path);
} // namespace pstore_dump
} // namespace vm_tools