Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Naked Assembly Routines

Naked Assembly Routines

Scheduled Pinned Locked Moved .NET (Core and Framework)
c++htmldotnetcomquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    ursus zeta
    wrote on last edited by
    #1

    OK,...I'm a maniac, but I was thinking of writing some fairly simple assembly routines to use in a Managed C++ application. If you go over to the MSDN site, they tell you this: "For functions declared with the naked attribute, the compiler generates code without prolog and epilog code. You can use this feature to write your own prolog/epilog code sequences using inline assembler code." You can see the Microsoft specific implementation at this page: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/\_pluslang\_the\_naked\_attribute.asp\[^\] Anyway, another thing that the Microsoft specific people tell you is that: "The naked keyword is ignored when compiling with /clr." What I don't understand is what they refer to as the Prolog and Epilog code that the compiler automatically inserts. By the way, I got this maniacal concept while reading the book: "Assembly Language for Intel-Based Computers, Fourth Edition", by Kip Irvine, 2003. Anyone ever have any experience with this sort of thing? I'd appreciate ANY intel, no matter how obscure and trivial.

    M 1 Reply Last reply
    0
    • U ursus zeta

      OK,...I'm a maniac, but I was thinking of writing some fairly simple assembly routines to use in a Managed C++ application. If you go over to the MSDN site, they tell you this: "For functions declared with the naked attribute, the compiler generates code without prolog and epilog code. You can use this feature to write your own prolog/epilog code sequences using inline assembler code." You can see the Microsoft specific implementation at this page: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/\_pluslang\_the\_naked\_attribute.asp\[^\] Anyway, another thing that the Microsoft specific people tell you is that: "The naked keyword is ignored when compiling with /clr." What I don't understand is what they refer to as the Prolog and Epilog code that the compiler automatically inserts. By the way, I got this maniacal concept while reading the book: "Assembly Language for Intel-Based Computers, Fourth Edition", by Kip Irvine, 2003. Anyone ever have any experience with this sort of thing? I'd appreciate ANY intel, no matter how obscure and trivial.

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      ursus zeta wrote: What I don't understand is what they refer to as the Prolog and Epilog code that the compiler automatically inserts. The compiler automatically inserts code to save the stack pointer (mov ebp, esp), test for stack overflow, and possibly push a couple registers, often ebp, edi and esi. The epilog pops those registers and restores esp. It saves esp because local variables are placed on the stack, and this is simple way of returning the stack pointer to the proper state before doing a return (which, BTW, should also pop off any parameters pushed onto the stack before the function was called, unless you're using PASCAL calling convention, which requires that the caller pops the parameters off). Marc MyXaml Advanced Unit Testing YAPO

      U 1 Reply Last reply
      0
      • M Marc Clifton

        ursus zeta wrote: What I don't understand is what they refer to as the Prolog and Epilog code that the compiler automatically inserts. The compiler automatically inserts code to save the stack pointer (mov ebp, esp), test for stack overflow, and possibly push a couple registers, often ebp, edi and esi. The epilog pops those registers and restores esp. It saves esp because local variables are placed on the stack, and this is simple way of returning the stack pointer to the proper state before doing a return (which, BTW, should also pop off any parameters pushed onto the stack before the function was called, unless you're using PASCAL calling convention, which requires that the caller pops the parameters off). Marc MyXaml Advanced Unit Testing YAPO

        U Offline
        U Offline
        ursus zeta
        wrote on last edited by
        #3

        Marc, Thanks alot,...that is EXACTLY the information I was looking for. I appreciate it.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups