Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #21788
| Newsgroups | comp.lang.forth |
|---|---|
| Date | 2013-04-21 14:39 -0700 |
| References | <eb60b3e1-b203-4589-a1be-e80a161005ea@googlegroups.com> <1o3ftp855g01z.mpoeumil4ssc.dlg@40tude.net> |
| Message-ID | <922db982-72f1-498b-87ea-7dbf22757df7@googlegroups.com> (permalink) |
| Subject | Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... |
| From | AKE <assadebrahim2000@gmail.com> |
On Sunday, April 21, 2013 4:34:00 PM UTC+1, Coos Haak wrote: > Op Fri, 19 Apr 2013 18:21:11 -0700 (PDT) schreef AKE: > > > ( Protect edx by saving to unused part of stack memory ) > > mov ebx, esp > > sub ebx, # 20 \ advance 5 cells ahead of current stack > > mov [ebx], edx \ save protected register edx > > > > ( Run cpuid opcode ) <snip> > > ( Restore original value to edx from unused part of stack... ) > > mov ebx, esp > > sub ebx, # 4 \ ... which has now grown by 4 cells > > mov edx, [ebx] \ restore edx > > > Use of the return stack to move edx out of the way, resulting in simpler > and shorter code. > > CODE call-cpu-info > push ebx \ preserve TOS > > ( Protect edx on the return stack ) > sub ebp, # 4 \ Make room for edx > mov 0 [ebp], edx > > ( Run cpuid opcode ) > xor eax, eax \ eax=0 > cpuid \ returns eax=N (highest recognised param) > \ and three packed 4-byte chars to ebx,ecx,edx > > ( Send returned values to Forth stack ) > push ecx \ 'ntel' > push edx \ 'ineI' > push ebx \ 'Genu' > push eax \ highest recognised param > > ( Restore original value to edx from the return stack ) > mov edx, 0 [ebp] \ Restore edx > add ebp, # 4 > next, > end-code > Coos --- Like it. Hadn't thought of the return stack. That's much better now. Thanks! :) - Assad
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... AKE <assadebrahim2000@gmail.com> - 2013-04-19 18:21 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-04-21 01:27 -0400
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... AKE <assadebrahim2000@gmail.com> - 2013-04-21 04:57 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-04-21 11:39 -0400
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-21 09:53 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... AKE <assadebrahim2000@gmail.com> - 2013-04-21 14:47 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-22 02:17 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Coos Haak <chforth@hccnet.nl> - 2013-04-21 17:34 +0200
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Coos Haak <chforth@hccnet.nl> - 2013-04-21 17:42 +0200
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-21 12:37 -0500
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-21 10:53 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-22 03:24 -0500
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-22 02:49 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-22 10:06 +0000
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-22 07:35 -0500
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-22 13:12 +0000
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-22 10:01 -0500
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-22 08:33 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-22 11:34 -0500
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-23 03:27 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-04-23 17:42 -0400
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-24 03:00 -0500
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... AKE <assadebrahim2000@gmail.com> - 2013-04-21 14:43 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-22 02:21 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-22 08:36 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... Alex McDonald <blog@rivadpm.com> - 2013-04-22 08:39 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... AKE <assadebrahim2000@gmail.com> - 2013-04-22 13:55 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... AKE <assadebrahim2000@gmail.com> - 2013-04-21 14:39 -0700
Re: Stack Interface between x86 Assembler & Forth -- technique when running out of unprotected registers... albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-21 21:00 +0000
csiph-web