semihosting: Fix GDB File-I/O FLEN
fstat returns 0 on success and -1 on error. Since we have already
checked for error, ret must be zero. Therefore, any call to fstat on a
non-empty file will return -1/EOVERFLOW.
Restore the original logic that just did a byteswap. I don't really know
what the intention of the fixed commit was.
Fixes: a6300ed6b7 ("semihosting: Split out semihost_sys_flen")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20251027110344.2289945-36-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
parent
524fc77d23
commit
4f45b2c352
1 changed files with 1 additions and 4 deletions
|
|
@ -316,10 +316,7 @@ common_semi_flen_fstat_cb(CPUState *cs, uint64_t ret, int err)
|
||||||
&size, 8, 0)) {
|
&size, 8, 0)) {
|
||||||
ret = -1, err = EFAULT;
|
ret = -1, err = EFAULT;
|
||||||
} else {
|
} else {
|
||||||
size = be64_to_cpu(size);
|
ret = be64_to_cpu(size);
|
||||||
if (ret != size) {
|
|
||||||
ret = -1, err = EOVERFLOW;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
common_semi_cb(cs, ret, err);
|
common_semi_cb(cs, ret, err);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue