Assembler

This project aims to create a workable risc-v/x86/arm assembler using java, this is our first stage, and then we will use it to support all the embedded-asm-syntax in our tiny kernel.

We use antlr to create parser.

Project Management

Everyone in the team should be hands-on and contribute code. We follow NoPM project management methodology. Coding oriented. We have regular weekly meeting in Kowloon Tong, around 4-6 hours, to sync up our progress and share all knowledge.

Project site

gitlab https://gitlab.com/quantr/toolchain/Assembler

facebook https://www.facebook.com/groups/491276011610560

GitLab CI/CD

We rely on gitlab ci/cd to auto build our assembler, run a full test and upload the result to https://www.quantr.hk/asmweb

Peter
Derek Tang
Cheng Darren
Ken Lam
michellechw
Ronald Park
Developer performance

Finish all knowledge preparation. Feel comfortable with Intel manual, confirm the antlr designs and whole team start translating intel basic set of instruction.

2019-06-28
to
2020-03-30

closed

Netbeans RISC-V need to support

  1. create project, generate a quantr.hk json file, all our project settings go there
  2. editor supports
    • syntax highlight
    • accurate error highlight and error message
    • code completion
  3. debugger supports
    • step over
    • step in and step out only for c code
    • run and pause
  4. Hook the netbeans debugger to our simulator
    • provide memory and register window
    • allow user modify memory and register in runtime
  5. Profiler
    • mainly base on our listing file provide additional profile information about cpu cycle
  6. Well support macro
  7. for c project, support gcc and hook their inline assembly to our assembler, and make sure linker script work
2022-06-11
to
2022-12-31

active

We need to support these macro to make our assembler really work

  1. %define
  2. %ifdef
  3. label1:
  4. %skip
  5. .byte
  6. %include
  7. times 64 db 0
  8. times 64-$+buffer db ' '
2022-06-01
to
2022-12-31

