Author Topic: UASM 2.51  (Read 5937 times)

mabdelouahab

  • Member
  • ***
  • Posts: 494
Re: UASM 2.51
« Reply #15 on: March 05, 2021, 10:00:21 AM »
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

  • Member
  • **
  • Posts: 80
Re: UASM 2.51
« Reply #16 on: March 15, 2021, 01:35:07 AM »
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
Code: [Select]
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 10649EA8D069C51Dor
Code: [Select]
curl -fsSL https://apt.navegos.net/pub.key | sudo apt-key add -Source Links:
add package as sudo
Code: [Select]
sudo add-apt-repository "deb [arch=amd64] https://apt.navegos.net/ubuntu/uasm/ $(lsb_release -cs) main"or
Code: [Select]
echo "deb [arch=amd64] https://apt.navegos.net/ubuntu/uasm/ focal main" | sudo tee /etc/apt/sources.list.d/uasm.listupdate and install
Code: [Select]
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
Code: [Select]
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I /usr/include/uasm -Fo testlinux.o testlinux.asm
assemble windows object
Code: [Select]
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
Code: [Select]
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I %UASM_INC_DIR% -Fo testlinux.o testlinux.asmbash
Code: [Select]
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I $UASM_INC_DIR -Fo testlinux.o testlinux.asm
assemble windows object
command prompt
Code: [Select]
uasm -c -Cp -archAVX -W0 -Gv -zf3 -mf -win64 -I %UASM_INC_DIR% -Fo testwindows.obj testwindows.asmbash
Code: [Select]
uasm -c -Cp -archAVX -W0 -Gv -zf3 -mf -win64 -I $UASM_INC_DIR -Fo testwindows.obj testwindows.asm
« Last Edit: March 15, 2021, 05:40:30 AM by KradMoonRa »

six_L

  • Member
  • **
  • Posts: 225
Re: UASM 2.51
« Reply #17 on: March 18, 2021, 03:28:12 AM »
Code: [Select]
mov dqData,0FFFFFFFF00h
the following Error happens.
Quote
UASM 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

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: UASM 2.51
« Reply #18 on: March 18, 2021, 03:33:15 AM »
mov is a 32-bit instruction

six_L

  • Member
  • **
  • Posts: 225
Re: UASM 2.51
« Reply #19 on: March 18, 2021, 03:48:15 AM »
Code: [Select]
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?
Code: [Select]
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

  • Member
  • *****
  • Posts: 1741
  • <AMD>< 7-32>
Re: UASM 2.51
« Reply #20 on: March 18, 2021, 04:31:25 AM »
Code: [Select]
N_COLUMN STRUCT
JJ qword 16 dup(?)
N_COLUMN ENDS

I think in first place must be:
Code: [Select]
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.

KradMoonRa

  • Member
  • **
  • Posts: 80
Re: UASM 2.51
« Reply #21 on: March 18, 2021, 05:51:09 AM »
So:
Code: [Select]
mov dqData,0FFFFFFFF00h
the intel manual as no info about
mov MEM, imm64
or here for an idea.

can be done:
Code: [Select]
mov rax,0FFFFFFFF00h
mov dqData,rax
or
Code: [Select]
mov64 dqData, 0FFFFFFFF00hmov64 John macro to overcome this and other approaches
Code: [Select]
    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.

six_L

  • Member
  • **
  • Posts: 225
Re: UASM 2.51
« Reply #22 on: March 18, 2021, 07:07:08 PM »
thanks all who responed quickly. :thumbsup:

@HSE
Code: [Select]
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

  • Member
  • ****
  • Posts: 922
Re: UASM 2.51
« Reply #23 on: March 18, 2021, 09:32:09 PM »
Hi,

maybe someone also has a random error that disappears with the second recompilation of the source code - Fatal error A1105: Out of Memory ?!
« Last Edit: March 19, 2021, 08:24:13 AM by LiaoMi »

KradMoonRa

  • Member
  • **
  • Posts: 80
Re: UASM 2.51
« Reply #24 on: March 19, 2021, 06:02:19 AM »
#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.

Code: [Select]
.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
« Last Edit: March 19, 2021, 08:09:58 AM by KradMoonRa »

LiaoMi

  • Member
  • ****
  • Posts: 922
Re: UASM 2.51
« Reply #25 on: March 19, 2021, 08:23:48 AM »
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.

Code: [Select]
E:\security\security_20210318_221959.exe: failed to load pdb info.

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

Code: [Select]
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

  • Member
  • ****
  • Posts: 844
    • Uasm
Re: UASM 2.51
« Reply #26 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?

six_L

  • Member
  • **
  • Posts: 225
Re: UASM 2.51
« Reply #27 on: March 19, 2021, 08:45:14 PM »
@KradMoonRa:
Hi, That was my mistake.
All is ok.
Code: [Select]
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}>


Code: [Select]
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

  • Member
  • ****
  • Posts: 922
Re: UASM 2.51
« Reply #28 on: March 19, 2021, 08:59:36 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
Quote
maybe 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...

Code: [Select]
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
Code: [Select]
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
Code: [Select]
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

  • Member
  • **
  • Posts: 80
Re: UASM 2.51
« Reply #29 on: March 20, 2021, 03:08:05 AM »
#six_L
Hi
Good catch...

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

Code: [Select]
.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