Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Alpha asm & Linux
@ 1999-05-02  3:26 Dan Morrill
  1999-05-02  4:01 ` Wai-Sun Chia
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Morrill @ 1999-05-02  3:26 UTC (permalink / raw)
  To: axp-list


I need to learn about some of the lower levels of how Linux works on the Alpha.
Specifically, I need to know some basic Alpha assembly and how Linux/Alpha
handles calling conventions (i.e. are parameters passed on the stack or in
registers, etc.)  I need to know what happens at the assembly level when a
program makes a function call on the Alpha.


I hate to ask this question since I know it's been asked before, but can anyone
recommend a good way to learn this information?  (e.g. where to look in kernel
sources for calling conventions, a good source for Alpha asm, etc.)


Dan Morrill
Computer Scientist, Physicist


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Alpha asm & Linux
  1999-05-02  3:26 Alpha asm & Linux Dan Morrill
@ 1999-05-02  4:01 ` Wai-Sun Chia
  1999-05-02 16:12   ` Jeff DeMaagd
  0 siblings, 1 reply; 10+ messages in thread
From: Wai-Sun Chia @ 1999-05-02  4:01 UTC (permalink / raw)
  To: axp-list

Dan Morrill wrote:
> 
> I need to learn about some of the lower levels of how Linux works on the Alpha.
> Specifically, I need to know some basic Alpha assembly and how Linux/Alpha

Check these out:
http://ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html

<snip>
-- 
Wai-Sun "squidster" Chia
Web/Unix Developer
Network & System Intergration Services
MSA


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Alpha asm & Linux
  1999-05-02  4:01 ` Wai-Sun Chia
@ 1999-05-02 16:12   ` Jeff DeMaagd
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff DeMaagd @ 1999-05-02 16:12 UTC (permalink / raw)
  To: axp-list

On Sun, 2 May 1999, Wai-Sun Chia wrote:

> Dan Morrill wrote:
> > 
>> I need to learn about some of the lower levels of how Linux works on
>> the Alpha.  Specifically, I need to know some basic Alpha assembly and
>> how Linux/Alpha..
> 
> Check these out:
> http://ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html

Linux's calling conventions in softare are compatible with Digital UNIX's.
There are links on alphalinux.org that gives you links to DEC's DU
software documentation, nearly all of it is available in Word, .ps, .pdf
or HTML formats.

Jeff DeMaagd


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Alpha asm & Linux
@ 1999-05-03 13:14 Tenhave, Tim
  1999-05-03 15:13 ` Uncle George
  0 siblings, 1 reply; 10+ messages in thread
From: Tenhave, Tim @ 1999-05-03 13:14 UTC (permalink / raw)
  To: 'axp-list@redhat.com'

Hi Dan,

You can find the Compaq/Digital Tru64 UNIX docs through the following
link...

http://www.unix.digital.com/faqs/publications/pub_page/doc_list.html

Follow the link to the latest UNIX (4.0E) and locate the link to the 
"Programming" docs.  In there is the latest ASM book.

Enjoy,

Tim


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Alpha asm & Linux
  1999-05-03 13:14 Tenhave, Tim
@ 1999-05-03 15:13 ` Uncle George
  1999-05-03 17:12   ` Philip Blundell
  1999-05-03 17:55   ` Wes Bauske
  0 siblings, 2 replies; 10+ messages in thread
From: Uncle George @ 1999-05-03 15:13 UTC (permalink / raw)
  To: axp-list

This book/docs may explain the machine instructions & architecture
issues - it certainly does not explain how to really write an assembly
program on linux/alpha - or incorporate the assembler in the "C"
__asm__  stuff. Also more annoying is the register nameing convensions -
i'd like very much to use t0, a0 and the like.
gat
BTW assembler & UNIX has always been difficult

Tenhave, Tim wrote:

>
> Follow the link to the latest UNIX (4.0E) and locate the link to the
> "Programming" docs.  In there is the latest ASM book.
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Alpha asm & Linux
  1999-05-03 15:13 ` Uncle George
