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

Administrator
Peter
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
Placeholder Peter
2. our listing format 3. macro 1. how to compile an asm file
2023-02-23
07:42:41.550
Placeholder Peter
0x9b 0x97 0x37 0x00 0x000000008000002a : slliw a5,a5,0x3
2022-05-25
01:49:18.226
Placeholder Peter
2021-05-20
11:09:38.520
Placeholder 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
Placeholder 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
Placeholder JennyTse
![Capture](/uploads/108d346527d082e075771274e89fdfc8/Capture.PNG)
2020-01-07
08:44:47.763
Placeholder 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
Placeholder 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
Placeholder 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
Placeholder 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
Placeholder 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
Placeholder 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
Placeholder 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
Placeholder 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
Placeholder Peter
Enhance netbeans-antlr to support antlr file formatting
2019-10-01
16:10:14.050
Placeholder 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
Placeholder 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
Placeholder JennyTse
how do use these instructions? ![scas](/uploads/804c4b6eec0109cf145912dc83e127b4/scas.PNG)
2019-09-18
14:54:58.160
Placeholder 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
Placeholder 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
skipped #10692 master 3a41ad66
#4456 Administrator deploy
passwd riscv-tests addi
0:0
55 years, 3 months
skipped #10691 master 3a41ad66
#4456 Administrator deploy
passwd riscv-tests addi
0:0
55 years, 3 months
failed #10690 master 3a41ad66
#4456 Administrator build
passwd riscv-tests addi
0:0
3 months, 11 days
success #10651 master 3a41ad66
#4416 Placeholder Peter
passwd riscv-tests addi
0:52
5 months, 6 days
success #10650 master 3a41ad66
#4416 Placeholder Peter
passwd riscv-tests addi
0:26
5 months, 6 days
success #10649 master 3a41ad66
#4416 Placeholder Peter
passwd riscv-tests addi
1:50
5 months, 6 days
success #10648 master 0eea24c0
#4415 Placeholder Peter
dev
2:44
5 months, 20 days
success #10647 master 0eea24c0
#4415 Placeholder Peter
dev
1:8
5 months, 20 days
success #10646 master 0eea24c0
#4415 Placeholder Peter
dev
0:24
5 months, 20 days
success #10645 master 1e4cd0e4
#4414 Placeholder Peter
dev
0:32
5 months, 26 days
success #10644 master 1e4cd0e4
#4414 Placeholder Peter
dev
1:4
5 months, 26 days
success #10643 master 1e4cd0e4
#4414 Placeholder Peter
dev
0:23
5 months, 26 days
success #10642 master 420ad641
#4413 Placeholder Peter
dev
1:23
6 months, 4 days
success #10641 master 420ad641
#4413 Placeholder Peter
dev
0:31
6 months, 4 days
failed #10640 master 420ad641
#4413 Placeholder Peter
dev
0:30
6 months, 4 days
success #10639 master 420ad641
#4413 Placeholder Peter
dev
0:23
6 months, 4 days
success #10638 master e39df433
#4412 Placeholder Peter
dev
0:38
6 months, 5 days
failed #10637 master e39df433
#4412 Placeholder Peter
dev
0:24
6 months, 5 days
success #10636 master e39df433
#4412 Placeholder Peter
dev
0:23
6 months, 5 days
success #10635 master e39df433
#4412 Placeholder Peter
dev
0:20
6 months, 5 days
success #10634 master 0d54d559
#4411 Placeholder Peter
test-riscv
1:0
6 months, 5 days
failed #10633 master 0d54d559
#4411 Placeholder Peter
test-riscv
0:27
6 months, 5 days
success #10632 master 0d54d559
#4411 Placeholder Peter
test-riscv
0:27
6 months, 5 days
success #10631 master 0d54d559
#4411 Placeholder Peter
test-riscv
2:3
6 months, 5 days
success #10630 master 0d54d559
#4411 Placeholder Peter
test-riscv
0:26
6 months, 5 days
success #10629 master 333dc8f5
#4410 Placeholder Peter
Merge origin/master
2:11
9 months, 14 days
success #10628 master 333dc8f5
#4410 Placeholder Peter
Merge origin/master
5:37
9 months, 14 days
failed #10627 master 333dc8f5
#4410 Placeholder Peter
Merge origin/master
2:44
9 months, 14 days
success #10626 master 333dc8f5
#4410 Placeholder Peter
Merge origin/master
1:1
9 months, 14 days
success #10625 master 89da80ab
#4409 Placeholder Peter
dev
1:56
9 months, 24 days
success #10624 master 89da80ab
#4409 Placeholder Peter
dev
1:12
9 months, 24 days
success #10623 master 89da80ab
#4409 Placeholder Peter
dev
1:14
9 months, 24 days
success #10622 master 89da80ab
#4409 Placeholder Peter
dev
0:37
9 months, 24 days
success #10621 master d11574cc
#4408 Placeholder Peter
dev
4:28
9 months, 24 days
success #10620 master d11574cc
#4408 Placeholder Peter
dev
2:37
9 months, 24 days
success #10619 master d11574cc
#4408 Placeholder Peter
dev
2:25
9 months, 24 days
success #10618 master d11574cc
#4408 Placeholder Peter
dev
2:49
9 months, 24 days
success #10617 master 8bae06ca
#4407 Placeholder Peter
dev
3:2
9 months, 24 days
success #10616 master 8bae06ca
#4407 Placeholder Peter
dev
3:5
9 months, 24 days
success #10615 master 8bae06ca
#4407 Placeholder Peter
dev
2:26
9 months, 24 days
success #10614 master 8bae06ca
#4407 Placeholder Peter
dev
1:32
9 months, 24 days
success #10613 master 33664eb5
#4406 Placeholder Peter
docker works
2:12
9 months, 24 days
success #10612 master 33664eb5
#4406 Placeholder Peter
docker works
2:16
9 months, 24 days
success #10611 master 33664eb5
#4406 Placeholder Peter
docker works
9:41
9 months, 24 days
success #10610 master 33664eb5
#4406 Placeholder Peter
docker works
1:20
9 months, 24 days
success #10609 master ee0b0f56
#4405 Placeholder Peter
dev
2:31
9 months, 24 days
success #10608 master ee0b0f56
#4405 Placeholder Peter
dev
3:16
9 months, 24 days
success #10607 master ee0b0f56
#4405 Placeholder Peter
dev
3:34
9 months, 24 days
success #10606 master ee0b0f56
#4405 Placeholder Peter
dev
0:59
9 months, 24 days
success #10605 master 58b88e8e
#4404 Placeholder Peter
dev
9:31
10 months, 3 days
success #10604 master 58b88e8e
#4404 Placeholder Peter
dev
8:48
10 months, 3 days
success #10603 master 58b88e8e
#4404 Placeholder Peter
dev
12:31
10 months, 3 days
success #10602 master 58b88e8e
#4404 Placeholder Peter
dev
5:21
10 months, 3 days
success #10601 master ac856581
#4403 Placeholder Peter
dev
13:36
10 months, 4 days
success #10600 master ac856581
#4403 Placeholder Peter
dev
9:22
10 months, 4 days
success #10599 master ac856581
#4403 Placeholder Peter
dev
14:48
10 months, 4 days
success #10598 master ac856581
#4403 Placeholder Peter
dev
3:26
10 months, 4 days
skipped #10597 master 47179c2f
#4402 Placeholder Peter
test-riscv
0:0
55 years, 3 months
skipped #10596 master 47179c2f
#4402 Placeholder Peter
test-riscv
0:0
55 years, 3 months
skipped #10595 master 47179c2f
#4402 Placeholder Peter
test-riscv
0:0
55 years, 3 months
failed #10594 master 47179c2f
#4402 Placeholder Peter
test-riscv
5:1
10 months, 18 days
failed #10593 master 47179c2f
#4402 Placeholder Peter
test-riscv
5:1
10 months, 4 days
failed #10592 master 47179c2f
#4402 Placeholder Peter
test-riscv
5:0
10 months, 19 days
success #10591 master 47179c2f
#4402 Placeholder Peter
test-riscv
0:15
10 months, 19 days
success #10590 master 5203c269
#4401 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:43
10 months, 19 days
success #10589 master 5203c269
#4401 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:24
10 months, 19 days
success #10588 master 5203c269
#4401 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:26
10 months, 19 days
success #10587 master 5203c269
#4401 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:13
10 months, 19 days
success #10586 master 5203c269
#4400 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:29
1 year, 6 days
success #10585 master 5203c269
#4400 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:26
1 year, 6 days
success #10584 master 5203c269
#4400 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:33
1 year, 6 days
success #10583 master 5203c269
#4400 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:16
1 year, 6 days
failed #10582 master 5203c269
#4400 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:20
1 year, 6 days
skipped #10581 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:0
55 years, 3 months
skipped #10580 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:0
55 years, 3 months
skipped #10579 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:0
55 years, 3 months
failed #10578 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:27
1 year, 6 days
failed #10577 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:14
1 year, 6 days
failed #10576 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:12
1 year, 6 days
failed #10575 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:16
1 year, 6 days
failed #10574 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:17
1 year, 6 days
failed #10573 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:14
1 year, 6 days
failed #10572 master 5203c269
#4399 Placeholder Peter
moved to Elf_Sym from Elf32_Sym
0:16
1 year, 6 days
success #10571 master 8bba77c4
#4398 Placeholder Peter
dev
0:33
1 year, 2 months
success #10570 master 8bba77c4
#4398 Placeholder Peter
dev
0:43
1 year, 2 months
success #10569 master 8bba77c4
#4398 Placeholder Peter
dev
0:25
1 year, 2 months
success #10568 master 8bba77c4
#4398 Placeholder Peter
dev
0:17
1 year, 2 months
success #10567 master 9acb6822
#4397 Placeholder Peter
fixed c.or disasm
0:34
1 year, 2 months
success #10566 master 9acb6822
#4397 Placeholder Peter
fixed c.or disasm
0:20
1 year, 2 months
success #10565 master 9acb6822
#4397 Placeholder Peter
fixed c.or disasm
0:26
1 year, 2 months
success #10564 master 9acb6822
#4397 Placeholder Peter
fixed c.or disasm
0:14
1 year, 2 months
success #10563 master aa505305
#4396 Placeholder Ken Lam
dev
0:25
1 year, 2 months
success #10562 master aa505305
#4396 Placeholder Ken Lam
dev
0:32
1 year, 2 months
success #10561 master aa505305
#4396 Placeholder Ken Lam
dev
0:34
1 year, 2 months
success #10560 master aa505305
#4396 Placeholder Ken Lam
dev
0:14
1 year, 2 months
success #10559 master 0f4dd389
#4395 Placeholder Ken Lam
dev
0:30
1 year, 2 months
success #10558 master 0f4dd389
#4395 Placeholder Ken Lam
dev
0:23
1 year, 2 months
success #10557 master 0f4dd389
#4395 Placeholder Ken Lam
dev
0:23
1 year, 2 months
success #10556 master 0f4dd389
#4395 Placeholder Ken Lam
dev
0:14
1 year, 2 months
success #10555 master b3d4bb6c
#4394 Placeholder Ken Lam
dev
0:32
1 year, 2 months