linux-user: Add debug code to exercise restarting system calls
If DEBUG_ERESTARTSYS is set restart all system calls once. This is pure debug code for exercising the syscall restart code paths in the per-architecture cpu main loops. Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk> Message-id: 1441497448-32489-10-git-send-email-T.E.Baldwin99@members.leeds.ac.uk [PMM: Add comment and a commented-out #define next to the commented-out generic DEBUG #define; remove the check on TARGET_USE_ERESTARTSYS; tweak comment message] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
parent
4134ecfeb9
commit
71a8f7fece
@ -110,6 +110,10 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
|
|||||||
CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
|
CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
|
||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
|
/* Define DEBUG_ERESTARTSYS to force every syscall to be restarted
|
||||||
|
* once. This exercises the codepaths for restart.
|
||||||
|
*/
|
||||||
|
//#define DEBUG_ERESTARTSYS
|
||||||
|
|
||||||
//#include <linux/msdos_fs.h>
|
//#include <linux/msdos_fs.h>
|
||||||
#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct linux_dirent [2])
|
#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct linux_dirent [2])
|
||||||
@ -5871,6 +5875,21 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
|||||||
struct statfs stfs;
|
struct statfs stfs;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
|
#if defined(DEBUG_ERESTARTSYS)
|
||||||
|
/* Debug-only code for exercising the syscall-restart code paths
|
||||||
|
* in the per-architecture cpu main loops: restart every syscall
|
||||||
|
* the guest makes once before letting it through.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
static int flag;
|
||||||
|
|
||||||
|
flag = !flag;
|
||||||
|
if (flag) {
|
||||||
|
return -TARGET_ERESTARTSYS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
gemu_log("syscall %d", num);
|
gemu_log("syscall %d", num);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user