cpu: Port cpl_changed to Rust

We leave the JS version too, since it's used by several other JS functions
that we aren't porting yet.
This commit is contained in:
Amaan Cheval 2018-09-07 18:59:11 +05:30 committed by Fabian
parent a9bb4619ef
commit b4922dc3b1
3 changed files with 5 additions and 3 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); },
"cpl_changed": function() { return cpu.cpl_changed.apply(cpu, arguments); },
"set_cr0": function() { return cpu.set_cr0.apply(cpu, arguments); },
"update_cs_size": function() { return cpu.update_cs_size.apply(cpu, arguments); },
"cpuid": function() { return cpu.cpuid.apply(cpu, arguments); },

View file

@ -892,6 +892,11 @@ pub unsafe fn get_seg(mut segment: i32) -> i32 {
return *segment_offsets.offset(segment as isize);
}
pub unsafe fn cpl_changed() {
*last_virt_eip = -1;
*last_virt_esp = -1;
}
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 cpl_changed();
#[no_mangle]
fn update_cs_size(cs_size: bool);
#[no_mangle]
fn set_cr0(cr0: i32);