OK, I think I finally have it all sorted out. Sorry if I sounded dense along the way.. there were multiple variable, which increases the number of possible combinations quickly. The patch from Kirill is needed, and makes things better. One thing I notice with it is that we now handle TARGET_F_GETLK64 in two places, first in the case for TARGET_NR_fcntl64 (around line 4300), and then again in do_fcntl(), which is called in the default case of the first location. Once difference between the two locations is wether or not the case for EABI is handled. In addition to Kirill's patch, my original patch for target_eabi_flock64 is still needed as well as an expanded version of the revised patch I sent later that does target->host strcture mapping for the F_GETLK* cases. I have used the fcntl test sets out of the Linux Test Projects to measure with an without the different parts of these patches. With the entire set (Which is attached), 16 of the 18 test sets pass completely, and a significant portion of test14 (one of the two that don't pass completely) passes as well. The tests in test14 that fail may be do to a problem with a syscall other than fcntl(), but I haven't completely resulved it yet. Without my portion of the patch, the results are much worse (maybe half-ish are passing). There is something interesting about test18 (the other one that doesn't pass). It intentionally passes in a bad value (-1) as the 3rd argument to fcntl(). It is testing wether it will get EFAULT. With these fixes, qemu will SEGV as it tries to convert the struct flock (or struct flock64) from target->host, and encounters the bad address that was passed in. The initial SEGV is caught, but the handler for it then SEGVs again. Ideally, we could detect that we are inside an emulated system call, and be able to just return the EFAULT. I ran the LTP tests for both old ABI and EABI, and got the same results. Attached is the combined patch for fcntl(). Stuart Stuart R. Anderson anderson@netsweng.com Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149