active
Peter
2. our listing format 3. macro 1. how to compile an asm file
2023-02-23
07:42:41.550
Peter
0x9b 0x97 0x37 0x00 0x000000008000002a : slliw a5,a5,0x3
2022-05-25
01:49:18.226
Peter
2021-05-20
11:09:38.520
Peter
"OUTS" instruction is stated in Intel manual, but NASM doesn't support the 'LODS', 'MOVS', 'STOS', 'SCAS', 'CMPS', 'INS', or 'OUTS' instructions, but only supports the forms such as 'LODSB', 'MOVSW', and 'SCASD' which explicitly specify the size of the components of the strings being manipulated. https://www.conradk.com/codebase/2017/06/06/x86-64-assembly-from-scratch/ **I need to know the reason**
2021-05-11
14:51:00.339
desmond ng
jmp [cx] does not exist in the list, but should we give an error if it is typed by a user? Currently only have a blank result, reason behind is not because there is no error message for such case, but because "no viable alternative input", which means the parser cant even identify it.
2020-05-18
17:14:49.296
JennyTse
![Capture](/uploads/108d346527d082e075771274e89fdfc8/Capture.PNG)
2020-01-07
08:44:47.763
desmond ng
In the function "NOP EAX" (16 bit mode), opcode is NP... which may mean no prefix. In nasm, it turns out that the instruction opcode is 66 f 1f c0. What is 66 if it is not a prefix?
2020-01-04
15:08:12.276
Kelvin Wu
POP r64 should contain REX Prefix. However, nasm doesn't output the prefix for some r64 registers. Example: 1. pop rax: quantr = 40 58, nasm = 58 2. pop r10: quantr = 41 5a, nasm = 41 5a 40, 41 in the above example are the REX prefix.
2019-12-28
03:59:34.596
Peter
Why nasm supports reg64 in LAR instruction, mismatch with intel manual?![why_lar_support_reg64](/uploads/dc2cd7210fca3c24102509880e4702e6/why_lar_support_reg64.jpg)
2019-12-06
09:50:52.067
Peter
Jenny: make sure if all instructions calling all 5 functions are still works: * initLeftToken * leftInit * initRightToken * rightInit * initCondition * initIns Kelvin: Remove byte/word/dword/qword from indirect memory access, i mean the wording before []
2019-12-01
09:51:34.796
Issac Liu
Hi, you can use this tool to compare any changes of the PE file header/section values as shown like this: ![image](/uploads/76e4d634f4d7745244746c146c50b4f7/image.png) ![image](/uploads/ab867b9a09d495dbaf7d6676e95a7757/image.png) ![image](/uploads/7389e99f9f17e020d1bfd9a8cc0477a8/image.png) download here: [LPE-DLXb_1.41_UPD.zip](/uploads/33a8cb7f7bb5b1ac02313d12f8cbcb1d/LPE-DLXb_1.41_UPD.zip)
2019-11-16
17:55:34.701
Issac Liu
Same to PEView, but I think powerful than each other. ![image](/uploads/f304c54c207a28f1f098871930e93f9e/image.png) You can download the Explorer Suite and install : [ExplorerSuite.exe](/uploads/27e6c712d825c27e319ad98744d1d438/ExplorerSuite.exe)
2019-10-27
06:24:35.515
Issac Liu
build by: **cl smallPE.c** guess that it will include import table Kernel32.dll reference [smallPE.c](/uploads/befec26eceff3131e17a905091d9b0ec/smallPE.c) [smallPE.exe](/uploads/fe1009c4e9b752d9ee7d8b94e1a838f2/smallPE.exe)
2019-10-27
06:10:24.425
Issac Liu
check the PE header field by PE View build by: **cl /nologo /c smallPE.c** **link /nologo /ENTRY:main /NODEFAULTLIB /SUBSYSTEM:WINDOWS smallPE.obj** [smallPE.exe](/uploads/c4e24b53e726d8043aa0b62bfab17c7c/smallPE.exe) [smallPE.c](/uploads/3a3cfde18ae3070bb919cf6677618eb3/smallPE.c)
2019-10-27
06:08:26.458
Peter
Enhance netbeans-antlr to support antlr file formatting
2019-10-01
16:10:14.050
Peter
1. Zero padding, cut of pad "0" 2. Jenny consolidate your code into well format, let us understand and give us tutorial next sat morning 3. Desmond: a. nasm in linux example, able to run and print hello world https://cs.lmu.edu/~ray/notes/nasmtutorial/ b. find out the minimum requirement to stuck asm program and run in linux
2019-10-01
16:09:37.663
Peter
./asm/assemble.c . Nasm just have these error, not many. ``` switch (m) { case MERR_OPSIZEMISSING: nasm_error(ERR_NONFATAL, "operation size not specified"); break; case MERR_OPSIZEMISMATCH: nasm_error(ERR_NONFATAL, "mismatch in operand sizes"); break; case MERR_BRNOTHERE: nasm_error(ERR_NONFATAL, "broadcast not permitted on this operand"); break; case MERR_BRNUMMISMATCH: nasm_error(ERR_NONFATAL, "mismatch in the number of broadcasting elements"); break; case MERR_MASKNOTHERE: nasm_error(ERR_NONFATAL, "mask not permitted on this operand"); break; case MERR_DECONOTHERE: nasm_error(ERR_NONFATAL, "unsupported mode decorator for instruction"); break; case MERR_BADCPU: nasm_error(ERR_NONFATAL, "no instruction for this cpu level"); break; case MERR_BADMODE: nasm_error(ERR_NONFATAL, "instruction not supported in %d-bit mode", bits); break; case MERR_ENCMISMATCH: nasm_error(ERR_NONFATAL, "specific encoding scheme not available"); break; case MERR_BADBND: nasm_error(ERR_NONFATAL, "bnd prefix is not allowed"); break; case MERR_BADREPNE: nasm_error(ERR_NONFATAL, "%s prefix is not allowed", (has_prefix(instruction, PPS_REP, P_REPNE) ? "repne" : "repnz")); break; case MERR_REGSETSIZE: nasm_error(ERR_NONFATAL, "invalid register set size"); break; case MERR_REGSET: nasm_error(ERR_NONFATAL, "register set not valid for operand"); break; default: nasm_error(ERR_NONFATAL, "invalid combination of opcode and operands"); ```
2019-09-30
11:11:44.731
JennyTse
how do use these instructions? ![scas](/uploads/804c4b6eec0109cf145912dc83e127b4/scas.PNG)
2019-09-18
14:54:58.160
Peter
I still don't understand what situation we need to add 0x66 ? adc al,0x12 ``` bit 16 = 14 12 bit 32 = 14 12 bit 64 = 14 12 ``` adc ax,0x1234 ``` bit 16 = 15 34 12 bit 32 = 66 15 34 12 bit 64 = 66 15 34 12 ``` adc eax,0x12345678 ``` bit 16 = 66 15 78 56 34 12 bit 32 = 15 78 56 34 12 bit 64 = 15 78 56 34 12 ```
2019-09-18
14:54:45.446
Peter
Please study windows object file format. Decode the byte like what you did last time. Please stop study ELF since i am creating a library for it. ``` global _main extern _GetStdHandle@4 extern _WriteFile@20 extern _ExitProcess@4 section .text _main: ; DWORD bytes; mov ebp, esp sub esp, 4 ; hStdOut = GetstdHandle( STD_OUTPUT_HANDLE) push -11 call _GetStdHandle@4 mov ebx, eax ; WriteFile( hstdOut, message, length(message), &bytes, 0); push 0 lea eax, [ebp-4] push eax push (message_end - message) push message push ebx call _WriteFile@20 ; ExitProcess(0) push 0 call _ExitProcess@4 ; never here hlt message: db 'Hello, World', 10 message_end: ``` To compile, you'll need NASM and LINK.EXE (from Visual studio Standard Edition) ``` nasm -fwin32 hello.asm link /subsystem:console /nodefaultlib /entry:main hello.obj ```
2019-09-12
20:22:40.724
Status Job Pipeline Stage Commit Msg Timing
success #7279686818 master 333dc8f5
godaddy1-assembler
#1363077125 Peter deploy
Merge origin/master
5:37
5 days, 17 hours
failed #7279686816 master 333dc8f5
godaddy1-assembler
#1363077125 Peter deploy
Merge origin/master
2:44
5 days, 17 hours
success #7279686814 master 333dc8f5
peter8-runner
#1363077125 Peter deploy
Merge origin/master
2:11
5 days, 17 hours
success #7279686812 master 333dc8f5
peter8-runner
#1363077125 Peter build
Merge origin/master
1:1
5 days, 17 hours
success #7202160692 master 89da80ab
godaddy1-assembler
#1350606406 Peter deploy
dev
1:56
15 days, 2 hours
success #7202160668 master 89da80ab
godaddy1-assembler
#1350606406 Peter deploy
dev
1:12
15 days, 2 hours
success #7202160651 master 89da80ab
peter8-runner
#1350606406 Peter deploy
dev
1:14
15 days, 2 hours
success #7202160532 master 89da80ab
peter8-runner
#1350606406 Peter build
dev
0:37
15 days, 2 hours
success #7201713868 master d11574cc
godaddy1-assembler
#1350531998 Peter deploy
dev
2:25
15 days, 2 hours
success #7201713867 master d11574cc
godaddy1-assembler
#1350531998 Peter deploy
dev
2:37
15 days, 2 hours
success #7201713865 master d11574cc
peter8-runner
#1350531998 Peter deploy
dev
4:28
15 days, 2 hours
success #7201713864 master d11574cc
peter8-runner
#1350531998 Peter build
dev
2:49
15 days, 3 hours
success #7201658058 master 8bae06ca
godaddy1-assembler
#1350523501 Peter deploy
dev
3:2
15 days, 2 hours
success #7201658056 master 8bae06ca
godaddy1-assembler
#1350523501 Peter deploy
dev
3:5
15 days, 2 hours
success #7201658055 master 8bae06ca
peter8-runner
#1350523501 Peter deploy
dev
2:26
15 days, 3 hours
success #7201658053 master 8bae06ca
peter8-runner
#1350523501 Peter build
dev
1:32
15 days, 3 hours
success #7201564840 master 33664eb5
godaddy1-assembler
#1350509869 Peter deploy
docker works
9:41
15 days, 2 hours
success #7201564839 master 33664eb5
godaddy1-assembler
#1350509869 Peter deploy
docker works
2:16
15 days, 3 hours
success #7201564837 master 33664eb5
peter8-runner
#1350509869 Peter deploy
docker works
2:12
15 days, 3 hours
success #7201564835 master 33664eb5
peter8-runner
#1350509869 Peter build
docker works
1:20
15 days, 3 hours
success #7201380690 master ee0b0f56
godaddy1-assembler
#1350478265 Peter deploy
dev
3:34
15 days, 3 hours
success #7201380682 master ee0b0f56
godaddy1-assembler
#1350478265 Peter deploy
dev
3:16
15 days, 3 hours
success #7201380674 master ee0b0f56
peter8-runner
#1350478265 Peter deploy
dev
2:31
15 days, 3 hours
success #7201380665 master ee0b0f56
peter8-runner
#1350478265 Peter build
dev
0:59
15 days, 3 hours
success #7116741809 master 58b88e8e
godaddy1-assembler
#1335452870 Peter deploy
dev
9:31
24 days, 22 hours
success #7116741808 master 58b88e8e
godaddy1-assembler
#1335452870 Peter deploy
dev
12:31
24 days, 22 hours
success #7116741807 master 58b88e8e
peter8-runner
#1335452870 Peter deploy
dev
8:48
24 days, 22 hours
success #7116741805 master 58b88e8e
peter8-runner
#1335452870 Peter build
dev
5:21
24 days, 22 hours
success #7110061861 master ac856581
godaddy1-assembler
#1334285301 Peter deploy
dev
14:48
25 days, 20 hours
success #7110061860 master ac856581
godaddy1-assembler
#1334285301 Peter deploy
dev
13:36
25 days, 20 hours
success #7110061859 master ac856581
peter8-runner
#1334285301 Peter deploy
dev
9:22
25 days, 20 hours
success #7110061858 master ac856581
peter8-runner
#1334285301 Peter build
dev
3:26
25 days, 21 hours
failed #7108024821 master 47179c2f
peter8-runner
#1314329953 Peter test
test-riscv
5:1
26 days, 14 hours
failed #6996700719 master 47179c2f
peter8-runner
#1314329953 Peter test
test-riscv
5:1
1 month, 10 days
skipped #6994899104 master 47179c2f
#1314329953 Peter deploy
test-riscv
0:0
54 years, 6 months
skipped #6994899103 master 47179c2f
#1314329953 Peter deploy
test-riscv
0:0
54 years, 6 months
skipped #6994899102 master 47179c2f
#1314329953 Peter deploy
test-riscv
0:0
54 years, 6 months
failed #6994899101 master 47179c2f
peter8-runner
#1314329953 Peter test
test-riscv
5:0
1 month, 11 days
success #6994899100 master 47179c2f
peter8-runner
#1314329953 Peter build
test-riscv
0:15
1 month, 11 days
success #6994897993 master 5203c269
godaddy1-assembler
#1314329746 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:43
1 month, 11 days
success #6994897992 master 5203c269
godaddy1-assembler
#1314329746 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:24
1 month, 11 days
success #6994897991 master 5203c269
peter8-runner
#1314329746 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:26
1 month, 11 days
success #6994897990 master 5203c269
peter8-runner
#1314329746 Peter build
moved to Elf_Sym from Elf32_Sym
0:13
1 month, 11 days
success #6621325497 master 5203c269
peter8-runner
#1252343798 Peter build
moved to Elf_Sym from Elf32_Sym
0:16
2 months, 27 days
success #6621323921 master 5203c269
godaddy1-assembler
#1252343798 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:33
2 months, 27 days
success #6621323920 master 5203c269
godaddy1-assembler
#1252343798 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:26
2 months, 27 days
success #6621323919 master 5203c269
peter8-runner
#1252343798 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:29
2 months, 27 days
failed #6621323918 master 5203c269
peter8-runner
#1252343798 Peter build
moved to Elf_Sym from Elf32_Sym
0:20
2 months, 27 days
failed #6621321513 master 5203c269
peter8-runner
#1252332992 Peter build
moved to Elf_Sym from Elf32_Sym
0:16
2 months, 27 days
failed #6621315992 master 5203c269
peter8-runner
#1252332992 Peter build
moved to Elf_Sym from Elf32_Sym
0:12
2 months, 27 days
failed #6621299115 master 5203c269
peter8-runner
#1252332992 Peter build
moved to Elf_Sym from Elf32_Sym
0:17
2 months, 27 days
failed #6621296966 master 5203c269
peter8-runner
#1252332992 Peter build
moved to Elf_Sym from Elf32_Sym
0:27
2 months, 27 days
failed #6621288583 master 5203c269
peter8-runner
#1252332992 Peter build
moved to Elf_Sym from Elf32_Sym
0:16
2 months, 27 days
failed #6621282911 master 5203c269
peter8-runner
#1252332992 Peter build
moved to Elf_Sym from Elf32_Sym
0:14
2 months, 27 days
skipped #6621276644 master 5203c269
#1252332992 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:0
54 years, 6 months
skipped #6621276642 master 5203c269
#1252332992 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:0
54 years, 6 months
skipped #6621276641 master 5203c269
#1252332992 Peter deploy
moved to Elf_Sym from Elf32_Sym
0:0
54 years, 6 months
failed #6621276640 master 5203c269
peter8-runner
#1252332992 Peter build
moved to Elf_Sym from Elf32_Sym
0:14
2 months, 27 days
success #6168485611 master 8bba77c4
godaddy1-assembler
#1176006775 Peter deploy
dev
0:33
4 months, 28 days
success #6168485609 master 8bba77c4
godaddy1-assembler
#1176006775 Peter deploy
dev
0:25
4 months, 28 days
success #6168485607 master 8bba77c4
peter8-runner
#1176006775 Peter deploy
dev
0:43
4 months, 28 days
success #6168485606 master 8bba77c4
peter8-runner
#1176006775 Peter build
dev
0:17
4 months, 28 days
success #6073311822 master 9acb6822
godaddy1-assembler
#1160727755 Peter deploy
fixed c.or disasm
0:34
5 months, 10 days
success #6073311801 master 9acb6822
godaddy1-assembler
#1160727755 Peter deploy
fixed c.or disasm
0:26
5 months, 10 days
success #6073311788 master 9acb6822
peter8-runner
#1160727755 Peter deploy
fixed c.or disasm
0:20
5 months, 10 days
success #6073311771 master 9acb6822
peter8-runner
#1160727755 Peter build
fixed c.or disasm
0:14
5 months, 10 days
success #6069068541 master aa505305
godaddy1-assembler
#1160059152 Ken Lam deploy
dev
0:32
5 months, 11 days
success #6069068540 master aa505305
godaddy1-assembler
#1160059152 Ken Lam deploy
dev
0:34
5 months, 11 days
success #6069068539 master aa505305
peter8-runner
#1160059152 Ken Lam deploy
dev
0:25
5 months, 11 days
success #6069068538 master aa505305
peter8-runner
#1160059152 Ken Lam build
dev
0:14
5 months, 11 days
success #6059480809 master 0f4dd389
godaddy1-assembler
#1158639167 Ken Lam deploy
dev
0:30
5 months, 11 days
success #6059480808 master 0f4dd389
godaddy1-assembler
#1158639167 Ken Lam deploy
dev
0:23
5 months, 11 days
success #6059480807 master 0f4dd389
peter8-runner
#1158639167 Ken Lam deploy
dev
0:23
5 months, 11 days
success #6059480806 master 0f4dd389
peter8-runner
#1158639167 Ken Lam build
dev
0:14
5 months, 11 days
success #6041753769 master b3d4bb6c
godaddy1-assembler
#1155894489 Ken Lam deploy
dev
0:32
5 months, 13 days
success #6041753767 master b3d4bb6c
godaddy1-assembler
#1155894489 Ken Lam deploy
dev
0:26
5 months, 13 days
success #6041753766 master b3d4bb6c
peter8-runner
#1155894489 Ken Lam deploy
dev
0:21
5 months, 13 days
success #6041753765 master b3d4bb6c
peter8-runner
#1155894489 Ken Lam build
dev
0:14
5 months, 13 days
success #6038155716 master 350d933f
godaddy1-assembler
#1155232723 Peter deploy
dev
0:33
5 months, 13 days
success #6038155715 master 350d933f
godaddy1-assembler
#1155232723 Peter deploy
dev
0:23
5 months, 13 days
success #6038155714 master 350d933f
peter8-runner
#1155232723 Peter deploy
dev
0:24
5 months, 13 days
success #6038155713 master 350d933f
peter8-runner
#1155232723 Peter build
dev
0:16
5 months, 13 days
success #6038154040 master 4aee4f3c
godaddy1-assembler
#1155232388 Peter deploy
dev
0:33
5 months, 13 days
success #6038154039 master 4aee4f3c
godaddy1-assembler
#1155232388 Peter deploy
dev
0:25
5 months, 13 days
success #6038154038 master 4aee4f3c
peter8-runner
#1155232388 Peter deploy
dev
0:24
5 months, 13 days
success #6038154036 master 4aee4f3c
peter8-runner
#1155232388 Peter build
dev
0:15
5 months, 13 days
success #5948770682 master f1b70b0f
godaddy1-assembler
#1141342523 Peter deploy
dev
0:31
5 months, 25 days
success #5948770679 master f1b70b0f
godaddy1-assembler
#1141342523 Peter deploy
dev
0:24
5 months, 25 days
success #5948770677 master f1b70b0f
peter8-runner
#1141342523 Peter deploy
dev
0:25
5 months, 25 days
success #5948770673 master f1b70b0f
peter8-runner
#1141342523 Peter build
dev
0:14
5 months, 25 days
success #5929311893 master 0d03bfc5
godaddy1-assembler
#1138297222 Peter deploy
fixed wrong decode imm in c.ld
0:31
5 months, 27 days
success #5929311890 master 0d03bfc5
godaddy1-assembler
#1138297222 Peter deploy
fixed wrong decode imm in c.ld
0:24
5 months, 27 days
success #5929311889 master 0d03bfc5
peter8-runner
#1138297222 Peter deploy
fixed wrong decode imm in c.ld
0:21
5 months, 27 days
success #5929311888 master 0d03bfc5
peter8-runner
#1138297222 Peter build
fixed wrong decode imm in c.ld
0:14
5 months, 27 days
success #5928009746 optimize 4390e53e
godaddy1-assembler
#1138078350 Peter deploy
dev
0:31
5 months, 27 days
success #5928009745 optimize 4390e53e
godaddy1-assembler
#1138078350 Peter deploy
dev
0:23
5 months, 27 days
success #5928009744 optimize 4390e53e
peter8-runner
#1138078350 Peter deploy
dev
0:25
5 months, 27 days
success #5928009742 optimize 4390e53e
peter8-runner
#1138078350 Peter build
dev
0:15
5 months, 27 days
success #5925986067 master 877ffa83
godaddy1-assembler
#1137649455 Peter deploy
dev
0:32
5 months, 28 days
success #5925986066 master 877ffa83
godaddy1-assembler
#1137649455 Peter deploy
dev
0:22
5 months, 28 days