Linux-Development-Sys Digest #562, Volume #8 Tue, 13 Mar 01 05:13:10 EST
Contents:
Re: AT&T vs Intel x86 asm format (Alexander Viro)
Re: AT&T vs Intel x86 asm format (Kaz Kylheku)
Re: The kernel equivalent of _enable() & _disable() (Kaz Kylheku)
Re: AT&T vs Intel x86 asm format
Re: AT&T vs Intel x86 asm format (Robert Redelmeier)
AMR ??? (Aminudin Khalid)
Re: How to use C++ to develope the linux driver module?
Re: Can linux be trusted?
Re: Can linux be trusted?
Re: C language (Josef Moellers)
How to "preload a glibc shared object" (Gaurav Navlakha)
Re: How to use C++ to develope the linux driver module? ("O.Petzold")
Re: How to use C++ to develope the linux driver module? (Erik de Castro Lopo)
Re: AT&T vs Intel x86 asm format (Rene Herman)
Re: How to "preload a glibc shared object" ("Aneesh Kumar K.V")
logging/recording of shell inputs/outputs (Hans-Friedrich Koetter)
Re: AMR ??? (Kenneth R�rvik)
Re: logging/recording of shell inputs/outputs (Josef Moellers)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (Alexander Viro)
Subject: Re: AT&T vs Intel x86 asm format
Date: 12 Mar 2001 20:39:55 -0500
In article <[EMAIL PROTECTED]>,
D. Stimits <[EMAIL PROTECTED]> wrote:
>I'm looking for a URL or other reference that will give me a cross
>reference between nasm/Intel syntax asm versus AT&T/as syntax for x86
>Linux.
>
>Also, if I use gcc or g++ and compile with a -S to generate assembler,
>and I end up with a "movl" line, e.g.:
>movl -8(%ebp),%eax
>
>Can someone tell me on this specific movl which exact mov instruction
>this corresponds to in x86 assembler under Intel pneumonics? There is a
>sizeable family of movl... instructions, but none simply named "movl"
>(at least not in the Intel asm reference).
It's eax = *(long*)(ebp-8); IIRC in Intel syntax that would be
MOV DWORD PTR [EBP-8], EAX
or something like that (bugger if I remember their weird syntax for
object size). AT&T syntax takes the object size into command suffix -
'l' in "movl" is for "long". Symplifies the operands' syntax...
Notice that default is a memory operand -
movl 12345, %eax ; eax = *(u32*)(12345);
movl some_var, %eax ; eax = some_var;
$ prefix prevents dereferencing
movl $12345, %eax ; eax = 12345;
movl $some_var, %eax ; eax = &some_var;
BTW, the following is also legitimate:
movl eax, %eax
- since registers are prefixed with % their names are not reserved, you
can have a variable with the same name. E.g. line above puts the contents of
variable called eax into the register eax, etc.
Names are simply replaced with addresses. Offsets are written as below:
movb line(%ebx), %cl
is cl = line[ebx];.
Having several offsets goes like
movb line(%eax,%ebx), %cl ; cl = line[eax+ebx]
and x86 [base + offset + scale * offset2] addressing mode is written as
base(offset, offset2, scale).
Obviously, target is the second argument (add eax to ebx is
addl %eax,%ebx
not
ADD EBX, EAX
as in Intel syntax). Matter of taste, indeed, but IMO AT&T form is
more convenient...
What else? Syntax for labels is the same for both, except that
5: ....
....
call 5f
....
jz 5b
....
5: ....
is legitimate - call will got to the second label, jz to the first
(5f - search forward for 5:, 5b - search backwards for 5:). Obviously
convenient for macros.
For jumps/calls/etc. argument is _not_ dereferenced. I.e.
jmp foo ; jump to address foo
jmp *foo ; jump to the address stored in variable foo
jmp *%ebx ; jump to address stored in ebx
jmp *foo(,%ebx,4) ;jump to address stored in ebx'th element of array foo
and the same goes for calls, condtitional jumps, loops, etc.
(comment on the last example: you can omit parts of index expression,
interpretation sould be obvious)
As for the reference... info page on as(1) would probably be useful.
--
"You're one of those condescending Unix computer users!"
"Here's a nickel, kid. Get yourself a better computer" - Dilbert.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: AT&T vs Intel x86 asm format
Reply-To: [EMAIL PROTECTED]
Date: Tue, 13 Mar 2001 01:57:29 GMT
On Mon, 12 Mar 2001 17:24:10 -0700, D. Stimits <[EMAIL PROTECTED]> wrote:
>I'm looking for a URL or other reference that will give me a cross
>reference between nasm/Intel syntax asm versus AT&T/as syntax for x86
>Linux.
>
>Also, if I use gcc or g++ and compile with a -S to generate assembler,
>and I end up with a "movl" line, e.g.:
>movl -8(%ebp),%eax
This is simple indirect addressing with a displacement. The value -8 is
added to EBP to form an address from which 32 bits are moved into EAX.
>Can someone tell me on this specific movl which exact mov instruction
>this corresponds to in x86 assembler under Intel pneumonics? There is a
Pneumonics is an excellent word for the, er, inflated syntax, which
is something like:
MOV EAX, DWORD PTR [EBP - 8]
:)
>sizeable family of movl... instructions, but none simply named "movl"
>(at least not in the Intel asm reference).
The l suffix determines the width of the data being operated on,
expressing in one letter that for which some imbecile invented
the notation ``DWORD PTR''.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: The kernel equivalent of _enable() & _disable()
Reply-To: [EMAIL PROTECTED]
Date: Tue, 13 Mar 2001 02:04:59 GMT
On Mon, 12 Mar 2001 20:56:29 GMT, Matt <[EMAIL PROTECTED]> wrote:
>I'm porting some Windows driver code and I've come across these little
>blocks of code every so often:
>
>#ifndef WIN32
>_disable();
>#endif
>
>#ifndef WIN32
>_enable();
>#endif
>
>Am I correct in assuming they are to do with interrupts? They are
>wrapped around some I/O port accesses, but AFAIK the card doesn't
>generate any interrupts. Are cli() and sti() the kernel equivalents?
It could be that accesses to the ports must be done in real-time.
You definitely do not want to use cli() and sti(). To disable
interrupts on the current processor, use __cli() and __sti().
Code which uses _disable and _enable to create a critical region should
be ported to Linux using spin_lock_irqsave and spin_unlock_irqrestore,
which are powerful enough to lock out an interrupt service routine on
one processor from a critical region held by another processor.
And
>do I need to use them, seems as WIN32 platforms don't either?
I suspect the purpose of the #ifndef directives may be to allow the
code to be compiled in Win32 user space, for some kind of limited
testing.
------------------------------
From: <[EMAIL PROTECTED]>
Subject: Re: AT&T vs Intel x86 asm format
Date: Mon, 12 Mar 2001 18:45:38 -0800
Look back in these posts a bit and you will see some discussion about inline
assembler syntax about 2 weeks ago including a URL to some useful help.
"Kaz Kylheku" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Mon, 12 Mar 2001 17:24:10 -0700, D. Stimits <[EMAIL PROTECTED]> wrote:
> >I'm looking for a URL or other reference that will give me a cross
> >reference between nasm/Intel syntax asm versus AT&T/as syntax for x86
> >Linux.
> >
> >Also, if I use gcc or g++ and compile with a -S to generate assembler,
> >and I end up with a "movl" line, e.g.:
> >movl -8(%ebp),%eax
>
> This is simple indirect addressing with a displacement. The value -8 is
> added to EBP to form an address from which 32 bits are moved into EAX.
>
> >Can someone tell me on this specific movl which exact mov instruction
> >this corresponds to in x86 assembler under Intel pneumonics? There is a
>
> Pneumonics is an excellent word for the, er, inflated syntax, which
> is something like:
>
> MOV EAX, DWORD PTR [EBP - 8]
>
> :)
>
> >sizeable family of movl... instructions, but none simply named "movl"
> >(at least not in the Intel asm reference).
>
> The l suffix determines the width of the data being operated on,
> expressing in one letter that for which some imbecile invented
> the notation ``DWORD PTR''.
>
------------------------------
Date: Mon, 12 Mar 2001 21:17:53 -0600
From: Robert Redelmeier <[EMAIL PROTECTED]>
Subject: Re: AT&T vs Intel x86 asm format
D. Stimits wrote:
>
> I'm looking for a URL or other reference that will give me a cross
> reference between nasm/Intel syntax asm versus AT&T/as syntax for x86
> Linux.
http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html
> Also, if I use gcc or g++ and compile with a -S to generate assembler,
> and I end up with a "movl" line, e.g.:
> movl -8(%ebp),%eax
As it should be! This moves the first function parameter into
%eax. 0(%ebp) contains old ebp, -4(%ebp) contains the return addr.
%ebp is as usually the current stack frame pointer.
In Intel syntax: `mov eax, dword ptr [ebp - 8]`
-- Robert "You have to play the hand you are dealt in Silicon."
------------------------------
From: Aminudin Khalid <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.hardware
Subject: AMR ???
Date: Tue, 13 Mar 2001 21:54:12 +0800
Reply-To: [EMAIL PROTECTED]
Hi,
What is AMR ?
Where can I get the AMR specification ?
Does Linux support AMR devices ?
Do we have any linux library to program AMR devices ?
------------------------------
From: [EMAIL PROTECTED] ()
Subject: Re: How to use C++ to develope the linux driver module?
Date: Tue, 13 Mar 2001 06:22:58 -0000
In article <[EMAIL PROTECTED]>,
�B�_�� <[EMAIL PROTECTED]> wrote:
> I need to port a driver module written in C++ to linux .
Translate it to C. While the topic of using C++ for drivers hass
come up here many times it isn't easy to do nor very desirable.
--
http://www.spinics.net/linux
------------------------------
From: [EMAIL PROTECTED] ()
Crossposted-To:
comp.lang.c,comp.os.linux.development.apps,comp.sys.be.programmer,comp.sys.mac.programmer.misc,comp.unix.bsd.freebsd.misc,comp.unix.bsd.misc,gnu.gcc,linux.dev.gcc
Subject: Re: Can linux be trusted?
Date: Tue, 13 Mar 2001 06:30:02 -0000
In article <98bo3h$etb$[EMAIL PROTECTED]>,
Richard Tobin <[EMAIL PROTECTED]> wrote:
>>Remember that 3.0 isn't
>>the same as 3 and (depending on how your floats are encoded) might be
>>2.99999999.
>If your floats are encoded in any way that is actually used, 3 will be
>represented exactly.
You might be surprised at how floats can be encoded in real life. But even
so will 0.3 be exact?
--
http://www.spinics.net/photo
------------------------------
From: [EMAIL PROTECTED] ()
Crossposted-To:
comp.lang.c,comp.os.linux.development.apps,comp.sys.be.programmer,comp.sys.mac.programmer.misc,comp.unix.bsd.freebsd.misc,comp.unix.bsd.misc,gnu.gcc
Subject: Re: Can linux be trusted?
Date: Tue, 13 Mar 2001 06:32:13 -0000
In article <[EMAIL PROTECTED]>, Robert Redelmeier <[EMAIL PROTECTED]> wrote:
>> How ? Is it an exact binary number ?
>YES! 3d = 1.1b * 2^1b .
>
>In general, all non-mantissa over[under?]flowing integers
>can be exactly representing by floats.
You are assuming that normalized floats are x.xxxx * 10^nn and not
0.xxxx * 10^nn.
--
http://www.spinics.net/linux
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: C language
Date: Tue, 13 Mar 2001 07:55:31 +0100
[EMAIL PROTECTED] wrote:
> >> > ((Open)(buffer->port_open))(buffer->context, 1,port_number);
> =
> Ok, buffer->port_open is a pointer to a function that
> returns BOOLEAN.
No, it's not, it's _casted_ into a "pointer to a function that returns
BOOLEAN". It could be everything, but should be at least of pointer
size.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
From: Gaurav Navlakha <[EMAIL PROTECTED]>
Subject: How to "preload a glibc shared object"
Date: Tue, 13 Mar 2001 01:46:05 -0600
Hi all,
I'm trying to make RealPlayer run on linux with a
patch available at www.i2k.com/~jeffd/rpopen. It says that there is a
shared object that must be preloaded when running RealPlayer.
If someone can please look at this site and figure out and let me know
how to go about doing this, I should be grateful.
Thanks very much,
Gaurav.
------------------------------
From: "O.Petzold" <[EMAIL PROTECTED]>
Subject: Re: How to use C++ to develope the linux driver module?
Date: Tue, 13 Mar 2001 09:32:11 +0100
"Peter T. Breuer" wrote:
> <[EMAIL PROTECTED]> wrote:
> > Can C++ be used in developing kernel module? and if yes, how
>
> No (short answer).
>
> > can I do to fix the problems?
>
> You can implement C++ memory and exception handling in the kernel.
> Etc.
Hi,
do you have the code for exception handling in kernel space ? This is
imo very
compiler specific. I'm locking forward to get it.
Implementing new/delete using kmalloc/kfreee or vmalloc/vfree isn't that
problem.
You can't use rtti and exceptions basicly (therefore to wish to see the
eh code
for kernel). Take a lock to the rtl mailing list archive at
<www.rtlinux.org>. There
where some threads about.
On my experience using c++ in kernel isn't easy since it's not fully
suported even if
you share code between user and kernel space as me. Unfortunally I
forgot how to
write C ..... 8)
Regards
Olaf
------------------------------
From: Erik de Castro Lopo <[EMAIL PROTECTED]>
Subject: Re: How to use C++ to develope the linux driver module?
Date: Tue, 13 Mar 2001 08:23:35 GMT
O.Petzold wrote:
>
> "Peter T. Breuer" wrote:
>
> > <[EMAIL PROTECTED]> wrote:
> > > Can C++ be used in developing kernel module? and if yes, how
> >
> > No (short answer).
> >
> > > can I do to fix the problems?
> >
> > You can implement C++ memory and exception handling in the kernel.
> > Etc.
>
> Hi,
>
> do you have the code for exception handling in kernel space ? This is
> imo very
> compiler specific. I'm locking forward to get it.
>
> Implementing new/delete using kmalloc/kfreee or vmalloc/vfree isn't that
> problem.
> You can't use rtti and exceptions basicly (therefore to wish to see the
> eh code
> for kernel). Take a lock to the rtl mailing list archive at
> <www.rtlinux.org>. There where some threads about.
Yes, it is possible to do it.
Is it a good idea? No!
So why go throught the pain?
Erik
--
=================================================================
Erik de Castro Lopo [EMAIL PROTECTED] (Yes its valid)
=================================================================
Those who do not understand Unix are condemned to reinvent it, poorly.
-- Henry Spencer
------------------------------
From: Rene Herman <[EMAIL PROTECTED]>
Subject: Re: AT&T vs Intel x86 asm format
Date: Tue, 13 Mar 2001 09:35:42 +0100
D. Stimits wrote:
> movl -8(%ebp),%eax
mov eax, [ebp - 8]
I saw some other replies adding a "dword ptr" to this example, which is
of course utterly unnecesary in any half-decent intel syntax assembler,
since the use of "eax" (a 32 bit destination register) unambigiously
specifies the transfer-size already.
AT&T syntax is usually overly verbose (movl), and annoying to anyone
used to intel syntax. The reversal of source and dest operands might be
considered a matter of taste. Most of its other features are to be
considered a matter of bad taste.
Note that starting with binutils-2.10 as can also assemble intel syntax
(.intel_syntax). Refer to the Assembly-HOWTO.
------------------------------
From: "Aneesh Kumar K.V" <[EMAIL PROTECTED]>
Subject: Re: How to "preload a glibc shared object"
Date: Tue, 13 Mar 2001 14:32:51 +0530
Hi ,
export LD_PRELOAD =/home/guest/a.so
Try man ld.so on linux or man ld.so.1 on solaris
-aneesh
Gaurav Navlakha wrote:
> Hi all,
>
> I'm trying to make RealPlayer run on linux with a
> patch available at www.i2k.com/~jeffd/rpopen. It says that there is a
> shared object that must be preloaded when running RealPlayer.
>
> If someone can please look at this site and figure out and let me know
> how to go about doing this, I should be grateful.
>
> Thanks very much,
> Gaurav.
------------------------------
From: [EMAIL PROTECTED] (Hans-Friedrich Koetter)
Subject: logging/recording of shell inputs/outputs
Date: 13 Mar 2001 08:56:31 GMT
Reply-To: [EMAIL PROTECTED]
Hi,
I'm searching for a program which starts a shell or starts in a shell. All command
typed in this shell and all responses from the system should then be logged into a
file so one can parse all in- and outputs.
Does anybody knows such a tool and/or can give me an URL where I can find software to
monitor / log shell-inputs and outputs?
THX for your help!
Hans
--
--
=======================================================================
Dipl.-Inform. Hans-Friedrich Koetter | "640K sollte genug fuer
FernUniversitaet Hagen | jedermann sein."
LG DatenVerarbeitungsTechnik (DVT) |
58084 Hagen | Bill Gates (1981)
Tel.:(02331) 987-4538 |
Fax :(02331) 987-375 |
EMail: [EMAIL PROTECTED]|
------------------------------
Crossposted-To: comp.os.linux.hardware
Subject: Re: AMR ???
From: [EMAIL PROTECTED] (Kenneth R�rvik)
Date: Tue, 13 Mar 2001 09:21:47 GMT
[EMAIL PROTECTED] (Aminudin Khalid) wrote in <[EMAIL PROTECTED]>:
>What is AMR ?
Audio/Modem Riser - a special slot to insert cheap software modems. These
cards use the system CPU for many functions that are done in hardware in
real modems. Much like the dreaded winmodems that use the PCI bus.
>Where can I get the AMR specification ?
Don't know, but try Intel.
>Does Linux support AMR devices ?
Not as far as I know.
>Do we have any linux library to program AMR devices ?
Not that I know of.
--
Kenneth R�rvik 91841353/22950312
Nordbergv. 60 A [EMAIL PROTECTED]
0875 OSLO home.no.net/stasis
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: logging/recording of shell inputs/outputs
Date: Tue, 13 Mar 2001 10:28:34 +0100
Hans-Friedrich Koetter wrote:
> =
> Hi,
> =
> I'm searching for a program which starts a shell or starts in a shell. =
All command
> typed in this shell and all responses from the system should then be lo=
gged into a
> file so one can parse all in- and outputs.
"script" logs all output into a file (typescript).
You should try to get a copy of Richard Stevens' "Advanced Programming
in the Unix Environment". He describes how logging is done and you get
the source.
> Does anybody knows such a tool and/or can give me an URL where I can fi=
nd software to monitor / log shell-inputs and outputs?
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list by posting to the
comp.os.linux.development.system newsgroup.
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************