Re: pushb assembler command in gas




"dude84" <spamtrap@xxxxxxxxxx> wrote in message
news:1143330854.953113.11900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
According to the documentation I have there is supposed to be a pushb
command for gcc assemlber (gas). The pushw command works. I'm trying
to use the pushb command and it does not work. There are supposed to
be three corresponding types of commands with AT&T syntax when writing
assembler l,w, and b.
Here is an example of what I am trying to do.
pushb $0x13
Here is a copy of the error that I get:
Error: suffix or operands invalid for `push'
If I use an invalid command like pushi I get an error as follows:
Error: no such instruction
I believe it is possible that for some reason the pushb is a command
that is documented and should work, but for some reason it does not.
Can anyone tell me why a byte sized push in gas would not work (or
possibly the specific reason why this byte sized push is failing)? I
have a book that says the pushb command is supposed to be possible in
gas. Can anyone tell me why this wouldn't work?



I think what you are refering to is '0x6A PUSH imm8'. This does not push a
byte onto the stack. It pushes a byte value, encoded as part of the
instruction, as either a word (16-bits) or the CPU size [longword (32-bits)
for 32-bit CPUs and quadword (64-bits) for 64-bit CPUs] depending on the
stack size for the current CPU mode and size override prefixes.

You can read up on this for 32-bit CPU's at the following link. Don't
forget to view the "Operation" outline.

PUSH instruction.
http://www.rz.uni-karlsruhe.de/rz/docs/VTune/reference/vc266.htm

Complete IA-32 reference.
http://www.rz.uni-karlsruhe.de/rz/docs/VTune/reference/About_IA-32_Instructions.htm


Also, GAS should have a file called "i386.h" which shows all possible
instruction encoding in a rough format. For DJGGP it's in
binutl-x.xx/include/opcode/i386.h. It should be somewhere similar in Linux.


The 'PUSH imm8' is encoded as 0x6A. From i386.h, there are two lines for
this instruction:

{"push", 1, 0x6a, X, Cpu186|CpuNo64, wl_Suf|DefaultSize, { Imm8S, 0, 0} },
{"push", 1, 0x6a, X, Cpu186|Cpu64, wq_Suf|DefaultSize|NoRex64, { Imm8S, 0,
0} },

For the first line, 'Cpu186' indicates the minimum CPU for the push
instruction: 80186. 'CpuNo64' indicates it for non-64 bit CPU's. 'wl_suf'
indicates the instruction can have a 'w' or 'l' suffix. 'w' for word
(16-bits) and 'l' for longword (32-bits).

'pushw'
'pushl'

For the second line, 'Cpu186' indicates the minimum CPU for the push
instruction: 80186. 'Cpu64' indicates that the instruction encoding is for
64-bit CPU's. 'wq_suf' indicates the instruction can have a 'w' or 'q'
suffix. 'w' for word (16-bits) and 'q' for quadword (64-bits).

'pushw'
'pushq'

At a minimum, you should understand that:
1) bytes can't be pushed onto the stack
2) 16-bit values can be pushed onto the stack
3) 32-bit or 64-bit values, depending on the cpu and/or cpu mode, can be
pushed onto the stack


Rod Pemberton


.



Relevant Pages

  • Re: pushb assembler command in gas
    ... The pushw command works. ... to use the pushb command and it does not work. ... Can anyone tell me why a byte sized push in gas would not work (or ...
    (comp.lang.asm.x86)
  • Re: Saving a single worksheet
    ... I used the script for Mil one sheet in Outlook object model. ... I am trying to apply this macro to a command button in the sheet. ... if I use display under the lines for OutMail will it stop at the point where I will have to push the send button for the message to go? ... > Private Sub CommandButton1_Click ...
    (microsoft.public.excel.programming)
  • Re: Different results with opening form with docmd.
    ... <MS ACCESS MVP> ... The problem I am having is that the sometimes I push the command button ... Debug.Print "Will update " & strDecision ...
    (microsoft.public.access.formscoding)
  • Re: [opensuse] ipconfrig--where?
    ... Only true if you have an automatic transmission, you can actually push ... New coke was marketing, not engineering. ... Those users don't use command lines at all, ...
    (SuSE)
  • Re: label and ef with tex4ht another problem
    ... associated with a latex object that is programmed to support the ... whenever a \section instruction is encountered it issues a declaration ... counter that is updated with the command \refstepcounter. ...
    (comp.text.tex)