Commit 50c08f8e authored by Max Filippov's avatar Max Filippov Committed by Chris Zankel

xtensa: ISS: fix specific simcalls

Simcalls that take memory buffer definitely need wmb or rmb to make sure
gcc doesn't optimize away code that fills the buffer.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Signed-off-by: default avatarChris Zankel <chris@zankel.net>
parent ddffeb8c
...@@ -78,8 +78,9 @@ static inline int __simc(int a, int b, int c, int d, int e, int f) ...@@ -78,8 +78,9 @@ static inline int __simc(int a, int b, int c, int d, int e, int f)
return ret; return ret;
} }
static inline int simc_open(char *file, int flags, int mode) static inline int simc_open(const char *file, int flags, int mode)
{ {
wmb();
return __simc(SYS_open, (int) file, flags, mode, 0, 0); return __simc(SYS_open, (int) file, flags, mode, 0, 0);
} }
...@@ -90,16 +91,19 @@ static inline int simc_close(int fd) ...@@ -90,16 +91,19 @@ static inline int simc_close(int fd)
static inline int simc_ioctl(int fd, int request, void *arg) static inline int simc_ioctl(int fd, int request, void *arg)
{ {
wmb();
return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0); return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0);
} }
static inline int simc_read(int fd, void *buf, size_t count) static inline int simc_read(int fd, void *buf, size_t count)
{ {
rmb();
return __simc(SYS_read, fd, (int) buf, count, 0, 0); return __simc(SYS_read, fd, (int) buf, count, 0, 0);
} }
static inline int simc_write(int fd, void *buf, size_t count) static inline int simc_write(int fd, const void *buf, size_t count)
{ {
wmb();
return __simc(SYS_write, fd, (int) buf, count, 0, 0); return __simc(SYS_write, fd, (int) buf, count, 0, 0);
} }
...@@ -107,6 +111,7 @@ static inline int simc_poll(int fd) ...@@ -107,6 +111,7 @@ static inline int simc_poll(int fd)
{ {
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
wmb();
return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv, return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv,
0, 0); 0, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment