cpu: Port update_cs_size to Rust

The JS version needs to stay too since it can be called by other JS-only functions.
This commit is contained in:
Amaan Cheval 2018-09-07 19:12:04 +05:30 committed by Fabian
parent 1712d25725
commit 56ec3be5a4
4 changed files with 8 additions and 4 deletions

View file

@ -213,7 +213,6 @@ function V86Starter(options)
"verw": function() { return cpu.verw.apply(cpu, arguments); },
"verr": function() { return cpu.verr.apply(cpu, arguments); },
"update_cs_size": function() { return cpu.update_cs_size.apply(cpu, arguments); },
"cpuid": function() { return cpu.cpuid.apply(cpu, arguments); },
"load_ldt": function() { return cpu.load_ldt.apply(cpu, arguments); },

View file

@ -44,7 +44,6 @@ extern void popa16(void);
extern void popa32(void);
extern void undefined_instruction(void);
extern void unimplemented_sse(void);
extern void update_cs_size(int32_t);
extern void update_eflags(int32_t);
extern bool switch_seg(int32_t, int32_t);
extern void lss16(int32_t, int32_t, int32_t);

View file

@ -921,6 +921,14 @@ pub unsafe fn cpl_changed() {
*last_virt_esp = -1;
}
pub unsafe fn update_cs_size(new_size: bool) {
if *is_32 != new_size {
*is_32 = new_size;
// TODO:
// update_operand_size();
}
}
pub unsafe fn test_privileges_for_io(port: i32, size: i32) -> bool {
if *protected_mode && (*cpl > getiopl() as u8 || (*flags & FLAG_VM != 0)) {
if !*tss_size_32 {

View file

@ -21,8 +21,6 @@ extern "C" {
#[no_mangle]
fn cpuid();
#[no_mangle]
fn update_cs_size(cs_size: bool);
#[no_mangle]
fn lsl(r: i32, v: i32) -> i32;
#[no_mangle]
fn lar(r: i32, v: i32) -> i32;