kvm_booke.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License, version 2, as
  4. * published by the Free Software Foundation.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. *
  15. * Copyright SUSE Linux Products GmbH 2010
  16. *
  17. * Authors: Alexander Graf <agraf@suse.de>
  18. */
  19. #ifndef __ASM_KVM_BOOKE_H__
  20. #define __ASM_KVM_BOOKE_H__
  21. #include <linux/types.h>
  22. #include <linux/kvm_host.h>
  23. static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val)
  24. {
  25. vcpu->arch.gpr[num] = val;
  26. }
  27. static inline ulong kvmppc_get_gpr(struct kvm_vcpu *vcpu, int num)
  28. {
  29. return vcpu->arch.gpr[num];
  30. }
  31. static inline void kvmppc_set_cr(struct kvm_vcpu *vcpu, u32 val)
  32. {
  33. vcpu->arch.cr = val;
  34. }
  35. static inline u32 kvmppc_get_cr(struct kvm_vcpu *vcpu)
  36. {
  37. return vcpu->arch.cr;
  38. }
  39. static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, u32 val)
  40. {
  41. vcpu->arch.xer = val;
  42. }
  43. static inline u32 kvmppc_get_xer(struct kvm_vcpu *vcpu)
  44. {
  45. return vcpu->arch.xer;
  46. }
  47. static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu)
  48. {
  49. return vcpu->arch.last_inst;
  50. }
  51. static inline void kvmppc_set_ctr(struct kvm_vcpu *vcpu, ulong val)
  52. {
  53. vcpu->arch.ctr = val;
  54. }
  55. static inline ulong kvmppc_get_ctr(struct kvm_vcpu *vcpu)
  56. {
  57. return vcpu->arch.ctr;
  58. }
  59. static inline void kvmppc_set_lr(struct kvm_vcpu *vcpu, ulong val)
  60. {
  61. vcpu->arch.lr = val;
  62. }
  63. static inline ulong kvmppc_get_lr(struct kvm_vcpu *vcpu)
  64. {
  65. return vcpu->arch.lr;
  66. }
  67. static inline void kvmppc_set_pc(struct kvm_vcpu *vcpu, ulong val)
  68. {
  69. vcpu->arch.pc = val;
  70. }
  71. static inline ulong kvmppc_get_pc(struct kvm_vcpu *vcpu)
  72. {
  73. return vcpu->arch.pc;
  74. }
  75. static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
  76. {
  77. return vcpu->arch.fault_dear;
  78. }
  79. static inline ulong kvmppc_get_msr(struct kvm_vcpu *vcpu)
  80. {
  81. return vcpu->arch.shared->msr;
  82. }
  83. #endif /* __ASM_KVM_BOOKE_H__ */