You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(208) |
Jun
(43) |
Jul
|
Aug
(2) |
Sep
(17) |
Oct
|
Nov
(4) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(11) |
Mar
(3) |
Apr
(2) |
May
|
Jun
(3) |
Jul
(29) |
Aug
(29) |
Sep
(48) |
Oct
|
Nov
|
Dec
(5) |
2004 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2005 |
Jan
(12) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(1) |
Dec
(2) |
2006 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(21) |
Nov
(25) |
Dec
(16) |
2007 |
Jan
(26) |
Feb
(26) |
Mar
(18) |
Apr
(51) |
May
(45) |
Jun
(26) |
Jul
(6) |
Aug
(85) |
Sep
(161) |
Oct
(111) |
Nov
(83) |
Dec
(18) |
2008 |
Jan
(31) |
Feb
(27) |
Mar
|
Apr
(16) |
May
(142) |
Jun
(136) |
Jul
(51) |
Aug
(21) |
Sep
(47) |
Oct
(428) |
Nov
(19) |
Dec
(6) |
2009 |
Jan
(11) |
Feb
(37) |
Mar
(17) |
Apr
(15) |
May
(13) |
Jun
(61) |
Jul
(127) |
Aug
(15) |
Sep
(22) |
Oct
(28) |
Nov
(37) |
Dec
(10) |
2010 |
Jan
(18) |
Feb
(22) |
Mar
(10) |
Apr
(41) |
May
|
Jun
(48) |
Jul
(61) |
Aug
(54) |
Sep
(34) |
Oct
(15) |
Nov
(49) |
Dec
(11) |
2011 |
Jan
|
Feb
(24) |
Mar
(10) |
Apr
(9) |
May
|
Jun
(33) |
Jul
(41) |
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(86) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(9) |
Aug
(4) |
Sep
(11) |
Oct
(3) |
Nov
(3) |
Dec
(10) |
2013 |
Jan
(1) |
Feb
(23) |
Mar
(15) |
Apr
(7) |
May
(20) |
Jun
(3) |
Jul
(15) |
Aug
|
Sep
(29) |
Oct
(16) |
Nov
(69) |
Dec
(18) |
2014 |
Jan
|
Feb
(8) |
Mar
|
Apr
|
May
(16) |
Jun
(7) |
Jul
|
Aug
(5) |
Sep
(2) |
Oct
(4) |
Nov
(25) |
Dec
(8) |
2015 |
Jan
(6) |
Feb
(6) |
Mar
|
Apr
(1) |
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(2) |
Oct
(1) |
Nov
(6) |
Dec
|
2016 |
Jan
(12) |
Feb
(97) |
Mar
(57) |
Apr
(52) |
May
(33) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
(3) |
Nov
(3) |
Dec
|
2017 |
Jan
(4) |
Feb
|
Mar
(23) |
Apr
(5) |
May
|
Jun
(2) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
(6) |
Nov
(3) |
Dec
(3) |
2018 |
Jan
(4) |
Feb
(11) |
Mar
|
Apr
(1) |
May
(3) |
Jun
(6) |
Jul
|
Aug
(5) |
Sep
(5) |
Oct
(36) |
Nov
(128) |
Dec
(18) |
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-28 20:54:17
|
Commit-ID: 41f9ce464a00d799355a09dad806de0dc7f3996e Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=41f9ce464a00d799355a09dad806de0dc7f3996e Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 28 Oct 2018 13:49:01 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 28 Oct 2018 23:51:03 +0300 .gitignore: Add patches directory Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d55e31f..c2f323f 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,4 @@ TAGS /x86/regs.c /x86/regs.h /x86/regvals.c +/patches/ |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-28 20:54:17
|
Commit-ID: f856a97707ac60903e985d474ef018407326c15f Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=f856a97707ac60903e985d474ef018407326c15f Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 28 Oct 2018 14:23:54 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 28 Oct 2018 23:51:31 +0300 elf: Convert header to linux style No functional changes. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/elf.h | 746 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 373 insertions(+), 373 deletions(-) diff --git a/output/elf.h b/output/elf.h index 32f5b47..ab992ce 100644 --- a/output/elf.h +++ b/output/elf.h @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2009 The NASM Authors - All Rights Reserved + * Copyright 1996-2018 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * @@ -42,367 +42,367 @@ #include "compiler.h" /* Segment types */ -#define PT_NULL 0 -#define PT_LOAD 1 -#define PT_DYNAMIC 2 -#define PT_INTERP 3 -#define PT_NOTE 4 -#define PT_SHLIB 5 -#define PT_PHDR 6 -#define PT_LOOS 0x60000000 -#define PT_HIOS 0x6fffffff -#define PT_LOPROC 0x70000000 -#define PT_HIPROC 0x7fffffff -#define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */ +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_LOOS 0x60000000 +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff +#define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */ /* ELF file types */ -#define ET_NONE 0 -#define ET_REL 1 -#define ET_EXEC 2 -#define ET_DYN 3 -#define ET_CORE 4 -#define ET_LOPROC 0xff00 -#define ET_HIPROC 0xffff +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff /* ELF machine types */ -#define EM_NONE 0 -#define EM_M32 1 -#define EM_SPARC 2 -#define EM_386 3 -#define EM_68K 4 -#define EM_88K 5 -#define EM_486 6 /* Not used in Linux at least */ -#define EM_860 7 -#define EM_MIPS 8 /* R3k, bigendian(?) */ -#define EM_MIPS_RS4_BE 10 /* R4k BE */ -#define EM_PARISC 15 -#define EM_SPARC32PLUS 18 -#define EM_PPC 20 -#define EM_PPC64 21 -#define EM_S390 22 -#define EM_SH 42 -#define EM_SPARCV9 43 /* v9 = SPARC64 */ -#define EM_H8_300H 47 -#define EM_H8S 48 -#define EM_IA_64 50 -#define EM_X86_64 62 -#define EM_CRIS 76 -#define EM_V850 87 -#define EM_ALPHA 0x9026 /* Interrim Alpha that stuck around */ -#define EM_CYGNUS_V850 0x9080 /* Old v850 ID used by Cygnus */ -#define EM_S390_OLD 0xA390 /* Obsolete interrim value for S/390 */ +#define EM_NONE 0 +#define EM_M32 1 +#define EM_SPARC 2 +#define EM_386 3 +#define EM_68K 4 +#define EM_88K 5 +#define EM_486 6 /* Not used in Linux at least */ +#define EM_860 7 +#define EM_MIPS 8 /* R3k, bigendian(?) */ +#define EM_MIPS_RS4_BE 10 /* R4k BE */ +#define EM_PARISC 15 +#define EM_SPARC32PLUS 18 +#define EM_PPC 20 +#define EM_PPC64 21 +#define EM_S390 22 +#define EM_SH 42 +#define EM_SPARCV9 43 /* v9 = SPARC64 */ +#define EM_H8_300H 47 +#define EM_H8S 48 +#define EM_IA_64 50 +#define EM_X86_64 62 +#define EM_CRIS 76 +#define EM_V850 87 +#define EM_ALPHA 0x9026 /* Interrim Alpha that stuck around */ +#define EM_CYGNUS_V850 0x9080 /* Old v850 ID used by Cygnus */ +#define EM_S390_OLD 0xA390 /* Obsolete interrim value for S/390 */ /* Dynamic type values */ -#define DT_NULL 0 -#define DT_NEEDED 1 -#define DT_PLTRELSZ 2 -#define DT_PLTGOT 3 -#define DT_HASH 4 -#define DT_STRTAB 5 -#define DT_SYMTAB 6 -#define DT_RELA 7 -#define DT_RELASZ 8 -#define DT_RELAENT 9 -#define DT_STRSZ 10 -#define DT_SYMENT 11 -#define DT_INIT 12 -#define DT_FINI 13 -#define DT_SONAME 14 -#define DT_RPATH 15 -#define DT_SYMBOLIC 16 -#define DT_REL 17 -#define DT_RELSZ 18 -#define DT_RELENT 19 -#define DT_PLTREL 20 -#define DT_DEBUG 21 -#define DT_TEXTREL 22 -#define DT_JMPREL 23 -#define DT_LOPROC 0x70000000 -#define DT_HIPROC 0x7fffffff +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff /* Auxilliary table entries */ -#define AT_NULL 0 /* end of vector */ -#define AT_IGNORE 1 /* entry should be ignored */ -#define AT_EXECFD 2 /* file descriptor of program */ -#define AT_PHDR 3 /* program headers for program */ -#define AT_PHENT 4 /* size of program header entry */ -#define AT_PHNUM 5 /* number of program headers */ -#define AT_PAGESZ 6 /* system page size */ -#define AT_BASE 7 /* base address of interpreter */ -#define AT_FLAGS 8 /* flags */ -#define AT_ENTRY 9 /* entry point of program */ -#define AT_NOTELF 10 /* program is not ELF */ -#define AT_UID 11 /* real uid */ -#define AT_EUID 12 /* effective uid */ -#define AT_GID 13 /* real gid */ -#define AT_EGID 14 /* effective gid */ -#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ -#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ -#define AT_CLKTCK 17 /* frequency at which times() increments */ +#define AT_NULL 0 /* end of vector */ +#define AT_IGNORE 1 /* entry should be ignored */ +#define AT_EXECFD 2 /* file descriptor of program */ +#define AT_PHDR 3 /* program headers for program */ +#define AT_PHENT 4 /* size of program header entry */ +#define AT_PHNUM 5 /* number of program headers */ +#define AT_PAGESZ 6 /* system page size */ +#define AT_BASE 7 /* base address of interpreter */ +#define AT_FLAGS 8 /* flags */ +#define AT_ENTRY 9 /* entry point of program */ +#define AT_NOTELF 10 /* program is not ELF */ +#define AT_UID 11 /* real uid */ +#define AT_EUID 12 /* effective uid */ +#define AT_GID 13 /* real gid */ +#define AT_EGID 14 /* effective gid */ +#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ +#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ +#define AT_CLKTCK 17 /* frequency at which times() increments */ /* 18..22 = ? */ -#define AT_SECURE 23 /* secure mode boolean */ +#define AT_SECURE 23 /* secure mode boolean */ /* Program header permission flags */ -#define PF_X 0x1 -#define PF_W 0x2 -#define PF_R 0x4 +#define PF_X 0x1 +#define PF_W 0x2 +#define PF_R 0x4 /* Section header types */ -#define SHT_NULL 0 -#define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_RELA 4 -#define SHT_HASH 5 -#define SHT_DYNAMIC 6 -#define SHT_NOTE 7 -#define SHT_NOBITS 8 -#define SHT_REL 9 -#define SHT_SHLIB 10 -#define SHT_DYNSYM 11 -#define SHT_NUM 12 -#define SHT_LOPROC 0x70000000 -#define SHT_HIPROC 0x7fffffff -#define SHT_LOUSER 0x80000000 -#define SHT_HIUSER 0xffffffff +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_NUM 12 +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0xffffffff /* Section header flags */ -#define SHF_WRITE (1 << 0) /* Writable */ -#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ -#define SHF_EXECINSTR (1 << 2) /* Executable */ -#define SHF_MERGE (1 << 4) /* Might be merged */ -#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ -#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ -#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ -#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling required */ -#define SHF_GROUP (1 << 9) /* Section is member of a group. */ -#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ +#define SHF_WRITE (1 << 0) /* Writable */ +#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ +#define SHF_EXECINSTR (1 << 2) /* Executable */ +#define SHF_MERGE (1 << 4) /* Might be merged */ +#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ +#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ +#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ +#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling required */ +#define SHF_GROUP (1 << 9) /* Section is member of a group */ +#define SHF_TLS (1 << 10) /* Section hold thread-local data */ /* Special section numbers */ -#define SHN_UNDEF 0 -#define SHN_LORESERVE 0xff00 -#define SHN_LOPROC 0xff00 -#define SHN_HIPROC 0xff1f -#define SHN_ABS 0xfff1 -#define SHN_COMMON 0xfff2 -#define SHN_HIRESERVE 0xffff +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_HIPROC 0xff1f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_HIRESERVE 0xffff /* Section align flag */ -#define SHA_ANY 1 /* No alignment constraint */ +#define SHA_ANY 1 /* No alignment constraint */ /* Lenght of magic at the start of a file */ -#define EI_NIDENT 16 +#define EI_NIDENT 16 /* Magic number constants... */ -#define EI_MAG0 0 /* e_ident[] indexes */ -#define EI_MAG1 1 -#define EI_MAG2 2 -#define EI_MAG3 3 -#define EI_CLASS 4 -#define EI_DATA 5 -#define EI_VERSION 6 -#define EI_OSABI 7 -#define EI_ABIVERSION 8 -#define EI_NINDENT 16 - -#define ELFMAG0 0x7f /* EI_MAG */ -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' -#define ELFMAG "\177ELF" -#define SELFMAG 4 - -#define ELFCLASSNONE 0 /* EI_CLASS */ -#define ELFCLASS32 1 -#define ELFCLASS64 2 -#define ELFCLASSNUM 3 - -#define ELFDATANONE 0 /* e_ident[EI_DATA] */ -#define ELFDATA2LSB 1 -#define ELFDATA2MSB 2 - -#define EV_NONE 0 /* e_version, EI_VERSION */ -#define EV_CURRENT 1 -#define EV_NUM 2 - -#define ELFOSABI_NONE 0 -#define ELFOSABI_LINUX 3 - -/* Legal values for ST_BIND subfield of st_info (symbol binding). */ -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* Weak symbol */ -#define STB_NUM 3 /* Number of defined types. */ -#define STB_LOOS 10 /* Start of OS-specific */ -#define STB_HIOS 12 /* End of OS-specific */ -#define STB_LOPROC 13 /* Start of processor-specific */ -#define STB_HIPROC 15 /* End of processor-specific */ +#define EI_MAG0 0 /* e_ident[] indexes */ +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_OSABI 7 +#define EI_ABIVERSION 8 +#define EI_NINDENT 16 + +#define ELFMAG0 0x7f /* EI_MAG */ +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define ELFCLASSNONE 0 /* EI_CLASS */ +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define ELFDATANONE 0 /* e_ident[EI_DATA] */ +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 + +#define EV_NONE 0 /* e_version, EI_VERSION */ +#define EV_CURRENT 1 +#define EV_NUM 2 + +#define ELFOSABI_NONE 0 +#define ELFOSABI_LINUX 3 + +/* Legal values for ST_BIND subfield of st_info (symbol binding) */ +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* Weak symbol */ +#define STB_NUM 3 /* Number of defined types */ +#define STB_LOOS 10 /* Start of OS-specific */ +#define STB_HIOS 12 /* End of OS-specific */ +#define STB_LOPROC 13 /* Start of processor-specific */ +#define STB_HIPROC 15 /* End of processor-specific */ /* Symbol types */ -#define STT_NOTYPE 0 /* Symbol type is unspecified */ -#define STT_OBJECT 1 /* Symbol is a data object */ -#define STT_FUNC 2 /* Symbol is a code object */ -#define STT_SECTION 3 /* Symbol associated with a section */ -#define STT_FILE 4 /* Symbol's name is file name */ -#define STT_COMMON 5 /* Symbol is a common data object */ -#define STT_TLS 6 /* Symbol is thread-local data object*/ -#define STT_NUM 7 /* Number of defined types. */ +#define STT_NOTYPE 0 /* Symbol type is unspecified */ +#define STT_OBJECT 1 /* Symbol is a data object */ +#define STT_FUNC 2 /* Symbol is a code object */ +#define STT_SECTION 3 /* Symbol associated with a section */ +#define STT_FILE 4 /* Symbol's name is file name */ +#define STT_COMMON 5 /* Symbol is a common data object */ +#define STT_TLS 6 /* Symbol is thread-local data object */ +#define STT_NUM 7 /* Number of defined types */ /* Symbol visibilities */ -#define STV_DEFAULT 0 /* Default symbol visibility rules */ -#define STV_INTERNAL 1 /* Processor specific hidden class */ -#define STV_HIDDEN 2 /* Sym unavailable in other modules */ -#define STV_PROTECTED 3 /* Not preemptible, not exported */ +#define STV_DEFAULT 0 /* Default symbol visibility rules */ +#define STV_INTERNAL 1 /* Processor specific hidden class */ +#define STV_HIDDEN 2 /* Sym unavailable in other modules */ +#define STV_PROTECTED 3 /* Not preemptible, not exported */ /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field */ -#define ELF32_ST_BIND(i) ((i) >> 4) -#define ELF32_ST_MKBIND(i) ((i) << 4) /* just a helper */ -#define ELF32_ST_TYPE(i) ((i) & 0xf) -#define ELF32_ST_INFO(b, i) (ELF32_ST_MKBIND(b) + ELF32_ST_TYPE(i)) +#define ELF32_ST_BIND(i) ((i) >> 4) +#define ELF32_ST_MKBIND(i) ((i) << 4) /* just a helper */ +#define ELF32_ST_TYPE(i) ((i) & 0xf) +#define ELF32_ST_INFO(b, i) (ELF32_ST_MKBIND(b) + ELF32_ST_TYPE(i)) -#define ELF64_ST_BIND(i) ELF32_ST_BIND(i) -#define ELF64_ST_MKBIND(i) ELF32_ST_MKBIND(i) -#define ELF64_ST_TYPE(i) ELF32_ST_TYPE(i) -#define ELF64_ST_INFO(b, i) ELF32_ST_INFO(b, i) +#define ELF64_ST_BIND(i) ELF32_ST_BIND(i) +#define ELF64_ST_MKBIND(i) ELF32_ST_MKBIND(i) +#define ELF64_ST_TYPE(i) ELF32_ST_TYPE(i) +#define ELF64_ST_INFO(b, i) ELF32_ST_INFO(b, i) /* * ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */ -typedef uint16_t Elf32_Half; -typedef int16_t Elf32_SHalf; -typedef uint32_t Elf32_Word; -typedef int32_t Elf32_Sword; -typedef uint64_t Elf32_Xword; -typedef int64_t Elf32_Sxword; +typedef uint16_t Elf32_Half; +typedef int16_t Elf32_SHalf; +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; -typedef uint32_t Elf32_Off; -typedef uint32_t Elf32_Addr; -typedef uint16_t Elf32_Section; +typedef uint32_t Elf32_Off; +typedef uint32_t Elf32_Addr; +typedef uint16_t Elf32_Section; -typedef uint16_t Elf64_Half; -typedef int16_t Elf64_SHalf; -typedef uint32_t Elf64_Word; -typedef int32_t Elf64_Sword; -typedef uint64_t Elf64_Xword; -typedef int64_t Elf64_Sxword; +typedef uint16_t Elf64_Half; +typedef int16_t Elf64_SHalf; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; -typedef uint64_t Elf64_Off; -typedef uint64_t Elf64_Addr; -typedef uint16_t Elf64_Section; +typedef uint64_t Elf64_Off; +typedef uint64_t Elf64_Addr; +typedef uint16_t Elf64_Section; /* * Dynamic header */ typedef struct elf32_dyn { - Elf32_Sword d_tag; - union { - Elf32_Sword d_val; - Elf32_Addr d_ptr; - } d_un; + Elf32_Sword d_tag; + union { + Elf32_Sword d_val; + Elf32_Addr d_ptr; + } d_un; } Elf32_Dyn; typedef struct elf64_dyn { - Elf64_Sxword d_tag; - union { - Elf64_Xword d_val; - Elf64_Addr d_ptr; - } d_un; + Elf64_Sxword d_tag; + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; } Elf64_Dyn; /* * Relocations */ -#define ELF32_R_SYM(x) ((x) >> 8) -#define ELF32_R_TYPE(x) ((x) & 0xff) -#define ELF32_R_INFO(s,t) (((Elf32_Word)(s) << 8) + ELF32_R_TYPE(t)) +#define ELF32_R_SYM(x) ((x) >> 8) +#define ELF32_R_TYPE(x) ((x) & 0xff) +#define ELF32_R_INFO(s,t) (((Elf32_Word)(s) << 8) + ELF32_R_TYPE(t)) typedef struct elf32_rel { - Elf32_Addr r_offset; - Elf32_Word r_info; + Elf32_Addr r_offset; + Elf32_Word r_info; } Elf32_Rel; typedef struct elf32_rela { - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; } Elf32_Rela; enum reloc32_type { - R_386_32 = 1, /* ordinary absolute relocation */ - R_386_PC32 = 2, /* PC-relative relocation */ - R_386_GOT32 = 3, /* an offset into GOT */ - R_386_PLT32 = 4, /* a PC-relative offset into PLT */ - R_386_COPY = 5, /* ??? */ - R_386_GLOB_DAT = 6, /* ??? */ - R_386_JUMP_SLOT = 7, /* ??? */ - R_386_RELATIVE = 8, /* ??? */ - R_386_GOTOFF = 9, /* an offset from GOT base */ - R_386_GOTPC = 10, /* a PC-relative offset _to_ GOT */ - R_386_TLS_TPOFF = 14, /* Offset in static TLS block */ - R_386_TLS_IE = 15, /* Address of GOT entry for static TLS block offset */ - /* These are GNU extensions, but useful */ - R_386_16 = 20, /* A 16-bit absolute relocation */ - R_386_PC16 = 21, /* A 16-bit PC-relative relocation */ - R_386_8 = 22, /* An 8-bit absolute relocation */ - R_386_PC8 = 23 /* An 8-bit PC-relative relocation */ + R_386_32 = 1, /* ordinary absolute relocation */ + R_386_PC32 = 2, /* PC-relative relocation */ + R_386_GOT32 = 3, /* an offset into GOT */ + R_386_PLT32 = 4, /* a PC-relative offset into PLT */ + R_386_COPY = 5, /* ??? */ + R_386_GLOB_DAT = 6, /* ??? */ + R_386_JUMP_SLOT = 7, /* ??? */ + R_386_RELATIVE = 8, /* ??? */ + R_386_GOTOFF = 9, /* an offset from GOT base */ + R_386_GOTPC = 10, /* a PC-relative offset _to_ GOT */ + R_386_TLS_TPOFF = 14, /* Offset in static TLS block */ + R_386_TLS_IE = 15, /* Address of GOT entry for static TLS block offset */ + /* These are GNU extensions, but useful */ + R_386_16 = 20, /* A 16-bit absolute relocation */ + R_386_PC16 = 21, /* A 16-bit PC-relative relocation */ + R_386_8 = 22, /* An 8-bit absolute relocation */ + R_386_PC8 = 23 /* An 8-bit PC-relative relocation */ }; -#define ELF64_R_SYM(x) ((x) >> 32) -#define ELF64_R_TYPE(x) ((x) & 0xffffffff) -#define ELF64_R_INFO(s,t) (((Elf64_Xword)(s) << 32) + ELF64_R_TYPE(t)) +#define ELF64_R_SYM(x) ((x) >> 32) +#define ELF64_R_TYPE(x) ((x) & 0xffffffff) +#define ELF64_R_INFO(s,t) (((Elf64_Xword)(s) << 32) + ELF64_R_TYPE(t)) typedef struct elf64_rel { - Elf64_Addr r_offset; - Elf64_Xword r_info; + Elf64_Addr r_offset; + Elf64_Xword r_info; } Elf64_Rel; typedef struct elf64_rela { - Elf64_Addr r_offset; - Elf64_Xword r_info; - Elf64_Sxword r_addend; + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; } Elf64_Rela; enum reloc64_type { - R_X86_64_NONE = 0, /* No reloc */ - R_X86_64_64 = 1, /* Direct 64 bit */ - R_X86_64_PC32 = 2, /* PC relative 32 bit signed */ - R_X86_64_GOT32 = 3, /* 32 bit GOT entry */ - R_X86_64_PLT32 = 4, /* 32 bit PLT address */ - R_X86_64_COPY = 5, /* Copy symbol at runtime */ - R_X86_64_GLOB_DAT = 6, /* Create GOT entry */ - R_X86_64_JUMP_SLOT = 7, /* Create PLT entry */ - R_X86_64_RELATIVE = 8, /* Adjust by program base */ - R_X86_64_GOTPCREL = 9, /* 32 bit signed PC relative offset to GOT */ - R_X86_64_32 = 10, /* Direct 32 bit zero extended */ - R_X86_64_32S = 11, /* Direct 32 bit sign extended */ - R_X86_64_16 = 12, /* Direct 16 bit zero extended */ - R_X86_64_PC16 = 13, /* 16 bit sign extended pc relative */ - R_X86_64_8 = 14, /* Direct 8 bit sign extended */ - R_X86_64_PC8 = 15, /* 8 bit sign extended pc relative */ - R_X86_64_DTPMOD64 = 16, /* ID of module containing symbol */ - R_X86_64_DTPOFF64 = 17, /* Offset in module's TLS block */ - R_X86_64_TPOFF64 = 18, /* Offset in initial TLS block */ - R_X86_64_TLSGD = 19, /* 32 bit signed PC relative offset to two GOT entries for GD symbol */ - R_X86_64_TLSLD = 20, /* 32 bit signed PC relative offset to two GOT entries for LD symbol */ - R_X86_64_DTPOFF32 = 21, /* Offset in TLS block */ - R_X86_64_GOTTPOFF = 22, /* 32 bit signed PC relative offset to GOT entry for IE symbol */ - R_X86_64_TPOFF32 = 23, /* Offset in initial TLS block */ - R_X86_64_PC64 = 24, /* word64 S + A - P */ - R_X86_64_GOTOFF64 = 25, /* word64 S + A - GOT */ - R_X86_64_GOTPC32 = 26, /* word32 GOT + A - P */ - R_X86_64_GOT64 = 27, /* word64 G + A */ - R_X86_64_GOTPCREL64 = 28, /* word64 G + GOT - P + A */ - R_X86_64_GOTPC64 = 29, /* word64 GOT - P + A */ - R_X86_64_GOTPLT64 = 30, /* word64 G + A */ - R_X86_64_PLTOFF64 = 31, /* word64 L - GOT + A */ - R_X86_64_SIZE32 = 32, /* word32 Z + A */ - R_X86_64_SIZE64 = 33, /* word64 Z + A */ - R_X86_64_GOTPC32_TLSDESC = 34, /* word32 */ - R_X86_64_TLSDESC_CALL = 35, /* none */ - R_X86_64_TLSDESC = 36 /* word64?2 */ + R_X86_64_NONE = 0, /* No reloc */ + R_X86_64_64 = 1, /* Direct 64 bit */ + R_X86_64_PC32 = 2, /* PC relative 32 bit signed */ + R_X86_64_GOT32 = 3, /* 32 bit GOT entry */ + R_X86_64_PLT32 = 4, /* 32 bit PLT address */ + R_X86_64_COPY = 5, /* Copy symbol at runtime */ + R_X86_64_GLOB_DAT = 6, /* Create GOT entry */ + R_X86_64_JUMP_SLOT = 7, /* Create PLT entry */ + R_X86_64_RELATIVE = 8, /* Adjust by program base */ + R_X86_64_GOTPCREL = 9, /* 32 bit signed PC relative offset to GOT */ + R_X86_64_32 = 10, /* Direct 32 bit zero extended */ + R_X86_64_32S = 11, /* Direct 32 bit sign extended */ + R_X86_64_16 = 12, /* Direct 16 bit zero extended */ + R_X86_64_PC16 = 13, /* 16 bit sign extended pc relative */ + R_X86_64_8 = 14, /* Direct 8 bit sign extended */ + R_X86_64_PC8 = 15, /* 8 bit sign extended pc relative */ + R_X86_64_DTPMOD64 = 16, /* ID of module containing symbol */ + R_X86_64_DTPOFF64 = 17, /* Offset in module's TLS block */ + R_X86_64_TPOFF64 = 18, /* Offset in initial TLS block */ + R_X86_64_TLSGD = 19, /* 32 bit signed PC relative offset to two GOT entries for GD symbol */ + R_X86_64_TLSLD = 20, /* 32 bit signed PC relative offset to two GOT entries for LD symbol */ + R_X86_64_DTPOFF32 = 21, /* Offset in TLS block */ + R_X86_64_GOTTPOFF = 22, /* 32 bit signed PC relative offset to GOT entry for IE symbol */ + R_X86_64_TPOFF32 = 23, /* Offset in initial TLS block */ + R_X86_64_PC64 = 24, /* word64 S + A - P */ + R_X86_64_GOTOFF64 = 25, /* word64 S + A - GOT */ + R_X86_64_GOTPC32 = 26, /* word32 GOT + A - P */ + R_X86_64_GOT64 = 27, /* word64 G + A */ + R_X86_64_GOTPCREL64 = 28, /* word64 G + GOT - P + A */ + R_X86_64_GOTPC64 = 29, /* word64 GOT - P + A */ + R_X86_64_GOTPLT64 = 30, /* word64 G + A */ + R_X86_64_PLTOFF64 = 31, /* word64 L - GOT + A */ + R_X86_64_SIZE32 = 32, /* word32 Z + A */ + R_X86_64_SIZE64 = 33, /* word64 Z + A */ + R_X86_64_GOTPC32_TLSDESC= 34, /* word32 */ + R_X86_64_TLSDESC_CALL = 35, /* none */ + R_X86_64_TLSDESC = 36 /* word64?2 */ }; /* @@ -410,21 +410,21 @@ enum reloc64_type { */ typedef struct elf32_sym { - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Half st_shndx; + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; } Elf32_Sym; typedef struct elf64_sym { - Elf64_Word st_name; - unsigned char st_info; - unsigned char st_other; - Elf64_Half st_shndx; - Elf64_Addr st_value; - Elf64_Xword st_size; + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Half st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; } Elf64_Sym; /* @@ -432,37 +432,37 @@ typedef struct elf64_sym { */ typedef struct elf32_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; } Elf32_Ehdr; typedef struct elf64_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf64_Half e_type; - Elf64_Half e_machine; - Elf64_Word e_version; - Elf64_Addr e_entry; - Elf64_Off e_phoff; - Elf64_Off e_shoff; - Elf64_Word e_flags; - Elf64_Half e_ehsize; - Elf64_Half e_phentsize; - Elf64_Half e_phnum; - Elf64_Half e_shentsize; - Elf64_Half e_shnum; - Elf64_Half e_shstrndx; + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; } Elf64_Ehdr; /* @@ -470,25 +470,25 @@ typedef struct elf64_hdr { */ typedef struct elf32_phdr { - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; } Elf32_Phdr; typedef struct elf64_phdr { - Elf64_Word p_type; - Elf64_Word p_flags; - Elf64_Off p_offset; - Elf64_Addr p_vaddr; - Elf64_Addr p_paddr; - Elf64_Xword p_filesz; - Elf64_Xword p_memsz; - Elf64_Xword p_align; + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; } Elf64_Phdr; /* @@ -496,44 +496,44 @@ typedef struct elf64_phdr { */ typedef struct elf32_shdr { - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; } Elf32_Shdr; typedef struct elf64_shdr { - Elf64_Word sh_name; - Elf64_Word sh_type; - Elf64_Xword sh_flags; - Elf64_Addr sh_addr; - Elf64_Off sh_offset; - Elf64_Xword sh_size; - Elf64_Word sh_link; - Elf64_Word sh_info; - Elf64_Xword sh_addralign; - Elf64_Xword sh_entsize; + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; } Elf64_Shdr; /* * Note header */ typedef struct elf32_note { - Elf32_Word n_namesz; /* Name size */ - Elf32_Word n_descsz; /* Content size */ - Elf32_Word n_type; /* Content type */ + Elf32_Word n_namesz; /* Name size */ + Elf32_Word n_descsz; /* Content size */ + Elf32_Word n_type; /* Content type */ } Elf32_Nhdr; typedef struct elf64_note { - Elf64_Word n_namesz; /* Name size */ - Elf64_Word n_descsz; /* Content size */ - Elf64_Word n_type; /* Content type */ + Elf64_Word n_namesz; /* Name size */ + Elf64_Word n_descsz; /* Content size */ + Elf64_Word n_type; /* Content type */ } Elf64_Nhdr; #endif /* OUTPUT_ELF_H */ |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-28 20:54:16
|
Commit-ID: 29a829948701805e6c9a6d0fe174f20260284a64 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=29a829948701805e6c9a6d0fe174f20260284a64 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 28 Oct 2018 13:54:15 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 28 Oct 2018 23:51:18 +0300 dwarf: Update header and drop redundant space Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/dwarf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/output/dwarf.h b/output/dwarf.h index 26ca0b2..f846b2b 100644 --- a/output/dwarf.h +++ b/output/dwarf.h @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2009 The NASM Authors - All Rights Reserved + * Copyright 1996-2018 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * @@ -606,7 +606,7 @@ enum dwarf_call_frame { DW_CFA_def_cfa_register = 0x0d, DW_CFA_def_cfa_offset = 0x0e, /* DWARF 3 */ - DW_CFA_def_cfa_expression = 0x0f, + DW_CFA_def_cfa_expression = 0x0f, DW_CFA_expression = 0x10, DW_CFA_offset_extended_sf = 0x11, DW_CFA_def_cfa_sf = 0x12, |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-28 20:54:16
|
Commit-ID: fa13a138ea493fed22c16f8b89af494b3449bee1 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=fa13a138ea493fed22c16f8b89af494b3449bee1 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 28 Oct 2018 15:30:59 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 28 Oct 2018 23:51:38 +0300 stabs: Convert style and add comments Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/stabs.h | 188 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 97 insertions(+), 91 deletions(-) diff --git a/output/stabs.h b/output/stabs.h index 57f15cf..d40a572 100644 --- a/output/stabs.h +++ b/output/stabs.h @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2010 The NASM Authors - All Rights Reserved + * Copyright 1996-2018 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * @@ -42,103 +42,109 @@ /* offsets */ enum stab_offsets { - STAB_strdxoff = 0, - STAB_typeoff = 4, - STAB_otheroff = 5, - STAB_descoff = 6, - STAB_valoff = 8, - STAB_stabsize = 12 + STAB_strdxoff = 0, + STAB_typeoff = 4, + STAB_otheroff = 5, + STAB_descoff = 6, + STAB_valoff = 8, + STAB_stabsize = 12 }; /* stab/non-stab types */ enum stab_types { - N_UNDF = 0x00, - N_ABS = 0x02, - N_ABS_EXT = 0x03, - N_TEXT = 0x04, - N_TEXT_EXT = 0x05, - N_DATA = 0x06, - N_DATA_EXT = 0x07, - N_BSS = 0x08, - N_BSS_EXT = 0x09, - N_FN_SEQ = 0x0c, - N_INDR = 0x0a, - N_COMM = 0x12, - N_SETA = 0x14, - N_SETA_EXT = 0x15, - N_SETT = 0x16, - N_SETT_EXT = 0x17, - N_SETD = 0x18, - N_SETD_EXT = 0x19, - N_SETB = 0x1a, - N_SETB_EXT = 0x1b, - N_SETV = 0x1c, - N_SETV_EXT = 0x1d, - N_WARNING = 0x1e, - N_FN = 0x1f, - N_GSYM = 0x20, - N_FNAME = 0x22, - N_FUN = 0x24, - N_STSYM = 0x26, - N_LCSYM = 0x28, - N_MAIN = 0x2a, - N_ROSYM = 0x2c, - N_BNSYM = 0x2e, - N_PC = 0x30, - N_NSYMS = 0x32, - N_NOMAP = 0x34, - N_OBJ = 0x38, - N_OPT = 0x3c, - N_RSYM = 0x40, - N_M2C = 0x42, - N_SLINE = 0x44, - N_DSLINE = 0x46, - N_BSLINE = 0x48, - N_BROWS = 0x48, - N_DEFD = 0x4a, - N_FLINE = 0x4c, - N_ENSYM = 0x4e, - N_EHDECL = 0x50, - N_MOD2 = 0x50, - N_CATCH = 0x54, - N_SSYM = 0x60, - N_ENDM = 0x62, - N_SO = 0x64, /* ID for main source file */ - N_OSO = 0x66, - N_ALIAS = 0x6c, - N_LSYM = 0x80, - N_BINCL = 0x82, - N_SOL = 0x84, /* ID for sub-source file */ - N_PSYM = 0xa0, - N_EINCL = 0xa2, - N_ENTRY = 0xa4, - N_LBRAC = 0xc0, - N_EXCL = 0xc2, - N_SCOPE = 0xc4, - N_PATCH = 0xd0, - N_RBRAC = 0xe0, - N_BCOMM = 0xe2, - N_ECOMM = 0xe4, - N_ECOML = 0xe8, - N_WITH = 0xea, - N_NBTEXT = 0xf0, - N_NBDATA = 0xf2, - N_NBBSS = 0xf4, - N_NBSTS = 0xf6, - N_NBLCS = 0xf8, - N_LENG = 0xfe + N_UNDF = 0x00, /* Undefined symbol */ + N_EXT = 0x01, /* External symbol */ + N_ABS = 0x02, /* Absolute symbol */ + N_ABS_EXT = 0x03, /* Absolute external symbol */ + N_TEXT = 0x04, /* Symbol in text segment */ + N_TEXT_EXT = 0x05, /* Symbol in external text segment */ + N_DATA = 0x06, + N_DATA_EXT = 0x07, + N_BSS = 0x08, + N_BSS_EXT = 0x09, + N_INDR = 0x0a, + N_FN_SEQ = 0x0c, /* N_FN from Sequent compilers */ + N_WEAKU = 0x0d, /* Weak undefined symbol */ + N_WEAKA = 0x0e, /* Weak absolute symbl */ + N_WEAKT = 0x0f, /* Weak text symbol */ + N_WEAKD = 0x10, /* Weak data symbol */ + N_WEAKB = 0x11, /* Weak bss symbol */ + N_COMM = 0x12, /* Common symbol */ + N_SETA = 0x14, /* Absolute set element symbol */ + N_SETA_EXT = 0x15, + N_SETT = 0x16, /* Text set element symbol */ + N_SETT_EXT = 0x17, + N_SETD = 0x18, /* Data set element symbol */ + N_SETD_EXT = 0x19, + N_SETB = 0x1a, /* BSS set element symbol */ + N_SETB_EXT = 0x1b, + N_SETV = 0x1c, /* Pointer to set vector in data area */ + N_SETV_EXT = 0x1d, + N_WARNING = 0x1e, /* Warning symbol */ + N_FN = 0x1f, /* Filename of .o file */ + N_GSYM = 0x20, /* Global variable */ + N_FNAME = 0x22, /* Function name for BSD Fortran */ + N_FUN = 0x24, /* Function name or text segment variable for C */ + N_STSYM = 0x26, /* Data-segment variable with internal linkage */ + N_LCSYM = 0x28, /* BSS-segment variable with internal linkage */ + N_MAIN = 0x2a, /* Name of main routine */ + N_ROSYM = 0x2c, /* Read-only data symbols */ + N_BNSYM = 0x2e, /* The beginning of a relocatable function block */ + N_PC = 0x30, /* Global symbol in Pascal */ + N_NSYMS = 0x32, /* Number of symbols */ + N_NOMAP = 0x34, /* No DST map for sym */ + N_OBJ = 0x38, /* Like N_SO, but for the object file */ + N_OPT = 0x3c, /* Options for the debugger */ + N_RSYM = 0x40, /* Register variable */ + N_M2C = 0x42, /* Modula-2 compilation unit */ + N_SLINE = 0x44, /* Line number in text segment */ + N_DSLINE = 0x46, /* Line number in data segment */ + N_BSLINE = 0x48, /* Line number in bss segment */ + N_BROWS = 0x48, /* Sun's source-code browser stabs */ + N_DEFD = 0x4a, /* GNU Modula-2 definition module dependency */ + N_FLINE = 0x4c, /* Function start/body/end line numbers */ + N_ENSYM = 0x4e, /* This tells the end of a relocatable function */ + N_EHDECL = 0x50, /* GNU C++ exception variable */ + N_MOD2 = 0x50, /* Modula2 info "for imc" */ + N_CATCH = 0x54, /* GNU C++ `catch' clause */ + N_SSYM = 0x60, /* Structure or union element */ + N_ENDM = 0x62, /* Last stab emitted for module */ + N_SO = 0x64, /* ID for main source file */ + N_OSO = 0x66, /* Apple: This is the stab that associated the .o file */ + N_ALIAS = 0x6c, /* SunPro F77: Name of alias */ + N_LSYM = 0x80, /* Automatic variable in the stack */ + N_BINCL = 0x82, /* Beginning of an include file */ + N_SOL = 0x84, /* ID for sub-source file */ + N_PSYM = 0xa0, /* Parameter variable */ + N_EINCL = 0xa2, /* End of an include file */ + N_ENTRY = 0xa4, /* Alternate entry point */ + N_LBRAC = 0xc0, /* Beginning of lexical block */ + N_EXCL = 0xc2, /* Place holder for deleted include file */ + N_SCOPE = 0xc4, /* Modula-2 scope information */ + N_PATCH = 0xd0, /* Solaris2: Patch Run Time Checker */ + N_RBRAC = 0xe0, /* End of a lexical block */ + N_BCOMM = 0xe2, /* Begin named common block */ + N_ECOMM = 0xe4, /* End named common block */ + N_ECOML = 0xe8, /* Member of a common block */ + N_WITH = 0xea, /* Solaris2: Pascal "with" statement */ + N_NBTEXT = 0xf0, + N_NBDATA = 0xf2, + N_NBBSS = 0xf4, + N_NBSTS = 0xf6, + N_NBLCS = 0xf8, + N_LENG = 0xfe /* Second symbol entry whih a length-value for the preceding entry */ }; enum stab_source_file { - N_SO_AS = 0x01, - N_SO_C = 0x02, - N_SO_ANSI_C = 0x03, - N_SO_CC = 0x04, - N_SO_FORTRAN = 0x05, - N_SO_PASCAL = 0x06, - N_SO_FORTRAN90 = 0x07, - N_SO_OBJC = 0x32, - N_SO_OBJCPLUS = 0x33 + N_SO_AS = 0x01, + N_SO_C = 0x02, + N_SO_ANSI_C = 0x03, + N_SO_CC = 0x04, + N_SO_FORTRAN = 0x05, + N_SO_PASCAL = 0x06, + N_SO_FORTRAN90 = 0x07, + N_SO_OBJC = 0x32, + N_SO_OBJCPLUS = 0x33 }; #endif /* STABS_H_ */ |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-28 20:54:15
|
Commit-ID: 218971e5ac1f01169fa20795fbf768e68b2aec14 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=218971e5ac1f01169fa20795fbf768e68b2aec14 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 28 Oct 2018 13:52:54 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 28 Oct 2018 23:51:10 +0300 dwarf: Update definitions for v4 and v5 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/dwarf.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/output/dwarf.h b/output/dwarf.h index e672819..26ca0b2 100644 --- a/output/dwarf.h +++ b/output/dwarf.h @@ -90,6 +90,7 @@ enum dwarf_tag { DW_TAG_variant_part = 0x33, DW_TAG_variable = 0x34, DW_TAG_volatile_type = 0x35, + /* DWARF 3 */ DW_TAG_dwarf_procedure = 0x36, DW_TAG_restrict_type = 0x37, DW_TAG_interface_type = 0x38, @@ -100,6 +101,12 @@ enum dwarf_tag { DW_TAG_imported_unit = 0x3d, DW_TAG_condition = 0x3f, DW_TAG_shared_type = 0x40, + /* DWARF 4 */ + DW_TAG_type_unit = 0x41, + DW_TAG_rvalue_reference_type = 0x42, + DW_TAG_template_alias = 0x43, + /* DWARF 5 */ + DW_TAG_atomic_type = 0x47, DW_TAG_lo_user = 0x4080, DW_TAG_hi_user = 0xffff @@ -131,7 +138,12 @@ enum dwarf_form { DW_FORM_ref4 = 0x13, DW_FORM_ref8 = 0x14, DW_FORM_ref_udata = 0x15, - DW_FORM_indirect = 0x16 + DW_FORM_indirect = 0x16, + /* DWARF 4 */ + DW_FORM_sec_offset = 0x17, + DW_FORM_exprloc = 0x18, + DW_FORM_flag_present = 0x19, + DW_FORM_ref_sig8 = 0x20 }; enum dwarf_attribute { @@ -194,6 +206,7 @@ enum dwarf_attribute { DW_AT_variable_parameter = 0x4b, DW_AT_virtuality = 0x4c, DW_AT_vtable_elem_location = 0x4d, + /* DWARF 3 */ DW_AT_allocated = 0x4e, DW_AT_associated = 0x4f, DW_AT_data_location = 0x50, @@ -221,6 +234,15 @@ enum dwarf_attribute { DW_AT_elemental = 0x66, DW_AT_pure = 0x67, DW_AT_recursive = 0x68, + /* DWARF 4 */ + DW_AT_signature = 0x69, + DW_AT_main_subprogram = 0x6a, + DW_AT_data_bit_offset = 0x6b, + DW_AT_const_expr = 0x6c, + DW_AT_enum_class = 0x6d, + DW_AT_linkage_name = 0x6e, + /* DWARF 5 */ + DW_AT_noreturn = 0x87, DW_AT_lo_user = 0x2000, DW_AT_hi_user = 0x3fff @@ -372,6 +394,7 @@ enum dwarf_op { DW_OP_deref_size = 0x94, DW_OP_xderef_size = 0x95, DW_OP_nop = 0x96, + /* DWARF 3 */ DW_OP_push_object_address = 0x97, DW_OP_call2 = 0x98, DW_OP_call4 = 0x99, @@ -379,6 +402,9 @@ enum dwarf_op { DW_OP_form_tls_address = 0x9b, DW_OP_call_frame_cfa = 0x9c, DW_OP_bit_piece = 0x9d, + /* DWARF 4 */ + DW_OP_implicit_value = 0x9e, + DW_OP_stack_value = 0x9f, DW_OP_lo_user = 0xe0, DW_OP_hi_user = 0xff @@ -393,6 +419,7 @@ enum dwarf_base_type { DW_ATE_signed_char = 0x06, DW_ATE_unsigned = 0x07, DW_ATE_unsigned_char = 0x08, + /* DWARF 3 */ DW_ATE_imaginary_float = 0x09, DW_ATE_packed_decimal = 0x0a, DW_ATE_numeric_string = 0x0b, @@ -400,6 +427,8 @@ enum dwarf_base_type { DW_ATE_signed_fixed = 0x0d, DW_ATE_unsigned_fixed = 0x0e, DW_ATE_decimal_float = 0x0f, + /* DWARF 4 */ + DW_ATE_UTF = 0x10, DW_ATE_lo_user = 0x80, DW_ATE_hi_user = 0xff @@ -576,6 +605,7 @@ enum dwarf_call_frame { DW_CFA_def_cfa = 0x0c, DW_CFA_def_cfa_register = 0x0d, DW_CFA_def_cfa_offset = 0x0e, + /* DWARF 3 */ DW_CFA_def_cfa_expression = 0x0f, DW_CFA_expression = 0x10, DW_CFA_offset_extended_sf = 0x11, |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-28 17:42:15
|
Commit-ID: 661f723d39e03ca6eb05d7376a43ca33db478354 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=661f723d39e03ca6eb05d7376a43ca33db478354 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 28 Oct 2018 20:39:34 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 28 Oct 2018 20:39:34 +0300 preproc: Fix out of bound access on malformed input A fuzzer revealed a problem in preproc code. https://bugzilla.nasm.us/show_bug.cgi?id=3392521 Reported-by: ganshuitao <gan...@gm...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index 0174c9a..9034135 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -4002,7 +4002,7 @@ static Token *expand_mmac_params(Token * tline) thead = NULL; while (tline) { - if (tline->type == TOK_PREPROC_ID && + if (tline->type == TOK_PREPROC_ID && tline->text && tline->text[0] && (((tline->text[1] == '+' || tline->text[1] == '-') && tline->text[2]) || (tline->text[1] >= '0' && tline->text[1] <= '9') || tline->text[1] == '%')) { |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-25 22:33:17
|
Commit-ID: fe2e1d469ac163a076e5cbc760cc3f4f051ee615 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=fe2e1d469ac163a076e5cbc760cc3f4f051ee615 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Thu, 25 Oct 2018 23:40:42 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Fri, 26 Oct 2018 01:29:52 +0300 doc: Clarify %include search directory semantics Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- doc/changes.src | 2 +- doc/nasmdoc.src | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/doc/changes.src b/doc/changes.src index 7da6662..efed8a1 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -9,7 +9,7 @@ since 2007. \S{cl-2.14} Version 2.14 -\b Fixed \c{-I} option handling when ending slash is not present. +\b Changed \c{-I} option semantics by adding a trailing path separator unconditionally. \b Fixed null dereference in corrupted invalid single line macros. diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index fb140e9..782914d 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -628,16 +628,12 @@ library}, for example, by typing (As usual, a space between \c{-i} and the path name is allowed, and optional). -NASM, in the interests of complete source-code portability, does not -understand the file naming conventions of the OS it is running on; -the string you provide as an argument to the \c{-i} option will be -prepended exactly as written to the name of the include file. -Therefore the trailing backslash in the above example is necessary. -Under Unix, a trailing forward slash is similarly necessary. - -(You can use this to your advantage, if you're really \i{perverse}, -by noting that the option \c{-ifoo} will cause \c{%include "bar.i"} -to search for the file \c{foobar.i}...) +Prior NASM 2.14 a path provided in the option has been considered as +a verbatim copy and providing a path separator been up to a caller. +One could implicitly concatenate a search path together with a filename. +Still this was rather a trick than something useful. Now the trailing +path separator is made to always present, thus \c{-ifoo} will be +considered as the \c{-ifoo/} directory. If you want to define a \e{standard} \i{include search path}, similar to \c{/usr/include} on Unix systems, you should place one or |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-24 21:15:17
|
Commit-ID: c7922f95af706ff508c8e652f1f2dcb70c3f4a4c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c7922f95af706ff508c8e652f1f2dcb70c3f4a4c Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 5 May 2018 12:54:34 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Thu, 25 Oct 2018 00:14:08 +0300 output: macho -- Rename sect_attribs to macho_known_section_attr To unify with macho_known_section in namings. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outmacho.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index 0ce69ef..769aac0 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -755,7 +755,7 @@ static const struct macho_known_section { }; /* Section type or attribute directives */ -static const struct sect_attribs { +static const struct macho_known_section_attr { const char *name; uint32_t flags; } sect_attribs[] = { @@ -792,11 +792,11 @@ lookup_known_section(const char *name, bool by_sectname) static int32_t macho_section(char *name, int pass, int *bits) { const struct macho_known_section *known_section; + const struct macho_known_section_attr *sa; char *sectionAttributes; struct section *s; const char *section, *segment; uint32_t flags; - const struct sect_attribs *sa; char *currentAttribute; char *comma; |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-24 21:15:14
|
Commit-ID: 458c04eca47af88c096148d9a8825a3abc91d677 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=458c04eca47af88c096148d9a8825a3abc91d677 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Thu, 25 Oct 2018 00:13:54 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Thu, 25 Oct 2018 00:13:54 +0300 output: macho -- Use lookup_known_section helper To make it similar to elf code. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outmacho.c | 59 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index cb2c90a..0ce69ef 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -738,12 +738,12 @@ static void macho_output(int32_t secto, const void *data, #define NO_TYPE S_NASM_TYPE_MASK /* Translation table from traditional Unix section names to Mach-O */ -static const struct sectmap { +static const struct macho_known_section { const char *nasmsect; const char *segname; const char *sectname; const uint32_t flags; -} sectmap[] = { +} known_sections[] = { { ".text", "__TEXT", "__text", S_CODE }, { ".data", "__DATA", "__data", S_REGULAR }, { ".rodata", "__DATA", "__const", S_REGULAR }, @@ -752,7 +752,6 @@ static const struct sectmap { { ".debug_info", "__DWARF", "__debug_info", S_ATTR_DEBUG }, { ".debug_line", "__DWARF", "__debug_line", S_ATTR_DEBUG }, { ".debug_str", "__DWARF", "__debug_str", S_ATTR_DEBUG }, - { NULL, NULL, NULL, 0 } }; /* Section type or attribute directives */ @@ -772,10 +771,28 @@ static const struct sect_attribs { { NULL, 0 } }; +static const struct macho_known_section * +lookup_known_section(const char *name, bool by_sectname) +{ + size_t i; + + if (name && name[0]) { + for (i = 0; i < ARRAY_SIZE(known_sections); i++) { + const char *p = by_sectname ? + known_sections[i].sectname : + known_sections[i].nasmsect; + if (!strcmp(name, p)) + return &known_sections[i]; + } + } + + return NULL; +} + static int32_t macho_section(char *name, int pass, int *bits) { + const struct macho_known_section *known_section; char *sectionAttributes; - const struct sectmap *sm; struct section *s; const char *section, *segment; uint32_t flags; @@ -822,29 +839,23 @@ static int32_t macho_section(char *name, int pass, int *bits) nasm_error(ERR_NONFATAL, "section name %s too long\n", section); } - if (!strcmp(section, "__text")) { - flags = S_REGULAR | S_ATTR_SOME_INSTRUCTIONS | - S_ATTR_PURE_INSTRUCTIONS; - } else if (!strcmp(section, "__bss")) { - flags = S_ZEROFILL; - } else { - flags = S_REGULAR; - } + known_section = lookup_known_section(section, true); + if (known_section) + flags = known_section->flags; + else + flags = S_REGULAR; } else { - for (sm = sectmap; sm->nasmsect != NULL; ++sm) { - /* make lookup into section name translation table */ - if (!strcmp(name, sm->nasmsect)) { - segment = sm->segname; - section = sm->sectname; - flags = sm->flags; - goto found; - } - } - nasm_error(ERR_NONFATAL, "unknown section name\n"); - return NO_SEG; + known_section = lookup_known_section(name, false); + if (!known_section) { + nasm_error(ERR_NONFATAL, "unknown section name %s\n", name); + return NO_SEG; + } + + segment = known_section->segname; + section = known_section->sectname; + flags = known_section->flags; } - found: /* try to find section with that name, or create it */ s = find_or_add_section(segment, section); new_seg = is_new_section(s); |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-24 19:51:13
|
Commit-ID: fbc92bdb666e6c40d1970faa920b8a28858add07 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=fbc92bdb666e6c40d1970faa920b8a28858add07 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Thu, 3 May 2018 01:39:29 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 24 Oct 2018 22:49:03 +0300 output: macho -- Beautify known sections Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outmacho.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index 21e02e2..cb2c90a 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -734,41 +734,41 @@ static void macho_output(int32_t secto, const void *data, } } +#define S_CODE (S_REGULAR | S_ATTR_SOME_INSTRUCTIONS | S_ATTR_PURE_INSTRUCTIONS) +#define NO_TYPE S_NASM_TYPE_MASK + /* Translation table from traditional Unix section names to Mach-O */ static const struct sectmap { - const char *nasmsect; - const char *segname; - const char *sectname; - const uint32_t flags; + const char *nasmsect; + const char *segname; + const char *sectname; + const uint32_t flags; } sectmap[] = { - {".text", "__TEXT", "__text", - S_REGULAR|S_ATTR_SOME_INSTRUCTIONS|S_ATTR_PURE_INSTRUCTIONS}, - {".data", "__DATA", "__data", S_REGULAR}, - {".rodata", "__DATA", "__const", S_REGULAR}, - {".bss", "__DATA", "__bss", S_ZEROFILL}, - {".debug_abbrev", "__DWARF", "__debug_abbrev", S_ATTR_DEBUG}, - {".debug_info", "__DWARF", "__debug_info", S_ATTR_DEBUG}, - {".debug_line", "__DWARF", "__debug_line", S_ATTR_DEBUG}, - {".debug_str", "__DWARF", "__debug_str", S_ATTR_DEBUG}, - {NULL, NULL, NULL, 0} + { ".text", "__TEXT", "__text", S_CODE }, + { ".data", "__DATA", "__data", S_REGULAR }, + { ".rodata", "__DATA", "__const", S_REGULAR }, + { ".bss", "__DATA", "__bss", S_ZEROFILL }, + { ".debug_abbrev", "__DWARF", "__debug_abbrev", S_ATTR_DEBUG }, + { ".debug_info", "__DWARF", "__debug_info", S_ATTR_DEBUG }, + { ".debug_line", "__DWARF", "__debug_line", S_ATTR_DEBUG }, + { ".debug_str", "__DWARF", "__debug_str", S_ATTR_DEBUG }, + { NULL, NULL, NULL, 0 } }; -#define NO_TYPE S_NASM_TYPE_MASK - /* Section type or attribute directives */ static const struct sect_attribs { - const char *name; - uint32_t flags; + const char *name; + uint32_t flags; } sect_attribs[] = { - { "data", S_REGULAR }, - { "code", S_REGULAR|S_ATTR_SOME_INSTRUCTIONS|S_ATTR_PURE_INSTRUCTIONS }, - { "mixed", S_REGULAR|S_ATTR_SOME_INSTRUCTIONS }, - { "bss", S_ZEROFILL }, - { "zerofill", S_ZEROFILL }, - { "no_dead_strip", NO_TYPE|S_ATTR_NO_DEAD_STRIP }, - { "live_support", NO_TYPE|S_ATTR_LIVE_SUPPORT }, - { "strip_static_syms", NO_TYPE|S_ATTR_STRIP_STATIC_SYMS }, - { "debug", NO_TYPE|S_ATTR_DEBUG }, + { "data", S_REGULAR }, + { "code", S_CODE }, + { "mixed", S_REGULAR | S_ATTR_SOME_INSTRUCTIONS }, + { "bss", S_ZEROFILL }, + { "zerofill", S_ZEROFILL }, + { "no_dead_strip", NO_TYPE | S_ATTR_NO_DEAD_STRIP }, + { "live_support", NO_TYPE | S_ATTR_LIVE_SUPPORT }, + { "strip_static_syms", NO_TYPE | S_ATTR_STRIP_STATIC_SYMS }, + { "debug", NO_TYPE | S_ATTR_DEBUG }, { NULL, 0 } }; |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-24 19:45:17
|
Commit-ID: 68de05ca7933790b6de03178df3a2f79f6f13b6a Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=68de05ca7933790b6de03178df3a2f79f6f13b6a Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 2 May 2018 17:55:39 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 24 Oct 2018 22:31:07 +0300 output: macho -- Move constants into the header Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/macho.h | 282 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ output/outmacho.c | 76 +-------------- 2 files changed, 283 insertions(+), 75 deletions(-) diff --git a/output/macho.h b/output/macho.h new file mode 100644 index 0000000..538c531 --- /dev/null +++ b/output/macho.h @@ -0,0 +1,282 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 1996-2018 The NASM Authors - All Rights Reserved + * See the file AUTHORS included with the NASM distribution for + * the specific copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following + * conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ----------------------------------------------------------------------- */ + +#ifndef OUTPUT_MACHO_H +#define OUTPUT_MACHO_H + +#include "compiler.h" + +/* Magics */ +#define MH_MAGIC 0xfeedface +#define MH_MAGIC_64 0xfeedfacf + +/* File types */ +#define MH_OBJECT 0x1 + +/* CPUs */ +#define CPU_ARCH_MASK 0xff000000 +#define CPU_ARCH_ABI64 0x01000000 +#define CPU_TYPE_X86 7 +#define CPU_TYPE_I386 CPU_TYPE_X86 +#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64) + +#define CPU_SUBTYPE_MASK 0xff000000 +#define CPU_SUBTYPE_I386_ALL 3 + +/* Header flags */ +#define MH_SUBSECTIONS_VIA_SYMBOLS 0x00002000 + +/* Load commands */ +#define LC_SEGMENT 0x1 +#define LC_SEGMENT_64 0x19 +#define LC_SYMTAB 0x2 + +/* Symbol type bits */ +#define N_STAB 0xe0 +#define N_PEXT 0x10 +#define N_TYPE 0x0e +#define N_EXT 0x01 + +/* To mask with N_TYPE */ +#define N_UNDF 0x00 +#define N_ABS 0x02 +#define N_INDR 0x0a +#define N_PBUD 0x0c +#define N_SECT 0x0e + +/* Section ordinals */ +#define NO_SECT 0x00 +#define MAX_SECT 0xff + +/* Section bits */ +#define SECTION_TYPE 0x000000ff +#define SECTION_ATTRIBUTES 0xffffff00 +#define SECTION_ATTRIBUTES_USR 0xff000000 +#define SECTION_ATTRIBUTES_SYS 0x00ffff00 + +#define S_REGULAR 0x00 +#define S_ZEROFILL 0x01 +#define S_CSTRING_LITERALS 0x02 +#define S_4BYTE_LITERALS 0x03 +#define S_8BYTE_LITERALS 0x04 +#define S_LITERAL_POINTERS 0x05 +#define S_NON_LAZY_SYMBOL_POINTERS 0x06 +#define S_LAZY_SYMBOL_POINTERS 0x07 +#define S_SYMBOL_STUBS 0x08 +#define S_MOD_INIT_FUNC_POINTERS 0x09 +#define S_MOD_TERM_FUNC_POINTERS 0x0a +#define S_COALESCED 0x0b +#define S_GB_ZEROFILL 0x0c +#define S_INTERPOSING 0x0d +#define S_16BYTE_LITERALS 0x0e +#define S_DTRACE_DOF 0x0f +#define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10 +#define S_THREAD_LOCAL_REGULAR 0x11 +#define S_THREAD_LOCAL_ZEROFILL 0x12 +#define S_THREAD_LOCAL_VARIABLES 0x13 +#define S_THREAD_LOCAL_VARIABLE_POINTERS 0x14 +#define S_THREAD_LOCAL_INIT_FUNCTION_POINTERS 0x15 + +#define S_ATTR_PURE_INSTRUCTIONS 0x80000000 +#define S_ATTR_NO_TOC 0x40000000 +#define S_ATTR_STRIP_STATIC_SYMS 0x20000000 +#define S_ATTR_NO_DEAD_STRIP 0x10000000 +#define S_ATTR_LIVE_SUPPORT 0x08000000 +#define S_ATTR_SELF_MODIFYING_CODE 0x04000000 +#define S_ATTR_DEBUG 0x02000000 + +#define S_ATTR_SOME_INSTRUCTIONS 0x00000400 +#define S_ATTR_EXT_RELOC 0x00000200 +#define S_ATTR_LOC_RELOC 0x00000100 +#define INDIRECT_SYMBOL_LOCAL 0x80000000 +#define INDIRECT_SYMBOL_ABS 0x40000000 + +/* Relocation info type */ +#define GENERIC_RELOC_VANILLA 0 +#define GENERIC_RELOC_PAIR 1 +#define GENERIC_RELOC_SECTDIFF 2 +#define GENERIC_RELOC_PB_LA_PTR 3 +#define GENERIC_RELOC_LOCAL_SECTDIFF 4 +#define GENERIC_RELOC_TLV 5 + +#define X86_64_RELOC_UNSIGNED 0 +#define X86_64_RELOC_SIGNED 1 +#define X86_64_RELOC_BRANCH 2 +#define X86_64_RELOC_GOT_LOAD 3 +#define X86_64_RELOC_GOT 4 +#define X86_64_RELOC_SUBTRACTOR 5 +#define X86_64_RELOC_SIGNED_1 6 +#define X86_64_RELOC_SIGNED_2 7 +#define X86_64_RELOC_SIGNED_4 8 +#define X86_64_RELOC_TLV 9 + +/* Relocation info */ +#define R_ABS 0 +#define R_SCATTERED 0x80000000 + +/* VM permission constants */ +#define VM_PROT_NONE 0x00 +#define VM_PROT_READ 0x01 +#define VM_PROT_WRITE 0x02 +#define VM_PROT_EXECUTE 0x04 + +typedef struct { + uint32_t magic; + uint32_t cputype; + uint32_t cpusubtype; + uint32_t filetype; + uint32_t ncmds; + uint32_t sizeofcmds; + uint32_t flags; +} macho_header_t; + +typedef struct { + uint32_t magic; + uint32_t cputype; + uint32_t cpusubtype; + uint32_t filetype; + uint32_t ncmds; + uint32_t sizeofcmds; + uint32_t flags; + uint32_t reserved; +} macho_header_64_t; + +typedef struct { + uint32_t cmd; + uint32_t cmdsize; +} macho_load_command_t; + +typedef struct { + uint32_t cmd; + uint32_t cmdsize; + char segname[16]; + uint32_t vmaddr; + uint32_t vmsize; + uint32_t fileoff; + uint32_t filesize; + uint32_t maxprot; + uint32_t initprot; + uint32_t nsects; + uint32_t flags; +} macho_segment_command_t; + +typedef struct { + uint32_t cmd; + uint32_t cmdsize; + char segname[16]; + uint64_t vmaddr; + uint64_t vmsize; + uint64_t fileoff; + uint64_t filesize; + uint32_t maxprot; + uint32_t initprot; + uint32_t nsects; + uint32_t flags; +} macho_segment_command_64_t; + +typedef struct { + char sectname[16]; + char segname[16]; + uint32_t addr; + uint32_t size; + uint32_t offset; + uint32_t align; + uint32_t reloff; + uint32_t nreloc; + uint32_t flags; + uint32_t reserved1; + uint32_t reserved2; +} macho_section_t; + +typedef struct { + char sectname[16]; + char segname[16]; + uint64_t addr; + uint64_t size; + uint32_t offset; + uint32_t align; + uint32_t reloff; + uint32_t nreloc; + uint32_t flags; + uint32_t reserved1; + uint32_t reserved2; + uint32_t reserved3; +} macho_section_64_t; + +typedef struct { + uint32_t cmd; + uint32_t cmdsize; + uint32_t symoff; + uint32_t nsyms; + uint32_t stroff; + uint32_t strsize; +} macho_symtab_command_t; + +typedef struct { + int32_t r_address; + union { + struct { + uint32_t r_symbolnum: 24, + r_pcrel: 1, + r_length: 2, + r_extern: 1, + r_type: 4; + } s; + uint32_t r_raw; + } u; +} macho_relocation_info_t; + +typedef struct nlist_base { + uint32_t n_strx; + uint8_t n_type; + uint8_t n_sect; + uint16_t n_desc; +} macho_nlist_base_t; + +typedef struct nlist { + uint32_t n_strx; + uint8_t n_type; + uint8_t n_sect; + int16_t n_desc; + uint32_t n_value; +} macho_nlist_t; + +typedef struct { + uint32_t n_strx; + uint8_t n_type; + uint8_t n_sect; + uint16_t n_desc; + uint64_t n_value; +} macho_nlist_64_t; + +#endif /* OUTPUT_MACHO_H */ diff --git a/output/outmacho.c b/output/outmacho.c index f5673c8..21e02e2 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -56,6 +56,7 @@ #include "outlib.h" #include "ver.h" #include "dwarf.h" +#include "macho.h" #if defined(OF_MACHO) || defined(OF_MACHO64) @@ -72,45 +73,8 @@ #define MACHO_SECTCMD64_SIZE 80 #define MACHO_NLIST64_SIZE 16 -/* Mach-O file header values */ -#define MH_MAGIC 0xfeedface -#define MH_MAGIC_64 0xfeedfacf -#define CPU_TYPE_I386 7 /* x86 platform */ -#define CPU_TYPE_X86_64 0x01000007 /* x86-64 platform */ -#define CPU_SUBTYPE_I386_ALL 3 /* all-x86 compatible */ -#define MH_OBJECT 0x1 /* object file */ - -/* Mach-O header flags */ -#define MH_SUBSECTIONS_VIA_SYMBOLS 0x2000 - -/* Mach-O load commands */ -#define LC_SEGMENT 0x1 /* 32-bit segment load cmd */ -#define LC_SEGMENT_64 0x19 /* 64-bit segment load cmd */ -#define LC_SYMTAB 0x2 /* symbol table load command */ - /* Mach-O relocations numbers */ -/* Generic relocs, used by i386 Mach-O */ -#define GENERIC_RELOC_VANILLA 0 /* Generic relocation */ -#define GENERIC_RELOC_TLV 5 /* Thread local */ - -#define X86_64_RELOC_UNSIGNED 0 /* Absolute address */ -#define X86_64_RELOC_SIGNED 1 /* Signed 32-bit disp */ -#define X86_64_RELOC_BRANCH 2 /* CALL/JMP with 32-bit disp */ -#define X86_64_RELOC_GOT_LOAD 3 /* MOVQ of GOT entry */ -#define X86_64_RELOC_GOT 4 /* Different GOT entry */ -#define X86_64_RELOC_SUBTRACTOR 5 /* Subtracting two symbols */ -#define X86_64_RELOC_SIGNED_1 6 /* SIGNED with -1 addend */ -#define X86_64_RELOC_SIGNED_2 7 /* SIGNED with -2 addend */ -#define X86_64_RELOC_SIGNED_4 8 /* SIGNED with -4 addend */ -#define X86_64_RELOC_TLV 9 /* Thread local */ - -/* Mach-O VM permission constants */ -#define VM_PROT_NONE (0x00) -#define VM_PROT_READ (0x01) -#define VM_PROT_WRITE (0x02) -#define VM_PROT_EXECUTE (0x04) - #define VM_PROT_DEFAULT (VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE) #define VM_PROT_ALL (VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE) @@ -175,25 +139,6 @@ struct section { uint32_t extreloc; /* external relocations */ }; -#define SECTION_TYPE 0x000000ff /* section type mask */ - -#define S_REGULAR (0x0) /* standard section */ -#define S_ZEROFILL (0x1) /* zerofill, in-memory only */ - -#define SECTION_ATTRIBUTES_SYS 0x00ffff00 /* system setable attributes */ -#define S_ATTR_SOME_INSTRUCTIONS 0x00000400 /* section contains some - machine instructions */ -#define S_ATTR_EXT_RELOC 0x00000200 /* section has external relocation entries */ -#define S_ATTR_LOC_RELOC 0x00000100 /* section has local relocation entries */ -#define S_ATTR_DEBUG 0x02000000 -#define S_ATTR_SELF_MODIFYING_CODE 0x04000000 -#define S_ATTR_LIVE_SUPPORT 0x08000000 -#define S_ATTR_NO_DEAD_STRIP 0x10000000 /* no dead stripping */ -#define S_ATTR_STRIP_STATIC_SYMS 0x20000000 -#define S_ATTR_NO_TOC 0x40000000 -#define S_ATTR_PURE_INSTRUCTIONS 0x80000000 /* section uses pure machine instructions */ -#define S_ATTR_DEBUG 0x02000000 /* debug section */ - #define S_NASM_TYPE_MASK 0x800004ff /* we consider these bits "section type" */ /* fake section for absolute symbols, *not* part of the section linked list */ @@ -214,10 +159,6 @@ struct reloc { type:4; /* reloc type */ }; -#define R_ABS 0 /* absolute relocation */ -#define R_SCATTERED 0x80000000 /* reloc entry is scattered if - ** highest bit == 1 */ - struct symbol { /* nasm internal data */ struct rbtree symv[2]; /* All/global symbol rbtrees; "key" contains the @@ -234,23 +175,8 @@ struct symbol { uint16_t desc; /* for stab debugging, 0 for us */ }; -/* symbol type bits */ -#define N_EXT 0x01 /* global or external symbol */ -#define N_PEXT 0x10 /* private external symbol */ - -#define N_UNDF 0x0 /* undefined symbol | n_sect == */ -#define N_ABS 0x2 /* absolute symbol | NO_SECT */ -#define N_SECT 0xe /* defined symbol, n_sect holds - ** section number */ - -#define N_TYPE 0x0e /* type bit mask */ - #define DEFAULT_SECTION_ALIGNMENT 0 /* byte (i.e. no) alignment */ -/* special section number values */ -#define NO_SECT 0 /* no section, invalid */ -#define MAX_SECT 255 /* maximum number of sections */ - static struct section *sects, **sectstail, **sectstab; static struct symbol *syms, **symstail; static uint32_t nsyms; |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-21 12:48:15
|
Commit-ID: 0e7f5111515df03925383d94a85e4383f635606c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=0e7f5111515df03925383d94a85e4383f635606c Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 21 Oct 2018 15:45:02 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 21 Oct 2018 15:45:02 +0300 doc: Update changes Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- doc/changes.src | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changes.src b/doc/changes.src index b2f092c..7da6662 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -9,6 +9,8 @@ since 2007. \S{cl-2.14} Version 2.14 +\b Fixed \c{-I} option handling when ending slash is not present. + \b Fixed null dereference in corrupted invalid single line macros. \b Fixed division by zero which may happen if source code is malformed. |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-17 20:42:15
|
Commit-ID: 1f620b8e8445d9f61a309f536e670e49adb16542 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=1f620b8e8445d9f61a309f536e670e49adb16542 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 17 Oct 2018 23:40:50 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 17 Oct 2018 23:40:50 +0300 test: nasm-t -- Add alonesym-obj testcase Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- {test => travis/test}/alonesym-obj.asm | 3 --- travis/test/alonesym-obj.json | 18 ++++++++++++++++++ travis/test/alonesym-obj.obj.t | Bin 0 -> 1163 bytes 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test/alonesym-obj.asm b/travis/test/alonesym-obj.asm similarity index 95% copy from test/alonesym-obj.asm copy to travis/test/alonesym-obj.asm index 8db3a2c..6be4d5d 100644 --- a/test/alonesym-obj.asm +++ b/travis/test/alonesym-obj.asm @@ -1,6 +1,3 @@ -;Testname=unoptimized; Arguments=-O0 -fobj -oalonesym-obj.obj; Files=stdout stderr alonesym-obj.obj -;Testname=optimized; Arguments=-Ox -fobj -oalonesym-obj.obj; Files=stdout stderr alonesym-obj.obj - section DOS32DATA align=16 public use32 FLAT class=DOS32DATA global sym0000 diff --git a/travis/test/alonesym-obj.json b/travis/test/alonesym-obj.json new file mode 100644 index 0000000..cdb2ea2 --- /dev/null +++ b/travis/test/alonesym-obj.json @@ -0,0 +1,18 @@ +[ + { + "description": "Check global symbols in OBJ output (-Ox)", + "id": "alonesym-obj", + "format": "obj", + "source": "alonesym-obj.asm", + "option": "-Ox", + "target": [ + { "output": "alonesym-obj.obj" } + ] + }, + { + "description": "Check global symbols in OBJ output (-O0)", + "ref": "alonesym-obj", + "option": "-O0", + "update": false + } +] diff --git a/travis/test/alonesym-obj.obj.t b/travis/test/alonesym-obj.obj.t new file mode 100644 index 0000000..480d599 Binary files /dev/null and b/travis/test/alonesym-obj.obj.t differ |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-17 20:42:12
|
Commit-ID: dcf3937e92bcdc6181ab7e53680402a6b884f29f Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=dcf3937e92bcdc6181ab7e53680402a6b884f29f Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 17 Oct 2018 23:36:43 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 17 Oct 2018 23:36:43 +0300 test: nasm-t -- Use new syntax for update Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- travis/nasm-t.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/travis/nasm-t.py b/travis/nasm-t.py index 714eccc..b7d8534 100755 --- a/travis/nasm-t.py +++ b/travis/nasm-t.py @@ -349,15 +349,10 @@ def test_update(desc): if 'update' in desc and desc['update'] == 'false': return test_skip(desc['_test-name'], "No output provided") - pnasm = exec_nasm(desc) + pnasm, stdout, stderr = exec_nasm(desc) if pnasm == None: return False - stdout = pnasm.stdout.read() - stderr = pnasm.stderr.read() - pnasm.stdout.close() - pnasm.stderr.close() - for t in desc['target']: if 'output' in t: output = desc['_base-dir'] + os.sep + t['output'] |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-17 18:44:23
|
Commit-ID: 2e1bf723a9e3da2adf9aaee25200b06887cc2aa8 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=2e1bf723a9e3da2adf9aaee25200b06887cc2aa8 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 25 Apr 2018 00:34:00 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 17 Oct 2018 21:40:14 +0300 test: travis -- Add some of converted tests Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- travis/test/_file_.asm | 4 + travis/test/_file_.bin.t | Bin 0 -> 56 bytes travis/test/_file_.json | 8 + travis/test/_version.json | 7 + travis/test/_version.stdout | 1 + travis/test/a32offs.asm | 7 + travis/test/a32offs.bin.t | 1 + travis/test/a32offs.json | 18 + {test => travis/test}/absolute.asm | 3 - travis/test/absolute.bin.t | 1 + travis/test/absolute.json | 8 + {test => travis/test}/addr64x.asm | 3 - travis/test/addr64x.bin.t | Bin 0 -> 56 bytes travis/test/addr64x.json | 25 + travis/test/addr64x.stderr | 4 + travis/test/align13.asm | 16 + travis/test/align13.json | 25 + travis/test/align13.stderr | 4 + test/tmap.nas => travis/test/tmap.asm | 2889 +++++++++++++++++---------------- travis/test/tmap.json | 10 + travis/test/tmap.o.stderr | 1 + travis/test/tmap.o.t | Bin 0 -> 6752 bytes {test => travis/test}/weirdpaste.asm | 3 - travis/test/weirdpaste.bin.t | Bin 0 -> 42 bytes travis/test/weirdpaste.i.t | 30 + travis/test/weirdpaste.json | 18 + 26 files changed, 1633 insertions(+), 1453 deletions(-) diff --git a/travis/test/_file_.asm b/travis/test/_file_.asm new file mode 100644 index 0000000..e349e2c --- /dev/null +++ b/travis/test/_file_.asm @@ -0,0 +1,4 @@ + db __FILE__, `\r\n` + db __FILE__, `\r\n` + dw __LINE__ + dw __LINE__ diff --git a/travis/test/_file_.bin.t b/travis/test/_file_.bin.t new file mode 100644 index 0000000..2ba4aa2 Binary files /dev/null and b/travis/test/_file_.bin.t differ diff --git a/travis/test/_file_.json b/travis/test/_file_.json new file mode 100644 index 0000000..cf16822 --- /dev/null +++ b/travis/test/_file_.json @@ -0,0 +1,8 @@ +{ + "description": "Check the __FILE__ preprocessor directive", + "format": "bin", + "source": "_file_.asm", + "target": [ + { "output": "_file_.bin" } + ] +} diff --git a/travis/test/_version.json b/travis/test/_version.json new file mode 100644 index 0000000..f84a8c8 --- /dev/null +++ b/travis/test/_version.json @@ -0,0 +1,7 @@ +{ + "description": "Check the NASM version", + "target": [ + { "option": "-v", "stdout": "_version.stdout" } + ], + "error": "over" +} diff --git a/travis/test/_version.stdout b/travis/test/_version.stdout new file mode 100644 index 0000000..935c7d0 --- /dev/null +++ b/travis/test/_version.stdout @@ -0,0 +1 @@ +NASM version 2.14rc0 compiled on Apr 25 2018 diff --git a/travis/test/a32offs.asm b/travis/test/a32offs.asm new file mode 100644 index 0000000..82df66c --- /dev/null +++ b/travis/test/a32offs.asm @@ -0,0 +1,7 @@ + bits 16 +foo: a32 loop foo +bar: loop bar, ecx + + bits 32 +baz: a16 loop baz +qux: loop qux, cx diff --git a/travis/test/a32offs.bin.t b/travis/test/a32offs.bin.t new file mode 100644 index 0000000..44d38d2 --- /dev/null +++ b/travis/test/a32offs.bin.t @@ -0,0 +1 @@ +gggg \ No newline at end of file diff --git a/travis/test/a32offs.json b/travis/test/a32offs.json new file mode 100644 index 0000000..cb8ac1f --- /dev/null +++ b/travis/test/a32offs.json @@ -0,0 +1,18 @@ +[ + { + "description": "Check a16/a32 address prefix (-Ox)", + "id": "a32offs", + "format": "bin", + "source": "a32offs.asm", + "option": "-Ox", + "target": [ + { "output": "a32offs.bin" } + ] + }, + { + "description": "Check a16/a32 address prefix (-O0)", + "ref": "a32offs", + "option": "-O0", + "update": false + } +] diff --git a/test/absolute.asm b/travis/test/absolute.asm similarity index 71% copy from test/absolute.asm copy to travis/test/absolute.asm index 969a85e..38532ec 100644 --- a/test/absolute.asm +++ b/travis/test/absolute.asm @@ -1,7 +1,4 @@ -;Testname=bin; Arguments=-fbin -oabsolute.bin; Files=stdout stderr absolute.bin -%ifmacro org org 7c00h -%endif init_foo: jmp init_bar nop diff --git a/travis/test/absolute.bin.t b/travis/test/absolute.bin.t new file mode 100644 index 0000000..b132e69 --- /dev/null +++ b/travis/test/absolute.bin.t @@ -0,0 +1 @@ + |f| \ No newline at end of file diff --git a/travis/test/absolute.json b/travis/test/absolute.json new file mode 100644 index 0000000..6a6a946 --- /dev/null +++ b/travis/test/absolute.json @@ -0,0 +1,8 @@ +{ + "description": "Check absolute addressing", + "format": "bin", + "source": "absolute.asm", + "target": [ + { "output": "absolute.bin" } + ] +} diff --git a/test/addr64x.asm b/travis/test/addr64x.asm similarity index 55% copy from test/addr64x.asm copy to travis/test/addr64x.asm index c7a64f5..1fbec45 100644 --- a/test/addr64x.asm +++ b/travis/test/addr64x.asm @@ -1,6 +1,3 @@ -;Testname=O0; Arguments=-O0 -fbin -oaddr64.bin; Files=stdout stderr addr64.bin -;Testname=O1; Arguments=-O1 -fbin -oaddr64.bin; Files=stdout stderr addr64.bin -;Testname=Ox; Arguments=-Ox -fbin -oaddr64.bin; Files=stdout stderr addr64.bin bits 64 mov rdx,[rax] mov eax,[byte rsp+0x01] diff --git a/travis/test/addr64x.bin.t b/travis/test/addr64x.bin.t new file mode 100644 index 0000000..b9166a2 Binary files /dev/null and b/travis/test/addr64x.bin.t differ diff --git a/travis/test/addr64x.json b/travis/test/addr64x.json new file mode 100644 index 0000000..e642ce6 --- /dev/null +++ b/travis/test/addr64x.json @@ -0,0 +1,25 @@ +[ + { + "description": "Check 64-bit addressing (-Ox)", + "id": "addr64x", + "format": "bin", + "source": "addr64x.asm", + "option": "-Ox", + "target": [ + { "output": "addr64x.bin" }, + { "stderr": "addr64x.stderr" } + ] + }, + { + "description": "Check 64-bit addressing (-O1)", + "ref": "addr64x", + "option": "-O1", + "update": "false" + }, + { + "description": "Check 64-bit addressing (-O0)", + "ref": "addr64x", + "option": "-O0", + "update": "false" + } +] diff --git a/travis/test/addr64x.stderr b/travis/test/addr64x.stderr new file mode 100644 index 0000000..5d1b318 --- /dev/null +++ b/travis/test/addr64x.stderr @@ -0,0 +1,4 @@ +./travis/test/addr64x.asm:5: warning: byte data exceeds bounds [-w+number-overflow] +./travis/test/addr64x.asm:5: warning: byte data exceeds bounds [-w+number-overflow] +./travis/test/addr64x.asm:6: warning: byte data exceeds bounds [-w+number-overflow] +./travis/test/addr64x.asm:6: warning: byte data exceeds bounds [-w+number-overflow] diff --git a/travis/test/align13.asm b/travis/test/align13.asm new file mode 100644 index 0000000..556373f --- /dev/null +++ b/travis/test/align13.asm @@ -0,0 +1,16 @@ +; Test of non-power-of-2 alignment + + bits 32 + + inc eax + inc eax + align 13 + inc eax + inc eax + align 13 + inc eax + inc eax + align 13 + align 13 ;should do nothing + inc eax + inc eax diff --git a/travis/test/align13.json b/travis/test/align13.json new file mode 100644 index 0000000..7375023 --- /dev/null +++ b/travis/test/align13.json @@ -0,0 +1,25 @@ +[ + { + "description": "Test of non-power-of-2 alignment (-Ox)", + "id": "align13", + "format": "bin", + "source": "align13.asm", + "option": "-Ox -o align13.bin", + "target": [ + { "stderr": "align13.stderr" } + ], + "error": "expected" + }, + { + "description": "Test of non-power-of-2 alignment (-O1)", + "ref": "align13", + "option": "-O1 -o align13.bin", + "update": "false" + }, + { + "description": "Test of non-power-of-2 alignment (-O0)", + "ref": "align13", + "option": "-O0 -o align13.bin", + "update": "false" + } +] diff --git a/travis/test/align13.stderr b/travis/test/align13.stderr new file mode 100644 index 0000000..31d6e31 --- /dev/null +++ b/travis/test/align13.stderr @@ -0,0 +1,4 @@ +./travis/test/align13.asm:7: error: segment alignment `13' is not power of two +./travis/test/align13.asm:10: error: segment alignment `13' is not power of two +./travis/test/align13.asm:13: error: segment alignment `13' is not power of two +./travis/test/align13.asm:14: error: segment alignment `13' is not power of two diff --git a/test/tmap.nas b/travis/test/tmap.asm similarity index 96% copy from test/tmap.nas copy to travis/test/tmap.asm index 51b477f..a634e1b 100644 --- a/test/tmap.nas +++ b/travis/test/tmap.asm @@ -1,1447 +1,1448 @@ -;; NASM note: this file abuses the section flags in such a way that -;; NASM 0.98.37 broke when this was compiled with: -;; nasm -o tmap.o -f elf -DLINUX tmap.nas - -;;----------------------------------------------------------------------------- -;; -;; $Id$ -;; -;; Copyright (C) 1998-2000 by DooM Legacy Team. -;; -;; This program 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 2 -;; of the License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but 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. -;; -;; +;; NASM note: this file abuses the section flags in such a way that +;; NASM 0.98.37 broke when this was compiled with: +;; nasm -o tmap.o -f elf -DLINUX tmap.nas + +;;----------------------------------------------------------------------------- +;; +;; $Id$ +;; +;; Copyright (C) 1998-2000 by DooM Legacy Team. +;; +;; This program 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 2 +;; of the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but 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. +;; +;; ;; $Log$ ;; Revision 1.2 2003/09/10 23:33:38 hpa ;; Use the version of tmap.nas that actually caused problems -;; -;; Revision 1.10 2001/02/24 13:35:21 bpereira -;; no message -;; -;; Revision 1.9 2001/02/10 15:24:19 hurdler -;; Apply Rob's patch for Linux version -;; -;; Revision 1.8 2000/11/12 09:48:15 bpereira -;; no message -;; -;; Revision 1.7 2000/11/06 20:52:16 bpereira -;; no message -;; -;; Revision 1.6 2000/11/03 11:48:40 hurdler -;; Fix compiling problem under win32 with 3D-Floors and FragglScript (to verify!) -;; -;; Revision 1.5 2000/11/03 03:27:17 stroggonmeth -;; Again with the bug fixing... -;; -;; Revision 1.4 2000/11/02 17:50:10 stroggonmeth -;; Big 3Dfloors & FraggleScript commit!! -;; -;; Revision 1.3 2000/04/24 20:24:38 bpereira -;; no message -;; -;; Revision 1.2 2000/02/27 00:42:11 hurdler -;; fix CR+LF problem -;; -;; Revision 1.1.1.1 2000/02/22 20:32:32 hurdler -;; Initial import into CVS (v1.29 pr3) -;; -;; -;; DESCRIPTION: -;; assembler optimised rendering code for software mode -;; draw floor spans, and wall columns. -;; -;;----------------------------------------------------------------------------- - - -[BITS 32] - -%ifdef LINUX -%macro cextern 1 -[extern %1] -%endmacro - -%macro cglobal 1 -[global %1] -%endmacro - -%define CODE_SEG .data -%else -%macro cextern 1 -%define %1 _%1 -[extern %1] -%endmacro - -%macro cglobal 1 -%define %1 _%1 -[global %1] -%endmacro - -%define CODE_SEG .text -%endif - - -;; externs -;; columns -cextern dc_x -cextern dc_yl -cextern dc_yh -cextern ylookup -cextern columnofs -cextern dc_source -cextern dc_texturemid -cextern dc_iscale -cextern centery -cextern dc_colormap -cextern dc_transmap -cextern colormaps - -;; spans -cextern ds_x1 -cextern ds_x2 -cextern ds_y -cextern ds_xfrac -cextern ds_yfrac -cextern ds_xstep -cextern ds_ystep -cextern ds_source -cextern ds_colormap -;cextern ds_textureheight - -; polygon edge rasterizer -cextern prastertab - - -;;---------------------------------------------------------------------- -;; -;; R_DrawColumn -;; -;; New optimised version 10-01-1998 by D.Fabrice and P.Boris -;; TO DO: optimise it much farther... should take at most 3 cycles/pix -;; once it's fixed, add code to patch the offsets so that it -;; works in every screen width. -;; -;;---------------------------------------------------------------------- - -[SECTION .data] - -;;.align 4 -loopcount dd 0 -pixelcount dd 0 -tystep dd 0 - -[SECTION CODE_SEG write] - -;---------------------------------------------------------------------------- -;fixed_t FixedMul (fixed_t a, fixed_t b) -;---------------------------------------------------------------------------- -cglobal FixedMul -; align 16 -FixedMul: - mov eax,[esp+4] - imul dword [esp+8] - shrd eax,edx,16 - ret - -;---------------------------------------------------------------------------- -;fixed_t FixedDiv2 (fixed_t a, fixed_t b); -;---------------------------------------------------------------------------- -cglobal FixedDiv2 -; align 16 -FixedDiv2: - mov eax,[esp+4] - mov edx,eax ;; these two instructions allow the next - sar edx,31 ;; two to pair, on the Pentium processor. - shld edx,eax,16 - sal eax,16 - idiv dword [esp+8] - ret - -;---------------------------------------------------------------------------- -; void ASM_PatchRowBytes (int rowbytes); -;---------------------------------------------------------------------------- -cglobal ASM_PatchRowBytes -; align 16 -ASM_PatchRowBytes: - mov eax,[esp+4] - mov [p1+2],eax - mov [p2+2],eax - mov [p3+2],eax - mov [p4+2],eax - mov [p5+2],eax - mov [p6+2],eax - mov [p7+2],eax - mov [p8+2],eax - mov [p9+2],eax - mov [pa+2],eax - mov [pb+2],eax - mov [pc+2],eax - mov [pd+2],eax - mov [pe+2],eax - mov [pf+2],eax - mov [pg+2],eax - mov [ph+2],eax - mov [pi+2],eax - mov [pj+2],eax - mov [pk+2],eax - mov [pl+2],eax - mov [pm+2],eax - mov [pn+2],eax - mov [po+2],eax - mov [pp+2],eax - mov [pq+2],eax - add eax,eax - mov [q1+2],eax - mov [q2+2],eax - mov [q3+2],eax - mov [q4+2],eax - mov [q5+2],eax - mov [q6+2],eax - mov [q7+2],eax - mov [q8+2],eax - ret - - -;---------------------------------------------------------------------------- -; 8bpp column drawer -;---------------------------------------------------------------------------- - -cglobal R_DrawColumn_8 -; align 16 -R_DrawColumn_8: - push ebp ;; preserve caller's stack frame pointer - push esi ;; preserve register variables - push edi - push ebx -;; -;; dest = ylookup[dc_yl] + columnofs[dc_x]; -;; - mov ebp,[dc_yl] - mov ebx,ebp - mov edi,[ylookup+ebx*4] - mov ebx,[dc_x] - add edi,[columnofs+ebx*4] ;; edi = dest -;; -;; pixelcount = yh - yl + 1 -;; - mov eax,[dc_yh] - inc eax - sub eax,ebp ;; pixel count - mov [pixelcount],eax ;; save for final pixel - jle near vdone ;; nothing to scale -;; -;; frac = dc_texturemid - (centery-dc_yl)*fracstep; -;; - mov ecx,[dc_iscale] ;; fracstep - mov eax,[centery] - sub eax,ebp - imul eax,ecx - mov edx,[dc_texturemid] - sub edx,eax - mov ebx,edx - shr ebx,16 ;; frac int. - and ebx,0x7f - shl edx,16 ;; y frac up - - mov ebp,ecx - shl ebp,16 ;; fracstep f. up - shr ecx,16 ;; fracstep i. ->cl - and cl,0x7f - mov esi,[dc_source] -;; -;; lets rock :) ! -;; - mov eax,[pixelcount] - mov dh,al - shr eax,2 - mov ch,al ;; quad count - mov eax,[dc_colormap] - test dh,0x3 - je near v4quadloop -;; -;; do un-even pixel -;; - test dh,0x1 - je two_uneven - - mov al,[esi+ebx] ;; prep un-even loops - add edx,ebp ;; ypos f += ystep f - adc bl,cl ;; ypos i += ystep i - mov dl,[eax] ;; colormap texel - and bl,0x7f ;; mask 0-127 texture index - mov [edi],dl ;; output pixel -p1: add edi,0x12345678 -;; -;; do two non-quad-aligned pixels -;; -two_uneven: - test dh,0x2 - je f3 - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp ;; ypos f += ystep f - adc bl,cl ;; ypos i += ystep i - mov dl,[eax] ;; colormap texel - and bl,0x7f ;; mask 0-127 texture index - mov [edi],dl ;; output pixel - mov al,[esi+ebx] - add edx,ebp ;; fetch source texel - adc bl,cl ;; ypos f += ystep f - mov dl,[eax] ;; ypos i += ystep i - and bl,0x7f ;; colormap texel -p2: add edi,0x12345678 ;; mask 0-127 texture index - mov [edi],dl -p3: add edi,0x12345678 ;; output pixel -;; -;; test if there was at least 4 pixels -;; -f3: - test ch,0xff ;; test quad count - je near vdone -;; -;; ebp : ystep frac. upper 16 bits -;; edx : y frac. upper 16 bits -;; ebx : y i. lower 7 bits, masked for index -;; ecx : ch = counter, cl = y step i. -;; eax : colormap aligned 256 -;; esi : source texture column -;; edi : dest screen -;; -v4quadloop: - mov dh,0x7f ;; prep mask -align 4 -vquadloop: - mov al,[esi+ebx] ;; prep loop - add edx,ebp ;; ypos f += ystep f - adc bl,cl ;; ypos i += ystep i - mov dl,[eax] ;; colormap texel - mov [edi],dl ;; output pixel - and bl,0x7f ;; mask 0-127 texture index - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp - adc bl,cl -p4: add edi,0x12345678 - mov dl,[eax] - and bl,0x7f - mov [edi],dl - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp - adc bl,cl -p5: add edi,0x12345678 - mov dl,[eax] - and bl,0x7f - mov [edi],dl - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp - adc bl,cl -p6: add edi,0x12345678 - mov dl,[eax] - and bl,0x7f - mov [edi],dl - -p7: add edi,0x12345678 - - dec ch - jne vquadloop - -vdone: - pop ebx ;; restore register variables - pop edi - pop esi - pop ebp ;; restore caller's stack frame pointer - ret - -;;---------------------------------------------------------------------- -;;13-02-98: -;; R_DrawSkyColumn : same as R_DrawColumn but: -;; -;; - wrap around 256 instead of 127. -;; this is needed because we have a higher texture for mouselook, -;; we need at least 200 lines for the sky. -;; -;; NOTE: the sky should never wrap, so it could use a faster method. -;; for the moment, we'll still use a wrapping method... -;; -;; IT S JUST A QUICK CUT N PASTE, WAS NOT OPTIMISED AS IT SHOULD BE !!! -;; -;;---------------------------------------------------------------------- - -cglobal R_DrawSkyColumn_8 -; align 16 -R_DrawSkyColumn_8: - push ebp - push esi - push edi - push ebx -;; -;; dest = ylookup[dc_yl] + columnofs[dc_x]; -;; - mov ebp,[dc_yl] - mov ebx,ebp - mov edi,[ylookup+ebx*4] - mov ebx,[dc_x] - add edi,[columnofs+ebx*4] ;; edi = dest -;; -;; pixelcount = yh - yl + 1 -;; - mov eax,[dc_yh] - inc eax - sub eax,ebp ;; pixel count - mov [pixelcount],eax ;; save for final pixel - jle near vskydone ;; nothing to scale -;; -;; frac = dc_texturemid - (centery-dc_yl)*fracstep; -;; - mov ecx,[dc_iscale] ;; fracstep - mov eax,[centery] - sub eax,ebp - imul eax,ecx - mov edx,[dc_texturemid] - sub edx,eax - mov ebx,edx - shr ebx,16 ;; frac int. - and ebx,0xff - shl edx,16 ;; y frac up - mov ebp,ecx - shl ebp,16 ;; fracstep f. up - shr ecx,16 ;; fracstep i. ->cl - mov esi,[dc_source] -;; -;; lets rock :) ! -;; - mov eax,[pixelcount] - mov dh,al - shr eax,0x2 - mov ch,al ;; quad count - mov eax,[dc_colormap] - test dh,0x3 - je vskyquadloop -;; -;; do un-even pixel -;; - test dh,0x1 - je f2 - mov al,[esi+ebx] ;; prep un-even loops - add edx,ebp ;; ypos f += ystep f - adc bl,cl ;; ypos i += ystep i - mov dl,[eax] ;; colormap texel - mov [edi],dl ;; output pixel -p8: add edi,0x12345678 -;; -;; do two non-quad-aligned pixels -;; -f2: test dh,0x2 - je skyf3 - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp ;; ypos f += ystep f - adc bl,cl ;; ypos i += ystep i - mov dl,[eax] ;; colormap texel - mov [edi],dl ;; output pixel - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp ;; ypos f += ystep f - adc bl,cl ;; ypos i += ystep i - mov dl,[eax] ;; colormap texel -p9: add edi,0x12345678 - mov [edi],dl ;; output pixel - -pa: add edi,0x12345678 -;; -;; test if there was at least 4 pixels -;; -skyf3: test ch,0xff ;; test quad count - je vskydone -;; -;; ebp : ystep frac. upper 24 bits -;; edx : y frac. upper 24 bits -;; ebx : y i. lower 7 bits, masked for index -;; ecx : ch = counter, cl = y step i. -;; eax : colormap aligned 256 -;; esi : source texture column -;; edi : dest screen -;; -align 4 -vskyquadloop: - mov al,[esi+ebx] ;; prep loop - add edx,ebp ;; ypos f += ystep f - mov dl,[eax] ;; colormap texel - adc bl,cl ;; ypos i += ystep i - mov [edi],dl ;; output pixel - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp - adc bl,cl -pb: add edi,0x12345678 - mov dl,[eax] - mov [edi],dl - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp - adc bl,cl -pc: add edi,0x12345678 - mov dl,[eax] - mov [edi],dl - - mov al,[esi+ebx] ;; fetch source texel - add edx,ebp - adc bl,cl -pd: add edi,0x12345678 - mov dl,[eax] - mov [edi],dl - -pe: add edi,0x12345678 - - dec ch - jne vskyquadloop -vskydone: - pop ebx - pop edi - pop esi - pop ebp - ret - - -;;---------------------------------------------------------------------- -;; R_DrawTranslucentColumn_8 -;; -;; Vertical column texture drawer, with transparency. Replaces Doom2's -;; 'fuzz' effect, which was not so beautiful. -;; Transparency is always impressive in some way, don't know why... -;;---------------------------------------------------------------------- - -cglobal R_DrawTranslucentColumn_8 -R_DrawTranslucentColumn_8: - push ebp ;; preserve caller's stack frame pointer - push esi ;; preserve register variables - push edi - push ebx -;; -;; dest = ylookup[dc_yl] + columnofs[dc_x]; -;; - mov ebp,[dc_yl] - mov ebx,ebp - mov edi,[ylookup+ebx*4] - mov ebx,[dc_x] - add edi,[columnofs+ebx*4] ;; edi = dest -;; -;; pixelcount = yh - yl + 1 -;; - mov eax,[dc_yh] - inc eax - sub eax,ebp ;; pixel count - mov [pixelcount],eax ;; save for final pixel - jle near vtdone ;; nothing to scale -;; -;; frac = dc_texturemid - (centery-dc_yl)*fracstep; -;; - mov ecx,[dc_iscale] ;; fracstep - mov eax,[centery] - sub eax,ebp - imul eax,ecx - mov edx,[dc_texturemid] - sub edx,eax - mov ebx,edx - - shr ebx,16 ;; frac int. - and ebx,0x7f - shl edx,16 ;; y frac up - - mov ebp,ecx - shl ebp,16 ;; fracstep f. up - shr ecx,16 ;; fracstep i. ->cl - and cl,0x7f - push cx - mov ecx,edx - pop cx - mov edx,[dc_colormap] - mov esi,[dc_source] -;; -;; lets rock :) ! -;; - mov eax,[pixelcount] - shr eax,0x2 - test byte [pixelcount],0x3 - mov ch,al ;; quad count - mov eax,[dc_transmap] - je vt4quadloop -;; -;; do un-even pixel -;; - test byte [pixelcount],0x1 - je trf2 - - mov ah,[esi+ebx] ;; fetch texel : colormap number - add ecx,ebp - adc bl,cl - mov al,[edi] ;; fetch dest : index into colormap - and bl,0x7f - mov dl,[eax] - mov dl,[edx] - mov [edi],dl -pf: add edi,0x12345678 -;; -;; do two non-quad-aligned pixels -;; -trf2: test byte [pixelcount],0x2 - je trf3 - - mov ah,[esi+ebx] ;; fetch texel : colormap number - add ecx,ebp - adc bl,cl - mov al,[edi] ;; fetch dest : index into colormap - and bl,0x7f - mov dl,[eax] - mov dl,[edx] - mov [edi],dl -pg: add edi,0x12345678 - - mov ah,[esi+ebx] ;; fetch texel : colormap number - add ecx,ebp - adc bl,cl - mov al,[edi] ;; fetch dest : index into colormap - and bl,0x7f - mov dl,[eax] - mov dl,[edx] - mov [edi],dl -ph: add edi,0x12345678 -;; -;; test if there was at least 4 pixels -;; -trf3: test ch,0xff ;; test quad count - je near vtdone - -;; -;; ebp : ystep frac. upper 24 bits -;; edx : y frac. upper 24 bits -;; ebx : y i. lower 7 bits, masked for index -;; ecx : ch = counter, cl = y step i. -;; eax : colormap aligned 256 -;; esi : source texture column -;; edi : dest screen -;; -vt4quadloop: - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov [tystep],ebp -pi: add edi,0x12345678 - mov al,[edi] ;; fetch dest : index into colormap -pj: sub edi,0x12345678 - mov ebp,edi -pk: sub edi,0x12345678 - jmp short inloop -align 4 -vtquadloop: - add ecx,[tystep] - adc bl,cl -q1: add ebp,0x23456789 - and bl,0x7f - mov dl,[eax] - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov dl,[edx] - mov [edi],dl - mov al,[ebp] ;; fetch dest : index into colormap -inloop: - add ecx,[tystep] - adc bl,cl -q2: add edi,0x23456789 - and bl,0x7f - mov dl,[eax] - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov dl,[edx] - mov [ebp+0x0],dl - mov al,[edi] ;; fetch dest : index into colormap - - add ecx,[tystep] - adc bl,cl -q3: add ebp,0x23456789 - and bl,0x7f - mov dl,[eax] - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov dl,[edx] - mov [edi],dl - mov al,[ebp] ;; fetch dest : index into colormap - - add ecx,[tystep] - adc bl,cl -q4: add edi,0x23456789 - and bl,0x7f - mov dl,[eax] - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov dl,[edx] - mov [ebp],dl - mov al,[edi] ;; fetch dest : index into colormap - - dec ch - jne vtquadloop -vtdone: - pop ebx - pop edi - pop esi - pop ebp - ret - - -;;---------------------------------------------------------------------- -;; R_DrawShadeColumn -;; -;; for smoke..etc.. test. -;;---------------------------------------------------------------------- -cglobal R_DrawShadeColumn_8 -R_DrawShadeColumn_8: - push ebp ;; preserve caller's stack frame pointer - push esi ;; preserve register variables - push edi - push ebx - -;; -;; dest = ylookup[dc_yl] + columnofs[dc_x]; -;; - mov ebp,[dc_yl] - mov ebx,ebp - mov edi,[ylookup+ebx*4] - mov ebx,[dc_x] - add edi,[columnofs+ebx*4] ;; edi = dest -;; -;; pixelcount = yh - yl + 1 -;; - mov eax,[dc_yh] - inc eax - sub eax,ebp ;; pixel count - mov [pixelcount],eax ;; save for final pixel - jle near shdone ;; nothing to scale -;; -;; frac = dc_texturemid - (centery-dc_yl)*fracstep; -;; - mov ecx,[dc_iscale] ;; fracstep - mov eax,[centery] - sub eax,ebp - imul eax,ecx - mov edx,[dc_texturemid] - sub edx,eax - mov ebx,edx - shr ebx,16 ;; frac int. - and ebx,byte +0x7f - shl edx,16 ;; y frac up - - mov ebp,ecx - shl ebp,16 ;; fracstep f. up - shr ecx,16 ;; fracstep i. ->cl - and cl,0x7f - - mov esi,[dc_source] -;; -;; lets rock :) ! -;; - mov eax,[pixelcount] - mov dh,al - shr eax,2 - mov ch,al ;; quad count - mov eax,[colormaps] - test dh,3 - je sh4quadloop -;; -;; do un-even pixel -;; - test dh,0x1 - je shf2 - - mov ah,[esi+ebx] ;; fetch texel : colormap number - add edx,ebp - adc bl,cl - mov al,[edi] ;; fetch dest : index into colormap - and bl,0x7f - mov dl,[eax] - mov [edi],dl -pl: add edi,0x12345678 -;; -;; do two non-quad-aligned pixels -;; -shf2: - test dh,0x2 - je shf3 - - mov ah,[esi+ebx] ;; fetch texel : colormap number - add edx,ebp - adc bl,cl - mov al,[edi] ;; fetch dest : index into colormap - and bl,0x7f - mov dl,[eax] - mov [edi],dl -pm: add edi,0x12345678 - - mov ah,[esi+ebx] ;; fetch texel : colormap number - add edx,ebp - adc bl,cl - mov al,[edi] ;; fetch dest : index into colormap - and bl,0x7f - mov dl,[eax] - mov [edi],dl -pn: add edi,0x12345678 -;; -;; test if there was at least 4 pixels -;; -shf3: - test ch,0xff ;; test quad count - je near shdone - -;; -;; ebp : ystep frac. upper 24 bits -;; edx : y frac. upper 24 bits -;; ebx : y i. lower 7 bits, masked for index -;; ecx : ch = counter, cl = y step i. -;; eax : colormap aligned 256 -;; esi : source texture column -;; edi : dest screen -;; -sh4quadloop: - mov dh,0x7f ;; prep mask - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov [tystep],ebp -po: add edi,0x12345678 - mov al,[edi] ;; fetch dest : index into colormap -pp: sub edi,0x12345678 - mov ebp,edi -pq: sub edi,0x12345678 - jmp short shinloop - -align 4 -shquadloop: - add edx,[tystep] - adc bl,cl - and bl,dh -q5: add ebp,0x12345678 - mov dl,[eax] - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov [edi],dl - mov al,[ebp] ;; fetch dest : index into colormap -shinloop: - add edx,[tystep] - adc bl,cl - and bl,dh -q6: add edi,0x12345678 - mov dl,[eax] - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov [ebp],dl - mov al,[edi] ;; fetch dest : index into colormap - - add edx,[tystep] - adc bl,cl - and bl,dh -q7: add ebp,0x12345678 - mov dl,[eax] - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov [edi],dl - mov al,[ebp] ;; fetch dest : index into colormap - - add edx,[tystep] - adc bl,cl - and bl,dh -q8: add edi,0x12345678 - mov dl,[eax] - mov ah,[esi+ebx] ;; fetch texel : colormap number - mov [ebp],dl - mov al,[edi] ;; fetch dest : index into colormap - - dec ch - jne shquadloop - -shdone: - pop ebx ;; restore register variables - pop edi - pop esi - pop ebp ;; restore caller's stack frame pointer - ret - - - -;;---------------------------------------------------------------------- -;; -;; R_DrawSpan -;; -;; Horizontal texture mapping -;; -;;---------------------------------------------------------------------- - - -[SECTION .data] - -oldcolormap dd 0 - -[SECTION CODE_SEG write] - -cglobal R_DrawSpan_8 -R_DrawSpan_8: - push ebp ;; preserve caller's stack frame pointer - push esi ;; preserve register variables - push edi - push ebx -;; -;; initilise registers -;; - - mov edx, [ds_xfrac] - mov eax, [ds_ystep] - ror edx, 14 - ror eax, 15 - mov bl, dl - mov ecx, [ds_xstep] - mov dh, al - mov ax, 1 - mov [tystep], eax - - - mov eax, [ds_yfrac] - ror ecx, 13 - ror eax, 16 - mov dl, cl - mov bh, al - xor cx, cx - and ebx, 0x3fff - mov [pixelcount],ecx - - mov ecx, [ds_x2] - mov edi, [ds_y] - mov esi, [ds_x1] - mov edi, [ylookup+edi*4] - mov ebp, ebx - add edi, [columnofs+esi*4] - sub esi, ecx ;; pixel count - shr ebp, 2 - mov ecx, [ds_colormap] - mov ax, si - mov esi, [ds_source] - sar ax,1 - jnc near .midloop ;; check parity - -; summary -; edx = high16bit xfrac[0..13], ah=ystep[16..24] al=xtep[14..21] -; ebx = high16bit =0, bh=yfrac[16..24], bl=xfrac[14..21] -; ecx = colormap table cl=0 (colormap is aligned 8 bits) -; eax = high16bit yfrac[0..15], dx = count -; esi = flat texture source -; edi = screeen buffer destination -; ebp = work register -; pixelcount = high16bit xstep[0..13] rest to 0 -; tystep = high16bit ystep[0..15] low 16 bit = 2 (increment of count) - -align 4 -.loop - add eax, [tystep] - mov cl, [esi+ebp] - adc bh, dh - mov cl, [ecx] - and bh, 0x3f - mov [edi], cl - mov ebp, ebx - inc edi - shr ebp, 2 - -.midloop: - add edx, [pixelcount] - mov cl, [esi+ebp] - adc bl, dl - mov cl, [ecx] - mov ebp, ebx - mov [edi], cl - inc edi - shr ebp, 2 - - test eax, 0xffff - jnz near .loop - -.hdone: pop ebx ;; restore register variables - pop edi - pop esi - pop ebp ;; restore caller's stack frame pointer - ret - - -[SECTION .data] - -obelix dd 0 -etaussi dd 0 - -[SECTION CODE_SEG] - -cglobal R_DrawSpan_8_old -R_DrawSpan_8_old: - push ebp ;; preserve caller's stack frame pointer - push esi ;; preserve register variables - push edi - push ebx -;; -;; find loop count -;; - mov eax,[ds_x2] - inc eax - sub eax,[ds_x1] ;; pixel count - mov [pixelcount],eax ;; save for final pixel - js near .hdone ;; nothing to scale - shr eax,0x1 ;; double pixel count - mov [loopcount],eax -;; -;; build composite position -;; - mov ebp,[ds_xfrac] - shl ebp,10 - and ebp,0xffff0000 - mov eax,[ds_yfrac] - shr eax,6 - and eax,0xffff - mov edi,[ds_y] - or ebp,eax - - mov esi,[ds_source] -;; -;; calculate screen dest -;; - mov edi,[ylookup+edi*4] - mov eax,[ds_x1] - add edi,[columnofs+eax*4] -;; -;; build composite step -;; - mov ebx,[ds_xstep] - shl ebx,10 - and ebx,0xffff0000 - mov eax,[ds_ystep] - shr eax,6 - and eax,0xffff - or ebx,eax - - mov [obelix],ebx - mov [etaussi],esi - -;; %eax aligned colormap -;; %ebx aligned colormap -;; %ecx,%edx scratch -;; %esi virtual source -;; %edi moving destination pointer -;; %ebp frac - - mov eax,[ds_colormap] - mov ecx,ebp - add ebp,ebx ;; advance frac pointer - shr cx,10 - rol ecx,6 - and ecx,4095 ;; finish calculation for third pixel - mov edx,ebp - shr dx,10 - rol edx,6 - add ebp,ebx ;; advance frac pointer - and edx,4095 ;; finish calculation for fourth pixel - mov ebx,eax - mov al,[esi+ecx] ;; get first pixel - mov bl,[esi+edx] ;; get second pixel - - test dword [pixelcount],0xfffffffe - - mov dl,[eax] ;; color translate first pixel - -;; movw $0xf0f0,%dx ;;see visplanes start - - je .hchecklast - - mov dh,[ebx] ;; color translate second pixel - mov esi,[loopcount] -align 4 -.hdoubleloop: - mov ecx,ebp - shr cx,10 - rol ecx,6 - add ebp,[obelix] ;; advance frac pointer - mov [edi],dx ;; write first pixel - and ecx,4095 ;; finish calculation for third pixel - mov edx,ebp - shr dx,10 - rol edx,6 - add ecx,[etaussi] - and edx,4095 ;; finish calculation for fourth pixel - mov al,[ecx] ;; get third pixel - add ebp,[obelix] ;; advance frac pointer - add edx,[etaussi] - mov bl,[edx] ;; get fourth pixel - mov dl,[eax] ;; color translate third pixel - add edi,byte +0x2 ;; advance to third pixel destination - dec esi ;; done with loop? - mov dh,[ebx] ;; color translate fourth pixel - jne .hdoubleloop -;; check for final pixel -.hchecklast: - test dword [pixelcount],0x1 - je .hdone - mov [edi],dl ;; write final pixel -.hdone: pop ebx ;; restore register variables - pop edi - pop esi - pop ebp ;; restore caller's stack frame pointer - ret - - -;; ======================================================================== -;; Rasterization des segments d'un polygne textur de manire LINEAIRE. -;; Il s'agit donc d'interpoler les coordonnes aux bords de la texture en -;; mme temps que les abscisses minx/maxx pour chaque ligne. -;; L'argument 'dir' indique quels bords de la texture sont interpols: -;; 0 : segments associs aux bord SUPERIEUR et INFERIEUR ( TY constant ) -;; 1 : segments associs aux bord GAUCHE et DROITE ( TX constant ) -;; ======================================================================== -;; -;; void rasterize_segment_tex( LONG x1, LONG y1, LONG x2, LONG y2, LONG tv1, LONG tv2, LONG tc, LONG dir ); -;; ARG1 ARG2 ARG3 ARG4 ARG5 ARG6 ARG7 ARG8 -;; -;; Pour dir = 0, (tv1,tv2) = (tX1,tX2), tc = tY, en effet TY est constant. -;; -;; Pour dir = 1, (tv1,tv2) = (tY1,tY2), tc = tX, en effet TX est constant. -;; -;; -;; Uses: extern struct rastery *_rastertab; -;; - -[SECTION CODE_SEG write] - -MINX EQU 0 -MAXX EQU 4 -TX1 EQU 8 -TY1 EQU 12 -TX2 EQU 16 -TY2 EQU 20 -RASTERY_SIZEOF EQU 24 - -cglobal rasterize_segment_tex -rasterize_segment_tex: - push ebp - mov ebp,esp - - sub esp,byte +0x8 ;; alloue les variables locales - - push ebx - push esi - push edi - o16 mov ax,es - push eax - -;; #define DX [ebp-4] -;; #define TD [ebp-8] - - mov eax,[ebp+0xc] ;; y1 - mov ebx,[ebp+0x14] ;; y2 - cmp ebx,eax - je near .L_finished ;; special (y1==y2) segment horizontal, exit! - - jg near .L_rasterize_right - -;;rasterize_left: ;; on rasterize un segment la GAUCHE du polygne - - mov ecx,eax - sub ecx,ebx - inc ecx ;; y1-y2+1 - - mov eax,RASTERY_SIZEOF - mul ebx ;; * y2 - mov esi,[prastertab] - add esi,eax ;; point into rastertab[y2] - - mov eax,[ebp+0x8] ;; ARG1 - sub eax,[ebp+0x10] ;; ARG3 - shl eax,0x10 ;; ((x1-x2)<<PRE) ... - cdq - idiv ecx ;; dx = ... / (y1-y2+1) - mov [ebp-0x4],eax ;; DX - - mov eax,[ebp+0x18] ;; ARG5 - sub eax,[ebp+0x1c] ;; ARG6 - shl eax,0x10 - cdq - idiv ecx ;; tdx =((tx1-tx2)<<PRE) / (y1-y2+1) - mov [ebp-0x8],eax ;; idem tdy =((ty1-ty2)<<PRE) / (y1-y2+1) - - mov eax,[ebp+0x10] ;; ARG3 - shl eax,0x10 ;; x = x2<<PRE - - mov ebx,[ebp+0x1c] ;; ARG6 - shl ebx,0x10 ;; tx = tx2<<PRE d0 - ;; ty = ty2<<PRE d1 - mov edx,[ebp+0x20] ;; ARG7 - shl edx,0x10 ;; ty = ty<<PRE d0 - ;; tx = tx<<PRE d1 - push ebp - mov edi,[ebp-0x4] ;; DX - cmp dword [ebp+0x24],byte +0x0 ;; ARG8 direction ? - - mov ebp,[ebp-0x8] ;; TD - je .L_rleft_h_loop -;; -;; TY varie, TX est constant -;; -.L_rleft_v_loop: - mov [esi+MINX],eax ;; rastertab[y].minx = x - add ebx,ebp - mov [esi+TX1],edx ;; .tx1 = tx - add eax,edi - mov [esi+TY1],ebx ;; .ty1 = ty - - ;;addl DX, %eax // x += dx - ;;addl TD, %ebx // ty += tdy - - add esi,RASTERY_SIZEOF ;; next raster line into rastertab[] - dec ecx - jne .L_rleft_v_loop - pop ebp - jmp .L_finished -;; -;; TX varie, TY est constant -;; -.L_rleft_h_loop: - mov [esi+MINX],eax ;; rastertab[y].minx = x - add eax,edi - mov [esi+TX1],ebx ;; .tx1 = tx - add ebx,ebp - mov [esi+TY1],edx ;; .ty1 = ty - - ;;addl DX, %eax // x += dx - ;;addl TD, %ebx // tx += tdx - - add esi,RASTERY_SIZEOF ;; next raster line into rastertab[] - dec ecx - jne .L_rleft_h_loop - pop ebp - jmp .L_finished -;; -;; on rasterize un segment la DROITE du polygne -;; -.L_rasterize_right: - mov ecx,ebx - sub ecx,eax - inc ecx ;; y2-y1+1 - - mov ebx,RASTERY_SIZEOF - mul ebx ;; * y1 - mov esi,[prastertab] - add esi,eax ;; point into rastertab[y1] - - mov eax,[ebp+0x10] ;; ARG3 - sub eax,[ebp+0x8] ;; ARG1 - shl eax,0x10 ;; ((x2-x1)<<PRE) ... - cdq - idiv ecx ;; dx = ... / (y2-y1+1) - mov [ebp-0x4],eax ;; DX - - mov eax,[ebp+0x1c] ;; ARG6 - sub eax,[ebp+0x18] ;; ARG5 - shl eax,0x10 - cdq - idiv ecx ;; tdx =((tx2-tx1)<<PRE) / (y2-y1+1) - mov [ebp-0x8],eax ;; idem tdy =((ty2-ty1)<<PRE) / (y2-y1+1) - - mov eax,[ebp+0x8] ;; ARG1 - shl eax,0x10 ;; x = x1<<PRE - - mov ebx,[ebp+0x18] ;; ARG5 - shl ebx,0x10 ;; tx = tx1<<PRE d0 - ;; ty = ty1<<PRE d1 - mov edx,[ebp+0x20] ;; ARG7 - shl edx,0x10 ;; ty = ty<<PRE d0 - ;; tx = tx<<PRE d1 - push ebp - mov edi,[ebp-0x4] ;; DX - - cmp dword [ebp+0x24], 0 ;; direction ? - - mov ebp,[ebp-0x8] ;; TD - je .L_rright_h_loop -;; -;; TY varie, TX est constant -;; -.L_rright_v_loop: - - mov [esi+MAXX],eax ;; rastertab[y].maxx = x - add ebx,ebp - mov [esi+TX2],edx ;; .tx2 = tx - add eax,edi - mov [esi+TY2],ebx ;; .ty2 = ty - - ;;addl DX, %eax // x += dx - ;;addl TD, %ebx // ty += tdy - - add esi,RASTERY_SIZEOF - dec ecx - jne .L_rright_v_loop - - pop ebp - - jmp short .L_finished -;; -;; TX varie, TY est constant -;; -.L_rright_h_loop: - mov [esi+MAXX],eax ;; rastertab[y].maxx = x - add eax,edi - mov [esi+TX2],ebx ;; .tx2 = tx - add ebx,ebp - mov [esi+TY2],edx ;; .ty2 = ty - - ;;addl DX, %eax // x += dx - ;;addl TD, %ebx // tx += tdx - - add esi,RASTERY_SIZEOF - dec ecx - jne .L_rright_h_loop - - pop ebp - -.L_finished: - pop eax - o16 mov es,ax - pop edi - pop esi - pop ebx - - mov esp,ebp - pop ebp - ret - - -;;; this version can draw 64x64 tiles, but they would have to be arranged 4 per row, -;; so that the stride from one line to the next is 256 -;; -;; .data -;;xstep dd 0 -;;ystep dd 0 -;;texwidth dd 64 ;; texture width -;; .text -;; this code is kept in case we add high-detail floor textures for example (256x256) -; align 16 -;_R_DrawSpan_8: -; push ebp ;; preserve caller's stack frame pointer -; push esi ;; preserve register variables -; push edi -; push ebx -;; -;; find loop count -;; -; mov eax,[ds_x2] -; inc eax -; sub eax,[ds_x1] ;; pixel count -; mov [pixelcount],eax ;; save for final pixel -; js near .hdone ;; nothing to scale -;; -;; calculate screen dest -;; -; mov edi,[ds_y] -; mov edi,[ylookup+edi*4] -; mov eax,[ds_x1] -; add edi,[columnofs+eax*4] -;; -;; prepare registers for inner loop -;; -; xor eax,eax -; mov edx,[ds_xfrac] -; ror edx,16 -; mov al,dl -; mov ecx,[ds_yfrac] -; ror ecx,16 -; mov ah,cl -; -; mov ebx,[ds_xstep] -; ror ebx,16 -; mov ch,bl -; and ebx,0xffff0000 -; mov [xstep],ebx -; mov ebx,[ds_ystep] -; ror ebx,16 -; mov dh,bl -; and ebx,0xffff0000 -; mov [ystep],ebx -; -; mov esi,[ds_source] -; -;;; %eax Yi,Xi in %ah,%al -;;; %ebx aligned colormap -;;; %ecx Yfrac upper, dXi in %ch, %cl is counter (upto 1024pels, =4x256) -;;; %edx Xfrac upper, dYi in %dh, %dl receives mapped pixels from (ebx) -;;; ystep dYfrac, add to %ecx, low word is 0 -;;; xstep dXfrac, add to %edx, low word is 0 -;;; %ebp temporary register serves as offset like %eax -;;; %esi virtual source -;;; %edi moving destination pointer -; -; mov ebx,[pixelcount] -; shr ebx,0x2 ;; 4 pixels per loop -; test bl,0xff -; je near .hchecklast -; mov cl,bl -; -; mov ebx,[dc_colormap] -;;; -;;; prepare loop with first pixel -;;; -; add ecx,[ystep] ;;pra1 -; adc ah,dh -; add edx,[xstep] -; adc al,ch -; and eax,0x3f3f -; mov bl,[esi+eax] ;;prb1 -; mov dl,[ebx] ;;prc1 -; -; add ecx,[ystep] ;;a2 -; adc ah,dh -; -;.hdoubleloop: -; mov [edi+1],dl -; add edx,[xstep] -; adc al,ch -; add edi,byte +0x2 -; mov ebp,eax -; add ecx,[ystep] -; adc ah,dh -; and ebp,0x3f3f -; add edx,[xstep] -; mov bl,[esi+ebp] -; adc al,ch -; mov dl,[ebx] -; and eax,0x3f3f -; mov [edi],dl -; mov bl,[esi+eax] -; add ecx,[ystep] -; adc ah,dh -; add edx,[xstep] -; adc al,ch -; mov dl,[ebx] -; mov ebp,eax -; mov [edi+1],dl -; and ebp,0x3f3f -; add ecx,[ystep] -; adc ah,dh -; mov bl,[esi+ebp] -; add edi,byte +0x2 -; add edx,[xstep] -; adc al,ch -; mov dl,[ebx] -; and eax,0x3f3f -; mov [edi],dl -; mov bl,[esi+eax] -; add ecx,[ystep] -; adc ah,dh -; mov dl,[ebx] -; dec cl -; jne near .hdoubleloop -;;; check for final pixel -;.hchecklast: -;;; to do -;.hdone: -; pop ebx -; pop edi -; pop esi -; pop ebp -; ret +;; +;; Revision 1.10 2001/02/24 13:35:21 bpereira +;; no message +;; +;; Revision 1.9 2001/02/10 15:24:19 hurdler +;; Apply Rob's patch for Linux version +;; +;; Revision 1.8 2000/11/12 09:48:15 bpereira +;; no message +;; +;; Revision 1.7 2000/11/06 20:52:16 bpereira +;; no message +;; +;; Revision 1.6 2000/11/03 11:48:40 hurdler +;; Fix compiling problem under win32 with 3D-Floors and FragglScript (to verify!) +;; +;; Revision 1.5 2000/11/03 03:27:17 stroggonmeth +;; Again with the bug fixing... +;; +;; Revision 1.4 2000/11/02 17:50:10 stroggonmeth +;; Big 3Dfloors & FraggleScript commit!! +;; +;; Revision 1.3 2000/04/24 20:24:38 bpereira +;; no message +;; +;; Revision 1.2 2000/02/27 00:42:11 hurdler +;; fix CR+LF problem +;; +;; Revision 1.1.1.1 2000/02/22 20:32:32 hurdler +;; Initial import into CVS (v1.29 pr3) +;; +;; +;; DESCRIPTION: +;; assembler optimised rendering code for software mode +;; draw floor spans, and wall columns. +;; +;;----------------------------------------------------------------------------- + + +[BITS 32] + +%ifdef LINUX +%macro cextern 1 +[extern %1] +%endmacro + +%macro cglobal 1 +[global %1] +%endmacro + +%define CODE_SEG .data +%else +%macro cextern 1 +%define %1 _%1 +[extern %1] +%endmacro + +%macro cglobal 1 +%define %1 _%1 +[global %1] +%endmacro + +%define CODE_SEG .text +%endif + + +;; externs +;; columns +cextern dc_x +cextern dc_yl +cextern dc_yh +cextern ylookup +cextern columnofs +cextern dc_source +cextern dc_texturemid +cextern dc_iscale +cextern centery +cextern dc_colormap +cextern dc_transmap +cextern colormaps + +;; spans +cextern ds_x1 +cextern ds_x2 +cextern ds_y +cextern ds_xfrac +cextern ds_yfrac +cextern ds_xstep +cextern ds_ystep +cextern ds_source +cextern ds_colormap +;cextern ds_textureheight + +; polygon edge rasterizer +cextern prastertab + + +;;---------------------------------------------------------------------- +;; +;; R_DrawColumn +;; +;; New optimised version 10-01-1998 by D.Fabrice and P.Boris +;; TO DO: optimise it much farther... should take at most 3 cycles/pix +;; once it's fixed, add code to patch the offsets so that it +;; works in every screen width. +;; +;;---------------------------------------------------------------------- + +[SECTION .data] + +;;.align 4 +loopcount dd 0 +pixelcount dd 0 +tystep dd 0 + +[SECTION CODE_SEG write] + +;---------------------------------------------------------------------------- +;fixed_t FixedMul (fixed_t a, fixed_t b) +;---------------------------------------------------------------------------- +cglobal FixedMul +; align 16 +FixedMul: + mov eax,[esp+4] + imul dword [esp+8] + shrd eax,edx,16 + ret + +;---------------------------------------------------------------------------- +;fixed_t FixedDiv2 (fixed_t a, fixed_t b); +;---------------------------------------------------------------------------- +cglobal FixedDiv2 +; align 16 +FixedDiv2: + mov eax,[esp+4] + mov edx,eax ;; these two instructions allow the next + sar edx,31 ;; two to pair, on the Pentium processor. + shld edx,eax,16 + sal eax,16 + idiv dword [esp+8] + ret + +;---------------------------------------------------------------------------- +; void ASM_PatchRowBytes (int rowbytes); +;---------------------------------------------------------------------------- +cglobal ASM_PatchRowBytes +; align 16 +ASM_PatchRowBytes: + mov eax,[esp+4] + mov [p1+2],eax + mov [p2+2],eax + mov [p3+2],eax + mov [p4+2],eax + mov [p5+2],eax + mov [p6+2],eax + mov [p7+2],eax + mov [p8+2],eax + mov [p9+2],eax + mov [pa+2],eax + mov [pb+2],eax + mov [pc+2],eax + mov [pd+2],eax + mov [pe+2],eax + mov [pf+2],eax + mov [pg+2],eax + mov [ph+2],eax + mov [pi+2],eax + mov [pj+2],eax + mov [pk+2],eax + mov [pl+2],eax + mov [pm+2],eax + mov [pn+2],eax + mov [po+2],eax + mov [pp+2],eax + mov [pq+2],eax + add eax,eax + mov [q1+2],eax + mov [q2+2],eax + mov [q3+2],eax + mov [q4+2],eax + mov [q5+2],eax + mov [q6+2],eax + mov [q7+2],eax + mov [q8+2],eax + ret + + +;---------------------------------------------------------------------------- +; 8bpp column drawer +;---------------------------------------------------------------------------- + +cglobal R_DrawColumn_8 +; align 16 +R_DrawColumn_8: + push ebp ;; preserve caller's stack frame pointer + push esi ;; preserve register variables + push edi + push ebx +;; +;; dest = ylookup[dc_yl] + columnofs[dc_x]; +;; + mov ebp,[dc_yl] + mov ebx,ebp + mov edi,[ylookup+ebx*4] + mov ebx,[dc_x] + add edi,[columnofs+ebx*4] ;; edi = dest +;; +;; pixelcount = yh - yl + 1 +;; + mov eax,[dc_yh] + inc eax + sub eax,ebp ;; pixel count + mov [pixelcount],eax ;; save for final pixel + jle near vdone ;; nothing to scale +;; +;; frac = dc_texturemid - (centery-dc_yl)*fracstep; +;; + mov ecx,[dc_iscale] ;; fracstep + mov eax,[centery] + sub eax,ebp + imul eax,ecx + mov edx,[dc_texturemid] + sub edx,eax + mov ebx,edx + shr ebx,16 ;; frac int. + and ebx,0x7f + shl edx,16 ;; y frac up + + mov ebp,ecx + shl ebp,16 ;; fracstep f. up + shr ecx,16 ;; fracstep i. ->cl + and cl,0x7f + mov esi,[dc_source] +;; +;; lets rock :) ! +;; + mov eax,[pixelcount] + mov dh,al + shr eax,2 + mov ch,al ;; quad count + mov eax,[dc_colormap] + test dh,0x3 + je near v4quadloop +;; +;; do un-even pixel +;; + test dh,0x1 + je two_uneven + + mov al,[esi+ebx] ;; prep un-even loops + add edx,ebp ;; ypos f += ystep f + adc bl,cl ;; ypos i += ystep i + mov dl,[eax] ;; colormap texel + and bl,0x7f ;; mask 0-127 texture index + mov [edi],dl ;; output pixel +p1: add edi,0x12345678 +;; +;; do two non-quad-aligned pixels +;; +two_uneven: + test dh,0x2 + je f3 + + mov al,[esi+ebx] ;; fetc... [truncated message content] |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-17 18:44:19
|
Commit-ID: 6977b23cfbf04e996da7ff46aa2d9ec59dc729e3 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=6977b23cfbf04e996da7ff46aa2d9ec59dc729e3 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 25 Apr 2018 01:10:10 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 17 Oct 2018 21:40:14 +0300 travis: Disable osx for a while osx update takes too long, disable it for a while. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f23fa5e..a74ab82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,8 @@ language: c os: - linux - - osx env: - TR_ARCH=local -before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python ; fi script: - ./autogen.sh - ./configure |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-17 18:44:18
|
Commit-ID: 88ef566099465bad4b3b54f59724efa93dc5f66c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=88ef566099465bad4b3b54f59724efa93dc5f66c Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 22 Apr 2018 23:51:12 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 17 Oct 2018 21:38:35 +0300 README: Update link to license Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8bca043..4b8ab9a 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,9 @@ a widespread (thus netwide), portable (thus netwide!), very flexible and mature assembler tool with support for many output formats (thus netwide!!). Now we have good news for you: NASM is licensed under the "simplified" -(2-clause) BSD license. This means its development is open to even wider -society of programmers wishing to improve their lovely assembler. +[(2-clause) BSD license](https://opensource.org/licenses/BSD-2-Clause). +This means its development is open to even wider society of programmers +wishing to improve their lovely assembler. Visit our [nasm.us](https://www.nasm.us/) website for more details. We are gradually moving services away from Sourceforge. For our remaining |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-17 18:44:18
|
Commit-ID: ab50bc3780c44764a31f4c8880235fdcc8f09a50 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ab50bc3780c44764a31f4c8880235fdcc8f09a50 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 25 Apr 2018 00:45:17 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 17 Oct 2018 21:40:14 +0300 Add travis status into readme Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4b8ab9a..704fba1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ NASM, the Netwide Assembler =========================== +[](https://travis-ci.org/netwide-assembler/nasm) + Many many developers all over the net respect NASM for what it is: a widespread (thus netwide), portable (thus netwide!), very flexible and mature assembler tool with support for many output formats (thus netwide!!). |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-17 18:44:18
|
Commit-ID: 54533889403e61197179145b295970e4fe7b9d84 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=54533889403e61197179145b295970e4fe7b9d84 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 25 Apr 2018 00:31:21 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 17 Oct 2018 21:40:14 +0300 test: travis -- Add initial support Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- .travis.yml | 14 ++ travis/README.md | 104 ++++++++++++++ travis/nasm-t.py | 412 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 530 insertions(+) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f23fa5e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: c +os: + - linux + - osx +env: + - TR_ARCH=local +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python ; fi +script: + - ./autogen.sh + - ./configure + - make all + - python3 ./travis/nasm-t.py run diff --git a/travis/README.md b/travis/README.md new file mode 100644 index 0000000..d5aee05 --- /dev/null +++ b/travis/README.md @@ -0,0 +1,104 @@ +Testing NASM +============ +We use [Travis CI](https://travis-ci.org/) service to execute NASM tests, +which basically prepares the environment and runs our `nasm-t.py` script. + +The script scans a testing directory for `*.json` test descriptor files +and runs test by descriptor content. + +Test engine +----------- +`nasm-t.py` script is a simple test engine written by Python3 language +which allows either execute a single test or run them all in a sequence. + +A typical test case processed by the following steps: + + - a test descriptor get parsed to figure out which arguments + are to be provided into the NASM command line; + - invoke the NASM with arguments; + - compare generated files with precompiled templates. + +`nasm-t.py` supports the following commands: + + - `list`: to list all test cases + - `run`: to run test cases + - `update`: to update precompiled templates + +Use `nasm-t.py -h` command to get the detailed description of every option. + +Test descriptor file +-------------------- +A descriptor file should provide enough information how to run the NASM +itself and which output files or streams to compare with predefined ones. +We use `JSON` format with the following fields: + + - `description`: a short description of a test which is shown to + a user when tests are listed; + - `id`: descriptor internal name to use with `ref` field; + - `ref`: a reference to `id` from where settings should be + copied, it is convenient when say only `option` is different + while the rest of the fields are the same; + - `format`: NASM output format to use (`bin`,`elf` and etc); + - `source`: is a source file name to compile, this file must + be shipped together with descriptor file itself; + - `option`: an additional option passed to the command line; + - `update`: a trigger to skip updating targets when running + an update procedure; + - `target`: an array of targets which the test engine should + check once compilation finished: + - `stderr`: a file containing *stderr* stream output to check; + - `stdout`: a file containing *stdout* stream output to check; + - `output`: a file containing compiled result to check, in other + words it is a name passed as `-o` option to the compiler. + +Examples +-------- + +A simple test where no additional options are used, simply compile +`absolute.asm` file with `bin` format for output, then compare +produced `absolute.bin` file with precompiled `absolute.bin.dest`. + +```json +{ + "description": "Check absolute addressing", + "format": "bin", + "source": "absolute.asm", + "target": [ + { "output": "absolute.bin" } + ] +} +``` + +A slightly complex example: compile one source file with different optimization +options and all results must be the same. To not write three descriptors +we assign `id` to the first one and use `ref` term to copy settings. +Also, it is expected that `stderr` stream will not be empty but carry some +warnings to compare. + +```json +[ + { + "description": "Check 64-bit addressing (-Ox)", + "id": "addr64x", + "format": "bin", + "source": "addr64x.asm", + "option": "-Ox", + "target": [ + { "output": "addr64x.bin" }, + { "stderr": "addr64x.stderr" } + ] + }, + { + "description": "Check 64-bit addressing (-O1)", + "ref": "addr64x", + "option": "-O1", + "update": "false" + }, + { + "description": "Check 64-bit addressing (-O0)", + "ref": "addr64x", + "option": "-O0", + "update": "false" + } +] +``` diff --git a/travis/nasm-t.py b/travis/nasm-t.py new file mode 100755 index 0000000..714eccc --- /dev/null +++ b/travis/nasm-t.py @@ -0,0 +1,412 @@ +#!/usr/bin/python3 + +import subprocess +import argparse +import difflib +import filecmp +import fnmatch +import json +import sys +import re +import os + +fmtr_class = argparse.ArgumentDefaultsHelpFormatter +parser = argparse.ArgumentParser(prog = 'nasm-t.py', + formatter_class=fmtr_class) + +parser.add_argument('-d', '--directory', + dest = 'dir', default = './travis/test', + help = 'Directory with tests') + +parser.add_argument('--nasm', + dest = 'nasm', default = './nasm', + help = 'Nasm executable to use') + +parser.add_argument('--hexdump', + dest = 'hexdump', default = '/usr/bin/hexdump', + help = 'Hexdump executable to use') + +sp = parser.add_subparsers(dest = 'cmd') +for cmd in ['run']: + spp = sp.add_parser(cmd, help = 'Run test cases') + spp.add_argument('-t', '--test', + dest = 'test', + help = 'Run the selected test only', + required = False) + +for cmd in ['list']: + spp = sp.add_parser(cmd, help = 'List test cases') + +for cmd in ['update']: + spp = sp.add_parser(cmd, help = 'Update test cases with new compiler') + spp.add_argument('-t', '--test', + dest = 'test', + help = 'Update the selected test only', + required = False) + +args = parser.parse_args() + +if args.cmd == None: + parser.print_help() + sys.exit(1) + +def read_stdfile(path): + with open(path, "rb") as f: + data = f.read().decode("utf-8").strip("\n") + f.close() + return data + +# +# Check if descriptor has mandatory fields +def is_valid_desc(desc): + if desc == None: + return False + if 'description' not in desc: + return false + return True + +# +# Expand ref/id in descriptors array +def expand_templates(desc_array): + desc_ids = { } + for d in desc_array: + if 'id' in d: + desc_ids[d['id']] = d + for i, d in enumerate(desc_array): + if 'ref' in d and d['ref'] in desc_ids: + ref = desc_ids[d['ref']] + own = d.copy() + desc_array[i] = ref.copy() + for k, v in own.items(): + desc_array[i][k] = v + del desc_array[i]['id'] + return desc_array + +def prepare_desc(desc, basedir, name, path): + if not is_valid_desc(desc): + return False + # + # Put private fields + desc['_base-dir'] = basedir + desc['_json-file'] = name + desc['_json-path'] = path + desc['_test-name'] = basedir + os.sep + name[:-5] + # + # If no target provided never update + if 'target' not in desc: + desc['target'] = [] + desc['update'] = 'false' + # + # Which code to expect when nasm finishes + desc['_wait'] = 0 + if 'error' in desc: + if desc['error'] == 'expected': + desc['_wait'] = 1 + # + # Walk over targets and generate match templates + # if were not provided yet + for d in desc['target']: + if 'output' in d and not 'match' in d: + d['match'] = d['output'] + ".t" + return True + +def read_json(path): + desc = None + try: + with open(path, "rb") as f: + try: + desc = json.loads(f.read().decode("utf-8").strip("\n")) + except: + desc = None + finally: + f.close() + except: + pass + return desc + +def read_desc(basedir, name): + path = basedir + os.sep + name + desc = read_json(path) + desc_array = [] + if type(desc) == dict: + if prepare_desc(desc, basedir, name, path) == True: + desc_array += [desc] + elif type(desc) == list: + expand_templates(desc) + for de in desc: + if prepare_desc(de, basedir, name, path) == True: + desc_array += [de] + return desc_array + +def collect_test_desc_from_file(path): + if not fnmatch.fnmatch(path, '*.json'): + path += '.json' + basedir = os.path.dirname(path) + filename = os.path.basename(path) + return read_desc(basedir, filename) + +def collect_test_desc_from_dir(basedir): + desc_array = [] + if os.path.isdir(basedir): + for filename in os.listdir(basedir): + if os.path.isdir(basedir + os.sep + filename): + desc_array += collect_test_desc_from_dir(basedir + os.sep + filename) + elif fnmatch.fnmatch(filename, '*.json'): + desc = read_desc(basedir, filename) + if desc == None: + continue + desc_array += desc + return desc_array + +if args.cmd == 'list': + fmt_entry = '%-32s %s' + desc_array = collect_test_desc_from_dir(args.dir) + print(fmt_entry % ('Name', 'Description')) + for desc in desc_array: + print(fmt_entry % (desc['_test-name'], desc['description'])) + +def test_abort(test, message): + print("\t%s: %s" % (test, message)) + print("=== Test %s ABORT ===" % (test)) + sys.exit(1) + return False + +def test_fail(test, message): + print("\t%s: %s" % (test, message)) + print("=== Test %s FAIL ===" % (test)) + return False + +def test_skip(test, message): + print("\t%s: %s" % (test, message)) + print("=== Test %s SKIP ===" % (test)) + return True + +def test_over(test): + print("=== Test %s ERROR OVER ===" % (test)) + return True + +def test_pass(test): + print("=== Test %s PASS ===" % (test)) + return True + +def test_updated(test): + print("=== Test %s UPDATED ===" % (test)) + return True + +def run_hexdump(path): + p = subprocess.Popen([args.hexdump, "-C", path], + stdout = subprocess.PIPE, + close_fds = True) + if p.wait() == 0: + return p + return None + +def show_std(stdname, data): + print("\t--- %s" % (stdname)) + for i in data.split("\n"): + print("\t%s" % i) + print("\t---") + +def cmp_std(test, data_name, data, match): + match_data = read_stdfile(match) + if match_data == None: + return test_fail(test, "Can't read " + match) + if data != match_data: + print("\t--- %s" % (data_name)) + for i in data.split("\n"): + print("\t%s" % i) + print("\t--- %s" % (match)) + for i in match_data.split("\n"): + print("\t%s" % i) + + diff = difflib.unified_diff(data.split("\n"), match_data.split("\n"), + fromfile = data_name, tofile = match) + for i in diff: + print("\t%s" % i.strip("\n")) + print("\t---") + return False + return True + +def show_diff(test, patha, pathb): + pa = run_hexdump(patha) + pb = run_hexdump(pathb) + if pa == None or pb == None: + return test_fail(test, "Can't create dumps") + sa = pa.stdout.read().decode("utf-8").strip("\n") + sb = pb.stdout.read().decode("utf-8").strip("\n") + print("\t--- hexdump %s" % (patha)) + for i in sa.split("\n"): + print("\t%s" % i) + print("\t--- hexdump %s" % (pathb)) + for i in sb.split("\n"): + print("\t%s" % i) + pa.stdout.close() + pb.stdout.close() + + diff = difflib.unified_diff(sa.split("\n"), sb.split("\n"), + fromfile = patha, tofile = pathb) + for i in diff: + print("\t%s" % i.strip("\n")) + print("\t---") + return True + +def prepare_run_opts(desc): + opts = [] + + if 'format' in desc: + opts += ['-f', desc['format']] + if 'option' in desc: + opts += desc['option'].split(" ") + for t in desc['target']: + if 'output' in t: + if 'option' in t: + opts += t['option'].split(" ") + [desc['_base-dir'] + os.sep + t['output']] + else: + opts += ['-o', desc['_base-dir'] + os.sep + t['output']] + if 'stdout' in t or 'stderr' in t: + if 'option' in t: + opts += t['option'].split(" ") + if 'source' in desc: + opts += [desc['_base-dir'] + os.sep + desc['source']] + return opts + +def exec_nasm(desc): + print("\tProcessing %s" % (desc['_test-name'])) + opts = [args.nasm] + prepare_run_opts(desc) + + print("\tExecuting %s" % (" ".join(opts))) + pnasm = subprocess.Popen(opts, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + close_fds = True) + if pnasm == None: + test_fail(desc['_test-name'], "Unable to execute test") + return None + wait_rc = pnasm.wait(); + + stdout = pnasm.stdout.read().decode("utf-8").strip("\n") + stderr = pnasm.stderr.read().decode("utf-8").strip("\n") + pnasm.stdout.close() + pnasm.stderr.close() + + if desc['_wait'] != wait_rc: + if stdout != "": + show_std("stdout", stdout) + if stderr != "": + show_std("stderr", stderr) + test_fail(desc['_test-name'], + "Unexpected ret code: " + str(wait_rc)) + return None, None, None + return pnasm, stdout, stderr + +def test_run(desc): + print("=== Running %s ===" % (desc['_test-name'])) + + pnasm, stdout, stderr = exec_nasm(desc) + if pnasm == None: + return False + + for t in desc['target']: + if 'output' in t: + output = desc['_base-dir'] + os.sep + t['output'] + match = desc['_base-dir'] + os.sep + t['match'] + if desc['_wait'] == 1: + continue + print("\tComparing %s %s" % (output, match)) + if filecmp.cmp(match, output) == False: + show_diff(desc['_test-name'], match, output) + return test_fail(desc['_test-name'], match + " and " + output + " files are different") + elif 'stdout' in t: + print("\tComparing stdout") + match = desc['_base-dir'] + os.sep + t['stdout'] + if cmp_std(desc['_test-name'], 'stdout', stdout, match) == False: + return test_fail(desc['_test-name'], "Stdout mismatch") + else: + stdout = "" + elif 'stderr' in t: + print("\tComparing stderr") + match = desc['_base-dir'] + os.sep + t['stderr'] + if cmp_std(desc['_test-name'], 'stderr', stderr, match) == False: + return test_fail(desc['_test-name'], "Stderr mismatch") + else: + stderr = "" + + if stdout != "": + show_std("stdout", stdout) + return test_fail(desc['_test-name'], "Stdout is not empty") + + if stderr != "": + show_std("stderr", stderr) + return test_fail(desc['_test-name'], "Stderr is not empty") + + return test_pass(desc['_test-name']) + +# +# Compile sources and generate new targets +def test_update(desc): + print("=== Updating %s ===" % (desc['_test-name'])) + + if 'update' in desc and desc['update'] == 'false': + return test_skip(desc['_test-name'], "No output provided") + + pnasm = exec_nasm(desc) + if pnasm == None: + return False + + stdout = pnasm.stdout.read() + stderr = pnasm.stderr.read() + pnasm.stdout.close() + pnasm.stderr.close() + + for t in desc['target']: + if 'output' in t: + output = desc['_base-dir'] + os.sep + t['output'] + match = desc['_base-dir'] + os.sep + t['match'] + print("\tMoving %s to %s" % (output, match)) + os.rename(output, match) + if 'stdout' in t: + match = desc['_base-dir'] + os.sep + t['stdout'] + print("\tMoving %s to %s" % ('stdout', match)) + with open(match, "wb") as f: + f.write(stdout) + f.close() + if 'stderr' in t: + match = desc['_base-dir'] + os.sep + t['stderr'] + print("\tMoving %s to %s" % ('stderr', match)) + with open(match, "wb") as f: + f.write(stderr) + f.close() + + return test_updated(desc['_test-name']) + +if args.cmd == 'run': + desc_array = [] + if args.test == None: + desc_array = collect_test_desc_from_dir(args.dir) + else: + desc_array = collect_test_desc_from_file(args.test) + if len(desc_array) == 0: + test_abort(args.test, "Can't obtain test descriptors") + + for desc in desc_array: + if test_run(desc) == False: + if 'error' in desc and desc['error'] == 'over': + test_over(desc['_test-name']) + else: + test_abort(desc['_test-name'], "Error detected") + +if args.cmd == 'update': + desc_array = [] + if args.test == None: + desc_array = collect_test_desc_from_dir(args.dir) + else: + desc_array = collect_test_desc_from_file(args.test) + if len(desc_array) == 0: + test_abort(args.test, "Can't obtain a test descriptors") + + for desc in desc_array: + if test_update(desc) == False: + if 'error' in desc and desc['error'] == 'over': + test_over(desc['_test-name']) + else: + test_abort(desc['_test-name'], "Error detected") |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-17 18:44:17
|
Commit-ID: b5e00ec018f1630e2bd486652cb5b6c82155e3f9 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b5e00ec018f1630e2bd486652cb5b6c82155e3f9 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 22 Apr 2018 23:49:16 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 17 Oct 2018 21:38:28 +0300 Convert README to md format And update it a bit. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- README | 23 ----------------------- README.md | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/README b/README deleted file mode 100644 index 792b038..0000000 --- a/README +++ /dev/null @@ -1,23 +0,0 @@ - NASM, the Netwide Assembler. - -Many many developers all over the net respect NASM for what it is -- a widespread (thus netwide), portable (thus netwide!), very -flexible and mature assembler tool with support for many output -formats (thus netwide!!). - -Now we have good news for you: NASM is licensed under the "simplified" -(2-clause) BSD license. This means its development is open to even -wider society of programmers wishing to improve their lovely -assembler. - -The NASM project is now situated at SourceForge.net, the most -popular Open Source development site on the Internet. - -Visit our website at http://nasm.sourceforge.net/ and our -SourceForge project at http://sourceforge.net/projects/nasm/ - -See the file CHANGES for the description of changes between revisions, -and the file AUTHORS for a list of contributors. - - With best regards, - NASM crew. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8bca043 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +NASM, the Netwide Assembler +=========================== + +Many many developers all over the net respect NASM for what it is: +a widespread (thus netwide), portable (thus netwide!), very flexible +and mature assembler tool with support for many output formats (thus netwide!!). + +Now we have good news for you: NASM is licensed under the "simplified" +(2-clause) BSD license. This means its development is open to even wider +society of programmers wishing to improve their lovely assembler. + +Visit our [nasm.us](https://www.nasm.us/) website for more details. +We are gradually moving services away from Sourceforge. For our remaining +Sourceforge services see [here](https://sourceforge.net/projects/nasm/). + +With best regards, the NASM crew. |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-14 21:30:16
|
Commit-ID: 28b69e2a633a850e724f309a5ec81bac8638084a Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=28b69e2a633a850e724f309a5ec81bac8638084a Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Mon, 15 Oct 2018 00:26:52 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Mon, 15 Oct 2018 00:26:52 +0300 NASM 2.14rc16 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 65323e6..258d9f0 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.14rc15 +2.14rc16 |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-14 18:12:16
|
Commit-ID: 1cbd48ad488cbbaafb7db65de2c6238f27267ec4 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=1cbd48ad488cbbaafb7db65de2c6238f27267ec4 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 14 Oct 2018 21:09:30 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 14 Oct 2018 21:09:30 +0300 doc: Update changes Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- doc/changes.src | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/changes.src b/doc/changes.src index 5852bc0..b2f092c 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -9,6 +9,10 @@ since 2007. \S{cl-2.14} Version 2.14 +\b Fixed null dereference in corrupted invalid single line macros. + +\b Fixed division by zero which may happen if source code is malformed. + \b Fixed out of bound access in processing of malformed segment override. \b Fixed out of bound access in certain \c{EQU} parsing. |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-14 16:27:18
|
Commit-ID: 980dd658b521afe4a688c4195410c4449a8e2468 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=980dd658b521afe4a688c4195410c4449a8e2468 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 14 Oct 2018 19:25:32 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 14 Oct 2018 19:25:32 +0300 preproc: expand_smacro -- Fix nil dereference on error path When error happened earlier we might have a.mac already handled and set to nil. https://bugzilla.nasm.us/show_bug.cgi?id=3392508 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index 0ceb243..cdf03bc 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -4473,7 +4473,9 @@ again: } if (tline->type == TOK_SMAC_END) { - tline->a.mac->in_progress = false; + /* On error path it might already be dropped */ + if (tline->a.mac) + tline->a.mac->in_progress = false; tline = delete_Token(tline); } else { t = *tail = tline; |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-13 22:51:15
|
Commit-ID: ceec0d818798aeaa75ed4907e6135b0247ed46b2 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ceec0d818798aeaa75ed4907e6135b0247ed46b2 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 14 Oct 2018 01:26:19 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 14 Oct 2018 01:49:43 +0300 eval: Eliminate division by zero When doing division we should detect if the value we're divided by is not zero. Instead of is_unknown() helper we should use is_just_unknown(). https://bugzilla.nasm.us/show_bug.cgi?id=3392515 https://bugzilla.nasm.us/show_bug.cgi?id=3392473 Reported-by: Jun <jx...@ps...> Reported-by: stuartly <sit...@gm...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/eval.c b/asm/eval.c index 1a6680f..7e727a4 100644 --- a/asm/eval.c +++ b/asm/eval.c @@ -580,7 +580,7 @@ static expr *expr5(int critical) " scalar values"); return NULL; } - if (j != '*' && !is_unknown(f) && reloc_value(f) == 0) { + if (j != '*' && !is_just_unknown(f) && reloc_value(f) == 0) { nasm_error(ERR_NONFATAL, "division by zero"); return NULL; } |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-13 20:04:17
|
Commit-ID: d94402d6f7f10ad1536a767c18c830ca7d0823a8 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=d94402d6f7f10ad1536a767c18c830ca7d0823a8 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 13 Oct 2018 23:03:24 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 13 Oct 2018 23:03:24 +0300 doc: Update changes Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- doc/changes.src | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changes.src b/doc/changes.src index 80415f8..5852bc0 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -9,6 +9,8 @@ since 2007. \S{cl-2.14} Version 2.14 +\b Fixed out of bound access in processing of malformed segment override. + \b Fixed out of bound access in certain \c{EQU} parsing. \b Fixed buffer underflow in float parsing. |