sim-syscall.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Simulator system call support.
  2. Copyright 2002-2015 Free Software Foundation, Inc.
  3. This file is part of simulators.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef SIM_SYSCALL_H
  15. #define SIM_SYSCALL_H
  16. /* Perform a syscall on the behalf of the target program. The error/result are
  17. normalized into a single value (like a lot of operating systems do). If you
  18. want the split values, see the other function below.
  19. Note: While cb_syscall requires you handle the exit syscall yourself, that is
  20. not the case with these helpers.
  21. Note: Types here match the gdb callback interface. */
  22. long sim_syscall (SIM_CPU *, int func, long arg1, long arg2, long arg3,
  23. long arg4);
  24. /* Same as sim_syscall, but return the split values by referenced. */
  25. void sim_syscall_multi (SIM_CPU *, int func, long arg1, long arg2, long arg3,
  26. long arg4, long *result, long *result2, int *errcode);
  27. /* Simple memory callbacks for cb_syscall's read_mem/write_mem that assume
  28. cb_syscall's p1 and p2 are set to the SIM_DESC and SIM_CPU respectively. */
  29. int sim_syscall_read_mem (host_callback *, struct cb_syscall *, unsigned long,
  30. char *, int);
  31. int sim_syscall_write_mem (host_callback *, struct cb_syscall *, unsigned long,
  32. const char *, int);
  33. #endif