uti: fix syscall response is mis-consumed by __do_in_kernel_irq_syscall

Refs: #1617
Change-Id: Iddd8ccd81d7f692f1f45ec888d31c2a87ec521ce
This commit is contained in:
Masamichi Takagi
2021-02-24 16:53:56 +09:00
committed by Masamichi Takagi
parent afea6af667
commit 35296c8210
2 changed files with 4 additions and 2 deletions

View File

@ -366,6 +366,7 @@ retry_alloc:
#define STATUS_IN_PROGRESS 0 #define STATUS_IN_PROGRESS 0
#define STATUS_SYSCALL 4 #define STATUS_SYSCALL 4
#define __NR_syscall_response 8001
req->valid = 0; req->valid = 0;
if (__notify_syscall_requester(usrdata->os, packet, resp) < 0) { if (__notify_syscall_requester(usrdata->os, packet, resp) < 0) {
@ -440,7 +441,7 @@ retry_alloc:
req->valid = 0; req->valid = 0;
/* check result */ /* check result */
if (req->number != __NR_mmap) { if (req->number != __NR_syscall_response) {
printk("%s:unexpected response. %lx %lx\n", printk("%s:unexpected response. %lx %lx\n",
__FUNCTION__, req->number, req->args[0]); __FUNCTION__, req->number, req->args[0]);
syscall_ret = -EIO; syscall_ret = -EIO;

View File

@ -244,6 +244,7 @@ long do_syscall(struct syscall_request *req, int cpu)
#define STATUS_COMPLETED 1 #define STATUS_COMPLETED 1
#define STATUS_PAGE_FAULT 3 #define STATUS_PAGE_FAULT 3
#define STATUS_SYSCALL 4 #define STATUS_SYSCALL 4
#define __NR_syscall_response 8001
while (smp_load_acquire(&res.status) != STATUS_COMPLETED) { while (smp_load_acquire(&res.status) != STATUS_COMPLETED) {
while (smp_load_acquire(&res.status) == STATUS_IN_PROGRESS) { while (smp_load_acquire(&res.status) == STATUS_IN_PROGRESS) {
struct cpu_local_var *v; struct cpu_local_var *v;
@ -372,7 +373,7 @@ long do_syscall(struct syscall_request *req, int cpu)
} }
/* send result */ /* send result */
req2.number = __NR_mmap; req2.number = __NR_syscall_response;
req2.args[1] = syscall_ret; req2.args[1] = syscall_ret;
/* The current thread is the requester and only the waiting thread /* The current thread is the requester and only the waiting thread
* may serve the request */ * may serve the request */