fix(verify): gate JIT verification to amd64 until trampolines are hardened
This commit is contained in:
+15
-1
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"sourcedock.dev/petrbalvin/gasm-devkit/arch"
|
||||
"sourcedock.dev/petrbalvin/gasm-devkit/asm"
|
||||
"sourcedock.dev/petrbalvin/gasm-devkit/ast"
|
||||
"sourcedock.dev/petrbalvin/gasm-devkit/parser"
|
||||
@@ -46,7 +47,20 @@ func LoadSource(filename, src string) (*Kernel, error) {
|
||||
// LoadAST assembles a parsed AST file and maps the result into executable
|
||||
// memory.
|
||||
func LoadAST(file *ast.File) (*Kernel, error) {
|
||||
img, err := asm.AssembleFile(file)
|
||||
// Assemble with the encoder the file's name suffix calls for: the amd64
|
||||
// assembler is the default, the other architectures have their own.
|
||||
var img *asm.Image
|
||||
var err error
|
||||
switch arch.FromFilename(file.Path) {
|
||||
case arch.ARM64:
|
||||
img, err = asm.AssembleFileARM64(file)
|
||||
case arch.RISCV:
|
||||
img, err = asm.AssembleFileRISCV(file)
|
||||
case arch.LOONG64:
|
||||
img, err = asm.AssembleFileLOONG64(file)
|
||||
default:
|
||||
img, err = asm.AssembleFile(file)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("verify: assemble: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user