svc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "common/common_types.h"
  6. ////////////////////////////////////////////////////////////////////////////////////////////////////
  7. // SVC types
  8. struct MemoryInfo {
  9. u32 base_address;
  10. u32 size;
  11. u32 permission;
  12. u32 state;
  13. };
  14. struct PageInfo {
  15. u32 flags;
  16. };
  17. enum ResetType {
  18. RESETTYPE_ONESHOT,
  19. RESETTYPE_STICKY,
  20. RESETTYPE_PULSE,
  21. RESETTYPE_MAX_BIT = (1u << 31),
  22. };
  23. enum ArbitrationType {
  24. ARBITRATIONTYPE_SIGNAL,
  25. ARBITRATIONTYPE_WAIT_IF_LESS_THAN,
  26. ARBITRATIONTYPE_DECREMENT_AND_WAIT_IF_LESS_THAN,
  27. ARBITRATIONTYPE_WAIT_IF_LESS_THAN_WITH_TIMEOUT,
  28. ARBITRATIONTYPE_DECREMENT_AND_WAIT_IF_LESS_THAN_WITH_TIMEOUT,
  29. ARBITRATIONTYPE_MAX_BIT = (1u << 31)
  30. };
  31. ////////////////////////////////////////////////////////////////////////////////////////////////////
  32. // Namespace SVC
  33. namespace SVC {
  34. /// Values accepted by svcGetSystemInfo's type parameter.
  35. enum class SystemInfoType {
  36. /**
  37. * Reports total used memory for all regions or a specific one, according to the extra
  38. * parameter. See `SystemInfoMemUsageRegion`.
  39. */
  40. REGION_MEMORY_USAGE = 0,
  41. /**
  42. * Returns the memory usage for certain allocations done internally by the kernel.
  43. */
  44. KERNEL_ALLOCATED_PAGES = 2,
  45. /**
  46. * "This returns the total number of processes which were launched directly by the kernel.
  47. * For the ARM11 NATIVE_FIRM kernel, this is 5, for processes sm, fs, pm, loader, and pxi."
  48. */
  49. KERNEL_SPAWNED_PIDS = 26,
  50. };
  51. /**
  52. * Accepted by svcGetSystemInfo param with REGION_MEMORY_USAGE type. Selects a region to query
  53. * memory usage of.
  54. */
  55. enum class SystemInfoMemUsageRegion {
  56. ALL = 0,
  57. APPLICATION = 1,
  58. SYSTEM = 2,
  59. BASE = 3,
  60. };
  61. void CallSVC(u32 immediate);
  62. } // namespace