2
0

target_arch_vmparam.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * RISC-V VM parameters definitions
  3. *
  4. * Copyright (c) 2019 Mark Corbin
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef TARGET_ARCH_VMPARAM_H
  20. #define TARGET_ARCH_VMPARAM_H
  21. #include "cpu.h"
  22. /* Compare with riscv/include/vmparam.h */
  23. #define TARGET_MAXTSIZ (1 * GiB) /* max text size */
  24. #define TARGET_DFLDSIZ (128 * MiB) /* initial data size limit */
  25. #define TARGET_MAXDSIZ (1 * GiB) /* max data size */
  26. #define TARGET_DFLSSIZ (128 * MiB) /* initial stack size limit */
  27. #define TARGET_MAXSSIZ (1 * GiB) /* max stack size */
  28. #define TARGET_SGROWSIZ (128 * KiB) /* amount to grow stack */
  29. #define TARGET_VM_MINUSER_ADDRESS (0x0000000000000000UL)
  30. #define TARGET_VM_MAXUSER_ADDRESS (0x0000004000000000UL)
  31. #define TARGET_USRSTACK (TARGET_VM_MAXUSER_ADDRESS - TARGET_PAGE_SIZE)
  32. static inline abi_ulong get_sp_from_cpustate(CPURISCVState *state)
  33. {
  34. return state->gpr[xSP];
  35. }
  36. static inline void set_second_rval(CPURISCVState *state, abi_ulong retval2)
  37. {
  38. state->gpr[xA1] = retval2;
  39. }
  40. static inline abi_ulong get_second_rval(CPURISCVState *state)
  41. {
  42. return state->gpr[xA1];
  43. }
  44. #endif /* TARGET_ARCH_VMPARAM_H */