Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 578209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:14:09+00:00 2026-05-13T14:14:09+00:00

Is there any restriction on using #define’d functions/inline functions inside Assembly files. I referred

  • 0

Is there any restriction on using #define’d functions/inline functions inside Assembly files.

I referred bsd kernel in which two different implementations are defined.
One is macro and other is a normal function ( both are for same function)

In the c file splx is defined asfunction,
http://ftp.hu.freebsd.org/pub/netbsd/NetBSD-release-4-0/src/sys/arch/arm/omap/omap_intr.c

Whereas in h header file splx is defined as macro,
http://ftp.hu.freebsd.org/pub/netbsd/NetBSD-release-4-0/src/sys/arch/arm/omap/omap_intr.h

My understanding is c file definition is used in assembly files whereas macro definition is used in all other functions where the header file is included.

I think I m not clear why assembly is coming into picture here. Basically there are two definitions , one in the c file and another in h file for splx. When I just comment out splx definition in C fle, I get some errors in the compilation of Assembly files.(cpu.S) Thatz why I thought function definition is used(as in c file) while compiling assembly file, whereas macro definition is used for all other files include the h file.

Now my question is: Why can’t assembly file too cannot use the macro definition by including the header file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:14:09+00:00Added an answer on May 13, 2026 at 2:14 pm

    In the header file, splx is defined as

    void splx(int)
    void _setsoftintr(int);
    
    #if !defined(EVBARM_SPL_NOINLINE)
    #define splx(new) omap_splx(new)
    #define _spllower(ipl) omap_spllower(ipl)
    #define _setsoftintr(si) omap_setsoftintr(si)
    #endif /* !EVBARM_SPL_NOINTR */ 
    

    I’m not sure why you’re referring to assembly files when this language is clearly C, but I see nothing wrong with these declarations – splx is a function, but if EVBARM_SPL_NOINLINE is defined then the macro is used to remap all uses of splx to splx_omap. This is a valid use of the preprocessor, and is not redefining splx – rather using some trickery to modify code to use splx_omap.

    This works because the preprocessor runs before the compiler, so any occurence of splx will be replaced by splx_omap before compilation takes place. Some people would find this disturbing but it’s one of the capabilities of the preprocessor and is quite useful (when proper precautions are observed).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way we can fetch X509 Public Cetrificates using c# from AD
Is there any way to implement linking of object files in C, in such
I'm wondering whether or not there are any restrictions during HBase minor/major compactions .
Is there any functional difference in Python between a try statement and an if
Is there any way in Notepad++ (or even with another tool) to change the
Is there any way I can set a formatter on models that will convert
Are there any recommended libraries, patterns or examples on how to implement Prefetching and/or
Is there any difference (compiler/interpreter/juju wise, etc) between the two versions of checking the
Is there any way to use Google's API to retrieve a user's current zipcode
Is there any way to overload the > (greater than) operator, to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.