News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

UASM 2.51

Started by johnsa, March 01, 2021, 01:14:16 AM

Previous topic - Next topic

mabdelouahab

Thank you John, is a great work!
It works well on Linux

Assemble started...UASM v2.50, Mar  4 2021, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

main.asm: 35 lines, 5 passes, 131509 ms, 0 warnings, 0 errors
... SUCCESS

The previous version (UASM v2.50, Oct 10 2020) was generating: Error A2169: General Failure

KradMoonRa

#16
Thank you John,

From Your insights and code changes I managed to debug the code properly with gdb.

* Fix VPTESTMW VPTESTMM VPTESTNMW VPTESTMB
* Finally found the bug that I have added by adding the calling conventions to 32bits, reference pointer never initialized in if statement. Seg faults. That's as hard to debug.
* Added Setup Project for windows.
* Added ubuntu/debian package manager project.
* Fix dbgcv.c (_getcwd) to portable code.
* Fix dbgcv.c (_pgmptr) to portable code.
* Striped macrolib to *.inc files, for better contribution without the need to recompile UASM. 
* And more...

Check setup installer for.

Windows Setup, add the necessary path environment variables, and MSBuild BuildCustomizations for VS2019.

windows:
Win Setup

Linux installs to /usr/bin/uasm and inc files to /usr/include/uasm

Linux:
Instructions:
add the sign key to your trusted keys
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 10649EA8D069C51D
or
curl -fsSL https://apt.navegos.net/pub.key | sudo apt-key add -
Source Links:
add package as sudo
sudo add-apt-repository "deb [arch=amd64] https://apt.navegos.net/ubuntu/uasm/ $(lsb_release -cs) main"
or
echo "deb [arch=amd64] https://apt.navegos.net/ubuntu/uasm/ focal main" | sudo tee /etc/apt/sources.list.d/uasm.list
update and install
sudo apt-get update && sudo apt-get install uasm


I go for a pull request to the master branch or new branch if good insights that's it's ok here.


Some test:
Download attached zip.

linux enviroment
assemble linux object
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I /usr/include/uasm -Fo testlinux.o testlinux.asm

assemble windows object
uasm -c -Cp -archAVX -W0 -Gv -zf3 -mf -win64 -I /usr/include/uasm -Fo testwindows.obj testwindows.asm

windows enviroment
assemble linux object
command prompt
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I %UASM_INC_DIR% -Fo testlinux.o testlinux.asm
bash
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I $UASM_INC_DIR -Fo testlinux.o testlinux.asm

assemble windows object
command prompt
uasm -c -Cp -archAVX -W0 -Gv -zf3 -mf -win64 -I %UASM_INC_DIR% -Fo testwindows.obj testwindows.asm
bash
uasm -c -Cp -archAVX -W0 -Gv -zf3 -mf -win64 -I $UASM_INC_DIR -Fo testwindows.obj testwindows.asm
The uasmlib

six_L

mov dqData,0FFFFFFFF00h

the following Error happens.
QuoteUASM v2.51, Feb 27 2021, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

ij_4.asm(131) : Error A2237: Constant value too large: FFFFFFFF00h
ij_4.asm: 220 lines, 1 passes, 108 ms, 0 warnings, 1 errors
Say you, Say me, Say the codes together for ever.

jj2007

mov is a 32-bit instruction

six_L

N_COLUMN STRUCT
JJ qword 16 dup(?)
N_COLUMN ENDS

MCRYPT_AES_256_KEY_STATE STRUCT
Key byte 32 dup(?)
IV byte 16 dup(?)
EncryIJ N_COLUMN 15 dup(<>)
DecryIJ N_COLUMN 15 dup(<>)
Feedback        byte 16 dup(?)
MCRYPT_AES_256_KEY_STATE ENDS
.data?
Xm_Stc MCRYPT_AES_256_KEY_STATE <>
.data
Xm_Stc1 MCRYPT_AES_256_KEY_STATE <>

