Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197608
b: refs/heads/master
c: 0564ee8
h: refs/heads/master
v: v3
  • Loading branch information
Alexander Graf authored and Avi Kivity committed Apr 25, 2010
1 parent 3acbdb6 commit 9f00580
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dba2e123e7502870c965e4b445554bc8e56f78b2
refs/heads/master: 0564ee8a8611326f28bae2a0455182b458826762
33 changes: 33 additions & 0 deletions trunk/arch/powerpc/include/asm/kvm_ppc.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,39 @@ extern void kvmppc_booke_exit(void);

extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu);

/*
* Cuts out inst bits with ordering according to spec.
* That means the leftmost bit is zero. All given bits are included.
*/
static inline u32 kvmppc_get_field(u64 inst, int msb, int lsb)
{
u32 r;
u32 mask;

BUG_ON(msb > lsb);

mask = (1 << (lsb - msb + 1)) - 1;
r = (inst >> (63 - lsb)) & mask;

return r;
}

/*
* Replaces inst bits with ordering according to spec.
*/
static inline u32 kvmppc_set_field(u64 inst, int msb, int lsb, int value)
{
u32 r;
u32 mask;

BUG_ON(msb > lsb);

mask = ((1 << (lsb - msb + 1)) - 1) << (63 - lsb);
r = (inst & ~mask) | ((value << (63 - lsb)) & mask);

return r;
}

#ifdef CONFIG_PPC_BOOK3S

/* We assume we're always acting on the current vcpu */
Expand Down

0 comments on commit 9f00580

Please sign in to comment.