2 typedef __builtin_msr_t msr_t;
4 static msr_t rdmsr(unsigned long index)
6 return __builtin_rdmsr(index);
9 static void uart_tx_byte(unsigned char data)
11 while(!(__builtin_inb(0x3f8 + 0x05) & 0x20))
13 __builtin_outb(data, 0x3f8 + 0x00);
15 while(!(__builtin_inb(0x3f8 + 0x05) & 0x40))
20 static void print_nibble(unsigned nibble)
30 static void print_debug_hex32(unsigned int value)
32 print_nibble((value >> 28U) & 0x0fU);
33 print_nibble((value >> 24U) & 0x0fU);
34 print_nibble((value >> 20U) & 0x0fU);
35 print_nibble((value >> 16U) & 0x0fU);
36 print_nibble((value >> 12U) & 0x0fU);
37 print_nibble((value >> 8U) & 0x0fU);
38 print_nibble((value >> 4U) & 0x0fU);
39 print_nibble(value & 0x0fU);
42 static void print_debug(const char *str)
45 while((ch = *str++) != '\0') {
50 static void main(void)
52 unsigned long start, stop;
54 msr = rdmsr(0xC001001A);
55 print_debug("TOP_MEM: ");
56 print_debug_hex32(msr.hi);
57 print_debug_hex32(msr.lo);
62 print_debug("Testing DRAM : ");
63 print_debug_hex32(start);
65 print_debug_hex32(stop);
68 print_debug("DRAM verify: ");
69 print_debug_hex32(start);
70 print_debug_hex32(stop);