@ 1999-05-03 17:12   ` Philip Blundell
  1999-05-03 20:33     ` Uncle George
  1999-05-03 17:55   ` Wes Bauske
  1 sibling, 1 reply; 10+ messages in thread
From: Philip Blundell @ 1999-05-03 17:12 UTC (permalink / raw)
  To: axp-list

>This book/docs may explain the machine instructions & architecture
>issues - it certainly does not explain how to really write an assembly
>program on linux/alpha - or incorporate the assembler in the "C"
>__asm__  stuff. 

Neither of these issues is really Alpha specific or even Linux specific.  The 
details of GCC's "asm" facility are in the GCC manual.

p.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Alpha asm & Linux
  1999-05-03 15:13 ` Uncle George
  1999-05-03 17:12   ` Philip Blundell
@ 1999-05-03 17:55   ` Wes Bauske
  1999-05-04 11:26     ` Uncle George
  1 sibling, 1 reply; 10+ messages in thread
From: Wes Bauske @ 1999-05-03 17:55 UTC (permalink / raw)
  To: axp-list

Uncle George wrote:
> 
> This book/docs may explain the machine instructions & architecture
> issues - it certainly does not explain how to really write an assembly
> program on linux/alpha - or incorporate the assembler in the "C"
> __asm__  stuff. Also more annoying is the register nameing convensions -
> i'd like very much to use t0, a0 and the like.

If you snoop around in the kernel code, you can find
examples of how to inline asm in C code.

> gat
> BTW assembler & UNIX has always been difficult
> 

In what way? The calling interface is more painful
from what I've seen. By splitting the args between
regs and memory, one can make the code faster so 
it's a tradeoff in complexity for speed. Also, by 
inlining things inside C, you can avoid having to
code your own interface. Also, asm for the specific 
machine has it's own quirks but no more so than 
other machines. Other than that, its just managing
the stack. What am I not seeing?


Wes


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Alpha asm & Linux
  1999-05-03 17:12   ` Philip Blundell
@ 1999-05-03 20:33     ` Uncle George
  0 siblings, 0 replies; 10+ messages in thread
From: Uncle George @ 1999-05-03 20:33 UTC (permalink / raw)
  To: axp-list

Ha Ha Ha,
u mean the gcc (egcs) manual for tha alpha. I'm sure u can be more specific.
gat

Philip Blundell wrote:

> >This book/docs may explain the machine instructions & architecture
> >issues - it certainly does not explain how to really write an assembly
> >program on linux/alpha - or incorporate the assembler in the "C"
> >__asm__  stuff.
>
> Neither of these issues is really Alpha specific or even Linux specific.  The
> details of GCC's "asm" facility are in the GCC manual.
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Alpha asm & Linux
  1999-05-03 17:55   ` Wes Bauske
@ 1999-05-04 11:26     ` Uncle George
  1999-05-04 18:12       ` Wes Bauske
  0 siblings, 1 reply; 10+ messages in thread
From: Uncle George @ 1999-05-04 11:26 UTC (permalink / raw)
  To: axp-list

Wes Bauske wrote:

> Uncle George wrote:
> >
>
> If you snoop around in the kernel code, you can find
> examples of how to inline asm in C code.
>

Yup, thats how u know that that particular ( __asm__) facility is available,
as well as __inline__ , there is probably some more esoteric enhancements.

>
> > gat
> > BTW assembler & UNIX has always been difficult
> >
>
> In what way?

    Take for instance    Opcodes.    Ever try to figure out how to add "/U"
or "/S" or "/V", i'm sure i can find more strangeness if i were to try all
the opcodes!
    Old pdp11/ATT unix assembler jumps/goto's were either a forward ref of
backward ref.
    I cant tell if branch labels is gonna be defined as a local symbol or
global.
    Register conventions ( in __asm__ u gotta know that $9 is s0 )
    Yes, frontend & backend "C" linkages. I generally take a "something.c"
program with the same   arglist an "C" compile with -S. THEN
    u also observe in the resultant .s  file various assembler directives
that does who knows what, and if u reserarch l( perservere ) ong enough u
will find them based on "dec unix"
    Debugging - need i say more
        A particular peeve is that the opcode isn;t always printed out with
an Alpha assembler opcode
        Try matching register conventions with "cc -S", and gdb

> The calling interface is more painful
> from what I've seen. By splitting the args between
> regs and memory, one can make the code faster so
> it's a tradeoff in complexity for speed. Also, by

> inlining things inside C,

Did u mean __asm__ rather than inlineing ?

> you can avoid having to
> code your own interface. Also, asm for the specific
> machine has it's own quirks but no more so than
> other machines. Other than that, its just managing
> the stack.

    Dont forget the FP ( no not floating point ),
    I believe also GP
    gdb stack traces

