1. A method of controlling branch prediction logic in a data processing system, the method comprising: saving a first state of branch prediction logic in a processing core in response to a first hypervisor-mode instruction executed by the processing core for a hypervisor resident in the data processing system, wherein saving the first state of the branch prediction logic is performed in association with a context switch away from the hypervisor; restoring the first state of the branch prediction logic in response to a second hypervisor-mode instruction executed by the processing core for the hypervisor, wherein restoring the first state of the branch prediction is performed in association with a context switch to the hypervisor; saving a second state of the branch prediction logic in response to a third guest-mode or user-mode instruction executed by the processing core for a program hosted by the hypervisor, wherein the program is a guest operating system or a user process, and wherein saving the second state of the branch prediction logic is performed in association with a context switch away from the program; and restoring the second state of the branch prediction logic in response to a fourth guest-mode or user-mode instruction executed by the processing core for the program hosted by the hypervisor, wherein restoring the second state of the branch prediction is performed in association with a context switch to the program.