mirror of
https://github.com/copy/v86
synced 2025-10-14 01:54:07 +08:00
make #ud non-panic
This commit is contained in:
@@ -213,8 +213,9 @@ function gen_instruction_body_after_prefix(encodings, size)
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
default_case: {
|
default_case: {
|
||||||
|
varname: "x",
|
||||||
body: [
|
body: [
|
||||||
`if DEBUG { panic!("Bad instruction at {:x}", *instruction_pointer); }`,
|
`dbg_log!("#ud ${encoding.opcode.toString(16).toUpperCase()}/{} at {:x}", x, *instruction_pointer);`,
|
||||||
"trigger_ud();",
|
"trigger_ud();",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -413,7 +414,7 @@ function gen_table()
|
|||||||
|
|
||||||
"use crate::cpu::cpu::{after_block_boundary, modrm_resolve};",
|
"use crate::cpu::cpu::{after_block_boundary, modrm_resolve};",
|
||||||
"use crate::cpu::cpu::{read_imm8, read_imm8s, read_imm16, read_imm32s, read_moffs};",
|
"use crate::cpu::cpu::{read_imm8, read_imm8s, read_imm16, read_imm32s, read_moffs};",
|
||||||
"use crate::cpu::cpu::{task_switch_test, trigger_ud, DEBUG};",
|
"use crate::cpu::cpu::{task_switch_test, trigger_ud};",
|
||||||
"use crate::cpu::instructions;",
|
"use crate::cpu::instructions;",
|
||||||
"use crate::cpu::global_pointers::{instruction_pointer, prefixes};",
|
"use crate::cpu::global_pointers::{instruction_pointer, prefixes};",
|
||||||
"use crate::prefix;",
|
"use crate::prefix;",
|
||||||
@@ -478,7 +479,6 @@ function gen_table()
|
|||||||
"use crate::cpu::cpu::{after_block_boundary, modrm_resolve};",
|
"use crate::cpu::cpu::{after_block_boundary, modrm_resolve};",
|
||||||
"use crate::cpu::cpu::{read_imm8, read_imm16, read_imm32s};",
|
"use crate::cpu::cpu::{read_imm8, read_imm16, read_imm32s};",
|
||||||
"use crate::cpu::cpu::{task_switch_test, task_switch_test_mmx, trigger_ud};",
|
"use crate::cpu::cpu::{task_switch_test, task_switch_test_mmx, trigger_ud};",
|
||||||
"use crate::cpu::cpu::DEBUG;",
|
|
||||||
"use crate::cpu::instructions_0f;",
|
"use crate::cpu::instructions_0f;",
|
||||||
"use crate::cpu::global_pointers::{instruction_pointer, prefixes};",
|
"use crate::cpu::global_pointers::{instruction_pointer, prefixes};",
|
||||||
"use crate::prefix;",
|
"use crate::prefix;",
|
||||||
|
@@ -32,7 +32,8 @@ export function print_syntax_tree(statements)
|
|||||||
|
|
||||||
if(statement.default_case)
|
if(statement.default_case)
|
||||||
{
|
{
|
||||||
cases.push(`_ => {`);
|
const varname = statement.default_case.varname || "_";
|
||||||
|
cases.push(`${varname} => {`);
|
||||||
cases.push.apply(cases, indent(print_syntax_tree(statement.default_case.body), 4));
|
cases.push.apply(cases, indent(print_syntax_tree(statement.default_case.body), 4));
|
||||||
cases.push(`}`);
|
cases.push(`}`);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user