> What am I not seeing?
>

Let me also not forget that "please refer to the assembler docs" has always
accompanied by most man references. When I see that i also notice a lack of
complete assembler docs ( maybe i should say up-to-date assembler docs ).
THis is not just endemic of ALPHA/LINUX but of most unix's



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Alpha asm & Linux
  1999-05-04 11:26     ` Uncle George
@ 1999-05-04 18:12       ` Wes Bauske
  0 siblings, 0 replies; 10+ messages in thread
From: Wes Bauske @ 1999-05-04 18:12 UTC (permalink / raw)
  To: axp-list

Uncle George wrote:
> 
> Wes Bauske wrote:
> 
> 
>     Take for instance    Opcodes.    Ever try to figure out how to add "/U"
> or "/S" or "/V", i'm sure i can find more strangeness if i were to try all
> the opcodes!

OK, that falls under the quirks of the given machine.
Looking at gcc output should show you how to do that.
Just set the appropriate flag "-mieee", and see how it
differs from a non-flagged run. In general, I have no
interest in the various trap modes since they hurt 
performance and about the only reason I'd use asm is 
to get better performance.

>     Old pdp11/ATT unix assembler jumps/goto's were either a forward ref of
> backward ref.
>     I cant tell if branch labels is gonna be defined as a local symbol or
> global.

I thought there was a specific declaration to make a symbol external.(.globl)
Otherwise it's local. 

>     Register conventions ( in __asm__ u gotta know that $9 is s0 )

Is there no way to make your own register names on Alphas?

I used to use things like "F4   equ    4" on MVS many moons ago
keep my eyeballs straight when using FP instructions. 

>     Yes, frontend & backend "C" linkages. I generally take a "something.c"
> program with the same   arglist an "C" compile with -S. THEN
>     u also observe in the resultant .s  file various assembler directives
> that does who knows what, and if u reserarch l( perservere ) ong enough u
> will find them based on "dec unix"

So, Alpha Linux is a halfbreed, part GNU, and part DEC UNIX.
Need both doc sets.

>     Debugging - need i say more
>         A particular peeve is that the opcode isn;t always printed out with
> an Alpha assembler opcode
>         Try matching register conventions with "cc -S", and gdb
>

Haven't written anything so large lately that I couldn't
just stare at it for a while and see what the problem
was. From looking at gcc asm output, I didn't see anything
particularly unusual, but then I could have missed it.
 
> > The calling interface is more painful
> > from what I've seen. By splitting the args between
> > regs and memory, one can make the code faster so
> > it's a tradeoff in complexity for speed. Also, by
> 
> > inlining things inside C,
> 
> Did u mean __asm__ rather than inlineing ?

Both.

> 
> > you can avoid having to
> > code your own interface. Also, asm for the specific
> > machine has it's own quirks but no more so than
> > other machines. Other than that, its just managing
> > the stack.
> 
>     Dont forget the FP ( no not floating point ),

Frame pointer

>     I believe also GP

Global pointer

>     gdb stack traces
> 
> > What am I not seeing?
> >
> 
> Let me also not forget that "please refer to the assembler docs" has always
> accompanied by most man references. When I see that i also notice a lack of
> complete assembler docs ( maybe i should say up-to-date assembler docs ).
> THis is not just endemic of ALPHA/LINUX but of most unix's
> 

In general, I agree finding asm docs is more difficult
on UNIX. Mostly due to the fact almost no application
programmers need them.

I grabbed copies off one of Digital's old sites for
their asm progammer's guide and the Architecture reference
and they've so far explained everything I needed to know.

Try:

http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/Digital_UNIX/V4.0/Digital_UNIX_Bookshelf.html

http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/alpha_cookbook/biblio.htm

Might be newer stuff out there but they show most stuff.


Wes


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1999-05-04 19:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-05-02  3:26 Alpha asm & Linux Dan Morrill
1999-05-02  4:01 ` Wai-Sun Chia
1999-05-02 16:12   ` Jeff DeMaagd
  -- strict thread matches above, loose matches on Subject: below --
1999-05-03 13:14 Tenhave, Tim
1999-05-03 15:13 ` Uncle George
1999-05-03 17:12   ` Philip Blundell
1999-05-03 20:33     ` Uncle George
1999-05-03 17:55   ` Wes Bauske
1999-05-04 11:26     ` Uncle George
1999-05-04 18:12       ` Wes Bauske

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox