Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Warning: Error Msg

Hi all,

I've been trying to compile some assembly code for FreeBSD but keep getting the following error message - "Warning: word value exceeds bounds"

The Code:
---------

xor eax,eax
cdq
push byte 0x0a
push 0x21676e69 ;!gni
push 0x6e726f4d ;nroM
mov ebx,esp
push byte 0x10
push ebx
push byte 0x1
push eax
mov al, 0x4
int 80h
push edx
mov al,0x1
int 0x80

Compilation method
------------------
nasm -o morning morning.s

Thanks in advance for any help.

[blue]I am Invincible... ;-)[/blue]

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : Hi all,
    :
    : I've been trying to compile some assembly code for FreeBSD but keep
    : getting the following error message - "Warning: word value exceeds
    : bounds"
    :
    : The Code:
    : ---------
    :
    : xor eax,eax
    : cdq
    : push byte 0x0a
    : push [color=Blue]dword [/color]0x21676e69 ;!gni
    : push [color=Blue]dword [/color]0x6e726f4d ;nroM
    : mov ebx,esp
    : push byte 0x10
    : push ebx
    : push byte 0x1
    : push eax
    : mov al, 0x4
    : int 80h
    : push edx
    : mov al,0x1
    : int 0x80
    :
    : Compilation method
    : ------------------
    : nasm -o morning morning.s
    :
    : Thanks in advance for any help.
    :

    You need to explicitly specify the data size for the push instruction.

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • DertweillerDertweiller Posts: 37Member
    Thanks very much Richard - that worked although the other problem is every time I compile that same code using s-proc -e writeFBSD, I get a Segmentation Fault error instead of the word that is supposed to be output which is 'Morning!
    '. Sorry I'm new to assembly so all help will be appreciated.
    [blue]I am Invincible... ;-)[/blue]
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : Thanks very much Richard - that worked although the other problem is
    : every time I compile that same code using s-proc -e writeFBSD, I get
    : a Segmentation Fault error instead of the word that is supposed to
    : be output which is 'Morning!
    '. Sorry I'm new to assembly so all
    : help will be appreciated.

    I'm not familair with FreeBSD's INT80, so I can not verify the parameters for you. Could you please post the documentation you have on INT80/AL=1 and INT80/AL=4?
    What I do notice is that your stack after this isn't 2-byte aligned.
    You push: 1+4+4+1+4+1+4+4 which leaves you 1-byte short of being 2-byte aligned. Also, I highly doubt you are supposed to pass the actual value of the string through the stack. More like, you'll want to pass the address to the string. Then one last thing: INT80 does not clean up the stack for you, so you'll need to pop all the things of the stack again (however in this case [ADD esp, 23] will do the trick (you pushes 23 bytes).

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
Sign In or Register to comment.