Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

User exception handler in C (Developers)

posted by Laaca Homepage, Czech republic, 18.08.2020, 20:15

> Undocumented unit cpu has some functions too, and might be more maintained.

I think that undocumented unit CPU has a potential bug.

function cr0 : longint;assembler;
      asm
         DB 0Fh,20h,0C0h
         { mov eax,cr0
           special registers are not allowed in the assembler
                parsers }
      end;


Problem is that "mov eax,cr0" is a privileged instruction. Sure, some DPMI managers let you to call it anyway but it is not sure.
And I am not sure about other OSes.

Better is to use the instruction SMSW which is non-privileged.

function cr0 : longint;assembler;
asm
mov eax,0
smsw ax 
end;

---
DOS-u-akbar!

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 251 users online (1 registered, 250 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum