60 fillCopy(
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);
74 fillCopy(
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;
208 return SysDescTable::writeBuf(phys_proxy, alloc,
mem);
238 header->localAPICAddress = params().local_apic_address;
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",
271 data->acpiProcessorId = params().acpi_processor_id;
272 data->apicId = params().apic_id;
273 data->flags = params().flags;
285 data->ioApicId = params().id;
286 data->ioApicAddress = params().address;
287 data->intBase = params().int_base;
299 data->busSource = params().bus_source;
300 data->irqSource = params().irq_source;
301 data->globalSystemInterrupt = params().sys_int;
302 data->flags = params().flags;
314 data->acpiProcessorId = params().acpi_processor_id;
317 data->lintNo = params().lint_no;
329 data->localAPICAddress = params().address;