WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 6bd4efd6 authored by qinsoon's avatar qinsoon
Browse files

fixed two bugs that may cause generating invalid assembly

(operand doesnt match instruction, such as movl %rdi, %edx)
parent 99e16961
......@@ -433,6 +433,8 @@ impl <'a> InstructionSelection {
let tmp_res = self.get_result_value(node);
// cmov only take (16/32/64bits registers)
// so we use 64bits registers here and truncate later
// make res64, and set to zero
let tmp_res64 = self.make_temporary(f_context, UINT64_TYPE.clone(), vm);
self.backend.emit_xor_r_r(&tmp_res64, &tmp_res64);
......@@ -465,7 +467,7 @@ impl <'a> InstructionSelection {
}
// truncate tmp_res64 to tmp_res (probably u8)
self.backend.emit_mov_r_r(&tmp_res, &tmp_res64);
self.backend.emit_mov_r_r(&tmp_res, unsafe {&tmp_res64.as_type(UINT8_TYPE.clone())});
}
Instruction_::Branch1(ref dest) => {
......@@ -648,10 +650,22 @@ impl <'a> InstructionSelection {
op::ConvOp::TRUNC => {
if self.match_ireg(op) {
let tmp_op = self.emit_ireg(op, f_content, f_context, vm);
let tmp_res = self.get_result_value(node);
let dst_length = match tmp_res.ty.get_int_length() {
Some(len) => len,
None => panic!("dst of TRUNC is not int: {}", tmp_res)
};
// mov op -> result
self.backend.emit_mov_r_r(&tmp_res, &tmp_op);
match dst_length {
1 => self.backend.emit_mov_r_r(&tmp_res, unsafe {&tmp_op.as_type(UINT8_TYPE.clone())}),
8 => self.backend.emit_mov_r_r(&tmp_res, unsafe {&tmp_op.as_type(UINT8_TYPE.clone())}),
16 => self.backend.emit_mov_r_r(&tmp_res, unsafe {&tmp_op.as_type(UINT16_TYPE.clone())}),
32 => self.backend.emit_mov_r_r(&tmp_res, unsafe {&tmp_op.as_type(UINT32_TYPE.clone())}),
64 => self.backend.emit_mov_r_r(&tmp_res, unsafe {&tmp_op.as_type(UINT64_TYPE.clone())}),
_ => panic!("unsupported int length: {}", dst_length)
}
} else {
panic!("unexpected op (expect ireg): {}", op);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment