A patch for ret in 16bit mode

H.J. Lu (hjl@lucon.org)
Tue, 26 May 1998 23:11:26 -0700 (PDT)


> > Also, I've noticed all the 'ret' instructions have extraneous prefix
> > bytes, even when not needed. (ie in .code16):
> >
> > 66 c3 ret
> > 'stead of:
> > c3 ret
> >
> > test.S:
> > --- cut ---
> > .text
> > .code16
> >
> > ret
> > --- cut ---
> >
> > iniquity:~$ as test.S
> > iniquity:~$ objdump -D a.out
> >
> > a.out: file format elf32-i386
> >
> > Disassembly of section .text:
> >
> > 00000000 <.text>:
> > 0: 66 c3 ret
> >
>
> Please try "retw" instead of "ret" for 16bit return.

Or you can try this patch on binutils 2.9.1.0.4 :-).

H.J.

---
Tue May 26 21:34:40 1998  H.J. Lu  <hjl@gnu.org>

* i386.h (i386_optab): Remove "retw", "lretw", "enterw" and "leavew". Remove Data32 from "ret", "lret", "enter" and "leave". Add WordOperand to "ret", "lret", "enter" and "leave".

Index: i386.h =================================================================== RCS file: /home/work/cvs/gnu/binutils/include/opcode/i386.h,v retrieving revision 1.31 diff -u -r1.31 i386.h --- i386.h 1998/04/27 18:43:10 1.31 +++ i386.h 1998/05/27 04:46:02 @@ -287,18 +287,12 @@ {"ljmp", 2, 0xea, _, JumpInterSegment|WordOperand|DWordOperand, { Imm16, Imm16|Imm32, 0} }, {"ljmp", 1, 0xff, 5, Modrm|WordOperand|DWordOperand, { WordMem, 0, 0} }, -{"ret", 0, 0xc3, _, NoModrm|Data32|DWordOperand, { 0, 0, 0} }, -{"ret", 1, 0xc2, _, NoModrm|Data32|DWordOperand, { Imm16, 0, 0} }, -{"retw", 0, 0xc3, _, NoModrm|Data16|WordOperand, { 0, 0, 0} }, -{"retw", 1, 0xc2, _, NoModrm|Data16|WordOperand, { Imm16, 0, 0} }, -{"lret", 0, 0xcb, _, NoModrm|Data32|DWordOperand, { 0, 0, 0} }, -{"lret", 1, 0xca, _, NoModrm|Data32|DWordOperand, { Imm16, 0, 0} }, -{"lretw", 0, 0xcb, _, NoModrm|Data16|WordOperand, { 0, 0, 0} }, -{"lretw", 1, 0xca, _, NoModrm|Data16|WordOperand, { Imm16, 0, 0} }, -{"enter", 2, 0xc8, _, NoModrm|Data32|DWordOperand, { Imm16, Imm8, 0} }, -{"leave", 0, 0xc9, _, NoModrm|Data32|DWordOperand, { 0, 0, 0} }, -{"enterw", 2, 0xc8, _, NoModrm|Data16|WordOperand, { Imm16, Imm8, 0} }, -{"leavew", 0, 0xc9, _, NoModrm|Data16|WordOperand, { 0, 0, 0} }, +{"ret", 0, 0xc3, _, NoModrm|WordOperand|DWordOperand, { 0, 0, 0} }, +{"ret", 1, 0xc2, _, NoModrm|WordOperand|DWordOperand, { Imm16, 0, 0} }, +{"lret", 0, 0xcb, _, NoModrm|WordOperand|DWordOperand, { 0, 0, 0} }, +{"lret", 1, 0xca, _, NoModrm|WordOperand|DWordOperand, { Imm16, 0, 0} }, +{"enter", 2, 0xc8, _, NoModrm|WordOperand|DWordOperand, { Imm16, Imm8, 0} }, +{"leave", 0, 0xc9, _, NoModrm|WordOperand|DWordOperand, { 0, 0, 0} }, /* conditional jumps */ {"jo", 1, 0x70, _, Jump, { Disp, 0, 0} },

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu