2018-07-22 13:24:36 +01:00
|
|
|
### GNU Mes --- Maxwell Equations of Software
|
2018-08-15 17:26:55 +01:00
|
|
|
### Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2017-07-02 15:25:14 +01:00
|
|
|
###
|
2018-07-22 13:24:36 +01:00
|
|
|
### This file is part of GNU Mes.
|
2017-07-02 15:25:14 +01:00
|
|
|
###
|
|
|
|
### Mes is free software# you can redistribute it and/or modify it
|
|
|
|
### under the terms of the GNU General Public License as published by
|
|
|
|
### the Free Software Foundation# either version 3 of the License, or (at
|
|
|
|
### your option) any later version.
|
|
|
|
###
|
2018-07-22 13:24:36 +01:00
|
|
|
### GNU Mes is distributed in the hope that it will be useful, but
|
2017-07-02 15:25:14 +01:00
|
|
|
### WITHOUT ANY WARRANTY# without even the implied warranty of
|
|
|
|
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
### GNU General Public License for more details.
|
|
|
|
###
|
|
|
|
### You should have received a copy of the GNU General Public License
|
2018-07-22 13:24:36 +01:00
|
|
|
### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
2017-07-02 15:25:14 +01:00
|
|
|
|
2018-08-15 17:26:55 +01:00
|
|
|
# reduced instruction set: eax, ebx (some ecx for shift, edx for mul, div)
|
2018-10-07 14:15:45 +01:00
|
|
|
# 193 instructions
|
2018-10-06 14:56:14 +01:00
|
|
|
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE add____$i32,%eax 05
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE add____$i32,%ebx 81c3
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE add____$i32,(%eax) 8100
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE add____$i32,(%ebx) 8103
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE add____$i32,0x32(%eax) 8180
|
|
|
|
DEFINE add____$i32,0x32(%ebp) 8185
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE add____$i8,%eax 83c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE add____$i8,%ebx 83c3
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE add____$i8,%esp 83c4
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE add____$i8,(%eax) 8300
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE add____$i8,(%ebx) 8303
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE add____$i8,0x32 8305
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE add____$i8,0x32(%eax) 8380
|
|
|
|
DEFINE add____$i8,0x32(%ebp) 8385
|
|
|
|
DEFINE add____$i8,0x8(%eax) 8340
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE add____$i8,0x8(%ebp) 8345
|
|
|
|
DEFINE add____%eax,%eax 01c0
|
|
|
|
DEFINE add____%ebp,%eax 01e8
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE add____%ebx,%eax 01d8
|
|
|
|
DEFINE add____%ebx,%ebx 01db
|
|
|
|
DEFINE addb___$i8,(%eax) 8000
|
|
|
|
DEFINE addb___$i8,(%ebx) 8003
|
|
|
|
DEFINE addw___$i8,(%eax) 668100
|
|
|
|
DEFINE addw___$i8,(%ebx) 668103
|
2018-05-13 16:05:28 +01:00
|
|
|
DEFINE and____$i32,%eax 25
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE and____$i32,%ebx 81e3
|
|
|
|
DEFINE and____%ebx,%eax 21d8
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE call32 e8
|
|
|
|
DEFINE call___*%eax ffd0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE call___*%ebx ffd3
|
2018-10-06 16:28:08 +01:00
|
|
|
DEFINE cltd 99
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE cmp____$0x32,%eax 3d
|
|
|
|
DEFINE cmp____$i32,%eax 3d
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE cmp____$i8,%eax 83f8
|
2018-11-09 15:56:54 +00:00
|
|
|
DEFINE cmp____$i8,%ebx 81fb
|
2018-10-07 14:15:45 +01:00
|
|
|
DEFINE div___%ebx f7f3
|
2017-09-03 07:18:18 +01:00
|
|
|
DEFINE hlt f4
|
2017-07-28 19:36:21 +01:00
|
|
|
DEFINE idiv___%ebx f7fb
|
2017-09-10 15:59:43 +01:00
|
|
|
DEFINE int cd
|
2017-11-26 12:10:46 +00:00
|
|
|
DEFINE int____$0x80 cd80
|
2018-05-19 10:41:53 +01:00
|
|
|
DEFINE ja32 0f87
|
|
|
|
DEFINE jae32 0f83
|
|
|
|
DEFINE jb32 0f82
|
|
|
|
DEFINE jbe32 0f86
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE je32 0f84
|
2017-07-29 19:46:16 +01:00
|
|
|
DEFINE je8 74
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE jg32 0f8f
|
|
|
|
DEFINE jge32 0f8d
|
2017-07-29 19:46:16 +01:00
|
|
|
DEFINE jl32 0f8c
|
|
|
|
DEFINE jle32 0f8e
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE jmp32 e9
|
2017-11-26 12:10:46 +00:00
|
|
|
DEFINE jmp____*%ebx ffe3
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE jne32 0f85
|
|
|
|
DEFINE lahf 9f
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE lea____0x32(%ebp),%eax 8d85
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE lea____0x8(%ebp),%eax 8d45
|
|
|
|
DEFINE leave c9
|
|
|
|
DEFINE mov____$i32,%eax b8
|
|
|
|
DEFINE mov____$i32,%ebx bb
|
|
|
|
DEFINE mov____$i32,(%eax) c700
|
|
|
|
DEFINE mov____$i32,0x32 c705
|
|
|
|
DEFINE mov____$i32,0x8(%eax) c740
|
|
|
|
DEFINE mov____$i32,0x8(%ebp) c745
|
2019-02-24 11:31:44 +00:00
|
|
|
DEFINE mov____$i8,%al b0
|
|
|
|
DEFINE mov____$i8,%eax b0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mov____%al,(%ebx) 8803
|
2019-02-09 20:42:17 +00:00
|
|
|
DEFINE mov____%al,0x32(%ebp) 8885
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mov____%al,0x8(%ebp) 8845
|
|
|
|
DEFINE mov____%ax,(%ebx) 668903
|
|
|
|
DEFINE mov____%ax,0x8(%ebp) 668945
|
2018-10-06 19:23:43 +01:00
|
|
|
DEFINE mov____%bx,%bx 6689db
|
|
|
|
DEFINE mov____%cl,(%ebx) 8a08
|
|
|
|
DEFINE mov____%cx,(%ebx) 668b08
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____%dl,(%eax) 8810
|
|
|
|
DEFINE mov____%dl,0x8(%eax) 8850
|
|
|
|
DEFINE mov____%eax,%ebx 89c3
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mov____%eax,%ecx 89c1
|
|
|
|
DEFINE mov____%eax,(%ebx) 8903
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____%eax,0x32 a3
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE mov____%eax,0x32(%ebp) 8985
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____%eax,0x8(%ebp) 8945
|
|
|
|
DEFINE mov____%ebp,%eax 89e8
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mov____%ebp,%ebx 89eb
|
|
|
|
DEFINE mov____%ebx,%eax 89d8
|
|
|
|
DEFINE mov____%ebx,%ecx 89d9
|
2017-08-06 17:49:19 +01:00
|
|
|
DEFINE mov____%ebx,0x32 891d
|
|
|
|
DEFINE mov____%ebx,0x32(%ebp) 899d
|
|
|
|
DEFINE mov____%ebx,0x8(%ebp) 895d
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mov____%ecx,(%ebx) 890b
|
2020-07-15 21:15:36 +01:00
|
|
|
DEFINE mov____%edi,%ebp 89fd
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____%edx,%eax 89d0
|
2017-07-28 19:36:21 +01:00
|
|
|
DEFINE mov____%edx,%ebx 89d3
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____%esp,%ebp 89e5
|
2020-07-15 21:15:36 +01:00
|
|
|
DEFINE mov____%esp,%edi 89e7
|
2018-10-06 19:23:43 +01:00
|
|
|
DEFINE mov____(%eax),%cl 8a08
|
|
|
|
DEFINE mov____(%eax),%cx 668b08
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____(%eax),%eax 8b00
|
2017-07-28 21:45:32 +01:00
|
|
|
DEFINE mov____(%eax),%ecx 8b08
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mov____(%ebx),%ebx 8b1b
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE mov____0x32(%eax),%eax 8b80
|
2017-08-06 17:49:19 +01:00
|
|
|
DEFINE mov____0x32(%eax),%ebx 8b98
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE mov____0x32(%ebp),%eax 8b85
|
|
|
|
DEFINE mov____0x32(%ebp),%ebx 8b9d
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____0x32,%eax a1
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mov____0x32,%ebx 8b1d
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____0x8(%eax),%eax 8b40
|
2017-08-06 17:49:19 +01:00
|
|
|
DEFINE mov____0x8(%eax),%ebx 8b58
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____0x8(%ebp),%eax 8b45
|
2017-11-26 12:10:46 +00:00
|
|
|
DEFINE mov____0x8(%ebp),%ebp 8b6d
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____0x8(%ebp),%ebx 8b5d
|
|
|
|
DEFINE mov____0x8(%ebp),%ecx 8b4d
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mov____0x8(%ebp),%edi 8b7d
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE mov____0x8(%ebp),%edx 8b55
|
2018-08-11 10:42:30 +01:00
|
|
|
DEFINE mov____0x8(%ebp),%esi 8b75
|
2017-11-26 12:10:46 +00:00
|
|
|
DEFINE mov____0x8(%ebp),%esp 8b65
|
2018-10-06 14:56:14 +01:00
|
|
|
DEFINE movb___%al,0x32 a2
|
2018-10-16 19:40:37 +01:00
|
|
|
DEFINE movb___%bl,0x32 881d
|
mescc: Tinycc support: Char and short sign extend.
* module/mes/as-i386.mes (i386:accu*n->local, i386:byte-accu->local+n,
i386:word-accu->local+n): Remove.
(i386:byte-accu, i386:signed-byte-accu, i386:word-accu,
i386:signed-word-accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (accu->local+n-text): Simplify.
(mem->accu, convert-accu): New function.
(expr->accu): Use them.
* stage0/x86.M1 (mov____%al,0x32(%ebp), mov____%al,0x8(%ebp),
mov____%ax,0x32(%ebp), mov____%ax,0x8(%ebp), movzbl_0x32(%ebp),%eax,
movzbl_0x8(%ebp),%eax, movzwl_0x32(%ebp),%eax,
movzwl_0x8(%ebp),%eax): Deprecate.
* scaffold/tests/7r-sign-extend.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-18 22:58:10 +01:00
|
|
|
DEFINE movsbl_%al,%eax 0fbec0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE movsbl_%bl,%ebx 0fbedb
|
mescc: Tinycc support: Char and short sign extend.
* module/mes/as-i386.mes (i386:accu*n->local, i386:byte-accu->local+n,
i386:word-accu->local+n): Remove.
(i386:byte-accu, i386:signed-byte-accu, i386:word-accu,
i386:signed-word-accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (accu->local+n-text): Simplify.
(mem->accu, convert-accu): New function.
(expr->accu): Use them.
* stage0/x86.M1 (mov____%al,0x32(%ebp), mov____%al,0x8(%ebp),
mov____%ax,0x32(%ebp), mov____%ax,0x8(%ebp), movzbl_0x32(%ebp),%eax,
movzbl_0x8(%ebp),%eax, movzwl_0x32(%ebp),%eax,
movzwl_0x8(%ebp),%eax): Deprecate.
* scaffold/tests/7r-sign-extend.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-18 22:58:10 +01:00
|
|
|
DEFINE movswl_%ax,%eax 0fbfc0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE movswl_%bx,%ebx 0fbfdb
|
2018-10-06 14:56:14 +01:00
|
|
|
DEFINE movw___%ax,0x32 66a3
|
2018-10-16 19:40:37 +01:00
|
|
|
DEFINE movw___%bx,0x32 66891d
|
mescc: Tinycc support: Char and short sign extend.
* module/mes/as-i386.mes (i386:accu*n->local, i386:byte-accu->local+n,
i386:word-accu->local+n): Remove.
(i386:byte-accu, i386:signed-byte-accu, i386:word-accu,
i386:signed-word-accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (accu->local+n-text): Simplify.
(mem->accu, convert-accu): New function.
(expr->accu): Use them.
* stage0/x86.M1 (mov____%al,0x32(%ebp), mov____%al,0x8(%ebp),
mov____%ax,0x32(%ebp), mov____%ax,0x8(%ebp), movzbl_0x32(%ebp),%eax,
movzbl_0x8(%ebp),%eax, movzwl_0x32(%ebp),%eax,
movzwl_0x8(%ebp),%eax): Deprecate.
* scaffold/tests/7r-sign-extend.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-18 22:58:10 +01:00
|
|
|
DEFINE movzbl_%al,%eax 0fb6c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE movzbl_%bl,%ebx 0fb6db
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE movzbl_(%eax),%eax 0fb600
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE movzbl_(%ebx),%ebx 0fb61b
|
2017-08-06 11:27:16 +01:00
|
|
|
DEFINE movzbl_0x32(%eax),%eax 0fb680
|
|
|
|
DEFINE movzbl_0x8(%eax),%eax 0fb640
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE movzbl_0x8(%ebp),%eax 0fb645
|
mescc: Tinycc support: Char and short sign extend.
* module/mes/as-i386.mes (i386:accu*n->local, i386:byte-accu->local+n,
i386:word-accu->local+n): Remove.
(i386:byte-accu, i386:signed-byte-accu, i386:word-accu,
i386:signed-word-accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (accu->local+n-text): Simplify.
(mem->accu, convert-accu): New function.
(expr->accu): Use them.
* stage0/x86.M1 (mov____%al,0x32(%ebp), mov____%al,0x8(%ebp),
mov____%ax,0x32(%ebp), mov____%ax,0x8(%ebp), movzbl_0x32(%ebp),%eax,
movzbl_0x8(%ebp),%eax, movzwl_0x32(%ebp),%eax,
movzwl_0x8(%ebp),%eax): Deprecate.
* scaffold/tests/7r-sign-extend.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-18 22:58:10 +01:00
|
|
|
DEFINE movzwl_%ax,%eax 0fb7c0
|
2018-10-06 14:56:14 +01:00
|
|
|
DEFINE movzwl_%bx,%ebx 0fb7db
|
2017-08-08 09:00:13 +01:00
|
|
|
DEFINE movzwl_(%eax),%eax 0fb700
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE movzwl_(%ebx),%ebx 0fb71b
|
2017-08-06 11:27:16 +01:00
|
|
|
DEFINE movzwl_0x32(%eax),%eax 0fb780
|
2017-12-03 15:33:35 +00:00
|
|
|
DEFINE movzwl_0x32(%ebp),%eax 0fb785
|
2017-08-06 11:27:16 +01:00
|
|
|
DEFINE movzwl_0x8(%eax),%eax 0fb740
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE mul____%ebx f7e3
|
|
|
|
DEFINE mul_____%ebx f7e3
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE nop 90
|
|
|
|
DEFINE not____%eax f7d0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE not____%ebx f7d3
|
|
|
|
DEFINE or_____%ebx,%eax 09d8
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE pop____%eax 58
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE pop____%ebx 5b
|
lib: Support gcc-4.6.4: Add mmap, munmap.
* include/linux/x86/syscall.h (SYS_mmap, SYS_munmap): New defines.
* include/linux/x86_64/syscall.h (SYS_mmap, SYS_munmap): New defines.
* include/linux/arm/syscall (SYS_mmap, SYS_munmap): New defines..
* include/sys/mman.h (MAP_SHARED, MAP_PRIVATE, MAP_ANONYMOUS,
MAP_POPULATE, MAP_ANON, MAP_FAILED): New macro.
(mmap, munmap): Declare.
* lib/linux/x86-mes-gcc/mes.c (_sys_call6): New function.
* lib/linux/x86-mes/mes.c (__sys_call6): New function.
(_sys_call6): New function.
* lib/linux/x86_64-mes-gcc/mes.c (_sys_call6): New function.
* lib/linux/x86_64-mes/mes.c (__sys_call): Cater for 6 syscall parameters.
(_sys_call6): New function.
* lib/x86-mes/x86.M1 (pop____%ebp): New macro.
* lib/x86_64-mes/x86_64.M1 (mov____0x8(%rbp),%r9): New macro.
* lib/linux/arm-mes-gcc/syscall.c (_sys_call6, __sys_call6): Enable.
* lib/linux/mmap.c: New file.
* lib/linux/munmap.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add them.
2019-02-08 15:51:37 +00:00
|
|
|
DEFINE pop____%ebp 5d
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE pop____%edx 5a
|
|
|
|
DEFINE push___$i32 68
|
|
|
|
DEFINE push___%eax 50
|
|
|
|
DEFINE push___%ebp 55
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE push___%ebx 53
|
2017-07-24 07:36:43 +01:00
|
|
|
DEFINE push___%edx 52
|
|
|
|
DEFINE push___(%eax) ff30
|
|
|
|
DEFINE push___0x32(%ebp) ffb5
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE push___0x8(%ebp) ff75
|
|
|
|
DEFINE ret c3
|
|
|
|
DEFINE sahf 9e
|
2018-05-19 10:41:53 +01:00
|
|
|
DEFINE seta___%al 0f97c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE seta___%bl 0f97c3
|
2018-05-19 10:41:53 +01:00
|
|
|
DEFINE setae__%al 0f93c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE setae__%bl 0f93c3
|
2018-05-19 10:41:53 +01:00
|
|
|
DEFINE setb___%al 0f92c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE setb___%bl 0f92c3
|
2018-05-19 10:41:53 +01:00
|
|
|
DEFINE setbe__%al 0f96c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE setbe__%bl 0f96c3
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE sete___%al 0f94c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE sete___%bl 0f94c3
|
2017-07-29 19:46:16 +01:00
|
|
|
DEFINE setg___%al 0f9fc0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE setg___%bl 0f9fc3
|
2017-07-29 19:46:16 +01:00
|
|
|
DEFINE setge__%al 0f9dc0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE setge__%bl 0f9dc3
|
2017-07-29 19:46:16 +01:00
|
|
|
DEFINE setl___%al 0f9cc0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE setl___%bl 0f9cc3
|
2017-07-29 19:46:16 +01:00
|
|
|
DEFINE setle__%al 0f9ec0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE setle__%bl 0f9ec3
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE setne__%al 0f95c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE setne__%bl 0f95c3
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE shl____$i8,%eax c1e0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE shl____$i8,%ebx c1e3
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE shl____%cl,%eax d3e0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE shl____%cl,%ebx d3e3
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE shr____%cl,%eax d3e8
|
2018-08-14 19:32:56 +01:00
|
|
|
DEFINE sub____$8,%esp 83ec
|
|
|
|
DEFINE sub____$i32,%esp 81ec
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE sub____%al,%dl 28d0
|
|
|
|
DEFINE sub____%dl,%al 28c2
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE sub____%ebx,%eax 29d8
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE test___%al,%al 84c0
|
|
|
|
DEFINE test___%eax,%eax 85c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE test___%ebx,%ebx 85db
|
|
|
|
DEFINE xchg___%eax,%ebx 93
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE xchg___%eax,(%esp) 870424
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE xchg___%ebx,(%esp) 871c24
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE xor____$i32,%eax 35
|
|
|
|
DEFINE xor____$i8,%ah 80f4
|
|
|
|
DEFINE xor____%eax,%eax 31c0
|
2018-08-15 17:26:55 +01:00
|
|
|
DEFINE xor____%ebx,%eax 31d8
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE xor____%ebx,%ebx 31db
|
|
|
|
DEFINE xor____%edx,%edx 31d2
|
|
|
|
|
2018-08-15 17:26:55 +01:00
|
|
|
|
|
|
|
# Enough for all of Mes + Mes C Libray when using all registers, i.e.,
|
|
|
|
# non-reduced instruction set
|
|
|
|
#DEFINE add____$i32,%ecx 81c1
|
|
|
|
#DEFINE add____$i32,%edx 81c2
|
|
|
|
#DEFINE add____$i32,%esi 81c6
|
|
|
|
#DEFINE add____$i8,%ecx 83c1
|
|
|
|
#DEFINE add____$i8,%edx 83c2
|
|
|
|
#DEFINE add____$i8,%esi 83c6
|
|
|
|
#DEFINE add____$i8,(%ecx) 8301
|
|
|
|
#DEFINE add____$i8,(%edx) 8302
|
|
|
|
#DEFINE add____%ecx,%ebx 01cb
|
|
|
|
#DEFINE add____%ecx,%ecx 01c9
|
|
|
|
#DEFINE add____%edx,%eax 01d0
|
|
|
|
#DEFINE add____%edx,%ecx 01d1
|
|
|
|
#DEFINE add____%edx,%edx 01d2
|
|
|
|
#DEFINE add____%esi,%edx 01f2
|
|
|
|
#DEFINE and____$i32,%ecx 81e1
|
|
|
|
#DEFINE and____$i32,%edx 81e2
|
|
|
|
#DEFINE and____%edx,%eax 21d0
|
|
|
|
#DEFINE and____(%edx),%eax 2302
|
|
|
|
#DEFINE cmp____%edx,%eax 39d0
|
|
|
|
#DEFINE idiv___%ecx f7f9
|
|
|
|
#DEFINE lea____0x32(%ebp),%edx 8d95
|
|
|
|
#DEFINE lea____0x8(%ebp),%edx 8d55
|
|
|
|
#DEFINE mov____$i32,%ecx b9
|
|
|
|
#DEFINE mov____$i32,%edx ba
|
|
|
|
#DEFINE mov____$i32,%esi be
|
|
|
|
#DEFINE mov____%al,(%edx) 8802
|
|
|
|
#DEFINE mov____%al,0x8(%edx) 8842
|
|
|
|
#DEFINE mov____%ax,(%edx) 668902
|
|
|
|
#DEFINE mov____%ax,0x32(%edx) 668982
|
|
|
|
#DEFINE mov____%ax,0x8(%edx) 668942
|
|
|
|
#DEFINE mov____%bl,(%ecx) 8819
|
|
|
|
#DEFINE mov____%eax,%edx 89c2
|
|
|
|
#DEFINE mov____%eax,%esi 89c6
|
|
|
|
#DEFINE mov____%eax,(%ecx) 8901
|
|
|
|
#DEFINE mov____%eax,(%edx) 8902
|
|
|
|
#DEFINE mov____%eax,0x32(%edx) 8982
|
|
|
|
#DEFINE mov____%eax,0x8(%edx) 8942
|
|
|
|
#DEFINE mov____%ebp,%ecx 89e9
|
|
|
|
#DEFINE mov____%ebp,%edx 89ea
|
|
|
|
#DEFINE mov____%ebp,%esi 89ee
|
|
|
|
#DEFINE mov____%ebx,(%ecx) 8919
|
|
|
|
#DEFINE mov____%ebx,0x8(%edx) 895a
|
|
|
|
#DEFINE mov____%ecx,%eax 89c8
|
|
|
|
#DEFINE mov____%ecx,%ecx 89c9
|
|
|
|
#DEFINE mov____%ecx,%edx 89ca
|
|
|
|
#DEFINE mov____%ecx,(%eax) 8908
|
|
|
|
#DEFINE mov____%ecx,(%edx) 890a
|
|
|
|
#DEFINE mov____%ecx,0x32(%ebp) 898d
|
|
|
|
#DEFINE mov____%ecx,0x8(%ebp) 894d
|
|
|
|
#DEFINE mov____%edi,%ebx 89fb
|
|
|
|
#DEFINE mov____%edx,%ecx 89d1
|
|
|
|
#DEFINE mov____%edx,(%eax) 8910
|
|
|
|
#DEFINE mov____%edx,0x32(%ebp) 8995
|
|
|
|
#DEFINE mov____%edx,0x8(%ebp) 8955
|
|
|
|
#DEFINE mov____%esi,%eax 89f0
|
|
|
|
#DEFINE mov____%esi,%ebx 89f3
|
|
|
|
#DEFINE mov____(%ecx),%ecx 8b09
|
|
|
|
#DEFINE mov____(%edx),%eax 8b02
|
|
|
|
#DEFINE mov____(%edx),%ecx 8b0a
|
|
|
|
#DEFINE mov____(%edx),%edx 8b12
|
|
|
|
#DEFINE mov____0x32(%eax),%ecx 8b88
|
|
|
|
#DEFINE mov____0x32(%ebp),%ecx 8b8d
|
|
|
|
#DEFINE mov____0x32(%ebp),%edx 8b95
|
|
|
|
#DEFINE mov____0x32,%ecx 8b0d
|
|
|
|
#DEFINE mov____0x32,%edx 8b15
|
|
|
|
#DEFINE mov____0x8(%eax),%ecx 8b48
|
|
|
|
#DEFINE movsbl_%cl,%ecx 0fbec9
|
|
|
|
#DEFINE movsbl_%dl,%edx 0fbed2
|
|
|
|
#DEFINE movswl_%cx,%ecx 0fbfc9
|
|
|
|
#DEFINE movzbl_%cl,%ecx 0fb6c9
|
|
|
|
#DEFINE movzbl_%dl,%edx 0fb6d2
|
|
|
|
#DEFINE movzbl_(%eax),%edx 0fb610
|
|
|
|
#DEFINE movzbl_(%ecx),%ecx 0fb609
|
|
|
|
#DEFINE movzbl_(%edx),%edx 0fb612
|
|
|
|
#DEFINE movzwl_(%ecx),%ecx 0fb709
|
|
|
|
#DEFINE mul____%ecx f7e1
|
|
|
|
#DEFINE mul____%edi f7e7
|
|
|
|
#DEFINE mul____%edx f7e2
|
|
|
|
#DEFINE mul____%esi f7e6
|
|
|
|
#DEFINE or_____%ecx,%ebx 09cb
|
|
|
|
#DEFINE or_____%edx,%eax 09d0
|
|
|
|
#DEFINE or_____(%edx),%eax 0b02
|
|
|
|
#DEFINE pop____%ecx 59
|
|
|
|
#DEFINE pop____%edi 5f
|
|
|
|
#DEFINE push___%ecx 51
|
|
|
|
#DEFINE push___%edi 57
|
|
|
|
#DEFINE push___%esi 56
|
|
|
|
#DEFINE shl____$i8,%ecx c1e1
|
|
|
|
#DEFINE shl____$i8,%edx c1e2
|
|
|
|
#DEFINE shl____%cl,%ecx d3e1
|
|
|
|
#DEFINE sub____%eax,%edx 29c2
|
|
|
|
#DEFINE sub____%ecx,%ebx 29cb
|
|
|
|
#DEFINE sub____%edx,%eax 29d0
|
|
|
|
#DEFINE sub____%edx,%ecx 29d1
|
|
|
|
#DEFINE xchg___%ebx,%ecx 87d9
|
|
|
|
#DEFINE xchg___%ecx,%edx 87ca
|
|
|
|
#DEFINE xor____%ecx,%ecx 31c9
|
|
|
|
#DEFINE xor____%edx,%eax 31d0
|
|
|
|
|
|
|
|
|
2018-08-14 19:32:56 +01:00
|
|
|
# deprecated, remove after 0.18
|
|
|
|
DEFINE sub____%esp,$i32 81ec
|
|
|
|
DEFINE sub____%esp,$i8 83ec
|
|
|
|
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE SYS_exit 01000000
|
core: Support fork, waitpid, execve.
* stage0/x86.M1 (SYS_fork, SYS_waitpid, SYS_execve): New define.
* lib/linux-gcc.c (fork, waitpid, execve): New function.
* lib/linux-mes.c (fork, waitpid, execve): New function.
* lib/libc.c (wait): New function.
* include/unistd.h (fork, execve): Declare.
* include/sys/wait.h (waitpid, wait): Declare.
* module/mes/posix.mes (search-path, execlp, system*, waitpid): New function.
* src/posix.c (primitive_fork, execl): New function.
2018-05-24 18:54:42 +01:00
|
|
|
DEFINE SYS_fork 02000000
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE SYS_read 03000000
|
2018-06-02 10:41:06 +01:00
|
|
|
DEFINE SYS_rmdir 28000000
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE SYS_write 04000000
|
|
|
|
DEFINE SYS_open 05000000
|
2017-07-24 11:21:24 +01:00
|
|
|
DEFINE SYS_close 06000000
|
core: Support fork, waitpid, execve.
* stage0/x86.M1 (SYS_fork, SYS_waitpid, SYS_execve): New define.
* lib/linux-gcc.c (fork, waitpid, execve): New function.
* lib/linux-mes.c (fork, waitpid, execve): New function.
* lib/libc.c (wait): New function.
* include/unistd.h (fork, execve): Declare.
* include/sys/wait.h (waitpid, wait): Declare.
* module/mes/posix.mes (search-path, execlp, system*, waitpid): New function.
* src/posix.c (primitive_fork, execl): New function.
2018-05-24 18:54:42 +01:00
|
|
|
DEFINE SYS_waitpid 07000000
|
2017-07-24 16:09:33 +01:00
|
|
|
DEFINE SYS_unlink 0a000000
|
core: Support fork, waitpid, execve.
* stage0/x86.M1 (SYS_fork, SYS_waitpid, SYS_execve): New define.
* lib/linux-gcc.c (fork, waitpid, execve): New function.
* lib/linux-mes.c (fork, waitpid, execve): New function.
* lib/libc.c (wait): New function.
* include/unistd.h (fork, execve): Declare.
* include/sys/wait.h (waitpid, wait): Declare.
* module/mes/posix.mes (search-path, execlp, system*, waitpid): New function.
* src/posix.c (primitive_fork, execl): New function.
2018-05-24 18:54:42 +01:00
|
|
|
DEFINE SYS_execve 0b000000
|
2017-11-26 17:45:10 +00:00
|
|
|
DEFINE SYS_chmod 0f000000
|
2017-07-24 16:33:33 +01:00
|
|
|
DEFINE SYS_lseek 13000000
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE SYS_access 21000000
|
|
|
|
DEFINE SYS_brk 2d000000
|
2018-04-22 10:42:47 +01:00
|
|
|
DEFINE SYS_ioctl 36000000
|
2018-06-03 17:54:26 +01:00
|
|
|
DEFINE SYS_stat 6a000000
|
2017-07-02 15:25:14 +01:00
|
|
|
DEFINE SYS_fsync 76000000
|
2017-07-24 12:49:17 +01:00
|
|
|
DEFINE SYS_getcwd b7000000
|