MCPcopy Create free account
hub / github.com/coreboot/coreboot / gdb_message_encode_bytes

Function gdb_message_encode_bytes

payloads/libpayload/gdb/transport.c:77–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75/* Message encode/decode functions (must access whole aligned words for MMIO) */
76
77void gdb_message_encode_bytes(struct gdb_message *message, const void *data,
78 int length)
79{
80 die_if(message->used + length * 2 > message->size, OUTPUT_OVERRUN_MSG);
81 const mmio_word_t *aligned =
82 (mmio_word_t *)ALIGN_DOWN((uintptr_t)data, sizeof(*aligned));
83 mmio_word_t word = be32toh(readl(aligned++));
84 while (length--) {
85 u8 byte = (word >> ((((void *)aligned - data) - 1) * 8));
86 message->buf[message->used++] = to_hex(byte >> 4);
87 message->buf[message->used++] = to_hex(byte & 0xf);
88 if (length && ++data == (void *)aligned)
89 word = be32toh(readl(aligned++));
90 }
91}
92
93void gdb_message_decode_bytes(const struct gdb_message *message, int offset,
94 void *data, int length)

Callers 8

gdb_arch_encode_regsFunction · 0.85
gdb_arch_encode_regsFunction · 0.85
gdb_arch_encode_regsFunction · 0.85
gdb_get_last_signalFunction · 0.85
gdb_read_memoryFunction · 0.85
gdb_command_loopFunction · 0.85
gdb_output_writeFunction · 0.85
gdb_exitFunction · 0.85

Calls 2

to_hexFunction · 0.85
readlFunction · 0.50

Tested by

no test coverage detected