From b8e698bde31abced2a480eae3be8f6067e69122a Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Tue, 3 Feb 2004 11:00:34 +0000 Subject: [PATCH] Added CPU instructions to all nasm source files. FIXME: ctojr32 needs CPU 486 because it uses bswap. committer: mfx 1075806034 +0000 --- TODO | 1 + src/stub/fold_elf86.asm | 1 + src/stub/fold_exec86.asm | 1 + src/stub/fold_sh86.asm | 1 + src/stub/l_com.asm | 3 +++ src/stub/l_djgpp2.asm | 1 + src/stub/l_exe.asm | 3 +++ src/stub/l_lx_elf86.asm | 1 + src/stub/l_lx_exec86.asm | 1 + src/stub/l_lx_sep86.asm | 1 + src/stub/l_lx_sh86.asm | 1 + src/stub/l_sys.asm | 7 +++++++ src/stub/l_tmt.asm | 1 + src/stub/l_w32pe.asm | 1 + src/stub/l_wcle.asm | 1 + src/stub/macros.ash | 4 ++++ src/stub/upx_itoa.asm | 1 + 17 files changed, 30 insertions(+) diff --git a/TODO b/TODO index 6b3ccfef..34822bd5 100644 --- a/TODO +++ b/TODO @@ -14,6 +14,7 @@ IMPORTANT PROBLEMS THAT SHOULD BE FIXED SOON: - atari/tos is incompatible with upx 1.2 ??? +- stub ctojr32 needs CPU 486 because of bswap OTHER: diff --git a/src/stub/fold_elf86.asm b/src/stub/fold_elf86.asm index d221145d..8e4b60d9 100644 --- a/src/stub/fold_elf86.asm +++ b/src/stub/fold_elf86.asm @@ -30,6 +30,7 @@ BITS 32 SECTION .text + CPU 386 %define PAGE_SIZE ( 1<<12) %define szElf32_Ehdr 0x34 diff --git a/src/stub/fold_exec86.asm b/src/stub/fold_exec86.asm index aee60013..1ce6f725 100644 --- a/src/stub/fold_exec86.asm +++ b/src/stub/fold_exec86.asm @@ -30,6 +30,7 @@ BITS 32 SECTION .text + CPU 386 ;; control just falls through, after this part and compiled C code ;; are uncompressed. diff --git a/src/stub/fold_sh86.asm b/src/stub/fold_sh86.asm index 3706c9a6..aacc4432 100644 --- a/src/stub/fold_sh86.asm +++ b/src/stub/fold_sh86.asm @@ -32,6 +32,7 @@ BITS 32 SECTION .text + CPU 386 %define PAGE_SIZE ( 1<<12) %define szElf32_Ehdr 0x34 diff --git a/src/stub/l_com.asm b/src/stub/l_com.asm index 9bee26d1..949f7a76 100644 --- a/src/stub/l_com.asm +++ b/src/stub/l_com.asm @@ -35,6 +35,7 @@ BITS 16 ORG 0 SECTION .text + CPU 8086 ; ============= ; ============= ENTRY POINT @@ -78,7 +79,9 @@ cutpoint: ; ============= DECOMPRESSION ; ============= + CPU 286 %include "n2b_d16.ash" + CPU 8086 ; ============= ; ============= CALLTRICK diff --git a/src/stub/l_djgpp2.asm b/src/stub/l_djgpp2.asm index e151b8d3..41aafe90 100644 --- a/src/stub/l_djgpp2.asm +++ b/src/stub/l_djgpp2.asm @@ -33,6 +33,7 @@ BITS 32 SECTION .text ORG 0 + CPU 386 ; ============= ; ============= ENTRY POINT diff --git a/src/stub/l_exe.asm b/src/stub/l_exe.asm index 3e25eef6..deee2949 100644 --- a/src/stub/l_exe.asm +++ b/src/stub/l_exe.asm @@ -33,6 +33,7 @@ BITS 16 ORG 0 SECTION .text + CPU 8086 ; ============= ; ============= ENTRY POINT @@ -83,9 +84,11 @@ do_copy: ; ============= DECOMPRESSION ; ============= + CPU 286 %include "n2b_d8e.ash" %include "n2d_d8e.ash" %include "n2e_d8e.ash" + CPU 8086 ; ============= ; ============= RELOCATION diff --git a/src/stub/l_lx_elf86.asm b/src/stub/l_lx_elf86.asm index d8811a77..8fcee7eb 100644 --- a/src/stub/l_lx_elf86.asm +++ b/src/stub/l_lx_elf86.asm @@ -32,6 +32,7 @@ BITS 32 SECTION .text + CPU 386 %define jmps jmp short %define jmpn jmp near diff --git a/src/stub/l_lx_exec86.asm b/src/stub/l_lx_exec86.asm index e6faa943..a21e795d 100644 --- a/src/stub/l_lx_exec86.asm +++ b/src/stub/l_lx_exec86.asm @@ -32,6 +32,7 @@ BITS 32 SECTION .text + CPU 386 %define jmps jmp short %define jmpn jmp near diff --git a/src/stub/l_lx_sep86.asm b/src/stub/l_lx_sep86.asm index fa9f16e6..7fb34499 100644 --- a/src/stub/l_lx_sep86.asm +++ b/src/stub/l_lx_sep86.asm @@ -32,6 +32,7 @@ BITS 32 SECTION .text + CPU 386 %define jmps jmp short %define jmpn jmp near diff --git a/src/stub/l_lx_sh86.asm b/src/stub/l_lx_sh86.asm index c1a0aabd..177960c8 100644 --- a/src/stub/l_lx_sh86.asm +++ b/src/stub/l_lx_sh86.asm @@ -32,6 +32,7 @@ BITS 32 SECTION .text + CPU 386 ; /************************************************************************* ; // program entry point diff --git a/src/stub/l_sys.asm b/src/stub/l_sys.asm index a603ab27..c3140d9b 100644 --- a/src/stub/l_sys.asm +++ b/src/stub/l_sys.asm @@ -36,6 +36,7 @@ BITS 16 ORG 0 SECTION .text + CPU 8086 ; ============= ; ============= ENTRY POINT @@ -49,7 +50,9 @@ start: dw 0 ; opendos wants this field untouched strategy: %ifdef __SYSI2861__ + CPU 286 pusha + CPU 8086 %else; __SYSI0861__ push ax push bx @@ -94,7 +97,9 @@ cutpoint: ; ============= DECOMPRESSION ; ============= + CPU 286 %include "n2b_d16.ash" + CPU 8086 ; ============= ; ============= CALLTRICK @@ -106,7 +111,9 @@ cutpoint: ; __SYSMAIN5__ pop es %ifdef __SYSI2862__ + CPU 286 popa + CPU 8086 %else; __SYSI0862__ pop bp pop di diff --git a/src/stub/l_tmt.asm b/src/stub/l_tmt.asm index 0ef448f4..275835b1 100644 --- a/src/stub/l_tmt.asm +++ b/src/stub/l_tmt.asm @@ -33,6 +33,7 @@ BITS 32 SECTION .text ORG 0 + CPU 386 ; ============= ; ============= ENTRY POINT diff --git a/src/stub/l_w32pe.asm b/src/stub/l_w32pe.asm index 4ac682c6..70ff6ea8 100644 --- a/src/stub/l_w32pe.asm +++ b/src/stub/l_w32pe.asm @@ -36,6 +36,7 @@ BITS 32 SECTION .text ORG 0 + CPU 386 ; ============= ; ============= ENTRY POINT diff --git a/src/stub/l_wcle.asm b/src/stub/l_wcle.asm index c3d4b288..cddda18d 100644 --- a/src/stub/l_wcle.asm +++ b/src/stub/l_wcle.asm @@ -33,6 +33,7 @@ BITS 32 SECTION .text ORG 0 + CPU 386 ; ============= ; ============= ENTRY POINT diff --git a/src/stub/macros.ash b/src/stub/macros.ash index ed65cdab..5b6e2a56 100644 --- a/src/stub/macros.ash +++ b/src/stub/macros.ash @@ -282,6 +282,9 @@ reloc_endx: ;; MRUBYTEn 256 entries in wheel (smallest code) %macro ctojr32 0 + + CPU 486 ; FIXME: ctojr32 uses bswap + ;; I got confused by the syntactic sugar of the fake %ifdefs. ;; I can read the section name more easily when it is at the left margin. ;; Also, some of the logic to select the sections is not that simple, @@ -576,6 +579,7 @@ unfcount: push edx ret + CPU 386 %endmacro ; vi:ts=8:et:nowrap diff --git a/src/stub/upx_itoa.asm b/src/stub/upx_itoa.asm index 47227309..ae91e87b 100644 --- a/src/stub/upx_itoa.asm +++ b/src/stub/upx_itoa.asm @@ -27,6 +27,7 @@ BITS 32 SECTION .text + CPU 386 GLOBAL upx_itoa upx_itoa: ; char *upx_itoa(eax= unsigned v, edx= char *buf) /* 0<=(int)v */