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

Function dump_ram

payloads/coreinfo/ramdump_module.c:15–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15static void dump_ram(WINDOW *win, uint32_t addr, int row, int col)
16{
17 int i, x = 0, y = 0, count = 0;
18 volatile uint8_t *ptr = (void *)(addr);
19
20 mvwprintw(win, 0, col + 54, "RAM address: 0x%08x", addr);
21
22 /* Dump 256 bytes of RAM. */
23 for (i = 1; i < 257; i++) {
24 if (x == 0) {
25 mvwprintw(win, row + y, col - 1, "%08x", addr + 16 * y);
26 mvwaddch(win, row + y, col + 59, '|');
27 mvwaddch(win, row + y, col + 76, '|');
28 }
29 mvwprintw(win, row + y, col + x + 9, "%02x", ptr[i - 1]);
30 mvwprintw(win, row + y, 62 + count++, "%c",
31 isprint(ptr[i - 1]) ? ptr[i - 1] : ' ');
32 x += 3;
33 if (x == 24) /* One more space after column/byte 8. */
34 x++;
35 if (i % 16 == 0) {
36 y++; /* Start a newline after 16 bytes. */
37 x = count = 0;
38 }
39 }
40}
41
42static int ramdump_module_redraw(WINDOW *win)
43{

Callers 1

ramdump_module_redrawFunction · 0.85

Calls 3

mvwaddchFunction · 0.85
mvwprintwFunction · 0.50
isprintFunction · 0.50

Tested by

no test coverage detected