All of lore.kernel.org
 help / color / mirror / Atom feed
* how to include mips assembly in c code?
@ 2003-10-09  5:38 durai
  2003-10-09  7:54 ` Ralf Baechle
  2003-10-09  8:05 ` Matthew Dharm
  0 siblings, 2 replies; 5+ messages in thread
From: durai @ 2003-10-09  5:38 UTC (permalink / raw)
  To: mips

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

hello,
I am having the following assembly code and i wanted to call this function from a c code.
can anybody tell me how to include this code in a c program?

/******************************************************************************
*
* sysWbFlush - flush the write buffer
*
* This routine flushes the write buffers, making certain all
* subsequent memory writes have occurred.  It is used during critical periods
* only, e.g., after memory-mapped I/O register access.
*
* RETURNS: N/A

* sysWbFlush (void)

*/
        .ent    sysWbFlush
sysWbFlush:
        li      t0, K1BASE              /* load uncached address        */
        lw      t0, 0(t0)               /* read in order to flush       */
        j       ra                      /* return to caller             */
        .end    sysWbFlush


regards
durai

[-- Attachment #2: Type: text/html, Size: 2394 bytes --]

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

* Re: how to include mips assembly in c code?
  2003-10-09  5:38 how to include mips assembly in c code? durai
@ 2003-10-09  7:54 ` Ralf Baechle
  2003-10-09  8:05 ` Matthew Dharm
  1 sibling, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2003-10-09  7:54 UTC (permalink / raw)
  To: durai; +Cc: mips

On Thu, Oct 09, 2003 at 11:08:56AM +0530, durai wrote:

> I am having the following assembly code and i wanted to call this function
> from a c code.
> can anybody tell me how to include this code in a c program?

Several solutions:

  #define sysWbFlush()	 do { (*(volatile unsigned int *)K1BASE) } while (0)

Or using your existing code:

  extern void sysWbFlush(void);

the call as

  sysWbFlush();

No point in using inline assembler for such a small fragment.

Anyway - I suggest you dump this code and look at <asm/wbflush.h>.

  Ralf

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

* Re: how to include mips assembly in c code?
  2003-10-09  5:38 how to include mips assembly in c code? durai
  2003-10-09  7:54 ` Ralf Baechle
@ 2003-10-09  8:05 ` Matthew Dharm
  2003-10-09 21:47   ` ilya
  1 sibling, 1 reply; 5+ messages in thread
From: Matthew Dharm @ 2003-10-09  8:05 UTC (permalink / raw)
  To: durai; +Cc: mips

I feel compelled to point out that the source file you are quoting looks
suspiciously like it came from VxWorks, which means it is likely copyright
Wind River Systems.  Using their code without permission would be illegal.

Matt

On Thu, Oct 09, 2003 at 11:08:56AM +0530, durai wrote:
> hello,
> I am having the following assembly code and i wanted to call this function from a c code.
> can anybody tell me how to include this code in a c program?
> 
> /******************************************************************************
> *
> * sysWbFlush - flush the write buffer
> *
> * This routine flushes the write buffers, making certain all
> * subsequent memory writes have occurred.  It is used during critical periods
> * only, e.g., after memory-mapped I/O register access.
> *
> * RETURNS: N/A
> 
> * sysWbFlush (void)
> 
> */
>         .ent    sysWbFlush
> sysWbFlush:
>         li      t0, K1BASE              /* load uncached address        */
>         lw      t0, 0(t0)               /* read in order to flush       */
>         j       ra                      /* return to caller             */
>         .end    sysWbFlush
> 
> 
> regards
> durai
-- 
Matthew Dharm                              Work: mdharm@momenco.com
Senior Software Designer, Momentum Computer

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

* Re: how to include mips assembly in c code?
  2003-10-09  8:05 ` Matthew Dharm
@ 2003-10-09 21:47   ` ilya
  2003-10-09 22:09     ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: ilya @ 2003-10-09 21:47 UTC (permalink / raw)
  To: Matthew Dharm; +Cc: durai, mips

[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]

Here we go - whole six lines of code! What a terrible copyright infigement!

On Thu, Oct 09, 2003 at 01:05:39AM -0700, Matthew Dharm wrote:
> I feel compelled to point out that the source file you are quoting looks
> suspiciously like it came from VxWorks, which means it is likely copyright
> Wind River Systems.  Using their code without permission would be illegal.
> 
> Matt
> 
> On Thu, Oct 09, 2003 at 11:08:56AM +0530, durai wrote:
> > hello,
> > I am having the following assembly code and i wanted to call this function from a c code.
> > can anybody tell me how to include this code in a c program?
> > 
> > /******************************************************************************
> > *
> > * sysWbFlush - flush the write buffer
> > *
> > * This routine flushes the write buffers, making certain all
> > * subsequent memory writes have occurred.  It is used during critical periods
> > * only, e.g., after memory-mapped I/O register access.
> > *
> > * RETURNS: N/A
> > 
> > * sysWbFlush (void)
> > 
> > */
> >         .ent    sysWbFlush
> > sysWbFlush:
> >         li      t0, K1BASE              /* load uncached address        */
> >         lw      t0, 0(t0)               /* read in order to flush       */
> >         j       ra                      /* return to caller             */
> >         .end    sysWbFlush
> > 
> > 
> > regards
> > durai
> -- 
> Matthew Dharm                              Work: mdharm@momenco.com
> Senior Software Designer, Momentum Computer
> 
> 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: how to include mips assembly in c code?
  2003-10-09 21:47   ` ilya
@ 2003-10-09 22:09     ` Wolfgang Denk
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2003-10-09 22:09 UTC (permalink / raw)
  To: ilya; +Cc: mips

In message <20031009214706.GA19899@gateway.total-knowledge.com> you wrote:
> 
> Here we go - whole six lines of code! What a terrible copyright infigement!

Six lines of code, and 12  lines  of  obvious  comments,  and  pretty
obvious  function  names - this is exactly what the Evil Empire (like
SCO et al) is looking for.

Please try and be a little less ignorant.


Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
In Nature there are neither rewards nor punishments, there are conse-
quences.                                            -- R.G. Ingersoll

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

end of thread, other threads:[~2003-10-09 22:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-09  5:38 how to include mips assembly in c code? durai
2003-10-09  7:54 ` Ralf Baechle
2003-10-09  8:05 ` Matthew Dharm
2003-10-09 21:47   ` ilya
2003-10-09 22:09     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.