why don't support this express?
N_COLUMN STRUCT
JJ qword 16 dup(?)
N_COLUMN ENDS

MCRYPT_AES_256_KEY_STATE STRUCT
Key byte 32 dup(?)
IV byte 16 dup(?)
EncryIJ N_COLUMN 15 dup(<?>)
DecryIJ N_COLUMN 15 dup(<?>)
Feedback        byte 16 dup(?)
MCRYPT_AES_256_KEY_STATE ENDS
.data?
Xm_Stc MCRYPT_AES_256_KEY_STATE <?>
.data
Xm_Stc1 MCRYPT_AES_256_KEY_STATE <0>

Say you, Say me, Say the codes together for ever.

HSE

Quote from: six_L on March 18, 2021, 03:48:15 AM
N_COLUMN STRUCT
JJ qword 16 dup(?)
N_COLUMN ENDS


I think in first place must be:
N_COLUMN STRUCT
JJ byte 16 dup(?)
N_COLUMN ENDS


And it's an structure with several elements, you can't initialize that with one element.
Equations in Assembly: SmplMath

KradMoonRa

So:
mov dqData,0FFFFFFFF00h

the intel manual as no info about
mov MEM, imm64
or here for an idea.

can be done:

mov rax,0FFFFFFFF00h
mov dqData,rax

or
mov64 dqData, 0FFFFFFFF00h
mov64 John macro to overcome this and other approaches
    MOV64 MACRO dst:REQ, imm:REQ
        MOV DWORD PTR dst, LOW32(imm)
        MOV DWORD PTR dst + 4, HIGH32(imm)
    ENDM


for  dup(?) initializer in one string, gonna think about that. I have done one fixed size macro for sub-struct initializer but not with dup.
The uasmlib

six_L

thanks all who responed quickly. :thumbsup:

@HSE
typedef struct _CRYPT_AES_256_KEY_STATE {
  unsigned char Key[32];
  unsigned char IV[16];
  unsigned char EncryptionState[15][16];
  unsigned char DecryptionState[15][16];
  unsigned char Feedback[16];
} CRYPT_AES_256_KEY_STATE, *PCRYPT_AES_256_KEY_STATE;

on the basis of the above struct, it's correct. but Word(DWORD,QWORD) are required as units for encryption or decryption at sometimes, such as Unicode,UTF-8,UTF-16.

@KradMoonRa
hope you are keeping the great work to update.

Say you, Say me, Say the codes together for ever.

LiaoMi

#23
Hi,

maybe someone also has a random error that disappears with the second recompilation of the source code - Fatal error A1105: Out of Memory ?!

KradMoonRa

#24
#six_L hey i'm trying, but no success for mixed structs with dup yet( :dazzled:)...

* produces the correct results, but mixing struct with dup with sub struct with dup no. all struct with dup ok, all struct with sub struct with dup ok.


.data?
N_COLUMN STRUCT
    JJ qword 16 dup(?)
N_COLUMN ENDS

N_COLUMB STRUCT
    jbb byte 1 dup(?)
N_COLUMB ENDS

MCRYPT_AES_256_KEY_STATE STRUCT
    Key     N_COLUMB 32 dup(<?>)
    IV      N_COLUMB 16 dup(<?>)
    EncryIJ     N_COLUMN 15 dup(<?>)
    DecryIJ     N_COLUMN 15 dup(<?>)
    Feedback    N_COLUMB 16 dup(<?>)
MCRYPT_AES_256_KEY_STATE ENDS

