Like Tree2Likes
  • 1 Post By tabstop
  • 1 Post By AndrewHunter

Ask two question about embedded assembler

This is a discussion on Ask two question about embedded assembler within the Linux Programming forums, part of the Platform Specific Boards category; Look: Code: int main() { unsigned char buf[]={0xB2,0x48,0xB4,0x02,0xCD,0x21,0xB8,0x00,0x4C,0xCD,0x21}; printf("%x\n",buf); __asm__("jmp buf"); //it is error return 0; } 1:I want to ...

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    50

    Ask two question about embedded assembler

    Look:
    Code:
    int main()
    {
        unsigned char buf[]={0xB2,0x48,0xB4,0x02,0xCD,0x21,0xB8,0x00,0x4C,0xCD,0x21};
        printf("%x\n",buf);
        __asm__("jmp buf"); //it is error   
     	
        return 0;
    }
    1:I want to know the address of buf is offset address or physical address(include segment address and offset address)?
    2:There are binary codes in buf,I want to jmp it,how to do?

  2. #2
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    THIS IS A CROSS POST. DON'T DO THAT.

    The questions you are going to get are on this thread.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    1. Can I choose c) none of the above?

    2. I don't think "buf" means anything in assembler. Have you read this?
    AndrewHunter likes this.

  4. #4
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Quote Originally Posted by tabstop View Post
    ...
    2. I don't think "buf" means anything in assembler. ...
    Whew, I am glad you didn't have a definitive statement there. Because as we found out just recently "Since it's impossible to create every type of ISA, one can NOT say for sure if a machine can exist" in which an "ISA/compiler" would know what "buf" was.

    anduril462 likes this.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. embedded design, delay routine question
    By dannybeckett in forum C Programming
    Replies: 12
    Last Post: 03-24-2011, 02:46 PM
  2. 6502 assembler question
    By Syscal in forum C Programming
    Replies: 2
    Last Post: 09-21-2010, 11:25 PM
  3. Question on embedded systems
    By ssharish2005 in forum C Programming
    Replies: 3
    Last Post: 08-12-2007, 03:28 PM
  4. assembler and linker stuff...question
    By dirkduck in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-17-2001, 12:10 AM
  5. Embedded Tools question...
    By ober in forum Windows Programming
    Replies: 1
    Last Post: 09-28-2001, 03:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21