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

  • Home
  • SEARCH
  • 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 9162655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:15:44+00:00 2026-06-17T14:15:44+00:00

Basically I need to know what register void* pointers are placed in when they

  • 0

Basically I need to know what register void* pointers are placed in when they are returned from a C function. I have this code:

void* kmalloc(unsigned int size)
{
    asm("mov %[size], %%esi"
    : /* no outputs */
    : [size] "m" (size)
    : "esi");
    asm("movl $9, %eax");
    asm("int $0x80");

}

which should put an address into EAX. I thought that return values in C were stored in EAX, but apparently not, (oh and I am using GCC BTW). I need to some how return EAX, register int won’t work either because of the compiler settings. Is there a register that is used for returning pointers? Or is it like pushed onto the stack or something?

  • 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-06-17T14:15:46+00:00Added an answer on June 17, 2026 at 2:15 pm

    This is not a valid way to write inline asm. Even if you put the return value in the right register, it could be lost/clobbered by the time the function actually returns, because the compiler can add arbitrary epilogue code. You must use output constraints and a return statement to return the results of inline asm:

    void* kmalloc(unsigned int size)
    {
        void *p;
        asm("int $0x80" : "=a"(p) : "S"(size), "a"(9));
        return p;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically what I need to know is this: I have to show a drop
I haven't found any info on that. I basically need to know from a
Basically I need to know how to make this work. I removed one of
I have a string: $uri = start/test/go/; Basically I need to know which regular
I don't know the best way to label this but basically, I have 3
I basically need to know how to import SQL code into Access. I've tried
I need to know how to take 10.25 and turn it to 1025 basically
TL;DR I need to know which characters are deleted with Win32. Basically, I need
I basically need a custom function to be used only when, for example, the
I basically need to check if there is an easier way to do this

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.