delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/27/02:21:07

From: Heo Sung-Gwan <heo AT turbotek DOT co DOT kr>
Newsgroups: comp.os.msdos.programmer,comp.lang.asm.x86,comp.os.msdos.djgpp,comp.unix.pc-clone.32bit
Subject: FPU and protected mode
Date: Thu, 27 Mar 1997 11:47:23 +0900
Organization: S/W Team, Turbo Tek
Lines: 39
Message-ID: <3339DFBB.3A4B@turbotek.co.kr>
Reply-To: heo AT turbotek DOT co DOT kr
NNTP-Posting-Host: 203.239.124.66
Mime-Version: 1.0
CC: heo AT turbotek DOT co DOT kr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I am coding FPU context switch with Pentium processor using fnsave and
frstor FPU instructions. And I found these FPU instructions behaves
differently between real mode and protected mode.

See the following code:

	int	i;
	char	fpusave[124];

	fpusave[0] = 0x7f;	fpusave[1] = 0x03;
	fpusave[2] = 0x00;	fpusave[3] = 0x00;
	fpusave[4] = 0xff;	fpusave[5] = 0xff;

	asm  {
		frstor	fpusave
		fwait
		fnsave	fpusave
		fwait
	}
	for( i = 0; i < 124; i++ ) 
		printf("%x ", fpusave[i]);		

When compiled with bcc -B, it output 7f 03 00 00 ff ....
but when compiled with bcc32 and PMC protectd library, it output 7f 03
ff ff 7f 7f .....
Also when compiled with djgpp in DOS and gcc in linux after inline
assembly code is modified, it output the same as bcc32 and PMC lib: 7f
03 ff ff 7f 7f .... 

What happened to FPU in protected mode?


Thanks in advance.

Heo Sung-Gwan
---
E-mail: heo AT turbotek DOT co DOT kr

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019