.data?
;public Xm_StcN
;Xm_StcN     N_COLUMN  < {?} >                      ;ok
;public Xm_StcM
;Xm_StcM     MCRYPT_AES_256_KEY_STATE <>            ;ok only byte struct
;public Xm_StcK
;Xm_StcK     MCRYPT_AES_256_KEY_STATE { < {} > }     ;ok only dup of struct with dup
public Xm_StcX
Xm_StcX     MCRYPT_AES_256_KEY_STATE { < {} >, < {} >, < {} >, < {} >, < {} > }  ;ok only if all dup of sub struct with dup
.data
;public Xm_Stc1N
;Xm_Stc1N     N_COLUMN  < {0} >                     ;ok
;public Xm_Stc1M
;Xm_Stc1M     MCRYPT_AES_256_KEY_STATE  {''}        ;ok only byte struct
;public Xm_Stc1K
;Xm_Stc1K     MCRYPT_AES_256_KEY_STATE { < {} > }    ;ok only dup of struct with dup
public Xm_Stc1X
Xm_Stc1X     MCRYPT_AES_256_KEY_STATE { < {} >, < {} >, < {} >, < {} >, < {} > }  ;ok only if all dup of sub struct with dup

The uasmlib

LiaoMi

Hi johnsa,

with a new CodeView (-Zi5 -Zi8), I get this message during linking

security.obj : warning LNK4209: debugging information corrupt; recompile module; linking object as if no debug info

Without these flags, there is no message.

E:\security\security_20210318_221959.exe: failed to load pdb info.

Do you want to browse for the pdb file on disk?


Translated Windows SDK 10.0 32 bits
security.asm: 257 lines, 2 passes, 2046 ms, 0 warnings, 0 errors
Microsoft (R) Incremental Linker Version 14.28.29337.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Starting pass 1
Processed /DEFAULTLIB:ntdll.lib
Processed /DEFAULTLIB:ntdllp.lib
security.obj : warning LNK4209: debugging information corrupt; recompile module; linking object as if no debug info
Processed /DEFAULTLIB:kernel32.Lib
Processed /DEFAULTLIB:User32.Lib
Processed /DEFAULTLIB:ntoskrnl.lib
Processed /DEFAULTLIB:Advapi32.lib
Processed /DEFAULTLIB:ucrt.lib
Processed /DEFAULTLIB:crt10_32.lib
module 'security.obj' unsafe for SAFESEH image.

johnsa

Hi,

I too have found this corrupt debugging info in one of my projects. 100 other test-cases and projects were fine.
I spent some time trying to nail it down, what was odd is that the error seemed to come and go depending on which lines of code I commented, ie. it looked like it was related to symbol positioning.
It was hard to follow in my one example where it occurred as the project is about 10k lines, having a smaller test-case that does this would help.

I'm not sure if Nidud has encountered this yet and maybe has some ideas?

six_L

@KradMoonRa:
Hi, That was my mistake.
All is ok.

EncryIJ N_COLUMN 15 dup(<?>) ======>EncryIJ N_COLUMN 15 dup(<{?}>)
DecryIJ N_COLUMN 15 dup(<?>) ======>DecryIJ N_COLUMN 15 dup(<{?}>)
.data?
Xm_Stc MCRYPT_AES_256_KEY_STATE <?> ============>Xm_Stc MCRYPT_AES_256_KEY_STATE <{?}>
.data
Xm_Stc MCRYPT_AES_256_KEY_STATE <0> ============>Xm_Stc MCRYPT_AES_256_KEY_STATE <{0}>



N_COLUMN STRUCT
JJ dword 16 dup(?)
N_COLUMN ENDS

MCRYPT_AES_256_KEY_STATE STRUCT
Key byte 32 dup(?)
IV byte 16 dup(?)
EncryIJ N_COLUMN 15 dup(<{?}>)
DecryIJ N_COLUMN 15 dup(<{?}>)
Feedback        byte 16 dup(?)
MCRYPT_AES_256_KEY_STATE ENDS
Say you, Say me, Say the codes together for ever.

LiaoMi

Quote from: johnsa on March 19, 2021, 08:02:22 PM
Hi,

I too have found this corrupt debugging info in one of my projects. 100 other test-cases and projects were fine.
I spent some time trying to nail it down, what was odd is that the error seemed to come and go depending on which lines of code I commented, ie. it looked like it was related to symbol positioning.
It was hard to follow in my one example where it occurred as the project is about 10k lines, having a smaller test-case that does this would help.

