forked from oracle/graal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'vm-23.1.3' into mandrel-23.1
- Loading branch information
Showing
488 changed files
with
643 additions
and
64,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...vm.compiler/src/org/graalvm/compiler/core/amd64/AMD64ReadDataFromUserPageKeyRegister.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package org.graalvm.compiler.core.amd64; | ||
|
||
import jdk.vm.ci.amd64.AMD64; | ||
import jdk.vm.ci.amd64.AMD64Kind; | ||
import jdk.vm.ci.code.ValueUtil; | ||
import jdk.vm.ci.meta.AllocatableValue; | ||
import jdk.vm.ci.meta.Value; | ||
import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler; | ||
import org.graalvm.compiler.core.common.LIRKind; | ||
import org.graalvm.compiler.lir.LIRInstructionClass; | ||
import org.graalvm.compiler.lir.Opcode; | ||
import org.graalvm.compiler.lir.amd64.AMD64LIRInstruction; | ||
import org.graalvm.compiler.lir.asm.CompilationResultBuilder; | ||
|
||
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG; | ||
|
||
/** | ||
* Reads the value of PKRU into EAX and clears EDX. ECX must be 0 when RDPKRU is executed; | ||
* otherwise, a general-protection exception (#GP) occurs. RDPKRU can be executed only if CR4.PKE = | ||
* 1; otherwise, an invalid-opcode exception (#UD) occurs. Software can discover the value of | ||
* CR4.PKE by examining CPUID.(EAX=07H,ECX=0H):ECX.OSPKE [bit 4]. On processors that support the | ||
* Intel 64 Architecture, the high-order 32-bits of RCX are ignored and the high-order 32-bits of | ||
* RDX and RAX are cleared. | ||
*/ | ||
@Opcode("RDPKRU") | ||
public class AMD64ReadDataFromUserPageKeyRegister extends AMD64LIRInstruction { | ||
public static final LIRInstructionClass<AMD64ReadDataFromUserPageKeyRegister> TYPE = LIRInstructionClass.create(AMD64ReadDataFromUserPageKeyRegister.class); | ||
|
||
// the result of the rdpkru is in eax | ||
@Def protected Value retVal; | ||
|
||
// edx will be cleared | ||
@Temp({REG}) protected AllocatableValue edx; | ||
|
||
// ecx must be zero | ||
@Temp({REG}) protected AllocatableValue zeroArg1; | ||
|
||
public AMD64ReadDataFromUserPageKeyRegister() { | ||
super(TYPE); | ||
this.retVal = AMD64.rax.asValue(LIRKind.value(AMD64Kind.DWORD)); | ||
this.edx = AMD64.rdx.asValue(LIRKind.value(AMD64Kind.DWORD)); | ||
this.zeroArg1 = AMD64.rcx.asValue(LIRKind.value(AMD64Kind.DWORD)); | ||
} | ||
|
||
@Override | ||
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { | ||
masm.xorl(ValueUtil.asRegister(zeroArg1), ValueUtil.asRegister(zeroArg1)); | ||
masm.rdpkru(); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
....vm.compiler/src/org/graalvm/compiler/core/amd64/AMD64WriteDataToUserPageKeyRegister.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package org.graalvm.compiler.core.amd64; | ||
|
||
import jdk.vm.ci.amd64.AMD64; | ||
import jdk.vm.ci.amd64.AMD64Kind; | ||
import jdk.vm.ci.code.RegisterValue; | ||
import jdk.vm.ci.code.ValueUtil; | ||
import jdk.vm.ci.meta.AllocatableValue; | ||
import jdk.vm.ci.meta.Value; | ||
import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler; | ||
import org.graalvm.compiler.core.common.LIRKind; | ||
import org.graalvm.compiler.lir.LIRInstructionClass; | ||
import org.graalvm.compiler.lir.Opcode; | ||
import org.graalvm.compiler.lir.amd64.AMD64LIRInstruction; | ||
import org.graalvm.compiler.lir.asm.CompilationResultBuilder; | ||
|
||
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG; | ||
|
||
/** | ||
* Writes the value of EAX into PKRU. ECX and EDX must be 0 when WRPKRU is executed; otherwise, a | ||
* general protection exception (#GP) occurs. WRPKRU can be executed only if CR4.PKE = 1; otherwise, | ||
* an invalid-opcode exception (#UD) occurs. Software can discover the value of CR4.PKE by examining | ||
* CPUID.(EAX=07H,ECX=0H):ECX.OSPKE [bit 4]. On processors that support the Intel 64 Architecture, | ||
* the high-order 32-bits of RCX, RDX and RAX are ignored. | ||
*/ | ||
@Opcode("WRPKRU") | ||
public class AMD64WriteDataToUserPageKeyRegister extends AMD64LIRInstruction { | ||
public static final LIRInstructionClass<AMD64WriteDataToUserPageKeyRegister> TYPE = LIRInstructionClass.create(AMD64WriteDataToUserPageKeyRegister.class); | ||
|
||
// the argument to wrpkru is in eax | ||
@Use protected Value arg; | ||
// ecx and edx need to be zero | ||
@Temp({REG}) protected AllocatableValue zeroArg1; | ||
@Temp({REG}) protected AllocatableValue zeroArg2; | ||
|
||
public AMD64WriteDataToUserPageKeyRegister(RegisterValue arg) { | ||
super(TYPE); | ||
assert arg.getRegister().equals(AMD64.rax); | ||
this.arg = arg; | ||
zeroArg1 = AMD64.rcx.asValue(LIRKind.value(AMD64Kind.DWORD)); | ||
zeroArg2 = AMD64.rdx.asValue(LIRKind.value(AMD64Kind.DWORD)); | ||
} | ||
|
||
@Override | ||
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { | ||
masm.xorl(ValueUtil.asRegister(zeroArg1), ValueUtil.asRegister(zeroArg1)); | ||
masm.xorl(ValueUtil.asRegister(zeroArg2), ValueUtil.asRegister(zeroArg2)); | ||
masm.wrpkru(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...ternal.vm.compiler/src/org/graalvm/compiler/core/amd64/ReadProtectionKeyRegisterNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package org.graalvm.compiler.core.amd64; | ||
|
||
import jdk.vm.ci.meta.Value; | ||
import org.graalvm.compiler.core.common.type.IntegerStamp; | ||
import org.graalvm.compiler.graph.NodeClass; | ||
import org.graalvm.compiler.nodeinfo.NodeCycles; | ||
import org.graalvm.compiler.nodeinfo.NodeInfo; | ||
import org.graalvm.compiler.nodeinfo.NodeSize; | ||
import org.graalvm.compiler.nodes.FixedWithNextNode; | ||
import org.graalvm.compiler.nodes.spi.LIRLowerable; | ||
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; | ||
|
||
@NodeInfo(cycles = NodeCycles.CYCLES_1, size = NodeSize.SIZE_4) | ||
public class ReadProtectionKeyRegisterNode extends FixedWithNextNode implements LIRLowerable { | ||
public static final NodeClass<ReadProtectionKeyRegisterNode> TYPE = NodeClass.create(ReadProtectionKeyRegisterNode.class); | ||
|
||
public ReadProtectionKeyRegisterNode() { | ||
super(TYPE, IntegerStamp.create(32)); | ||
} | ||
|
||
@Override | ||
public void generate(NodeLIRBuilderTool gen) { | ||
Value result = gen.getLIRGeneratorTool().emitProtectionKeyRegisterRead(); | ||
gen.setResult(this, result); | ||
} | ||
|
||
@NodeIntrinsic | ||
public static native int readProtectionKeyRegister(); | ||
} |
56 changes: 56 additions & 0 deletions
56
...ernal.vm.compiler/src/org/graalvm/compiler/core/amd64/WriteProtectionKeyRegisterNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package org.graalvm.compiler.core.amd64; | ||
|
||
import org.graalvm.compiler.core.common.type.StampFactory; | ||
import org.graalvm.compiler.graph.NodeClass; | ||
import org.graalvm.compiler.nodeinfo.NodeCycles; | ||
import org.graalvm.compiler.nodeinfo.NodeInfo; | ||
import org.graalvm.compiler.nodeinfo.NodeSize; | ||
import org.graalvm.compiler.nodes.FixedWithNextNode; | ||
import org.graalvm.compiler.nodes.ValueNode; | ||
import org.graalvm.compiler.nodes.spi.LIRLowerable; | ||
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; | ||
import org.graalvm.word.WordBase; | ||
|
||
@NodeInfo(cycles = NodeCycles.CYCLES_16, size = NodeSize.SIZE_4) | ||
public class WriteProtectionKeyRegisterNode extends FixedWithNextNode implements LIRLowerable { | ||
public static final NodeClass<WriteProtectionKeyRegisterNode> TYPE = NodeClass.create(WriteProtectionKeyRegisterNode.class); | ||
|
||
@Input protected ValueNode value; | ||
|
||
public WriteProtectionKeyRegisterNode(ValueNode value) { | ||
super(TYPE, StampFactory.forVoid()); | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public void generate(NodeLIRBuilderTool gen) { | ||
gen.getLIRGeneratorTool().emitProtectionKeyRegisterWrite(gen.operand(value)); | ||
} | ||
|
||
@NodeIntrinsic | ||
public static native void writeProtectionKeyRegister(WordBase value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.