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:
parent
a9bb4619ef
commit
b4922dc3b1
|
@ -213,7 +213,6 @@ function V86Starter(options)
|
||||||
"verw": function() { return cpu.verw.apply(cpu, arguments); },
|
"verw": function() { return cpu.verw.apply(cpu, arguments); },
|
||||||
"verr": function() { return cpu.verr.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); },
|
"set_cr0": function() { return cpu.set_cr0.apply(cpu, arguments); },
|
||||||
"update_cs_size": function() { return cpu.update_cs_size.apply(cpu, arguments); },
|
"update_cs_size": function() { return cpu.update_cs_size.apply(cpu, arguments); },
|
||||||
"cpuid": function() { return cpu.cpuid.apply(cpu, arguments); },
|
"cpuid": function() { return cpu.cpuid.apply(cpu, arguments); },
|
||||||
|
|
|
@ -892,6 +892,11 @@ pub unsafe fn get_seg(mut segment: i32) -> i32 {
|
||||||
return *segment_offsets.offset(segment as isize);
|
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 {
|
pub unsafe fn test_privileges_for_io(port: i32, size: i32) -> bool {
|
||||||
if *protected_mode && (*cpl > getiopl() as u8 || (*flags & FLAG_VM != 0)) {
|
if *protected_mode && (*cpl > getiopl() as u8 || (*flags & FLAG_VM != 0)) {
|
||||||
if !*tss_size_32 {
|
if !*tss_size_32 {
|
||||||
|
|
|
@ -21,8 +21,6 @@ extern "C" {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
fn cpuid();
|
fn cpuid();
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
fn cpl_changed();
|
|
||||||
#[no_mangle]
|
|
||||||
fn update_cs_size(cs_size: bool);
|
fn update_cs_size(cs_size: bool);
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
fn set_cr0(cr0: i32);
|
fn set_cr0(cr0: i32);
|
||||||
|
|
Loading…
Reference in a new issue