delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/08/05:22:21

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <47E442770B0CD511917E0040C77A460001FCAB@MAILEX>
From: Andy Younger <AndyY AT redlemon DOT com>
To: cygwin AT cygwin DOT com
Subject: RE: Where is GetCurrentFiber?
Date: Thu, 8 Mar 2001 10:26:41 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

------_=_NextPart_000_01C0A7BA.44022200
Content-Type: text/plain;
	charset="iso-8859-1"

Piqued by interest, I did a quick hack of these macros into GNU assembly.
Seems to work ok. Can someone see if these work, its been a long time since
I did inline assembly in GAS format.


Andrew Younger
Programmer

Red Lemon Studios Ltd
175 West George Street, Glasgow G2 2LB, Scotland, U.K.
Tel +44 (0) 141 271 2000
Fax +44 (0) 141 271 2001

andyy AT redlemon DOT com
www.redlemon.com

It's a game thing!
-----------
The recipient acknowledges that Red Lemon Studios is unable to exercise
control over the content of information contained in transmissions made via
the Internet.  Red Lemon Studios hereby excludes any warranty as to the
quality or accuracy of any information contained in this message and any
liability of any kind for the information contained in it, or for its
transmission, reception, storage or use in any way whatsoever.

 

> -----Original Message-----
> From: cygwin-owner AT sources DOT redhat DOT com
> [mailto:cygwin-owner AT sources DOT redhat DOT com]On Behalf Of Corinna Vinschen
> Sent: 07 March 2001 18:35
> To: cygwin
> Subject: Re: Where is GetCurrentFiber?
> 
> 
> On Wed, Mar 07, 2001 at 01:10:08PM -0500, Larry Hall (RFK 
> Partners, Inc) wrote:
> > At 01:06 PM 3/7/2001, Corinna Vinschen wrote:
> > >On Tue, Mar 06, 2001 at 10:57:02AM -0500, Larry Hall (RFK 
> Partners, Inc) wrote:
> > > > I don't think so.  GetCurrentFiber() and GetFiberData() 
> are in user32.dll
> > > > according to the MSDN.
> > >
> > >Hmm, which MSDN are you looking into? MSDN explicitely says
> > >`GetCurrentFiber()' and `GetFiberData()' are macros, defined
> > >in winnt.h.
> > >
> > >Corinna
> > 
> > 
> > 
> > Oops!  Quite right.  I didn't look very closely at that 
> page and just clicked
> > right along to "Requirements".  These are macros.  I guess 
> they are improperly
> > defined in Cygwin's winnt.h.
> 
> Yep. They are simply declared as functions, unfortunately.
> 
> Corinna
> 
> -- 
> Corinna Vinschen                  Please, send mails 
> regarding Cygwin to
> Cygwin Developer                                
mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


------_=_NextPart_000_01C0A7BA.44022200
Content-Type: application/octet-stream;
	name="fiber.c"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="fiber.c"

#include <windows.h>=0A=
=0A=
// Quick hack for windows Fiber macros=0A=
#if __GNUC__=0A=
__inline PVOID GNU_GetFiberData(void)=0A=
{=0A=
	void* ret;=0A=
	__asm__ volatile ("=0A=
		movl	%%fs:0x10,%%eax=0A=
		movl	(%%eax),%%eax=0A=
	" : "=3Dg" (ret)=0A=
	  :=0A=
	  );=0A=
	return ret;=0A=
}=0A=
=0A=
__inline PVOID GNU_GetCurrentFiber(void)=0A=
{=0A=
	void* ret;=0A=
	=0A=
	__asm__ volatile ("=0A=
		movl	%%fs:0x10,%%eax=0A=
	" : "=3Dg" (ret)=0A=
	  :=0A=
	  );=0A=
	return ret;=0A=
}=0A=
=0A=
#define GetFiberData GNU_GetFiberData=0A=
#define GetCurrentFiber GNU_GetCurrentFiber=0A=
=0A=
#endif=0A=
=0A=
#include <stdio.h>=0A=
=0A=
int main(void)=0A=
{=0A=
	void *pFiber =3D GetCurrentFiber();=0A=
	void *pData =3D 0L; // GetFiberData();	// This will die..=0A=
											// as fiber is NULL=0A=
	printf("%p %p\n", pFiber, pData);=0A=
	return 0;=0A=
}=0A=


------_=_NextPart_000_01C0A7BA.44022200
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
------_=_NextPart_000_01C0A7BA.44022200--

- Raw text -


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