Applied fence.i fix on memory write to v20171231 release
This commit is contained in:
parent
ab5a98663e
commit
0e2fc08c3b
|
@ -1408,6 +1408,30 @@ static int execute_fence(struct target *target)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int execute_fence_i(struct target *target)
|
||||||
|
{
|
||||||
|
struct riscv_program program;
|
||||||
|
riscv_program_init(&program, target);
|
||||||
|
riscv_program_fence_i(&program);
|
||||||
|
int result = riscv_program_exec(&program, target);
|
||||||
|
if (result != ERROR_OK)
|
||||||
|
LOG_ERROR("Unable to execute fence.i");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int execute_fences(struct target *target)
|
||||||
|
{
|
||||||
|
if (execute_fence(target) != ERROR_OK)
|
||||||
|
{
|
||||||
|
return ERROR_FAIL;
|
||||||
|
}
|
||||||
|
if (execute_fence_i(target) != ERROR_OK)
|
||||||
|
{
|
||||||
|
return ERROR_FAIL;
|
||||||
|
}
|
||||||
|
return ERROR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the requested memory, taking care to execute every read exactly once,
|
* Read the requested memory, taking care to execute every read exactly once,
|
||||||
* even if cmderr=busy is encountered.
|
* even if cmderr=busy is encountered.
|
||||||
|
@ -1822,7 +1846,7 @@ error:
|
||||||
if (register_write_direct(target, GDB_REGNO_S0, s0) != ERROR_OK)
|
if (register_write_direct(target, GDB_REGNO_S0, s0) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
if (execute_fence(target) != ERROR_OK)
|
if (execute_fences(target) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue