Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SyscallOther #1419

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion optimism/src/mips/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,26 @@ pub fn interpret_rtype<Env: InterpreterEnv>(env: &mut Env, instr: RTypeInstructi
RTypeInstruction::SyscallWritePreimage => (),
RTypeInstruction::SyscallWriteOther => (),
RTypeInstruction::SyscallFcntl => (),
RTypeInstruction::SyscallOther => (),
RTypeInstruction::SyscallOther => {
let syscall_num = env.read_register(&Env::constant(2));
dannywillems marked this conversation as resolved.
Show resolved Hide resolved
let is_sysbrk = {
// FIXME: Requires constraints
let pos = env.alloc_scratch();
unsafe { env.test_zero(&(syscall_num.clone() - Env::constant(4045)), pos) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add constants later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1438

};
let is_sysclone = {
// FIXME: Requires constraints
let pos = env.alloc_scratch();
unsafe { env.test_zero(&(syscall_num.clone() - Env::constant(4120)), pos) }
};
let v0 = { is_sysbrk * Env::constant(0x40000000) + is_sysclone };
let v1 = Env::constant(0);
env.write_register(&Env::constant(2), v0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env.write_register(&Env::constant(2), v0);
env.write_register(&Env::constant(REGISTER_V0), v0);

env.write_register(&Env::constant(7), v1);
dannywillems marked this conversation as resolved.
Show resolved Hide resolved
env.set_instruction_pointer(next_instruction_pointer.clone());
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32));
return;
}
RTypeInstruction::MoveZero => (),
RTypeInstruction::MoveNonZero => (),
RTypeInstruction::Sync => (),
Expand Down