60fillCopy(
void *dest,
size_t dest_size,
const void *src,
size_t src_size)
62 src_size = std::min(src_size, dest_size);
63 const size_t zero_size = dest_size - src_size;
65 uint8_t *pos = (uint8_t *)dest;
67 std::memcpy(pos, src, src_size);
70 std::memset(pos, 0, zero_size);
74fillCopy(
void *dest,
size_t dest_size,
const std::string &src)
76 fillCopy(dest, dest_size, src.c_str(), src.length());
85 for (
unsigned i = 0;
i < size; ++
i)
117 static_assert(
sizeof(
signature) - 1 ==
sizeof(
data->signature),
118 "signature length mismatch");
126 DPRINTF(ACPI,
"Allocated RSDT @ %llx\n",
data->rsdtAddress);
130 DPRINTF(ACPI,
"Allocated XSDT @ %llx\n",
data->xsdtAddress);
149 assert(
mem.size() >=
sizeof(
Mem));
154 DPRINTF(ACPI,
"Writing system description table [%llx - %llx]\n",
addr,
165 header->oemRevision =
p.oem_revision;
166 header->creatorID =
p.creator_id;
167 header->creatorRevision =
p.creator_revision;
194 auto base_size =
mem.size();
195 mem.resize(base_size +
sizeof(
Ptr) * entries.size());
197 Ptr* ptr_array =
reinterpret_cast<Ptr*
>(
mem.data() + base_size);
198 DPRINTF(ACPI,
"RXSDT: Writing %d entries (ptr size: %d)\n", entries.size(),
200 for (
const auto *entry : entries) {
201 Addr entry_addr = entry->write(phys_proxy, alloc);
203 "RXSDT: Entry address doesn't fit in pointer type.");
204 DPRINTF(ACPI,
"RXSDT: wrote entry @ %llx\n", entry_addr);
205 *ptr_array++ = entry_addr;
239 header->flags = params().flags;
241 for (
const auto& record : records) {
242 auto entry = record->prepare();
243 mem.insert(
mem.end(), entry.begin(), entry.end());
246 DPRINTF(ACPI,
"MADT: writing %d records (size: %d)\n",
247 records.size(),
mem.size());
255 assert(
mem.size() >=
sizeof(
Mem));
256 DPRINTF(ACPI,
"MADT: writing record type %d (size: %d)\n",
272 data->apicId = params().apic_id;
273 data->flags = params().flags;
286 data->ioApicAddress = params().address;
287 data->intBase = params().int_base;
300 data->irqSource = params().irq_source;
301 data->globalSystemInterrupt = params().sys_int;
302 data->flags = params().flags;
317 data->lintNo = params().lint_no;
This object is a proxy for a port or other object which implements the functional response protocol,...
void writeBlob(Addr addr, const void *p, uint64_t size) const
Same as tryWriteBlob, but insists on success.
Abstract superclass for simulation objects.
void prepareBuf(std::vector< uint8_t > &mem) const override
void prepareBuf(std::vector< uint8_t > &mem) const override
void prepareBuf(std::vector< uint8_t > &mem) const override
void prepareBuf(std::vector< uint8_t > &mem) const override
Addr writeBuf(PortProxy &phys_proxy, Allocator &alloc, std::vector< uint8_t > &mem) const override
void prepareBuf(std::vector< uint8_t > &mem) const override
virtual void prepareBuf(std::vector< uint8_t > &mem) const =0
static const char signature[]
Addr write(PortProxy &phys_proxy, Allocator &alloc) const
std::vector< SysDescTable * > entries
Addr writeBuf(PortProxy &phys_proxy, Allocator &alloc, std::vector< uint8_t > &mem) const override
RXSDT(const Params &p, const char *_signature, uint8_t _revision)
virtual Addr writeBuf(PortProxy &phys_proxy, Allocator &alloc, std::vector< uint8_t > &mem) const =0
Addr write(PortProxy &phys_proxy, Allocator &alloc) const
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
const Params & params() const
static uint8_t apic_checksum(uint8_t *ptr, std::size_t size)
static void fillCopy(void *dest, size_t dest_size, const void *src, size_t src_size)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
PortProxy Object Declaration.
virtual Addr alloc(std::size_t size, unsigned align=1)=0
Addr alloc(std::size_t size, unsigned align) override
uint64_t localAPICAddress
uint32_t localAPICAddress