Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

This login session: $13.99


programming / alt.lang.asm / Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?

SubjectAuthor
* Can AX and BX, CX etc be used for parameter passing in 32 bit asmVeek M
+- Re: Can AX and BX, CX etc be used for parameter passing in 32 bitMelzzzzz
+* Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm codeJJ
|+- Re: Can AX and BX, CX etc be used for parameter passing in 32 bitMelzzzzz
|`* Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asmVeek M
| `* Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm codeJJ
|  +* Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm codeRobert Wessel
|  |`* Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm codeJJ
|  | `- Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm codeRobert Wessel
|  `- Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asmVeek M
`* Re: Can AX and BX, CX etc be used for parameter passing in 32 bitRod Pemberton
 `- Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asmVeek M

1
Subject: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Veek M
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Tue, 31 Dec 2019 13:53 UTC
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: vee...@dont-use-this.com (Veek M)
Newsgroups: alt.lang.asm
Subject: Can AX and BX, CX etc be used for parameter passing in 32 bit asm
code - why not?
Date: Tue, 31 Dec 2019 13:53:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <qufjsl$kt9$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 31 Dec 2019 13:53:25 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ba783e9fe030df0710b8a9033db4b9ed";
logging-data="21417"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/HuEGoPZv8AudtGTgnC5Xp"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:bvArXjG1Z36oeR+FslWzGfsYPu8=
View all headers
This is what Seyfarth says:

For  32 bit programs the  protocol is  different .  Registers r8-
r15  are not  available, so there is not much value in passing function
parameters in registers.  These programs use the stack for all parameters.
 

Why is that? Why can't AX and BX, CX, DX be used for parameter passing?
Only the r8 - registers aren't available in 32 bit.



Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Melzzzzz
Newsgroups: alt.lang.asm
Organization: usenet-news.net
Date: Tue, 31 Dec 2019 14:36 UTC
References: 1
Path: i2pn2.org!i2pn.org!aioe.org!peer02.am4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx19.am4.POSTED!not-for-mail
Newsgroups: alt.lang.asm
From: Melzz...@zzzzz.com (Melzzzzz)
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit
asm code - why not?
References: <qufjsl$kt9$1@dont-email.me>
User-Agent: slrn/1.0.3 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Lines: 21
Message-ID: <f2JOF.67908$qQ.42346@fx19.am4>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Tue, 31 Dec 2019 14:36:59 UTC
Organization: usenet-news.net
Date: Tue, 31 Dec 2019 14:36:59 GMT
X-Received-Bytes: 1419
X-Received-Body-CRC: 21168094
View all headers
On 2019-12-31, Veek M <veek@dont-use-this.com> wrote:
This is what Seyfarth says:

For  32 bit programs the  protocol is  different .  Registers r8-
r15  are not  available, so there is not much value in passing function
parameters in registers.  These programs use the stack for all parameters.
 

Why is that? Why can't AX and BX, CX, DX be used for parameter passing?
Only the r8 - registers aren't available in 32 bit.

Depends on calling convention...



--
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi --  Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi
bili naoruzani. -- Mladen Gogala


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: JJ
Newsgroups: alt.lang.asm
Organization: albasani.net
Date: Tue, 31 Dec 2019 15:08 UTC
References: 1
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!news.albasani.net!.POSTED!not-for-mail
From: jj4pub...@vfemail.net (JJ)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
Date: Tue, 31 Dec 2019 22:08:50 +0700
Organization: albasani.net
Lines: 29
Message-ID: <176l97bwkm4a4$.1n2ay3ij76a3v$.dlg@40tude.net>
References: <qufjsl$kt9$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.albasani.net I8j1Sf1li4iHcwslqXadGL7DlJq7sXpr/jzo0R9i4pz0WBNzHvY4BjlXvRQTSUJRlcv0SnSCo8FBVvgBPvc+Dw==
NNTP-Posting-Date: Tue, 31 Dec 2019 15:09:43 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="e8e6f/gi+FCCFqUv/fMq1HcnJHHzp1UbgE0FzWiOTEBypfw+6+KpXeSXkNByPbUS7uDDBdm6xxYqSuZm6EPD30qWkERyr1tYExfemJeTmU6xYu+sPUvLPHLKj0kwE4/t"; mail-complaints-to="abuse@albasani.net"
User-Agent: 40tude_Dialog/2.0.15.84
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
Cancel-Lock: sha1:sF+T8i1Yv2OpN1JXbwZ/LUhViY4=
View all headers
On Tue, 31 Dec 2019 13:53:25 -0000 (UTC), Veek M wrote:
This is what Seyfarth says:

For  32 bit programs the  protocol is  different .  Registers r8-
r15  are not  available, so there is not much value in passing function
parameters in registers.  These programs use the stack for all parameters.
 

Why is that? Why can't AX and BX, CX, DX be used for parameter passing?
Only the r8 - registers aren't available in 32 bit.

That's just a software framework recommendation. It's not a requirement if
you don't use that software framework.

e.g. in Windows, if you use Windows API, you must follow its parameter
passing method, otherwise the function can't function properly. So, the
Windows API defines the rule for parameter passing. If you make you own
library, you can use any register, stack, or memory for parameter passing.
You're the creator of the function. You define the rule. But in Windows OS
however, there's other rule where certain registers must always be preserved
because they're used by the OS. This rule you must follow, because you're
using someone else's OS. If you make your own OS, anything can be using for
parameter passing. You define the rule.

The x64 parameter passing is just an official recommendation which is
adhered by OS developers from *nix to Windows. It's not a requirement if
you're making your own OS. However, keep in mind that some registers is also
used by the hardware for e.g. task switching. This applies not only for your
own OS, but also other OSes.


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Melzzzzz
Newsgroups: alt.lang.asm
Organization: usenet-news.net
Date: Tue, 31 Dec 2019 15:25 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!aioe.org!peer02.am4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx38.am4.POSTED!not-for-mail
Newsgroups: alt.lang.asm
From: Melzz...@zzzzz.com (Melzzzzz)
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit
asm code - why not?
References: <qufjsl$kt9$1@dont-email.me>
<176l97bwkm4a4$.1n2ay3ij76a3v$.dlg@40tude.net>
User-Agent: slrn/1.0.3 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Lines: 34
Message-ID: <JLJOF.202767$NM1.93438@fx38.am4>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Tue, 31 Dec 2019 15:25:29 UTC
Organization: usenet-news.net
Date: Tue, 31 Dec 2019 15:25:29 GMT
X-Received-Bytes: 2420
X-Received-Body-CRC: 2337807667
View all headers
On 2019-12-31, JJ <jj4public@vfemail.net> wrote:
On Tue, 31 Dec 2019 13:53:25 -0000 (UTC), Veek M wrote:
This is what Seyfarth says:

For  32 bit programs the  protocol is  different .  Registers r8-
r15  are not  available, so there is not much value in passing function
parameters in registers.  These programs use the stack for all parameters.
 

Why is that? Why can't AX and BX, CX, DX be used for parameter passing?
Only the r8 - registers aren't available in 32 bit.

That's just a software framework recommendation. It's not a requirement if
you don't use that software framework.

e.g. in Windows, if you use Windows API, you must follow its parameter
passing method, otherwise the function can't function properly. So, the
Windows API defines the rule for parameter passing. If you make you own
library, you can use any register, stack, or memory for parameter passing.
You're the creator of the function. You define the rule. But in Windows OS
however, there's other rule where certain registers must always be preserved
because they're used by the OS. This rule you must follow, because you're
using someone else's OS. If you make your own OS, anything can be using for
parameter passing. You define the rule.

It is not OS thing. Golang has it's own convention I beleive  Plan9 or
so. If you want to call go procedure from assembler you'll see :)

--
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi --  Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi
bili naoruzani. -- Mladen Gogala


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Veek M
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Tue, 31 Dec 2019 18:25 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: vee...@dont-use-this.com (Veek M)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm
code - why not?
Date: Tue, 31 Dec 2019 18:25:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <qug3q1$8r2$2@dont-email.me>
References: <qufjsl$kt9$1@dont-email.me>
<176l97bwkm4a4$.1n2ay3ij76a3v$.dlg@40tude.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 31 Dec 2019 18:25:05 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="89eedcfaf0af3ceedb932b1b84586ced";
logging-data="9058"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+aNlUOrtNdTN3Z8jOgVH45"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:w1fOec6OlYjPxFFJjeFA+myR5IU=
View all headers
On Tue, 31 Dec 2019 22:08:50 +0700, JJ wrote:

, anything can be using for parameter passing. You define the rule.

Thanks, but why is the convention made that way.. for 32 bit..
Linux uses 6 integer registers in x64 and most of they are
RSI RDI RCX RDX R8 R9 out of which in 32bit only R8/R9 are not
available..

Okay they are 32bit so E not R - so 1/2 is missing.. but we could
pass parameters in EDX ECX EDI ESI? (windows uses only 4 anyhow so?)
and EBX?


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Rod Pemberton
Newsgroups: alt.lang.asm
Organization: Aioe.org NNTP Server
Date: Wed, 1 Jan 2020 08:04 UTC
References: 1
Path: i2pn2.org!i2pn.org!aioe.org!.POSTED.+15yR2JuBIwiofOqK4kSZw.user.gioia.aioe.org!not-for-mail
From: nomaili...@trgzxcqvbe.cpm (Rod Pemberton)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit
asm code - why not?
Date: Wed, 1 Jan 2020 03:04:46 -0500
Organization: Aioe.org NNTP Server
Lines: 66
Message-ID: <quhjle$q4s$3@gioia.aioe.org>
References: <qufjsl$kt9$1@dont-email.me>
NNTP-Posting-Host: +15yR2JuBIwiofOqK4kSZw.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
X-Notice: Filtered by postfilter v. 0.9.2
View all headers
On Tue, 31 Dec 2019 13:53:25 -0000 (UTC)
Veek M <veek@dont-use-this.com> wrote:

This is what Seyfarth says:

For  32 bit programs the  protocol is  different .  Registers
r8- r15  are not  available,

True.

so there is not much value in passing
function parameters in registers.

False.

Accessing registers are faster than using a stack, especially for older
processors which always stored the stack in memory.  Newer processors
can cache the stack on the processor, but the caches still aren't as
fast as registers.

Some C compilers, e.g., OpenWatcom, allow you to select register
parameters as a command-line compile option, instead of using the
stack.  Most high-level languages are usually compiled to use a stack
to pass parameters, by default.  This is to allow for a variable number
of arguments to be passed to a procedure.  However, this generally
isn't required as most well written code won't exceed three or four
parameters.  So, even high-level code, e.g., C language, which is
compiled for 16-bit x86 can generally use registers to pass parameters,
if allowed by the compiler.

These programs use the stack for all parameters.

False.  See above.

Why is that? Why can't AX and BX, CX, DX be used for parameter
passing? Only the r8 - registers aren't available in 32 bit.

They can and are, but this depends on the situation.

For assembly, there is no restriction on how you use registers for your
own code.

It's only when your assembly code is calling other code that you may
need to comply with a calling convention that specifies which registers
to use, i.e., destroy, and which registers you can't use, i.e.,
preserve.  This is referred to callee-savee registers or some such
terminology. These methods are usually stack based.

Code that is compiled by a compiler - as noted above - or called by
compiled high-level language code (C, Pascal, Java, etc...) will
generally use a stack based calling convention, by default.

You can get an introduction to calling conventions on Wikipedia:

https://en.wikipedia.org/wiki/Calling_convention
https://en.wikipedia.org/wiki/X86_calling_conventions

For certain calling conventions, there are very large standard
documents, which can be rather technical.


Rod Pemberton
--
"It's OK to be White." <-- investigated by FBI as a hate crime
"Black Lives Matter." <-- not being investigated ...



Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: JJ
Newsgroups: alt.lang.asm
Organization: albasani.net
Date: Wed, 1 Jan 2020 10:52 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!news.albasani.net!.POSTED!not-for-mail
From: jj4pub...@vfemail.net (JJ)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
Date: Wed, 1 Jan 2020 17:52:15 +0700
Organization: albasani.net
Lines: 27
Message-ID: <1pkhcaq1wj7e5.1672x4um9f728.dlg@40tude.net>
References: <qufjsl$kt9$1@dont-email.me> <176l97bwkm4a4$.1n2ay3ij76a3v$.dlg@40tude.net> <qug3q1$8r2$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.albasani.net CxJuhu08HbwfjpcnDiXhTc53rnwuWOwbC7zYpSVyhsr6euNvtK9PyJlKJ6RSJUt3ki/92uswkGfNp+X8pyySdut1/9HnSjTwlFLblz03XSTr7SsPJ16kndZdtUS1HnyH
NNTP-Posting-Date: Wed, 1 Jan 2020 10:53:13 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="kwhYmuAdBMLK/AcCHp0BOdasmElYyxqZu+Hf4/n4Sj9TtRaUNeOLRfYShXxZYAqgM95aIfX6bxkLh/ghJloZpmBYUuZIehcJHP1bdDfqDlp3cpsnimP0Mxl0xnee6P7u"; mail-complaints-to="abuse@albasani.net"
User-Agent: 40tude_Dialog/2.0.15.84
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
Cancel-Lock: sha1:6z6sqB8jDM3zYYtdAcFxjeOybEw=
View all headers
On Tue, 31 Dec 2019 18:25:05 -0000 (UTC), Veek M wrote:
Thanks, but why is the convention made that way.. for 32 bit..
Linux uses 6 integer registers in x64 and most of they are
RSI RDI RCX RDX R8 R9 out of which in 32bit only R8/R9 are not
available..

R## registers are only available in 64-bit mode. Not exactly sure why. I
could only guess that probably because there's no more room to include them
in the 32-bit opcode encoding. Or probably AMD simply don't want to extend
the 32-bit mode, because that can lower the CPU production cost a bit. They
may be thinking that 32-bit should no longer be supported. Existing
softwares still work anyway.

Okay they are 32bit so E not R - so 1/2 is missing..

Like Intel did with E?X registers where there's no register to access the
upper 16-bits, AMD follows that rule by not adding registers to access the
upper 32-bits of R?? registers.

but we could
pass parameters in EDX ECX EDI ESI? (windows uses only 4 anyhow so?)
and EBX?

For EBX, ECX, EDX, ESI, and EDI...
In Windows, you can use any register as long as EBX, ESI, and EDI values are
preserved. If you use C compiler, ECX is used by the C library, and its
value should be preserved.


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Robert Wessel
Newsgroups: alt.lang.asm
Organization: Forte - www.forteinc.com
Date: Wed, 1 Jan 2020 14:51 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!aioe.org!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx07.iad.POSTED!not-for-mail
From: robertwe...@yahoo.com (Robert Wessel)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
Message-ID: <n0cp0fp9i2tpmaoaiaqc14ll787jr6ckv7@4ax.com>
References: <qufjsl$kt9$1@dont-email.me> <176l97bwkm4a4$.1n2ay3ij76a3v$.dlg@40tude.net> <qug3q1$8r2$2@dont-email.me> <1pkhcaq1wj7e5.1672x4um9f728.dlg@40tude.net>
User-Agent: ForteAgent/7.20.32.1218
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 38
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Wed, 01 Jan 2020 08:51:38 -0600
X-Received-Bytes: 2791
X-Received-Body-CRC: 2189346845
View all headers
On Wed, 1 Jan 2020 17:52:15 +0700, JJ <jj4public@vfemail.net> wrote:

On Tue, 31 Dec 2019 18:25:05 -0000 (UTC), Veek M wrote:
Thanks, but why is the convention made that way.. for 32 bit..
Linux uses 6 integer registers in x64 and most of they are
RSI RDI RCX RDX R8 R9 out of which in 32bit only R8/R9 are not
available..

R## registers are only available in 64-bit mode. Not exactly sure why. I
could only guess that probably because there's no more room to include them
in the 32-bit opcode encoding. Or probably AMD simply don't want to extend
the 32-bit mode, because that can lower the CPU production cost a bit. They
may be thinking that 32-bit should no longer be supported. Existing
softwares still work anyway.


In 64-bit mode, AMD reused the one byte INC and DEC instructions for
the REX prefixes, which are used to encode an additional bit of
register specifier.  For obvious reasons, you couldn't do this in
16/32 bit mode without breaking existing programs.


Okay they are 32bit so E not R - so 1/2 is missing..

Like Intel did with E?X registers where there's no register to access the
upper 16-bits, AMD follows that rule by not adding registers to access the
upper 32-bits of R?? registers.


While the default operand size is controlled by the segment descriptor
in 16/32 bit mode, the other size can be accessed by using the operand
size prefix (0x66), so you can access the upper halves of the Exx
registers even in 16-bit mode, even in real mode.  You can even call
between 16 and 32-bit code fairly easily (subject to constraints on
how the segments are set up, and obviously you cannot pass a 32-bit
offset to 16 bit code).  You cannot really do that with 64-bit code
(it can be done, of course, although you need to jump through some
hoops).


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: JJ
Newsgroups: alt.lang.asm
Organization: albasani.net
Date: Wed, 1 Jan 2020 20:50 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!news.albasani.net!.POSTED!not-for-mail
From: jj4pub...@vfemail.net (JJ)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
Date: Thu, 2 Jan 2020 03:50:57 +0700
Organization: albasani.net
Lines: 23
Message-ID: <1rrgjeyqds0hs$.7s88or5y1dfs.dlg@40tude.net>
References: <qufjsl$kt9$1@dont-email.me> <176l97bwkm4a4$.1n2ay3ij76a3v$.dlg@40tude.net> <qug3q1$8r2$2@dont-email.me> <1pkhcaq1wj7e5.1672x4um9f728.dlg@40tude.net> <n0cp0fp9i2tpmaoaiaqc14ll787jr6ckv7@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.albasani.net MSBoq7lm0x0VtLFHSpQIsz+ysNwjZ0WvQiu1ycqzycQr0d9tjylCxviNvaaePw88Lrz+iISWffw5sg/QadstdEooZgl43wg4lJfrCSZYEyppmHu+ftF2Zcx5bj8FRS/R
NNTP-Posting-Date: Wed, 1 Jan 2020 20:51:57 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="+VS1I6abpMeTQl6fxbI2tMRdMMQL5ZsIzvugCTeHzkrq3uP1ab+KzTpCTLqGakOFMyFMRwSDbC4SSPAQMIpEvHepw3tfB/yyqulae5ppqr0coftDi213ag99gP4U/rUk"; mail-complaints-to="abuse@albasani.net"
User-Agent: 40tude_Dialog/2.0.15.84
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
Cancel-Lock: sha1:auNig8bXhnpKquLxRHN4+isp0RU=
View all headers
On Wed, 01 Jan 2020 08:51:38 -0600, Robert Wessel wrote:

While the default operand size is controlled by the segment descriptor
in 16/32 bit mode, the other size can be accessed by using the operand
size prefix (0x66), so you can access the upper halves of the Exx
registers even in 16-bit mode, even in real mode.  You can even call
between 16 and 32-bit code fairly easily (subject to constraints on
how the segments are set up, and obviously you cannot pass a 32-bit
offset to 16 bit code).  You cannot really do that with 64-bit code
(it can be done, of course, although you need to jump through some
hoops).

But that accesses the 32-bit register as a whole, which also accesses the
lower half. i.e. there's no 32/64 bit equivalent of e.g. AH register.
Something like EAH for upper EAX, or RAH for upper RAX.

The only way to access only the upper half of RAX/EAX is to swap the upper
and lower bits, access it using EAX/AX, then swap the bits back. Or copy the
register to EDX/DX then clears the upper half.

Is x86-64 opcode encoding near to its very limit? If so, then the next step
should be an entirely new mode, right? Perhaps, dumping 16-bit mode would
free up some space for opcode encoding. (ouch!)


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Robert Wessel
Newsgroups: alt.lang.asm
Organization: Forte - www.forteinc.com
Date: Thu, 2 Jan 2020 00:13 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!aioe.org!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx47.iad.POSTED!not-for-mail
From: robertwe...@yahoo.com (Robert Wessel)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
Message-ID: <hlcq0f94ab510m3lcg4dhi21g4frgjnhb0@4ax.com>
References: <qufjsl$kt9$1@dont-email.me> <176l97bwkm4a4$.1n2ay3ij76a3v$.dlg@40tude.net> <qug3q1$8r2$2@dont-email.me> <1pkhcaq1wj7e5.1672x4um9f728.dlg@40tude.net> <n0cp0fp9i2tpmaoaiaqc14ll787jr6ckv7@4ax.com> <1rrgjeyqds0hs$.7s88or5y1dfs.dlg@40tude.net>
User-Agent: ForteAgent/7.20.32.1218
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 44
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Wed, 01 Jan 2020 18:13:50 -0600
X-Received-Bytes: 3280
X-Received-Body-CRC: 1816338912
View all headers
On Thu, 2 Jan 2020 03:50:57 +0700, JJ <jj4public@vfemail.net> wrote:

On Wed, 01 Jan 2020 08:51:38 -0600, Robert Wessel wrote:

While the default operand size is controlled by the segment descriptor
in 16/32 bit mode, the other size can be accessed by using the operand
size prefix (0x66), so you can access the upper halves of the Exx
registers even in 16-bit mode, even in real mode.  You can even call
between 16 and 32-bit code fairly easily (subject to constraints on
how the segments are set up, and obviously you cannot pass a 32-bit
offset to 16 bit code).  You cannot really do that with 64-bit code
(it can be done, of course, although you need to jump through some
hoops).

But that accesses the 32-bit register as a whole, which also accesses the
lower half. i.e. there's no 32/64 bit equivalent of e.g. AH register.
Something like EAH for upper EAX, or RAH for upper RAX.

The only way to access only the upper half of RAX/EAX is to swap the upper
and lower bits, access it using EAX/AX, then swap the bits back. Or copy the
register to EDX/DX then clears the upper half.

Is x86-64 opcode encoding near to its very limit? If so, then the next step
should be an entirely new mode, right? Perhaps, dumping 16-bit mode would
free up some space for opcode encoding. (ouch!)


Ah, it wasn't clear to me that you were talking about specifically
accessing the upper haves of the registers, rather than the registers
as a whole.

At this point x86 encoding is more than a bit of a mess, with a number
of different prefix schemes to extend it.  But at least things like
EVEX have a fair bit of room (even if this is adding a *four* byte
prefix to instructions - on the plus  it does allow the elimination of
separate prefixes for some other functions).

Dumping 16-bit mode (or even 32-bit mode) really does nothing for long
mode encoding space.  As I mentioned long mode encoding is already
different (and incompatible with) 16/32 bit encoding.  Sure, there are
many similarities, but definite differences as well.

One of the disappointments of AMD64 was that AMD didn't take what was
likely the last opportunity to clean up x86 encoding.


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Veek M
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Sat, 4 Jan 2020 07:01 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: vee...@dont-use-this.com (Veek M)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm
code - why not?
Date: Sat, 4 Jan 2020 07:01:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 1
Message-ID: <qupd8t$i50$1@dont-email.me>
References: <qufjsl$kt9$1@dont-email.me> <quhjle$q4s$3@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 4 Jan 2020 07:01:49 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f3256a5f54575ce9277b22f1c2171c34";
logging-data="18592"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7Ag11RW2ND6dLEH68Ma73"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:ha5CqwpgRv2QHwamk5b7TW+IfRc=
View all headers
thanks :) that was clear and fit my knowledge level


Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm code - why not?
From: Veek M
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Sat, 4 Jan 2020 07:03 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: vee...@dont-use-this.com (Veek M)
Newsgroups: alt.lang.asm
Subject: Re: Can AX and BX, CX etc be used for parameter passing in 32 bit asm
code - why not?
Date: Sat, 4 Jan 2020 07:03:47 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 3
Message-ID: <qupdci$i50$2@dont-email.me>
References: <qufjsl$kt9$1@dont-email.me>
<176l97bwkm4a4$.1n2ay3ij76a3v$.dlg@40tude.net> <qug3q1$8r2$2@dont-email.me>
<1pkhcaq1wj7e5.1672x4um9f728.dlg@40tude.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 4 Jan 2020 07:03:47 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f3256a5f54575ce9277b22f1c2171c34";
logging-data="18592"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18X5NE/FkKgXBG49cgcy9KN"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:9t/2PjFZEUsBsNkNKACxSi/2fSo=
View all headers
I didn't follow any of this - any introductory reading material would
help. I suspect it has something to do with multi-byte opcodes which I
haven't quite figured out as yet.


1
rocksolid light 0.7.2
clearneti2ptor