[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rtl-digest V1 #138




rtl-digest          Monday, November 5 2001          Volume 01 : Number 138




----------------------------------------------------------------------

Date: Thu, 1 Nov 2001 22:38:19 -0800 (PST)
From: A V <anumula_rtl@yahoo.com>
Subject: Re: [rtl] unresolved symbols and kernel libraries

Linux Kernel Internals by M.Beck is good. Though it
cannot give complete reference it gives some idea of
the kernel. I hope it is best for beginners.

- --- "Calin A. Culianu" <calin@ajvar.org> wrote:
> On Wed, 31 Oct 2001, Pablo Alvarez wrote:
> 
> > Calin Culianu wrote:
> >
> > >The kernel has it's own UNIQUE and DISTINCT set
> of
> > > 'library' functions that are sort of compiled
> into it.  Things for
> > > managing memory, working with strings, abusing
> its own data structures,
> > > dealing with user space, fennagling interrupts,
> etc...  Some of these
> > > library routines have the same name as the
> conventional c library
> > > routines.. (strncpy() is one example that comes
> to mind, there are
> > > others). However, that's where the similarities
> end.  The kernel is it's
> > > own programming environment.  Apart from the
> fact that you are using C,
> > > forget everything you ever knew about using C
> and the C library when you
> > > are solving programmatic problems in the kernel
> (ok.. that's a bit
> > > strong.. a lot of the kernel library resembles
> the user-space library
> > > stuff so yeah, it helps to have the background
> just so you can quickly
> > > learn the way the kernel does things). But the
> main reason for the above
> > > rant is this: Open yourself up to learning the
> kernel's library.
> > >
> >
> > That post cleared up a lot of things. I have a
> question: where do I go to
> > start learning the kernel's library? Books, man
> pages, web sites?
> 
> Heh, that's a good quetion which I really don't know
> the complete answer
> to.  There are some books, yes.  Recently I
> purchased "Understanding the
> Linux Kernel" by Bovet et al.  It sucks.  Really. 
> Very disorganized and
> very difficult to find the information you need.  It
> isn't a good
> reference, and isn't even that fun to read
> recreationally.  It's written
> by a bunch of University professors who have spent
> too much time dealing
> with undergrads that they probably forgot how to
> relate to actual
> engineers and computer scientists.  :(
> 
> I heard good things about "Linux Kernel Internals"
> but that book was
> recommended by the same guy that told me to buy the
> other book, so take
> that with a grain of salt.
> 
> If you have tons of time on your hands, it's always
> fun to read the .h
> files that are in the kernel's include/ directory. 
> They are really cool
> to read since the kernel developers have devised
> some devious compiler
> tricks to do things such as export symbols, etc. 
> Anyway, it takes time to
> peruse header files and be able to construct
> meaninful understandings from
> them, so maybe that isn't for you if you have
> limited amounts of it (time,
> that is).  At any rate, happy hacking!! :)
> 
> -Calin
> 
> >
> > Thanks,
> >
> > Pablo Alvarez
> >
> >
> >
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org
> OR
> echo "unsubscribe rtl <Your_email>" | mail
> majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
> 


__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Fri, 2 Nov 2001 07:42:53 -0000 
From: David.Hamilton@jet.uk (David Hamilton)
Subject: RE: [rtl] Can't use unistd.h in C++ realtime modules?

Ivan,
The rtl headers should but don't have 
#ifdef __cplusplus
extern "C"
#endif
at the top.
Therefore you have to make the extern "C" declaration yourself.
I just use the example header (from examples/cpp) rtl_cpp.h and added
#define <unistd.h>
to it.
Note: I moved the new and delete functions to another header (rtl_cpp_fun.h)
so I could include rtl_cpp.h in multiple .cpp files, and include
rtl_cpp_fun.h in just one (to avoid multiple copies of the function being
linked together).
David

- -----Original Message-----
From: Ivan Martinez [mailto:im@iau.dtu.dk]
Sent: 01 November 2001 15:19
To: RTLinux mailing list
Subject: [rtl] Can't use unistd.h in C++ realtime modules?


	Hello all,
	The first line of my C++ realtime module is:

#include <unistd.h>

	Which produces the following compilation errors:

In file included from /usr/src/rtlinux-3.1/linux/include/linux/wait.h:14,
                 from /usr/src/rtlinux-3.1/linux/include/linux/fs.h:12,
                 from /usr/src/rtlinux-3.1/include/rtl_posixio.h:13,
                 from /usr/src/rtlinux-3.1/include/posix/unistd.h:17,
                 from rtmodule.cpp:1:
/usr/src/rtlinux-3.1/linux/include/linux/list.h:35: parse error before `new'
/usr/src/rtlinux-3.1/linux/include/linux/list.h: In function `void
__list_add 
(...)':
/usr/src/rtlinux-3.1/linux/include/linux/list.h:39: `next' undeclared (first

use this function)
/usr/src/rtlinux-3.1/linux/include/linux/list.h:39: (Each undeclared 
identifier is reported only once
for each function it appears in.)
/usr/src/rtlinux-3.1/linux/include/linux/list.h:39: parse error before `;'
/usr/src/rtlinux-3.1/linux/include/linux/list.h:42: `prev' undeclared (first

use this function)
..

	I use the attached Makefile. Do you know what's wrong?.
	BTW, I don't really know which C and C++ libraries I can link in
realtime 
modules, could anybody tell me where to find info about that?.
	Thank you,
	Ivan Martinez
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Fri, 2 Nov 2001 09:20:01 +0000
From: Chunky Kibbles <gjb105@cs.york.ac.uk>
Subject: Re: [rtl] Problems with RDTSC examples posted here recently

On Thu, Nov 01, 2001 at 02:54:37PM -0700, John Regehr wrote:
> > Don't forget to make sure it's __volatile__, elsewise this is the very
> > epitome of what would produce dodgy results...
> 
> Right.  So method2 and method2A seem to be broken in multiple ways -
> forget you ever saw them.  Rather, look at this page:
> 
> http://www-106.ibm.com/developerworks/linux/library/l-ia.html?dwzone=linux
> 
> which has a nice explanation of inline assembly syntax for gcc, and even
> explains why method1 is the right way to code rdtsc.

Yep. All of the above are conclusions I came to [and actually used]
having read http://sag-www.ssl.berkeley.edu/~korpela/djgpp_asm.html

Thanks,
Gary (-;
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Fri, 2 Nov 2001 10:48:29 +0100 (CET)
From: Der Herr Hofrat <der.herr@hofr.at>
Subject: Re: [rtl] Problems with RDTSC examples posted here recently

> On Thu, Nov 01, 2001 at 02:54:37PM -0700, John Regehr wrote:
> > > Don't forget to make sure it's __volatile__, elsewise this is the very
> > > epitome of what would produce dodgy results...
> > 
> > Right.  So method2 and method2A seem to be broken in multiple ways -
> > forget you ever saw them.  Rather, look at this page:

in what way is method2 brocken ??

if you compile method1 and method2A and look at the assembler coee they are
absolutly the same - the only difference on the source level is that its easier
to read "mov" than "0x31" thats all.

- ---method1---
__inline__ unsigned long long int rdtsc(void)
{
	unsigned long long int x;
	__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
	return x;
}


- ---method2A---
__inline__ unsigned long long int hwtime(void)
{
	unsigned long long int x;
	__asm__("rdtsc\n\t"
		"mov %%edx, %%ecx\n\t"
		:"=A" (x));
	return x;
}


- ---assembler code of method1----
globl rdtsc
	.type	 rdtsc,@function
rdtsc:
	pushl %ebp
	movl %esp,%ebp
	subl $20,%esp
	pushl %ebx


- ---assembler code of method2A----
globl hwtime
	.type	 hwtime,@function
hwtime:
	pushl %ebp
	movl %esp,%ebp
	subl $20,%esp
	pushl %ebx


hofrat
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Fri, 2 Nov 2001 11:06:36 +0100 (CET)
From: Der Herr Hofrat <der.herr@hofr.at>
Subject: Re: [rtl] Problems with RDTSC examples posted here recently

> > On Thu, Nov 01, 2001 at 02:54:37PM -0700, John Regehr wrote:
> > > > Don't forget to make sure it's __volatile__, elsewise this is the very
> > > > epitome of what would produce dodgy results...
> > > 
> > > Right.  So method2 and method2A seem to be broken in multiple ways -
> > > forget you ever saw them.  Rather, look at this page:
> 
> in what way is method2 brocken ??
> 
> if you compile method1 and method2A and look at the assembler coee they are
> absolutly the same - the only difference on the source level is that its easier
> to read "mov" than "0x31" thats all.
> 
> ---method1---
> __inline__ unsigned long long int rdtsc(void)
> {
> 	unsigned long long int x;
> 	__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
> 	return x;
> }
> 
> 
> ---method2A---
> __inline__ unsigned long long int hwtime(void)
> {
> 	unsigned long long int x;
> 	__asm__("rdtsc\n\t"
> 		"mov %%edx, %%ecx\n\t"
> 		:"=A" (x));
> 	return x;
> }
>

forgot to put in objdump output in the last post


08048430 <rdtsc>:
 8048430:	55                   	push   %ebp
 8048431:	89 e5                	mov    %esp,%ebp
 8048433:	83 ec 14             	sub    $0x14,%esp
 8048436:	53                   	push   %ebx
 8048437:	0f 31                	rdtsc  
 8048439:	89 c1                	mov    %eax,%ecx
 804843b:	89 d3                	mov    %edx,%ebx
 804843d:	89 4d f8             	mov    %ecx,0xfffffff8(%ebp)
 8048440:	89 5d fc             	mov    %ebx,0xfffffffc(%ebp)
 8048443:	8b 4d f8             	mov    0xfffffff8(%ebp),%ecx
 8048446:	8b 5d fc             	mov    0xfffffffc(%ebp),%ebx
 8048449:	89 c8                	mov    %ecx,%eax
 804844b:	89 da                	mov    %ebx,%edx
 804844d:	eb 01                	jmp    8048450 <rdtsc+0x20>
 804844f:	90                   	nop    
 8048450:	8b 5d e8             	mov    0xffffffe8(%ebp),%ebx
 8048453:	89 ec                	mov    %ebp,%esp
 8048455:	5d                   	pop    %ebp
 8048456:	c3                   	ret    
 8048457:	89 f6                	mov    %esi,%esi
 8048459:	8d bc 27 00 00 00 00 	lea    0x0(%edi,1),%edi

08048460 <hwtime>:
 8048460:	55                   	push   %ebp
 8048461:	89 e5                	mov    %esp,%ebp
 8048463:	83 ec 14             	sub    $0x14,%esp
 8048466:	53                   	push   %ebx
 8048467:	0f 31                	rdtsc  
 8048469:	89 d1                	mov    %edx,%ecx
 804846b:	89 c1                	mov    %eax,%ecx
 804846d:	89 d3                	mov    %edx,%ebx
 804846f:	89 4d f8             	mov    %ecx,0xfffffff8(%ebp)
 8048472:	89 5d fc             	mov    %ebx,0xfffffffc(%ebp)
 8048475:	8b 4d f8             	mov    0xfffffff8(%ebp),%ecx
 8048478:	8b 5d fc             	mov    0xfffffffc(%ebp),%ebx
 804847b:	89 c8                	mov    %ecx,%eax
 804847d:	89 da                	mov    %ebx,%edx
 804847f:	eb 00                	jmp    8048481 <hwtime+0x21>
 8048481:	8b 5d e8             	mov    0xffffffe8(%ebp),%ebx
 8048484:	89 ec                	mov    %ebp,%esp
 8048486:	5d                   	pop    %ebp
 8048487:	c3                   	ret    
 8048488:	90                   	nop    
 8048489:	8d b4 26 00 00 00 00 	lea    0x0(%esi,1),%esi

- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Fri, 2 Nov 2001 12:23:36 +0100
From: Anders Gnistrup <agn@city.dk>
Subject: Re: [rtl] unresolved symbols and kernel libraries

On Thu, 1 Nov 2001 11:32:57 -0500 (EST)
"Calin A. Culianu" <calin@ajvar.org> wrote:

> On Wed, 31 Oct 2001, Wolfgang Denk wrote:
> 
> > Dear Pablo,
> >
> > in message <200110311630.LAA45562@fserv2.bu.edu> you wrote:
> > >
> > > That post cleared up a lot of things. I have a question: where do I go to
> > > start learning the kernel's library? Books, man pages, web sites?
> >
> > See  Documentation/kernel-docs.txt  in  your  Linux   kernel   source
> > directory for books and other pointers.
> >
> > Type "make pdfdocs" or "make psdocs" or "make htmldocs" in your Linux
> > kernel source directory to build the online documentation,  then  see
> > "Documentation/DocBook/kernel-api.pdf"  or  "*.ps"  or "*.html" for a
> > description of the Kernel API, especially "Chapter 3. Basic C Library
> > Functions".
> >
> > Wolfgang Denk
> 
> WOAH! I never knew that!  Thanks so much Wolfgang for that very very
> valuable tip!
> 
> *Running to linux source directory now to make ps docs...*
> 
well, the reason might be that it is only a part of the kernel from kernels 2,4,x

Anders Gnistrup

> -Calin
> 
> >
> >
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
> 
> 
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Fri, 2 Nov 2001 08:45:59 -0700 (MST)
From: John Regehr <regehr@cs.utah.edu>
Subject: Re: [rtl] Problems with RDTSC examples posted here recently

> if you compile method1 and method2A and look at the assembler coee they are
> absolutly the same - the only difference on the source level is that its easier
> to read "mov" than "0x31" thats all.

".byte 0x0f 0x31" is a synonym for "rdtsc" - look at your disassembly
again.  It's what we used in the bad old days when GNU assembler didn't
understand the rdtsc mnemonic.  The "mov" is spurious and harmful.

John

- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Fri, 2 Nov 2001 17:17:30 +0100 (CET)
From: Der Herr Hofrat <der.herr@hofr.at>
Subject: Re: [rtl] Problems with RDTSC examples posted here recently

> > if you compile method1 and method2A and look at the assembler coee they are
> > absolutly the same - the only difference on the source level is that its easier
> > to read "mov" than "0x31" thats all.
> 
> ".byte 0x0f 0x31" is a synonym for "rdtsc" - look at your disassembly
> again.  It's what we used in the bad old days when GNU assembler didn't
> understand the rdtsc mnemonic.  The "mov" is spurious and harmful.
>

yup - the mov is sensless.

overlooked that.

hofrat 
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Sat, 03 Nov 2001 02:03:12 +0000
From: ndrez@att.net
Subject: Re: [rtl] Problems with RDTSC examples posted here recently

Method2 is broken because it gives erroneous results.  
In my original post I presented a small program that 
called three different versions of a RDTSC functions 
(1,2,2A) and only method 1 gave results that were in any 
posssible way correct.  Since these are three different 
functions, there can't be any optimization issues 
between the source code in the three functions and it's 
not at all obvious -- at least to me -- where 
a "volatile" declaration could be put.  If someone could 
post a modified version of my program in method 2 or 
method 2a worked, I'd be very grateful.

 Norm
> > > On Thu, Nov 01, 2001 at 02:54:37PM -0700, John Regehr wrote:
> > > > > Don't forget to make sure it's __volatile__, elsewise this is the very
> > > > > epitome of what would produce dodgy results...
> > > > 
> > > > Right.  So method2 and method2A seem to be broken in multiple ways -
> > > > forget you ever saw them.  Rather, look at this page:
> > 
> > in what way is method2 brocken ??
> > 
> > if you compile method1 and method2A and look at the assembler coee they are
> > absolutly the same - the only difference on the source level is that its 
> easier
> > to read "mov" than "0x31" thats all.
> > 
> > ---method1---
> > __inline__ unsigned long long int rdtsc(void)
> > {
> > 	unsigned long long int x;
> > 	__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
> > 	return x;
> > }
> > 
> > 
> > ---method2A---
> > __inline__ unsigned long long int hwtime(void)
> > {
> > 	unsigned long long int x;
> > 	__asm__("rdtsc\n\t"
> > 		"mov %%edx, %%ecx\n\t"
> > 		:"=A" (x));
> > 	return x;
> > }
> >
> 
> forgot to put in objdump output in the last post
> 
> 
> 08048430 <rdtsc>:
>  8048430:	55                   	push   %ebp
>  8048431:	89 e5                	mov    %esp,%ebp
>  8048433:	83 ec 14             	sub    $0x14,%esp
>  8048436:	53                   	push   %ebx
>  8048437:	0f 31                	rdtsc  
>  8048439:	89 c1                	mov    %eax,%ecx
>  804843b:	89 d3                	mov    %edx,%ebx
>  804843d:	89 4d f8             	mov    %ecx,0xfffffff8(%ebp)
>  8048440:	89 5d fc             	mov    %ebx,0xfffffffc(%ebp)
>  8048443:	8b 4d f8             	mov    0xfffffff8(%ebp),%ecx
>  8048446:	8b 5d fc             	mov    0xfffffffc(%ebp),%ebx
>  8048449:	89 c8                	mov    %ecx,%eax
>  804844b:	89 da                	mov    %ebx,%edx
>  804844d:	eb 01                	jmp    8048450 <rdtsc+0x20>
>  804844f:	90                   	nop    
>  8048450:	8b 5d e8             	mov    0xffffffe8(%ebp),%ebx
>  8048453:	89 ec                	mov    %ebp,%esp
>  8048455:	5d                   	pop    %ebp
>  8048456:	c3                   	ret    
>  8048457:	89 f6                	mov    %esi,%esi
>  8048459:	8d bc 27 00 00 00 00 	lea    0x0(%edi,1),%edi
> 
> 08048460 <hwtime>:
>  8048460:	55                   	push   %ebp
>  8048461:	89 e5                	mov    %esp,%ebp
>  8048463:	83 ec 14             	sub    $0x14,%esp
>  8048466:	53                   	push   %ebx
>  8048467:	0f 31                	rdtsc  
>  8048469:	89 d1                	mov    %edx,%ecx
>  804846b:	89 c1                	mov    %eax,%ecx
>  804846d:	89 d3                	mov    %edx,%ebx
>  804846f:	89 4d f8             	mov    %ecx,0xfffffff8(%ebp)
>  8048472:	89 5d fc             	mov    %ebx,0xfffffffc(%ebp)
>  8048475:	8b 4d f8             	mov    0xfffffff8(%ebp),%ecx
>  8048478:	8b 5d fc             	mov    0xfffffffc(%ebp),%ebx
>  804847b:	89 c8                	mov    %ecx,%eax
>  804847d:	89 da                	mov    %ebx,%edx
>  804847f:	eb 00                	jmp    8048481 <hwtime+0x21>
>  8048481:	8b 5d e8             	mov    0xffffffe8(%ebp),%ebx
>  8048484:	89 ec                	mov    %ebp,%esp
>  8048486:	5d                   	pop    %ebp
>  8048487:	c3                   	ret    
>  8048488:	90                   	nop    
>  8048489:	8d b4 26 00 00 00 00 	lea    0x0(%esi,1),%esi
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
> 
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Sat, 3 Nov 2001 15:47:48 +0000
From: Chunky Kibbles <gjb105@cs.york.ac.uk>
Subject: Re: [rtl] Problems with RDTSC examples posted here recently

On Sat, Nov 03, 2001 at 02:03:12AM +0000, ndrez@att.net wrote:
> Method2 is broken because it gives erroneous results.  
> In my original post I presented a small program that 
> called three different versions of a RDTSC functions 
> (1,2,2A) and only method 1 gave results that were in any 
> posssible way correct.  Since these are three different 
> functions, there can't be any optimization issues 
> between the source code in the three functions and it's 
> not at all obvious -- at least to me -- where 
> a "volatile" declaration could be put.  If someone could 
> post a modified version of my program in method 2 or 
> method 2a worked, I'd be very grateful.


> > > ---method1---
> > > __inline__ unsigned long long int rdtsc(void)
> > > {
> > > 	unsigned long long int x;
> > > 	__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
> > > 	return x;
> > > }
> > > 
> > > 
> > > ---method2A---
> > > __inline__ unsigned long long int hwtime(void)
> > > {
> > > 	unsigned long long int x;
> > > 	__asm__("rdtsc\n\t"
> > > 		"mov %%edx, %%ecx\n\t"
> > > 		:"=A" (x));
> > > 	return x;
> > > }

Things, severally:

1) Use __volatile__, not volatile. Just an ANISism for clarity.

2) The mov is, in practice, as much use as a chocolate teapot. You're
achieving absolutely nada.

3) In the case you're using 2A, [It's been a long time since I did any
"serious" assembly], don't you need to give some clobber registers?
Specifically, something like:

- ---method2A-clobber---
__inline__ unsigned long long int hwtime(void)
{
 unsigned long long int x;
 __asm__("rdtsc\n\t"
          "mov %%edx, %%ecx\n\t"
          :"=A" (x)
	  :
          : "ecx");
  return x;
}

Or %ecx, or whatever it is. Can't remember, as I'm not using it.

In the end, here's some actual code I'm now using:

/* Ripped straight out of "vanilla" kernel */
#define rdtscll(x) \
        __asm__ __volatile__ ("rdtsc" : "=A" (x))

<snip>
long long int time_blocked,counter0,counter1;
do_some_funky_init_stuff();
        while (1) {
                rdtscll(counter0);
		pthread_wait_np ();
                rdtscll(counter1);
		time_blocked = counter1-counter0;
		rtf_put(fifo_out, (char *) &time_blocked,sizeof(time_blocked));
	}
</snip>

Obviously, that achieves very little except to tell you what _other_
processes in your system are doing to aid in the jitter of your piece
of code.
But still, it gets the point across, yes?

Gary (-;	

PS Norm, you've been instrumental in getting me this far, and thanks
(=
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Sun, 4 Nov 2001 14:51:27 +0000
From: Chunky Kibbles <gjb105@cs.york.ac.uk>
Subject: [rtl] Random question

What exactly does this achieve:

int pthread_wakeup_np (pthread_t thread)
{ 
#ifdef CONFIG_SMP
        if (thread->cpu != rtl_getcpuid()) {
                pthread_kill(thread,RTL_SIGNAL_WAKEUP);
                rtl_reschedule_thread(thread);
        } else
#endif  
        {
                pthread_kill(thread,RTL_SIGNAL_WAKEUP);
                rtl_reschedule_thread(thread);
        }
        return 0;
}
?

It's in rtl_sched.c, and, as I see it, if I'm running on an SMP box,
then your scheduler is doing an uneccessary comparison all the time,
and an unnecessary jump [branch? I can't ever remember which one's
which...] half the time...

Gary (-;
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Sun, 4 Nov 2001 08:26:20 -0800 (PST)
From: A V <anumula_rtl@yahoo.com>
Subject: [rtl] runtime image of module

Hi all,

  I want to know how the runtime image of a will
be.i.e where the stack will be and bss . Can somebody
help me.

Regards
Venkat

__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Mon, 5 Nov 2001 11:17:17 +0100
From: Ivan Martinez <im@iau.dtu.dk>
Subject: Re: [rtl] Can't use unistd.h in C++ realtime modules?

	Thank you,
	I need this to add C++ support to my Dynamic Systems Library (dslib.sf.net). 
It wouldn't be nice to ask users to modify RTLinux' header files, and I 
prefer not to complicate things by making the library generate aditional 
header files.
	So, is there a way of including "unistd.h" in the realtime module?. Using 
the following doesn't seem to make any difference:
extern "C" {
#incude <unistd.h>
}
	Regards,
	Ivan

On Friday 02 November 2001 08:42, David Hamilton wrote:
> Ivan,
> The rtl headers should but don't have
> #ifdef __cplusplus
> extern "C"
> #endif
> at the top.
> Therefore you have to make the extern "C" declaration yourself.
> I just use the example header (from examples/cpp) rtl_cpp.h and added
> #define <unistd.h>
> to it.
> Note: I moved the new and delete functions to another header
> (rtl_cpp_fun.h) so I could include rtl_cpp.h in multiple .cpp files, and
> include
> rtl_cpp_fun.h in just one (to avoid multiple copies of the function being
> linked together).
> David
>
> -----Original Message-----
> From: Ivan Martinez [mailto:im@iau.dtu.dk]
> Sent: 01 November 2001 15:19
> To: RTLinux mailing list
> Subject: [rtl] Can't use unistd.h in C++ realtime modules?
>
>
> 	Hello all,
> 	The first line of my C++ realtime module is:
>
> #include <unistd.h>
>
> 	Which produces the following compilation errors:
>
> In file included from /usr/src/rtlinux-3.1/linux/include/linux/wait.h:14,
>                  from /usr/src/rtlinux-3.1/linux/include/linux/fs.h:12,
>                  from /usr/src/rtlinux-3.1/include/rtl_posixio.h:13,
>                  from /usr/src/rtlinux-3.1/include/posix/unistd.h:17,
>                  from rtmodule.cpp:1:
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:35: parse error before
> `new' /usr/src/rtlinux-3.1/linux/include/linux/list.h: In function `void
> __list_add
> (...)':
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:39: `next' undeclared
> (first
>
> use this function)
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:39: (Each undeclared
> identifier is reported only once
> for each function it appears in.)
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:39: parse error before `;'
> /usr/src/rtlinux-3.1/linux/include/linux/list.h:42: `prev' undeclared
> (first
>
> use this function)
> ...
>
> 	I use the attached Makefile. Do you know what's wrong?.
> 	BTW, I don't really know which C and C++ libraries I can link in
> realtime
> modules, could anybody tell me where to find info about that?.
> 	Thank you,
> 	Ivan Martinez
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Mon, 05 Nov 2001 15:03:55 +0100
From: Thomas Sauter <sauter@2010pv.com>
Subject: Re: [rtl] Low Cost Term Life Insurance                         XMUM

don´t spam me again !!!!, i´am not interessted in your fucking insurance

QuoteSupport49@excite.com wrote:

> 
> 
>                   Term Quotes    Life Insurance Companies
> 
>             
> 
>  
> 
>  
> 
>   Since 1996, term life insurance rates have been reduced by as much as 70%
> 
> 40 year old male - $250,000 - 10 year level term
> As low as $10.44 per month!
> 
> At TermQuotes Life Insurance Companies of America, we will survey the 
> top life insurance companies for you and provide you with the best rates 
> available. The quote is free. There is no obligation to buy. Compare the 
> rates and see for yourself. Fill out this quick form below for further 
> information.
> 
> Results of computer survey 07-09-01
> Sample Annual Premiums
> * 10 Year Level Premium Term Rates *
> Age $250,000 $500,000 $1,000,000
> 35 $115 $175 $305
> 45 $210 $375 $670
> 55 $500 $935 $1,370
> 65 $1,305 $2,550 $4,920
> 70 $2,265 $4,480 $7,510
> 
> 
> *Above rates guaranteed to remain level for 10 years
> Rates based on male preferred class 1 non-smoker
> Policies are guaranteed renewable to age 95
> Policies with 15, 20, 25, and 30 year level premiums also available
> 
> Attention All Smokers,
> you may qualify for special reduced smoker rates!
> 
> Universal Life, Second-to-Die and Estate Planning products also provided.
> 
> Submit This Form for a Free Term Insurance Quote!
> 
> Name Insured: 
> Amount of Coverage:  
> Date of Birth: Month   Day Year
> Sex:  Male Female
> Height:  FT in
> Weight:  lbs.
> Occupation: 
> xxx
> Have You Ever Had:
> High Blood Pressure  Yes No
> Heart Attack or Stroke  Yes No
> Cancer  Yes No
> Diabetes  Yes No
> Mother, Father, Sister, Brother Diagnosed or Died of Cancer or 
> Cardiovascular Disease Before Age 60  Yes No
> Have You  Smoked Within the Last 12 Months  Yes No
> xxx
> Person Completing Request: 
> Mailing Address: 
> City:  State Zip
> Daytime Phone: 
> Evening Phone:  
> Email Address:  
> Best time to contact:
> 
> When you click submit it may start your spell check, so please click 
> "Ignore" if it does.
> 
>  
> YOUR INTERNET ADVERTISING
> CopyrightÿFFFFA92000-2001 . All Rights Reserved
> 
> This could be your ad!
> 
> Email Us <mailto:IllIlllIIIIIlllIIII@excite.com?subject=Direct Marketing 
> Inquiry> with your name and a good phone number to reach you.
> 
> If you think, that you will not benefit from this correspondence, please 
> click here. <http://www.removeyou.com>
> 
> -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail 
> majordomo@rtlinux.org OR echo "unsubscribe rtl " | mail 
> majordomo@rtlinux.org -- For more information on Real-Time Linux see: 
> http://www.rtlinux.org/


- -- 
Thomas Sauter                               Tel. 06221/75933-15
20/10 Perfect Vision                        sauter@2010pv.com
Waldhofer Str. 100
D-69123 Heidelberg

- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Mon, 05 Nov 2001 15:05:14 +0100
From: Thomas Sauter <sauter@2010pv.com>
Subject: Re: [rtl] Marketing is the LIFEBLOOD of your Business                VUFMMO

Don´t spam me again - I´am not interessted in whatever you like to sell 
me folks !!!!

InternetSales3@excite.com wrote:

> As a dot.com professional you know that it is essential to your teams'
> success to advertise your web site, business, product, service, or your
> organizations' cause to the masses. You also know that your marketing and
> advertising budget limits your options.
> 
> If you are a Fortune 500 corporation, you have the advantage of being able
> to book 30 second TV spots during the SuperBowl. Most of us are not in
> that position though. Besides, did you know that something on the order of
> 92% of TV viewers run to the washroom at commercial breaks during the
> program, thereby missing the expensive commercial spot.
> 
> Q: Of all the various advertising mediums which do you feel is most
> effective, in cases when you require your prospect to remember your
> telephone number or web address?
> 
> Let's outline and agree on a list of the main advertising and marketing
> mediums first:
> 
> - Television Commercial
> - Television Infomercial
> - Internet Banner Ads (paid for on a click-through basis)
> - Internet Banner Ads (paid for on an impression basis)
> - So-Called opted-in email list rental and broadcast
> - Radio Commercial
> - Print Media (Newspapers, Magazines)
> - Print Media (Hand-Outs)
> - Trade Shows
> - News or Media organization story or profile on your project
> - Affiliate Links
> - Signage
> - Telemarketing
> - Direct Mail 
> - Broadcast Fax (not personalized to its recipients)
> - Broadcast Fax (personalized and to the Attention of its recipients)
> - Targeted Broadcast Email (personalized or not)
> 
> Now consider the effectiveness of each advertising choice, remembering
> that in many cases your audience must still remember a telephone number in
> order to contact you.
> 
> Q: Which is the least costly and most effective?
> 
> E-mail marketing works! Why? There are many reasons, but primarily because
> people are focused on their monitors while checking their e-mail. Totally
> focused. In addition, they have a hard copy of your ad on their hard
> drive, and it is simple for them to forward the ad to their friends and
> associates as well.
> 
> You can tell your story with more words and target your list to particular
> types of recipients or geographical areas.
> 
> Rates are as follows;
> 
> 1 million messages      $1249.95
> 3 million messages      $3249.95
> 5 million messages      $4999.95
> 
> If you want to book your ad or talk with a representative, please complete
> the form and fax it to: 972-931-8724
> 
> 
> Your Name: ___________________________________________________________
> 
> Company: _____________________________________________________________
> 
> Telephone: ____________________________________________ Ext: _________
> 
> Fax: _______________________________________________
> 
> E-Mail: ______________________________________________________________
> 
> Date: ___________________________
> 
> 
> 
> 
> 
> 
> "THIS MESSAGE IS BEING SENT IN COMPLIANCE OF THE EMAIL BILL: SECTION 301. PER SECTION #)!, PARAGRAPH (a) (2) (c) of S. 1618. WE RENTED YOUR EMAIL ADDRESS FOR A ONE TIME MAILING AS THAT OF AN INDIVIDUAL INTERESTED IN RECEIVING INFORMATION ABOUT LEGITIMATE BUSINESS. IF THIS MESSAGE IS IN ERROR, PLEASE FORGIVE THIS INTRUSION AND REPLY A BLANK EMAIL WITH "UNSUBSCRIBE" IN THE SUBJECT LINE TO AND YOUR ADDRESS WILL BE IMMEDIATELY AND PERMANENTLY REMOVED FROM OUR LIST"
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
> 
> 
> 
> 


- -- 
Thomas Sauter                               Tel. 06221/75933-15
20/10 Perfect Vision                        sauter@2010pv.com
Waldhofer Str. 100
D-69123 Heidelberg

- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Mon, 5 Nov 2001 11:29:29 -0500 (EST)
From: "Calin A. Culianu" <calin@ajvar.org>
Subject: Re: [rtl] runtime image of module

On Sun, 4 Nov 2001, A V wrote:
>
> Hi all,
>
>   I want to know how the runtime image of a will
> be.i.e where the stack will be and bss . Can somebody
> help me.

All modules run in kernel space. This means that the address space of a
running module is the same logical address space that the kernel itself
uses -- this is because a module IS the kernel.  Memory for modules is
cleanly allocated during the module's creation and cleanly free'd during
the module's destruction. (with the exception for memory the module itself
explicitly allocates using kmalloc).

As far as stacks go: Well, that depends... you may have several stacks if
you go and create yourself several threads inside your module.  The other
data and code segments and such all get allocated by the kernel in kernel
space via kmalloc probably during the create_module() system call. For
more info, module.c in the kernel/ subtree of the linux source tree can
answer many of your questions... :)

As for where exactly stacks come from in the linux kernel when tasks run
on behalf of users or during bottom-halves of drivers: that's a good
question. I would imagine that actually there are fewer kernel stacks than
there are kernel tasks.  Most of the time tasks spend their time running
in user mode, where they get their own user stacks.. as for when they run
in kernel mode during system calls, they probably get these temporary
stacks that go away completely as soon as the system call returns to user
mode.

I kind of wish I knew more about the kernel and the relationship between
different threads of execution and dedicated kernel tasks.... Oh well..
maybe someone else can shed more light on this matter...

- -Calin




>
> Regards
> Venkat
>
> __________________________________________________
> Do You Yahoo!?
> Find a job, post your resume.
> http://careers.yahoo.com
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
>

- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

Date: Mon, 05 Nov 2001 14:02:34 -0500
From: "Oportunidades en la red" <oportunidades@007mundo.com>
Subject: [rtl] Ya está GANANDO dinero con Orbitel?

Hola rtl@rtlinux.org!     Dos ideas claves: 

1) Ahorrar en larga distancia
2) Ganar dinero por el consumo de los que usted invita

Este mes ha salido el mejor plan de larga distancia que ha habido en el mercado. 
Se trata del Plan Ahorro de Orbitel. 

Este plan une todos los planes, para así permitir no sólo tener las mejores tarifas 
en larga distancia nacional sino también, dentro del mismo plan, escoger el destino 
internacional al que llamamos más frecuentemente y  lograr descuentos, a este 
último destino, por encima del 50%. 

El plan tiene las siguientes características:

*$ 195 pesos minuto a cualquier destino nacional, veinticuatro horas al día. 

*Adicionalmente podemos escoger un destino internacional con descuento mayor 
al 50%. 
*Además tenemos una hora feliz de 9 a 10 PM. que nos da el precio increíble de 
$150 pesos cualquier destino nacional y $500 pesos cualquier destino internacional.
*Y lo mejor de todo, usted puede ahora participar en el negocio de Orbitel invitando 
a sus amigos a participar en la red de usuarios de ORBITEL, eMultiRed y ayudarlos 
a ahorrar y ganar dinero y USTED TAMBIÉN GANA POR EL CONSUMO DE ELLOS!

Increíble, verdad?

Bueno, yo no creía y estoy viendo los resultados…
Inscríbase sin costo, haciendo clic aquí:

http://www.emultired.com/ASP/PlanNegocios.asp?ida=1002799

Si usted desea lograr ingresos importantes, que le permitan vivir de este negocio 
en el término de uno a dos años, tiene en este momento la oportunidad de afiliar 
a todo el mundo, dado que hoy por hoy el plan Ahorro no tiene competencia en 
el mercado. Si usted le envía email a todo el mundo y explica este espectacular 
plan, podrá afiliar diariamente a muchísimas personas… Y ganar dinero por los 
consumos de TODOS LOS QUE ESTÉN EN SU GRUPO!!!

Clic?

http://www.emultired.com/ASP/PlanNegocios.asp?ida=1002799













- --------------------

E-Mail sent using the Free Trial Version of WorldMerge, the fastest
and easiest way to send personalized e-mail messages. For more
information visit http://www.coloradosoft.com/worldmrg

71252

- -- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
- --
For more information on Real-Time Linux see:
http://www.rtlinux.org/

------------------------------

End of rtl-digest V1 #138
*************************