# US 2021/0334122 A1 · Processor control register configuration support

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0334122 A1
- Document ID: US20210334122A1
- Status: Published application
- Kind: A1
- Application number: 16/857,455
- Filed: 2020-04-24
- Published: 2021-10-28
- Earliest claimed: 2020-04-24
- Assignees: Red Hat, Inc.
- Applicants: Red Hat, Inc.
- Inventors: Michael Tsirkin
- Web page: https://patentgrep.com/patent/US20210334122A1

## CPC

- G06F 9/45545: {Guest-host, i.e. hypervisor is an application program itself, e.g. VirtualBox}
- G06F 9/30101: {Special purpose registers}
- G06F 9/4406: {Loading of operating system}
- G06F 9/44505: {Configuring for program initiating, e.g. using registry, configuration files}
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 2009/45583: {Memory management, e.g. access or allocation}
- G06F 2009/45591: {Monitoring or debugging support}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system includes a memory, a processor, a control register, and a hypervisor. The hypervisor is configured to determine a fault resulting from a guest attempting to execute code on a memory page designated as non-executable. The hypervisor changes a configuration of the control register to an unlocked configuration based at least in part on the fault and designates the memory page as executable. A hypercall is received from the guest after booting a new operating system from the currently-executing operating system. The hypervisor is further configured to change the configuration of the control register to a locked configuration and designate the memory page as non-executable.

## Claims

### Claim 1

A system comprising:
a memory;
a processor in communication with the memory;
a control register in communication with the processor; and
a hypervisor configured to:
determine a fault resulting from a guest attempting to execute first code from a memory page designated as non-executable, wherein the first code is configured to cause a new operating system to boot from a currently-executing operating system;
change a configuration of the control register from a locked configuration to an unlocked configuration based at least in part on the fault;
change the memory page from non-executable to executable;
receive a hypercall from the guest after execution of the first code, the hypercall indicating that the control register has been configured by the guest after booting the new operating system;
change the configuration of the control register from the unlocked configuration to the locked configuration; and
change the memory page from executable to non-executable.

### Claim 2 (depends on 1)

The system of claim 1, wherein the hypervisor is further configured to:
determine that the memory page is a startup page, wherein the hypervisor is configured to change the configuration of the control register from the locked configuration to the unlocked configuration based at least in part on the determination that the memory page is the startup page.

### Claim 3 (depends on 1)

The system of claim 1, wherein the hypervisor is further configured to:
determine a first offset of an address on the memory page specified by the fault;
determine a second offset of the first code configured to cause the new operating system to boot from the currently-executing operating system;
determine that the first offset matches the second offset; and
change the configuration of the control register from the locked configuration to the unlocked configuration based at least in part on the determination that the first offset matches the second offset.

### Claim 4 (depends on 1)

The system of claim 1, wherein the hypervisor is further configured to:
pass control of the processor to the guest after changing the memory page from non-executable to executable, wherein the guest executes the first code at the address of the memory page.

### Claim 5 (depends on 1)

The system of claim 1, wherein the execution of the first code causes the new operating system to boot from a currently-executing operating system using kexec.

### Claim 6 (depends on 1)

The system of claim 1, wherein the control register is CR0 or CR4.

### Claim 7 (depends on 1)

The system of claim 1, wherein the hypervisor is further configured to determine whether the fault is associated with the memory page comprising a branch to kexec initialization code.

### Claim 8 (depends on 1)

The system of claim 1, wherein the fault is caused by the memory page being designated as non-executable.

### Claim 9

A method comprising:
determining, by a hypervisor, a fault resulting from a guest attempting to execute first code from a memory page designated as non-executable, wherein the first code is configured to cause a new operating system to boot from a currently-executing operating system;
changing, by the hypervisor, a configuration of a control register associated with a processor from a locked configuration to an unlocked configuration based at least in part on the fault;
changing, by the hypervisor, the memory page from non-executable to executable;
receiving, by the hypervisor from the guest after execution of the first code, a hypercall indicating that the control register has been configured by the guest after booting the new operating system;
changing, by the hypervisor, the configuration of the control register from the unlocked configuration to the locked configuration; and
changing, by the hypervisor, the memory page from executable to non-executable.

### Claim 10 (depends on 9)

The method of claim 9, further comprising:
determining, by the hypervisor, that the memory page is a startup page, wherein the hypervisor is configured to change the configuration of the control register from the locked configuration to the unlocked configuration based at least in part on the determination that the memory page is the startup page.

### Claim 11 (depends on 9)

The method of claim 9, further comprising:
determining, by the hypervisor, a first offset of an address on the memory page specified by the fault;
determining, by the hypervisor, a second offset of the first code configured to cause the new operating system to boot from the currently-executing operating system;
determining, by the hypervisor, that the first offset matches the second offset; and
changing, by the hypervisor, the configuration of the control register from the locked configuration to the unlocked configuration based at least in part on the determination that the first offset matches the second offset.

### Claim 12 (depends on 9)

The method of claim 9, further comprising:
passing, by the hypervisor, control of the processor to the guest after changing the memory page from non-executable to executable, wherein the guest executes the first code at the address of the memory page.

### Claim 13 (depends on 9)

The method of claim 9, further comprising:
executing the first code, by the guest, to cause the new operating system to boot from a currently-executing operating system using kexec.

### Claim 14 (depends on 9)

The method of claim 9, wherein the control register is CR0 or CR4.

### Claim 15 (depends on 9)

The method of claim 9, further comprising:
determining, by the hypervisor, whether the fault is associated with the memory page comprising a branch to kexec initialization code.

### Claim 16 (depends on 9)

The method of claim 9, wherein the fault is caused by the memory page being designated as non-executable.

### Claim 17

A non-transitory machine readable medium storing a program, which when executed by a processor causes a hypervisor to:
determine a fault resulting from a guest attempting to execute first code from a memory page designated as non-executable, wherein the first code is configured to cause a new operating system to boot from a currently-executing operating system;
change a configuration of a control register associated with the processor from a locked configuration to an unlocked configuration based at least in part on the fault;
change the memory page from non-executable to executable;
receive a hypercall from the guest after execution of the first code, the hypercall indicating that the control register has been configured by the guest after booting the new operating system;
change the configuration of the control register from the unlocked configuration to the locked configuration; and
change the memory page from executable to non-executable.

### Claim 18 (depends on 17)

The non-transitory machine readable medium of claim 17, which, when executed by the processor, further causes the hypervisor to:
determine that the memory page is a startup page, wherein the hypervisor is configured to change the configuration of the control register from the locked configuration to the unlocked configuration based at least in part on the determination that the memory page is the startup page.

### Claim 19 (depends on 17)

The non-transitory machine readable medium of claim 17, which, when executed by the processor, further causes the hypervisor to:
determine a first offset of an address on the memory page specified by the fault;
determine a second offset of the first code configured to cause the new operating system to boot from the currently-executing operating system;
determine that the first offset matches the second offset; and
change the configuration of the control register from the locked configuration to the unlocked configuration based at least in part on the determination that the first offset matches the second offset.

### Claim 20 (depends on 17)

The non-transitory machine readable medium of claim 17, which, when executed by the processor, further causes the hypervisor to:
pass control of the processor to the guest after changing the memory page from non-executable to executable, wherein the guest executes the first code at the address of the memory page.
