Message-ID: From: yjtseng To: djgpp AT delorie DOT com Cc: yjtseng AT micron DOT com Subject: Help needed in getting CR0 under DOS Date: Thu, 8 Apr 1999 13:17:26 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain Reply-To: djgpp AT delorie DOT com Hi, I wrote inline assembly code to access the control register CR0 and compiled it under djgpp. It ran O.k. in window DOS but gave me general protection fault under pure DOS environment. The code is as follows. --------------------------- #include unsigned long getCR0() { unsigned long result=0; __asm__ __volatile__ ("pushl %%ebx\n movl %%cr0, %%ebx\n movl %%ebx, %0\n popl %%ebx\n" : "=b" (result) : : "%ebx","%cc", "memory" ); return result; } void main() { unsigned long result; result=getCR0(); printf("inside getCR0: result=0x%x\n", result); } ------------------------ I was able to access registers such as eax and ebx using the same inline technique under DOS. Anything that I should be aware of? Thanks. Jay