Add missing "volatile" to "asm" statements
This commit is contained in:
parent
31588b871e
commit
dda7db273d
|
@ -26,7 +26,7 @@ int heap_memory_used = 0;
|
||||||
long time()
|
long time()
|
||||||
{
|
{
|
||||||
int cycles;
|
int cycles;
|
||||||
asm("rdcycle %0" : "=r"(cycles));
|
asm volatile ("rdcycle %0" : "=r"(cycles));
|
||||||
// printf("[time() -> %d]", cycles);
|
// printf("[time() -> %d]", cycles);
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ long time()
|
||||||
long insn()
|
long insn()
|
||||||
{
|
{
|
||||||
int insns;
|
int insns;
|
||||||
asm("rdinstret %0" : "=r"(insns));
|
asm volatile ("rdinstret %0" : "=r"(insns));
|
||||||
// printf("[insn() -> %d]", insns);
|
// printf("[insn() -> %d]", insns);
|
||||||
return insns;
|
return insns;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ char *malloc(int size)
|
||||||
// printf("[malloc(%d) -> %d (%d..%d)]", size, (int)p, heap_memory_used, heap_memory_used + size);
|
// printf("[malloc(%d) -> %d (%d..%d)]", size, (int)p, heap_memory_used, heap_memory_used + size);
|
||||||
heap_memory_used += size;
|
heap_memory_used += size;
|
||||||
if (heap_memory_used > 1024)
|
if (heap_memory_used > 1024)
|
||||||
asm("ebreak");
|
asm volatile ("ebreak");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ static void stats_print_dec(unsigned int val, int digits, bool zero_pad)
|
||||||
void stats(void)
|
void stats(void)
|
||||||
{
|
{
|
||||||
unsigned int num_cycles, num_instr;
|
unsigned int num_cycles, num_instr;
|
||||||
__asm__("rdcycle %0; rdinstret %1;" : "=r"(num_cycles), "=r"(num_instr));
|
__asm__ volatile ("rdcycle %0; rdinstret %1;" : "=r"(num_cycles), "=r"(num_instr));
|
||||||
print_str("Cycle counter ........");
|
print_str("Cycle counter ........");
|
||||||
stats_print_dec(num_cycles, 8, false);
|
stats_print_dec(num_cycles, 8, false);
|
||||||
print_str("\nInstruction counter ..");
|
print_str("\nInstruction counter ..");
|
||||||
|
|
Loading…
Reference in New Issue