I'm not sure if Nidud has encountered this yet and maybe has some ideas?

Hi John,

this is probably the same bug
Quotemaybe someone also has a random error that disappears with the second recompilation of the source code - Fatal error A1105: Out of Memory ?!

Since the results are different every time, it is as if the error occurs in a random manner. This time the error occurred in a different place...

Starting pass 1
Processed /DEFAULTLIB:ntdll.lib
Processed /DEFAULTLIB:ntdllp.lib
Processed /DEFAULTLIB:kernel32.Lib
Processed /DEFAULTLIB:User32.Lib
Processed /DEFAULTLIB:ntoskrnl.lib
Processed /DEFAULTLIB:Advapi32.lib
Processed /DEFAULTLIB:ucrt.lib
Processed /DEFAULTLIB:crt10_32.lib
security.obj : warning LNK4209: debugging information corrupt; recompile module; linking object as if no debug info


And here is the second example - test.obj : warning LNK4200: corrupt line number information in object file; ignored
Starting pass 2
     test.obj
test.obj : warning LNK4200: corrupt line number information in object file; ignored
     ntdllp.lib(ntdll.dll)
     ntdllp.lib(ntdll.dll)
     ntdllp.lib(ntdll.dll)
     ntdllp.lib(ntdll.dll)
     ntdllp.lib(ntdll.dll)
     kernel32.Lib(KERNEL32.dll)
     kernel32.Lib(KERNEL32.dll)
     kernel32.Lib(KERNEL32.dll)
     kernel32.Lib(KERNEL32.dll)
Finished pass 2


On the third try, I received the already known message - test.obj : warning LNK4209: debugging information corrupt; recompile module; linking object as if no debug info
Translated Windows SDK 10.0 32 bits
test.asm: 129 lines, 2 passes, 1190 ms, 0 warnings, 0 errors
Microsoft (R) Incremental Linker Version 14.28.29337.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Starting pass 1
Processed /DEFAULTLIB:ntdll.lib
Processed /DEFAULTLIB:ntdllp.lib
test.obj : warning LNK4209: debugging information corrupt; recompile module; linking object as if no debug info
Processed /DEFAULTLIB:kernel32.Lib
Processed /DEFAULTLIB:User32.Lib
Processed /DEFAULTLIB:ntoskrnl.lib
Processed /DEFAULTLIB:ucrt.lib
module 'test.obj' unsafe for SAFESEH image.


Different symptoms occur each time. This one is the most serious - Fatal error A1105: Out of Memory, but it is very difficult to get it. I have attached a test case with different results, you can see two log files - test_20210319_104316.assemblylog, test_20210319_104510.assemblylog. Please note that both pdb files differ in size! (!!!)




KradMoonRa

#six_L
Hi
Good catch...

But definitively, the data initiator only initiates 1 byte all the other bytes defaults to 0.


.data?
N_COLUMN STRUCT
    JJ dword 16 dup(?)      ;64 bytes
N_COLUMN ENDS

MCRYPT_AES_256_KEY_STATE STRUCT
    Key     byte 32 dup(?)              ;32 bytes
    IV      byte 16 dup(?)              ;16 bytes
    EncryIJ     N_COLUMN 15 dup(<{?}>)  ;960 bytes
    DecryIJ     N_COLUMN 15 dup(<{?}>)  ;960 bytes
    Feedback    byte 16 dup(?)          ;16 bytes
MCRYPT_AES_256_KEY_STATE ENDS

.data?
public Xm_Stc
Xm_Stc      MCRYPT_AES_256_KEY_STATE <{?}>
.data
public Xm_Stc1
Xm_Stc1     MCRYPT_AES_256_KEY_STATE <{-1,-1,-1,-1,-1,-1,-1}>  ; Here the value can grow but only the first 7 bytes are changed the other bytes defaults to 0 empty initiator. Or write 1984 times -1


The uasmlib