diff --git a/.editorconfig b/.editorconfig index 7f5b23fc3..ee80e45e9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,9 +1,10 @@ -[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}] charset = utf-8 -indent_size = 2 +indent_size = 4 indent_style = space insert_final_newline = true trim_trailing_whitespace = true - end_of_line = lf -max_line_length = 100 +max_line_length = 80 + +[*.{vue,json,jsonc,html,css,config.ts,lock,yaml,yml}] +indent_size = 2 diff --git a/README.md b/README.md index 75597337d..927f3c645 100644 --- a/README.md +++ b/README.md @@ -296,8 +296,8 @@

Authors

- * :technologist: [Diego Camarmas Alonso](https://github.com/) - * :technologist: [Félix García Carballeira](https://www.researchgate.net/profile/Felix_Garcia-Carballeira) + * :technologist: [Diego Camarmas Alonso](https://github.com/dcamarmas) + * :technologist: [Félix García Carballeira](https://github.com/fgcarbal) * :technologist: [Alejandro Calderón Mateos](https://github.com/acaldero) ### Contributors @@ -305,10 +305,10 @@ * :technologist: [Lucas Elvira Martín](https://github.com/luelvira) (RISC-V and several improvements) * :technologist: [José Antonio Verde Jiménez](https://github.com/joseaverde) (Real hardware integration) * :technologist: [Álvaro Guerrero Espinosa](https://github.com/ALVAROPING1) (New compiler) - * :technologist: [Elisa Utrilla Arroyo](https://github.com/EUtrilla2002) (Real hardware integration) + * :technologist: [Elisa Utrilla Arroyo](https://github.com/EUtrilla2002) (Real hardware integration, Arduino integration) * :technologist: [Luis Daniel Casais Mezquida](https://github.com/rajayonin) (Website migration, interrupts, timers, and memory-mapped devices) * :technologist: [Jorge Ramos Santana](https://github.com/mjorgers) (core/tests rewrite, new web UI, new CLI, RV64 & Z80 architectures) - * :technologist: [Juan Carlos Cano Resa](https://github.com/Jotaceee) (SAIL integration) + * :technologist: [Juan Carlos Cano Resa](https://github.com/Jotaceee) (Sail integration) @@ -317,6 +317,24 @@
+:atom: 6.1.x + + - [x] Sail integration: + * RISC-V 32 and RISC-V 64 full specification supported + * Cache module integrated + - [x] Arduino support: + * ESP32 Microcontroller + * Arduino GPIO simulation UI + - [x] New activity bar + +
+ + - Source Code: https://github.com/creatorsim/creator-v6.1 + - Try Version: https://creatorsim.github.io/creator-v6.1 + +
+ +
:atom: 6.0.x - [x] **BREAKING CHANGES**: diff --git a/architecture.json b/architecture.json deleted file mode 100644 index 91826afab..000000000 --- a/architecture.json +++ /dev/null @@ -1,307 +0,0 @@ -{ - "version": "2.0.0", - "config": { - "name": "Simple8Bit", - "word_size": 8, - "byte_size": 8, - "description": "A simple custom 8-bit architecture", - "endianness": "little_endian", - "memory_alignment": true, - "passing_convention": true, - "sensitive_register_name": false, - "main_function": "main", - "comment_prefix": ";", - "start_address": 0, - "pc_offset": 0 - }, - "templates": [ - { - "name": "standard", - "nwords": 1, - "clk_cycles": 1, - "fields": [ - { - "name": "opcode", - "type": "co", - "startbit": 7, - "stopbit": 0, - "order": 0 - } - ] - } - ], - "components": [ - { - "name": "Control registers", - "type": "ctrl_registers", - "double_precision": false, - "elements": [ - { - "name": [ - "PC" - ], - "nbits": 8, - "encoding": 0, - "value": 0, - "default_value": 0, - "properties": [ - "read", - "write", - "program_counter" - ] - } - ] - }, - { - "name": "Integer registers", - "type": "int_registers", - "double_precision": false, - "elements": [ - { - "name": [ - "A" - ], - "encoding": 0, - "nbits": 8, - "value": 0, - "default_value": 0, - "properties": [ - "read", - "write" - ] - }, - { - "name": [ - "B" - ], - "encoding": 1, - "nbits": 8, - "value": 0, - "default_value": 0, - "properties": [ - "read", - "write" - ] - }, - { - "name": [ - "SP" - ], - "encoding": 2, - "nbits": 8, - "value": 0, - "default_value": 0, - "properties": [ - "read", - "write", - "stack_pointer" - ] - } - ] - } - ], - "memory_layout": { - "text": { - "start": 0, - "end": 1023 - }, - "data": { - "start": 1024, - "end": 32767 - }, - "stack": { - "start": 32768, - "end": 65535 - } - }, - "instructions": [ - { - "name": "nop", - "nwords": 1, - "clk_cycles": 1, - "fields": [ - { - "name": "opcode", - "type": "co", - "startbit": 7, - "stopbit": 0, - "order": 0, - "value": "00000000" - } - ], - "template": "standard", - "definition": "", - "type": "Other", - "help": "", - "signature_definition": "F0", - "signature_pretty": "nop", - "co": "00000000" - }, - { - "name": "add", - "nwords": 3, - "clk_cycles": 5, - "fields": [ - { - "name": "opcode", - "type": "co", - "startbit": 7, - "stopbit": 0, - "order": 0, - "value": "00100000" - }, - { - "type": "INT-Reg", - "word": 1, - "startbit": 7, - "stopbit": 0, - "order": 1, - "suffix": ",", - "name": "reg1" - }, - { - "type": "INT-Reg", - "word": 2, - "order": 2, - "startbit": 7, - "stopbit": 0, - "name": "reg2" - } - ], - "template": "standard", - "definition": "registers[reg1] = (registers[reg1] + registers[reg2]) & 0xFFn;\n", - "type": "Other", - "help": "", - "signature_definition": "F0 F1, F2", - "signature_pretty": "add reg1, reg2", - "co": "00100000" - }, - { - "name": "load", - "nwords": 3, - "clk_cycles": 4, - "fields": [ - { - "name": "opcode", - "type": "co", - "startbit": 7, - "stopbit": 0, - "order": 0, - "value": "10000001" - }, - { - "type": "INT-Reg", - "word": 1, - "startbit": 7, - "stopbit": 0, - "order": 1, - "suffix": ",", - "name": "reg" - }, - { - "type": "imm-signed", - "word": 2, - "startbit": 7, - "stopbit": 0, - "order": 2, - "name": "number" - } - ], - "template": "standard", - "definition": "registers[reg] = number\n", - "type": "Other", - "help": "", - "signature_definition": "F0 F1, F2", - "signature_pretty": "load reg, number", - "co": "10000001" - } - ], - "directives": [ - { - "name": ".data", - "action": "data_segment", - "size": null - }, - { - "name": ".text", - "action": "code_segment", - "size": null - }, - { - "name": ".bss", - "action": "global_symbol", - "size": null - }, - { - "name": ".zero", - "action": "space", - "size": 1 - }, - { - "name": ".space", - "action": "space", - "size": 1 - }, - { - "name": ".align", - "action": "align", - "size": null - }, - { - "name": ".balign", - "action": "balign", - "size": null - }, - { - "name": ".globl", - "action": "global_symbol", - "size": null - }, - { - "name": ".string", - "action": "ascii_null_end", - "size": null - }, - { - "name": ".asciz", - "action": "ascii_null_end", - "size": null - }, - { - "name": ".ascii", - "action": "ascii_not_null_end", - "size": null - }, - { - "name": ".byte", - "action": "byte", - "size": 1 - }, - { - "name": ".half", - "action": "half_word", - "size": 2 - }, - { - "name": ".word", - "action": "word", - "size": 4 - }, - { - "name": ".dword", - "action": "double_word", - "size": 8 - }, - { - "name": ".float", - "action": "float", - "size": 4 - }, - { - "name": ".double", - "action": "double", - "size": 8 - } - ], - "pseudoinstructions": [] -} \ No newline at end of file diff --git a/architecture/MIPS32.yml b/architecture/MIPS32.yml index d61d0743b..7c01aae82 100644 --- a/architecture/MIPS32.yml +++ b/architecture/MIPS32.yml @@ -132,7 +132,7 @@ components: double_precision: false elements: - name: - - r0 + - "0" - zero nbits: 32 value: 0 @@ -141,7 +141,7 @@ components: properties: - read - name: - - r1 + - "1" - at nbits: 32 value: 0 @@ -151,7 +151,7 @@ components: - read - write - name: - - r2 + - "2" - v0 nbits: 32 value: 0 @@ -161,7 +161,7 @@ components: - read - write - name: - - r3 + - "3" - v1 nbits: 32 value: 0 @@ -171,7 +171,7 @@ components: - read - write - name: - - r4 + - "4" - a0 nbits: 32 value: 0 @@ -181,7 +181,7 @@ components: - read - write - name: - - r5 + - "5" - a1 nbits: 32 value: 0 @@ -191,7 +191,7 @@ components: - read - write - name: - - r6 + - "6" - a2 nbits: 32 value: 0 @@ -201,7 +201,7 @@ components: - read - write - name: - - r7 + - "7" - a3 nbits: 32 value: 0 @@ -211,7 +211,7 @@ components: - read - write - name: - - r8 + - "8" - t0 nbits: 32 value: 0 @@ -221,7 +221,7 @@ components: - read - write - name: - - r9 + - "9" - t1 nbits: 32 value: 0 @@ -231,7 +231,7 @@ components: - read - write - name: - - r10 + - "10" - t2 nbits: 32 value: 0 @@ -241,7 +241,7 @@ components: - read - write - name: - - r11 + - "11" - t3 nbits: 32 value: 0 @@ -251,7 +251,7 @@ components: - read - write - name: - - r12 + - "12" - t4 nbits: 32 value: 0 @@ -261,7 +261,7 @@ components: - read - write - name: - - r13 + - "13" - t5 nbits: 32 value: 0 @@ -271,7 +271,7 @@ components: - read - write - name: - - r14 + - "14" - t6 nbits: 32 value: 0 @@ -281,7 +281,7 @@ components: - read - write - name: - - r15 + - "15" - t7 nbits: 32 value: 0 @@ -291,7 +291,7 @@ components: - read - write - name: - - r16 + - "16" - s0 nbits: 32 value: 0 @@ -302,7 +302,7 @@ components: - write - saved - name: - - r17 + - "17" - s1 nbits: 32 value: 0 @@ -313,7 +313,7 @@ components: - write - saved - name: - - r18 + - "18" - s2 nbits: 32 value: 0 @@ -324,7 +324,7 @@ components: - write - saved - name: - - r19 + - "19" - s3 nbits: 32 value: 0 @@ -335,7 +335,7 @@ components: - write - saved - name: - - r20 + - "20" - s4 nbits: 32 value: 0 @@ -346,7 +346,7 @@ components: - write - saved - name: - - r21 + - "21" - s5 nbits: 32 value: 0 @@ -357,7 +357,7 @@ components: - write - saved - name: - - r22 + - "22" - s6 nbits: 32 value: 0 @@ -368,7 +368,7 @@ components: - write - saved - name: - - r23 + - "23" - s7 nbits: 32 value: 0 @@ -379,7 +379,7 @@ components: - write - saved - name: - - r24 + - "24" - t8 nbits: 32 value: 0 @@ -389,7 +389,7 @@ components: - read - write - name: - - r25 + - "25" - t9 nbits: 32 value: 0 @@ -399,7 +399,7 @@ components: - read - write - name: - - r26 + - "26" - k0 nbits: 32 value: 0 @@ -409,7 +409,7 @@ components: - read - write - name: - - r27 + - "27" - k1 nbits: 32 value: 0 @@ -419,7 +419,7 @@ components: - read - write - name: - - r28 + - "28" - gp nbits: 32 value: 0 @@ -430,18 +430,18 @@ components: - write - global_pointer - name: - - r29 + - "29" - sp nbits: 32 - value: 268435452 - default_value: 268435452 + value: 0x0FFFFFFC + default_value: 0x0FFFFFFC encoding: 29 properties: - read - write - stack_pointer - name: - - r30 + - "30" - fp nbits: 32 value: 0 @@ -452,11 +452,11 @@ components: - write - frame_pointer - name: - - r31 + - "31" - ra nbits: 32 - value: 4294967295 - default_value: 4294967295 + value: -1 + default_value: -1 encoding: 31 properties: - read @@ -467,6 +467,7 @@ components: elements: - name: - f0 + - FP0 nbits: 32 value: 0 default_value: 0 @@ -485,6 +486,7 @@ components: - write - name: - f2 + - FP2 nbits: 32 value: 0 default_value: 0 @@ -503,6 +505,7 @@ components: - write - name: - f4 + - FP4 nbits: 32 value: 0 default_value: 0 @@ -521,6 +524,7 @@ components: - write - name: - f6 + - FP6 nbits: 32 value: 0 default_value: 0 @@ -539,6 +543,7 @@ components: - write - name: - f8 + - FP8 nbits: 32 value: 0 default_value: 0 @@ -557,6 +562,7 @@ components: - write - name: - f10 + - FP10 nbits: 32 value: 0 default_value: 0 @@ -575,6 +581,7 @@ components: - write - name: - f12 + - FP12 nbits: 32 value: 0 default_value: 0 @@ -593,6 +600,7 @@ components: - write - name: - f14 + - FP14 nbits: 32 value: 0 default_value: 0 @@ -611,6 +619,7 @@ components: - write - name: - f16 + - FP16 nbits: 32 value: 0 default_value: 0 @@ -629,6 +638,7 @@ components: - write - name: - f18 + - FP18 nbits: 32 value: 0 default_value: 0 @@ -647,6 +657,7 @@ components: - write - name: - f20 + - FP20 nbits: 32 value: 0 default_value: 0 @@ -665,6 +676,7 @@ components: - write - name: - f22 + - FP22 nbits: 32 value: 0 default_value: 0 @@ -683,6 +695,7 @@ components: - write - name: - f24 + - FP24 nbits: 32 value: 0 default_value: 0 @@ -701,6 +714,7 @@ components: - write - name: - f26 + - FP26 nbits: 32 value: 0 default_value: 0 @@ -719,6 +733,7 @@ components: - write - name: - f28 + - FP28 nbits: 32 value: 0 default_value: 0 @@ -737,6 +752,7 @@ components: - write - name: - f30 + - FP30 nbits: 32 value: 0 default_value: 0 @@ -1019,13 +1035,36 @@ instructions: fields: - field: function value: "000101" + - field: fmt + type: cop + value: "00000" - field: ft order: null value: "00000" preoperation: | - let fsValue = CAPI.FS.uint2float32(registers[fs]); + let fsValue = CAPI.FP.uint2float32(registers[fs]); postoperation: | - fd = CAPI.FS.float322uint(result); + registers[fd] = CAPI.FP.float322uint(result); + definition: | + let result = Math.abs(fsValue); + - name: abs.d + type: Arithmetic floating point + template: FPU_R + nwords: 1 + clk_cycles: 1 + fields: + - field: function + value: "000101" + - field: fmt + type: cop + value: "00001" + - field: ft + order: null + value: "00000" + preoperation: | + let fsValue = CAPI.ARCH.readDouble(fs); + postoperation: | + CAPI.ARCH.writeDouble(result, fd) definition: | let result = Math.abs(fsValue); @@ -1058,10 +1097,10 @@ instructions: value: "00000" type: cop preoperation: | - fsValue = CAPI.FS.uint2float32(registers[fs]); - ftValue = CAPI.FS.uint2float32(registers[ft]); + fsValue = CAPI.FP.uint2float32(registers[fs]); + ftValue = CAPI.FP.uint2float32(registers[ft]); postoperation: | - registers[fd] = CAPI.FS.float322uint(result); + registers[fd] = CAPI.FP.float322uint(result); definition: | let result = fsValue + ftValue; @@ -1151,7 +1190,7 @@ instructions: - field: opcode value: "001100" definition: | - registers[rt] = registers[rs] & (imm & 0xFFFF); + registers[rt] = registers[rs] & (imm & 0xFFFFn); - name: bc template: Custom @@ -1169,6 +1208,7 @@ instructions: order: 1 definition: | // Not implemented + CAPI.VALIDATION.raise('bc not implemented'); - name: bc1eqz template: FPU_I @@ -1322,7 +1362,9 @@ instructions: type: offset_bytes definition: | if (CAPI.FP.uint2int(registers[rs]) >= 0) { - registers.PC = registers.PC - 4n + imm; + const pc = registers.PC + registers.ra = pc + registers.PC = pc - 4n + imm; CAPI.STACK.beginFrame(registers[rs]); } @@ -1675,7 +1717,9 @@ instructions: startbit: 5 stopbit: 0 value: "100001" - definition: registers[fd] = registers[fs]; + definition: | + let val = CAPI.FP.uint2float32(registers[fs]); + CAPI.ARCH.writeDouble(val, fd); - name: cvt.d.w template: Custom type: Arithmetic floating point @@ -1696,7 +1740,7 @@ instructions: stopbit: 21 value: "00001" - field: fs - type: SFP-Reg + type: INT-Reg startbit: 15 stopbit: 11 order: 2 @@ -1714,7 +1758,7 @@ instructions: startbit: 5 stopbit: 0 value: "100001" - definition: registers[fd] = registers[fs]; + definition: CAPI.ARCH.writeDouble(Number(CAPI.FP.uint2int(registers[fs])), fd); - name: cvt.s.d template: Custom type: Arithmetic floating point @@ -1754,8 +1798,8 @@ instructions: stopbit: 0 value: "100000" definition: | - let val = CAPI.FS.uint2float32(registers[fs]); - CAPI.ARCH.writeDouble(val, fd); + let val = CAPI.ARCH.readDouble(fs); + registers[fd] = CAPI.FP.float322uint(val, fd); - name: cvt.s.w template: Custom type: Arithmetic floating point @@ -1776,7 +1820,7 @@ instructions: stopbit: 21 value: "00010" - field: fs - type: SFP-Reg + type: INT-Reg startbit: 15 stopbit: 11 order: 2 @@ -1794,7 +1838,7 @@ instructions: startbit: 5 stopbit: 0 value: "100000" - definition: registers[fd] = parseFloat(float2int_v2(registers[fs])); + definition: registers[fd] = CAPI.FP.float322uint(Number(CAPI.FP.uint2int(registers[fs]))); - name: cvt.w.d template: Custom type: Arithmetic floating point @@ -1822,7 +1866,7 @@ instructions: prefix: $ suffix: "," - field: fd - type: SFP-Reg + type: INT-Reg startbit: 10 stopbit: 6 order: 1 @@ -1835,7 +1879,7 @@ instructions: value: "100100" definition: | let val = CAPI.ARCH.readDouble(fs); - CAPI.REG.write(BigInt(Math.trunc(val)), fd); + CAPI.REG.write(CAPI.FP.int2uint(BigInt(Math.trunc(val))), fd); - name: cvt.w.s template: Custom type: Arithmetic floating point @@ -1863,7 +1907,7 @@ instructions: prefix: $ suffix: "," - field: fd - type: SFP-Reg + type: INT-Reg startbit: 10 stopbit: 6 order: 1 @@ -1874,7 +1918,9 @@ instructions: startbit: 5 stopbit: 0 value: "100100" - definition: registers[fd] = parseInt(registers[fs]); + definition: | + let val = CAPI.FP.uint2float32(registers[fs]); + CAPI.REG.write(CAPI.FP.int2uint(BigInt(Math.trunc(val))), fd); - name: div template: Custom type: Arithmetic integer @@ -2077,10 +2123,10 @@ instructions: stopbit: 0 value: "000011" preoperation: | - fsValue = CAPI.FS.uint2float32(fs); - ftValue = CAPI.FS.uint2float32(ft); + fsValue = CAPI.FP.uint2float32(registers[fs]); + ftValue = CAPI.FP.uint2float32(registers[ft]); postoperation: | - fd = CAPI.FS.float322uint(result); + registers[fd] = CAPI.FP.float322uint(result); definition: |- let result; if (ftValue != 0) @@ -2132,7 +2178,7 @@ instructions: value: "011011" definition: |- if (registers[rt] != 0) - { registers[rd] = Math.floor(CAPI.FP.int2uint(registers[rs]) / CAPI.FP.int2uint(registers[rt])); } + { registers[rd] = CAPI.FP.int2uint(registers[rs]) / CAPI.FP.int2uint(registers[rt]); } else { CAPI.VALIDATION.raise('Division by zero not allowed'); } - name: divu template: Custom @@ -2168,9 +2214,9 @@ instructions: value: "011011" definition: |- if (registers[rt] != 0) - { registers.LO = Math.floor(CAPI.FP.int2uint(registers[rs]) / CAPI.FP.int2uint(registers[rt])); - registers.HI = CAPI.FP.int2uint(registers[rs]) % CAPI.FP.int2uint(registers[rt]); } - else { CAPI.VALIDATION.raise('Division by zero not allowed'); } + { registers.LO = CAPI.FP.int2uint(registers[rs]) / CAPI.FP.int2uint(registers[rt]); + registers.HI = CAPI.FP.int2uint(registers[rs]) % CAPI.FP.int2uint(registers[rt]); } + else { CAPI.VALIDATION.raise('Division by zero not allowed'); } - name: j template: Custom type: Unconditional bifurcation @@ -2279,8 +2325,10 @@ instructions: stopbit: 0 value: "001000" definition: |- - registers.PC = registers[rs]; - CAPI.STACK.endFrame(); + const pc = registers[rs] + registers.PC = pc; + if (BigInt.asIntN(32, pc) === -1n) CAPI.SYSCALL.exit(); + else CAPI.STACK.endFrame(); - name: lb template: Custom type: Memory access @@ -2316,7 +2364,8 @@ instructions: suffix: ) order: 3 definition: | - registers[reg1] = CAPI.MEM.read(registers[reg2]+val, 1, reg1); + const result = CAPI.MEM.read(registers[reg2]+val, 1, reg1, false); + registers[reg1] = CAPI.FP.int2uint(CAPI.FP.uint2int(result, 8)); - name: lbu template: Custom type: Memory access @@ -2352,7 +2401,7 @@ instructions: order: 2 space: false definition: | - registers[rt] = CAPI.MEM.read(registers[base]+off, 1, rt); + registers[rt] = CAPI.MEM.read(registers[base]+off, 1, rt, false); - name: ldc1 template: Custom type: Memory access @@ -2392,11 +2441,11 @@ instructions: postoperation: | CAPI.ARCH.writeDouble(doubleValue, ft); definition: | - if (CAPI.VALIDATION.isMisaligned(registers[base] + off, 'd')) { - CAPI.VALIDATION.raise('The memory must be aligned'); - } - let high = CAPI.MEM.read(registers[base] + off, 4); - let low = CAPI.MEM.read(registers[base] + off + 4n, 4, ft); + let addr = registers[base] + off; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + let high = CAPI.MEM.read(addr, 4, false); + let low = CAPI.MEM.read(addr + 4n, 4, ft, false); let doubleValue = CAPI.FP.uint2float64(Number(low), Number(high)); - name: lh template: Custom @@ -2433,7 +2482,11 @@ instructions: prefix: ($ suffix: ) definition: | - registers[reg1] = CAPI.MEM.read(registers[reg2]+val, 2, reg1); + let addr = registers[reg2] + val; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + const result = CAPI.MEM.read(addr, 2, reg1, false); + registers[reg1] = CAPI.FP.int2uint(CAPI.FP.uint2int(result, 16)); - name: lhu template: Custom type: Memory access @@ -2469,7 +2522,10 @@ instructions: order: 2 space: false definition: | - registers[rt] = CAPI.MEM.read(registers[base]+off, 2, rt); + let addr = registers[base] + off; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rt] = CAPI.MEM.read(addr, 2, rt, false); - name: lui template: Custom type: Other @@ -2533,7 +2589,10 @@ instructions: suffix: ) order: 3 definition: | - registers[reg1] = CAPI.MEM.read(registers[reg2]+val, 4, reg1); + let addr = registers[reg2] + val; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[reg1] = CAPI.MEM.read(addr, 4, reg1, false); - name: lwc1 template: Custom type: Memory access @@ -2569,7 +2628,10 @@ instructions: order: 2 space: false definition: |- - registers[ft] = CAPI.MEM.read(registers[base]+off, 4, ft); + let addr = registers[base] + off; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[ft] = CAPI.MEM.read(addr, 4, ft, false); - name: mfc1 template: Custom type: Transfer between registers @@ -2821,9 +2883,9 @@ instructions: stopbit: 0 value: "000110" preoperation: | - fsValue = CAPI.FS.uint2float32(fs); + fsValue = CAPI.FP.uint2float32(fs); postoperation: | - registers[fd] = CAPI.FS.float322uint(result); + registers[fd] = CAPI.FP.float322uint(result); definition: let result = fsValue; - name: mtc1 template: Custom @@ -2857,7 +2919,7 @@ instructions: stopbit: 11 order: 2 prefix: $ - definition: registers[fs] = CAPI.FP.uint2float32(registers[rt]); + definition: registers[fs] = registers[rt]; - name: mthi template: Custom type: Transfer between registers @@ -3046,10 +3108,10 @@ instructions: stopbit: 0 value: "000010" preoperation: | - fsValue = CAPI.FS.uint2float32(fs); - ftValue = CAPI.FS.uint2float32(ft); + fsValue = CAPI.FP.uint2float32(registers[fs]); + ftValue = CAPI.FP.uint2float32(registers[ft]); postoperation: | - registers[fd] = CAPI.FS.float322uint(result); + registers[fd] = CAPI.FP.float322uint(result); definition: | let result = fsValue * ftValue; - name: mult @@ -3086,8 +3148,8 @@ instructions: value: "011000" definition: |- let result = CAPI.FP.uint2int(registers[rs]) * CAPI.FP.uint2int(registers[rt]); - registers.HI = Math.floor(result / Math.pow (2, 32)); - registers.LO = result % Math.pow(2, 32); + registers.HI = CAPI.FP.int2uint(result >> 32n); + registers.LO = CAPI.FP.int2uint(result & 0xFFFFFFFFn); - name: multu template: Custom type: Arithmetic integer @@ -3122,10 +3184,8 @@ instructions: value: "011001" definition: |- let result = CAPI.FP.int2uint(registers[rs]) * CAPI.FP.int2uint(registers[rt]); - registers.HI = Math.floor(result / Math.pow(2, 32)); - registers.HI = registers.HI >>> 0; // TODO: This is broken with bigints. - registers.LO = result % Math.pow(2, 32); - registers.LO = registers.LO >>> 0; + registers.HI = CAPI.FP.int2uint(result >> 32n); + registers.LO = CAPI.FP.int2uint(result & 0xFFFFFFFFn); - name: nop template: Custom type: Logic @@ -3304,7 +3364,7 @@ instructions: stopbit: 0 value: "000010" definition: | - registers[rd] = CAPI.FP.int2uint((registers[rt] >>> sa) | (registers[rt] << (32 - sa))); // TODO: This is broken with bigints. + registers[rd] = CAPI.FP.int2uint((CAPI.FP.int2uint(registers[rt]) >> sa) | (registers[rt] << (32n - sa))); - name: rsqrt.d template: Custom type: Arithmetic floating point @@ -3391,9 +3451,9 @@ instructions: stopbit: 0 value: "010110" preoperation: | - fsValue = CAPI.FS.uint2float32(fs); + fsValue = CAPI.FP.uint2float32(registers[fs]); postoperation: | - fd = CAPI.FS.float322uint(fd); + registers[fd] = CAPI.FP.float322uint(result); definition: |- let result; if (fsValue >= 0) { @@ -3435,7 +3495,7 @@ instructions: stopbit: 0 order: 2 space: false - definition: "CAPI.MEM.write(registers[base]+off, 1, registers[rt], rt);" + definition: "CAPI.MEM.write(registers[base]+off, 1, BigInt.asUintN(8, registers[rt]), rt, 'byte', false);" - name: sdc1 template: Custom type: Memory access @@ -3473,12 +3533,12 @@ instructions: preoperation: | let doubleValue = CAPI.ARCH.readDouble(ft); let parts = CAPI.FP.float642uint(doubleValue); + let value = (BigInt(parts[1]) << 32n) | BigInt(parts[0]) definition: | - if (CAPI.VALIDATION.isMisaligned(registers[base] + off, 'd')) { - CAPI.VALIDATION.raise('The memory must be aligned'); - } - CAPI.MEM.write(registers[base] + off, 4, BigInt(parts[0]), ft); - CAPI.MEM.write(registers[base] + off + 4n, 4, BigInt(parts[1])); + let addr = registers[base] + off; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 8, value, ft, 'float64', false); - name: sh template: Custom type: Memory access @@ -3513,7 +3573,11 @@ instructions: stopbit: 0 order: 2 space: false - definition: "CAPI.MEM.write(registers[base]+off, 2, registers[rt], rt);" + definition: | + let addr = registers[base] + off; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 2, BigInt.asUintN(16, registers[rt]), rt, 'half', false); - name: sll template: Custom type: Arithmetic integer @@ -3552,7 +3616,7 @@ instructions: startbit: 5 stopbit: 0 value: "111111" - definition: rd = CAPI.FP.int2uint(registers[rt] << sa); + definition: registers[rd] = CAPI.FP.int2uint(registers[rt] << sa); - name: slt template: Custom type: Logic @@ -3700,7 +3764,7 @@ instructions: startbit: 5 stopbit: 0 value: "101011" - definition: "registers[rd] = CAPI.FP.uint2int(registers[rs]) < CAPI.FP.uint2int(registers[rt]) ? 1n : 0n;" + definition: "registers[rd] = registers[rs] < registers[rt] ? 1n : 0n;" - name: sqrt.d template: Custom type: Arithmetic floating point @@ -3787,9 +3851,9 @@ instructions: stopbit: 0 value: "000100" preoperation: | - fsValue = CAPI.FS.uint2float32(fs); + fsValue = CAPI.FP.uint2float32(registers[fs]); postoperation: | - registers[fd] = CAPI.FS.float322uint(result); + registers[fd] = CAPI.FP.float322uint(result); definition: |- let result; if (fsValue >= 0) { @@ -3836,7 +3900,7 @@ instructions: stopbit: 0 value: "000011" definition: | - registers[rd] = CAPI.FP.int2uint(registers[rt] >> sa); + registers[rd] = CAPI.FP.int2uint(CAPI.FP.uint2int(registers[rt]) >> sa); - name: srl template: Custom type: Arithmetic integer @@ -3881,7 +3945,7 @@ instructions: stopbit: 0 value: "000010" definition: | - registers[rd] = registers[rt] >>> sa; // TODO:broken with bigints. + registers[rd] = CAPI.FP.int2uint(registers[rt]) >> sa; - name: sub template: Custom type: Arithmetic integer @@ -4019,10 +4083,10 @@ instructions: stopbit: 0 value: "000001" preoperation: | - fsValue = CAPI.FS.uint2float32(fs); - ftValue = CAPI.FS.uint2float32(ft); + fsValue = CAPI.FP.uint2float32(registers[fs]); + ftValue = CAPI.FP.uint2float32(registers[ft]); postoperation: | - registers[fd] = CAPI.FS.float322uint(result); + registers[fd] = CAPI.FP.float322uint(result); definition: let result = fsValue - ftValue; - name: subu template: Custom @@ -4099,7 +4163,11 @@ instructions: prefix: ($ suffix: ) order: 3 - definition: "CAPI.MEM.write(val+registers[reg2], 4, registers[reg1], reg1);" + definition: | + let addr = registers[reg2] + val; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, registers[reg1], reg1, 'word', false); - name: swc1 template: Custom type: Memory access @@ -4134,7 +4202,11 @@ instructions: stopbit: 0 order: 2 space: false - definition: "CAPI.MEM.write(registers[base]+off, 4, registers[ft], ft);" + definition: | + let addr = registers[base] + off; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, registers[ft], ft, 'float32', false); - name: syscall template: Custom type: Syscall @@ -4156,6 +4228,7 @@ instructions: value: "001100" definition: |- let FP0 = CAPI.ARCH.readDouble('f0'); + let f12 = CAPI.FP.uint2float32(registers.f12); let FP12 = CAPI.ARCH.readDouble('f12'); switch(registers["v0"]) { case 1n: @@ -4174,10 +4247,10 @@ instructions: CAPI.SYSCALL.read('v0', 'int32'); break; case 6n: - CAPI.SYSCALL.read(f0, 'float'); + CAPI.SYSCALL.read('f0', 'float'); break; case 7n: - CAPI.SYSCALL.read(FP0, 'double'); + CAPI.SYSCALL.read('FP0', 'double'); break; case 8n: CAPI.SYSCALL.read('a0', 'string', 'a1'); @@ -4981,18 +5054,24 @@ pseudoinstructions: - field: val type: imm-signed definition: |- - no_ret_op{tmp0=Field.2.(63,32).double; - tmp_low0=tmp0&0x0000FFFF; - tmp_hi0=tmp0>>>16; - tmp1=Field.2.(31,0).double; - tmp_low1=tmp1&0x0000FFFF; - tmp_hi1=tmp1>>>16}; + no_ret_op{ + tmp0=Field.2.(63,32).double; + tmp_low0=tmp0&0x0000FFFF; + tmp_hi0=tmp0>>>16; + tmp1=Field.2.(31,0).double; + tmp_low1=tmp1&0x0000FFFF; + tmp_hi1=tmp1>>>16; + tmp_reg=reg_name{1}; + regNumber=parseInt(tmp_reg.substring(2), 10); + reg0="f" + regNumber; + reg1="f" + (regNumber + 1); + }; lui $at, op{tmp_hi1}; ori $at, $at, op{tmp_low1}; - mtc1 $at, $aliasDouble(rd;1); + mtc1 $at, $op{reg1}; lui $at, op{tmp_hi0}; ori $at, $at, op{tmp_low0}; - mtc1 $at, $aliasDouble(rd;0); + mtc1 $at, $op{reg0}; - name: li.s help: "" properties: [] diff --git a/architecture/RISCV/RV32IMFD.yml b/architecture/RISCV/RV32IMFD.yml index 8cc988d99..825c89625 100644 --- a/architecture/RISCV/RV32IMFD.yml +++ b/architecture/RISCV/RV32IMFD.yml @@ -8,7 +8,7 @@ config: name: RV32 word_size: 32 byte_size: 8 - description: RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley. + description: RISC-V is a free and open standard ISA (Instruction Set Architecture) based on RISC (Reduced Instruction Set Computer) principles. It was created in 2010 at the University of California, Berkeley. endianness: big_endian memory_alignment: true main_function: main @@ -20,32 +20,33 @@ config: plugin: riscv assemblers: - name: CreatorAssembler - description: Default CREATOR assembler + description: "Default CREATOR assembler" + extensions: I: - description: RV32I Base Instruction Set + description: "RV32I Base Instruction Set" template: Base M: - description: RV32M Integer Multiply/Divide Extension + description: "RV32M Integer Multiply/Divide Extension" type: extension F: - description: RV32F Single-Precision Floating-Point Extension + description: "RV32F Single-Precision Floating-Point Extension" type: extension implies: - Zicsr D: - description: RV32D Double-Precision Floating-Point Extension + description: "RV32D Double-Precision Floating-Point Extension" type: extension implies: - F Zifencei: - description: RV32/RV64 Zifencei Standard Extension + description: "RV32/RV64 Zifencei Standard Extension" type: extension Zicsr: - description: RV32/RV64 Zicsr Standard Extension + description: "RV32/RV64 Zicsr Standard Extension" type: extension Priv: - description: RV32/RV64 Privileged instructions + description: "RV32/RV64 Privileged instructions" type: extension components: @@ -91,6 +92,7 @@ components: encoding: 2 properties: - read + - write - name: - mstatus nbits: 32 @@ -164,8 +166,8 @@ components: - x1 - ra nbits: 32 - value: 0xFFFFFF00 - default_value: 0xFFFFFF00 + value: -1 + default_value: -1 encoding: 1 properties: - read @@ -888,6 +890,16 @@ memory_layout: start: 0x0FFFFFFC end: 0x0FFFFFFF +modifiers: + hi: + lower_signed: true + output_signed: false + range: [12, 32] + lo: + lower_signed: false + output_signed: true + range: [0, 12] + templates: - name: B type: Conditional bifurcation @@ -1489,8 +1501,8 @@ instructions: - field: funct3 value: "000" definition: | - if (registers[rs1] === registers[rs2]) - registers.pc = registers.pc + imm; + if (registers[rs1] === registers[rs2]) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 and rs2 are equal. - name: bge @@ -1502,7 +1514,7 @@ instructions: value: "101" definition: | if (CAPI.FP.uint2int(registers[rs1]) >= CAPI.FP.uint2int(registers[rs2])) - registers.pc = registers.pc + imm; + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 is greater than or equal to rs2, using signed comparison. @@ -1514,8 +1526,8 @@ instructions: - field: funct3 value: "111" definition: | - if (CAPI.FP.int2uint(registers[rs1]) > CAPI.FP.int2uint(registers[rs2])) - registers.pc = registers.pc + imm; + if (CAPI.FP.int2uint(registers[rs1]) >= CAPI.FP.int2uint(registers[rs2])) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 is greater than or equal to rs2, using unsigned comparison. @@ -1528,9 +1540,8 @@ instructions: value: "100" definition: | if (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) - registers.pc = registers.pc + imm; - help: Take the branch if registers rs1 is less than rs2, using signed - comparison. + registers.pc = registers.pc + imm; + help: Take the branch if registers rs1 is less than rs2, using signed comparison. - name: bltu template: B @@ -1541,9 +1552,8 @@ instructions: value: "110" definition: | if (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(registers[rs2])) - registers.pc = registers.pc + imm; - help: Take the branch if registers rs1 is less than rs2, using unsigned - comparison. + registers.pc = registers.pc + imm; + help: Take the branch if registers rs1 is less than rs2, using unsigned comparison. - name: bne template: B @@ -1553,8 +1563,8 @@ instructions: - field: funct3 value: "001" definition: | - if (registers[rs1] !== registers[rs2]) - registers.pc = registers.pc + imm; + if (registers[rs1] !== registers[rs2]) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 and rs2 are not equal. # I-type instructions @@ -1589,8 +1599,7 @@ instructions: value: "111" definition: | registers[rd] = registers[rs1] & CAPI.FP.int2uint(imm); - help: Performs bitwise AND on register rs1 and the sign-extended 12-bit - immediate and place the result in rd. + help: Performs bitwise AND on register rs1 and the sign-extended 12-bit immediate and place the result in rd. - name: jalr template: I-Offset @@ -1602,8 +1611,10 @@ instructions: value: "000" definition: | registers[rd] = registers.pc + 4n; - registers.pc = (registers[rs1] + imm) & ~1n; - CAPI.STACK.endFrame(); + const pc = registers[rs1] + imm; + registers.pc = pc & ~1n; + if (BigInt.asIntN(32, pc) === -1n) CAPI.SYSCALL.exit(); + else CAPI.STACK.endFrame(); help: Jump to address and place return address in rd. - name: lb @@ -1615,9 +1626,10 @@ instructions: - field: funct3 value: "000" definition: | - registers[rd] = CAPI.MEM.read(imm + registers[rs1], 1, rd); - help: Loads a 8-bit value from memory and sign-extends this to XLEN bits - before storing it in register rd. + let addr = registers[rs1] + imm; + const result = CAPI.MEM.read(addr, 1, rd, false); + registers[rd] = CAPI.FP.int2uint(CAPI.FP.uint2int(result, 8)); + help: Loads a 8-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. - name: lbu template: I-Offset @@ -1629,10 +1641,9 @@ instructions: value: "100" definition: | let addr = CAPI.FP.int2uint(registers[rs1]) + imm; - registers[rd] = CAPI.MEM.read(addr, 1, rd); - registers[rd] = CAPI.FP.int2uint(registers[rd]); - help: Loads a 8-bit value from memory and zero-extends this to XLEN bits - before storing it in register rd. + let result = CAPI.MEM.read(addr, 1, rd, false); + registers[rd] = CAPI.FP.int2uint(result); + help: Loads a 8-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. - name: lh template: I-Offset @@ -1643,9 +1654,12 @@ instructions: - field: funct3 value: "001" definition: | - registers[rd] = CAPI.MEM.read(imm + registers[rs1], 2, rd); - help: Loads a 16-bit value from memory and sign-extends this to XLEN bits - before storing it in register rd. + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + const result = CAPI.MEM.read(addr, 2, rd, false); + registers[rd] = CAPI.FP.int2uint(CAPI.FP.uint2int(result, 16)); + help: Loads a 16-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. - name: lhu template: I-Offset @@ -1656,11 +1670,12 @@ instructions: - field: funct3 value: "101" definition: | - let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; - registers[rd] = CAPI.MEM.read(addr, 2, rd); - registers[rd] = CAPI.FP.int2uint(registers[rd]); - help: Loads a 16-bit value from memory and zero-extends this to XLEN bits - before storing it in register rd. + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + let result = CAPI.MEM.read(addr, 2, rd, false); + registers[rd] = CAPI.FP.int2uint(result); + help: Loads a 16-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. - name: lw template: I-Offset @@ -1671,10 +1686,11 @@ instructions: - field: funct3 value: "010" definition: | - let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; - registers[rd] = CAPI.MEM.read(addr, 4, rd); - help: Loads a 32-bit value from memory and sign-extends this to XLEN bits - before storing it in register rd. + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 4, rd, false); + help: Loads a 32-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. - name: ori template: I @@ -1686,8 +1702,7 @@ instructions: value: "110" definition: | registers[rd] = registers[rs1] | imm; - help: Performs bitwise OR on register rs1 and the sign-extended 12-bit - immediate and place the result in rd. + help: Performs bitwise OR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. - name: slli template: I-Shift @@ -1701,8 +1716,7 @@ instructions: value: "0000000" definition: | if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] << shamt); - help: Performs logical left shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: slti template: I @@ -1713,9 +1727,8 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1 : 0; - help: Place the value 1 in register rd if register rs1 is less than the - signextended immediate when both are treated as signed numbers, else 0 is written to rd. + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1n : 0n; + help: Place the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. - name: sltiu template: I @@ -1726,9 +1739,8 @@ instructions: - field: funct3 value: "011" definition: | - registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1: 0; - help: Place the value 1 in register rd if register rs1 is less than the - immediate when both are treated as unsigned numbers, else 0 is written to rd. + registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1n : 0n; + help: Place the value 1 in register rd if register rs1 is less than the immediate when both are treated as unsigned numbers, else 0 is written to rd. - name: srai template: I-Shift @@ -1741,9 +1753,8 @@ instructions: - field: funct7 value: "0100000" definition: | - if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); - help: Performs arithmetic right shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(CAPI.FP.uint2int(registers[rs1]) >> shamt); + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: srli template: I-Shift @@ -1757,8 +1768,7 @@ instructions: value: "0000000" definition: | if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); - help: Performs logical right shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: xori template: I @@ -1789,9 +1799,11 @@ instructions: - field: opcode value: "1101111" definition: | - registers[rd] = registers.pc + 4n; - registers.pc += imm; - CAPI.STACK.beginFrame(); + if (CAPI.ARDUINO.check_arduino(imm,registers.pc) === false) { + registers[rd] = registers.pc + 4n; + registers.pc = registers.pc + imm; + CAPI.STACK.beginFrame(); + } help: Jump to address and place return address in rd. # R-type instructions @@ -1827,8 +1839,7 @@ instructions: value: "111" definition: | registers[rd] = registers[rs1] & registers[rs2]; - help: Performs bitwise AND on registers rs1 and rs2 and place the result - in rd. + help: Performs bitwise AND on registers rs1 and rs2 and place the result in rd. - name: or template: R @@ -1841,8 +1852,8 @@ instructions: value: "110" definition: | registers[rd] = registers[rs1] | registers[rs2]; - help: Performs bitwise OR on registers rs1 and rs2 and place the result in - rd. + help: Performs bitwise OR on registers rs1 and rs2 and place the result in rd. + - name: sll template: R fields: @@ -1855,8 +1866,7 @@ instructions: definition: | const shiftAmount = registers[rs2] & 0x1Fn; registers[rd] = (registers[rs1] << shiftAmount) & 0xFFFFFFFFn; - help: Performs logical left shift on the value in register rs1 by the - shift amount held in the lower 5 bits of register rs2. + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. - name: slt template: R @@ -1868,9 +1878,8 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1 : 0; - help: Place the value 1 in register rd if register rs1 is less than - register rs2 when both are treated as signed numbers, else 0 is written to rd. + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1n : 0n; + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as signed numbers, else 0 is written to rd. - name: sltu template: R @@ -1914,8 +1923,7 @@ instructions: definition: | const shiftAmount = registers[rs2] & 0x1Fn; registers[rd] = (registers[rs1] >> shiftAmount) & 0xFFFFFFFFn; - help: Logical right shift on the value in register rs1 by the shift amount - held in the lower 5 bits of register rs2. + help: Logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. - name: sub template: R @@ -1943,8 +1951,7 @@ instructions: value: "100" definition: | registers[rd] = (registers[rs1] ^ registers[rs2]); - help: Performs bitwise XOR on registers rs1 and rs2 and place the result - in rd. + help: Performs bitwise XOR on registers rs1 and rs2 and place the result in rd. # S-type instructions # 31-25 24-20 19-15 14-12 11-7 6-0 @@ -1962,7 +1969,7 @@ instructions: - field: funct3 value: "000" definition: | - CAPI.MEM.write(registers[rs1] + imm, 1, BigInt.asUintN(8, registers[rs2]), rs2, 'byte'); + CAPI.MEM.write(registers[rs1] + imm, 1, BigInt.asUintN(8, registers[rs2]), rs2, 'byte', false); help: Store 8-bit, values from the low bits of register rs2 to memory. - name: sh @@ -1973,10 +1980,12 @@ instructions: - field: funct3 value: "001" definition: | - CAPI.MEM.write(imm + registers[rs1], 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half'); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half', false); help: Store 16-bit, values from the low bits of register rs2 to memory. - # The check for the - name: sw template: S fields: @@ -1985,7 +1994,10 @@ instructions: - field: funct3 value: "010" definition: | - CAPI.MEM.write(imm + registers[rs1], 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word'); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word', false); help: Store 32-bit, values from the low bits of register rs2 to memory. # U-type instructions @@ -2107,7 +2119,7 @@ instructions: (BigInt.asIntN(32, BigInt(registers[rs1])) / BigInt.asIntN(32, BigInt(registers[rs2]))) ); } - else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + else CAPI.VALIDATION.raise('Division by zero not allowed'); help: Perform an XLEN bits by XLEN bits signed integer division of rs1 by rs2, rounding towards zero. @@ -2121,13 +2133,11 @@ instructions: - field: funct3 value: "101" definition: | - if (registers[rs2] != 0) { - registers[rd] = BigInt.asIntN( - 32, - (BigInt.asUintN(32, BigInt(registers[rs1])) / BigInt.asUintN(32, BigInt(registers[rs2]))) - ); + const div = registers[rs2] + if (div != 0) { + registers[rd] = CAPI.FP.int2uint(registers[rs1] / div); } - else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + else CAPI.VALIDATION.raise('Division by zero not allowed'); help: Perform an XLEN-bit by XLEN-bit unsigned integer division of rs1 by rs2, rounding towards zero. @@ -2155,12 +2165,8 @@ instructions: - field: funct3 value: "001" definition: | - registers[rd] = BigInt.asIntN( - 32, - BigInt.asIntN( - 64, - BigInt.asIntN(32, BigInt(registers[rs1])) * BigInt.asIntN(32, BigInt(registers[rs2])), - ) >> 32n, + registers[rd] = CAPI.FP.int2uint( + (CAPI.FP.uint2int(registers[rs1]) * CAPI.FP.uint2int(registers[rs2])) >> 32n, ); help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. @@ -2175,12 +2181,8 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = BigInt.asIntN( - 32, - BigInt.asIntN( - 64, - BigInt.asIntN(32, BigInt(registers[rs1])) * BigInt.asUintN(32, BigInt(registers[rs2])), - ) >> 32n, + registers[rd] = CAPI.FP.int2uint( + (CAPI.FP.uint2int(registers[rs1]) * registers[rs2]) >> 32n, ); help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. @@ -2195,12 +2197,8 @@ instructions: - field: funct3 value: "011" definition: | - registers[rd] = BigInt.asIntN( - 32, - BigInt.asUintN( - 64, - BigInt.asUintN(32, BigInt(registers[rs1])) * BigInt.asUintN(32, BigInt(registers[rs2])), - ) >> 32n, + registers[rd] = CAPI.FP.int2uint( + (registers[rs1] * registers[rs2]) >> 32n, ); help: Performs an XLEN-bit by XLEN-bit multiplication of unsigned rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. @@ -2251,12 +2249,14 @@ instructions: - field: rd type: DFP-Reg definition: | - registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 4, rd); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 4, rd, false); postoperation: | registers[rd] = CAPI.ARCH.NaNBox(registers[rd]); - help: Load a single-precision floating-point value from memory into - floating-point register rd. + help: Load a single-precision floating-point value from memory into floating-point register rd. - name: fadd.s template: R-Floating @@ -2335,11 +2335,10 @@ instructions: optional: true order: 3 postoperation: | - registers[rd] = CAPI.ARCH.toBigInt(registers[rd],'NaNBfloat32_64'); + registers[rd] = CAPI.ARCH.toBigInt(result,'NaNBfloat32_64'); definition: | - registers[rd] = CAPI.FP.uint2int(registers[rs1]) - help: Converts a 32-bit signed integer, in integer register rs1 into a - floating-point number in floating-point register rd. + const result = CAPI.FP.uint2int(registers[rs1]) + help: Converts a 32-bit signed integer, in integer register rs1 into a floating-point number in floating-point register rd. - name: fcvt.s.wu template: R-IntToFloat @@ -2357,8 +2356,7 @@ instructions: order: 3 definition: | registers[rd] = CAPI.FP.int2uint(registers[rs1]) - help: Converts a 32-bit unsigned integer, in integer register rs1 into a - floating-point number in floating-point register rd. + help: Converts a 32-bit unsigned integer, in integer register rs1 into a floating-point number in floating-point register rd. - name: fcvt.w.s template: R-FloatToInt @@ -2386,8 +2384,7 @@ instructions: } definition: | result = parseInt(registers[rs1]); - help: Convert a floating-point number in floating-point register rs1 to a - signed 32-bit in integer register rd. + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in integer register rd. - name: fcvt.wu.s template: R-FloatToInt @@ -2415,8 +2412,7 @@ instructions: } definition: | registers[rd] = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Convert a floating-point number in floating-point register rs1 to a - signed 32-bit in unsigned integer register rd. + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in unsigned integer register rd. - name: fdiv.s template: R-Floating @@ -2457,17 +2453,11 @@ instructions: - field: rd type: INT-Reg preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); - } definition: | - result = (rs1Number === rs2Number) ? 1 : 0; + registers[rd] = (rs1Number === rs2Number)? 1n : 0n; help: Performs a quiet equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is @@ -2485,17 +2475,11 @@ instructions: - field: rd type: INT-Reg preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); - } definition: | - result = (rs1Number <= rs2Number) ? 1 : 0; + registers[rd] = (rs1Number <= rs2Number)? 1n : 0n; help: Performs a quiet less or equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The @@ -2513,17 +2497,11 @@ instructions: - field: rd type: INT-Reg preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); - } definition: | - result = (rs1Number < rs2Number) ? 1 : 0; + registers[rd] = (rs1Number < rs2Number)? 1n : 0n; help: Performs a quiet less comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is @@ -2675,8 +2653,7 @@ instructions: } definition: | result = (rs2Number >= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. - The result's sign bit is rs2's sign bit. + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. - name: fsgnjn.s template: R-Floating @@ -2699,8 +2676,7 @@ instructions: } definition: | result = (rs2Number <= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. - The result's sign bit is rs2's sign bit. + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. - name: fsgnjx.s template: R-Floating @@ -2725,8 +2701,7 @@ instructions: let a = rs1Number < 0; let b = rs2Number < 0; result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. - The result's sign bit is XOR of sign bit of rs1 and rs2. + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. - name: fsqrt.s template: R-Floating @@ -2745,9 +2720,8 @@ instructions: optional: true order: 3 preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let result, rs1Number, type_rs1; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); - [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); @@ -2759,7 +2733,7 @@ instructions: result = Math.sqrt(rs1Number); } else { CAPI.VALIDATION.raise( - 'Square root of a negative number is not allowed.' + "Square root of a negative number is not allowed." ); } help: Perform single-precision square root. @@ -2788,7 +2762,7 @@ instructions: } definition: | result = rs1Number - rs2Number; - help: Perform single-precision floating-point substraction. + help: Perform single-precision floating-point subtraction. - name: fmadd.s template: R4 @@ -2806,7 +2780,7 @@ instructions: let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); @@ -2833,7 +2807,7 @@ instructions: let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); @@ -2860,7 +2834,7 @@ instructions: let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); @@ -2887,7 +2861,7 @@ instructions: let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); @@ -2909,9 +2883,11 @@ instructions: type: DFP-Reg definition: | let value = registers[rs2] & 0xFFFFFFFFn; - CAPI.MEM.write(registers[rs1] + imm, 4, value, rs2, 'float32'); - help: Store a single-precision value from floating-point register rs2 to - memory. + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, value, rs2, 'float32', false); + help: Store a single-precision value from floating-point register rs2 to memory. D: # ____ __ __ _____ ____ ____ @@ -2932,12 +2908,11 @@ instructions: - field: rd type: DFP-Reg definition: | - if (CAPI.VALIDATION.isMisaligned(registers[rs1] + imm, 'd')) { - CAPI.VALIDATION.raise('The memory must be aligned'); - } - registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 8, rd); - help: Load a double-precision floating-point value from memory into - floating-point register rd. + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 8, rd, false); + help: Load a double-precision floating-point value from memory into floating-point register rd. - name: fadd.d template: R-Double @@ -3035,8 +3010,7 @@ instructions: } definition: | result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual - help: Converts double floating-point register in rs1 into a double - floating-point number in floating-point register rd. + help: Converts double floating-point register in rs1 into a double floating-point number in floating-point register rd. - name: fcvt.d.w template: R-Conversion @@ -3057,14 +3031,13 @@ instructions: - field: rs1 type: INT-Reg preoperation: | - let result, rs1Number, type_rs1; - [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + let result, rs1Number; + rs1Number = registers[rs1]; postoperation: | registers[rd] = CAPI.ARCH.toBigInt(result, 'float64'); definition: | result = CAPI.FP.uint2int(rs1Number); - help: Converts a 32-bit signed integer, in integer register rs1 into a - double-precision floating-point number in floating-point register rd. + help: Converts a 32-bit signed integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. - name: fcvt.d.wu template: R-Conversion @@ -3096,8 +3069,7 @@ instructions: } definition: | result = CAPI.FP.int2uint(parseFloat(rs1Number)); - help: Converts a 32-bit unsigned integer, in integer register rs1 into a - double-precision floating-point number in floating-point register rd. + help: Converts a 32-bit unsigned integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. - name: fcvt.s.d template: R-Conversion @@ -3129,8 +3101,7 @@ instructions: } definition: | result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual - help: Converts double floating-point register in rs1 into a floating-point - number in floating-point register rd. + help: Converts double floating-point register in rs1 into a floating-point number in floating-point register rd. - name: fcvt.w.d template: R-Conversion @@ -3162,8 +3133,7 @@ instructions: } definition: | result = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Converts a double-precision floating-point number in floating-point - register rs1 to a signed 32-bit integer, in integer register rd. + help: Converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit integer, in integer register rd. - name: fcvt.wu.d template: R-Conversion @@ -3195,8 +3165,7 @@ instructions: } definition: | result = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Converts a double-precision floating-point number in floating-point - register rs1 to a unsigned 32-bit integer, in integer register rd. + help: Converts a double-precision floating-point number in floating-point register rs1 to a unsigned 32-bit integer, in integer register rd. - name: fdiv.d template: R-Double @@ -3236,17 +3205,11 @@ instructions: - field: rd type: INT-Reg preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); - } definition: | - registers[rd] = (rs1Number == rs2Number) ? 1 : 0; + registers[rd] = (rs1Number === rs2Number)? 1n : 0n; help: Performs a quiet equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid @@ -3267,14 +3230,8 @@ instructions: let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); - } definition: | - registers[rd] = (rs1Number <= rs2Number) ? 1 : 0; + registers[rd] = (rs1Number <= rs2Number)? 1n : 0n; help: Performs a quiet less or equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid @@ -3295,14 +3252,8 @@ instructions: let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); - } definition: | - registers[rd] = (rs1Number < rs2Number) ? 1 : 0; + registers[rd] = (rs1Number < rs2Number) ? 1n : 0n; help: Performs a quiet less comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid @@ -3423,7 +3374,7 @@ instructions: registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } definition: | - registers[rd] = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); + result = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is opposite of rs2's sign bit. @@ -3449,7 +3400,7 @@ instructions: definition: | let a = rs1Number < 0; let b = rs2Number < 0; - registers[rd] = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. @@ -3470,9 +3421,8 @@ instructions: optional: true order: 3 preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let result, rs1Number, type_rs1; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); - [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); @@ -3481,7 +3431,7 @@ instructions: } definition: | if (rs1Number >= 0) { - registers[rd] = Math.sqrt(rs1Number); + result = Math.sqrt(rs1Number); } else { CAPI.VALIDATION.raise( "Square root of a negative number is not allowed." @@ -3637,7 +3587,10 @@ instructions: - field: rs2 type: DFP-Reg definition: | - CAPI.MEM.write(registers[rs1] + imm, 8, registers[rs2], rs2, 'float64'); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 8, registers[rs2], rs2, 'float64', false); help: Store a double-precision value from the floating-point registers to memory. @@ -3701,40 +3654,40 @@ instructions: # TODO: Implement rest of CSR instructions - Zifencei: - # _____ _ __ _ - # |__ /(_) / _| ___ _ __ ___ ___ (_) - # / / | || |_ / _ \| '_ \ / __|/ _ \| | - # / /_ | || _|| __/| | | || (__| __/| | - # /____||_||_| \___||_| |_| \___|\___||_| - # RV32/RV64 Zifencei Standard Exension - - - name: fence.i - template: Custom - type: Syscall - fields: - - field: opcode - value: "0001111" - - field: funct3 - type: cop - startbit: 14 - stopbit: 12 - value: "001" - - field: zeros - type: cop - startbit: 31 - stopbit: 15 - value: "00000000000000000" - - field: zeros2 - type: cop - startbit: 11 - stopbit: 7 - value: "00000" - definition: | - console.log('Not implemented: fence.i'); - CAPI.VALIDATION.raise('fence.i not implemented'); - help: Provides explicit synchronization between writes to instruction - memory and instruction fetches on the same hart. +Zifencei: + # _____ _ __ _ + # |__ /(_) / _| ___ _ __ ___ ___ (_) + # / / | || |_ / _ \| '_ \ / __|/ _ \| | + # / /_ | || _|| __/| | | || (__| __/| | + # /____||_||_| \___||_| |_| \___|\___||_| + # RV32/RV64 Zifencei Standard Exension + + - name: fence.i + template: Custom + type: Syscall + fields: + - field: opcode + value: "0001111" + - field: funct3 + type: cop + startbit: 14 + stopbit: 12 + value: "001" + - field: zeros + type: cop + startbit: 31 + stopbit: 15 + value: "00000000000000000" + - field: zeros2 + type: cop + startbit: 11 + stopbit: 7 + value: "00000" + definition: | + console.log('Not implemented: fence.i'); + CAPI.VALIDATION.raise('fence.i not implemented'); + help: Provides explicit synchronization between writes to instruction + memory and instruction fetches on the same hart. pseudoinstructions: # Make sure the definitions correspond with those in the RISC-V ASM manual (TODO: Check these!) @@ -3760,9 +3713,8 @@ pseudoinstructions: - field: off type: offset_bytes definition: | - bge reg1, x0, off; - help: Take the branch if the value in register rs1 is greater or equal to - 0. + bge rs1, x0, off; + help: Take the branch if the value in register rs1 is greater or equal to 0. - name: bgt fields: @@ -3887,13 +3839,13 @@ pseudoinstructions: type: imm-unsigned definition: | no_ret_op{ - tmp = Field.2.(31,0).int; - tmp_pc_offset = (reg.pc - 4) & 0xFFF; + tmp = Field.2.(31,0).int - (reg.pc - 4); tmp_low = tmp & 0x00000FFF; - tmp_hi = tmp >> 12; + tmp_low = tmp_low>0x7FF? tmp_low - 0x1000 : tmp_low; + tmp_hi = (tmp - tmp_low) >> 12; }; auipc rd, op{tmp_hi}; - addi rd, rd, op{tmp_low - (tmp_pc_offset)}; + addi rd, rd, op{tmp_low}; - name: li fields: @@ -4111,13 +4063,13 @@ interrupts: CAPI.SYSCALL.read('a0', 'char'); break; } - CAPI.INTERRUPTS.clearHighlight(); + CAPI.STACK.endFrame(); custom: | CAPI.INTERRUPTS.globalDisable(); CAPI.INTERRUPTS.setKernelMode(); - registers.epc = registers.pc; + registers.mepc = CAPI.REG.read("pc"); // get "real" PC (next instruction) // jump to handler if (registers.mtvec & 1n) { // vectored mode @@ -4134,7 +4086,6 @@ interrupts: return null; is_enabled: | - if (!(registers.mstatus & 2n ** 3n)) return false; // MIE switch (type) { case InterruptType.Software: case InterruptType.EnvironmentCall: @@ -4147,7 +4098,7 @@ interrupts: return false; is_global_enabled: | - return !(registers.mstatus & 2n ** 3n); // MIE + return !!(registers.mstatus & 2n ** 3n); // MIE enable: | switch (type) { diff --git a/architecture/RISCV/RV64IMFD.yml b/architecture/RISCV/RV64IMFD.yml index e358d6212..5efea7a0a 100644 --- a/architecture/RISCV/RV64IMFD.yml +++ b/architecture/RISCV/RV64IMFD.yml @@ -6,9 +6,9 @@ version: 2.0.0 config: name: RV64 - word_size: 32 # In RV64, the word size is also 32 bits + word_size: 32 # In RV64, word size is also 32 bits byte_size: 8 - description: RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley. + description: RISC-V is a free and open standard ISA (Instruction Set Architecture) based on RISC (Reduced Instruction Set Computer) principles. It was created in 2010 at the University of California, Berkeley. endianness: big_endian memory_alignment: true main_function: main @@ -46,6 +46,9 @@ extensions: Zicsr: description: "RV32/RV64 Zicsr Standard Extension" type: extension + Priv: + description: "RV32/RV64 Privileged instructions" + type: extension components: - name: Control registers @@ -53,7 +56,7 @@ components: double_precision: false elements: - name: - - PC + - pc nbits: 64 value: 0 default_value: 0 @@ -62,6 +65,90 @@ components: - read - write - program_counter + - name: + - mepc + nbits: 64 + value: 0 + encoding: 1 + default_value: 0 + properties: + - read + - write + - exception_program_counter + - name: + - mcause + nbits: 64 + value: 0 + default_value: 0 + encoding: 0x342 + properties: + - read + - write + + - name: + - mtvec + nbits: 64 + value: 0 + default_value: 0 + encoding: 2 + properties: + - read + - write + - name: + - mstatus + nbits: 64 + value: 8 + default_value: 8 + encoding: 3 + properties: + - read + - write + - name: + - mip + nbits: 64 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - mie + nbits: 64 + value: 0x00000888 + default_value: 0x00000888 # MEIE + MTIE + MSIE + encoding: 5 + properties: + - read + - write + - name: + - mscratch + nbits: 64 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - mtime + nbits: 64 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - mtimecmp + nbits: 64 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - name: Integer registers type: int_registers double_precision: false @@ -80,8 +167,8 @@ components: - x1 - ra nbits: 64 - value: 18446744073709551615 - default_value: 18446744073709551615 + value: -1 + default_value: -1 encoding: 1 properties: - read @@ -90,8 +177,8 @@ components: - x2 - sp nbits: 64 - value: 268435452 - default_value: 268435452 + value: 0x0FFFFFFC + default_value: 0x0FFFFFFC encoding: 2 properties: - read @@ -402,6 +489,7 @@ components: properties: - read - write + - name: Floating point registers type: fp_registers double_precision: true @@ -1403,8 +1491,8 @@ instructions: - field: funct3 value: "000" definition: | - if (registers[rs1] === registers[rs2]) - registers["PC"] = registers["PC"] + imm; + if (registers[rs1] === registers[rs2]) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 and rs2 are equal. - name: bge @@ -1416,7 +1504,7 @@ instructions: value: "101" definition: | if (CAPI.FP.uint2int(registers[rs1]) >= CAPI.FP.uint2int(registers[rs2])) - registers["PC"] = registers["PC"] + imm; + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 is greater than or equal to rs2, using signed comparison. @@ -1428,8 +1516,8 @@ instructions: - field: funct3 value: "111" definition: | - if (CAPI.FP.int2uint(registers[rs1]) > CAPI.FP.int2uint(registers[rs2])) - registers["PC"] = registers["PC"] + imm; + if (CAPI.FP.int2uint(registers[rs1]) >= CAPI.FP.int2uint(registers[rs2])) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 is greater than or equal to rs2, using unsigned comparison. @@ -1442,9 +1530,8 @@ instructions: value: "100" definition: | if (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) - registers["PC"] = registers["PC"] + imm; - help: Take the branch if registers rs1 is less than rs2, using signed - comparison. + registers.pc = registers.pc + imm; + help: Take the branch if registers rs1 is less than rs2, using signed comparison. - name: bltu template: B @@ -1455,9 +1542,8 @@ instructions: value: "110" definition: | if (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(registers[rs2])) - registers["PC"] = registers["PC"] + imm; - help: Take the branch if registers rs1 is less than rs2, using unsigned - comparison. + registers.pc = registers.pc + imm; + help: Take the branch if registers rs1 is less than rs2, using unsigned comparison. - name: bne template: B @@ -1467,8 +1553,8 @@ instructions: - field: funct3 value: "001" definition: | - if (registers[rs1] !== registers[rs2]) - registers["PC"] = registers["PC"] + imm; + if (registers[rs1] !== registers[rs2]) + registers.pc = registers.pc + imm; help: Take the branch if registers rs1 and rs2 are not equal. # I-type instructions @@ -1521,8 +1607,7 @@ instructions: value: "111" definition: | registers[rd] = registers[rs1] & CAPI.FP.int2uint(imm); - help: Performs bitwise AND on register rs1 and the sign-extended 12-bit - immediate and place the result in rd. + help: Performs bitwise AND on register rs1 and the sign-extended 12-bit immediate and place the result in rd. - name: jalr template: I-Offset @@ -1533,9 +1618,11 @@ instructions: - field: funct3 value: "000" definition: | - registers[rd] = registers["PC"] + 4n; - registers["PC"] = (registers[rs1] + imm) & ~1n; - CAPI.STACK.endFrame(); + registers[rd] = registers.pc + 4n; + const pc = registers[rs1] + imm; + registers.pc = pc & ~1n; + if (BigInt.asIntN(64, pc) === -1n) CAPI.SYSCALL.exit(); + else CAPI.STACK.endFrame(); help: Jump to address and place return address in rd. - name: lb @@ -1547,9 +1634,11 @@ instructions: - field: funct3 value: "000" definition: | - registers[rd] = CAPI.MEM.read(imm + registers[rs1], 1, rd); - + let addr = registers[rs1] + imm; + const result = CAPI.MEM.read(addr, 1, rd, false); + registers[rd] = CAPI.FP.int2uint(CAPI.FP.uint2int(result, 8)); help: Loads a 8-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lbu template: I-Offset type: Memory access @@ -1560,9 +1649,10 @@ instructions: value: "100" definition: | let addr = CAPI.FP.int2uint(registers[rs1]) + imm; - registers[rd] = CAPI.MEM.read(addr, 1, rd); - registers[rd] = CAPI.FP.int2uint(registers[rd]); + let result = CAPI.MEM.read(addr, 1, rd, false); + registers[rd] = CAPI.FP.int2uint(result); help: Loads a 8-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lh template: I-Offset type: Memory access @@ -1572,9 +1662,13 @@ instructions: - field: funct3 value: "001" definition: | - registers[rd] = CAPI.MEM.read(imm + registers[rs1], 2, rd); - + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + const result = CAPI.MEM.read(addr, 2, rd, false); + registers[rd] = CAPI.FP.int2uint(CAPI.FP.uint2int(result, 16)); help: Loads a 16-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lhu template: I-Offset type: Memory access @@ -1584,10 +1678,13 @@ instructions: - field: funct3 value: "101" definition: | - let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; - registers[rd] = CAPI.MEM.read(addr, 2, rd); - registers[rd] = CAPI.FP.int2uint(registers[rd]); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + let result = CAPI.MEM.read(addr, 2, rd, false); + registers[rd] = CAPI.FP.int2uint(result); help: Loads a 16-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lw template: I-Offset type: Memory access @@ -1597,10 +1694,11 @@ instructions: - field: funct3 value: "010" definition: | - let addr = CAPI.FP.int2uint(registers[rs1], 32) + imm; - registers[rd] = CAPI.MEM.read(addr, 4, rd); - help: Loads a 32-bit value from memory and sign-extends this to XLEN bits - before storing it in register rd. + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 4, rd, false); + help: Loads a 32-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. - name: lwu template: I-Offset @@ -1611,11 +1709,12 @@ instructions: - field: funct3 value: "110" definition: | - var addr = CAPI.FP.int2uint(registers[rs1]) + imm; - registers[rd] = CAPI.MEM.read(addr, 4, rd); - registers[rd] = CAPI.FP.int2uint(registers[rd]); - help: Loads a 32-bit value from memory and zero-extends this to 64 bits - before storing it in register rd. + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + result = CAPI.MEM.read(addr, 4, rd, false); + registers[rd] = CAPI.FP.int2uint(result); + help: Loads a 32-bit value from memory and zero-extends this to 64 bits before storing it in register rd. - name: ld template: I-Offset @@ -1626,8 +1725,10 @@ instructions: - field: funct3 value: "011" definition: | - let addr = CAPI.FP.int2uint(registers[rs1]) + imm; - registers[rd] = CAPI.MEM.read(addr, 8, rd); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 8, rd, false); help: Loads a 64-bit value from memory into register rd for RV64I. - name: ori @@ -1640,8 +1741,8 @@ instructions: value: "110" definition: | registers[rd] = registers[rs1] | imm; - help: Performs bitwise OR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: slli # In RV64, slli is a 6-bit shift, so we need to slightly modify the template template: I-Shift @@ -1658,8 +1759,7 @@ instructions: startbit: 25 definition: | if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] << shamt); - help: Performs logical left shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: slliw template: I-Shift @@ -1677,8 +1777,7 @@ instructions: registers[rd] = temp & 0x80000000n ? temp | 0xFFFFFFFF00000000n : temp; registers[rd] = CAPI.FP.int2uint(registers[rd]); } - help: Performs logical left shift on the 32-bit of value in register rs1 - by the shift amount held in the lower 5 bits of the immediate. + help: Performs logical left shift on the 32-bit of value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: slti template: I @@ -1689,9 +1788,9 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1 : 0; - + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1n : 0n; help: Place the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. + - name: sltiu template: I type: Logic @@ -1701,8 +1800,9 @@ instructions: - field: funct3 value: "011" definition: | - registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1: 0; + registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1n : 0n; help: Place the value 1 in register rd if register rs1 is less than the immediate when both are treated as unsigned numbers, else 0 is written to rd. + - name: srai template: I-Shift type: Arithmetic integer @@ -1715,8 +1815,7 @@ instructions: value: "0100000" definition: | if (shamt > 0) registers[rd] = (BigInt.asIntN(64, registers[rs1]) >> shamt); - help: Performs arithmetic right shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: sraiw template: I-Shift @@ -1733,8 +1832,7 @@ instructions: const temp = BigInt.asIntN(32, BigInt(registers[rs1])) >> BigInt(shamt); registers[rd] = CAPI.FP.int2uint(temp); } - help: Performs arithmetic right shift on the 32-bit of value in register - rs1 by the shift amount held in the lower 5 bits of the immediate. + help: Performs arithmetic right shift on the 32-bit of value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: srli template: I-Shift @@ -1746,9 +1844,8 @@ instructions: - field: funct7 value: "0000000" definition: | - if (shamt > 0) rd = (rs1 >> shamt); - help: Performs logical right shift on the value in register rs1 by the - shift amount held in the lower 5 bits of the immediate. + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); + help: Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: srliw template: I-Shift @@ -1763,12 +1860,11 @@ instructions: definition: | if (shamt > 0) { const temp = - ((BigInt(registers[rs1]) & 0xffffffffn) >> BigInt(shamt)) & 0xffffffffn; + ((registers[rs1] & 0xffffffffn) >> shamt) & 0xffffffffn; registers[rd] = temp & 0x80000000n ? temp | 0xffffffff00000000n : temp; registers[rd] = CAPI.FP.int2uint(registers[rd]); } - help: Performs logical right shift on the 32-bit of value in register rs1 - by the shift amount held in the lower 5 bits of the immediate. + help: Performs logical right shift on the 32-bit of value in register rs1 by the shift amount held in the lower 5 bits of the immediate. - name: xori template: I @@ -1799,8 +1895,8 @@ instructions: - field: opcode value: "1101111" definition: | - registers[rd] = registers["PC"] + 4n; - registers["PC"] = registers["PC"] + imm; + registers[rd] = registers.pc + 4n; + registers.pc = registers.pc + imm; CAPI.STACK.beginFrame(); help: Jump to address and place return address in rd. @@ -1824,8 +1920,7 @@ instructions: definition: | registers[rd] = registers[rs2] + registers[rs1]; help: Adds the registers rs1 and rs2 and stores the result in rd. - Arithmetic overflow is ignored and the result is simply the low XLEN - bits of the result. + Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. - name: addw template: R @@ -1855,8 +1950,8 @@ instructions: value: "111" definition: | registers[rd] = registers[rs1] & registers[rs2]; - help: Performs bitwise AND on registers rs1 and rs2 and place the result in rd. + - name: or template: R fields: @@ -1868,8 +1963,8 @@ instructions: value: "110" definition: | registers[rd] = registers[rs1] | registers[rs2]; - help: Performs bitwise OR on registers rs1 and rs2 and place the result in rd. + - name: sll template: R fields: @@ -1882,8 +1977,7 @@ instructions: definition: | const shiftAmount = registers[rs2] & 0x1Fn; registers[rd] = (registers[rs1] << shiftAmount) & 0xFFFFFFFFn; - help: Performs logical left shift on the value in register rs1 by the - shift amount held in the lower 5 bits of register rs2. + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. - name: sllw template: R @@ -1912,9 +2006,9 @@ instructions: - field: funct3 value: "010" definition: | - registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1 : 0; - + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1n : 0n; help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as signed numbers, else 0 is written to rd. + - name: sltu template: R fields: @@ -1926,8 +2020,10 @@ instructions: value: "011" definition: | registers[rd] = ((registers[rs1] & 0xFFFFFFFFn) < (registers[rs2] & 0xFFFFFFFFn)) ? 1n : 0n; + help: Place the value 1 in register rd if register rs1 is less than + register rs2 when both are treated as unsigned numbers, else 0 is + written to rd. - help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as unsigned numbers, else 0 is written to rd. - name: sra template: R fields: @@ -2016,8 +2112,8 @@ instructions: - field: funct3 value: "000" definition: | - const temp = (BigInt(rs1) + BigInt(rs2)) & 0xFFFFFFFFn; - rd = temp & 0x80000000n ? temp | 0xFFFFFFFF00000000n : temp; + const temp = (registers[rs1] + registers[rs2]) & 0xFFFFFFFFn; + registers[rd] = temp & 0x80000000n ? temp | 0xFFFFFFFF00000000n : temp; help: Subtract the 32-bit of registers rs1 and 32-bit of register rs2 and stores the result in rd. Arithmetic overflow is ignored and the low 32-bits of the result is sign-extended to 64-bits and written to the @@ -2034,8 +2130,7 @@ instructions: value: "100" definition: | registers[rd] = (registers[rs1] ^ registers[rs2]); - help: Performs bitwise XOR on registers rs1 and rs2 and place the result - in rd. + help: Performs bitwise XOR on registers rs1 and rs2 and place the result in rd. # S-type instructions # 31-25 24-20 19-15 14-12 11-7 6-0 @@ -2053,7 +2148,7 @@ instructions: - field: funct3 value: "000" definition: | - CAPI.MEM.write(registers[rs1] + imm, 1, BigInt.asUintN(8, registers[rs2]), rs2, 'byte'); + CAPI.MEM.write(registers[rs1] + imm, 1, BigInt.asUintN(8, registers[rs2]), rs2, 'byte', false); help: Store 8-bit, values from the low bits of register rs2 to memory. - name: sh @@ -2064,8 +2159,10 @@ instructions: - field: funct3 value: "001" definition: | - CAPI.MEM.write(imm + registers[rs1], 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half'); - + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half', false); help: Store 16-bit, values from the low bits of register rs2 to memory. # The check for the @@ -2077,8 +2174,10 @@ instructions: - field: funct3 value: "010" definition: | - CAPI.MEM.write(imm + registers[rs1], 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word'); - + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word', false); help: Store 32-bit, values from the low bits of register rs2 to memory. - name: sd @@ -2089,12 +2188,16 @@ instructions: - field: funct3 value: "011" definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); CAPI.MEM.write( - imm + registers[rs1], + addr, 8, BigInt.asUintN(64, registers[rs2]), rs2, - "double", + "float64", + false, ); help: Loads a 64-bit value from memory into register rd for RV64I. @@ -2114,9 +2217,9 @@ instructions: - field: imm type: offset_bytes definition: | - registers[rd] = registers["PC"] + (imm << 12n); - + registers[rd] = registers.pc + (imm << 12n); help: Build pc-relative addresses and uses the U-type format. AUIPC forms a 32-bit offset from the 20-bit U-immediate, filling in the lowest 12 bits with zeros, adds this offset to the pc, then places the result in register rd. + - name: lui template: U fields: @@ -2144,42 +2247,8 @@ instructions: value: "0000000000000000000000000" preoperation: 'let [fa0Value, fa0Type] = CAPI.ARCH.toJSNumberD(registers["fa0"]);' definition: | - switch (registers["a7"]) { - case 1n: - CAPI.SYSCALL.print(registers["a0"], 'int32'); - break; - case 2n: - case 3n: - CAPI.SYSCALL.print(fa0Value, 'float'); - break; - case 4n: - CAPI.SYSCALL.print(registers["a0"], 'string'); - break; - case 5n: - CAPI.SYSCALL.read('registers["a0"]', 'int32'); - break; - case 6n: - CAPI.SYSCALL.read(fa0Value, 'float'); - break; - case 7n: - CAPI.SYSCALL.read(fa0Value, 'double'); - break; - case 8n: - CAPI.SYSCALL.read('registers["a0"]', 'string', 'registers["a1"]'); - break; - case 9n: - CAPI.SYSCALL.sbrk('registers["a0"]', 'registers["a0"]'); - break; - case 10n: - CAPI.SYSCALL.exit(); - break; - case 11n: - CAPI.SYSCALL.print(registers["a0"], 'char'); - break; - case 12n: - CAPI.SYSCALL.read('registers["a0"]', 'char'); - break; - } + CAPI.INTERRUPTS.create(InterruptType.EnvironmentCall); + CAPI.STACK.beginFrame(); help: Make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode @@ -2231,7 +2300,7 @@ instructions: if (registers[rs2] != 0) { registers[rd] = BigInt.asIntN( 32, - (BigInt.asIntN(32, registers[rs1]) / BigInt.asIntN(32, registers[rs2])) + (BigInt.asIntN(32, BigInt(registers[rs1])) / BigInt.asIntN(32, BigInt(registers[rs2]))) ); } else CAPI.VALIDATION.raise('Division by zero not allowed'); @@ -2248,10 +2317,11 @@ instructions: - field: funct3 value: "101" definition: | - if (registers[rs2] != 0) { + const div = registers[rs2] + if (div != 0) { registers[rd] = BigInt.asIntN( 32, - (BigInt.asUintN(32, registers[rs1]) / BigInt.asUintN(32, registers[rs2])) + (BigInt.asUintN(32, registers[rs1]) / BigInt.asUintN(32, div)) ); } else CAPI.VALIDATION.raise('Division by zero not allowed'); @@ -2282,7 +2352,7 @@ instructions: - field: funct3 value: "001" definition: | - registers[rd] = BigInt.asIntN( + registers[rd] = BigInt.asUintN( 32, BigInt.asIntN( 64, @@ -2379,12 +2449,14 @@ instructions: - field: rd type: SFP-Reg definition: | - registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 4, rd); - + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 4, rd, false); postoperation: | registers[rd] = CAPI.ARCH.NaNBox(registers[rd]); - help: Load a single-precision floating-point value from memory into floating-point register rd. + - name: fadd.s template: R-Floating fields: @@ -2407,11 +2479,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = rs1Number + rs2Number; - help: Perform single-precision floating-point addition. + - name: fclass.s template: R-Floating fields: @@ -2439,7 +2510,12 @@ instructions: a.slice(1, 9), a.slice(10), )); - help: Examines the value in floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + help: Examines the value in floating-point register rs1 and writes to + integer register rd a 10-bit mask that indicates the class of the + floating-point number. The corresponding bit in rd will be set if the + property is true and clear otherwise. All other bits in rd are cleared. + Note that exactly one bit in rd will be set. + - name: fcvt.s.w template: R-IntToFloat fields: @@ -2455,11 +2531,11 @@ instructions: optional: true order: 3 postoperation: | - registers[rd] = CAPI.ARCH.toBigInt(registers[rd],'NaNBfloat32_64'); + registers[rd] = CAPI.ARCH.toBigInt(result,'NaNBfloat32_64'); definition: | - registers[rd] = CAPI.FP.uint2int(registers[rs1]) - + result = CAPI.FP.uint2int(registers[rs1]) help: Converts a 32-bit signed integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.s.wu template: R-IntToFloat fields: @@ -2476,8 +2552,8 @@ instructions: order: 3 definition: | registers[rd] = CAPI.FP.int2uint(registers[rs1]) - help: Converts a 32-bit unsigned integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.s template: R-FloatToInt fields: @@ -2502,11 +2578,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = parseInt(registers[rs1]); - help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in integer register rd. + - name: fcvt.wu.s template: R-FloatToInt fields: @@ -2533,8 +2608,8 @@ instructions: } definition: | registers[rd] = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in unsigned integer register rd. + - name: fdiv.s template: R-Floating fields: @@ -2560,8 +2635,8 @@ instructions: definition: | if (rs2Number != 0) { result = rs1Number / rs2Number; } else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); - help: Perform single-precision floating-point division. + - name: feq.s template: R-Floating fields: @@ -2574,20 +2649,16 @@ instructions: - field: rd type: INT-Reg preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); - } - definition: | - result = (rs1Number === rs2Number) ? 1 : 0; + registers[rd] = (rs1Number === rs2Number)? 1n : 0n; + help: Performs a quiet equal comparison between floating-point registers + rs1 and rs2 and record the Boolean result in integer register rd. Only + signaling NaN inputs cause an Invalid Operation exception. The result is + 0 if either operand is NaN. - help: Performs a quiet equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: fle.s template: R-Floating fields: @@ -2600,20 +2671,16 @@ instructions: - field: rd type: INT-Reg preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); - } - definition: | - result = (rs1Number <= rs2Number) ? 1 : 0; + registers[rd] = (rs1Number <= rs2Number)? 1n : 0n; + help: Performs a quiet equal comparison between floating-point registers + rs1 and rs2 and record the Boolean result in integer register rd. Only + signaling NaN inputs cause an Invalid Operation exception. The result is + 0 if either operand is NaN. - help: Performs a quiet less or equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: flt.s template: R-Floating fields: @@ -2626,20 +2693,16 @@ instructions: - field: rd type: INT-Reg preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - if (CAPI.FP.isNaN(result)) { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); - } else { - registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); - } - definition: | - result = (rs1Number < rs2Number) ? 1 : 0; + registers[rd] = (rs1Number < rs2Number)? 1n : 0n; + help: Performs a quiet less or equal comparison between floating-point + registers rs1 and rs2 and record the Boolean result in integer register + rd. Only signaling NaN inputs cause an Invalid Operation exception. The + result is 0 if either operand is NaN. - help: Performs a quiet less comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: fmax.s template: R-Floating fields: @@ -2659,11 +2722,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = Math.max(rs1Number, rs2Number); - help: Write the larger of single precision data in rs1 and rs2 to rd. + - name: fmin.s template: R-Floating fields: @@ -2685,8 +2747,8 @@ instructions: } definition: | result = Math.min(rs1Number, rs2Number); - help: Write the smaller of single precision data in rs1 and rs2 to rd. + - name: fmul.s template: R-Floating fields: @@ -2711,8 +2773,8 @@ instructions: } definition: | result = rs2Number * rs1Number; - help: Perform single-precision floating-point multiplication. + - name: fmv.w.x template: R-IntToFloat fields: @@ -2733,11 +2795,12 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = CAPI.FP.uint2float32(rs1Number); + help: Move the single-precision value encoded in IEEE 754-2008 standard + encoding from the lower 32 bits of integer register rs1 to the + floating-point register rd. - help: Move the single-precision value encoded in IEEE 754-2008 standard encoding from the lower 32 bits of integer register rs1 to the floating-point register rd. - name: fmv.x.w template: R-FloatToInt fields: @@ -2761,8 +2824,10 @@ instructions: registers[rs1] = CAPI.ARCH.toBigInt(rs1Number, type_rs1); definition: | result = CAPI.FP.float322uint(rs1Number); + help: Move the single-precision value in floating-point register rs1 + represented in IEEE 754-2008 encoding to the lower 32 bits of integer + register rd. - help: Move the single-precision value in floating-point register rs1 represented in IEEE 754-2008 encoding to the lower 32 bits of integer register rd. - name: fsgnj.s template: R-Floating fields: @@ -2784,8 +2849,8 @@ instructions: } definition: | result = (rs2Number >= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjn.s template: R-Floating fields: @@ -2808,6 +2873,7 @@ instructions: definition: | result = (rs2Number <= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjx.s template: R-Floating fields: @@ -2832,6 +2898,7 @@ instructions: let b = rs2Number < 0; result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.s template: R-Floating fields: @@ -2849,25 +2916,24 @@ instructions: optional: true order: 3 preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let result, rs1Number, type_rs1; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); - [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | if (rs1Number >= 0) { result = Math.sqrt(rs1Number); } else { CAPI.VALIDATION.raise( - 'Square root of a negative number is not allowed.' + "Square root of a negative number is not allowed." ); } help: Perform single-precision square root. + - name: fsub.s template: R-Floating fields: @@ -2890,11 +2956,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = rs1Number - rs2Number; + help: Perform single-precision floating-point subtraction. - help: Perform single-precision floating-point substraction. - name: fmadd.s template: R4 fields: @@ -2911,18 +2976,17 @@ instructions: let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = rs1Number * rs2Number + rs3Number; - help: Perform single-precision fused multiply addition. + - name: fmsub.s template: R4 fields: @@ -2939,18 +3003,17 @@ instructions: let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = rs1Number * rs2Number - rs3Number; - help: Perform single-precision fused multiply addition. + - name: fnmadd.s template: R4 fields: @@ -2967,18 +3030,17 @@ instructions: let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = -rs1Number * rs2Number - rs3Number; - help: Perform negated single-precision fused multiply addition. + - name: fnmsub.s template: R4 fields: @@ -2995,18 +3057,17 @@ instructions: let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(rs3); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); } else { registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); } - definition: | result = -rs1Number * rs2Number + rs3Number; - help: Perform negated single-precision fused multiply addition. + - name: fsw template: S fields: @@ -3018,7 +3079,10 @@ instructions: type: SFP-Reg definition: | let value = registers[rs2] & 0xFFFFFFFFn; - CAPI.MEM.write(registers[rs1] + imm, 4, value, rs2, 'float32'); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, value, rs2, 'float32', false); help: Store a single-precision value from floating-point register rs2 to memory. D: @@ -3040,11 +3104,12 @@ instructions: - field: rd type: DFP-Reg definition: | - if (CAPI.VALIDATION.isMisaligned(registers[rs1] + imm, 'd')) { - CAPI.VALIDATION.raise('The memory must be aligned'); - } - registers[rd] = CAPI.MEM.read(registers[rs1] + imm, 8, rd); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(8, 8, rd, false); help: Load a double-precision floating-point value from memory into floating-point register rd. + - name: fadd.d template: R-Double fields: @@ -3069,8 +3134,8 @@ instructions: } definition: | result = rs1Number + rs2Number; - help: Perform double-precision floating-point addition. + - name: fclass.d template: R-Double fields: @@ -3103,7 +3168,12 @@ instructions: a.slice(1, 12), a.slice(13), ); - help: Examines the value in double-precision floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + help: Examines the value in double-precision floating-point register rs1 + and writes to integer register rd a 10-bit mask that indicates the class + of the floating-point number. The corresponding bit in rd will be set if + the property is true and clear otherwise. All other bits in rd are + cleared. Note that exactly one bit in rd will be set. + - name: fcvt.d.s template: R-Conversion fields: @@ -3134,8 +3204,8 @@ instructions: } definition: | result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual - help: Converts double floating-point register in rs1 into a double floating-point number in floating-point register rd. + - name: fcvt.d.w template: R-Conversion fields: @@ -3155,14 +3225,14 @@ instructions: - field: rs1 type: INT-Reg preoperation: | - let result, rs1Number, type_rs1; - [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + let result, rs1Number; + rs1Number = registers[rs1]; postoperation: | registers[rd] = CAPI.ARCH.toBigInt(result, 'float64'); definition: | result = CAPI.FP.uint2int(rs1Number); - help: Converts a 32-bit signed integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.d.wu template: R-Conversion fields: @@ -3193,8 +3263,8 @@ instructions: } definition: | result = CAPI.FP.int2uint(parseFloat(rs1Number)); - help: Converts a 32-bit unsigned integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.s.d template: R-Conversion fields: @@ -3225,8 +3295,8 @@ instructions: } definition: | result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual - help: Converts double floating-point register in rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.d template: R-Conversion fields: @@ -3255,11 +3325,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit integer, in integer register rd. + - name: fcvt.wu.d template: R-Conversion fields: @@ -3288,11 +3357,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = CAPI.FP.int2uint(parseInt(rs1Number)); - help: Converts a double-precision floating-point number in floating-point register rs1 to a unsigned 32-bit integer, in integer register rd. + - name: fdiv.d template: R-Double fields: @@ -3315,10 +3383,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = rs1Number / rs2Number; help: Perform double-precision floating-point division. + - name: feq.d template: R-Double fields: @@ -3331,15 +3399,16 @@ instructions: - field: rd type: INT-Reg preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - definition: | - registers[rd] = (rs1Number == rs2Number) ? 1 : 0; + registers[rd] = (rs1Number === rs2Number)? 1n : 0n; + help: Performs a quiet equal comparison between double-precision + floating-point registers rs1 and rs2 and record the Boolean result in + integer register rd. Only signaling NaN inputs cause an Invalid + Operation exception. The result is 0 if either operand is NaN. - help: Performs a quiet equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: fle.d template: R-Double fields: @@ -3355,12 +3424,13 @@ instructions: let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - definition: | - registers[rd] = (rs1Number <= rs2Number) ? 1 : 0; + registers[rd] = (rs1Number <= rs2Number)? 1n : 0n; + help: Performs a quiet less or equal comparison between double-precision + floating-point registers rs1 and rs2 and record the Boolean result in + integer register rd. Only signaling NaN inputs cause an Invalid + Operation exception. The result is 0 if either operand is NaN. - help: Performs a quiet less or equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: flt.d template: R-Double fields: @@ -3376,12 +3446,13 @@ instructions: let rs1Number, rs2Number, type_rs1, type_rs2; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); - postoperation: | - definition: | - registers[rd] = (rs1Number < rs2Number) ? 1 : 0; + registers[rd] = (rs1Number < rs2Number)? 1n : 0n; + help: Performs a quiet less comparison between double-precision + floating-point registers rs1 and rs2 and record the Boolean result in + integer register rd. Only signaling NaN inputs cause an Invalid + Operation exception. The result is 0 if either operand is NaN. - help: Performs a quiet less comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. - name: fmax.d template: R-Double fields: @@ -3401,11 +3472,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = Math.max(rs1Number, rs2Number); - help: Write the larger of double precision data in rs1 and rs2 to rd. + - name: fmin.d template: R-Double fields: @@ -3425,11 +3495,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = Math.min(rs1Number, rs2Number); - help: Write the smaller of double precision data in rs1 and rs2 to rd. + - name: fmul.d template: R-Double fields: @@ -3452,11 +3521,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = rs1Number * rs2Number; - help: Perform double-precision floating-point addition. + - name: fsgnj.d template: R-Double fields: @@ -3476,10 +3544,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | registers[rd] = (rs2Number > 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); help: Perform double-precision floating-point multiplication. + - name: fsgnjn.d template: R-Double fields: @@ -3499,11 +3567,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | - registers[rd] = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); + result = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. + The result's sign bit is opposite of rs2's sign bit. - help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is opposite of rs2's sign bit. - name: fsgnjx.d template: R-Double fields: @@ -3523,12 +3591,13 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | let a = rs1Number < 0; let b = rs2Number < 0; - registers[rd] = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); - help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. + The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.d template: R-Double fields: @@ -3546,25 +3615,24 @@ instructions: optional: true order: 3 preoperation: | - let result, rs1Number, rs2Number, type_rs1, type_rs2; + let result, rs1Number, type_rs1; [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); - [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); postoperation: | if (CAPI.FP.isNaN(result)) { registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | if (rs1Number >= 0) { - registers[rd] = Math.sqrt(rs1Number); + result = Math.sqrt(rs1Number); } else { CAPI.VALIDATION.raise( "Square root of a negative number is not allowed." ); } help: Perform double-precision square root. + - name: fsub.d template: R-Double fields: @@ -3587,11 +3655,10 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - definition: | result = rs1Number - rs2Number; - help: Perform double-precision floating-point addition. + - name: fmadd.d template: R4-Double fields: @@ -3615,12 +3682,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); definition: | result = rs1Number * rs2Number + rs3Number; - help: Perform double-precision fused multiply addition. + - name: fmsub.d template: R4-Double fields: @@ -3644,12 +3710,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); definition: | result = rs1Number * rs2Number - rs3Number; - help: Perform double-precision fused multiply subtraction. + - name: fnmadd.d template: R4-Double fields: @@ -3673,12 +3738,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); definition: | result = -rs1Number * rs2Number - rs3Number; - help: Perform negated double-precision fused multiply addition. + - name: fnmsub.d template: R4-Double fields: @@ -3702,12 +3766,11 @@ instructions: } else { registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); } - registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); definition: | result = -rs1Number * rs2Number + rs3Number; - help: Perform negated double-precision fused multiply subtraction. + - name: fsd template: S fields: @@ -3718,57 +3781,106 @@ instructions: - field: rs2 type: DFP-Reg definition: | - let val = BigInt("0x" + CAPI.FP.split_double(registers[rs2], 0)); - CAPI.MEM.write(registers[rs1] + imm, 4, val, rs2); - val = BigInt("0x" + CAPI.FP.split_double(registers[rs2], 1)); - CAPI.MEM.write(registers[rs1] + imm + 4n, 4, val, rs2); - CAPI.MEM.addHint(registers[rs1] + imm, "float64", 64); + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 8, registers[rs2], rs2, 'float64', false); help: Store a double-precision value from the floating-point registers to memory. - # Zicsr: - # _____ _ - # |__ /(_) ___ ___ _ __ - # / / | | / __|/ __|| '__| - # / /_ | || (__ \__ \| | - # /____||_| \___||___/|_| - # RV32/64 Zicsr Standard Extension - - # TODO: Implement CSR instructions + Priv: + # ____ _ + # | _ \ _ __ (_)__ __ + # | |_) || '__|| |\ \ / / + # | __/ | | | | \ V / + # |_| |_| |_| \_/ + # RV32/64 Privileged instructions - Zifencei: - # _____ _ __ _ - # |__ /(_) / _| ___ _ __ ___ ___ (_) - # / / | || |_ / _ \| '_ \ / __|/ _ \| | - # / /_ | || _|| __/| | | || (__| __/| | - # /____||_||_| \___||_| |_| \___|\___||_| - # RV32/RV64 Zifencei Standard Exension - - - name: fence.i + - name: mret + type: Control template: Custom - type: Syscall fields: - field: opcode - value: "0001111" - - field: funct3 - type: cop - startbit: 14 - stopbit: 12 - value: "001" - - field: zeros + value: "1110011" + - field: funct12 type: cop startbit: 31 - stopbit: 15 - value: "00000000000000000" - - field: zeros2 + stopbit: 20 + value: "001100000010" + - field: zeros type: cop - startbit: 11 + startbit: 19 stopbit: 7 - value: "00000" + value: "0000000000000" + definition: | + registers.pc = registers.mepc; + CAPI.INTERRUPTS.globalClear(); // TODO: clear only pending interrupt + CAPI.STACK.endFrame(); + CAPI.INTERRUPTS.setUserMode(); + CAPI.INTERRUPTS.clearHighlight(); + help: Return from traps in M-mode, and mret copies mpie into mie, then + sets mpie. + properties: + - privileged + + Zicsr: + # _____ _ + # |__ /(_) ___ ___ _ __ + # / / | | / __|/ __|| '__| + # / /_ | || (__ \__ \| | + # /____||_| \___||___/|_| + # RV32/64 Zicsr Standard Extension + + - name: csrrw + type: Transfer between registers + template: CSR + fields: + - field: opcode + value: "1110011" + - field: funct3 + value: "001" definition: | - console.log('Not implemented: fence.i'); - CAPI.VALIDATION.raise('fence.i not implemented'); - help: Provides explicit synchronization between writes to instruction - memory and instruction fetches on the same hart. + registers[rd] = registers[csr]; + registers[csr] = registers[rs1]; + help: Atomically swaps values in the CSRs and integer registers. CSRRW + reads the old value of the CSR, then writes it to integer register rd. + The initial value in rs1 is written to the CSR. + + # TODO: Implement rest of CSR instructions + +Zifencei: + # _____ _ __ _ + # |__ /(_) / _| ___ _ __ ___ ___ (_) + # / / | || |_ / _ \| '_ \ / __|/ _ \| | + # / /_ | || _|| __/| | | || (__| __/| | + # /____||_||_| \___||_| |_| \___|\___||_| + # RV32/RV64 Zifencei Standard Exension + + - name: fence.i + template: Custom + type: Syscall + fields: + - field: opcode + value: "0001111" + - field: funct3 + type: cop + startbit: 14 + stopbit: 12 + value: "001" + - field: zeros + type: cop + startbit: 31 + stopbit: 15 + value: "00000000000000000" + - field: zeros2 + type: cop + startbit: 11 + stopbit: 7 + value: "00000" + definition: | + console.log('Not implemented: fence.i'); + CAPI.VALIDATION.raise('fence.i not implemented'); + help: Provides explicit synchronization between writes to instruction + memory and instruction fetches on the same hart. pseudoinstructions: # Make sure the definitions correspond with those in the RISC-V ASM manual (TODO: Check these!) @@ -3793,7 +3905,7 @@ pseudoinstructions: - field: off type: offset_bytes definition: | - bge reg1, x0, off; + bge rs1, x0, off; help: Take the branch if the value in register rs1 is zero. - name: bgt @@ -3918,13 +4030,13 @@ pseudoinstructions: type: imm-unsigned definition: | no_ret_op{ - tmp = Field.2.(31,0).int; - tmp_pc_offset = (reg.pc - 4) & 0xFFF; + tmp = Field.2.(31,0).int - (reg.pc - 4); tmp_low = tmp & 0x00000FFF; - tmp_hi = tmp >> 12 + tmp_low = tmp_low>0x7FF? tmp_low - 0x1000 : tmp_low; + tmp_hi = (tmp - tmp_low) >> 12; }; auipc rd, op{tmp_hi}; - addi rd, rd, op{tmp_low - (tmp_pc_offset)}; + addi rd, rd, op{tmp_low}; - name: li fields: @@ -4093,3 +4205,168 @@ enums: rmm: 4 dyn: 7 DEFAULT: dyn + +interrupts: + handlers: + creator_syscall: | + let [fa0Value, fa0Type] = CAPI.ARCH.toJSNumberD(registers.fa0); + switch (registers.a7) { + case 1n: + CAPI.SYSCALL.print(registers.a0, 'int32'); + break; + case 2n: + case 3n: + CAPI.SYSCALL.print(fa0Value, 'float'); + break; + case 4n: + CAPI.SYSCALL.print(registers.a0, 'string'); + break; + case 5n: + CAPI.SYSCALL.read('a0', 'int32'); + break; + case 6n: + CAPI.SYSCALL.read('fa0', 'float'); + break; + case 7n: + CAPI.SYSCALL.read('fa0', 'double'); + break; + case 8n: + CAPI.SYSCALL.read('a0', 'string', 'a1'); + break; + case 9n: + CAPI.SYSCALL.sbrk('a0', 'a0'); + break; + case 10n: + CAPI.SYSCALL.exit(); + break; + case 11n: + CAPI.SYSCALL.print(registers.a0, 'char'); + break; + case 12n: + CAPI.SYSCALL.read('a0', 'char'); + break; + } + CAPI.INTERRUPTS.clearHighlight(); + CAPI.STACK.endFrame(); + + custom: | + CAPI.INTERRUPTS.globalDisable(); + CAPI.INTERRUPTS.setKernelMode(); + registers.mepc = CAPI.REG.read("pc"); // get "real" PC (next instruction) + + // jump to handler + if (registers.mtvec & 1n) { // vectored mode + registers.pc = + (registers.mtvec >> 2n) + 4 * (registers.mcause & (2 ** 32 - 1)); + } else { // direct mode + registers.pc = registers.mtvec >> 2n + } + + check: | + if (registers.mip & (2n ** 11n)) return InterruptType.External; + if (registers.mip & (2n ** 3n)) return InterruptType.Software; + if (registers.mip & (2n ** 7n)) return InterruptType.Timer; + return null; + + is_enabled: | + switch (type) { + case InterruptType.Software: + case InterruptType.EnvironmentCall: + return !! (registers.mie & 2n ** 3n); // MSIE + case InterruptType.External: + return !! (registers.mie & 2n ** 11n); // MEIE + case InterruptType.Timer: + return !! (registers.mie & 2n ** 7n); // MTIE + } + return false; + + is_global_enabled: | + return !!(registers.mstatus & 2n ** 3n); // MIE + + enable: | + switch (type) { + case InterruptType.Software: + case InterruptType.EnvironmentCall: + registers.mie |= 2n ** 3n; // MSIE + break; + case InterruptType.External: + registers.mie |= 2n ** 11n; // MEIE + break; + case InterruptType.Timer: + registers.mie |= 2n ** 7n; // MTIE + break; + } + + disable: | + switch (type) { + case InterruptType.Software: + case InterruptType.EnvironmentCall: + registers.mie &= ~(2n ** 3n); // MSIE + break; + case InterruptType.External: + registers.mie &= ~(2n ** 11n); // MEIE + break; + case InterruptType.Timer: + registers.mie &= ~(2n ** 7n); // MTIE + break; + } + + global_enable: | + registers.mstatus | 2n ** 3n + + global_disable: | + return !(registers.mstatus | (2n ** 3n)); + + global_clear: | + registers.mip = 0n; + registers.mcause = 0n; + + clear: | + switch (type) { + case InterruptType.Software: + case InterruptType.EnvironmentCall: + registers.mip &= ~(2n ** 3n); // MSIP + break; + case InterruptType.External: + registers.mip &= ~(2n ** 11n); // MEIP + break; + case InterruptType.Timer: + registers.mip &= ~(2n ** 7n); // MTIP + break; + } + registers.mcause = 0n; + + create: | + switch (type) { + case InterruptType.Software: + registers.mcause = 2n ** 3n; + registers.mip |= 2n ** 3n; // MSIP + break; + case InterruptType.External: + registers.mcause = 2n ** 31n + 11n; + registers.mip |= 2n ** 11n; // MEIP + break; + case InterruptType.EnvironmentCall: + registers.mcause = 2n ** 8n; + registers.mip |= 2n ** 3n; // MSIP + break; + case InterruptType.Timer: + registers.mcause = 2n ** 31n + 7n; + registers.mip |= 2n ** 7n; // MTIP + break; + } + +timer: + tick_cycles: 1 + advance: | + registers.mtime = (registers.mtime + 1n) % (2n**32n - 1n); + handler: | + if (registers.mtime === registers.mtimecmp) { + CAPI.INTERRUPTS.create(InterruptType.Timer); + } + is_enabled: | + return !! (registers.mie & 2n ** 7n); // MTIE + enable: | + registers.mie |= 2n ** 7n; // MTIE = 1 + disable: | + registers.mie &= ~(2n ** 7n); // MTIE = 0 diff --git a/architecture/RISCV/SRV32.yml b/architecture/RISCV/SRV32.yml new file mode 100644 index 000000000..1bc57cd10 --- /dev/null +++ b/architecture/RISCV/SRV32.yml @@ -0,0 +1,4567 @@ +# yaml-language-server: $schema=../schema.json +version: 2.0.0 + +# ASCII text generated w/ https://patorjk.com/software/taag/#p=display&h=1&f=Standard +# instruction help text extracted from https://msyksphinz-self.github.io/riscv-isadoc/html/index.html + +config: + name: SRV32 + word_size: 32 + description: RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley. + endianness: big_endian + memory_alignment: true + main_function: main + passing_convention: true + sensitive_register_name: true + comment_prefix: "#" + start_address: 0 + pc_offset: -4 + byte_size: 8 + plugin: riscv + assemblers: + - name: "Sail" + description: Default Creator Compiler +extensions: + I: + description: RV32I Base Instruction Set + template: Base + M: + description: RV32M Integer Multiply/Divide Extension + type: extension + F: + description: RV32F Single-Precision Floating-Point Extension + type: extension + implies: + - Zicsr + D: + description: RV32D Double-Precision Floating-Point Extension + type: extension + implies: + - F + Zifencei: + description: RV32/RV64 Zifencei Standard Extension + type: extension + Zicsr: + description: RV32/RV64 Zicsr Standard Extension + type: extension +components: + - name: Control registers + type: ctrl_registers + double_precision: false + elements: + - name: + - PC + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - program_counter + - name: Integer registers + type: int_registers + double_precision: false + elements: + - name: + - x0 + - zero + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - ignore_write + - name: + - x1 + - ra + nbits: 32 + value: -1 + default_value: -1 + encoding: 1 + properties: + - read + - write + - name: + - x2 + - sp + nbits: 32 + value: 0x0FFFFFFC + default_value: 0x0FFFFFFC + encoding: 2 + properties: + - read + - write + - stack_pointer + - name: + - x3 + - gp + nbits: 32 + value: 0 + default_value: 0 + encoding: 3 + properties: + - read + - write + - global_pointer + - name: + - x4 + - tp + nbits: 32 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - x5 + - t0 + nbits: 32 + value: 0 + default_value: 0 + encoding: 5 + properties: + - read + - write + - name: + - x6 + - t1 + nbits: 32 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - x7 + - t2 + nbits: 32 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - x8 + - fp + - s0 + nbits: 32 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - frame_pointer + - saved + - name: + - x9 + - s1 + nbits: 32 + value: 0 + default_value: 0 + encoding: 9 + properties: + - read + - write + - saved + - name: + - x10 + - a0 + nbits: 32 + value: 0 + default_value: 0 + encoding: 10 + properties: + - read + - write + - name: + - x11 + - a1 + nbits: 32 + value: 0 + default_value: 0 + encoding: 11 + properties: + - read + - write + - name: + - x12 + - a2 + nbits: 32 + value: 0 + default_value: 0 + encoding: 12 + properties: + - read + - write + - name: + - x13 + - a3 + nbits: 32 + value: 0 + default_value: 0 + encoding: 13 + properties: + - read + - write + - name: + - x14 + - a4 + nbits: 32 + value: 0 + default_value: 0 + encoding: 14 + properties: + - read + - write + - name: + - x15 + - a5 + nbits: 32 + value: 0 + default_value: 0 + encoding: 15 + properties: + - read + - write + - name: + - x16 + - a6 + nbits: 32 + value: 0 + default_value: 0 + encoding: 16 + properties: + - read + - write + - name: + - x17 + - a7 + nbits: 32 + value: 0 + default_value: 0 + encoding: 17 + properties: + - read + - write + - name: + - x18 + - s2 + nbits: 32 + value: 0 + default_value: 0 + encoding: 18 + properties: + - read + - write + - saved + - name: + - x19 + - s3 + nbits: 32 + value: 0 + default_value: 0 + encoding: 19 + properties: + - read + - write + - saved + - name: + - x20 + - s4 + nbits: 32 + value: 0 + default_value: 0 + encoding: 20 + properties: + - read + - write + - saved + - name: + - x21 + - s5 + nbits: 32 + value: 0 + default_value: 0 + encoding: 21 + properties: + - read + - write + - saved + - name: + - x22 + - s6 + nbits: 32 + value: 0 + default_value: 0 + encoding: 22 + properties: + - read + - write + - saved + - name: + - x23 + - s7 + nbits: 32 + value: 0 + default_value: 0 + encoding: 23 + properties: + - read + - write + - saved + - name: + - x24 + - s8 + nbits: 32 + value: 0 + default_value: 0 + encoding: 24 + properties: + - read + - write + - saved + - name: + - x25 + - s9 + nbits: 32 + value: 0 + default_value: 0 + encoding: 25 + properties: + - read + - write + - saved + - name: + - x26 + - s10 + nbits: 32 + value: 0 + default_value: 0 + encoding: 26 + properties: + - read + - write + - saved + - name: + - x27 + - s11 + nbits: 32 + value: 0 + default_value: 0 + encoding: 27 + properties: + - read + - write + - saved + - name: + - x28 + - t3 + nbits: 32 + value: 0 + default_value: 0 + encoding: 28 + properties: + - read + - write + - name: + - x29 + - t4 + nbits: 32 + value: 0 + default_value: 0 + encoding: 29 + properties: + - read + - write + - name: + - x30 + - t5 + nbits: 32 + value: 0 + default_value: 0 + encoding: 30 + properties: + - read + - write + - name: + - x31 + - t6 + nbits: 32 + value: 0 + default_value: 0 + encoding: 31 + properties: + - read + - write + - name: Floating point registers + type: fp_registers + double_precision: true + elements: + - name: + - f0 + - ft0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - f1 + - ft1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 1 + properties: + - read + - write + - name: + - f2 + - ft2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 2 + properties: + - read + - write + - name: + - f3 + - ft3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 3 + properties: + - read + - write + - name: + - f4 + - ft4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - f5 + - ft5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 5 + properties: + - read + - write + - name: + - f6 + - ft6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - f7 + - ft7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - f8 + - fs0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - saved + - name: + - f9 + - fs1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 9 + properties: + - read + - write + - saved + - name: + - f10 + - fa0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 10 + properties: + - read + - write + - name: + - f11 + - fa1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 11 + properties: + - read + - write + - name: + - f12 + - fa2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 12 + properties: + - read + - write + - name: + - f13 + - fa3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 13 + properties: + - read + - write + - name: + - f14 + - fa4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 14 + properties: + - read + - write + - name: + - f15 + - fa5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 15 + properties: + - read + - write + - name: + - f16 + - fa6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 16 + properties: + - read + - write + - name: + - f17 + - fa7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 17 + properties: + - read + - write + - name: + - f18 + - fs2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 18 + properties: + - read + - write + - saved + - name: + - f19 + - fs3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 19 + properties: + - read + - write + - saved + - name: + - f20 + - fs4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 20 + properties: + - read + - write + - saved + - name: + - f21 + - fs5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 21 + properties: + - read + - write + - saved + - name: + - f22 + - fs6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 22 + properties: + - read + - write + - saved + - name: + - f23 + - fs7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 23 + properties: + - read + - write + - saved + - name: + - f24 + - fs8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 24 + properties: + - read + - write + - saved + - name: + - f25 + - fs9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 25 + properties: + - read + - write + - saved + - name: + - f26 + - fs10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 26 + properties: + - read + - write + - saved + - name: + - f27 + - fs11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 27 + properties: + - read + - write + - saved + - name: + - f28 + - ft8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 28 + properties: + - read + - write + - name: + - f29 + - ft9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 29 + properties: + - read + - write + - name: + - f30 + - ft10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 30 + properties: + - read + - write + - name: + - f31 + - ft11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 31 + properties: + - read + - write + - name: Vectorial registers + type: v_registers + double_precision: true + elements: + - name: + - v0 + - vt0 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v1 + - vt1 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v2 + - vt2 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v3 + - vt3 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v4 + - vt4 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v5 + - vt5 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v6 + - vt6 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v7 + - vt7 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v8 + - vt8 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v9 + - vt9 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v10 + - vt10 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v11 + - vt11 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v12 + - vt12 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v13 + - vt13 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v14 + - vt14 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v15 + - vt15 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v16 + - vt16 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v17 + - vt17 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v18 + - vt18 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v19 + - vt19 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v20 + - vt20 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v21 + - vt21 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v22 + - vt22 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v23 + - vt23 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v24 + - vt24 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v25 + - vt25 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v26 + - vt26 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v27 + - vt27 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v28 + - vt28 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v29 + - vt29 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v30 + - vt30 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v31 + - vt31 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: Control state registers + type: csr_registers + double_precision: false + elements: +# USER registers + - name: + - ustatus + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uie + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - utvec + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uscratch + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uepc + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - ucause + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - utval + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uip + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# SUPERVISOR registers + - name: + - sstatus + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sedeleg + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sideleg + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sie + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - stvec + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sscratch + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sepc + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - scause + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - stval + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sip + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - satp + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# MACHINE REGISTERS + - name: + - mstatus + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - misa + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - medeleg + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mideleg + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mie + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mstvec + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mscratch + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mepc + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mcause + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mtval + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mip + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mcycle + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - minstret + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# COMMON REGISTERS + - name: + - cycle + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - time + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - instret + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - hpmcounterX + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - hpmcounterXh + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mhartid + nbits: 32 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + +directives: + - name: .data + action: data_segment + size: null + - name: .text + action: code_segment + size: null + - name: .bss + action: global_symbol + size: null + - name: .zero + action: space + size: 1 + - name: .space + action: space + size: 1 + - name: .align + action: align + size: null + - name: .balign + action: balign + size: null + - name: .globl + action: global_symbol + size: null + - name: .string + action: ascii_null_end + size: null + - name: .asciz + action: ascii_null_end + size: null + - name: .ascii + action: ascii_not_null_end + size: null + - name: .byte + action: byte + size: 1 + - name: .half + action: half_word + size: 2 + - name: .word + action: word + size: 4 + - name: .dword + action: double_word + size: 8 + - name: .float + action: float + size: 4 + - name: .double + action: double + size: 8 + +memory_layout: + text: + start: 0x80000000 + end: 0x80003FFF + data: + start: 0x80004000 + end: 0x80005FFF + stack: + start: 0x8000AFFC + end: 0x8000AFFF + +templates: + - name: B + type: Conditional bifurcation + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 1 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 2 + - name: imm + type: offset_bytes + startbit: + - 31 + - 7 + - 30 + - 11 + stopbit: + - 31 + - 7 + - 25 + - 8 + padding: 1 + order: 3 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: 31 + stopbit: 20 + order: 3 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I-Offset + # Not an "official" instruction, but used for the offset in the I-type instructions + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: 31 + stopbit: 20 + order: 2 + space: false + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + order: 3 + prefix: ( + suffix: ) + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I-Shift + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: shamt + type: imm-unsigned + startbit: 24 + stopbit: 20 + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: J + type: Unconditional bifurcation + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: offset_bytes + startbit: + - 31 + - 19 + - 20 + - 30 + stopbit: + - 31 + - 12 + - 20 + - 21 + padding: 1 + order: 2 + + - name: R + type: Arithmetic integer + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Floating # Used in rv32f / rv64f + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Double # Used in rv64d + nwords: 1 + type: Arithmetic floating point + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-IntToFloat # fcvt.s.w,... + nwords: 1 + type: Transfer between registers + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-FloatToInt # fcvt.w.s,... + type: Transfer between registers + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Conversion # Generic template + type: Transfer between registers + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: Not-Set + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: Not-Set + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R4 + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: rs3 + type: DFP-Reg + startbit: 31 + stopbit: 27 + suffix: "," + order: 4 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: funct2 + type: cop + startbit: 26 + stopbit: 25 + + - name: R4-Double + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: rs3 + type: DFP-Reg + startbit: 31 + stopbit: 27 + suffix: "," + order: 4 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: funct2 + type: cop + startbit: 26 + stopbit: 25 + + - name: S + type: Memory access + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: + - 31 + - 11 + stopbit: + - 25 + - 7 + order: 2 + space: false + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + prefix: ( + suffix: ) + order: 3 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: U + type: Arithmetic integer + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-unsigned + startbit: 31 + stopbit: 12 + order: 2 + + - name: CSR + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + order: 3 + - name: csr + type: Ctrl-Reg + startbit: 31 + stopbit: 20 + suffix: "," + order: 2 + + - name: Custom + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + +instructions: + I: + - name: beq + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "000" + definition: | + if (registers[rs1] === registers[rs2]) + registers["PC"] = registers["PC"] + imm; + + help: Take the branch if registers rs1 and rs2 are equal. + - name: bge + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "101" + definition: | + if (CAPI.FP.uint2int(registers[rs1]) >= CAPI.FP.uint2int(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is greater than or equal to rs2, using signed comparison. + - name: bgeu + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "111" + definition: | + if (CAPI.FP.int2uint(registers[rs1]) >= CAPI.FP.int2uint(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is greater than or equal to rs2, using unsigned comparison. + - name: blt + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "100" + definition: | + if (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is less than rs2, using signed comparison. + - name: bltu + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "110" + definition: | + if (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is less than rs2, using unsigned comparison. + - name: bne + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "001" + definition: | + if (registers[rs1] !== registers[rs2]) + registers["PC"] = registers["PC"] + imm; + + help: Take the branch if registers rs1 and rs2 are not equal. + - name: addi + extension: I + template: I + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs1] + imm; + + help: Adds the sign-extended 12-bit immediate to register rs1. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: andi + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] & CAPI.FP.int2uint(imm); + + help: Performs bitwise AND on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: jalr + extension: I + template: I-Offset + type: Unconditional bifurcation + fields: + - field: opcode + value: "1100111" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers.pc + 4n; + const pc = registers[rs1] + imm; + registers.pc = pc & ~1n; + if (BigInt.asIntN(32, pc) === -1n) CAPI.SYSCALL.exit(); + else CAPI.STACK.endFrame(); + help: Jump to address and place return address in rd. + - name: lb + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "000" + definition: | + registers[rd] = CAPI.MEM.read(imm + registers[rs1], 1, rd, false); + + help: Loads a 8-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lbu + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "100" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1]) + imm; + let result = CAPI.MEM.read(addr, 1, rd, false); + registers[rd] = CAPI.FP.int2uint(result); + help: Loads a 8-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lh + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "001" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 2, rd, false); + + help: Loads a 16-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lhu + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "101" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + let result = CAPI.MEM.read(addr, 2, rd, false); + registers[rd] = CAPI.FP.int2uint(result); + help: Loads a 16-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lw + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "010" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 4, rd, false); + help: Loads a 32-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: ld + extension: D + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "011" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 8, rd, false); + help: Loads a 64-bit value from memory into register rd for RV64I. + - name: ori + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] | imm; + + help: Performs bitwise OR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: slli + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "001" + - field: funct7 + value: "0000000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] << shamt); + + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: slti + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "010" + definition: | + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1n : 0n; + + help: Place the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. + - name: sltiu + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "011" + definition: | + registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1n: 0n; + help: Place the value 1 in register rd if register rs1 is less than the immediate when both are treated as unsigned numbers, else 0 is written to rd. + - name: srai + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "101" + - field: funct7 + value: "0100000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); + + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: srli + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "101" + - field: funct7 + value: "0000000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); + + help: Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: xori + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "100" + definition: | + registers[rd] = registers[rs1] ^ imm; + + help: Performs bitwise XOR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. Note, 'XORI rd, rs1, -1' performs a bitwise logical inversion of register rs1(assembler pseudo-instruction NOT rd, rs). + - name: jal + extension: I + template: J + fields: + - field: opcode + value: "1101111" + definition: | + registers[rd] = registers["PC"] + 4n; + registers["PC"] = registers["PC"] + imm; + CAPI.CHECK_STACK.begin(registers["PC"] + imm); + CAPI.DRAW_STACK.begin(registers["PC"] + imm); // This is not an accident. We only see the virtual PC here, and the virtual/physical PC sync happens after the instruction execution. + help: Jump to address and place return address in rd. + - name: add + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs2] + registers[rs1]; + + help: Adds the registers rs1 and rs2 and stores the result in rd. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: and + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] & registers[rs2]; + + help: Performs bitwise AND on registers rs1 and rs2 and place the result in rd. + - name: or + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] | registers[rs2]; + + help: Performs bitwise OR on registers rs1 and rs2 and place the result in rd. + - name: sll + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "001" + definition: | + const shiftAmount = registers[rs2] & 0x1Fn; + registers[rd] = (registers[rs1] << shiftAmount) & 0xFFFFFFFFn; + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: slt + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "010" + definition: | + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1n : 0n; + + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as signed numbers, else 0 is written to rd. + - name: sltu + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "011" + definition: | + registers[rd] = ((registers[rs1] & 0xFFFFFFFFn) < (registers[rs2] & 0xFFFFFFFFn)) ? 1n : 0n; + + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as unsigned numbers, else 0 is written to rd. + - name: sra + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0100000" + - field: funct3 + value: "101" + definition: | + const temp = BigInt.asIntN(32, BigInt(registers[rs1])) >> BigInt(registers[rs2]); + registers[rd] = CAPI.FP.int2uint(temp); + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: srl + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "101" + definition: | + const shiftAmount = registers[rs2] & 0x1Fn; + registers[rd] = (registers[rs1] >> shiftAmount) & 0xFFFFFFFFn; + help: Logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: sub + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0100000" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs1] - registers[rs2]; + + help: Subs the register rs2 from rs1 and stores the result in rd. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: xor + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "100" + definition: | + registers[rd] = (registers[rs1] ^ registers[rs2]); + + help: Performs bitwise XOR on registers rs1 and rs2 and place the result in rd. + - name: sb + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "000" + definition: | + CAPI.MEM.write(registers[rs1] + imm, 1, BigInt.asUintN(8, registers[rs2]), rs2, 'byte', false); + + help: Store 8-bit, values from the low bits of register rs2 to memory. + - name: sh + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "001" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half', false); + + help: Store 16-bit, values from the low bits of register rs2 to memory. + - name: sw + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "010" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word', false); + + help: Store 32-bit, values from the low bits of register rs2 to memory. + + - name: sd + extension: D + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "011" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write( + addr, + 8, + BigInt.asUintN(64, registers[rs2]), + rs2, + "float64", + false, + ); + help: Loads a 64-bit value from memory into register rd for RV64I. + + - name: auipc + extension: I + template: U + fields: + - field: opcode + value: "0010111" + - field: imm + type: offset_bytes + definition: | + registers[rd] = registers["PC"] + (imm << 12n); + + help: Build pc-relative addresses and uses the U-type format. AUIPC forms a 32-bit offset from the 20-bit U-immediate, filling in the lowest 12 bits with zeros, adds this offset to the pc, then places the result in register rd. + - name: lui + extension: I + template: U + fields: + - field: opcode + value: "0110111" + - field: imm + type: imm-unsigned + definition: | + registers[rd] = imm << 12n; + + help: Build 32-bit constants and uses the U-type format. LUI places the U-immediate value in the top 20 bits of the destination register rd, filling in the lowest 12 bits with zeros. + - name: ecall + extension: I + template: Custom + type: Syscall + fields: + - field: opcode + value: "1110011" + - field: zeros + type: cop + startbit: 31 + stopbit: 7 + value: "0000000000000000000000000" + preoperation: 'let [fa0Value, fa0Type] = CAPI.ARCH.toJSNumberD(registers["fa0"]);' + definition: | + switch (registers["a7"]) { + case 1n: + CAPI.SYSCALL.print(registers["a0"], 'int32'); + break; + case 2n: + case 3n: + CAPI.SYSCALL.print(fa0Value, 'float'); + break; + case 4n: + CAPI.SYSCALL.print(registers["a0"], 'string'); + break; + case 5n: + CAPI.SYSCALL.read('a0', 'int'); + break; + case 6n: + CAPI.SYSCALL.read('fa0', 'float'); + break; + case 7n: + CAPI.SYSCALL.read('fa0', 'double'); + break; + case 8n: + CAPI.SYSCALL.read('a0', 'string', 'a1'); + break; + case 9n: + CAPI.SYSCALL.sbrk('a0', 'a0'); + break; + case 10n: + CAPI.SYSCALL.exit(); + break; + case 11n: + CAPI.SYSCALL.print(registers["a0"], 'char'); + break; + case 12n: + CAPI.SYSCALL.read('a0', 'char'); + break; + } + help: Make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode exception, or environment-call-from-M-mode exception, respectively, and performs no other operation. + - name: ebreak + extension: I + template: Custom + type: Syscall + fields: + - field: opcode + value: "1110011" + - field: funct12 + type: cop + startbit: 31 + stopbit: 20 + value: "000000000001" + - field: zeros + type: cop + startbit: 19 + stopbit: 7 + value: "0000000000000" + definition: | + console.log('Not implemented: ebreak'); + CAPI.VALIDATION.raise('ebreak not implemented'); + help: Used by debuggers to cause control to be transferred back to a debugging environment. It generates a breakpoint exception and performs no other operation. + M: + - name: div + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "100" + definition: | + if (registers[rs2] != 0) { + registers[rd] = BigInt.asIntN( + 32, + (BigInt.asIntN(32, BigInt(registers[rs1])) / BigInt.asIntN(32, BigInt(registers[rs2]))) + ); + } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + help: Perform an XLEN bits by XLEN bits signed integer division of rs1 by rs2, rounding towards zero. + - name: divu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "101" + definition: | + const div = registers[rs2] + if (div != 0) { + registers[rd] = CAPI.FP.int2uint(registers[rs1] / div); + } + else CAPI.VALIDATION.raise('Division by zero not allowed'); + help: Perform an XLEN-bit by XLEN-bit unsigned integer division of rs1 by rs2, rounding towards zero. + - name: mul + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "000" + definition: | + registers[rd] = CAPI.FP.uint2int(registers[rs1]) * CAPI.FP.uint2int(registers[rs2]); + + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. + - name: mulh + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "001" + definition: | + registers[rd] = CAPI.FP.int2uint( + (CAPI.FP.uint2int(registers[rs1]) * CAPI.FP.uint2int(registers[rs2])) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. + - name: mulhsu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "010" + definition: | + registers[rd] = CAPI.FP.int2uint( + (CAPI.FP.uint2int(registers[rs1]) * registers[rs2]) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. + - name: mulhu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "011" + definition: | + registers[rd] = CAPI.FP.int2uint( + (registers[rs1] * registers[rs2]) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of unsigned rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. + - name: rem + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] % registers[rs2]; + + help: Perform an XLEN-bit by XLEN-bit signed integer reminder of rs1 by rs2. + - name: remu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] % registers[rs2]; + + help: Perform an XLEN-bit by XLEN-bit unsigned integer reminder of rs1 by rs2. + F: + - name: flw + extension: F + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000111" + - field: funct3 + value: "010" + - field: rd + type: DFP-Reg + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 4, rd, false); + + postoperation: | + registers[rd] = CAPI.ARCH.NaNBox(registers[rd]); + + help: Load a single-precision floating-point value from memory into floating-point register rd. + - name: fadd.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number + rs2Number; + + help: Perform single-precision floating-point addition. + - name: fclass.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110000" + - field: funct3 + value: "001" + - field: rs1 + suffix: null + - field: rs2 + type: cop + value: "00000" + order: null + - field: rd + type: INT-Reg + preoperation: | + let rs1Value, rs2Value, type_rs1, type_rs2; + [rs1Value, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Value, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(registers[rd])) { + registers[rd] = CAPI.ARCH.toBigInt(registers[rd], "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(registers[rd], "NaNBfloat32_64"); + } + registers[rs1] = CAPI.ARCH.toBigInt(rs1Value, type_rs1); + registers[rs2] = CAPI.ARCH.toBigInt(rs2Value, type_rs2); + definition: | + let a = CAPI.FP.float2bin(registers[rs1]); + registers[rd] = CAPI.FP.check_ieee( + parseInt(a[0]), + parseInt(a.slice(1, 9), 2), + parseInt(a.slice(10), 2), + ); + help: Examines the value in floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + - name: fcvt.s.w + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101000" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + postoperation: | + registers[rd] = CAPI.ARCH.toBigInt(result,'NaNBfloat32_64'); + definition: | + result = CAPI.FP.uint2int(registers[rs1]) + + help: Converts a 32-bit signed integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.s.wu + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + definition: | + registers[rd] = CAPI.FP.int2uint(registers[rs1]) + + help: Converts a 32-bit unsigned integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.s + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100000" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = parseInt(registers[rs1]); + + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in integer register rd. + - name: fcvt.wu.s + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + registers[rd] = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in unsigned integer register rd. + - name: fdiv.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001100" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + if (rs2Number != 0) { result = rs1Number / rs2Number; } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + + help: Perform single-precision floating-point division. + - name: feq.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "010" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number === rs2Number)? 1n : 0n; + + help: Performs a quiet equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fle.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "000" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number <= rs2Number)? 1n : 0n; + + help: Performs a quiet less or equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: flt.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "001" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number < rs2Number)? 1n : 0n; + + help: Performs a quiet less comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fmax.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010100" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = Math.max(rs1Number, rs2Number); + + help: Write the larger of single precision data in rs1 and rs2 to rd. + - name: fmin.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010100" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = Math.min(rs1Number, rs2Number); + + help: Write the smaller of single precision data in rs1 and rs2 to rd. + - name: fmul.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = rs2Number * rs1Number; + + help: Perform single-precision floating-point multiplication. + - name: fmv.w.x + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1111000" + - field: funct5 + value: "00000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = CAPI.FP.uint2float32(rs1Number); + + help: Move the single-precision value encoded in IEEE 754-2008 standard encoding from the lower 32 bits of integer register rs1 to the floating-point register rd. + - name: fmv.x.w + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110000" + - field: funct5 + value: "00000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + registers[rs1] = CAPI.ARCH.toBigInt(rs1Number, type_rs1); + definition: | + result = CAPI.FP.float322uint(rs1Number); + + help: Move the single-precision value in floating-point register rs1 represented in IEEE 754-2008 encoding to the lower 32 bits of integer register rd. + - name: fsgnj.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = (rs2Number >= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjn.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = (rs2Number <= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjx.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "010" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + let a = rs1Number < 0; + let b = rs2Number < 0; + result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0101100" + - field: rs2 + type: cop + value: "00000" + order: null + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + if (rs1Number >= 0) { + result = Math.sqrt(rs1Number); + } else { + CAPI.VALIDATION.raise( + "Square root of a negative number is not allowed." + ); + } + help: Perform single-precision square root. + - name: fsub.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000100" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number - rs2Number; + + help: Perform single-precision floating-point subtraction. + - name: fmadd.s + extension: F + template: R4 + fields: + - field: opcode + value: "1000011" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number * rs2Number + rs3Number; + + help: Perform single-precision fused multiply addition. + - name: fmsub.s + extension: F + template: R4 + fields: + - field: opcode + value: "1000111" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number * rs2Number - rs3Number; + + help: Perform single-precision fused multiply addition. + - name: fnmadd.s + extension: F + template: R4 + fields: + - field: opcode + value: "1001111" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = -rs1Number * rs2Number - rs3Number; + + help: Perform negated single-precision fused multiply addition. + - name: fnmsub.s + extension: F + template: R4 + fields: + - field: opcode + value: "1001011" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = -rs1Number * rs2Number + rs3Number; + + help: Perform negated single-precision fused multiply addition. + - name: fsw + extension: F + template: S + fields: + - field: opcode + value: "0100111" + - field: funct3 + value: "010" + - field: rs2 + type: DFP-Reg + definition: | + let value = registers[rs2] & 0xFFFFFFFFn; + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, value, rs2, 'float32', false); + help: Store a single-precision value from floating-point register rs2 to memory. + D: + - name: fld + extension: D + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000111" + - field: funct3 + value: "011" + - field: rd + type: DFP-Reg + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 8, rd, false); + help: Load a double-precision floating-point value from memory into floating-point register rd. + - name: fadd.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number + rs2Number; + + help: Perform double-precision floating-point addition. + - name: fclass.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110001" + - field: funct3 + value: "001" + - field: rs1 + suffix: null + - field: rs2 + type: cop + value: "00000" + order: null + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + let a = CAPI.FP.float2bin(rs1Number); + registers[rd] = CAPI.FP.check_ieee( + parseInt(a[0]), + parseInt(a.slice(1, 12), 2), + parseInt(a.slice(13), 2), + ); + help: Examines the value in double-precision floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + - name: fcvt.d.s + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: rd + type: DFP-Reg + - field: rs1 + type: DFP-Reg + - field: funct7 + value: "0100001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual + + help: Converts double floating-point register in rs1 into a double floating-point number in floating-point register rd. + - name: fcvt.d.w + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + - field: rd + type: DFP-Reg + - field: rs1 + type: INT-Reg + preoperation: | + let result, rs1Number; + rs1Number = registers[rs1]; + postoperation: | + registers[rd] = CAPI.ARCH.toBigInt(result, 'float64'); + definition: | + result = CAPI.FP.uint2int(rs1Number); + + help: Converts a 32-bit signed integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.d.wu + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101001" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + - field: rd + type: DFP-Reg + - field: rs1 + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = CAPI.FP.int2uint(parseFloat(rs1Number)); + + help: Converts a 32-bit unsigned integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.s.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0100000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: DFP-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual + + help: Converts double floating-point register in rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: INT-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit integer, in integer register rd. + - name: fcvt.wu.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100001" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: INT-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Converts a double-precision floating-point number in floating-point register rs1 to a unsigned 32-bit integer, in integer register rd. + - name: fdiv.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001101" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number / rs2Number; + help: Perform double-precision floating-point division. + - name: feq.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "010" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number === rs2Number)? 1n : 0n; + + help: Performs a quiet equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fle.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "000" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number <= rs2Number)? 1n : 0n; + + help: Performs a quiet less or equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: flt.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "001" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number < rs2Number)? 1n : 0n; + + help: Performs a quiet less comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fmax.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010101" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = Math.max(rs1Number, rs2Number); + + help: Write the larger of double precision data in rs1 and rs2 to rd. + - name: fmin.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010101" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = Math.min(rs1Number, rs2Number); + + help: Write the smaller of double precision data in rs1 and rs2 to rd. + - name: fmul.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number * rs2Number; + + help: Perform double-precision floating-point addition. + - name: fsgnj.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + registers[rd] = (rs2Number > 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + help: Perform double-precision floating-point multiplication. + - name: fsgnjn.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); + + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is opposite of rs2's sign bit. + - name: fsgnjx.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "010" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + let a = rs1Number < 0; + let b = rs2Number < 0; + result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0101101" + - field: rs2 + type: cop + value: "00000" + order: null + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + if (rs1Number >= 0) { + result = Math.sqrt(rs1Number); + } else { + CAPI.VALIDATION.raise( + "Square root of a negative number is not allowed." + ); + } + help: Perform double-precision square root. + - name: fsub.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000101" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number - rs2Number; + + help: Perform double-precision floating-point addition. + - name: fmadd.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1000011" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = rs1Number * rs2Number + rs3Number; + + help: Perform double-precision fused multiply addition. + - name: fmsub.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1000111" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = rs1Number * rs2Number - rs3Number; + + help: Perform double-precision fused multiply subtraction. + - name: fnmadd.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1001111" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = -rs1Number * rs2Number - rs3Number; + + help: Perform negated double-precision fused multiply addition. + - name: fnmsub.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1001011" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = -rs1Number * rs2Number + rs3Number; + + help: Perform negated double-precision fused multiply subtraction. + - name: fsd + extension: D + template: S + fields: + - field: opcode + value: "0100111" + - field: funct3 + value: "011" + - field: rs2 + type: DFP-Reg + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 8, registers[rs2], rs2, 'float64', false); + help: Store a double-precision value from the floating-point registers to memory. + Zifencei: + - name: fence.i + extension: D + template: Custom + type: Syscall + fields: + - field: opcode + value: "0001111" + - field: funct3 + type: cop + startbit: 14 + stopbit: 12 + value: "001" + - field: zeros + type: cop + startbit: 31 + stopbit: 15 + value: "00000000000000000" + - field: zeros2 + type: cop + startbit: 11 + stopbit: 7 + value: "00000" + definition: | + console.log('Not implemented: fence.i'); + CAPI.VALIDATION.raise('fence.i not implemented'); + help: Provides explicit synchronization between writes to instruction memory and instruction fetches on the same hart. + +pseudoinstructions: + # Make sure the definitions correspond with those in the RISC-V ASM manual (TODO: Check these!) + + # RV32I Pseudoinstructions + I: + - name: beqz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + beq rs1, x0, off; + + - name: bgez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bge rs1, x0, off; + help: Take the branch if the value in register rs1 is zero. + + - name: bgt + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + blt rs2, rs1, off; + + - name: bgtu + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bltu rs2, rs1, off; + + - name: bgtz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bgt rs1, x0, off; + + - name: ble + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bge rs2, rs1, off; + + - name: bleu + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bgeu rs2, rs1, off; + + - name: blez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + ble x0, rs1, off; + + - name: bltz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + blt rs1, x0, off; + + - name: bnez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bne rs1, x0, off; + + - name: j + extension: I + fields: + - field: off + type: offset_bytes + definition: | + beq zero, zero, off; + + - name: jalr + extension: I + fields: + - field: rs + type: INT-Reg + definition: | + jalr x1, 0(rs); + + - name: jr + extension: I + fields: + - field: rs + type: INT-Reg + definition: | + jalr x0, 0(rs); + + - name: la + extension: I + fields: + - field: rd + type: INT-Reg + suffix: "," + - field: addr + type: imm-unsigned + definition: | + no_ret_op{ + tmp = Field.2.(31,0).int - (reg.pc - 4); + tmp_low = tmp & 0x00000FFF; + tmp_low = tmp_low>0x7FF? tmp_low - 0x1000 : tmp_low; + tmp_hi = (tmp - tmp_low) >> 12; + }; + auipc rd, op{tmp_hi}; + addi rd, rd, op{tmp_low}; + + - name: li + extension: I + fields: + - field: rd + type: INT-Reg + suffix: "," + - field: val + type: imm-signed + definition: | + no_ret_op{ + tmp = Field.2.(31,0).int; + tmp_low = tmp & 0x00000FFF; + tmp_low -= tmp_low > 0x7FF ? 0x1000 : 0; + tmp_hi = (tmp - tmp_low) >>> 12; + }; + if (tmp_hi === 0) { + addi rd, x0, op{tmp_low}; + } + else { + lui rd, op{tmp_hi}; + addi rd, rd, op{tmp_low}; + }; + help: Load the sign-extended 6-bit immediate, imm, into register rd. + + - name: mv + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + addi reg1, reg2, 0; + help: Copy the value in register rs2 into register rd. + + - name: neg + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sub reg1, x0, reg2; + + - name: nop + extension: I + definition: | + addi x0, x0, 0; + help: Does not change any user-visible state, except for advancing the pc. + + - name: not + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + xori reg1, reg2, -1; + + - name: ret + extension: I + definition: | + jalr x0, 0(x1); # TODO: check this! + + - name: seqz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sltiu reg1, reg2, 1; + + - name: sgtz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + slt reg1, x0, reg2; + + - name: sltz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + slt reg1, reg2, x0; + + - name: snez + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sltu reg1, x0, reg2; + F: + # RV32F Pseudoinstructions + - name: fabs.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjx.s rs1, rs2, rs2; + + - name: fmv.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnj.s rs1, rs2, rs2; + + - name: fneg.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjn.s rs1, rs2, rs2; + D: + # RV32D Pseudoinstructions + - name: fabs.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjx.d rs1, rs2, rs2; + + - name: fmv.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnj.d rs1, rs2, rs2; + + - name: fneg.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjn.d rs1, rs2, rs2; + +enums: + rounding_mode: + rne: 0 + rtz: 1 + rdn: 2 + rup: 3 + rmm: 4 + dyn: 7 + DEFAULT: dyn diff --git a/architecture/RISCV/SRV64.yml b/architecture/RISCV/SRV64.yml new file mode 100644 index 000000000..ff392e157 --- /dev/null +++ b/architecture/RISCV/SRV64.yml @@ -0,0 +1,4555 @@ +# yaml-language-server: $schema=../schema.json +version: 2.0.0 + +# ASCII text generated w/ https://patorjk.com/software/taag/#p=display&h=1&f=Standard +# instruction help text extracted from https://msyksphinz-self.github.io/riscv-isadoc/html/index.html + +config: + name: SRV64 + word_size: 32 + description: RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley. + endianness: big_endian + memory_alignment: true + main_function: main + passing_convention: true + sensitive_register_name: true + comment_prefix: "#" + start_address: 0 + pc_offset: -4 + byte_size: 8 + plugin: riscv + assemblers: + - name: "Sail" + description: Default Creator Compiler +extensions: + I: + description: RV32I Base Instruction Set + template: Base + M: + description: RV32M Integer Multiply/Divide Extension + type: extension + F: + description: RV32F Single-Precision Floating-Point Extension + type: extension + implies: + - Zicsr + D: + description: RV32D Double-Precision Floating-Point Extension + type: extension + implies: + - F + Zifencei: + description: RV32/RV64 Zifencei Standard Extension + type: extension + Zicsr: + description: RV32/RV64 Zicsr Standard Extension + type: extension +components: + - name: Control registers + type: ctrl_registers + double_precision: false + elements: + - name: + - PC + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - program_counter + - name: Integer registers + type: int_registers + double_precision: false + elements: + - name: + - x0 + - zero + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - ignore_write + - name: + - x1 + - ra + nbits: 64 + value: -1 + default_value: -1 + encoding: 1 + properties: + - read + - write + - name: + - x2 + - sp + nbits: 64 + value: 0x0FFFFFFC + default_value: 0x0FFFFFFC + encoding: 2 + properties: + - read + - write + - stack_pointer + - name: + - x3 + - gp + nbits: 64 + value: 0 + default_value: 0 + encoding: 3 + properties: + - read + - write + - global_pointer + - name: + - x4 + - tp + nbits: 64 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - x5 + - t0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 5 + properties: + - read + - write + - name: + - x6 + - t1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - x7 + - t2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - x8 + - fp + - s0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - frame_pointer + - saved + - name: + - x9 + - s1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 9 + properties: + - read + - write + - saved + - name: + - x10 + - a0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 10 + properties: + - read + - write + - name: + - x11 + - a1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 11 + properties: + - read + - write + - name: + - x12 + - a2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 12 + properties: + - read + - write + - name: + - x13 + - a3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 13 + properties: + - read + - write + - name: + - x14 + - a4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 14 + properties: + - read + - write + - name: + - x15 + - a5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 15 + properties: + - read + - write + - name: + - x16 + - a6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 16 + properties: + - read + - write + - name: + - x17 + - a7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 17 + properties: + - read + - write + - name: + - x18 + - s2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 18 + properties: + - read + - write + - saved + - name: + - x19 + - s3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 19 + properties: + - read + - write + - saved + - name: + - x20 + - s4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 20 + properties: + - read + - write + - saved + - name: + - x21 + - s5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 21 + properties: + - read + - write + - saved + - name: + - x22 + - s6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 22 + properties: + - read + - write + - saved + - name: + - x23 + - s7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 23 + properties: + - read + - write + - saved + - name: + - x24 + - s8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 24 + properties: + - read + - write + - saved + - name: + - x25 + - s9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 25 + properties: + - read + - write + - saved + - name: + - x26 + - s10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 26 + properties: + - read + - write + - saved + - name: + - x27 + - s11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 27 + properties: + - read + - write + - saved + - name: + - x28 + - t3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 28 + properties: + - read + - write + - name: + - x29 + - t4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 29 + properties: + - read + - write + - name: + - x30 + - t5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 30 + properties: + - read + - write + - name: + - x31 + - t6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 31 + properties: + - read + - write + - name: Floating point registers + type: fp_registers + double_precision: true + elements: + - name: + - f0 + - ft0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - f1 + - ft1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 1 + properties: + - read + - write + - name: + - f2 + - ft2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 2 + properties: + - read + - write + - name: + - f3 + - ft3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 3 + properties: + - read + - write + - name: + - f4 + - ft4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 4 + properties: + - read + - write + - name: + - f5 + - ft5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 5 + properties: + - read + - write + - name: + - f6 + - ft6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 6 + properties: + - read + - write + - name: + - f7 + - ft7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 7 + properties: + - read + - write + - name: + - f8 + - fs0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 8 + properties: + - read + - write + - saved + - name: + - f9 + - fs1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 9 + properties: + - read + - write + - saved + - name: + - f10 + - fa0 + nbits: 64 + value: 0 + default_value: 0 + encoding: 10 + properties: + - read + - write + - name: + - f11 + - fa1 + nbits: 64 + value: 0 + default_value: 0 + encoding: 11 + properties: + - read + - write + - name: + - f12 + - fa2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 12 + properties: + - read + - write + - name: + - f13 + - fa3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 13 + properties: + - read + - write + - name: + - f14 + - fa4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 14 + properties: + - read + - write + - name: + - f15 + - fa5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 15 + properties: + - read + - write + - name: + - f16 + - fa6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 16 + properties: + - read + - write + - name: + - f17 + - fa7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 17 + properties: + - read + - write + - name: + - f18 + - fs2 + nbits: 64 + value: 0 + default_value: 0 + encoding: 18 + properties: + - read + - write + - saved + - name: + - f19 + - fs3 + nbits: 64 + value: 0 + default_value: 0 + encoding: 19 + properties: + - read + - write + - saved + - name: + - f20 + - fs4 + nbits: 64 + value: 0 + default_value: 0 + encoding: 20 + properties: + - read + - write + - saved + - name: + - f21 + - fs5 + nbits: 64 + value: 0 + default_value: 0 + encoding: 21 + properties: + - read + - write + - saved + - name: + - f22 + - fs6 + nbits: 64 + value: 0 + default_value: 0 + encoding: 22 + properties: + - read + - write + - saved + - name: + - f23 + - fs7 + nbits: 64 + value: 0 + default_value: 0 + encoding: 23 + properties: + - read + - write + - saved + - name: + - f24 + - fs8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 24 + properties: + - read + - write + - saved + - name: + - f25 + - fs9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 25 + properties: + - read + - write + - saved + - name: + - f26 + - fs10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 26 + properties: + - read + - write + - saved + - name: + - f27 + - fs11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 27 + properties: + - read + - write + - saved + - name: + - f28 + - ft8 + nbits: 64 + value: 0 + default_value: 0 + encoding: 28 + properties: + - read + - write + - name: + - f29 + - ft9 + nbits: 64 + value: 0 + default_value: 0 + encoding: 29 + properties: + - read + - write + - name: + - f30 + - ft10 + nbits: 64 + value: 0 + default_value: 0 + encoding: 30 + properties: + - read + - write + - name: + - f31 + - ft11 + nbits: 64 + value: 0 + default_value: 0 + encoding: 31 + properties: + - read + - write + - name: Vectorial registers + type: v_registers + double_precision: true + elements: + - name: + - v0 + - vt0 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v1 + - vt1 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v2 + - vt2 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v3 + - vt3 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v4 + - vt4 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v5 + - vt5 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v6 + - vt6 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v7 + - vt7 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v8 + - vt8 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v9 + - vt9 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v10 + - vt10 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v11 + - vt11 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v12 + - vt12 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v13 + - vt13 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v14 + - vt14 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v15 + - vt15 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v16 + - vt16 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v17 + - vt17 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v18 + - vt18 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v19 + - vt19 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v20 + - vt20 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v21 + - vt21 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v22 + - vt22 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v23 + - vt23 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v24 + - vt24 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v25 + - vt25 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v26 + - vt26 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v27 + - vt27 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v28 + - vt28 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v29 + - vt29 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v30 + - vt30 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - v31 + - vt31 + nbits: 512 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: Control state registers + type: csr_registers + double_precision: false + elements: +# USER registers + - name: + - ustatus + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uie + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - utvec + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uscratch + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uepc + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - ucause + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - utval + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - uip + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# SUPERVISOR registers + - name: + - sstatus + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sedeleg + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sideleg + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sie + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - stvec + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sscratch + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sepc + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - scause + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - stval + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - sip + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - satp + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# MACHINE REGISTERS + - name: + - mstatus + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - misa + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - medeleg + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mideleg + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mie + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mstvec + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mscratch + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mepc + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mcause + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mtval + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mip + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mcycle + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - minstret + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write +# COMMON REGISTERS + - name: + - cycle + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - time + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - instret + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - hpmcounterX + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - hpmcounterXh + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + - name: + - mhartid + nbits: 64 + value: 0 + default_value: 0 + encoding: 0 + properties: + - read + - write + +directives: + - name: .data + action: data_segment + size: null + - name: .text + action: code_segment + size: null + - name: .bss + action: global_symbol + size: null + - name: .zero + action: space + size: 1 + - name: .space + action: space + size: 1 + - name: .align + action: align + size: null + - name: .balign + action: balign + size: null + - name: .globl + action: global_symbol + size: null + - name: .string + action: ascii_null_end + size: null + - name: .asciz + action: ascii_null_end + size: null + - name: .ascii + action: ascii_not_null_end + size: null + - name: .byte + action: byte + size: 1 + - name: .half + action: half_word + size: 2 + - name: .word + action: word + size: 4 + - name: .dword + action: double_word + size: 8 + - name: .float + action: float + size: 4 + - name: .double + action: double + size: 8 + +memory_layout: + text: + start: 0x0 + end: 0x1FFFF + data: + start: 0x20000 + end: 0x0FFFFFFF + stack: + start: 0x3FFFFFFC + end: 0x3FFFFFFF + +# memory_layout: +# text: +# start: 0 +# end: 131071 +# data: +# start: 131072 +# end: 70368744177663 +# stack: +# start: 140737488355324 +# end: 140737488355327 + +templates: + - name: B + type: Conditional bifurcation + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 1 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 2 + - name: imm + type: offset_bytes + startbit: + - 31 + - 7 + - 30 + - 11 + stopbit: + - 31 + - 7 + - 25 + - 8 + padding: 1 + order: 3 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: 31 + stopbit: 20 + order: 3 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I-Offset + # Not an "official" instruction, but used for the offset in the I-type instructions + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: 31 + stopbit: 20 + order: 2 + space: false + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + order: 3 + prefix: ( + suffix: ) + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: I-Shift + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: shamt + type: imm-unsigned + startbit: 24 + stopbit: 20 + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: J + type: Unconditional bifurcation + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: offset_bytes + startbit: + - 31 + - 19 + - 20 + - 30 + stopbit: + - 31 + - 12 + - 20 + - 21 + padding: 1 + order: 2 + + - name: R + type: Arithmetic integer + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Floating # Used in rv32f / rv64f + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Double # Used in rv64d + nwords: 1 + type: Arithmetic floating point + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-IntToFloat # fcvt.s.w,... + nwords: 1 + type: Transfer between registers + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-FloatToInt # fcvt.w.s,... + type: Transfer between registers + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R-Conversion # Generic template + type: Transfer between registers + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: Not-Set + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: Not-Set + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: funct5 + type: cop + startbit: 24 + stopbit: 20 + - name: funct7 + type: cop + startbit: 31 + stopbit: 25 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: R4 + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: rs3 + type: DFP-Reg + startbit: 31 + stopbit: 27 + suffix: "," + order: 4 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: funct2 + type: cop + startbit: 26 + stopbit: 25 + + - name: R4-Double + type: Arithmetic floating point + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: DFP-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: rs1 + type: DFP-Reg + startbit: 19 + stopbit: 15 + suffix: "," + order: 2 + - name: rs2 + type: DFP-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 3 + - name: rs3 + type: DFP-Reg + startbit: 31 + stopbit: 27 + suffix: "," + order: 4 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: funct2 + type: cop + startbit: 26 + stopbit: 25 + + - name: S + type: Memory access + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rs2 + type: INT-Reg + startbit: 24 + stopbit: 20 + suffix: "," + order: 1 + - name: imm + type: imm-signed + startbit: + - 31 + - 11 + stopbit: + - 25 + - 7 + order: 2 + space: false + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + prefix: ( + suffix: ) + order: 3 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + + - name: U + type: Arithmetic integer + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: imm + type: imm-unsigned + startbit: 31 + stopbit: 12 + order: 2 + + - name: CSR + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + - name: rd + type: INT-Reg + startbit: 11 + stopbit: 7 + suffix: "," + order: 1 + - name: funct3 + type: cop + startbit: 14 + stopbit: 12 + - name: rs1 + type: INT-Reg + startbit: 19 + stopbit: 15 + order: 3 + - name: csr + type: Ctrl-Reg + startbit: 31 + stopbit: 20 + suffix: "," + order: 2 + + - name: Custom + nwords: 1 + clk_cycles: 1 + fields: + - name: opcode + type: co + startbit: 6 + stopbit: 0 + order: 0 + +instructions: + I: + - name: beq + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "000" + definition: | + if (registers[rs1] === registers[rs2]) + registers["PC"] = registers["PC"] + imm; + + help: Take the branch if registers rs1 and rs2 are equal. + - name: bge + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "101" + definition: | + if (CAPI.FP.uint2int(registers[rs1]) >= CAPI.FP.uint2int(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is greater than or equal to rs2, using signed comparison. + - name: bgeu + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "111" + definition: | + if (CAPI.FP.int2uint(registers[rs1]) >= CAPI.FP.int2uint(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is greater than or equal to rs2, using unsigned comparison. + - name: blt + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "100" + definition: | + if (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is less than rs2, using signed comparison. + - name: bltu + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "110" + definition: | + if (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(registers[rs2])) + registers["PC"] = registers["PC"] + imm; + help: Take the branch if registers rs1 is less than rs2, using unsigned comparison. + - name: bne + extension: I + template: B + fields: + - field: opcode + value: "1100011" + - field: funct3 + value: "001" + definition: | + if (registers[rs1] !== registers[rs2]) + registers["PC"] = registers["PC"] + imm; + + help: Take the branch if registers rs1 and rs2 are not equal. + - name: addi + extension: I + template: I + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs1] + imm; + + help: Adds the sign-extended 12-bit immediate to register rs1. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: andi + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] & CAPI.FP.int2uint(imm); + + help: Performs bitwise AND on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: jalr + extension: I + template: I-Offset + type: Unconditional bifurcation + fields: + - field: opcode + value: "1100111" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers.pc + 4n; + const pc = registers[rs1] + imm; + registers.pc = pc & ~1n; + if (BigInt.asIntN(64, pc) === -1n) CAPI.SYSCALL.exit(); + else CAPI.STACK.endFrame(); + help: Jump to address and place return address in rd. + - name: lb + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "000" + definition: | + registers[rd] = CAPI.MEM.read(imm + registers[rs1], 1, rd, false); + + help: Loads a 8-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lbu + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "100" + definition: | + let addr = CAPI.FP.int2uint(registers[rs1]) + imm; + let result = CAPI.MEM.read(addr, 1, rd, false); + registers[rd] = CAPI.FP.int2uint(result); + help: Loads a 8-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lh + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "001" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 2, rd, false); + + help: Loads a 16-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: lhu + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "101" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + let result = CAPI.MEM.read(addr, 2, rd, false); + registers[rd] = CAPI.FP.int2uint(result); + help: Loads a 16-bit value from memory and zero-extends this to XLEN bits before storing it in register rd. + - name: lw + extension: I + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000011" + - field: funct3 + value: "010" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 4, rd, false); + help: Loads a 32-bit value from memory and sign-extends this to XLEN bits before storing it in register rd. + - name: ori + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] | imm; + + help: Performs bitwise OR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. + - name: slli + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "001" + - field: funct7 + value: "0000000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] << shamt); + + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: slti + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "010" + definition: | + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(imm)) ? 1n : 0n; + + help: Place the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. + - name: sltiu + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "011" + definition: | + registers[rd] = (CAPI.FP.int2uint(registers[rs1]) < CAPI.FP.int2uint(imm)) ? 1n: 0n; + help: Place the value 1 in register rd if register rs1 is less than the immediate when both are treated as unsigned numbers, else 0 is written to rd. + - name: srai + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "101" + - field: funct7 + value: "0100000" + definition: | + if (shamt > 0) registers[rd] = (BigInt.asIntN(64, registers[rs1]) >> shamt); + + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: srli + extension: I + template: I-Shift + type: Arithmetic integer + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "101" + - field: funct7 + value: "0000000" + definition: | + if (shamt > 0) registers[rd] = CAPI.FP.int2uint(registers[rs1] >> shamt); + + help: Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate. + - name: xori + extension: I + template: I + type: Logic + fields: + - field: opcode + value: "0010011" + - field: funct3 + value: "100" + definition: | + registers[rd] = registers[rs1] ^ imm; + + help: Performs bitwise XOR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. Note, 'XORI rd, rs1, -1' performs a bitwise logical inversion of register rs1(assembler pseudo-instruction NOT rd, rs). + - name: jal + extension: I + template: J + fields: + - field: opcode + value: "1101111" + definition: | + registers[rd] = registers["PC"] + 4n; + registers["PC"] = registers["PC"] + imm; + CAPI.CHECK_STACK.begin(registers["PC"] + imm); + CAPI.DRAW_STACK.begin(registers["PC"] + imm); // This is not an accident. We only see the virtual PC here, and the virtual/physical PC sync happens after the instruction execution. + help: Jump to address and place return address in rd. + - name: add + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs2] + registers[rs1]; + + help: Adds the registers rs1 and rs2 and stores the result in rd. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: and + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] & registers[rs2]; + + help: Performs bitwise AND on registers rs1 and rs2 and place the result in rd. + - name: or + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] | registers[rs2]; + + help: Performs bitwise OR on registers rs1 and rs2 and place the result in rd. + - name: sll + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "001" + definition: | + const shiftAmount = registers[rs2] & 0x1Fn; + registers[rd] = (registers[rs1] << shiftAmount) & 0xFFFFFFFFn; + help: Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: slt + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "010" + definition: | + registers[rd] = (CAPI.FP.uint2int(registers[rs1]) < CAPI.FP.uint2int(registers[rs2])) ? 1n : 0n; + + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as signed numbers, else 0 is written to rd. + - name: sltu + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "011" + definition: | + registers[rd] = ((registers[rs1] & 0xFFFFFFFFn) < (registers[rs2] & 0xFFFFFFFFn)) ? 1n : 0n; + + help: Place the value 1 in register rd if register rs1 is less than register rs2 when both are treated as unsigned numbers, else 0 is written to rd. + - name: sra + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0100000" + - field: funct3 + value: "101" + definition: | + const temp = BigInt.asIntN(32, BigInt(registers[rs1])) >> BigInt(registers[rs2]); + registers[rd] = CAPI.FP.int2uint(temp); + help: Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: srl + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "101" + definition: | + const shiftAmount = registers[rs2] & 0x1Fn; + registers[rd] = (registers[rs1] >> shiftAmount) & 0xFFFFFFFFn; + help: Logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of register rs2. + - name: sub + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0100000" + - field: funct3 + value: "000" + definition: | + registers[rd] = registers[rs1] - registers[rs2]; + + help: Subs the register rs2 from rs1 and stores the result in rd. Arithmetic overflow is ignored and the result is simply the low XLEN bits of the result. + - name: xor + extension: I + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000000" + - field: funct3 + value: "100" + definition: | + registers[rd] = (registers[rs1] ^ registers[rs2]); + + help: Performs bitwise XOR on registers rs1 and rs2 and place the result in rd. + - name: sb + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "000" + definition: | + CAPI.MEM.write(registers[rs1] + imm, 1, BigInt.asUintN(8, registers[rs2]), rs2, 'byte', false); + + help: Store 8-bit, values from the low bits of register rs2 to memory. + - name: sh + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "001" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 2)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 2, BigInt.asUintN(16, registers[rs2]), rs2, 'half', false); + + help: Store 16-bit, values from the low bits of register rs2 to memory. + - name: sw + extension: I + template: S + fields: + - field: opcode + value: "0100011" + - field: funct3 + value: "010" + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, BigInt.asUintN(32, registers[rs2]), rs2, 'word', false); + + help: Store 32-bit, values from the low bits of register rs2 to memory. + - name: auipc + extension: I + template: U + fields: + - field: opcode + value: "0010111" + - field: imm + type: offset_bytes + definition: | + registers[rd] = registers["PC"] + (imm << 12n); + + help: Build pc-relative addresses and uses the U-type format. AUIPC forms a 32-bit offset from the 20-bit U-immediate, filling in the lowest 12 bits with zeros, adds this offset to the pc, then places the result in register rd. + - name: lui + extension: I + template: U + fields: + - field: opcode + value: "0110111" + - field: imm + type: imm-unsigned + definition: | + registers[rd] = imm << 12n; + + help: Build 32-bit constants and uses the U-type format. LUI places the U-immediate value in the top 20 bits of the destination register rd, filling in the lowest 12 bits with zeros. + - name: ecall + extension: I + template: Custom + type: Syscall + fields: + - field: opcode + value: "1110011" + - field: zeros + type: cop + startbit: 31 + stopbit: 7 + value: "0000000000000000000000000" + preoperation: 'let [fa0Value, fa0Type] = CAPI.ARCH.toJSNumberD(registers["fa0"]);' + definition: | + switch (registers["a7"]) { + case 1n: + CAPI.SYSCALL.print(registers["a0"], 'int32'); + break; + case 2n: + case 3n: + CAPI.SYSCALL.print(fa0Value, 'float'); + break; + case 4n: + CAPI.SYSCALL.print(registers["a0"], 'string'); + break; + case 5n: + CAPI.SYSCALL.read('a0', 'int'); + break; + case 6n: + CAPI.SYSCALL.read('fa0', 'float'); + break; + case 7n: + CAPI.SYSCALL.read('fa0', 'double'); + break; + case 8n: + CAPI.SYSCALL.read('a0', 'string', 'a1'); + break; + case 9n: + CAPI.SYSCALL.sbrk('a0', 'a0'); + break; + case 10n: + CAPI.SYSCALL.exit(); + break; + case 11n: + CAPI.SYSCALL.print(registers["a0"], 'char'); + break; + case 12n: + CAPI.SYSCALL.read('a0', 'char'); + break; + } + help: Make a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode exception, or environment-call-from-M-mode exception, respectively, and performs no other operation. + - name: ebreak + extension: I + template: Custom + type: Syscall + fields: + - field: opcode + value: "1110011" + - field: funct12 + type: cop + startbit: 31 + stopbit: 20 + value: "000000000001" + - field: zeros + type: cop + startbit: 19 + stopbit: 7 + value: "0000000000000" + definition: | + console.log('Not implemented: ebreak'); + CAPI.VALIDATION.raise('ebreak not implemented'); + help: Used by debuggers to cause control to be transferred back to a debugging environment. It generates a breakpoint exception and performs no other operation. + M: + - name: div + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "100" + definition: | + if (registers[rs2] != 0) { + registers[rd] = BigInt.asIntN( + 32, + (BigInt.asIntN(32, BigInt(registers[rs1])) / BigInt.asIntN(32, BigInt(registers[rs2]))) + ); + } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + help: Perform an XLEN bits by XLEN bits signed integer division of rs1 by rs2, rounding towards zero. + - name: divu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "101" + definition: | + const div = registers[rs2] + if (div != 0) { + registers[rd] = BigInt.asIntN( + 32, + (BigInt.asUintN(32, registers[rs1]) / BigInt.asUintN(32, div)) + ); + } + else CAPI.VALIDATION.raise('Division by zero not allowed'); + help: Perform an XLEN-bit by XLEN-bit unsigned integer division of rs1 by rs2, rounding towards zero. + - name: mul + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "000" + definition: | + registers[rd] = CAPI.FP.uint2int(registers[rs1]) * CAPI.FP.uint2int(registers[rs2]); + + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. + - name: mulh + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "001" + definition: | + registers[rd] = BigInt.asUintN( + 32, + BigInt.asIntN( + 64, + BigInt.asIntN(32, registers[rs1]) * BigInt.asIntN(32, registers[rs2]), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by signed rs2 and places the lower XLEN bits in the destination register. + - name: mulhsu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "010" + definition: | + registers[rd] = BigInt.asIntN( + 32, + BigInt.asIntN( + 64, + BigInt.asIntN(32, registers[rs1]) * BigInt.asUintN(32, registers[rs2]), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of signed rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. + - name: mulhu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "011" + definition: | + registers[rd] = BigInt.asIntN( + 32, + BigInt.asUintN( + 64, + BigInt.asUintN(32, registers[rs1]) * BigInt.asUintN(32, registers[rs2]), + ) >> 32n, + ); + help: Performs an XLEN-bit by XLEN-bit multiplication of unsigned rs1 by unsigned rs2 and places the upper XLEN bits in the destination register. + - name: rem + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "110" + definition: | + registers[rd] = registers[rs1] % registers[rs2]; + + help: Perform an XLEN-bit by XLEN-bit signed integer reminder of rs1 by rs2. + - name: remu + extension: M + template: R + fields: + - field: opcode + value: "0110011" + - field: funct7 + value: "0000001" + - field: funct3 + value: "111" + definition: | + registers[rd] = registers[rs1] % registers[rs2]; + + help: Perform an XLEN-bit by XLEN-bit unsigned integer reminder of rs1 by rs2. + F: + - name: flw + extension: F + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000111" + - field: funct3 + value: "010" + - field: rd + type: DFP-Reg + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 4, rd, false); + + postoperation: | + registers[rd] = CAPI.ARCH.NaNBox(registers[rd]); + + help: Load a single-precision floating-point value from memory into floating-point register rd. + - name: fadd.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number + rs2Number; + + help: Perform single-precision floating-point addition. + - name: fclass.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110000" + - field: funct3 + value: "001" + - field: rs1 + suffix: null + - field: rs2 + type: cop + value: "00000" + order: null + - field: rd + type: INT-Reg + preoperation: | + let rs1Value, rs2Value, type_rs1, type_rs2; + [rs1Value, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Value, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(registers[rd])) { + registers[rd] = CAPI.ARCH.toBigInt(registers[rd], "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(registers[rd], "NaNBfloat32_64"); + } + registers[rs1] = CAPI.ARCH.toBigInt(rs1Value, type_rs1); + registers[rs2] = CAPI.ARCH.toBigInt(rs2Value, type_rs2); + definition: | + let a = CAPI.FP.float2bin(registers[rs1]); + registers[rd] = CAPI.FP.check_ieee( + parseInt(a[0]), + parseInt(a.slice(1, 9), 2), + parseInt(a.slice(10), 2), + ); + help: Examines the value in floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + - name: fcvt.s.w + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101000" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + postoperation: | + registers[rd] = CAPI.ARCH.toBigInt(result,'NaNBfloat32_64'); + definition: | + result = CAPI.FP.uint2int(registers[rs1]) + + help: Converts a 32-bit signed integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.s.wu + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + definition: | + registers[rd] = CAPI.FP.int2uint(registers[rs1]) + + help: Converts a 32-bit unsigned integer, in integer register rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.s + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100000" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = parseInt(registers[rs1]); + + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in integer register rd. + - name: fcvt.wu.s + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + registers[rd] = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Convert a floating-point number in floating-point register rs1 to a signed 32-bit in unsigned integer register rd. + - name: fdiv.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001100" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + if (rs2Number != 0) { result = rs1Number / rs2Number; } + else CAPI.VALIDATION.raise('Division by registers[zero] not allowed'); + + help: Perform single-precision floating-point division. + - name: feq.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "010" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number === rs2Number)? 1n : 0n; + + help: Performs a quiet equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fle.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "000" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number <= rs2Number)? 1n : 0n; + + help: Performs a quiet less or equal comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: flt.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010000" + - field: funct3 + value: "001" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number < rs2Number)? 1n : 0n; + + help: Performs a quiet less comparison between floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fmax.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010100" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = Math.max(rs1Number, rs2Number); + + help: Write the larger of single precision data in rs1 and rs2 to rd. + - name: fmin.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010100" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = Math.min(rs1Number, rs2Number); + + help: Write the smaller of single precision data in rs1 and rs2 to rd. + - name: fmul.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = rs2Number * rs1Number; + + help: Perform single-precision floating-point multiplication. + - name: fmv.w.x + extension: F + template: R-IntToFloat + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1111000" + - field: funct5 + value: "00000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = CAPI.FP.uint2float32(rs1Number); + + help: Move the single-precision value encoded in IEEE 754-2008 standard encoding from the lower 32 bits of integer register rs1 to the floating-point register rd. + - name: fmv.x.w + extension: F + template: R-FloatToInt + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110000" + - field: funct5 + value: "00000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + registers[rs1] = CAPI.ARCH.toBigInt(rs1Number, type_rs1); + definition: | + result = CAPI.FP.float322uint(rs1Number); + + help: Move the single-precision value in floating-point register rs1 represented in IEEE 754-2008 encoding to the lower 32 bits of integer register rd. + - name: fsgnj.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = (rs2Number >= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjn.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + result = (rs2Number <= 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is rs2's sign bit. + - name: fsgnjx.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010000" + - field: funct3 + value: "010" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + definition: | + let a = rs1Number < 0; + let b = rs2Number < 0; + result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0101100" + - field: rs2 + type: cop + value: "00000" + order: null + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + if (rs1Number >= 0) { + result = Math.sqrt(rs1Number); + } else { + CAPI.VALIDATION.raise( + "Square root of a negative number is not allowed." + ); + } + help: Perform single-precision square root. + - name: fsub.s + extension: F + template: R-Floating + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000100" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number - rs2Number; + + help: Perform single-precision floating-point subtraction. + - name: fmadd.s + extension: F + template: R4 + fields: + - field: opcode + value: "1000011" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number * rs2Number + rs3Number; + + help: Perform single-precision fused multiply addition. + - name: fmsub.s + extension: F + template: R4 + fields: + - field: opcode + value: "1000111" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = rs1Number * rs2Number - rs3Number; + + help: Perform single-precision fused multiply addition. + - name: fnmadd.s + extension: F + template: R4 + fields: + - field: opcode + value: "1001111" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = -rs1Number * rs2Number - rs3Number; + + help: Perform negated single-precision fused multiply addition. + - name: fnmsub.s + extension: F + template: R4 + fields: + - field: opcode + value: "1001011" + - field: funct2 + value: "00" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN32"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaNBfloat32_64"); + } + + definition: | + result = -rs1Number * rs2Number + rs3Number; + + help: Perform negated single-precision fused multiply addition. + - name: fsw + extension: F + template: S + fields: + - field: opcode + value: "0100111" + - field: funct3 + value: "010" + - field: rs2 + type: DFP-Reg + definition: | + let value = registers[rs2] & 0xFFFFFFFFn; + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 4)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 4, value, rs2, 'float32', false); + help: Store a single-precision value from floating-point register rs2 to memory. + D: + - name: fld + extension: D + template: I-Offset + type: Memory access + fields: + - field: opcode + value: "0000111" + - field: funct3 + value: "011" + - field: rd + type: DFP-Reg + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + registers[rd] = CAPI.MEM.read(addr, 8, rd, false); + help: Load a double-precision floating-point value from memory into floating-point register rd. + - name: fadd.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number + rs2Number; + + help: Perform double-precision floating-point addition. + - name: fclass.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1110001" + - field: funct3 + value: "001" + - field: rs1 + suffix: null + - field: rs2 + type: cop + value: "00000" + order: null + - field: rd + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + let a = CAPI.FP.float2bin(rs1Number); + registers[rd] = CAPI.FP.check_ieee( + parseInt(a[0]), + parseInt(a.slice(1, 12), 2), + parseInt(a.slice(13), 2), + ); + help: Examines the value in double-precision floating-point register rs1 and writes to integer register rd a 10-bit mask that indicates the class of the floating-point number. The corresponding bit in rd will be set if the property is true and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set. + - name: fcvt.d.s + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: rd + type: DFP-Reg + - field: rs1 + type: DFP-Reg + - field: funct7 + value: "0100001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual + + help: Converts double floating-point register in rs1 into a double floating-point number in floating-point register rd. + - name: fcvt.d.w + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + - field: rd + type: DFP-Reg + - field: rs1 + type: INT-Reg + preoperation: | + let result, rs1Number; + rs1Number = registers[rs1]; + postoperation: | + registers[rd] = CAPI.ARCH.toBigInt(result, 'float64'); + definition: | + result = CAPI.FP.uint2int(rs1Number); + + help: Converts a 32-bit signed integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.d.wu + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1101001" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: null + - field: rd + type: DFP-Reg + - field: rs1 + type: INT-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = CAPI.FP.int2uint(parseFloat(rs1Number)); + + help: Converts a 32-bit unsigned integer, in integer register rs1 into a double-precision floating-point number in floating-point register rd. + - name: fcvt.s.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0100000" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: DFP-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + definition: | + result = rs1Number; // TODO: This doesn't seem right, check the RISC-V manual + + help: Converts double floating-point register in rs1 into a floating-point number in floating-point register rd. + - name: fcvt.w.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100001" + - field: funct5 + value: "00000" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: INT-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Converts a double-precision floating-point number in floating-point register rs1 to a signed 32-bit integer, in integer register rd. + - name: fcvt.wu.d + extension: D + template: R-Conversion + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1100001" + - field: funct5 + value: "00001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + - field: rd + type: INT-Reg + - field: rs1 + type: DFP-Reg + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = CAPI.FP.int2uint(parseInt(rs1Number)); + + help: Converts a double-precision floating-point number in floating-point register rs1 to a unsigned 32-bit integer, in integer register rd. + - name: fdiv.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001101" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number / rs2Number; + help: Perform double-precision floating-point division. + - name: feq.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "010" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number == rs2Number)? 1n : 0n; + + help: Performs a quiet equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fle.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "000" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number <= rs2Number) ? 1n : 0n; + + help: Performs a quiet less or equal comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: flt.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "1010001" + - field: funct3 + value: "001" + - field: rd + type: INT-Reg + preoperation: | + let rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + definition: | + registers[rd] = (rs1Number < rs2Number)? 1n : 0n; + + help: Performs a quiet less comparison between double-precision floating-point registers rs1 and rs2 and record the Boolean result in integer register rd. Only signaling NaN inputs cause an Invalid Operation exception. The result is 0 if either operand is NaN. + - name: fmax.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010101" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = Math.max(rs1Number, rs2Number); + + help: Write the larger of double precision data in rs1 and rs2 to rd. + - name: fmin.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010101" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = Math.min(rs1Number, rs2Number); + + help: Write the smaller of double precision data in rs1 and rs2 to rd. + - name: fmul.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0001001" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number * rs2Number; + + help: Perform double-precision floating-point addition. + - name: fsgnj.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "000" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + registers[rd] = (rs2Number > 0) ? Math.abs(rs1Number) : -Math.abs(rs1Number); + help: Perform double-precision floating-point multiplication. + - name: fsgnjn.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "001" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = (rs2Number > 0) ? -Math.abs(rs1Number) : +Math.abs(rs1Number); + + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is opposite of rs2's sign bit. + - name: fsgnjx.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0010001" + - field: funct3 + value: "010" + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + let a = rs1Number < 0; + let b = rs2Number < 0; + result = a ^ b ? -Math.abs(rs1Number) : Math.abs(rs1Number); + help: Produce a result that takes all bits except the sign bit from rs1. The result's sign bit is XOR of sign bit of rs1 and rs2. + - name: fsqrt.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0101101" + - field: rs2 + type: cop + value: "00000" + order: null + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 3 + preoperation: | + let result, rs1Number, type_rs1; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + if (rs1Number >= 0) { + result = Math.sqrt(rs1Number); + } else { + CAPI.VALIDATION.raise( + "Square root of a negative number is not allowed." + ); + } + help: Perform double-precision square root. + - name: fsub.d + extension: D + template: R-Double + fields: + - field: opcode + value: "1010011" + - field: funct7 + value: "0000101" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 4 + preoperation: | + let result, rs1Number, rs2Number, type_rs1, type_rs2; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + definition: | + result = rs1Number - rs2Number; + + help: Perform double-precision floating-point addition. + - name: fmadd.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1000011" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = rs1Number * rs2Number + rs3Number; + + help: Perform double-precision fused multiply addition. + - name: fmsub.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1000111" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = rs1Number * rs2Number - rs3Number; + + help: Perform double-precision fused multiply subtraction. + - name: fnmadd.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1001111" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = -rs1Number * rs2Number - rs3Number; + + help: Perform negated double-precision fused multiply addition. + - name: fnmsub.d + extension: D + template: R4-Double + fields: + - field: opcode + value: "1001011" + - field: funct2 + value: "01" + - field: funct3 + type: enum + enum_name: rounding_mode + optional: true + order: 5 + preoperation: | + let result, rs1Number, rs2Number, rs3Number, type_rs1, type_rs2, type_rs3; + [rs1Number, type_rs1] = CAPI.ARCH.toJSNumberD(registers[rs1]); + [rs2Number, type_rs2] = CAPI.ARCH.toJSNumberD(registers[rs2]); + [rs3Number, type_rs3] = CAPI.ARCH.toJSNumberD(registers[rs3]); + postoperation: | + if (isNaN(result)) { + registers[rd] = CAPI.ARCH.toBigInt(result, "NaN64"); + } else { + registers[rd] = CAPI.ARCH.toBigInt(result, "float64"); + } + + registers[rs3] = CAPI.ARCH.toBigInt(rs3Number, type_rs3); + definition: | + result = -rs1Number * rs2Number + rs3Number; + + help: Perform negated double-precision fused multiply subtraction. + - name: fsd + extension: D + template: S + fields: + - field: opcode + value: "0100111" + - field: funct3 + value: "011" + - field: rs2 + type: DFP-Reg + definition: | + let addr = registers[rs1] + imm; + if (CAPI.VALIDATION.isMisaligned(addr, 8)) + CAPI.VALIDATION.raise('The memory must be aligned'); + CAPI.MEM.write(addr, 8, registers[rs2], rs2, 'float64', false); + help: Store a double-precision value from the floating-point registers to memory. + Zifencei: + - name: fence.i + extension: D + template: Custom + type: Syscall + fields: + - field: opcode + value: "0001111" + - field: funct3 + type: cop + startbit: 14 + stopbit: 12 + value: "001" + - field: zeros + type: cop + startbit: 31 + stopbit: 15 + value: "00000000000000000" + - field: zeros2 + type: cop + startbit: 11 + stopbit: 7 + value: "00000" + definition: | + console.log('Not implemented: fence.i'); + CAPI.VALIDATION.raise('fence.i not implemented'); + help: Provides explicit synchronization between writes to instruction memory and instruction fetches on the same hart. + +pseudoinstructions: + # Make sure the definitions correspond with those in the RISC-V ASM manual (TODO: Check these!) + + # RV32I Pseudoinstructions + I: + - name: beqz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + beq rs1, x0, off; + + - name: bgez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bge rs1, x0, off; + help: Take the branch if the value in register rs1 is zero. + + - name: bgt + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + blt rs2, rs1, off; + + - name: bgtu + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bltu rs2, rs1, off; + + - name: bgtz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bgt rs1, x0, off; + + - name: ble + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bge rs2, rs1, off; + + - name: bleu + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: rs2 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bgeu rs2, rs1, off; + + - name: blez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + ble x0, rs1, off; + + - name: bltz + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + blt rs1, x0, off; + + - name: bnez + extension: I + fields: + - field: rs1 + type: INT-Reg + suffix: "," + - field: off + type: offset_bytes + definition: | + bne rs1, x0, off; + + - name: j + extension: I + fields: + - field: off + type: offset_bytes + definition: | + beq zero, zero, off; + + - name: jalr + extension: I + fields: + - field: rs + type: INT-Reg + definition: | + jalr x1, 0(rs); + + - name: jr + extension: I + fields: + - field: rs + type: INT-Reg + definition: | + jalr x0, 0(rs); + + - name: la + extension: I + fields: + - field: rd + type: INT-Reg + suffix: "," + - field: addr + type: imm-unsigned + definition: | + no_ret_op{ + tmp = Field.2.(31,0).int - (reg.pc - 4); + tmp_low = tmp & 0x00000FFF; + tmp_low = tmp_low>0x7FF? tmp_low - 0x1000 : tmp_low; + tmp_hi = (tmp - tmp_low) >> 12; + }; + auipc rd, op{tmp_hi}; + addi rd, rd, op{tmp_low}; + + - name: li + extension: I + fields: + - field: rd + type: INT-Reg + suffix: "," + - field: val + type: imm-signed + definition: | + no_ret_op{ + tmp = Field.2.(31,0).int; + tmp_low = tmp & 0x00000FFF; + tmp_low -= tmp_low > 0x7FF ? 0x1000 : 0; + tmp_hi = (tmp - tmp_low) >>> 12; + }; + if (tmp_hi === 0) { + addi rd, x0, op{tmp_low}; + } + else { + lui rd, op{tmp_hi}; + addi rd, rd, op{tmp_low}; + }; + help: Load the sign-extended 6-bit immediate, imm, into register rd. + + - name: mv + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + addi reg1, reg2, 0; + help: Copy the value in register rs2 into register rd. + + - name: neg + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sub reg1, x0, reg2; + + - name: nop + extension: I + definition: | + addi x0, x0, 0; + help: Does not change any user-visible state, except for advancing the pc. + + - name: not + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + xori reg1, reg2, -1; + + - name: ret + extension: I + definition: | + jalr x0, 0(x1); # TODO: check this! + + - name: seqz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sltiu reg1, reg2, 1; + + - name: sgtz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + slt reg1, x0, reg2; + + - name: sltz + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + slt reg1, reg2, x0; + + - name: snez + extension: I + fields: + - field: reg1 + type: INT-Reg + suffix: "," + - field: reg2 + type: INT-Reg + definition: | + sltu reg1, x0, reg2; + F: + # RV32F Pseudoinstructions + - name: fabs.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjx.s rs1, rs2, rs2; + + - name: fmv.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnj.s rs1, rs2, rs2; + + - name: fneg.s + extension: F + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjn.s rs1, rs2, rs2; + D: + # RV32D Pseudoinstructions + - name: fabs.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjx.d rs1, rs2, rs2; + + - name: fmv.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnj.d rs1, rs2, rs2; + + - name: fneg.d + extension: D + fields: + - field: rs1 + type: DFP-Reg + suffix: "," + - field: rs2 + type: DFP-Reg + definition: | + fsgnjn.d rs1, rs2, rs2; + +enums: + rounding_mode: + rne: 0 + rtz: 1 + rdn: 2 + rup: 3 + rmm: 4 + dyn: 7 + DEFAULT: dyn diff --git a/architecture/available_arch.json b/architecture/available_arch.json index bbc9a7400..babddbe29 100644 --- a/architecture/available_arch.json +++ b/architecture/available_arch.json @@ -15,11 +15,11 @@ "alt": "RISC-V", "id": "select_confRISV", "examples": ["default"], - "description": "RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley.", + "description": "RISC-V is a free and open-standard instruction set architecture (ISA) based on RISC principles. This architecture was developed in 2010 at the University of California, Berkeley.

This ISA includes the 32-bit I (integer), M (multiplication and division), F (single-precision floating-point), and D (double-precision floating-point) RISC-V extensions.", "guide": "guides/riscv.pdf", "available": true }, - { + { "name": "RISC-V (RV64IMFD)", "alias": [ "RISC-V (RV64IMFD)", @@ -35,7 +35,39 @@ "alt": "RISC-V", "id": "select_confRISV", "examples": ["default"], - "description": "RISC-V is an instruction set architecture (ISA) based on the RISC type and its hardware is free. This architecture was created in 2010 at the University of California, Berkeley.", + "description": "RISC-V is a free and open-standard instruction set architecture (ISA) based on RISC principles. This architecture was developed in 2010 at the University of California, Berkeley.

This ISA includes the 64-bit I (integer), M (multiplication and division), F (single-precision floating-point), and D (double-precision floating-point) RISC-V extensions.", + "guide": "/guides/riscv.pdf", + "available": true + }, + { + "name": "RISC-V Sail 32 - Full Specification", + "alias": [ + "RISC-V (SRV32)", + "SRV32", + "srv32" + ], + "file": "RISCV/SRV32", + "img": "riscv.png", + "alt": "RISC-V", + "id": "select_confRISV", + "examples": ["default"], + "description": "RISC-V is a free and open-standard instruction set architecture (ISA) based on RISC principles. This architecture was developed in 2010 at the University of California, Berkeley.

This ISA includes the full 32-bit specification of RISC-V based on Sail.", + "guide": "/guides/riscv.pdf", + "available": true + }, + { + "name": "RISC-V Sail 64 - Full Specification", + "alias": [ + "RISC-V (SRV64)", + "SRV64", + "srv64" + ], + "file": "RISCV/SRV64", + "img": "riscv.png", + "alt": "RISC-V", + "id": "select_confRISV", + "examples": ["default"], + "description": "RISC-V is a free and open-standard instruction set architecture (ISA) based on RISC principles. This architecture was developed in 2010 at the University of California, Berkeley.

This ISA includes the full 64-bit specification of RISC-V based on Sail.", "guide": "/guides/riscv.pdf", "available": true }, diff --git a/bun.lock b/bun.lock index 1daee7947..e915327c5 100644 --- a/bun.lock +++ b/bun.lock @@ -1,6 +1,6 @@ { "lockfileVersion": 1, - "configVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "creator", @@ -27,7 +27,7 @@ "colors": "^1.4.0", "deno": "^2.5.4", "humanize-duration": "^3.33.0", - "js-yaml": "^4.1.0", + "js-yaml": "^4.1.1", "mitt": "^3.0.1", "monaco-editor": "^0.54.0", "monaco-vim": "^0.4.2", @@ -59,12 +59,12 @@ "globals": "^16.5.0", "jiti": "^2.6.1", "npm-run-all2": "^8.0.4", - "prettier": "^3.7.3", + "prettier": "^3.7.4", "prettier-plugin-vue": "^1.1.6", "sass-embedded": "^1.93.3", "sharp": "^0.34.5", "svgo": "^4.0.0", - "typescript": "~5.9.3", + "typescript": "^5.8.3", "unplugin-vue-components": "^30.0.0", "vite": "^7.2.4", "vite-multiple-assets": "^2.2.6", @@ -79,165 +79,163 @@ "trustedDependencies": [ "sharp", "deno", - "esbuild", "wasm-pack", "vue-demi", + "esbuild", "@parcel/watcher", ], "packages": { - "@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="], + "@babel/code-frame": ["@babel/code-frame@7.29.0", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="], - "@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="], + "@babel/compat-data": ["@babel/compat-data@7.29.0", "", {}, "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg=="], - "@babel/compat-data": ["@babel/compat-data@7.28.0", "", {}, "sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw=="], + "@babel/core": ["@babel/core@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-module-transforms": "^7.28.6", "@babel/helpers": "^7.28.6", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/traverse": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA=="], - "@babel/core": ["@babel/core@7.28.0", "", { "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.0", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.27.3", "@babel/helpers": "^7.27.6", "@babel/parser": "^7.28.0", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.0", "@babel/types": "^7.28.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ=="], - - "@babel/generator": ["@babel/generator@7.28.0", "", { "dependencies": { "@babel/parser": "^7.28.0", "@babel/types": "^7.28.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg=="], + "@babel/generator": ["@babel/generator@7.29.1", "", { "dependencies": { "@babel/parser": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw=="], "@babel/helper-annotate-as-pure": ["@babel/helper-annotate-as-pure@7.27.3", "", { "dependencies": { "@babel/types": "^7.27.3" } }, "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg=="], - "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.27.2", "", { "dependencies": { "@babel/compat-data": "^7.27.2", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ=="], + "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.28.6", "", { "dependencies": { "@babel/compat-data": "^7.28.6", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA=="], - "@babel/helper-create-class-features-plugin": ["@babel/helper-create-class-features-plugin@7.27.1", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.1", "@babel/helper-member-expression-to-functions": "^7.27.1", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/helper-replace-supers": "^7.27.1", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/traverse": "^7.27.1", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A=="], + "@babel/helper-create-class-features-plugin": ["@babel/helper-create-class-features-plugin@7.28.6", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-member-expression-to-functions": "^7.28.5", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/helper-replace-supers": "^7.28.6", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/traverse": "^7.28.6", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-dTOdvsjnG3xNT9Y0AUg1wAl38y+4Rl4sf9caSQZOXdNqVn+H+HbbJ4IyyHaIqNR6SW9oJpA/RuRjsjCw2IdIow=="], "@babel/helper-globals": ["@babel/helper-globals@7.28.0", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="], - "@babel/helper-member-expression-to-functions": ["@babel/helper-member-expression-to-functions@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA=="], + "@babel/helper-member-expression-to-functions": ["@babel/helper-member-expression-to-functions@7.28.5", "", { "dependencies": { "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5" } }, "sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg=="], - "@babel/helper-module-imports": ["@babel/helper-module-imports@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w=="], + "@babel/helper-module-imports": ["@babel/helper-module-imports@7.28.6", "", { "dependencies": { "@babel/traverse": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw=="], - "@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.27.3", "", { "dependencies": { "@babel/helper-module-imports": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1", "@babel/traverse": "^7.27.3" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg=="], + "@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.28.6", "", { "dependencies": { "@babel/helper-module-imports": "^7.28.6", "@babel/helper-validator-identifier": "^7.28.5", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA=="], "@babel/helper-optimise-call-expression": ["@babel/helper-optimise-call-expression@7.27.1", "", { "dependencies": { "@babel/types": "^7.27.1" } }, "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw=="], - "@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.27.1", "", {}, "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw=="], + "@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.28.6", "", {}, "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug=="], - "@babel/helper-replace-supers": ["@babel/helper-replace-supers@7.27.1", "", { "dependencies": { "@babel/helper-member-expression-to-functions": "^7.27.1", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/traverse": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA=="], + "@babel/helper-replace-supers": ["@babel/helper-replace-supers@7.28.6", "", { "dependencies": { "@babel/helper-member-expression-to-functions": "^7.28.5", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-mq8e+laIk94/yFec3DxSjCRD2Z0TAjhVbEJY3UQrlwVo15Lmt7C2wAUbK4bjnTs4APkwsYLTahXRraQXhb1WCg=="], "@babel/helper-skip-transparent-expression-wrappers": ["@babel/helper-skip-transparent-expression-wrappers@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg=="], "@babel/helper-string-parser": ["@babel/helper-string-parser@7.27.1", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="], - "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.27.1", "", {}, "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow=="], + "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], "@babel/helper-validator-option": ["@babel/helper-validator-option@7.27.1", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="], - "@babel/helpers": ["@babel/helpers@7.27.6", "", { "dependencies": { "@babel/template": "^7.27.2", "@babel/types": "^7.27.6" } }, "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug=="], + "@babel/helpers": ["@babel/helpers@7.28.6", "", { "dependencies": { "@babel/template": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw=="], - "@babel/parser": ["@babel/parser@7.28.4", "", { "dependencies": { "@babel/types": "^7.28.4" }, "bin": "./bin/babel-parser.js" }, "sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg=="], + "@babel/parser": ["@babel/parser@7.29.0", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="], - "@babel/plugin-proposal-decorators": ["@babel/plugin-proposal-decorators@7.28.0", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/plugin-syntax-decorators": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zOiZqvANjWDUaUS9xMxbMcK/Zccztbe/6ikvUXaG9nsPH3w6qh5UaPGAnirI/WhIbZ8m3OHU0ReyPrknG+ZKeg=="], + "@babel/plugin-proposal-decorators": ["@babel/plugin-proposal-decorators@7.29.0", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/plugin-syntax-decorators": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-CVBVv3VY/XRMxRYq5dwr2DS7/MvqPm23cOCjbwNnVrfOqcWlnefua1uUs0sjdKOGjvPUG633o07uWzJq4oI6dA=="], - "@babel/plugin-syntax-decorators": ["@babel/plugin-syntax-decorators@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-YMq8Z87Lhl8EGkmb0MwYkt36QnxC+fzCgrl66ereamPlYToRpIk5nUjKUY3QKLWq8mwUB1BgbeXcTJhZOCDg5A=="], + "@babel/plugin-syntax-decorators": ["@babel/plugin-syntax-decorators@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-71EYI0ONURHJBL4rSFXnITXqXrrY8q4P0q006DPfN+Rk+ASM+++IBXem/ruokgBZR8YNEWZ8R6B+rCb8VcUTqA=="], - "@babel/plugin-syntax-import-attributes": ["@babel/plugin-syntax-import-attributes@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww=="], + "@babel/plugin-syntax-import-attributes": ["@babel/plugin-syntax-import-attributes@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw=="], "@babel/plugin-syntax-import-meta": ["@babel/plugin-syntax-import-meta@7.10.4", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g=="], - "@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w=="], + "@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w=="], - "@babel/plugin-syntax-typescript": ["@babel/plugin-syntax-typescript@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ=="], + "@babel/plugin-syntax-typescript": ["@babel/plugin-syntax-typescript@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A=="], - "@babel/plugin-transform-typescript": ["@babel/plugin-transform-typescript@7.28.0", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-create-class-features-plugin": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-4AEiDEBPIZvLQaWlc9liCavE0xRM0dNca41WtBeM3jgFptfUOSG9z0uteLhq6+3rq+WB6jIvUwKDTpXEHPJ2Vg=="], + "@babel/plugin-transform-typescript": ["@babel/plugin-transform-typescript@7.28.6", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-0YWL2RFxOqEm9Efk5PvreamxPME8OyY0wM5wh5lHjF+VtVhdneCWGzZeSqzOfiobVqQaNCd2z0tQvnI9DaPWPw=="], - "@babel/template": ["@babel/template@7.27.2", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/parser": "^7.27.2", "@babel/types": "^7.27.1" } }, "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw=="], + "@babel/template": ["@babel/template@7.28.6", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="], - "@babel/traverse": ["@babel/traverse@7.28.0", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/template": "^7.27.2", "@babel/types": "^7.28.0", "debug": "^4.3.1" } }, "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg=="], + "@babel/traverse": ["@babel/traverse@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="], - "@babel/types": ["@babel/types@7.28.4", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q=="], + "@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], - "@bufbuild/protobuf": ["@bufbuild/protobuf@2.6.0", "", {}, "sha512-6cuonJVNOIL7lTj5zgo/Rc2bKAo4/GvN+rKCrUj7GdEHRzCk8zKOfFwUsL9nAVk5rSIsRmlgcpLzTRysopEeeg=="], + "@bufbuild/protobuf": ["@bufbuild/protobuf@2.11.0", "", {}, "sha512-sBXGT13cpmPR5BMgHE6UEEfEaShh5Ror6rfN3yEK5si7QVrtZg8LEPQb0VVhiLRUslD2yLnXtnRzG035J/mZXQ=="], - "@codemirror/autocomplete": ["@codemirror/autocomplete@6.18.6", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0" } }, "sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg=="], + "@codemirror/autocomplete": ["@codemirror/autocomplete@6.20.1", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0" } }, "sha512-1cvg3Vz1dSSToCNlJfRA2WSI4ht3K+WplO0UMOgmUYPivCyy2oueZY6Lx7M9wThm7SDUBViRmuT+OG/i8+ON9A=="], - "@codemirror/commands": ["@codemirror/commands@6.8.1", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", "@codemirror/view": "^6.27.0", "@lezer/common": "^1.1.0" } }, "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw=="], + "@codemirror/commands": ["@codemirror/commands@6.10.2", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", "@codemirror/view": "^6.27.0", "@lezer/common": "^1.1.0" } }, "sha512-vvX1fsih9HledO1c9zdotZYUZnE4xV0m6i3m25s5DIfXofuprk6cRcLUZvSk3CASUbwjQX21tOGbkY2BH8TpnQ=="], "@codemirror/lang-json": ["@codemirror/lang-json@6.0.2", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@lezer/json": "^1.0.0" } }, "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ=="], "@codemirror/lang-yaml": ["@codemirror/lang-yaml@6.1.2", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.2.0", "@lezer/lr": "^1.0.0", "@lezer/yaml": "^1.0.0" } }, "sha512-dxrfG8w5Ce/QbT7YID7mWZFKhdhsaTNOYjOkSIMt1qmC4VQnXSDSYVHHHn8k6kJUfIhtLo8t1JJgltlxWdsITw=="], - "@codemirror/language": ["@codemirror/language@6.11.3", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-9HBM2XnwDj7fnu0551HkGdrUrrqmYq/WC5iv6nbY2WdicXdGbhR/gfbZOH73Aqj4351alY1+aoG9rCNfiwS1RA=="], + "@codemirror/language": ["@codemirror/language@6.12.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.5.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-jEPmz2nGGDxhRTg3lTpzmIyGKxz3Gp3SJES4b0nAuE5SWQoKdT5GoQ69cwMmFd+wvFUhYirtDTr0/DRHpQAyWg=="], "@codemirror/legacy-modes": ["@codemirror/legacy-modes@6.5.2", "", { "dependencies": { "@codemirror/language": "^6.0.0" } }, "sha512-/jJbwSTazlQEDOQw2FJ8LEEKVS72pU0lx6oM54kGpL8t/NJ2Jda3CZ4pcltiKTdqYSRk3ug1B3pil1gsjA6+8Q=="], - "@codemirror/lint": ["@codemirror/lint@6.8.5", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.35.0", "crelt": "^1.0.5" } }, "sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA=="], + "@codemirror/lint": ["@codemirror/lint@6.9.5", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.35.0", "crelt": "^1.0.5" } }, "sha512-GElsbU9G7QT9xXhpUg1zWGmftA/7jamh+7+ydKRuT0ORpWS3wOSP0yT1FOlIZa7mIJjpVPipErsyvVqB9cfTFA=="], - "@codemirror/search": ["@codemirror/search@6.5.11", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "crelt": "^1.0.5" } }, "sha512-KmWepDE6jUdL6n8cAAqIpRmLPBZ5ZKnicE8oGU/s3QrAVID+0VhLFrzUucVKHG5035/BSykhExDL/Xm7dHthiA=="], + "@codemirror/search": ["@codemirror/search@6.6.0", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.37.0", "crelt": "^1.0.5" } }, "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw=="], - "@codemirror/state": ["@codemirror/state@6.5.2", "", { "dependencies": { "@marijn/find-cluster-break": "^1.0.0" } }, "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA=="], + "@codemirror/state": ["@codemirror/state@6.5.4", "", { "dependencies": { "@marijn/find-cluster-break": "^1.0.0" } }, "sha512-8y7xqG/hpB53l25CIoit9/ngxdfoG+fx+V3SHBrinnhOtLvKHRyAJJuHzkWrR4YXXLX8eXBsejgAAxHUOdW1yw=="], - "@codemirror/view": ["@codemirror/view@6.38.0", "", { "dependencies": { "@codemirror/state": "^6.5.0", "crelt": "^1.0.6", "style-mod": "^4.1.0", "w3c-keyname": "^2.2.4" } }, "sha512-yvSchUwHOdupXkd7xJ0ob36jdsSR/I+/C+VbY0ffBiL5NiSTEBDfB1ZGWbbIlDd5xgdUkody+lukAdOxYrOBeg=="], + "@codemirror/view": ["@codemirror/view@6.39.16", "", { "dependencies": { "@codemirror/state": "^6.5.0", "crelt": "^1.0.6", "style-mod": "^4.1.0", "w3c-keyname": "^2.2.4" } }, "sha512-m6S22fFpKtOWhq8HuhzsI1WzUP/hB9THbDj0Tl5KX4gbO6Y91hwBl7Yky33NdvB6IffuRFiBxf1R8kJMyXmA4Q=="], - "@deno/darwin-arm64": ["@deno/darwin-arm64@2.5.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-aQoAQSQdA8PVhS9ibx/vl1xtP0ngiZCD2tW/PqUd13fmwM12m3O2V8/oyMTzqXZtT/PnoiOtcqtujbF/yRUyVg=="], + "@deno/darwin-arm64": ["@deno/darwin-arm64@2.7.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-MPuhlIvUsM98ljVRD2wszRQzhd0Eizoj02hgDTNLTBS8lcuNs9Buig0dlnNMNxaUN8JdZ9Y0+22XJNhVNoi8WQ=="], - "@deno/darwin-x64": ["@deno/darwin-x64@2.5.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-9GrCi8ga5mgYB1b/8Pj9vRF4VVNLTuzyVd6bL0vEKFBZ/w27cQj0oY2o60t8AUTpW8iXpJfXMDoY7j4yiK1Xug=="], + "@deno/darwin-x64": ["@deno/darwin-x64@2.7.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-PPVC+BKAhlM3dvXqmKhzUyxA4D/IzNZWCc0dn9vEPAgIgWH8aVKwfIWf7yQS50FECKJz0C/QmANQOqVYYFxUqQ=="], - "@deno/linux-arm64-glibc": ["@deno/linux-arm64-glibc@2.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-HiAHeFBmNRsJFulNMQ2LX3k+IvAIhGAo9JcW/0PwrNa3WbMql9wq37pOPp8DkW2VUTvghh3FZm6GUcryUml4bQ=="], + "@deno/linux-arm64-glibc": ["@deno/linux-arm64-glibc@2.7.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-6l6bZdYqoUUdvLJqSkmXU3wSgSznaKIkoKfkyRjt/BLPmLxSeGvQ2cmX1Y5RE7GItO7DMwVksA9mce6RDm8GNg=="], - "@deno/linux-x64-glibc": ["@deno/linux-x64-glibc@2.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-aYct9Vp1RgKR2yW9hyWGTIL0EN0MgqaBuD0fbnQHygd4ftSfd/aWcBB3+n7OTUX/YNWSxYkOMLV1N8RWUCj4jw=="], + "@deno/linux-x64-glibc": ["@deno/linux-x64-glibc@2.7.1", "", { "os": "linux", "cpu": "x64" }, "sha512-st/6AKBOW9bA6FwCUi9zWnsOpTpw5o4CRt3eEQ4NYddcBTqegcfCOwyQuz23U2xTQfervPmpYrcFDqUM4YgTEw=="], - "@deno/win32-arm64": ["@deno/win32-arm64@2.5.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-HZq7gShjAehx1d2qg2cHRJJbxpbBk8kVmoPiZpILnN66XRwbNlWtrAUwsXNyHuBHcaT+7LgPTRUzX3KuDYXbwg=="], + "@deno/win32-arm64": ["@deno/win32-arm64@2.7.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-lc5LANMjnybwzcToDer1arEB4+gb6sYJgWLfD2pBhlkbdTOz3BPiESOKxUA0aR0eEy9tKH1c0Kq3EqVDVDp4kQ=="], - "@deno/win32-x64": ["@deno/win32-x64@2.5.6", "", { "os": "win32", "cpu": "x64" }, "sha512-GRBl8+CQbNeTp9CrxbCuAuqxi592NZfac1AvDgFEPt8O9aZe/2k+y7AQwESJGxEvyJl1vw6UV24qdf9N7pCM9Q=="], + "@deno/win32-x64": ["@deno/win32-x64@2.7.1", "", { "os": "win32", "cpu": "x64" }, "sha512-59nytY3Zez2Ur0f0YBY0Tv27Y6jZl76+5+k4XhSans7KaBqxB9/aA79GdSOeuW/7WOOFSZmlE+O07HMTkLY9Zg=="], - "@emnapi/runtime": ["@emnapi/runtime@1.7.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA=="], + "@emnapi/runtime": ["@emnapi/runtime@1.8.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg=="], - "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.10", "", { "os": "aix", "cpu": "ppc64" }, "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw=="], + "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.3", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg=="], - "@esbuild/android-arm": ["@esbuild/android-arm@0.25.10", "", { "os": "android", "cpu": "arm" }, "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w=="], + "@esbuild/android-arm": ["@esbuild/android-arm@0.27.3", "", { "os": "android", "cpu": "arm" }, "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA=="], - "@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.10", "", { "os": "android", "cpu": "arm64" }, "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg=="], + "@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.3", "", { "os": "android", "cpu": "arm64" }, "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg=="], - "@esbuild/android-x64": ["@esbuild/android-x64@0.25.10", "", { "os": "android", "cpu": "x64" }, "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg=="], + "@esbuild/android-x64": ["@esbuild/android-x64@0.27.3", "", { "os": "android", "cpu": "x64" }, "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ=="], - "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA=="], + "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg=="], - "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg=="], + "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg=="], - "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.10", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg=="], + "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.3", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w=="], - "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.10", "", { "os": "freebsd", "cpu": "x64" }, "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA=="], + "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.3", "", { "os": "freebsd", "cpu": "x64" }, "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA=="], - "@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.10", "", { "os": "linux", "cpu": "arm" }, "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg=="], + "@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.3", "", { "os": "linux", "cpu": "arm" }, "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw=="], - "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ=="], + "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg=="], - "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.10", "", { "os": "linux", "cpu": "ia32" }, "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ=="], + "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.3", "", { "os": "linux", "cpu": "ia32" }, "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg=="], - "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg=="], + "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA=="], - "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA=="], + "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw=="], - "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.10", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA=="], + "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.3", "", { "os": "linux", "cpu": "ppc64" }, "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA=="], - "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.10", "", { "os": "linux", "cpu": "none" }, "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA=="], + "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ=="], - "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.10", "", { "os": "linux", "cpu": "s390x" }, "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew=="], + "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.3", "", { "os": "linux", "cpu": "s390x" }, "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw=="], - "@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.10", "", { "os": "linux", "cpu": "x64" }, "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA=="], + "@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA=="], - "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A=="], + "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.3", "", { "os": "none", "cpu": "arm64" }, "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA=="], - "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.10", "", { "os": "none", "cpu": "x64" }, "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig=="], + "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.3", "", { "os": "none", "cpu": "x64" }, "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA=="], - "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.10", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw=="], + "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.3", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw=="], - "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.10", "", { "os": "openbsd", "cpu": "x64" }, "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw=="], + "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.3", "", { "os": "openbsd", "cpu": "x64" }, "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ=="], - "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.10", "", { "os": "none", "cpu": "arm64" }, "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag=="], + "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.3", "", { "os": "none", "cpu": "arm64" }, "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g=="], - "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.10", "", { "os": "sunos", "cpu": "x64" }, "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ=="], + "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.3", "", { "os": "sunos", "cpu": "x64" }, "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA=="], - "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw=="], + "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA=="], - "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.10", "", { "os": "win32", "cpu": "ia32" }, "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw=="], + "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q=="], - "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="], + "@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.3", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="], - "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.0", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g=="], + "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="], - "@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.1", "", {}, "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ=="], + "@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.2", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="], "@eslint/config-array": ["@eslint/config-array@0.21.1", "", { "dependencies": { "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", "minimatch": "^3.1.2" } }, "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA=="], @@ -245,43 +243,43 @@ "@eslint/core": ["@eslint/core@0.17.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ=="], - "@eslint/eslintrc": ["@eslint/eslintrc@3.3.1", "", { "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" } }, "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ=="], + "@eslint/eslintrc": ["@eslint/eslintrc@3.3.4", "", { "dependencies": { "ajv": "^6.14.0", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.1", "minimatch": "^3.1.3", "strip-json-comments": "^3.1.1" } }, "sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ=="], - "@eslint/js": ["@eslint/js@9.39.1", "", {}, "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw=="], + "@eslint/js": ["@eslint/js@9.39.3", "", {}, "sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw=="], "@eslint/object-schema": ["@eslint/object-schema@2.1.7", "", {}, "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA=="], "@eslint/plugin-kit": ["@eslint/plugin-kit@0.4.1", "", { "dependencies": { "@eslint/core": "^0.17.0", "levn": "^0.4.1" } }, "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA=="], - "@floating-ui/core": ["@floating-ui/core@1.7.3", "", { "dependencies": { "@floating-ui/utils": "^0.2.10" } }, "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w=="], + "@floating-ui/core": ["@floating-ui/core@1.7.5", "", { "dependencies": { "@floating-ui/utils": "^0.2.11" } }, "sha512-1Ih4WTWyw0+lKyFMcBHGbb5U5FtuHJuujoyyr5zTaWS5EYMeT6Jb2AuDeftsCsEuchO+mM2ij5+q9crhydzLhQ=="], - "@floating-ui/dom": ["@floating-ui/dom@1.7.4", "", { "dependencies": { "@floating-ui/core": "^1.7.3", "@floating-ui/utils": "^0.2.10" } }, "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA=="], + "@floating-ui/dom": ["@floating-ui/dom@1.7.6", "", { "dependencies": { "@floating-ui/core": "^1.7.5", "@floating-ui/utils": "^0.2.11" } }, "sha512-9gZSAI5XM36880PPMm//9dfiEngYoC6Am2izES1FF406YFsjvyBMmeJ2g4SAju3xWwtuynNRFL2s9hgxpLI5SQ=="], - "@floating-ui/utils": ["@floating-ui/utils@0.2.10", "", {}, "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ=="], + "@floating-ui/utils": ["@floating-ui/utils@0.2.11", "", {}, "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg=="], - "@floating-ui/vue": ["@floating-ui/vue@1.1.9", "", { "dependencies": { "@floating-ui/dom": "^1.7.4", "@floating-ui/utils": "^0.2.10", "vue-demi": ">=0.13.0" } }, "sha512-BfNqNW6KA83Nexspgb9DZuz578R7HT8MZw1CfK9I6Ah4QReNWEJsXWHN+SdmOVLNGmTPDi+fDT535Df5PzMLbQ=="], + "@floating-ui/vue": ["@floating-ui/vue@1.1.11", "", { "dependencies": { "@floating-ui/dom": "^1.7.6", "@floating-ui/utils": "^0.2.11", "vue-demi": ">=0.13.0" } }, "sha512-HzHKCNVxnGS35r9fCHBc3+uCnjw9IWIlCPL683cGgM9Kgj2BiAl8x1mS7vtvP6F9S/e/q4O6MApwSHj8hNLGfw=="], - "@fortawesome/fontawesome-common-types": ["@fortawesome/fontawesome-common-types@7.1.0", "", {}, "sha512-l/BQM7fYntsCI//du+6sEnHOP6a74UixFyOYUyz2DLMXKx+6DEhfR3F2NYGE45XH1JJuIamacb4IZs9S0ZOWLA=="], + "@fortawesome/fontawesome-common-types": ["@fortawesome/fontawesome-common-types@7.2.0", "", {}, "sha512-IpR0bER9FY25p+e7BmFH25MZKEwFHTfRAfhOyJubgiDnoJNsSvJ7nigLraHtp4VOG/cy8D7uiV0dLkHOne5Fhw=="], - "@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-fNxRUk1KhjSbnbuBxlWSnBLKLBNun52ZBTcs22H/xEEzM6Ap81ZFTQ4bZBxVQGQgVY0xugKGoRcCbaKjLQ3XZA=="], + "@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-6639htZMjEkwskf3J+e6/iar+4cTNM9qhoWuRfj9F3eJD6r7iCzV1SWnQr2Mdv0QT0suuqU8BoJCZUyCtP9R4Q=="], - "@fortawesome/free-brands-svg-icons": ["@fortawesome/free-brands-svg-icons@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-9byUd9bgNfthsZAjBl6GxOu1VPHgBuRUP9juI7ZoM98h8xNPTCTagfwUFyYscdZq4Hr7gD1azMfM9s5tIWKZZA=="], + "@fortawesome/free-brands-svg-icons": ["@fortawesome/free-brands-svg-icons@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-VNG8xqOip1JuJcC3zsVsKRQ60oXG9+oYNDCosjoU/H9pgYmLTEwWw8pE0jhPz/JWdHeUuK6+NQ3qsM4gIbdbYQ=="], - "@fortawesome/free-regular-svg-icons": ["@fortawesome/free-regular-svg-icons@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-0e2fdEyB4AR+e6kU4yxwA/MonnYcw/CsMEP9lH82ORFi9svA6/RhDyhxIv5mlJaldmaHLLYVTb+3iEr+PDSZuQ=="], + "@fortawesome/free-regular-svg-icons": ["@fortawesome/free-regular-svg-icons@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-iycmlN51EULlQ4D/UU9WZnHiN0CvjJ2TuuCrAh+1MVdzD+4ViKYH2deNAll4XAAYlZa8WAefHR5taSK8hYmSMw=="], - "@fortawesome/free-solid-svg-icons": ["@fortawesome/free-solid-svg-icons@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-Udu3K7SzAo9N013qt7qmm22/wo2hADdheXtBfxFTecp+ogsc0caQNRKEb7pkvvagUGOpG9wJC1ViH6WXs8oXIA=="], + "@fortawesome/free-solid-svg-icons": ["@fortawesome/free-solid-svg-icons@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-YTVITFGN0/24PxzXrwqCgnyd7njDuzp5ZvaCx5nq/jg55kUYd94Nj8UTchBdBofi/L0nwRfjGOg0E41d2u9T1w=="], - "@fortawesome/vue-fontawesome": ["@fortawesome/vue-fontawesome@3.1.2", "", { "peerDependencies": { "@fortawesome/fontawesome-svg-core": "~1 || ~6 || ~7", "vue": ">= 3.0.0 < 4" } }, "sha512-mhYnBIuuW8OIMHf31kOjaBmyE7BMrwBorhrOHVud6vTTu+7IPQNWB+DWaHoE75v10dRF5s/dFtcrgE7vKSEWwQ=="], + "@fortawesome/vue-fontawesome": ["@fortawesome/vue-fontawesome@3.1.3", "", { "peerDependencies": { "@fortawesome/fontawesome-svg-core": "~1 || ~6 || ~7", "vue": ">= 3.0.0 < 4" } }, "sha512-OHHUTLPEzdwP8kcYIzhioUdUOjZ4zzmi+midwa4bqscza4OJCOvTKJEHkXNz8PgZ23kWci1HkKVX0bm8f9t9gQ=="], "@humanfs/core": ["@humanfs/core@0.19.1", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="], - "@humanfs/node": ["@humanfs/node@0.16.6", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.3.0" } }, "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw=="], + "@humanfs/node": ["@humanfs/node@0.16.7", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ=="], "@humanwhocodes/module-importer": ["@humanwhocodes/module-importer@1.0.1", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="], "@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.3", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="], - "@img/colour": ["@img/colour@1.0.0", "", {}, "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw=="], + "@img/colour": ["@img/colour@1.1.0", "", {}, "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ=="], "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.2.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w=="], @@ -331,27 +329,25 @@ "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.34.5", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="], - "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.12", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg=="], + "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="], "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], - "@jridgewell/source-map": ["@jridgewell/source-map@0.3.10", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" } }, "sha512-0pPkgz9dY+bijgistcTTJ5mR+ocqRXLuhXHYdzoMmmoJ2C9S46RCm2GMUbatPEUK9Yjy26IrAy8D/M00lLkv+Q=="], - "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.29", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ=="], + "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], - "@lezer/common": ["@lezer/common@1.2.3", "", {}, "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA=="], + "@lezer/common": ["@lezer/common@1.5.1", "", {}, "sha512-6YRVG9vBkaY7p1IVxL4s44n5nUnaNnGM2/AckNgYOnxTG2kWh1vR8BMxPseWPjRNpb5VtXnMpeYAEAADoRV1Iw=="], - "@lezer/highlight": ["@lezer/highlight@1.2.1", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA=="], + "@lezer/highlight": ["@lezer/highlight@1.2.3", "", { "dependencies": { "@lezer/common": "^1.3.0" } }, "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g=="], "@lezer/json": ["@lezer/json@1.0.3", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ=="], - "@lezer/lr": ["@lezer/lr@1.4.2", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA=="], + "@lezer/lr": ["@lezer/lr@1.4.8", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-bPWa0Pgx69ylNlMlPvBPryqeLYQjyJjqPx+Aupm5zydLIF3NE+6MMLT8Yi23Bd9cif9VS00aUebn+6fDIGBcDA=="], - "@lezer/yaml": ["@lezer/yaml@1.0.3", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.4.0" } }, "sha512-GuBLekbw9jDBDhGur82nuwkxKQ+a3W5H0GfaAthDXcAu+XdpS43VlnxA9E9hllkpSP5ellRDKjLLj7Lu9Wr6xA=="], + "@lezer/yaml": ["@lezer/yaml@1.0.4", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.4.0" } }, "sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw=="], "@marijn/find-cluster-break": ["@marijn/find-cluster-break@1.0.2", "", {}, "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g=="], @@ -361,35 +357,35 @@ "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], - "@parcel/watcher": ["@parcel/watcher@2.5.1", "", { "dependencies": { "detect-libc": "^1.0.3", "is-glob": "^4.0.3", "micromatch": "^4.0.5", "node-addon-api": "^7.0.0" }, "optionalDependencies": { "@parcel/watcher-android-arm64": "2.5.1", "@parcel/watcher-darwin-arm64": "2.5.1", "@parcel/watcher-darwin-x64": "2.5.1", "@parcel/watcher-freebsd-x64": "2.5.1", "@parcel/watcher-linux-arm-glibc": "2.5.1", "@parcel/watcher-linux-arm-musl": "2.5.1", "@parcel/watcher-linux-arm64-glibc": "2.5.1", "@parcel/watcher-linux-arm64-musl": "2.5.1", "@parcel/watcher-linux-x64-glibc": "2.5.1", "@parcel/watcher-linux-x64-musl": "2.5.1", "@parcel/watcher-win32-arm64": "2.5.1", "@parcel/watcher-win32-ia32": "2.5.1", "@parcel/watcher-win32-x64": "2.5.1" } }, "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg=="], + "@parcel/watcher": ["@parcel/watcher@2.5.6", "", { "dependencies": { "detect-libc": "^2.0.3", "is-glob": "^4.0.3", "node-addon-api": "^7.0.0", "picomatch": "^4.0.3" }, "optionalDependencies": { "@parcel/watcher-android-arm64": "2.5.6", "@parcel/watcher-darwin-arm64": "2.5.6", "@parcel/watcher-darwin-x64": "2.5.6", "@parcel/watcher-freebsd-x64": "2.5.6", "@parcel/watcher-linux-arm-glibc": "2.5.6", "@parcel/watcher-linux-arm-musl": "2.5.6", "@parcel/watcher-linux-arm64-glibc": "2.5.6", "@parcel/watcher-linux-arm64-musl": "2.5.6", "@parcel/watcher-linux-x64-glibc": "2.5.6", "@parcel/watcher-linux-x64-musl": "2.5.6", "@parcel/watcher-win32-arm64": "2.5.6", "@parcel/watcher-win32-ia32": "2.5.6", "@parcel/watcher-win32-x64": "2.5.6" } }, "sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ=="], - "@parcel/watcher-android-arm64": ["@parcel/watcher-android-arm64@2.5.1", "", { "os": "android", "cpu": "arm64" }, "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA=="], + "@parcel/watcher-android-arm64": ["@parcel/watcher-android-arm64@2.5.6", "", { "os": "android", "cpu": "arm64" }, "sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A=="], - "@parcel/watcher-darwin-arm64": ["@parcel/watcher-darwin-arm64@2.5.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw=="], + "@parcel/watcher-darwin-arm64": ["@parcel/watcher-darwin-arm64@2.5.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Z2ZdrnwyXvvvdtRHLmM4knydIdU9adO3D4n/0cVipF3rRiwP+3/sfzpAwA/qKFL6i1ModaabkU7IbpeMBgiVEA=="], - "@parcel/watcher-darwin-x64": ["@parcel/watcher-darwin-x64@2.5.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg=="], + "@parcel/watcher-darwin-x64": ["@parcel/watcher-darwin-x64@2.5.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-HgvOf3W9dhithcwOWX9uDZyn1lW9R+7tPZ4sug+NGrGIo4Rk1hAXLEbcH1TQSqxts0NYXXlOWqVpvS1SFS4fRg=="], - "@parcel/watcher-freebsd-x64": ["@parcel/watcher-freebsd-x64@2.5.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ=="], + "@parcel/watcher-freebsd-x64": ["@parcel/watcher-freebsd-x64@2.5.6", "", { "os": "freebsd", "cpu": "x64" }, "sha512-vJVi8yd/qzJxEKHkeemh7w3YAn6RJCtYlE4HPMoVnCpIXEzSrxErBW5SJBgKLbXU3WdIpkjBTeUNtyBVn8TRng=="], - "@parcel/watcher-linux-arm-glibc": ["@parcel/watcher-linux-arm-glibc@2.5.1", "", { "os": "linux", "cpu": "arm" }, "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA=="], + "@parcel/watcher-linux-arm-glibc": ["@parcel/watcher-linux-arm-glibc@2.5.6", "", { "os": "linux", "cpu": "arm" }, "sha512-9JiYfB6h6BgV50CCfasfLf/uvOcJskMSwcdH1PHH9rvS1IrNy8zad6IUVPVUfmXr+u+Km9IxcfMLzgdOudz9EQ=="], - "@parcel/watcher-linux-arm-musl": ["@parcel/watcher-linux-arm-musl@2.5.1", "", { "os": "linux", "cpu": "arm" }, "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q=="], + "@parcel/watcher-linux-arm-musl": ["@parcel/watcher-linux-arm-musl@2.5.6", "", { "os": "linux", "cpu": "arm" }, "sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg=="], - "@parcel/watcher-linux-arm64-glibc": ["@parcel/watcher-linux-arm64-glibc@2.5.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w=="], + "@parcel/watcher-linux-arm64-glibc": ["@parcel/watcher-linux-arm64-glibc@2.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA=="], - "@parcel/watcher-linux-arm64-musl": ["@parcel/watcher-linux-arm64-musl@2.5.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg=="], + "@parcel/watcher-linux-arm64-musl": ["@parcel/watcher-linux-arm64-musl@2.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA=="], - "@parcel/watcher-linux-x64-glibc": ["@parcel/watcher-linux-x64-glibc@2.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A=="], + "@parcel/watcher-linux-x64-glibc": ["@parcel/watcher-linux-x64-glibc@2.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ=="], - "@parcel/watcher-linux-x64-musl": ["@parcel/watcher-linux-x64-musl@2.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg=="], + "@parcel/watcher-linux-x64-musl": ["@parcel/watcher-linux-x64-musl@2.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg=="], - "@parcel/watcher-win32-arm64": ["@parcel/watcher-win32-arm64@2.5.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw=="], + "@parcel/watcher-win32-arm64": ["@parcel/watcher-win32-arm64@2.5.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-3ukyebjc6eGlw9yRt678DxVF7rjXatWiHvTXqphZLvo7aC5NdEgFufVwjFfY51ijYEWpXbqF5jtrK275z52D4Q=="], - "@parcel/watcher-win32-ia32": ["@parcel/watcher-win32-ia32@2.5.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ=="], + "@parcel/watcher-win32-ia32": ["@parcel/watcher-win32-ia32@2.5.6", "", { "os": "win32", "cpu": "ia32" }, "sha512-k35yLp1ZMwwee3Ez/pxBi5cf4AoBKYXj00CZ80jUz5h8prpiaQsiRPKQMxoLstNuqe2vR4RNPEAEcjEFzhEz/g=="], - "@parcel/watcher-win32-x64": ["@parcel/watcher-win32-x64@2.5.1", "", { "os": "win32", "cpu": "x64" }, "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA=="], + "@parcel/watcher-win32-x64": ["@parcel/watcher-win32-x64@2.5.6", "", { "os": "win32", "cpu": "x64" }, "sha512-hbQlYcCq5dlAX9Qx+kFb0FHue6vbjlf0FrNzSKdYK2APUf7tGfGxQCk2ihEREmbR6ZMc0MVAD5RIX/41gpUzTw=="], - "@pkgr/core": ["@pkgr/core@0.2.7", "", {}, "sha512-YLT9Zo3oNPJoBjBc4q8G2mjU4tqIbf5CEOORbUUr48dCD9q3umJ3IPlVqOqDakPfd2HuwccBaqlGhN4Gmr5OWg=="], + "@pkgr/core": ["@pkgr/core@0.2.9", "", {}, "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA=="], "@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="], @@ -399,47 +395,57 @@ "@replit/codemirror-vim": ["@replit/codemirror-vim@6.3.0", "", { "peerDependencies": { "@codemirror/commands": "6.x.x", "@codemirror/language": "6.x.x", "@codemirror/search": "6.x.x", "@codemirror/state": "6.x.x", "@codemirror/view": "6.x.x" } }, "sha512-aTx931ULAMuJx6xLf7KQDOL7CxD+Sa05FktTDrtLaSy53uj01ll3Zf17JdKsriER248oS55GBzg0CfCTjEneAQ=="], - "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.50", "", {}, "sha512-5e76wQiQVeL1ICOZVUg4LSOVYg9jyhGCin+icYozhsUzM+fHE7kddi1bdiE0jwVqTfkjba3jUFbEkoC9WkdvyA=="], + "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-rc.2", "", {}, "sha512-izyXV/v+cHiRfozX62W9htOAvwMo4/bXKDrQ+vom1L1qRuexPock/7VZDAhnpHCLNejd3NJ6hiab+tO0D44Rgw=="], + + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.59.0", "", { "os": "android", "cpu": "arm" }, "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg=="], + + "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.59.0", "", { "os": "android", "cpu": "arm64" }, "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q=="], + + "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.59.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg=="], + + "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.59.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w=="], - "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.44.2", "", { "os": "android", "cpu": "arm" }, "sha512-g0dF8P1e2QYPOj1gu7s/3LVP6kze9A7m6x0BZ9iTdXK8N5c2V7cpBKHV3/9A4Zd8xxavdhK0t4PnqjkqVmUc9Q=="], + "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.59.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA=="], - "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.44.2", "", { "os": "android", "cpu": "arm64" }, "sha512-Yt5MKrOosSbSaAK5Y4J+vSiID57sOvpBNBR6K7xAaQvk3MkcNVV0f9fE20T+41WYN8hDn6SGFlFrKudtx4EoxA=="], + "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.59.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg=="], - "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.44.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-EsnFot9ZieM35YNA26nhbLTJBHD0jTwWpPwmRVDzjylQT6gkar+zenfb8mHxWpRrbn+WytRRjE0WKsfaxBkVUA=="], + "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.59.0", "", { "os": "linux", "cpu": "arm" }, "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw=="], - "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.44.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-dv/t1t1RkCvJdWWxQ2lWOO+b7cMsVw5YFaS04oHpZRWehI1h0fV1gF4wgGCTyQHHjJDfbNpwOi6PXEafRBBezw=="], + "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.59.0", "", { "os": "linux", "cpu": "arm" }, "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA=="], - "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.44.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-W4tt4BLorKND4qeHElxDoim0+BsprFTwb+vriVQnFFtT/P6v/xO5I99xvYnVzKWrK6j7Hb0yp3x7V5LUbaeOMg=="], + "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.59.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA=="], - "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.44.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-tdT1PHopokkuBVyHjvYehnIe20fxibxFCEhQP/96MDSOcyjM/shlTkZZLOufV3qO6/FQOSiJTBebhVc12JyPTA=="], + "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.59.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA=="], - "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.44.2", "", { "os": "linux", "cpu": "arm" }, "sha512-+xmiDGGaSfIIOXMzkhJ++Oa0Gwvl9oXUeIiwarsdRXSe27HUIvjbSIpPxvnNsRebsNdUo7uAiQVgBD1hVriwSQ=="], + "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.59.0", "", { "os": "linux", "cpu": "none" }, "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg=="], - "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.44.2", "", { "os": "linux", "cpu": "arm" }, "sha512-bDHvhzOfORk3wt8yxIra8N4k/N0MnKInCW5OGZaeDYa/hMrdPaJzo7CSkjKZqX4JFUWjUGm88lI6QJLCM7lDrA=="], + "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.59.0", "", { "os": "linux", "cpu": "none" }, "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q=="], - "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.44.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-NMsDEsDiYghTbeZWEGnNi4F0hSbGnsuOG+VnNvxkKg0IGDvFh7UVpM/14mnMwxRxUf9AdAVJgHPvKXf6FpMB7A=="], + "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.59.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA=="], - "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.44.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-lb5bxXnxXglVq+7imxykIp5xMq+idehfl+wOgiiix0191av84OqbjUED+PRC5OA8eFJYj5xAGcpAZ0pF2MnW+A=="], + "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.59.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA=="], - "@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.44.2", "", { "os": "linux", "cpu": "none" }, "sha512-Yl5Rdpf9pIc4GW1PmkUGHdMtbx0fBLE1//SxDmuf3X0dUC57+zMepow2LK0V21661cjXdTn8hO2tXDdAWAqE5g=="], + "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.59.0", "", { "os": "linux", "cpu": "none" }, "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg=="], - "@rollup/rollup-linux-powerpc64le-gnu": ["@rollup/rollup-linux-powerpc64le-gnu@4.44.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-03vUDH+w55s680YYryyr78jsO1RWU9ocRMaeV2vMniJJW/6HhoTBwyyiiTPVHNWLnhsnwcQ0oH3S9JSBEKuyqw=="], + "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.59.0", "", { "os": "linux", "cpu": "none" }, "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg=="], - "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.44.2", "", { "os": "linux", "cpu": "none" }, "sha512-iYtAqBg5eEMG4dEfVlkqo05xMOk6y/JXIToRca2bAWuqjrJYJlx/I7+Z+4hSrsWU8GdJDFPL4ktV3dy4yBSrzg=="], + "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.59.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w=="], - "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.44.2", "", { "os": "linux", "cpu": "none" }, "sha512-e6vEbgaaqz2yEHqtkPXa28fFuBGmUJ0N2dOJK8YUfijejInt9gfCSA7YDdJ4nYlv67JfP3+PSWFX4IVw/xRIPg=="], + "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.59.0", "", { "os": "linux", "cpu": "x64" }, "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg=="], - "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.44.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-evFOtkmVdY3udE+0QKrV5wBx7bKI0iHz5yEVx5WqDJkxp9YQefy4Mpx3RajIVcM6o7jxTvVd/qpC1IXUhGc1Mw=="], + "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.59.0", "", { "os": "linux", "cpu": "x64" }, "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg=="], - "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.44.2", "", { "os": "linux", "cpu": "x64" }, "sha512-/bXb0bEsWMyEkIsUL2Yt5nFB5naLAwyOWMEviQfQY1x3l5WsLKgvZf66TM7UTfED6erckUVUJQ/jJ1FSpm3pRQ=="], + "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.59.0", "", { "os": "openbsd", "cpu": "x64" }, "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ=="], - "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.44.2", "", { "os": "linux", "cpu": "x64" }, "sha512-3D3OB1vSSBXmkGEZR27uiMRNiwN08/RVAcBKwhUYPaiZ8bcvdeEwWPvbnXvvXHY+A/7xluzcN+kaiOFNiOZwWg=="], + "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.59.0", "", { "os": "none", "cpu": "arm64" }, "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA=="], - "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.44.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-VfU0fsMK+rwdK8mwODqYeM2hDrF2WiHaSmCBrS7gColkQft95/8tphyzv2EupVxn3iE0FI78wzffoULH1G+dkw=="], + "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.59.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A=="], - "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.44.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-+qMUrkbUurpE6DVRjiJCNGZBGo9xM4Y0FXU5cjgudWqIBWbcLkjE3XprJUsOFgC6xjBClwVa9k6O3A7K3vxb5Q=="], + "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.59.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA=="], - "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.44.2", "", { "os": "win32", "cpu": "x64" }, "sha512-3+QZROYfJ25PDcxFF66UEk8jGWigHJeecZILvkPkyQN7oc5BvFo4YEXFkOs154j3FTMp9mn9Ky8RCOwastduEA=="], + "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.59.0", "", { "os": "win32", "cpu": "x64" }, "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA=="], + + "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.59.0", "", { "os": "win32", "cpu": "x64" }, "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA=="], "@sagold/json-pointer": ["@sagold/json-pointer@5.1.2", "", {}, "sha512-+wAhJZBXa6MNxRScg6tkqEbChEHMgVZAhTHVJ60Y7sbtXtu9XA49KfUkdWlS2x78D6H9nryiKePiYozumauPfA=="], @@ -477,7 +483,7 @@ "@types/mdast": ["@types/mdast@4.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA=="], - "@types/node": ["@types/node@24.10.1", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ=="], + "@types/node": ["@types/node@24.11.0", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-fPxQqz4VTgPI/IQ+lj9r0h+fDR66bzoeMGHp8ASee+32OSGIkeASsoZuJixsQoVef1QJbeubcPBxKk22QVoWdw=="], "@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="], @@ -487,83 +493,83 @@ "@types/yargs-parser": ["@types/yargs-parser@21.0.3", "", {}, "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ=="], - "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.36.0", "", { "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.36.0", "@typescript-eslint/type-utils": "8.36.0", "@typescript-eslint/utils": "8.36.0", "@typescript-eslint/visitor-keys": "8.36.0", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.36.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-lZNihHUVB6ZZiPBNgOQGSxUASI7UJWhT8nHyUGCnaQ28XFCw98IfrMCG3rUl1uwUWoAvodJQby2KTs79UTcrAg=="], + "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.56.1", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/type-utils": "8.56.1", "@typescript-eslint/utils": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.56.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A=="], - "@typescript-eslint/parser": ["@typescript-eslint/parser@8.36.0", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.36.0", "@typescript-eslint/types": "8.36.0", "@typescript-eslint/typescript-estree": "8.36.0", "@typescript-eslint/visitor-keys": "8.36.0", "debug": "^4.3.4" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-FuYgkHwZLuPbZjQHzJXrtXreJdFMKl16BFYyRrLxDhWr6Qr7Kbcu2s1Yhu8tsiMXw1S0W1pjfFfYEt+R604s+Q=="], + "@typescript-eslint/parser": ["@typescript-eslint/parser@8.56.1", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg=="], - "@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.36.0", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.36.0", "@typescript-eslint/types": "^8.36.0", "debug": "^4.3.4" }, "peerDependencies": { "typescript": ">=4.8.4 <5.9.0" } }, "sha512-JAhQFIABkWccQYeLMrHadu/fhpzmSQ1F1KXkpzqiVxA/iYI6UnRt2trqXHt1sYEcw1mxLnB9rKMsOxXPxowN/g=="], + "@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.56.1", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.56.1", "@typescript-eslint/types": "^8.56.1", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ=="], - "@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.36.0", "", { "dependencies": { "@typescript-eslint/types": "8.36.0", "@typescript-eslint/visitor-keys": "8.36.0" } }, "sha512-wCnapIKnDkN62fYtTGv2+RY8FlnBYA3tNm0fm91kc2BjPhV2vIjwwozJ7LToaLAyb1ca8BxrS7vT+Pvvf7RvqA=="], + "@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.56.1", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1" } }, "sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w=="], - "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.36.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <5.9.0" } }, "sha512-Nhh3TIEgN18mNbdXpd5Q8mSCBnrZQeY9V7Ca3dqYvNDStNIGRmJA6dmrIPMJ0kow3C7gcQbpsG2rPzy1Ks/AnA=="], + "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.56.1", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ=="], - "@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.36.0", "", { "dependencies": { "@typescript-eslint/typescript-estree": "8.36.0", "@typescript-eslint/utils": "8.36.0", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-5aaGYG8cVDd6cxfk/ynpYzxBRZJk7w/ymto6uiyUFtdCozQIsQWh7M28/6r57Fwkbweng8qAzoMCPwSJfWlmsg=="], + "@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.56.1", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/utils": "8.56.1", "debug": "^4.4.3", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg=="], - "@typescript-eslint/types": ["@typescript-eslint/types@8.36.0", "", {}, "sha512-xGms6l5cTJKQPZOKM75Dl9yBfNdGeLRsIyufewnxT4vZTrjC0ImQT4fj8QmtJK84F58uSh5HVBSANwcfiXxABQ=="], + "@typescript-eslint/types": ["@typescript-eslint/types@8.56.1", "", {}, "sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw=="], - "@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.36.0", "", { "dependencies": { "@typescript-eslint/project-service": "8.36.0", "@typescript-eslint/tsconfig-utils": "8.36.0", "@typescript-eslint/types": "8.36.0", "@typescript-eslint/visitor-keys": "8.36.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "typescript": ">=4.8.4 <5.9.0" } }, "sha512-JaS8bDVrfVJX4av0jLpe4ye0BpAaUW7+tnS4Y4ETa3q7NoZgzYbN9zDQTJ8kPb5fQ4n0hliAt9tA4Pfs2zA2Hg=="], + "@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.56.1", "", { "dependencies": { "@typescript-eslint/project-service": "8.56.1", "@typescript-eslint/tsconfig-utils": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg=="], - "@typescript-eslint/utils": ["@typescript-eslint/utils@8.36.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", "@typescript-eslint/scope-manager": "8.36.0", "@typescript-eslint/types": "8.36.0", "@typescript-eslint/typescript-estree": "8.36.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-VOqmHu42aEMT+P2qYjylw6zP/3E/HvptRwdn/PZxyV27KhZg2IOszXod4NcXisWzPAGSS4trE/g4moNj6XmH2g=="], + "@typescript-eslint/utils": ["@typescript-eslint/utils@8.56.1", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA=="], - "@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.36.0", "", { "dependencies": { "@typescript-eslint/types": "8.36.0", "eslint-visitor-keys": "^4.2.1" } }, "sha512-vZrhV2lRPWDuGoxcmrzRZyxAggPL+qp3WzUrlZD+slFueDiYHxeBa34dUXPuC0RmGKzl4lS5kFJYvKCq9cnNDA=="], + "@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.56.1", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "eslint-visitor-keys": "^5.0.0" } }, "sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw=="], - "@uiw/codemirror-themes": ["@uiw/codemirror-themes@4.25.3", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-k7/B7Vf4jU/WcdewgJWP9tMFxbjB6UpUymZ3fx/TsbGwt2JXAouw0uyqCn1RlYBfr7YQnvEs3Ju9ECkd2sKzdg=="], + "@uiw/codemirror-themes": ["@uiw/codemirror-themes@4.25.7", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-Rcx1XiQiMOJzk/efVuZioCv3VuswUb2CPmiM1NIXY5N4vEMmWLY3N8T4/WkPzJ8ZZuk7o3OH2VI5bj7729fDYg=="], "@ungap/structured-clone": ["@ungap/structured-clone@1.3.0", "", {}, "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g=="], - "@vitejs/plugin-vue": ["@vitejs/plugin-vue@6.0.2", "", { "dependencies": { "@rolldown/pluginutils": "1.0.0-beta.50" }, "peerDependencies": { "vite": "^5.0.0 || ^6.0.0 || ^7.0.0", "vue": "^3.2.25" } }, "sha512-iHmwV3QcVGGvSC1BG5bZ4z6iwa1SOpAPWmnjOErd4Ske+lZua5K9TtAVdx0gMBClJ28DViCbSmZitjWZsWO3LA=="], + "@vitejs/plugin-vue": ["@vitejs/plugin-vue@6.0.4", "", { "dependencies": { "@rolldown/pluginutils": "1.0.0-rc.2" }, "peerDependencies": { "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0", "vue": "^3.2.25" } }, "sha512-uM5iXipgYIn13UUQCZNdWkYk+sysBeA97d5mHsAoAt1u/wpN3+zxOmsVJWosuzX+IMGRzeYUNytztrYznboIkQ=="], - "@volar/language-core": ["@volar/language-core@2.4.23", "", { "dependencies": { "@volar/source-map": "2.4.23" } }, "sha512-hEEd5ET/oSmBC6pi1j6NaNYRWoAiDhINbT8rmwtINugR39loROSlufGdYMF9TaKGfz+ViGs1Idi3mAhnuPcoGQ=="], + "@volar/language-core": ["@volar/language-core@2.4.28", "", { "dependencies": { "@volar/source-map": "2.4.28" } }, "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ=="], - "@volar/source-map": ["@volar/source-map@2.4.23", "", {}, "sha512-Z1Uc8IB57Lm6k7q6KIDu/p+JWtf3xsXJqAX/5r18hYOTpJyBn0KXUR8oTJ4WFYOcDzWC9n3IflGgHowx6U6z9Q=="], + "@volar/source-map": ["@volar/source-map@2.4.28", "", {}, "sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ=="], - "@volar/typescript": ["@volar/typescript@2.4.23", "", { "dependencies": { "@volar/language-core": "2.4.23", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-lAB5zJghWxVPqfcStmAP1ZqQacMpe90UrP5RJ3arDyrhy4aCUQqmxPPLB2PWDKugvylmO41ljK7vZ+t6INMTag=="], + "@volar/typescript": ["@volar/typescript@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw=="], - "@vue/babel-helper-vue-transform-on": ["@vue/babel-helper-vue-transform-on@1.4.0", "", {}, "sha512-mCokbouEQ/ocRce/FpKCRItGo+013tHg7tixg3DUNS+6bmIchPt66012kBMm476vyEIJPafrvOf4E5OYj3shSw=="], + "@vue/babel-helper-vue-transform-on": ["@vue/babel-helper-vue-transform-on@1.5.0", "", {}, "sha512-0dAYkerNhhHutHZ34JtTl2czVQHUNWv6xEbkdF5W+Yrv5pCWsqjeORdOgbtW2I9gWlt+wBmVn+ttqN9ZxR5tzA=="], - "@vue/babel-plugin-jsx": ["@vue/babel-plugin-jsx@1.4.0", "", { "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "@babel/plugin-syntax-jsx": "^7.25.9", "@babel/template": "^7.26.9", "@babel/traverse": "^7.26.9", "@babel/types": "^7.26.9", "@vue/babel-helper-vue-transform-on": "1.4.0", "@vue/babel-plugin-resolve-type": "1.4.0", "@vue/shared": "^3.5.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "optionalPeers": ["@babel/core"] }, "sha512-9zAHmwgMWlaN6qRKdrg1uKsBKHvnUU+Py+MOCTuYZBoZsopa90Di10QRjB+YPnVss0BZbG/H5XFwJY1fTxJWhA=="], + "@vue/babel-plugin-jsx": ["@vue/babel-plugin-jsx@1.5.0", "", { "dependencies": { "@babel/helper-module-imports": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.0", "@babel/types": "^7.28.2", "@vue/babel-helper-vue-transform-on": "1.5.0", "@vue/babel-plugin-resolve-type": "1.5.0", "@vue/shared": "^3.5.18" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "optionalPeers": ["@babel/core"] }, "sha512-mneBhw1oOqCd2247O0Yw/mRwC9jIGACAJUlawkmMBiNmL4dGA2eMzuNZVNqOUfYTa6vqmND4CtOPzmEEEqLKFw=="], - "@vue/babel-plugin-resolve-type": ["@vue/babel-plugin-resolve-type@1.4.0", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "@babel/parser": "^7.26.9", "@vue/compiler-sfc": "^3.5.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-4xqDRRbQQEWHQyjlYSgZsWj44KfiF6D+ktCuXyZ8EnVDYV3pztmXJDf1HveAjUAXxAnR8daCQT51RneWWxtTyQ=="], + "@vue/babel-plugin-resolve-type": ["@vue/babel-plugin-resolve-type@1.5.0", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/helper-module-imports": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/parser": "^7.28.0", "@vue/compiler-sfc": "^3.5.18" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Wm/60o+53JwJODm4Knz47dxJnLDJ9FnKnGZJbUUf8nQRAtt6P+undLUAVU3Ha33LxOJe6IPoifRQ6F/0RrU31w=="], - "@vue/compiler-core": ["@vue/compiler-core@3.5.25", "", { "dependencies": { "@babel/parser": "^7.28.5", "@vue/shared": "3.5.25", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-vay5/oQJdsNHmliWoZfHPoVZZRmnSWhug0BYT34njkYTPqClh3DNWLkZNJBVSjsNMrg0CCrBfoKkjZQPM/QVUw=="], + "@vue/compiler-core": ["@vue/compiler-core@3.5.29", "", { "dependencies": { "@babel/parser": "^7.29.0", "@vue/shared": "3.5.29", "entities": "^7.0.1", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-cuzPhD8fwRHk8IGfmYaR4eEe4cAyJEL66Ove/WZL7yWNL134nqLddSLwNRIsFlnnW1kK+p8Ck3viFnC0chXCXw=="], - "@vue/compiler-dom": ["@vue/compiler-dom@3.5.25", "", { "dependencies": { "@vue/compiler-core": "3.5.25", "@vue/shared": "3.5.25" } }, "sha512-4We0OAcMZsKgYoGlMjzYvaoErltdFI2/25wqanuTu+S4gismOTRTBPi4IASOjxWdzIwrYSjnqONfKvuqkXzE2Q=="], + "@vue/compiler-dom": ["@vue/compiler-dom@3.5.29", "", { "dependencies": { "@vue/compiler-core": "3.5.29", "@vue/shared": "3.5.29" } }, "sha512-n0G5o7R3uBVmVxjTIYcz7ovr8sy7QObFG8OQJ3xGCDNhbG60biP/P5KnyY8NLd81OuT1WJflG7N4KWYHaeeaIg=="], - "@vue/compiler-sfc": ["@vue/compiler-sfc@3.5.25", "", { "dependencies": { "@babel/parser": "^7.28.5", "@vue/compiler-core": "3.5.25", "@vue/compiler-dom": "3.5.25", "@vue/compiler-ssr": "3.5.25", "@vue/shared": "3.5.25", "estree-walker": "^2.0.2", "magic-string": "^0.30.21", "postcss": "^8.5.6", "source-map-js": "^1.2.1" } }, "sha512-PUgKp2rn8fFsI++lF2sO7gwO2d9Yj57Utr5yEsDf3GNaQcowCLKL7sf+LvVFvtJDXUp/03+dC6f2+LCv5aK1ag=="], + "@vue/compiler-sfc": ["@vue/compiler-sfc@3.5.29", "", { "dependencies": { "@babel/parser": "^7.29.0", "@vue/compiler-core": "3.5.29", "@vue/compiler-dom": "3.5.29", "@vue/compiler-ssr": "3.5.29", "@vue/shared": "3.5.29", "estree-walker": "^2.0.2", "magic-string": "^0.30.21", "postcss": "^8.5.6", "source-map-js": "^1.2.1" } }, "sha512-oJZhN5XJs35Gzr50E82jg2cYdZQ78wEwvRO6Y63TvLVTc+6xICzJHP1UIecdSPPYIbkautNBanDiWYa64QSFIA=="], - "@vue/compiler-ssr": ["@vue/compiler-ssr@3.5.25", "", { "dependencies": { "@vue/compiler-dom": "3.5.25", "@vue/shared": "3.5.25" } }, "sha512-ritPSKLBcParnsKYi+GNtbdbrIE1mtuFEJ4U1sWeuOMlIziK5GtOL85t5RhsNy4uWIXPgk+OUdpnXiTdzn8o3A=="], + "@vue/compiler-ssr": ["@vue/compiler-ssr@3.5.29", "", { "dependencies": { "@vue/compiler-dom": "3.5.29", "@vue/shared": "3.5.29" } }, "sha512-Y/ARJZE6fpjzL5GH/phJmsFwx3g6t2KmHKHx5q+MLl2kencADKIrhH5MLF6HHpRMmlRAYBRSvv347Mepf1zVNw=="], "@vue/devtools-api": ["@vue/devtools-api@6.6.4", "", {}, "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g=="], - "@vue/devtools-core": ["@vue/devtools-core@8.0.5", "", { "dependencies": { "@vue/devtools-kit": "^8.0.5", "@vue/devtools-shared": "^8.0.5", "mitt": "^3.0.1", "nanoid": "^5.1.5", "pathe": "^2.0.3", "vite-hot-client": "^2.1.0" }, "peerDependencies": { "vue": "^3.0.0" } }, "sha512-dpCw8nl0GDBuiL9SaY0mtDxoGIEmU38w+TQiYEPOLhW03VDC0lfNMYXS/qhl4I0YlysGp04NLY4UNn6xgD0VIQ=="], + "@vue/devtools-core": ["@vue/devtools-core@8.0.7", "", { "dependencies": { "@vue/devtools-kit": "^8.0.7", "@vue/devtools-shared": "^8.0.7" }, "peerDependencies": { "vue": "^3.0.0" } }, "sha512-PmpiPxvg3Of80ODHVvyckxwEW1Z02VIAvARIZS1xegINn3VuNQLm9iHUmKD+o6cLkMNWV8OG8x7zo0kgydZgdg=="], - "@vue/devtools-kit": ["@vue/devtools-kit@8.0.5", "", { "dependencies": { "@vue/devtools-shared": "^8.0.5", "birpc": "^2.6.1", "hookable": "^5.5.3", "mitt": "^3.0.1", "perfect-debounce": "^2.0.0", "speakingurl": "^14.0.1", "superjson": "^2.2.2" } }, "sha512-q2VV6x1U3KJMTQPUlRMyWEKVbcHuxhqJdSr6Jtjz5uAThAIrfJ6WVZdGZm5cuO63ZnSUz0RCsVwiUUb0mDV0Yg=="], + "@vue/devtools-kit": ["@vue/devtools-kit@8.0.7", "", { "dependencies": { "@vue/devtools-shared": "^8.0.7", "birpc": "^2.6.1", "hookable": "^5.5.3", "perfect-debounce": "^2.0.0" } }, "sha512-H6esJGHGl5q0E9iV3m2EoBQHJ+V83WMW83A0/+Fn95eZ2iIvdsq4+UCS6yT/Fdd4cGZSchx/MdWDreM3WqMsDw=="], - "@vue/devtools-shared": ["@vue/devtools-shared@8.0.5", "", { "dependencies": { "rfdc": "^1.4.1" } }, "sha512-bRLn6/spxpmgLk+iwOrR29KrYnJjG9DGpHGkDFG82UM21ZpJ39ztUT9OXX3g+usW7/b2z+h46I9ZiYyB07XMXg=="], + "@vue/devtools-shared": ["@vue/devtools-shared@8.0.7", "", {}, "sha512-CgAb9oJH5NUmbQRdYDj/1zMiaICYSLtm+B1kxcP72LBrifGAjUmt8bx52dDH1gWRPlQgxGPqpAMKavzVirAEhA=="], "@vue/eslint-config-prettier": ["@vue/eslint-config-prettier@10.2.0", "", { "dependencies": { "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.2" }, "peerDependencies": { "eslint": ">= 8.21.0", "prettier": ">= 3.0.0" } }, "sha512-GL3YBLwv/+b86yHcNNfPJxOTtVFJ4Mbc9UU3zR+KVoG7SwGTjPT+32fXamscNumElhcpXW3mT0DgzS9w32S7Bw=="], - "@vue/eslint-config-typescript": ["@vue/eslint-config-typescript@14.6.0", "", { "dependencies": { "@typescript-eslint/utils": "^8.35.1", "fast-glob": "^3.3.3", "typescript-eslint": "^8.35.1", "vue-eslint-parser": "^10.2.0" }, "peerDependencies": { "eslint": "^9.10.0", "eslint-plugin-vue": "^9.28.0 || ^10.0.0", "typescript": ">=4.8.4" }, "optionalPeers": ["typescript"] }, "sha512-UpiRY/7go4Yps4mYCjkvlIbVWmn9YvPGQDxTAlcKLphyaD77LjIu3plH4Y9zNT0GB4f3K5tMmhhtRhPOgrQ/bQ=="], + "@vue/eslint-config-typescript": ["@vue/eslint-config-typescript@14.7.0", "", { "dependencies": { "@typescript-eslint/utils": "^8.56.0", "fast-glob": "^3.3.3", "typescript-eslint": "^8.56.0", "vue-eslint-parser": "^10.4.0" }, "peerDependencies": { "eslint": "^9.10.0 || ^10.0.0", "eslint-plugin-vue": "^9.28.0 || ^10.0.0", "typescript": ">=4.8.4" }, "optionalPeers": ["typescript"] }, "sha512-iegbMINVc+seZ/QxtzWiOBozctrHiF2WvGedruu2EbLujg9VuU0FQiNcN2z1ycuaoKKpF4m2qzB5HDEMKbxtIg=="], - "@vue/language-core": ["@vue/language-core@3.1.5", "", { "dependencies": { "@volar/language-core": "2.4.23", "@vue/compiler-dom": "^3.5.0", "@vue/shared": "^3.5.0", "alien-signals": "^3.0.0", "muggle-string": "^0.4.1", "path-browserify": "^1.0.1", "picomatch": "^4.0.2" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-FMcqyzWN+sYBeqRMWPGT2QY0mUasZMVIuHvmb5NT3eeqPrbHBYtCP8JWEUCDCgM+Zr62uuWY/qoeBrPrzfa78w=="], + "@vue/language-core": ["@vue/language-core@3.2.5", "", { "dependencies": { "@volar/language-core": "2.4.28", "@vue/compiler-dom": "^3.5.0", "@vue/shared": "^3.5.0", "alien-signals": "^3.0.0", "muggle-string": "^0.4.1", "path-browserify": "^1.0.1", "picomatch": "^4.0.2" } }, "sha512-d3OIxN/+KRedeM5wQ6H6NIpwS3P5gC9nmyaHgBk+rO6dIsjY+tOh4UlPpiZbAh3YtLdCGEX4M16RmsBqPmJV+g=="], - "@vue/reactivity": ["@vue/reactivity@3.5.25", "", { "dependencies": { "@vue/shared": "3.5.25" } }, "sha512-5xfAypCQepv4Jog1U4zn8cZIcbKKFka3AgWHEFQeK65OW+Ys4XybP6z2kKgws4YB43KGpqp5D/K3go2UPPunLA=="], + "@vue/reactivity": ["@vue/reactivity@3.5.29", "", { "dependencies": { "@vue/shared": "3.5.29" } }, "sha512-zcrANcrRdcLtmGZETBxWqIkoQei8HaFpZWx/GHKxx79JZsiZ8j1du0VUJtu4eJjgFvU/iKL5lRXFXksVmI+5DA=="], - "@vue/runtime-core": ["@vue/runtime-core@3.5.25", "", { "dependencies": { "@vue/reactivity": "3.5.25", "@vue/shared": "3.5.25" } }, "sha512-Z751v203YWwYzy460bzsYQISDfPjHTl+6Zzwo/a3CsAf+0ccEjQ8c+0CdX1WsumRTHeywvyUFtW6KvNukT/smA=="], + "@vue/runtime-core": ["@vue/runtime-core@3.5.29", "", { "dependencies": { "@vue/reactivity": "3.5.29", "@vue/shared": "3.5.29" } }, "sha512-8DpW2QfdwIWOLqtsNcds4s+QgwSaHSJY/SUe04LptianUQ/0xi6KVsu/pYVh+HO3NTVvVJjIPL2t6GdeKbS4Lg=="], - "@vue/runtime-dom": ["@vue/runtime-dom@3.5.25", "", { "dependencies": { "@vue/reactivity": "3.5.25", "@vue/runtime-core": "3.5.25", "@vue/shared": "3.5.25", "csstype": "^3.1.3" } }, "sha512-a4WrkYFbb19i9pjkz38zJBg8wa/rboNERq3+hRRb0dHiJh13c+6kAbgqCPfMaJ2gg4weWD3APZswASOfmKwamA=="], + "@vue/runtime-dom": ["@vue/runtime-dom@3.5.29", "", { "dependencies": { "@vue/reactivity": "3.5.29", "@vue/runtime-core": "3.5.29", "@vue/shared": "3.5.29", "csstype": "^3.2.3" } }, "sha512-AHvvJEtcY9tw/uk+s/YRLSlxxQnqnAkjqvK25ZiM4CllCZWzElRAoQnCM42m9AHRLNJ6oe2kC5DCgD4AUdlvXg=="], - "@vue/server-renderer": ["@vue/server-renderer@3.5.25", "", { "dependencies": { "@vue/compiler-ssr": "3.5.25", "@vue/shared": "3.5.25" }, "peerDependencies": { "vue": "3.5.25" } }, "sha512-UJaXR54vMG61i8XNIzTSf2Q7MOqZHpp8+x3XLGtE3+fL+nQd+k7O5+X3D/uWrnQXOdMw5VPih+Uremcw+u1woQ=="], + "@vue/server-renderer": ["@vue/server-renderer@3.5.29", "", { "dependencies": { "@vue/compiler-ssr": "3.5.29", "@vue/shared": "3.5.29" }, "peerDependencies": { "vue": "3.5.29" } }, "sha512-G/1k6WK5MusLlbxSE2YTcqAAezS+VuwHhOvLx2KnQU7G2zCH6KIb+5Wyt6UjMq7a3qPzNEjJXs1hvAxDclQH+g=="], - "@vue/shared": ["@vue/shared@3.5.25", "", {}, "sha512-AbOPdQQnAnzs58H2FrrDxYj/TJfmeS2jdfEEhgiKINy+bnOANmVizIEgq1r+C5zsbs6l1CCQxtcj71rwNQ4jWg=="], + "@vue/shared": ["@vue/shared@3.5.29", "", {}, "sha512-w7SR0A5zyRByL9XUkCfdLs7t9XOHUyJ67qPGQjOou3p6GvBeBW+AVjUUmlxtZ4PIYaRvE+1LmK44O4uajlZwcg=="], "@vue/tsconfig": ["@vue/tsconfig@0.8.1", "", { "peerDependencies": { "typescript": "5.x", "vue": "^3.4.0" }, "optionalPeers": ["typescript", "vue"] }, "sha512-aK7feIWPXFSUhsCP9PFqPyFOcz4ENkb8hZ2pneL6m2UjCkccvaOhC/5KCKluuBufvp2KzkbdA2W2pk20vLzu3g=="], - "@vueuse/core": ["@vueuse/core@14.1.0", "", { "dependencies": { "@types/web-bluetooth": "^0.0.21", "@vueuse/metadata": "14.1.0", "@vueuse/shared": "14.1.0" }, "peerDependencies": { "vue": "^3.5.0" } }, "sha512-rgBinKs07hAYyPF834mDTigH7BtPqvZ3Pryuzt1SD/lg5wEcWqvwzXXYGEDb2/cP0Sj5zSvHl3WkmMELr5kfWw=="], + "@vueuse/core": ["@vueuse/core@14.2.1", "", { "dependencies": { "@types/web-bluetooth": "^0.0.21", "@vueuse/metadata": "14.2.1", "@vueuse/shared": "14.2.1" }, "peerDependencies": { "vue": "^3.5.0" } }, "sha512-3vwDzV+GDUNpdegRY6kzpLm4Igptq+GA0QkJ3W61Iv27YWwW/ufSlOfgQIpN6FZRMG0mkaz4gglJRtq5SeJyIQ=="], - "@vueuse/metadata": ["@vueuse/metadata@14.1.0", "", {}, "sha512-7hK4g015rWn2PhKcZ99NyT+ZD9sbwm7SGvp7k+k+rKGWnLjS/oQozoIZzWfCewSUeBmnJkIb+CNr7Zc/EyRnnA=="], + "@vueuse/metadata": ["@vueuse/metadata@14.2.1", "", {}, "sha512-1ButlVtj5Sb/HDtIy1HFr1VqCP4G6Ypqt5MAo0lCgjokrk2mvQKsK2uuy0vqu/Ks+sHfuHo0B9Y9jn9xKdjZsw=="], - "@vueuse/shared": ["@vueuse/shared@14.1.0", "", { "peerDependencies": { "vue": "^3.5.0" } }, "sha512-EcKxtYvn6gx1F8z9J5/rsg3+lTQnvOruQd8fUecW99DCK04BkWD7z5KQ/wTAx+DazyoEE9dJt/zV8OIEQbM6kw=="], + "@vueuse/shared": ["@vueuse/shared@14.2.1", "", { "peerDependencies": { "vue": "^3.5.0" } }, "sha512-shTJncjV9JTI4oVNyF1FQonetYAiTBd+Qj7cY89SWbXSkx7gyhrgtEdF2ZAVWS1S3SHlaROO6F2IesJxQEkZBw=="], "@xterm/addon-fit": ["@xterm/addon-fit@0.10.0", "", { "peerDependencies": { "@xterm/xterm": "^5.0.0" } }, "sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ=="], @@ -571,23 +577,23 @@ "@xterm/xterm": ["@xterm/xterm@5.5.0", "", {}, "sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A=="], - "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + "acorn": ["acorn@8.16.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw=="], "acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="], - "ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], + "ajv": ["ajv@8.18.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A=="], - "alien-signals": ["alien-signals@3.0.0", "", {}, "sha512-JHoRJf18Y6HN4/KZALr3iU+0vW9LKG+8FMThQlbn4+gv8utsLIkwpomjElGPccGeNwh0FI2HN6BLnyFLo6OyLQ=="], + "alien-signals": ["alien-signals@3.1.2", "", {}, "sha512-d9dYqZTS90WLiU0I5c6DHj/HcKkF8ZyGN3G5x8wSbslulz70KOxaqCT0hQCo9KOyhVqzqGojvNdJXoTumZOtcw=="], "ansi-colors": ["ansi-colors@4.1.3", "", {}, "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw=="], - "ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="], + "ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="], - "ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="], + "ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], "ansicolor": ["ansicolor@2.0.3", "", {}, "sha512-pzusTqk9VHrjgMCcTPDTTvfJfx6Q3+L5tQ6yKC8Diexmoit4YROTFIkxFvRTNL9y5s0Q8HrSrgerCD5bIC+Kiw=="], - "ansis": ["ansis@4.1.0", "", {}, "sha512-BGcItUBWSMRgOCe+SVZJ+S7yTRG0eGt9cXAHev72yuGcY23hnLA7Bky5L/xLyPINoSN95geovfBkqoTlNZYa7w=="], + "ansis": ["ansis@4.2.0", "", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="], "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], @@ -595,11 +601,13 @@ "balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + "baseline-browser-mapping": ["baseline-browser-mapping@2.10.0", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA=="], + "best-effort-json-parser": ["best-effort-json-parser@1.2.1", "", {}, "sha512-UICSLibQdzS1f+PBsi3u2YE3SsdXcWicHUg3IMvfuaePS2AYnZJdJeKhGv5OM8/mqJwPt79aDrEJ1oa84tELvw=="], "binary-install": ["binary-install@1.1.2", "", { "dependencies": { "axios": "^0.26.1", "rimraf": "^3.0.2", "tar": "^6.1.11" } }, "sha512-ZS2cqFHPZOy4wLxvzqfQvDjCOifn+7uCPqNmYRIBM/03+yllON+4fNnsD0VJdW0p97y+E+dTRNPStWNqMBq+9g=="], - "birpc": ["birpc@2.6.1", "", {}, "sha512-LPnFhlDpdSH6FJhJyn4M0kFO7vtQ5iPw24FnG0y21q09xC7e8+1LeR31S1MAIrDAHp4m7aas4bEkTDTvMAtebQ=="], + "birpc": ["birpc@2.9.0", "", {}, "sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw=="], "boolbase": ["boolbase@1.0.0", "", {}, "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="], @@ -611,11 +619,7 @@ "braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="], - "browserslist": ["browserslist@4.25.1", "", { "dependencies": { "caniuse-lite": "^1.0.30001726", "electron-to-chromium": "^1.5.173", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw=="], - - "buffer-builder": ["buffer-builder@0.2.0", "", {}, "sha512-7VPMEPuYznPSoR21NE1zvd2Xna6c/CloiZCfcMXR1Jny6PjX0N4Nsa38zcBFo/FMK+BlA+FLKbJCQ0i2yxp+Xg=="], - - "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="], + "browserslist": ["browserslist@4.28.1", "", { "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", "electron-to-chromium": "^1.5.263", "node-releases": "^2.0.27", "update-browserslist-db": "^1.2.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA=="], "bundle-name": ["bundle-name@4.1.0", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="], @@ -627,7 +631,7 @@ "callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="], - "caniuse-lite": ["caniuse-lite@1.0.30001727", "", {}, "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q=="], + "caniuse-lite": ["caniuse-lite@1.0.30001776", "", {}, "sha512-sg01JDPzZ9jGshqKSckOQthXnYwOEP50jeVFhaSFbZcOy05TiuuaffDOfcwtCisJ9kNQuLBFibYywv2Bgm9osw=="], "ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="], @@ -665,12 +669,10 @@ "concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="], - "confbox": ["confbox@0.2.2", "", {}, "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ=="], + "confbox": ["confbox@0.2.4", "", {}, "sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ=="], "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], - "copy-anything": ["copy-anything@3.0.5", "", { "dependencies": { "is-what": "^4.1.8" } }, "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w=="], - "crelt": ["crelt@1.0.6", "", {}, "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g=="], "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], @@ -685,7 +687,7 @@ "csso": ["csso@5.0.5", "", { "dependencies": { "css-tree": "~2.2.0" } }, "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ=="], - "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], + "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], @@ -693,13 +695,13 @@ "deepmerge": ["deepmerge@4.3.1", "", {}, "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="], - "default-browser": ["default-browser@5.2.1", "", { "dependencies": { "bundle-name": "^4.1.0", "default-browser-id": "^5.0.0" } }, "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg=="], + "default-browser": ["default-browser@5.5.0", "", { "dependencies": { "bundle-name": "^4.1.0", "default-browser-id": "^5.0.0" } }, "sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw=="], - "default-browser-id": ["default-browser-id@5.0.0", "", {}, "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA=="], + "default-browser-id": ["default-browser-id@5.0.1", "", {}, "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q=="], "define-lazy-prop": ["define-lazy-prop@3.0.0", "", {}, "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg=="], - "deno": ["deno@2.5.6", "", { "optionalDependencies": { "@deno/darwin-arm64": "2.5.6", "@deno/darwin-x64": "2.5.6", "@deno/linux-arm64-glibc": "2.5.6", "@deno/linux-x64-glibc": "2.5.6", "@deno/win32-arm64": "2.5.6", "@deno/win32-x64": "2.5.6" }, "bin": { "deno": "bin.cjs" } }, "sha512-SSe2gCf41A/uln54H7xdKZFtiDt+reBxYM4IaJLRH/NpEIE5T3VOcLSLHPaJzyiTvZe2xMz1QFcpg4cco5rNsA=="], + "deno": ["deno@2.7.1", "", { "optionalDependencies": { "@deno/darwin-arm64": "2.7.1", "@deno/darwin-x64": "2.7.1", "@deno/linux-arm64-glibc": "2.7.1", "@deno/linux-x64-glibc": "2.7.1", "@deno/win32-arm64": "2.7.1", "@deno/win32-x64": "2.7.1" }, "bin": { "deno": "bin.cjs" } }, "sha512-cqYEHu3vHIMvGLg8HSJJPHJZi3Mr94a743asH65n6gBw9I0wtPMZgXB84qhaWiWkL1G8E0kN7v67EY2wNApZ6Q=="], "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="], @@ -723,9 +725,9 @@ "ebnf": ["ebnf@1.9.1", "", { "bin": { "ebnf": "dist/bin.js" } }, "sha512-uW2UKSsuty9ANJ3YByIQE4ANkD8nqUPO7r6Fwcc1ADKPe9FRdcPpMl3VEput4JSvKBJ4J86npIC2MLP0pYkCuw=="], - "electron-to-chromium": ["electron-to-chromium@1.5.180", "", {}, "sha512-ED+GEyEh3kYMwt2faNmgMB0b8O5qtATGgR4RmRsIp4T6p7B8vdMbIedYndnvZfsaXvSzegtpfqRMDNCjjiSduA=="], + "electron-to-chromium": ["electron-to-chromium@1.5.307", "", {}, "sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg=="], - "emoji-regex": ["emoji-regex@10.4.0", "", {}, "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw=="], + "emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], "emoji-regex-xs": ["emoji-regex-xs@1.0.0", "", {}, "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg=="], @@ -741,19 +743,19 @@ "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="], - "esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="], + "esbuild": ["esbuild@0.27.3", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.3", "@esbuild/android-arm": "0.27.3", "@esbuild/android-arm64": "0.27.3", "@esbuild/android-x64": "0.27.3", "@esbuild/darwin-arm64": "0.27.3", "@esbuild/darwin-x64": "0.27.3", "@esbuild/freebsd-arm64": "0.27.3", "@esbuild/freebsd-x64": "0.27.3", "@esbuild/linux-arm": "0.27.3", "@esbuild/linux-arm64": "0.27.3", "@esbuild/linux-ia32": "0.27.3", "@esbuild/linux-loong64": "0.27.3", "@esbuild/linux-mips64el": "0.27.3", "@esbuild/linux-ppc64": "0.27.3", "@esbuild/linux-riscv64": "0.27.3", "@esbuild/linux-s390x": "0.27.3", "@esbuild/linux-x64": "0.27.3", "@esbuild/netbsd-arm64": "0.27.3", "@esbuild/netbsd-x64": "0.27.3", "@esbuild/openbsd-arm64": "0.27.3", "@esbuild/openbsd-x64": "0.27.3", "@esbuild/openharmony-arm64": "0.27.3", "@esbuild/sunos-x64": "0.27.3", "@esbuild/win32-arm64": "0.27.3", "@esbuild/win32-ia32": "0.27.3", "@esbuild/win32-x64": "0.27.3" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg=="], "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="], "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], - "eslint": ["eslint@9.39.1", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.39.1", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g=="], + "eslint": ["eslint@9.39.3", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.39.3", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg=="], - "eslint-config-prettier": ["eslint-config-prettier@10.1.5", "", { "peerDependencies": { "eslint": ">=7.0.0" }, "bin": { "eslint-config-prettier": "bin/cli.js" } }, "sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw=="], + "eslint-config-prettier": ["eslint-config-prettier@10.1.8", "", { "peerDependencies": { "eslint": ">=7.0.0" }, "bin": { "eslint-config-prettier": "bin/cli.js" } }, "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w=="], - "eslint-plugin-prettier": ["eslint-plugin-prettier@5.5.1", "", { "dependencies": { "prettier-linter-helpers": "^1.0.0", "synckit": "^0.11.7" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", "prettier": ">=3.0.0" }, "optionalPeers": ["@types/eslint", "eslint-config-prettier"] }, "sha512-dobTkHT6XaEVOo8IO90Q4DOSxnm3Y151QxPJlM/vKC0bVy+d6cVWQZLlFiuZPP0wS6vZwSKeJgKkcS+KfMBlRw=="], + "eslint-plugin-prettier": ["eslint-plugin-prettier@5.5.5", "", { "dependencies": { "prettier-linter-helpers": "^1.0.1", "synckit": "^0.11.12" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", "prettier": ">=3.0.0" }, "optionalPeers": ["@types/eslint", "eslint-config-prettier"] }, "sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw=="], - "eslint-plugin-vue": ["eslint-plugin-vue@10.6.2", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "natural-compare": "^1.4.0", "nth-check": "^2.1.1", "postcss-selector-parser": "^7.1.0", "semver": "^7.6.3", "xml-name-validator": "^4.0.0" }, "peerDependencies": { "@stylistic/eslint-plugin": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", "@typescript-eslint/parser": "^7.0.0 || ^8.0.0", "eslint": "^8.57.0 || ^9.0.0", "vue-eslint-parser": "^10.0.0" }, "optionalPeers": ["@stylistic/eslint-plugin", "@typescript-eslint/parser"] }, "sha512-nA5yUs/B1KmKzvC42fyD0+l9Yd+LtEpVhWRbXuDj0e+ZURcTtyRbMDWUeJmTAh2wC6jC83raS63anNM2YT3NPw=="], + "eslint-plugin-vue": ["eslint-plugin-vue@10.8.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "natural-compare": "^1.4.0", "nth-check": "^2.1.1", "postcss-selector-parser": "^7.1.0", "semver": "^7.6.3", "xml-name-validator": "^4.0.0" }, "peerDependencies": { "@stylistic/eslint-plugin": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", "@typescript-eslint/parser": "^7.0.0 || ^8.0.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "vue-eslint-parser": "^10.0.0" }, "optionalPeers": ["@stylistic/eslint-plugin", "@typescript-eslint/parser"] }, "sha512-f1J/tcbnrpgC8suPN5AtdJ5MQjuXbSU9pGRSSYAuF3SHoiYCOdEX6O22pLaRyLHXvDcOe+O5ENgc1owQ587agA=="], "eslint-scope": ["eslint-scope@8.4.0", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg=="], @@ -761,7 +763,7 @@ "espree": ["espree@10.4.0", "", { "dependencies": { "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^4.2.1" } }, "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ=="], - "esquery": ["esquery@1.6.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg=="], + "esquery": ["esquery@1.7.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="], "esrecurse": ["esrecurse@4.3.0", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="], @@ -771,7 +773,7 @@ "esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="], - "exsolve": ["exsolve@1.0.7", "", {}, "sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw=="], + "exsolve": ["exsolve@1.0.8", "", {}, "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA=="], "fast-copy": ["fast-copy@3.0.2", "", {}, "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ=="], @@ -787,7 +789,7 @@ "fast-uri": ["fast-uri@3.1.0", "", {}, "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA=="], - "fastq": ["fastq@1.19.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ=="], + "fastq": ["fastq@1.20.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw=="], "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], @@ -799,7 +801,7 @@ "flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="], - "flatted": ["flatted@3.3.3", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="], + "flatted": ["flatted@3.3.4", "", {}, "sha512-3+mMldrTAPdta5kjX2G2J7iX4zxtnwpdA8Tr2ZSjkyPSanvbZAcy6flmtnXbEybHrDcU9641lxrMfFuUxVz9vA=="], "follow-redirects": ["follow-redirects@1.15.11", "", {}, "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ=="], @@ -815,7 +817,7 @@ "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], - "get-east-asian-width": ["get-east-asian-width@1.3.0", "", {}, "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ=="], + "get-east-asian-width": ["get-east-asian-width@1.5.0", "", {}, "sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA=="], "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="], @@ -833,8 +835,6 @@ "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], - "graphemer": ["graphemer@1.4.0", "", {}, "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag=="], - "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], "has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="], @@ -851,11 +851,11 @@ "html-void-elements": ["html-void-elements@3.0.0", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="], - "humanize-duration": ["humanize-duration@3.33.1", "", {}, "sha512-hwzSCymnRdFx9YdRkQQ0OYequXiVAV6ZGQA2uzocwB0F4309Ke6pO8dg0P8LHhRQJyVjGteRTAA/zNfEcpXn8A=="], + "humanize-duration": ["humanize-duration@3.33.2", "", {}, "sha512-K7Ny/ULO1hDm2nnhvAY+SJV1skxFb61fd073SG1IWJl+D44ULrruCuTyjHKjBVVcSuTlnY99DKtgEG39CM5QOQ=="], "ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], - "immutable": ["immutable@5.1.3", "", {}, "sha512-+chQdDfvscSF1SJqv2gn4SRO2ZyS3xL3r7IW/wWEEzrzLisnOlKiQu5ytC/BVNcS15C39WT2Hg/bjKjDMcu+zg=="], + "immutable": ["immutable@5.1.5", "", {}, "sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A=="], "import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="], @@ -879,11 +879,9 @@ "is-regex": ["is-regex@1.2.1", "", { "dependencies": { "call-bound": "^1.0.2", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g=="], - "is-what": ["is-what@4.1.16", "", {}, "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A=="], + "is-wsl": ["is-wsl@3.1.1", "", { "dependencies": { "is-inside-container": "^1.0.0" } }, "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw=="], - "is-wsl": ["is-wsl@3.1.0", "", { "dependencies": { "is-inside-container": "^1.0.0" } }, "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw=="], - - "isexe": ["isexe@3.1.1", "", {}, "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ=="], + "isexe": ["isexe@3.1.5", "", {}, "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w=="], "jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="], @@ -929,15 +927,15 @@ "lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], - "magic-string": ["magic-string@0.30.19", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw=="], + "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], - "markdown-it": ["markdown-it@14.1.0", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg=="], + "markdown-it": ["markdown-it@14.1.1", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA=="], "marked": ["marked@14.0.0", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ=="], "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="], - "mdast-util-to-hast": ["mdast-util-to-hast@13.2.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA=="], + "mdast-util-to-hast": ["mdast-util-to-hast@13.2.1", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA=="], "mdn-data": ["mdn-data@2.12.2", "", {}, "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA=="], @@ -963,7 +961,7 @@ "mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], - "minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + "minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], "minipass": ["minipass@5.0.0", "", {}, "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ=="], @@ -979,17 +977,17 @@ "monaco-languageserver-types": ["monaco-languageserver-types@0.4.0", "", { "dependencies": { "monaco-types": "^0.1.0", "vscode-languageserver-protocol": "^3.0.0", "vscode-uri": "^3.0.0" } }, "sha512-QQ3BZiU5LYkJElGncSNb5AKoJ/LCs6YBMCJMAz9EA7v+JaOdn3kx2cXpPTcZfKA5AEsR0vc97sAw+5mdNhVBmw=="], - "monaco-marker-data-provider": ["monaco-marker-data-provider@1.2.4", "", { "dependencies": { "monaco-types": "^0.1.0" } }, "sha512-4DsPgsAqpTyUDs3humXRBPUJoihTv+L6v9aupQWD80X2YXaCXUd11mWYeSCYHuPgdUmjFaNWCEOjQ6ewf/QA1Q=="], + "monaco-marker-data-provider": ["monaco-marker-data-provider@1.2.5", "", { "dependencies": { "monaco-types": "^0.1.0" } }, "sha512-5ZdcYukhPwgYMCvlZ9H5uWs5jc23BQ8fFF5AhSIdrz5mvYLsqGZ58ZLxTv8rCX6+AxdJ8+vxg1HVSk+F2bLosg=="], - "monaco-types": ["monaco-types@0.1.0", "", {}, "sha512-aWK7SN9hAqNYi0WosPoMjenMeXJjwCxDibOqWffyQ/qXdzB/86xshGQobRferfmNz7BSNQ8GB0MD0oby9/5fTQ=="], + "monaco-types": ["monaco-types@0.1.2", "", {}, "sha512-8LwfrlWXsedHwAL41xhXyqzPibS8IqPuIXr9NdORhonS495c2/wky+sI1PRLvMCuiI0nqC2NH1six9hdiRY4Xg=="], "monaco-vim": ["monaco-vim@0.4.4", "", { "peerDependencies": { "monaco-editor": "*" } }, "sha512-LNChAb//WEm/W+eyeHG/0+pdVEHotk2hLTN+M3sQZx5E8cAlSWSgqcxpcRuQnxDybSln7pfHF9i63HmbIQvrWw=="], "monaco-worker-manager": ["monaco-worker-manager@2.0.1", "", { "peerDependencies": { "monaco-editor": ">=0.30.0" } }, "sha512-kdPL0yvg5qjhKPNVjJoym331PY/5JC11aPJXtCZNwWRvBr6jhkIamvYAyiY5P1AWFmNOy0aRDRoMdZfa71h8kg=="], - "monaco-yaml": ["monaco-yaml@5.4.0", "", { "dependencies": { "jsonc-parser": "^3.0.0", "monaco-languageserver-types": "^0.4.0", "monaco-marker-data-provider": "^1.0.0", "monaco-types": "^0.1.0", "monaco-worker-manager": "^2.0.0", "path-browserify": "^1.0.0", "prettier": "^3.0.0", "vscode-languageserver-textdocument": "^1.0.0", "vscode-languageserver-types": "^3.0.0", "vscode-uri": "^3.0.0", "yaml": "^2.0.0" }, "peerDependencies": { "monaco-editor": ">=0.36" } }, "sha512-tuBVDy1KAPrgO905GHTItu8AaA5bIzF5S4X0JVRAE/D66FpRhkDUk7tKi5bwKMVTTugtpMLsXN4ewh4CgE/FtQ=="], + "monaco-yaml": ["monaco-yaml@5.4.1", "", { "dependencies": { "jsonc-parser": "^3.0.0", "monaco-languageserver-types": "^0.4.0", "monaco-marker-data-provider": "^1.0.0", "monaco-types": "^0.1.0", "monaco-worker-manager": "^2.0.0", "path-browserify": "^1.0.0", "prettier": "^3.0.0", "vscode-languageserver-textdocument": "^1.0.0", "vscode-languageserver-types": "^3.0.0", "vscode-uri": "^3.0.0", "yaml": "^2.0.0" }, "peerDependencies": { "monaco-editor": ">=0.36" } }, "sha512-YQ6d/Ei98Uk073SJLFbwuSi95qhnl8F8NNmIUqN2XhDt9psZN2LqQ1T7pPQ866NJb2wFj44IrjnANgpa2jTfag=="], - "moo": ["moo@0.5.2", "", {}, "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q=="], + "moo": ["moo@0.5.3", "", {}, "sha512-m2fmM2dDm7GZQsY7KK2cme8agi+AAljILjQnof7p1ZMDe6dQ4bdnSMx0cPppudoeNv5hEFQirN6u+O4fDE0IWA=="], "mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="], @@ -1005,7 +1003,7 @@ "node-addon-api": ["node-addon-api@7.1.1", "", {}, "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ=="], - "node-releases": ["node-releases@2.0.19", "", {}, "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw=="], + "node-releases": ["node-releases@2.0.36", "", {}, "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA=="], "npm-normalize-package-bin": ["npm-normalize-package-bin@4.0.0", "", {}, "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w=="], @@ -1041,25 +1039,25 @@ "pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="], - "perfect-debounce": ["perfect-debounce@2.0.0", "", {}, "sha512-fkEH/OBiKrqqI/yIgjR92lMfs2K8105zt/VT6+7eTjNwisrsh47CeIED9z58zI7DfKdH3uHAn25ziRZn3kgAow=="], + "perfect-debounce": ["perfect-debounce@2.1.0", "", {}, "sha512-LjgdTytVFXeUgtHZr9WYViYSM/g8MkcTPYDlPa3cDqMirHjKiSZPYd6DoL7pK8AJQr+uWkQvCjHNdiMqsrJs+g=="], "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], - "picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], + "picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], "pidtree": ["pidtree@0.6.0", "", { "bin": { "pidtree": "bin/pidtree.js" } }, "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g=="], "pkg-types": ["pkg-types@2.3.0", "", { "dependencies": { "confbox": "^0.2.2", "exsolve": "^1.0.7", "pathe": "^2.0.3" } }, "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig=="], - "postcss": ["postcss@8.5.6", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg=="], + "postcss": ["postcss@8.5.8", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg=="], "postcss-selector-parser": ["postcss-selector-parser@7.1.1", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg=="], "prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="], - "prettier": ["prettier@3.7.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-QgODejq9K3OzoBbuyobZlUhznP5SKwPqp+6Q6xw6o8gnhr4O85L2U915iM2IDcfF2NPXVaM9zlo9tdwipnYwzg=="], + "prettier": ["prettier@3.8.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="], - "prettier-linter-helpers": ["prettier-linter-helpers@1.0.0", "", { "dependencies": { "fast-diff": "^1.1.2" } }, "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w=="], + "prettier-linter-helpers": ["prettier-linter-helpers@1.0.1", "", { "dependencies": { "fast-diff": "^1.1.2" } }, "sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg=="], "prettier-plugin-vue": ["prettier-plugin-vue@1.1.6", "", { "dependencies": { "prettier": "^2.8.1" } }, "sha512-trQ/oY+6hSsGe2zPIFThXMIM0TbxMEbk2VOrKjwHWuSz7OEo0rnumbz9a47OxVPCaAnGY9vZG8qDTiTmk9bq0A=="], @@ -1073,7 +1071,7 @@ "punycode.js": ["punycode.js@2.3.1", "", {}, "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA=="], - "qrcode.vue": ["qrcode.vue@3.6.0", "", { "peerDependencies": { "vue": "^3.0.0" } }, "sha512-vQcl2fyHYHMjDO1GguCldJxepq2izQjBkDEEu9NENgfVKP6mv/e2SU62WbqYHGwTgWXLhxZ1NCD1dAZKHQq1fg=="], + "qrcode.vue": ["qrcode.vue@3.8.0", "", { "peerDependencies": { "vue": "^3.0.0" } }, "sha512-+XKbSKvQu158zlHsJm+HObGUQM3Q+9Oq6yb2op/6lMM2gwOiiG9uIhujvrSV5UoTjrzR0BcNxCdW2kk7KE4NEg=="], "quansync": ["quansync@0.2.11", "", {}, "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA=="], @@ -1103,61 +1101,59 @@ "reusify": ["reusify@1.1.0", "", {}, "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw=="], - "rfdc": ["rfdc@1.4.1", "", {}, "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="], - "rimraf": ["rimraf@3.0.2", "", { "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" } }, "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA=="], - "rollup": ["rollup@4.44.2", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.44.2", "@rollup/rollup-android-arm64": "4.44.2", "@rollup/rollup-darwin-arm64": "4.44.2", "@rollup/rollup-darwin-x64": "4.44.2", "@rollup/rollup-freebsd-arm64": "4.44.2", "@rollup/rollup-freebsd-x64": "4.44.2", "@rollup/rollup-linux-arm-gnueabihf": "4.44.2", "@rollup/rollup-linux-arm-musleabihf": "4.44.2", "@rollup/rollup-linux-arm64-gnu": "4.44.2", "@rollup/rollup-linux-arm64-musl": "4.44.2", "@rollup/rollup-linux-loongarch64-gnu": "4.44.2", "@rollup/rollup-linux-powerpc64le-gnu": "4.44.2", "@rollup/rollup-linux-riscv64-gnu": "4.44.2", "@rollup/rollup-linux-riscv64-musl": "4.44.2", "@rollup/rollup-linux-s390x-gnu": "4.44.2", "@rollup/rollup-linux-x64-gnu": "4.44.2", "@rollup/rollup-linux-x64-musl": "4.44.2", "@rollup/rollup-win32-arm64-msvc": "4.44.2", "@rollup/rollup-win32-ia32-msvc": "4.44.2", "@rollup/rollup-win32-x64-msvc": "4.44.2", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-PVoapzTwSEcelaWGth3uR66u7ZRo6qhPHc0f2uRO9fX6XDVNrIiGYS0Pj9+R8yIIYSD/mCx2b16Ws9itljKSPg=="], + "rollup": ["rollup@4.59.0", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.59.0", "@rollup/rollup-android-arm64": "4.59.0", "@rollup/rollup-darwin-arm64": "4.59.0", "@rollup/rollup-darwin-x64": "4.59.0", "@rollup/rollup-freebsd-arm64": "4.59.0", "@rollup/rollup-freebsd-x64": "4.59.0", "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", "@rollup/rollup-linux-arm-musleabihf": "4.59.0", "@rollup/rollup-linux-arm64-gnu": "4.59.0", "@rollup/rollup-linux-arm64-musl": "4.59.0", "@rollup/rollup-linux-loong64-gnu": "4.59.0", "@rollup/rollup-linux-loong64-musl": "4.59.0", "@rollup/rollup-linux-ppc64-gnu": "4.59.0", "@rollup/rollup-linux-ppc64-musl": "4.59.0", "@rollup/rollup-linux-riscv64-gnu": "4.59.0", "@rollup/rollup-linux-riscv64-musl": "4.59.0", "@rollup/rollup-linux-s390x-gnu": "4.59.0", "@rollup/rollup-linux-x64-gnu": "4.59.0", "@rollup/rollup-linux-x64-musl": "4.59.0", "@rollup/rollup-openbsd-x64": "4.59.0", "@rollup/rollup-openharmony-arm64": "4.59.0", "@rollup/rollup-win32-arm64-msvc": "4.59.0", "@rollup/rollup-win32-ia32-msvc": "4.59.0", "@rollup/rollup-win32-x64-gnu": "4.59.0", "@rollup/rollup-win32-x64-msvc": "4.59.0", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg=="], - "run-applescript": ["run-applescript@7.0.0", "", {}, "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A=="], + "run-applescript": ["run-applescript@7.1.0", "", {}, "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q=="], "run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="], "rxjs": ["rxjs@7.8.2", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA=="], - "sass": ["sass@1.93.3", "", { "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", "source-map-js": ">=0.6.2 <2.0.0" }, "optionalDependencies": { "@parcel/watcher": "^2.4.1" }, "bin": { "sass": "sass.js" } }, "sha512-elOcIZRTM76dvxNAjqYrucTSI0teAF/L2Lv0s6f6b7FOwcwIuA357bIE871580AjHJuSvLIRUosgV+lIWx6Rgg=="], + "sass": ["sass@1.97.3", "", { "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", "source-map-js": ">=0.6.2 <2.0.0" }, "optionalDependencies": { "@parcel/watcher": "^2.4.1" }, "bin": { "sass": "sass.js" } }, "sha512-fDz1zJpd5GycprAbu4Q2PV/RprsRtKC/0z82z0JLgdytmcq0+ujJbJ/09bPGDxCLkKY3Np5cRAOcWiVkLXJURg=="], - "sass-embedded": ["sass-embedded@1.93.3", "", { "dependencies": { "@bufbuild/protobuf": "^2.5.0", "buffer-builder": "^0.2.0", "colorjs.io": "^0.5.0", "immutable": "^5.0.2", "rxjs": "^7.4.0", "supports-color": "^8.1.1", "sync-child-process": "^1.0.2", "varint": "^6.0.0" }, "optionalDependencies": { "sass-embedded-all-unknown": "1.93.3", "sass-embedded-android-arm": "1.93.3", "sass-embedded-android-arm64": "1.93.3", "sass-embedded-android-riscv64": "1.93.3", "sass-embedded-android-x64": "1.93.3", "sass-embedded-darwin-arm64": "1.93.3", "sass-embedded-darwin-x64": "1.93.3", "sass-embedded-linux-arm": "1.93.3", "sass-embedded-linux-arm64": "1.93.3", "sass-embedded-linux-musl-arm": "1.93.3", "sass-embedded-linux-musl-arm64": "1.93.3", "sass-embedded-linux-musl-riscv64": "1.93.3", "sass-embedded-linux-musl-x64": "1.93.3", "sass-embedded-linux-riscv64": "1.93.3", "sass-embedded-linux-x64": "1.93.3", "sass-embedded-unknown-all": "1.93.3", "sass-embedded-win32-arm64": "1.93.3", "sass-embedded-win32-x64": "1.93.3" }, "bin": { "sass": "dist/bin/sass.js" } }, "sha512-+VUy01yfDqNmIVMd/LLKl2TTtY0ovZN0rTonh+FhKr65mFwIYgU9WzgIZKS7U9/SPCQvWTsTGx9jyt+qRm/XFw=="], + "sass-embedded": ["sass-embedded@1.97.3", "", { "dependencies": { "@bufbuild/protobuf": "^2.5.0", "colorjs.io": "^0.5.0", "immutable": "^5.0.2", "rxjs": "^7.4.0", "supports-color": "^8.1.1", "sync-child-process": "^1.0.2", "varint": "^6.0.0" }, "optionalDependencies": { "sass-embedded-all-unknown": "1.97.3", "sass-embedded-android-arm": "1.97.3", "sass-embedded-android-arm64": "1.97.3", "sass-embedded-android-riscv64": "1.97.3", "sass-embedded-android-x64": "1.97.3", "sass-embedded-darwin-arm64": "1.97.3", "sass-embedded-darwin-x64": "1.97.3", "sass-embedded-linux-arm": "1.97.3", "sass-embedded-linux-arm64": "1.97.3", "sass-embedded-linux-musl-arm": "1.97.3", "sass-embedded-linux-musl-arm64": "1.97.3", "sass-embedded-linux-musl-riscv64": "1.97.3", "sass-embedded-linux-musl-x64": "1.97.3", "sass-embedded-linux-riscv64": "1.97.3", "sass-embedded-linux-x64": "1.97.3", "sass-embedded-unknown-all": "1.97.3", "sass-embedded-win32-arm64": "1.97.3", "sass-embedded-win32-x64": "1.97.3" }, "bin": { "sass": "dist/bin/sass.js" } }, "sha512-eKzFy13Nk+IRHhlAwP3sfuv+PzOrvzUkwJK2hdoCKYcWGSdmwFpeGpWmyewdw8EgBnsKaSBtgf/0b2K635ecSA=="], - "sass-embedded-all-unknown": ["sass-embedded-all-unknown@1.93.3", "", { "dependencies": { "sass": "1.93.3" }, "cpu": [ "!arm", "!x64", "!arm64", ] }, "sha512-3okGgnE41eg+CPLtAPletu6nQ4N0ij7AeW+Sl5Km4j29XcmqZQeFwYjHe1AlKTEgLi/UAONk1O8i8/lupeKMbw=="], + "sass-embedded-all-unknown": ["sass-embedded-all-unknown@1.97.3", "", { "dependencies": { "sass": "1.97.3" }, "cpu": [ "!arm", "!x64", "!arm64", ] }, "sha512-t6N46NlPuXiY3rlmG6/+1nwebOBOaLFOOVqNQOC2cJhghOD4hh2kHNQQTorCsbY9S1Kir2la1/XLBwOJfui0xg=="], - "sass-embedded-android-arm": ["sass-embedded-android-arm@1.93.3", "", { "os": "android", "cpu": "arm" }, "sha512-8xOw9bywfOD6Wv24BgCmgjkk6tMrsOTTHcb28KDxeJtFtoxiUyMbxo0vChpPAfp2Hyg2tFFKS60s0s4JYk+Raw=="], + "sass-embedded-android-arm": ["sass-embedded-android-arm@1.97.3", "", { "os": "android", "cpu": "arm" }, "sha512-cRTtf/KV/q0nzGZoUzVkeIVVFv3L/tS1w4WnlHapphsjTXF/duTxI8JOU1c/9GhRPiMdfeXH7vYNcMmtjwX7jg=="], - "sass-embedded-android-arm64": ["sass-embedded-android-arm64@1.93.3", "", { "os": "android", "cpu": "arm64" }, "sha512-uqUl3Kt1IqdGVAcAdbmC+NwuUJy8tM+2ZnB7/zrt6WxWVShVCRdFnWR9LT8HJr7eJN7AU8kSXxaVX/gedanPsg=="], + "sass-embedded-android-arm64": ["sass-embedded-android-arm64@1.97.3", "", { "os": "android", "cpu": "arm64" }, "sha512-aiZ6iqiHsUsaDx0EFbbmmA0QgxicSxVVN3lnJJ0f1RStY0DthUkquGT5RJ4TPdaZ6ebeJWkboV4bra+CP766eA=="], - "sass-embedded-android-riscv64": ["sass-embedded-android-riscv64@1.93.3", "", { "os": "android", "cpu": "none" }, "sha512-2jNJDmo+3qLocjWqYbXiBDnfgwrUeZgZFHJIwAefU7Fn66Ot7rsXl+XPwlokaCbTpj7eMFIqsRAZ/uDueXNCJg=="], + "sass-embedded-android-riscv64": ["sass-embedded-android-riscv64@1.97.3", "", { "os": "android", "cpu": "none" }, "sha512-zVEDgl9JJodofGHobaM/q6pNETG69uuBIGQHRo789jloESxxZe82lI3AWJQuPmYCOG5ElfRthqgv89h3gTeLYA=="], - "sass-embedded-android-x64": ["sass-embedded-android-x64@1.93.3", "", { "os": "android", "cpu": "x64" }, "sha512-y0RoAU6ZenQFcjM9PjQd3cRqRTjqwSbtWLL/p68y2oFyh0QGN0+LQ826fc0ZvU/AbqCsAizkqjzOn6cRZJxTTQ=="], + "sass-embedded-android-x64": ["sass-embedded-android-x64@1.97.3", "", { "os": "android", "cpu": "x64" }, "sha512-3ke0le7ZKepyXn/dKKspYkpBC0zUk/BMciyP5ajQUDy4qJwobd8zXdAq6kOkdiMB+d9UFJOmEkvgFJHl3lqwcw=="], - "sass-embedded-darwin-arm64": ["sass-embedded-darwin-arm64@1.93.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-7zb/hpdMOdKteK17BOyyypemglVURd1Hdz6QGsggy60aUFfptTLQftLRg8r/xh1RbQAUKWFbYTNaM47J9yPxYg=="], + "sass-embedded-darwin-arm64": ["sass-embedded-darwin-arm64@1.97.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-fuqMTqO4gbOmA/kC5b9y9xxNYw6zDEyfOtMgabS7Mz93wimSk2M1quQaTJnL98Mkcsl2j+7shNHxIS/qpcIDDA=="], - "sass-embedded-darwin-x64": ["sass-embedded-darwin-x64@1.93.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-Ek1Vp8ZDQEe327Lz0b7h3hjvWH3u9XjJiQzveq74RPpJQ2q6d9LfWpjiRRohM4qK6o4XOHw1X10OMWPXJtdtWg=="], + "sass-embedded-darwin-x64": ["sass-embedded-darwin-x64@1.97.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-b/2RBs/2bZpP8lMkyZ0Px0vkVkT8uBd0YXpOwK7iOwYkAT8SsO4+WdVwErsqC65vI5e1e5p1bb20tuwsoQBMVA=="], - "sass-embedded-linux-arm": ["sass-embedded-linux-arm@1.93.3", "", { "os": "linux", "cpu": "arm" }, "sha512-yeiv2y+dp8B4wNpd3+JsHYD0mvpXSfov7IGyQ1tMIR40qv+ROkRqYiqQvAOXf76Qwh4Y9OaYZtLpnsPjfeq6mA=="], + "sass-embedded-linux-arm": ["sass-embedded-linux-arm@1.97.3", "", { "os": "linux", "cpu": "arm" }, "sha512-2lPQ7HQQg4CKsH18FTsj2hbw5GJa6sBQgDsls+cV7buXlHjqF8iTKhAQViT6nrpLK/e8nFCoaRgSqEC8xMnXuA=="], - "sass-embedded-linux-arm64": ["sass-embedded-linux-arm64@1.93.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-RBrHWgfd8Dd8w4fbmdRVXRrhh8oBAPyeWDTKAWw8ZEmuXfVl4ytjDuyxaVilh6rR1xTRTNpbaA/YWApBlLrrNw=="], + "sass-embedded-linux-arm64": ["sass-embedded-linux-arm64@1.97.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-IP1+2otCT3DuV46ooxPaOKV1oL5rLjteRzf8ldZtfIEcwhSgSsHgA71CbjYgLEwMY9h4jeal8Jfv3QnedPvSjg=="], - "sass-embedded-linux-musl-arm": ["sass-embedded-linux-musl-arm@1.93.3", "", { "os": "linux", "cpu": "arm" }, "sha512-fU0fwAwbp7sBE3h5DVU5UPzvaLg7a4yONfFWkkcCp6ZrOiPuGRHXXYriWQ0TUnWy4wE+svsVuWhwWgvlb/tkKg=="], + "sass-embedded-linux-musl-arm": ["sass-embedded-linux-musl-arm@1.97.3", "", { "os": "linux", "cpu": "arm" }, "sha512-cBTMU68X2opBpoYsSZnI321gnoaiMBEtc+60CKCclN6PCL3W3uXm8g4TLoil1hDD6mqU9YYNlVG6sJ+ZNef6Lg=="], - "sass-embedded-linux-musl-arm64": ["sass-embedded-linux-musl-arm64@1.93.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-PS829l+eUng+9W4PFclXGb4uA2+965NHV3/Sa5U7qTywjeeUUYTZg70dJHSqvhrBEfCc2XJABeW3adLJbyQYkw=="], + "sass-embedded-linux-musl-arm64": ["sass-embedded-linux-musl-arm64@1.97.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-Lij0SdZCsr+mNRSyDZ7XtJpXEITrYsaGbOTz5e6uFLJ9bmzUbV7M8BXz2/cA7bhfpRPT7/lwRKPdV4+aR9Ozcw=="], - "sass-embedded-linux-musl-riscv64": ["sass-embedded-linux-musl-riscv64@1.93.3", "", { "os": "linux", "cpu": "none" }, "sha512-cK1oBY+FWQquaIGEeQ5H74KTO8cWsSWwXb/WaildOO9U6wmUypTgUYKQ0o5o/29nZbWWlM1PHuwVYTSnT23Jjg=="], + "sass-embedded-linux-musl-riscv64": ["sass-embedded-linux-musl-riscv64@1.97.3", "", { "os": "linux", "cpu": "none" }, "sha512-sBeLFIzMGshR4WmHAD4oIM7WJVkSoCIEwutzptFtGlSlwfNiijULp+J5hA2KteGvI6Gji35apR5aWj66wEn/iA=="], - "sass-embedded-linux-musl-x64": ["sass-embedded-linux-musl-x64@1.93.3", "", { "os": "linux", "cpu": "x64" }, "sha512-A7wkrsHu2/I4Zpa0NMuPGkWDVV7QGGytxGyUq3opSXgAexHo/vBPlGoDXoRlSdex0cV+aTMRPjoGIfdmNlHwyg=="], + "sass-embedded-linux-musl-x64": ["sass-embedded-linux-musl-x64@1.97.3", "", { "os": "linux", "cpu": "x64" }, "sha512-/oWJ+OVrDg7ADDQxRLC/4g1+Nsz1g4mkYS2t6XmyMJKFTFK50FVI2t5sOdFH+zmMp+nXHKM036W94y9m4jjEcw=="], - "sass-embedded-linux-riscv64": ["sass-embedded-linux-riscv64@1.93.3", "", { "os": "linux", "cpu": "none" }, "sha512-vWkW1+HTF5qcaHa6hO80gx/QfB6GGjJUP0xLbnAoY4pwEnw5ulGv6RM8qYr8IDhWfVt/KH+lhJ2ZFxnJareisQ=="], + "sass-embedded-linux-riscv64": ["sass-embedded-linux-riscv64@1.97.3", "", { "os": "linux", "cpu": "none" }, "sha512-l3IfySApLVYdNx0Kjm7Zehte1CDPZVcldma3dZt+TfzvlAEerM6YDgsk5XEj3L8eHBCgHgF4A0MJspHEo2WNfA=="], - "sass-embedded-linux-x64": ["sass-embedded-linux-x64@1.93.3", "", { "os": "linux", "cpu": "x64" }, "sha512-k6uFxs+e5jSuk1Y0niCwuq42F9ZC5UEP7P+RIOurIm8w/5QFa0+YqeW+BPWEW5M1FqVOsNZH3qGn4ahqvAEjPA=="], + "sass-embedded-linux-x64": ["sass-embedded-linux-x64@1.97.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Kwqwc/jSSlcpRjULAOVbndqEy2GBzo6OBmmuBVINWUaJLJ8Kczz3vIsDUWLfWz/kTEw9FHBSiL0WCtYLVAXSLg=="], - "sass-embedded-unknown-all": ["sass-embedded-unknown-all@1.93.3", "", { "dependencies": { "sass": "1.93.3" }, "os": [ "!linux", "!win32", "!darwin", "!android", ] }, "sha512-o5wj2rLpXH0C+GJKt/VpWp6AnMsCCbfFmnMAttcrsa+U3yrs/guhZ3x55KAqqUsE8F47e3frbsDL+1OuQM5DAA=="], + "sass-embedded-unknown-all": ["sass-embedded-unknown-all@1.97.3", "", { "dependencies": { "sass": "1.97.3" }, "os": [ "!linux", "!win32", "!darwin", "!android", ] }, "sha512-/GHajyYJmvb0IABUQHbVHf1nuHPtIDo/ClMZ81IDr59wT5CNcMe7/dMNujXwWugtQVGI5UGmqXWZQCeoGnct8Q=="], - "sass-embedded-win32-arm64": ["sass-embedded-win32-arm64@1.93.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-0dOfT9moy9YmBolodwYYXtLwNr4jL4HQC9rBfv6mVrD7ud8ue2kDbn+GVzj1hEJxvEexVSmDCf7MHUTLcGs9xQ=="], + "sass-embedded-win32-arm64": ["sass-embedded-win32-arm64@1.97.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-RDGtRS1GVvQfMGAmVXNxYiUOvPzn9oO1zYB/XUM9fudDRnieYTcUytpNTQZLs6Y1KfJxgt5Y+giRceC92fT8Uw=="], - "sass-embedded-win32-x64": ["sass-embedded-win32-x64@1.93.3", "", { "os": "win32", "cpu": "x64" }, "sha512-wHFVfxiS9hU/sNk7KReD+lJWRp3R0SLQEX4zfOnRP2zlvI2X4IQR5aZr9GNcuMP6TmNpX0nQPZTegS8+h9RrEg=="], + "sass-embedded-win32-x64": ["sass-embedded-win32-x64@1.97.3", "", { "os": "win32", "cpu": "x64" }, "sha512-SFRa2lED9UEwV6vIGeBXeBOLKF+rowF3WmNfb/BzhxmdAsKofCXrJ8ePW7OcDVrvNEbTOGwhsReIsF5sH8fVaw=="], - "sax": ["sax@1.4.1", "", {}, "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="], + "sax": ["sax@1.5.0", "", {}, "sha512-21IYA3Q5cQf089Z6tgaUTr7lDAyzoTPx5HRtbhsME8Udispad8dC/+sziTNugOEx54ilvatQ9YCzl4KQLPcRHA=="], - "semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="], + "semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], "sharp": ["sharp@0.34.5", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="], @@ -1173,27 +1169,19 @@ "smtp-address-parser": ["smtp-address-parser@1.0.10", "", { "dependencies": { "nearley": "^2.20.1" } }, "sha512-Osg9LmvGeAG/hyao4mldbflLOkkr3a+h4m1lwKCK5U8M6ZAr7tdXEz/+/vr752TSGE4MNUlUl9cIK2cB8cgzXg=="], - "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], - "source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="], - "source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="], - "space-separated-tokens": ["space-separated-tokens@2.0.2", "", {}, "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q=="], - "speakingurl": ["speakingurl@14.0.1", "", {}, "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ=="], - "string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], "stringify-entities": ["stringify-entities@4.0.4", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="], - "strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="], + "strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], - "style-mod": ["style-mod@4.1.2", "", {}, "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw=="], - - "superjson": ["superjson@2.2.2", "", { "dependencies": { "copy-anything": "^3.0.2" } }, "sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q=="], + "style-mod": ["style-mod@4.1.3", "", {}, "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ=="], "supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="], @@ -1201,14 +1189,12 @@ "sync-child-process": ["sync-child-process@1.0.2", "", { "dependencies": { "sync-message-port": "^1.0.0" } }, "sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA=="], - "sync-message-port": ["sync-message-port@1.1.3", "", {}, "sha512-GTt8rSKje5FilG+wEdfCkOcLL7LWqpMlr2c3LRuKt/YXxcJ52aGSbGBAdI4L3aaqfrBt6y711El53ItyH1NWzg=="], + "sync-message-port": ["sync-message-port@1.2.0", "", {}, "sha512-gAQ9qrUN/UCypHtGFbbe7Rc/f9bzO88IwrG8TDo/aMKAApKyD6E3W4Cm0EfhfBb6Z6SKt59tTCTfD+n1xmAvMg=="], - "synckit": ["synckit@0.11.8", "", { "dependencies": { "@pkgr/core": "^0.2.4" } }, "sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A=="], + "synckit": ["synckit@0.11.12", "", { "dependencies": { "@pkgr/core": "^0.2.9" } }, "sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ=="], "tar": ["tar@6.2.1", "", { "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" } }, "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A=="], - "terser": ["terser@5.44.0", "", { "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, "bin": { "terser": "bin/terser" } }, "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w=="], - "tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="], "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="], @@ -1217,7 +1203,7 @@ "trim-lines": ["trim-lines@3.0.1", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="], - "ts-api-utils": ["ts-api-utils@2.1.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ=="], + "ts-api-utils": ["ts-api-utils@2.4.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA=="], "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], @@ -1225,11 +1211,11 @@ "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], - "typescript-eslint": ["typescript-eslint@8.36.0", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.36.0", "@typescript-eslint/parser": "8.36.0", "@typescript-eslint/utils": "8.36.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-fTCqxthY+h9QbEgSIBfL9iV6CvKDFuoxg6bHPNpJ9HIUzS+jy2lCEyCmGyZRWEBSaykqcDPf1SJ+BfCI8DRopA=="], + "typescript-eslint": ["typescript-eslint@8.56.1", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.56.1", "@typescript-eslint/parser": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/utils": "8.56.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ=="], "uc.micro": ["uc.micro@2.1.0", "", {}, "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A=="], - "ufo": ["ufo@1.6.1", "", {}, "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA=="], + "ufo": ["ufo@1.6.3", "", {}, "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q=="], "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], @@ -1239,17 +1225,17 @@ "unist-util-stringify-position": ["unist-util-stringify-position@4.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ=="], - "unist-util-visit": ["unist-util-visit@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg=="], + "unist-util-visit": ["unist-util-visit@5.1.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg=="], "unist-util-visit-parents": ["unist-util-visit-parents@6.0.2", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ=="], - "unplugin": ["unplugin@2.3.10", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-6NCPkv1ClwH+/BGE9QeoTIl09nuiAt0gS28nn1PvYXsGKRwM2TCbFA2QiilmehPDTXIe684k4rZI1yl3A1PCUw=="], + "unplugin": ["unplugin@2.3.11", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww=="], "unplugin-utils": ["unplugin-utils@0.3.1", "", { "dependencies": { "pathe": "^2.0.3", "picomatch": "^4.0.3" } }, "sha512-5lWVjgi6vuHhJ526bI4nlCOmkCIF3nnfXkCMDeMJrtdvxTs6ZFCM8oNufGTsDbKv/tJ/xj8RpvXjRuPBZJuJog=="], "unplugin-vue-components": ["unplugin-vue-components@30.0.0", "", { "dependencies": { "chokidar": "^4.0.3", "debug": "^4.4.3", "local-pkg": "^1.1.2", "magic-string": "^0.30.19", "mlly": "^1.8.0", "tinyglobby": "^0.2.15", "unplugin": "^2.3.10", "unplugin-utils": "^0.3.1" }, "peerDependencies": { "@babel/parser": "^7.15.8", "@nuxt/kit": "^3.2.2 || ^4.0.0", "vue": "2 || 3" }, "optionalPeers": ["@babel/parser", "@nuxt/kit"] }, "sha512-4qVE/lwCgmdPTp6h0qsRN2u642tt4boBQtcpn4wQcWZAsr8TQwq+SPT3NDu/6kBFxzo/sSEK4ioXhOOBrXc3iw=="], - "update-browserslist-db": ["update-browserslist-db@1.1.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw=="], + "update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="], "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], @@ -1263,7 +1249,7 @@ "vfile-message": ["vfile-message@4.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw=="], - "vite": ["vite@7.2.6", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ=="], + "vite": ["vite@7.3.1", "", { "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA=="], "vite-dev-rpc": ["vite-dev-rpc@1.1.0", "", { "dependencies": { "birpc": "^2.4.0", "vite-hot-client": "^2.1.0" }, "peerDependencies": { "vite": "^2.9.0 || ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.1 || ^7.0.0-0" } }, "sha512-pKXZlgoXGoE8sEKiKJSng4hI1sQ4wi5YT24FCrwrLt6opmkjlqPPVmiPWWJn8M8byMxRGzp1CrFuqQs4M/Z39A=="], @@ -1277,7 +1263,7 @@ "vite-plugin-inspect": ["vite-plugin-inspect@11.3.3", "", { "dependencies": { "ansis": "^4.1.0", "debug": "^4.4.1", "error-stack-parser-es": "^1.0.5", "ohash": "^2.0.11", "open": "^10.2.0", "perfect-debounce": "^2.0.0", "sirv": "^3.0.1", "unplugin-utils": "^0.3.0", "vite-dev-rpc": "^1.1.0" }, "peerDependencies": { "vite": "^6.0.0 || ^7.0.0-0" } }, "sha512-u2eV5La99oHoYPHE6UvbwgEqKKOQGz86wMg40CCosP6q8BkB6e5xPneZfYagK4ojPJSj5anHCrnvC20DpwVdRA=="], - "vite-plugin-vue-devtools": ["vite-plugin-vue-devtools@8.0.5", "", { "dependencies": { "@vue/devtools-core": "^8.0.5", "@vue/devtools-kit": "^8.0.5", "@vue/devtools-shared": "^8.0.5", "sirv": "^3.0.2", "vite-plugin-inspect": "^11.3.3", "vite-plugin-vue-inspector": "^5.3.2" }, "peerDependencies": { "vite": "^6.0.0 || ^7.0.0-0" } }, "sha512-p619BlKFOqQXJ6uDWS1vUPQzuJOD6xJTfftj57JXBGoBD/yeQCowR7pnWcr/FEX4/HVkFbreI6w2uuGBmQOh6A=="], + "vite-plugin-vue-devtools": ["vite-plugin-vue-devtools@8.0.7", "", { "dependencies": { "@vue/devtools-core": "^8.0.7", "@vue/devtools-kit": "^8.0.7", "@vue/devtools-shared": "^8.0.7", "sirv": "^3.0.2", "vite-plugin-inspect": "^11.3.3", "vite-plugin-vue-inspector": "^5.3.2" }, "peerDependencies": { "vite": "^6.0.0 || ^7.0.0-0 || ^8.0.0-0" } }, "sha512-BWj/ykGpqVAJVdPyHmSTUm44buz3jPv+6jnvuFdQSRH0kAgP1cEIE4doHiFyqHXOmuB5EQVR/nh2g9YRiRNs9g=="], "vite-plugin-vue-inspector": ["vite-plugin-vue-inspector@5.3.2", "", { "dependencies": { "@babel/core": "^7.23.0", "@babel/plugin-proposal-decorators": "^7.23.0", "@babel/plugin-syntax-import-attributes": "^7.22.5", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-typescript": "^7.22.15", "@vue/babel-plugin-jsx": "^1.1.5", "@vue/compiler-dom": "^3.3.4", "kolorist": "^1.8.0", "magic-string": "^0.30.4" }, "peerDependencies": { "vite": "^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0-0 || ^7.0.0-0" } }, "sha512-YvEKooQcSiBTAs0DoYLfefNja9bLgkFM7NI2b07bE2SruuvX0MEa9cMaxjKVMkeCp5Nz9FRIdcN1rOdFVBeL6Q=="], @@ -1293,23 +1279,23 @@ "vscode-uri": ["vscode-uri@3.1.0", "", {}, "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ=="], - "vue": ["vue@3.5.25", "", { "dependencies": { "@vue/compiler-dom": "3.5.25", "@vue/compiler-sfc": "3.5.25", "@vue/runtime-dom": "3.5.25", "@vue/server-renderer": "3.5.25", "@vue/shared": "3.5.25" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g=="], + "vue": ["vue@3.5.29", "", { "dependencies": { "@vue/compiler-dom": "3.5.29", "@vue/compiler-sfc": "3.5.29", "@vue/runtime-dom": "3.5.29", "@vue/server-renderer": "3.5.29", "@vue/shared": "3.5.29" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-BZqN4Ze6mDQVNAni0IHeMJ5mwr8VAJ3MQC9FmprRhcBYENw+wOAAjRj8jfmN6FLl0j96OXbR+CjWhmAmM+QGnA=="], - "vue-codemirror6": ["vue-codemirror6@1.4.1", "", { "dependencies": { "vue-demi": "latest" }, "peerDependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "codemirror": "^6.0.0", "style-mod": "^4.0.0", "vue": "^2.7.14 || ^3.3.4" } }, "sha512-mokK4q89TvxtGXzdEv3YyvfX3RJJs7VxyNjBNpdNbP+jpum/ttLvWB+TEh/ziVZq5mFrQazVPCfUV8TVI/Ji2A=="], + "vue-codemirror6": ["vue-codemirror6@1.4.2", "", { "dependencies": { "vue-demi": "latest" }, "peerDependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "codemirror": "^6.0.0", "style-mod": "^4.0.0", "vue": "^2.7.14 || ^3.3.4" } }, "sha512-dD8PhKnZ8FiiorQk405oxN3DX4B0IMCyqHRtBpMNjrNmcvJYAqhj0IoJxR+Nx9Xgmt6UQKDn+1OJW3MDV5sbMA=="], "vue-demi": ["vue-demi@0.14.10", "", { "peerDependencies": { "@vue/composition-api": "^1.0.0-rc.1", "vue": "^3.0.0-0 || ^2.6.0" }, "optionalPeers": ["@vue/composition-api"], "bin": { "vue-demi-fix": "bin/vue-demi-fix.js", "vue-demi-switch": "bin/vue-demi-switch.js" } }, "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg=="], - "vue-eslint-parser": ["vue-eslint-parser@10.2.0", "", { "dependencies": { "debug": "^4.4.0", "eslint-scope": "^8.2.0", "eslint-visitor-keys": "^4.2.0", "espree": "^10.3.0", "esquery": "^1.6.0", "semver": "^7.6.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0" } }, "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw=="], + "vue-eslint-parser": ["vue-eslint-parser@10.4.0", "", { "dependencies": { "debug": "^4.4.0", "eslint-scope": "^8.2.0 || ^9.0.0", "eslint-visitor-keys": "^4.2.0 || ^5.0.0", "espree": "^10.3.0 || ^11.0.0", "esquery": "^1.6.0", "semver": "^7.6.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0" } }, "sha512-Vxi9pJdbN3ZnVGLODVtZ7y4Y2kzAAE2Cm0CZ3ZDRvydVYxZ6VrnBhLikBsRS+dpwj4Jv4UCv21PTEwF5rQ9WXg=="], - "vue-router": ["vue-router@4.6.3", "", { "dependencies": { "@vue/devtools-api": "^6.6.4" }, "peerDependencies": { "vue": "^3.5.0" } }, "sha512-ARBedLm9YlbvQomnmq91Os7ck6efydTSpRP3nuOKCvgJOHNrhRoJDSKtee8kcL1Vf7nz6U+PMBL+hTvR3bTVQg=="], + "vue-router": ["vue-router@4.6.4", "", { "dependencies": { "@vue/devtools-api": "^6.6.4" }, "peerDependencies": { "vue": "^3.5.0" } }, "sha512-Hz9q5sa33Yhduglwz6g9skT8OBPii+4bFn88w6J+J4MfEo4KRRpmiNG/hHHkdbRFlLBOqxN8y8gf2Fb0MTUgVg=="], - "vue-tsc": ["vue-tsc@3.1.5", "", { "dependencies": { "@volar/typescript": "2.4.23", "@vue/language-core": "3.1.5" }, "peerDependencies": { "typescript": ">=5.0.0" }, "bin": { "vue-tsc": "./bin/vue-tsc.js" } }, "sha512-L/G9IUjOWhBU0yun89rv8fKqmKC+T0HfhrFjlIml71WpfBv9eb4E9Bev8FMbyueBIU9vxQqbd+oOsVcDa5amGw=="], + "vue-tsc": ["vue-tsc@3.2.5", "", { "dependencies": { "@volar/typescript": "2.4.28", "@vue/language-core": "3.2.5" }, "peerDependencies": { "typescript": ">=5.0.0" }, "bin": { "vue-tsc": "bin/vue-tsc.js" } }, "sha512-/htfTCMluQ+P2FISGAooul8kO4JMheOTCbCy4M6dYnYYjqLe3BExZudAua6MSIKSFYQtFOYAll7XobYwcpokGA=="], "w3c-keyname": ["w3c-keyname@2.2.8", "", {}, "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="], "wasm-pack": ["wasm-pack@0.13.1", "", { "dependencies": { "binary-install": "^1.0.1" }, "bin": { "wasm-pack": "run.js" } }, "sha512-P9exD4YkjpDbw68xUhF3MDm/CC/3eTmmthyG5bHJ56kalxOTewOunxTke4SyF8MTXV6jUtNjXggPgrGmMtczGg=="], - "watchpack": ["watchpack@2.4.4", "", { "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" } }, "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA=="], + "watchpack": ["watchpack@2.5.1", "", { "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" } }, "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg=="], "webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="], @@ -1317,7 +1303,7 @@ "word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="], - "wrap-ansi": ["wrap-ansi@9.0.0", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q=="], + "wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="], "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="], @@ -1331,7 +1317,7 @@ "yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], - "yaml": ["yaml@2.8.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw=="], + "yaml": ["yaml@2.8.2", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A=="], "yargs": ["yargs@18.0.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^7.2.0", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg=="], @@ -1341,113 +1327,35 @@ "zwitch": ["zwitch@2.0.4", "", {}, "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A=="], - "@babel/core/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@babel/core/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/core/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - "@babel/core/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@babel/generator/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@babel/generator/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helper-annotate-as-pure/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], "@babel/helper-create-class-features-plugin/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@babel/helper-member-expression-to-functions/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helper-module-imports/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helper-optimise-call-expression/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helper-skip-transparent-expression-wrappers/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/helpers/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/template/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@babel/template/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/traverse/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@babel/traverse/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@babel/traverse/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "@codemirror/autocomplete/@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], - - "@codemirror/commands/@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], - - "@codemirror/lang-yaml/@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], - "@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], - "@eslint/eslintrc/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], - - "@eslint/eslintrc/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], + "@eslint/eslintrc/ajv": ["ajv@6.14.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="], "@eslint/eslintrc/globals": ["globals@14.0.0", "", {}, "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ=="], - "@eslint/eslintrc/js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], - - "@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/retry@0.3.1", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="], - - "@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="], - - "@jridgewell/trace-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="], - - "@parcel/watcher/detect-libc": ["detect-libc@1.0.3", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="], - "@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="], - "@typescript-eslint/parser/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "@typescript-eslint/project-service/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], + "@typescript-eslint/typescript-estree/minimatch": ["minimatch@10.2.4", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg=="], - "@typescript-eslint/type-utils/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], + "@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@5.0.1", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="], - "@typescript-eslint/typescript-estree/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], - - "@typescript-eslint/typescript-estree/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], - - "@typescript-eslint/utils/@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.7.0", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw=="], - - "@vue/babel-plugin-jsx/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@vue/babel-plugin-jsx/@vue/shared": ["@vue/shared@3.5.17", "", {}, "sha512-CabR+UN630VnsJO/jHWYBC1YVXyMq94KKp6iF5MQgZJs5I8cmjw6oVMO1oDbtBkENSHSSn/UadWlW/OAgdmKrg=="], - - "@vue/babel-plugin-resolve-type/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc": ["@vue/compiler-sfc@3.5.17", "", { "dependencies": { "@babel/parser": "^7.27.5", "@vue/compiler-core": "3.5.17", "@vue/compiler-dom": "3.5.17", "@vue/compiler-ssr": "3.5.17", "@vue/shared": "3.5.17", "estree-walker": "^2.0.2", "magic-string": "^0.30.17", "postcss": "^8.5.6", "source-map-js": "^1.2.1" } }, "sha512-rQQxbRJMgTqwRugtjw0cnyQv9cP4/4BxWfTdRBkqsTfLOHWykLzbOc3C4GGzAmdMDxhzU/1Ija5bTjMVrddqww=="], - - "@vue/compiler-core/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], - - "@vue/compiler-sfc/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="], - - "@vue/compiler-sfc/magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], - - "@vue/devtools-core/nanoid": ["nanoid@5.1.5", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-Ir/+ZpE9fDsNH0hQ3C68uyThDXzYcim2EqcZ8zn8Chtt1iylPT9xXJB0kPCnqzgcEGikO9RxSrh63MsmVCU7Fw=="], - - "@vue/language-core/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], + "@vue/compiler-core/entities": ["entities@7.0.1", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="], "chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], - "codemirror/@codemirror/language": ["@codemirror/language@6.11.2", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw=="], - "cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], "csso/css-tree": ["css-tree@2.2.1", "", { "dependencies": { "mdn-data": "2.0.28", "source-map-js": "^1.0.1" } }, "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA=="], - "eslint/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], + "eslint/ajv": ["ajv@6.14.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="], "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], @@ -1463,63 +1371,13 @@ "mlly/pkg-types": ["pkg-types@1.3.1", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="], - "monaco-yaml/prettier": ["prettier@3.6.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="], - "nearley/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], "prettier-plugin-vue/prettier": ["prettier@2.8.8", "", { "bin": { "prettier": "bin-prettier.js" } }, "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="], - "terser/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], - - "tinyglobby/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "unplugin/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "unplugin-utils/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "vite/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "vite-dev-rpc/birpc": ["birpc@2.5.0", "", {}, "sha512-VSWO/W6nNQdyP520F1mhf+Lc2f8pjGQOtoHHm7Ze8Go1kX7akpVIrtTa0fn+HB0QJEDVacl6aO08YE0PgXfdnQ=="], - - "vite-node/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "vite-node/vite": ["vite@7.0.3", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.6", "picomatch": "^4.0.2", "postcss": "^8.5.6", "rollup": "^4.40.0", "tinyglobby": "^0.2.14" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-y2L5oJZF7bj4c0jgGYgBNSdIu+5HF+m68rn2cQXFbGoShdhV1phX9rbnxy9YXj82aS8MMsCLAAFkRxZeWdldrQ=="], - - "vite-plugin-inspect/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "vite-plugin-inspect/sirv": ["sirv@3.0.1", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A=="], - - "vite-plugin-inspect/unplugin-utils": ["unplugin-utils@0.3.0", "", { "dependencies": { "pathe": "^2.0.3", "picomatch": "^4.0.3" } }, "sha512-JLoggz+PvLVMJo+jZt97hdIIIZ2yTzGgft9e9q8iMrC4ewufl62ekeW7mixBghonn2gVb/ICjyvlmOCUBnJLQg=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom": ["@vue/compiler-dom@3.5.17", "", { "dependencies": { "@vue/compiler-core": "3.5.17", "@vue/shared": "3.5.17" } }, "sha512-+2UgfLKoaNLhgfhV5Ihnk6wB4ljyW1/7wUIog2puUqajiC29Lp5R/IKDdkebh9jTbTogTbsgB+OY9cEWzG95JQ=="], - - "vite-plugin-vue-inspector/magic-string": ["magic-string@0.30.17", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="], - - "vue-eslint-parser/debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], - - "vue-eslint-parser/semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], - "@eslint/eslintrc/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], - "@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], - - "@typescript-eslint/utils/@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], - - "@vue/babel-plugin-resolve-type/@babel/parser/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/@vue/compiler-core": ["@vue/compiler-core@3.5.17", "", { "dependencies": { "@babel/parser": "^7.27.5", "@vue/shared": "3.5.17", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-Xe+AittLbAyV0pabcN7cP7/BenRBNcteM4aSDCtRvGw0d9OL+HG1u/XHLY/kt1q4fyMeZYXyIYrsHuPSiDPosA=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/@vue/compiler-dom": ["@vue/compiler-dom@3.5.17", "", { "dependencies": { "@vue/compiler-core": "3.5.17", "@vue/shared": "3.5.17" } }, "sha512-+2UgfLKoaNLhgfhV5Ihnk6wB4ljyW1/7wUIog2puUqajiC29Lp5R/IKDdkebh9jTbTogTbsgB+OY9cEWzG95JQ=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/@vue/compiler-ssr": ["@vue/compiler-ssr@3.5.17", "", { "dependencies": { "@vue/compiler-dom": "3.5.17", "@vue/shared": "3.5.17" } }, "sha512-hkDbA0Q20ZzGgpj5uZjb9rBzQtIHLS78mMilwrlpWk2Ep37DYntUz0PonQ6kr113vfOEdM+zTBuJDaceNIW0tQ=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/@vue/shared": ["@vue/shared@3.5.17", "", {}, "sha512-CabR+UN630VnsJO/jHWYBC1YVXyMq94KKp6iF5MQgZJs5I8cmjw6oVMO1oDbtBkENSHSSn/UadWlW/OAgdmKrg=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/magic-string": ["magic-string@0.30.17", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="], - - "@vue/compiler-core/@babel/parser/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], - - "@vue/compiler-sfc/@babel/parser/@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], + "@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@5.0.4", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg=="], "cross-spawn/which/isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], @@ -1529,82 +1387,6 @@ "mlly/pkg-types/confbox": ["confbox@0.1.8", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="], - "mlly/pkg-types/mlly": ["mlly@1.7.4", "", { "dependencies": { "acorn": "^8.14.0", "pathe": "^2.0.1", "pkg-types": "^1.3.0", "ufo": "^1.5.4" } }, "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw=="], - - "vite-node/vite/esbuild": ["esbuild@0.25.6", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.6", "@esbuild/android-arm": "0.25.6", "@esbuild/android-arm64": "0.25.6", "@esbuild/android-x64": "0.25.6", "@esbuild/darwin-arm64": "0.25.6", "@esbuild/darwin-x64": "0.25.6", "@esbuild/freebsd-arm64": "0.25.6", "@esbuild/freebsd-x64": "0.25.6", "@esbuild/linux-arm": "0.25.6", "@esbuild/linux-arm64": "0.25.6", "@esbuild/linux-ia32": "0.25.6", "@esbuild/linux-loong64": "0.25.6", "@esbuild/linux-mips64el": "0.25.6", "@esbuild/linux-ppc64": "0.25.6", "@esbuild/linux-riscv64": "0.25.6", "@esbuild/linux-s390x": "0.25.6", "@esbuild/linux-x64": "0.25.6", "@esbuild/netbsd-arm64": "0.25.6", "@esbuild/netbsd-x64": "0.25.6", "@esbuild/openbsd-arm64": "0.25.6", "@esbuild/openbsd-x64": "0.25.6", "@esbuild/openharmony-arm64": "0.25.6", "@esbuild/sunos-x64": "0.25.6", "@esbuild/win32-arm64": "0.25.6", "@esbuild/win32-ia32": "0.25.6", "@esbuild/win32-x64": "0.25.6" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-GVuzuUwtdsghE3ocJ9Bs8PNoF13HNQ5TXbEi2AhvVb8xU1Iwt9Fos9FEamfoee+u/TOsn7GUWc04lz46n2bbTg=="], - - "vite-node/vite/fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="], - - "vite-node/vite/tinyglobby": ["tinyglobby@0.2.14", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ=="], - - "vite-plugin-inspect/unplugin-utils/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom/@vue/compiler-core": ["@vue/compiler-core@3.5.17", "", { "dependencies": { "@babel/parser": "^7.27.5", "@vue/shared": "3.5.17", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "sha512-Xe+AittLbAyV0pabcN7cP7/BenRBNcteM4aSDCtRvGw0d9OL+HG1u/XHLY/kt1q4fyMeZYXyIYrsHuPSiDPosA=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom/@vue/shared": ["@vue/shared@3.5.17", "", {}, "sha512-CabR+UN630VnsJO/jHWYBC1YVXyMq94KKp6iF5MQgZJs5I8cmjw6oVMO1oDbtBkENSHSSn/UadWlW/OAgdmKrg=="], - - "vite-plugin-vue-inspector/magic-string/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="], - - "@vue/babel-plugin-resolve-type/@vue/compiler-sfc/magic-string/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="], - - "@vue/compiler-core/@babel/parser/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], - - "@vue/compiler-sfc/@babel/parser/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], - - "vite-node/vite/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.6", "", { "os": "aix", "cpu": "ppc64" }, "sha512-ShbM/3XxwuxjFiuVBHA+d3j5dyac0aEVVq1oluIDf71hUw0aRF59dV/efUsIwFnR6m8JNM2FjZOzmaZ8yG61kw=="], - - "vite-node/vite/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.25.6", "", { "os": "android", "cpu": "arm" }, "sha512-S8ToEOVfg++AU/bHwdksHNnyLyVM+eMVAOf6yRKFitnwnbwwPNqKr3srzFRe7nzV69RQKb5DgchIX5pt3L53xg=="], - - "vite-node/vite/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.6", "", { "os": "android", "cpu": "arm64" }, "sha512-hd5zdUarsK6strW+3Wxi5qWws+rJhCCbMiC9QZyzoxfk5uHRIE8T287giQxzVpEvCwuJ9Qjg6bEjcRJcgfLqoA=="], - - "vite-node/vite/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.25.6", "", { "os": "android", "cpu": "x64" }, "sha512-0Z7KpHSr3VBIO9A/1wcT3NTy7EB4oNC4upJ5ye3R7taCc2GUdeynSLArnon5G8scPwaU866d3H4BCrE5xLW25A=="], - - "vite-node/vite/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-FFCssz3XBavjxcFxKsGy2DYK5VSvJqa6y5HXljKzhRZ87LvEi13brPrf/wdyl/BbpbMKJNOr1Sd0jtW4Ge1pAA=="], - - "vite-node/vite/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-GfXs5kry/TkGM2vKqK2oyiLFygJRqKVhawu3+DOCk7OxLy/6jYkWXhlHwOoTb0WqGnWGAS7sooxbZowy+pK9Yg=="], - - "vite-node/vite/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.6", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-aoLF2c3OvDn2XDTRvn8hN6DRzVVpDlj2B/F66clWd/FHLiHaG3aVZjxQX2DYphA5y/evbdGvC6Us13tvyt4pWg=="], - - "vite-node/vite/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.6", "", { "os": "freebsd", "cpu": "x64" }, "sha512-2SkqTjTSo2dYi/jzFbU9Plt1vk0+nNg8YC8rOXXea+iA3hfNJWebKYPs3xnOUf9+ZWhKAaxnQNUf2X9LOpeiMQ=="], - - "vite-node/vite/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.6", "", { "os": "linux", "cpu": "arm" }, "sha512-SZHQlzvqv4Du5PrKE2faN0qlbsaW/3QQfUUc6yO2EjFcA83xnwm91UbEEVx4ApZ9Z5oG8Bxz4qPE+HFwtVcfyw=="], - - "vite-node/vite/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-b967hU0gqKd9Drsh/UuAm21Khpoh6mPBSgz8mKRq4P5mVK8bpA+hQzmm/ZwGVULSNBzKdZPQBRT3+WuVavcWsQ=="], - - "vite-node/vite/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.6", "", { "os": "linux", "cpu": "ia32" }, "sha512-aHWdQ2AAltRkLPOsKdi3xv0mZ8fUGPdlKEjIEhxCPm5yKEThcUjHpWB1idN74lfXGnZ5SULQSgtr5Qos5B0bPw=="], - - "vite-node/vite/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-VgKCsHdXRSQ7E1+QXGdRPlQ/e08bN6WMQb27/TMfV+vPjjTImuT9PmLXupRlC90S1JeNNW5lzkAEO/McKeJ2yg=="], - - "vite-node/vite/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-WViNlpivRKT9/py3kCmkHnn44GkGXVdXfdc4drNmRl15zVQ2+D2uFwdlGh6IuK5AAnGTo2qPB1Djppj+t78rzw=="], - - "vite-node/vite/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.6", "", { "os": "linux", "cpu": "ppc64" }, "sha512-wyYKZ9NTdmAMb5730I38lBqVu6cKl4ZfYXIs31Baf8aoOtB4xSGi3THmDYt4BTFHk7/EcVixkOV2uZfwU3Q2Jw=="], - - "vite-node/vite/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-KZh7bAGGcrinEj4qzilJ4hqTY3Dg2U82c8bv+e1xqNqZCrCyc+TL9AUEn5WGKDzm3CfC5RODE/qc96OcbIe33w=="], - - "vite-node/vite/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.6", "", { "os": "linux", "cpu": "s390x" }, "sha512-9N1LsTwAuE9oj6lHMyyAM+ucxGiVnEqUdp4v7IaMmrwb06ZTEVCIs3oPPplVsnjPfyjmxwHxHMF8b6vzUVAUGw=="], - - "vite-node/vite/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.6", "", { "os": "linux", "cpu": "x64" }, "sha512-A6bJB41b4lKFWRKNrWoP2LHsjVzNiaurf7wyj/XtFNTsnPuxwEBWHLty+ZE0dWBKuSK1fvKgrKaNjBS7qbFKig=="], - - "vite-node/vite/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.6", "", { "os": "none", "cpu": "arm64" }, "sha512-IjA+DcwoVpjEvyxZddDqBY+uJ2Snc6duLpjmkXm/v4xuS3H+3FkLZlDm9ZsAbF9rsfP3zeA0/ArNDORZgrxR/Q=="], - - "vite-node/vite/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.6", "", { "os": "none", "cpu": "x64" }, "sha512-dUXuZr5WenIDlMHdMkvDc1FAu4xdWixTCRgP7RQLBOkkGgwuuzaGSYcOpW4jFxzpzL1ejb8yF620UxAqnBrR9g=="], - - "vite-node/vite/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.6", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-l8ZCvXP0tbTJ3iaqdNf3pjaOSd5ex/e6/omLIQCVBLmHTlfXW3zAxQ4fnDmPLOB1x9xrcSi/xtCWFwCZRIaEwg=="], - - "vite-node/vite/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.6", "", { "os": "openbsd", "cpu": "x64" }, "sha512-hKrmDa0aOFOr71KQ/19JC7az1P0GWtCN1t2ahYAf4O007DHZt/dW8ym5+CUdJhQ/qkZmI1HAF8KkJbEFtCL7gw=="], - - "vite-node/vite/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.6", "", { "os": "none", "cpu": "arm64" }, "sha512-+SqBcAWoB1fYKmpWoQP4pGtx+pUUC//RNYhFdbcSA16617cchuryuhOCRpPsjCblKukAckWsV+aQ3UKT/RMPcA=="], - - "vite-node/vite/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.6", "", { "os": "sunos", "cpu": "x64" }, "sha512-dyCGxv1/Br7MiSC42qinGL8KkG4kX0pEsdb0+TKhmJZgCUDBGmyo1/ArCjNGiOLiIAgdbWgmWgib4HoCi5t7kA=="], - - "vite-node/vite/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-42QOgcZeZOvXfsCBJF5Afw73t4veOId//XD3i+/9gSkhSV6Gk3VPlWncctI+JcOyERv85FUo7RxuxGy+z8A43Q=="], - - "vite-node/vite/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.6", "", { "os": "win32", "cpu": "ia32" }, "sha512-4AWhgXmDuYN7rJI6ORB+uU9DHLq/erBbuMoAuB4VWJTu5KtCgcKYPynF0YI1VkBNuEfjNlLrFr9KZPJzrtLkrQ=="], - - "vite-node/vite/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.6", "", { "os": "win32", "cpu": "x64" }, "sha512-NgJPHHbEpLQgDH2MjQu90pzW/5vvXIZ7KOnPyNBm92A6WgZ/7b6fJyUBjoumLqeOQQGqY2QjQxRo97ah4Sj0cA=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom/@vue/compiler-core/@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - - "vite-plugin-vue-inspector/@vue/compiler-dom/@vue/compiler-core/@babel/parser/@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], + "@typescript-eslint/typescript-estree/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], } } diff --git a/creator-assembler b/creator-assembler index 02d5dc4a9..0531a2707 160000 --- a/creator-assembler +++ b/creator-assembler @@ -1 +1 @@ -Subproject commit 02d5dc4a944a66c618c9816884f6f00448586529 +Subproject commit 0531a2707011af39e85d78ffd588d14c73861ffd diff --git a/deno.lock b/deno.lock index 0300d0dcb..0ea81da64 100644 --- a/deno.lock +++ b/deno.lock @@ -1,421 +1,4113 @@ { "version": "5", "specifiers": { - "npm:readline-sync@^1.4.10": "1.4.10" + "jsr:@std/assert@^1.0.17": "1.0.19", + "jsr:@std/fs@^1.0.22": "1.0.23", + "jsr:@std/internal@^1.0.12": "1.0.12", + "jsr:@std/path@*": "1.1.4", + "jsr:@std/path@^1.1.4": "1.1.4", + "jsr:@std/testing@*": "1.0.17", + "npm:@codemirror/lang-yaml@^6.1.2": "6.1.2", + "npm:@codemirror/language@^6.11.3": "6.12.1", + "npm:@codemirror/legacy-modes@^6.5.1": "6.5.2", + "npm:@floating-ui/vue@^1.1.9": "1.1.9_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:@fortawesome/fontawesome-svg-core@^7.1.0": "7.1.0", + "npm:@fortawesome/free-brands-svg-icons@^7.0.1": "7.1.0", + "npm:@fortawesome/free-regular-svg-icons@^7.0.1": "7.1.0", + "npm:@fortawesome/free-solid-svg-icons@^7.1.0": "7.1.0", + "npm:@fortawesome/vue-fontawesome@^3.1.3": "3.1.3_@fortawesome+fontawesome-svg-core@7.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:@lezer/highlight@^1.2.3": "1.2.3", + "npm:@prettier/plugin-pug@^3.4.2": "3.4.2_prettier@3.8.0", + "npm:@replit/codemirror-vim@^6.3.0": "6.3.0_@codemirror+commands@6.10.1_@codemirror+language@6.12.1_@codemirror+search@6.6.0_@codemirror+state@6.5.4_@codemirror+view@6.39.11", + "npm:@tsconfig/node22@^22.0.5": "22.0.5", + "npm:@types/colors@^1.2.4": "1.2.4", + "npm:@types/humanize-duration@^3.27.4": "3.27.4", + "npm:@types/js-yaml@^4.0.9": "4.0.9", + "npm:@types/node@^24.10.1": "24.10.9", + "npm:@types/yargs@^17.0.35": "17.0.35", + "npm:@uiw/codemirror-themes@^4.25.1": "4.25.4_@codemirror+language@6.12.1_@codemirror+state@6.5.4_@codemirror+view@6.39.11", + "npm:@vitejs/plugin-vue@^6.0.2": "6.0.3_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_vue@3.5.27__typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_typescript@5.9.3", + "npm:@vue/eslint-config-prettier@^10.2.0": "10.2.0_eslint@9.39.2__jiti@2.6.1_prettier@3.8.0_jiti@2.6.1_eslint-config-prettier@10.1.8__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1", + "npm:@vue/eslint-config-typescript@^14.6.0": "14.6.0_eslint@9.39.2__jiti@2.6.1_eslint-plugin-vue@10.7.0__eslint@9.39.2___jiti@2.6.1__vue-eslint-parser@10.2.0___eslint@9.39.2____jiti@2.6.1___jiti@2.6.1__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1_vue-eslint-parser@10.2.0__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1", + "npm:@vue/tsconfig@~0.8.1": "0.8.1_typescript@5.9.3_vue@3.5.27__typescript@5.9.3", + "npm:@vueuse/core@14": "14.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:@xterm/addon-fit@0.10": "0.10.0_@xterm+xterm@5.5.0", + "npm:@xterm/addon-web-links@0.11": "0.11.0_@xterm+xterm@5.5.0", + "npm:ajv@^8.17.1": "8.17.1", + "npm:ansicolor@^2.0.3": "2.0.3", + "npm:bootstrap-vue-next@~0.40.6": "0.40.9_@floating-ui+vue@1.1.9__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_@vueuse+core@14.1.0__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_vue@3.5.27__typescript@5.9.3_vue-router@4.6.4__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_typescript@5.9.3", + "npm:bootstrap@^5.3.8": "5.3.8_@popperjs+core@2.11.8", + "npm:codemirror-json-schema@~0.8.1": "0.8.1_@codemirror+language@6.12.1_@codemirror+lint@6.9.2_@codemirror+state@6.5.4_@codemirror+view@6.39.11_@lezer+common@1.5.0", + "npm:codemirror@^6.0.2": "6.0.2", + "npm:colors@^1.4.0": "1.4.0", + "npm:deno@^2.5.4": "2.6.5", + "npm:eslint-plugin-vue@^10.5.1": "10.7.0_eslint@9.39.2__jiti@2.6.1_vue-eslint-parser@10.2.0__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1_jiti@2.6.1", + "npm:eslint@^9.39.1": "9.39.2_jiti@2.6.1", + "npm:globals@^16.5.0": "16.5.0", + "npm:humanize-duration@^3.33.0": "3.33.2", + "npm:jiti@^2.6.1": "2.6.1", + "npm:js-yaml@^4.1.1": "4.1.1", + "npm:mitt@^3.0.1": "3.0.1", + "npm:monaco-editor@0.54": "0.54.0", + "npm:monaco-vim@~0.4.2": "0.4.4_monaco-editor@0.54.0", + "npm:monaco-yaml@^5.4.0": "5.4.0_monaco-editor@0.54.0", + "npm:npm-run-all2@^8.0.4": "8.0.4", + "npm:prettier-plugin-vue@^1.1.6": "1.1.6", + "npm:prettier@^3.7.4": "3.8.0", + "npm:qrcode.vue@^3.6.0": "3.6.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:readline-sync@^1.4.10": "1.4.10", + "npm:sass-embedded@^1.93.3": "1.97.2", + "npm:sharp@~0.34.5": "0.34.5", + "npm:svgo@4": "4.0.0", + "npm:typescript@^5.8.3": "5.9.3", + "npm:unplugin-vue-components@30": "30.0.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:vite-multiple-assets@^2.2.6": "2.2.6_mime-types@2.1.35_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2", + "npm:vite-node@^3.2.4": "3.2.4_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2", + "npm:vite-plugin-image-optimizer@^2.0.3": "2.0.3_sharp@0.34.5_svgo@4.0.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2", + "npm:vite-plugin-vue-devtools@^8.0.5": "8.0.5_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_vue@3.5.27__typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_typescript@5.9.3", + "npm:vite-plugin-wasm@^3.5.0": "3.5.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2", + "npm:vite@^7.2.4": "7.3.1_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_picomatch@4.0.3", + "npm:vue-codemirror6@^1.4.1": "1.4.1_@codemirror+autocomplete@6.20.0_@codemirror+commands@6.10.1_@codemirror+language@6.12.1_@codemirror+lint@6.9.2_@codemirror+search@6.6.0_@codemirror+state@6.5.4_@codemirror+view@6.39.11_codemirror@6.0.2_style-mod@4.1.3_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:vue-router@^4.6.3": "4.6.4_vue@3.5.27__typescript@5.9.3_typescript@5.9.3", + "npm:vue-tsc@^3.1.4": "3.2.2_typescript@5.9.3", + "npm:vue@^3.5.21": "3.5.27_typescript@5.9.3", + "npm:wasm-pack@~0.13.1": "0.13.1", + "npm:xterm@^5.3.0": "5.3.0", + "npm:yargs@18": "18.0.0" + }, + "jsr": { + "@std/assert@1.0.19": { + "integrity": "eaada96ee120cb980bc47e040f82814d786fe8162ecc53c91d8df60b8755991e" + }, + "@std/fs@1.0.23": { + "integrity": "3ecbae4ce4fee03b180fa710caff36bb5adb66631c46a6460aaad49515565a37", + "dependencies": [ + "jsr:@std/path@^1.1.4" + ] + }, + "@std/internal@1.0.12": { + "integrity": "972a634fd5bc34b242024402972cd5143eac68d8dffaca5eaa4dba30ce17b027" + }, + "@std/path@1.1.4": { + "integrity": "1d2d43f39efb1b42f0b1882a25486647cb851481862dc7313390b2bb044314b5", + "dependencies": [ + "jsr:@std/internal" + ] + }, + "@std/testing@1.0.17": { + "integrity": "87bdc2700fa98249d48a17cd72413352d3d3680dcfbdb64947fd0982d6bbf681", + "dependencies": [ + "jsr:@std/assert", + "jsr:@std/fs", + "jsr:@std/internal", + "jsr:@std/path@^1.1.4" + ] + } }, "npm": { - "@esbuild/aix-ppc64@0.25.5": { - "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", + "@aesoper/normal-utils@0.1.5": { + "integrity": "sha512-LFF/6y6h5mfwhnJaWqqxuC8zzDaHCG62kMRkd8xhDtq62TQj9dM17A9DhE87W7DhiARJsHLgcina/9P4eNCN1w==" + }, + "@babel/code-frame@7.28.6": { + "integrity": "sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==", + "dependencies": [ + "@babel/helper-validator-identifier", + "js-tokens", + "picocolors" + ] + }, + "@babel/compat-data@7.28.6": { + "integrity": "sha512-2lfu57JtzctfIrcGMz992hyLlByuzgIk58+hhGCxjKZ3rWI82NnVLjXcaTqkI2NvlcvOskZaiZ5kjUALo3Lpxg==" + }, + "@babel/core@7.28.6": { + "integrity": "sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==", + "dependencies": [ + "@babel/code-frame", + "@babel/generator", + "@babel/helper-compilation-targets", + "@babel/helper-module-transforms", + "@babel/helpers", + "@babel/parser", + "@babel/template", + "@babel/traverse", + "@babel/types", + "@jridgewell/remapping", + "convert-source-map", + "debug", + "gensync", + "json5", + "semver@6.3.1" + ] + }, + "@babel/generator@7.28.6": { + "integrity": "sha512-lOoVRwADj8hjf7al89tvQ2a1lf53Z+7tiXMgpZJL3maQPDxh0DgLMN62B2MKUOFcoodBHLMbDM6WAbKgNy5Suw==", + "dependencies": [ + "@babel/parser", + "@babel/types", + "@jridgewell/gen-mapping", + "@jridgewell/trace-mapping", + "jsesc" + ] + }, + "@babel/helper-annotate-as-pure@7.27.3": { + "integrity": "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==", + "dependencies": [ + "@babel/types" + ] + }, + "@babel/helper-compilation-targets@7.28.6": { + "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "dependencies": [ + "@babel/compat-data", + "@babel/helper-validator-option", + "browserslist", + "lru-cache", + "semver@6.3.1" + ] + }, + "@babel/helper-create-class-features-plugin@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-dTOdvsjnG3xNT9Y0AUg1wAl38y+4Rl4sf9caSQZOXdNqVn+H+HbbJ4IyyHaIqNR6SW9oJpA/RuRjsjCw2IdIow==", + "dependencies": [ + "@babel/core", + "@babel/helper-annotate-as-pure", + "@babel/helper-member-expression-to-functions", + "@babel/helper-optimise-call-expression", + "@babel/helper-replace-supers", + "@babel/helper-skip-transparent-expression-wrappers", + "@babel/traverse", + "semver@6.3.1" + ] + }, + "@babel/helper-globals@7.28.0": { + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==" + }, + "@babel/helper-member-expression-to-functions@7.28.5": { + "integrity": "sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg==", + "dependencies": [ + "@babel/traverse", + "@babel/types" + ] + }, + "@babel/helper-module-imports@7.28.6": { + "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "dependencies": [ + "@babel/traverse", + "@babel/types" + ] + }, + "@babel/helper-module-transforms@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "dependencies": [ + "@babel/core", + "@babel/helper-module-imports", + "@babel/helper-validator-identifier", + "@babel/traverse" + ] + }, + "@babel/helper-optimise-call-expression@7.27.1": { + "integrity": "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==", + "dependencies": [ + "@babel/types" + ] + }, + "@babel/helper-plugin-utils@7.28.6": { + "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==" + }, + "@babel/helper-replace-supers@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-mq8e+laIk94/yFec3DxSjCRD2Z0TAjhVbEJY3UQrlwVo15Lmt7C2wAUbK4bjnTs4APkwsYLTahXRraQXhb1WCg==", + "dependencies": [ + "@babel/core", + "@babel/helper-member-expression-to-functions", + "@babel/helper-optimise-call-expression", + "@babel/traverse" + ] + }, + "@babel/helper-skip-transparent-expression-wrappers@7.27.1": { + "integrity": "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg==", + "dependencies": [ + "@babel/traverse", + "@babel/types" + ] + }, + "@babel/helper-string-parser@7.27.1": { + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==" + }, + "@babel/helper-validator-identifier@7.28.5": { + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==" + }, + "@babel/helper-validator-option@7.27.1": { + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==" + }, + "@babel/helpers@7.28.6": { + "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==", + "dependencies": [ + "@babel/template", + "@babel/types" + ] + }, + "@babel/parser@7.28.6": { + "integrity": "sha512-TeR9zWR18BvbfPmGbLampPMW+uW1NZnJlRuuHso8i87QZNq2JRF9i6RgxRqtEq+wQGsS19NNTWr2duhnE49mfQ==", + "dependencies": [ + "@babel/types" + ], + "bin": true + }, + "@babel/plugin-proposal-decorators@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-RVdFPPyY9fCRAX68haPmOk2iyKW8PKJFthmm8NeSI3paNxKWGZIn99+VbIf0FrtCpFnPgnpF/L48tadi617ULg==", + "dependencies": [ + "@babel/core", + "@babel/helper-create-class-features-plugin", + "@babel/helper-plugin-utils", + "@babel/plugin-syntax-decorators" + ] + }, + "@babel/plugin-syntax-decorators@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-71EYI0ONURHJBL4rSFXnITXqXrrY8q4P0q006DPfN+Rk+ASM+++IBXem/ruokgBZR8YNEWZ8R6B+rCb8VcUTqA==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-syntax-import-attributes@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-syntax-import-meta@7.10.4_@babel+core@7.28.6": { + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-syntax-jsx@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-syntax-typescript@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A==", + "dependencies": [ + "@babel/core", + "@babel/helper-plugin-utils" + ] + }, + "@babel/plugin-transform-typescript@7.28.6_@babel+core@7.28.6": { + "integrity": "sha512-0YWL2RFxOqEm9Efk5PvreamxPME8OyY0wM5wh5lHjF+VtVhdneCWGzZeSqzOfiobVqQaNCd2z0tQvnI9DaPWPw==", + "dependencies": [ + "@babel/core", + "@babel/helper-annotate-as-pure", + "@babel/helper-create-class-features-plugin", + "@babel/helper-plugin-utils", + "@babel/helper-skip-transparent-expression-wrappers", + "@babel/plugin-syntax-typescript" + ] + }, + "@babel/template@7.28.6": { + "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "dependencies": [ + "@babel/code-frame", + "@babel/parser", + "@babel/types" + ] + }, + "@babel/traverse@7.28.6": { + "integrity": "sha512-fgWX62k02qtjqdSNTAGxmKYY/7FSL9WAS1o2Hu5+I5m9T0yxZzr4cnrfXQ/MX0rIifthCSs6FKTlzYbJcPtMNg==", + "dependencies": [ + "@babel/code-frame", + "@babel/generator", + "@babel/helper-globals", + "@babel/parser", + "@babel/template", + "@babel/types", + "debug" + ] + }, + "@babel/types@7.28.6": { + "integrity": "sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==", + "dependencies": [ + "@babel/helper-string-parser", + "@babel/helper-validator-identifier" + ] + }, + "@bufbuild/protobuf@2.10.2": { + "integrity": "sha512-uFsRXwIGyu+r6AMdz+XijIIZJYpoWeYzILt5yZ2d3mCjQrWUTVpVD9WL/jZAbvp+Ed04rOhrsk7FiTcEDseB5A==" + }, + "@codemirror/autocomplete@6.20.0": { + "integrity": "sha512-bOwvTOIJcG5FVo5gUUupiwYh8MioPLQ4UcqbcRf7UQ98X90tCa9E1kZ3Z7tqwpZxYyOvh1YTYbmZE9RTfTp5hg==", + "dependencies": [ + "@codemirror/language", + "@codemirror/state", + "@codemirror/view", + "@lezer/common" + ] + }, + "@codemirror/commands@6.10.1": { + "integrity": "sha512-uWDWFypNdQmz2y1LaNJzK7fL7TYKLeUAU0npEC685OKTF3KcQ2Vu3klIM78D7I6wGhktme0lh3CuQLv0ZCrD9Q==", + "dependencies": [ + "@codemirror/language", + "@codemirror/state", + "@codemirror/view", + "@lezer/common" + ] + }, + "@codemirror/lang-json@6.0.2": { + "integrity": "sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ==", + "dependencies": [ + "@codemirror/language", + "@lezer/json" + ] + }, + "@codemirror/lang-yaml@6.1.2": { + "integrity": "sha512-dxrfG8w5Ce/QbT7YID7mWZFKhdhsaTNOYjOkSIMt1qmC4VQnXSDSYVHHHn8k6kJUfIhtLo8t1JJgltlxWdsITw==", + "dependencies": [ + "@codemirror/autocomplete", + "@codemirror/language", + "@codemirror/state", + "@lezer/common", + "@lezer/highlight", + "@lezer/lr", + "@lezer/yaml" + ] + }, + "@codemirror/language@6.12.1": { + "integrity": "sha512-Fa6xkSiuGKc8XC8Cn96T+TQHYj4ZZ7RdFmXA3i9xe/3hLHfwPZdM+dqfX0Cp0zQklBKhVD8Yzc8LS45rkqcwpQ==", + "dependencies": [ + "@codemirror/state", + "@codemirror/view", + "@lezer/common", + "@lezer/highlight", + "@lezer/lr", + "style-mod" + ] + }, + "@codemirror/legacy-modes@6.5.2": { + "integrity": "sha512-/jJbwSTazlQEDOQw2FJ8LEEKVS72pU0lx6oM54kGpL8t/NJ2Jda3CZ4pcltiKTdqYSRk3ug1B3pil1gsjA6+8Q==", + "dependencies": [ + "@codemirror/language" + ] + }, + "@codemirror/lint@6.9.2": { + "integrity": "sha512-sv3DylBiIyi+xKwRCJAAsBZZZWo82shJ/RTMymLabAdtbkV5cSKwWDeCgtUq3v8flTaXS2y1kKkICuRYtUswyQ==", + "dependencies": [ + "@codemirror/state", + "@codemirror/view", + "crelt" + ] + }, + "@codemirror/search@6.6.0": { + "integrity": "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==", + "dependencies": [ + "@codemirror/state", + "@codemirror/view", + "crelt" + ] + }, + "@codemirror/state@6.5.4": { + "integrity": "sha512-8y7xqG/hpB53l25CIoit9/ngxdfoG+fx+V3SHBrinnhOtLvKHRyAJJuHzkWrR4YXXLX8eXBsejgAAxHUOdW1yw==", + "dependencies": [ + "@marijn/find-cluster-break" + ] + }, + "@codemirror/view@6.39.11": { + "integrity": "sha512-bWdeR8gWM87l4DB/kYSF9A+dVackzDb/V56Tq7QVrQ7rn86W0rgZFtlL3g3pem6AeGcb9NQNoy3ao4WpW4h5tQ==", + "dependencies": [ + "@codemirror/state", + "crelt", + "style-mod", + "w3c-keyname" + ] + }, + "@deno/darwin-arm64@2.6.5": { + "integrity": "sha512-jHO9d9XsB2YzVUsJr7U9DEj7QEw69yMYbyaLbK1bpHJ6IjYRJFU/Wi7I1b9jSXurezQQulKf75+9QbU27XkL2g==", + "os": ["darwin"], + "cpu": ["arm64"] + }, + "@deno/darwin-x64@2.6.5": { + "integrity": "sha512-piyZbW02p4zlviz14UVvoUGhh2mu0OYQBBahdLIbnHaPC14Rj+fHu0vgG8+PTJNCIRkxA1zrm5/GBbjqU3GeZQ==", + "os": ["darwin"], + "cpu": ["x64"] + }, + "@deno/linux-arm64-glibc@2.6.5": { + "integrity": "sha512-9VjtjIepMgSc6aHNOvjHAlHkG/Lmatoeb6k5vpCtVLpwJWJcteIrNX+Rc2u7HcfJctfPs6HwDYsCGI/jnwwzGw==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@deno/linux-x64-glibc@2.6.5": { + "integrity": "sha512-TZV2Ez3T1qaA7snLKvevwq2LyTGI+1lCQrULZgrytmcaa0Q/9aErA3c135CSscv5LDKSWUXtBCWOHHI6rGm9MA==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@deno/win32-arm64@2.6.5": { + "integrity": "sha512-5zPTnSv0R72GwVxxP20cLN/K5VJd6mF5yaLd/4tnwpv4jExiiQWaoXrae/M8O16Ruz8R+AIpIJfs3oZ+2gwuzA==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@deno/win32-x64@2.6.5": { + "integrity": "sha512-vSr5ZjBvv5n80Bwa9P0WVLpUNLqnDtXMFIuR7H4mdo5zXU9Ay8ggPQ83yPMjmgqRZOBJNXQDFUA3ZWW+UmMjYQ==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@emnapi/runtime@1.8.1": { + "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "dependencies": [ + "tslib" + ] + }, + "@esbuild/aix-ppc64@0.27.2": { + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", "os": ["aix"], "cpu": ["ppc64"] }, - "@esbuild/android-arm64@0.25.5": { - "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", + "@esbuild/android-arm64@0.27.2": { + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", "os": ["android"], "cpu": ["arm64"] }, - "@esbuild/android-arm@0.25.5": { - "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", + "@esbuild/android-arm@0.27.2": { + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", "os": ["android"], "cpu": ["arm"] }, - "@esbuild/android-x64@0.25.5": { - "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", + "@esbuild/android-x64@0.27.2": { + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", "os": ["android"], "cpu": ["x64"] }, - "@esbuild/darwin-arm64@0.25.5": { - "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", + "@esbuild/darwin-arm64@0.27.2": { + "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", "os": ["darwin"], "cpu": ["arm64"] }, - "@esbuild/darwin-x64@0.25.5": { - "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", + "@esbuild/darwin-x64@0.27.2": { + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", "os": ["darwin"], "cpu": ["x64"] }, - "@esbuild/freebsd-arm64@0.25.5": { - "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", + "@esbuild/freebsd-arm64@0.27.2": { + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", "os": ["freebsd"], "cpu": ["arm64"] }, - "@esbuild/freebsd-x64@0.25.5": { - "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", + "@esbuild/freebsd-x64@0.27.2": { + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", "os": ["freebsd"], "cpu": ["x64"] }, - "@esbuild/linux-arm64@0.25.5": { - "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", + "@esbuild/linux-arm64@0.27.2": { + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", "os": ["linux"], "cpu": ["arm64"] }, - "@esbuild/linux-arm@0.25.5": { - "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", + "@esbuild/linux-arm@0.27.2": { + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", "os": ["linux"], "cpu": ["arm"] }, - "@esbuild/linux-ia32@0.25.5": { - "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", + "@esbuild/linux-ia32@0.27.2": { + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", "os": ["linux"], "cpu": ["ia32"] }, - "@esbuild/linux-loong64@0.25.5": { - "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", + "@esbuild/linux-loong64@0.27.2": { + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", "os": ["linux"], "cpu": ["loong64"] }, - "@esbuild/linux-mips64el@0.25.5": { - "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", + "@esbuild/linux-mips64el@0.27.2": { + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", "os": ["linux"], "cpu": ["mips64el"] }, - "@esbuild/linux-ppc64@0.25.5": { - "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", + "@esbuild/linux-ppc64@0.27.2": { + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", "os": ["linux"], "cpu": ["ppc64"] }, - "@esbuild/linux-riscv64@0.25.5": { - "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", + "@esbuild/linux-riscv64@0.27.2": { + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", "os": ["linux"], "cpu": ["riscv64"] }, - "@esbuild/linux-s390x@0.25.5": { - "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", + "@esbuild/linux-s390x@0.27.2": { + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", "os": ["linux"], "cpu": ["s390x"] }, - "@esbuild/linux-x64@0.25.5": { - "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", + "@esbuild/linux-x64@0.27.2": { + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", "os": ["linux"], "cpu": ["x64"] }, - "@esbuild/netbsd-arm64@0.25.5": { - "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", + "@esbuild/netbsd-arm64@0.27.2": { + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", "os": ["netbsd"], "cpu": ["arm64"] }, - "@esbuild/netbsd-x64@0.25.5": { - "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", + "@esbuild/netbsd-x64@0.27.2": { + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", "os": ["netbsd"], "cpu": ["x64"] }, - "@esbuild/openbsd-arm64@0.25.5": { - "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", + "@esbuild/openbsd-arm64@0.27.2": { + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", "os": ["openbsd"], "cpu": ["arm64"] }, - "@esbuild/openbsd-x64@0.25.5": { - "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", + "@esbuild/openbsd-x64@0.27.2": { + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", "os": ["openbsd"], "cpu": ["x64"] }, - "@esbuild/sunos-x64@0.25.5": { - "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", + "@esbuild/openharmony-arm64@0.27.2": { + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", + "os": ["openharmony"], + "cpu": ["arm64"] + }, + "@esbuild/sunos-x64@0.27.2": { + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", "os": ["sunos"], "cpu": ["x64"] }, - "@esbuild/win32-arm64@0.25.5": { - "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", + "@esbuild/win32-arm64@0.27.2": { + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", "os": ["win32"], "cpu": ["arm64"] }, - "@esbuild/win32-ia32@0.25.5": { - "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", + "@esbuild/win32-ia32@0.27.2": { + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", "os": ["win32"], "cpu": ["ia32"] }, - "@esbuild/win32-x64@0.25.5": { - "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", + "@esbuild/win32-x64@0.27.2": { + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", "os": ["win32"], "cpu": ["x64"] }, - "@parcel/watcher-android-arm64@2.5.1": { - "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==", - "os": ["android"], - "cpu": ["arm64"] + "@eslint-community/eslint-utils@4.9.1_eslint@9.39.2__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dependencies": [ + "eslint", + "eslint-visitor-keys@3.4.3" + ] }, - "@parcel/watcher-darwin-arm64@2.5.1": { - "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==", - "os": ["darwin"], - "cpu": ["arm64"] + "@eslint-community/regexpp@4.12.2": { + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==" }, - "@parcel/watcher-darwin-x64@2.5.1": { - "integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==", - "os": ["darwin"], - "cpu": ["x64"] + "@eslint/config-array@0.21.1": { + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dependencies": [ + "@eslint/object-schema", + "debug", + "minimatch@3.1.2" + ] }, - "@parcel/watcher-freebsd-x64@2.5.1": { - "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==", - "os": ["freebsd"], - "cpu": ["x64"] + "@eslint/config-helpers@0.4.2": { + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dependencies": [ + "@eslint/core" + ] }, - "@parcel/watcher-linux-arm-glibc@2.5.1": { - "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==", - "os": ["linux"], - "cpu": ["arm"] + "@eslint/core@0.17.0": { + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dependencies": [ + "@types/json-schema" + ] }, - "@parcel/watcher-linux-arm-musl@2.5.1": { - "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==", - "os": ["linux"], - "cpu": ["arm"] + "@eslint/eslintrc@3.3.3": { + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dependencies": [ + "ajv@6.12.6", + "debug", + "espree", + "globals@14.0.0", + "ignore@5.3.2", + "import-fresh", + "js-yaml", + "minimatch@3.1.2", + "strip-json-comments" + ] }, - "@parcel/watcher-linux-arm64-glibc@2.5.1": { - "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==", - "os": ["linux"], - "cpu": ["arm64"] + "@eslint/js@9.39.2": { + "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==" }, - "@parcel/watcher-linux-arm64-musl@2.5.1": { - "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==", - "os": ["linux"], - "cpu": ["arm64"] + "@eslint/object-schema@2.1.7": { + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==" }, - "@parcel/watcher-linux-x64-glibc@2.5.1": { - "integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==", - "os": ["linux"], - "cpu": ["x64"] + "@eslint/plugin-kit@0.4.1": { + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dependencies": [ + "@eslint/core", + "levn" + ] }, - "@parcel/watcher-linux-x64-musl@2.5.1": { - "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==", - "os": ["linux"], - "cpu": ["x64"] + "@floating-ui/core@1.7.3": { + "integrity": "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==", + "dependencies": [ + "@floating-ui/utils" + ] }, - "@parcel/watcher-win32-arm64@2.5.1": { - "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==", - "os": ["win32"], - "cpu": ["arm64"] + "@floating-ui/dom@1.7.4": { + "integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==", + "dependencies": [ + "@floating-ui/core", + "@floating-ui/utils" + ] }, - "@parcel/watcher-win32-ia32@2.5.1": { - "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==", - "os": ["win32"], - "cpu": ["ia32"] + "@floating-ui/utils@0.2.10": { + "integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==" }, - "@parcel/watcher-win32-x64@2.5.1": { - "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==", - "os": ["win32"], - "cpu": ["x64"] + "@floating-ui/vue@1.1.9_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-BfNqNW6KA83Nexspgb9DZuz578R7HT8MZw1CfK9I6Ah4QReNWEJsXWHN+SdmOVLNGmTPDi+fDT535Df5PzMLbQ==", + "dependencies": [ + "@floating-ui/dom", + "@floating-ui/utils", + "vue-demi" + ] }, - "@parcel/watcher@2.5.1": { - "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==", + "@fortawesome/fontawesome-common-types@7.1.0": { + "integrity": "sha512-l/BQM7fYntsCI//du+6sEnHOP6a74UixFyOYUyz2DLMXKx+6DEhfR3F2NYGE45XH1JJuIamacb4IZs9S0ZOWLA==" + }, + "@fortawesome/fontawesome-svg-core@7.1.0": { + "integrity": "sha512-fNxRUk1KhjSbnbuBxlWSnBLKLBNun52ZBTcs22H/xEEzM6Ap81ZFTQ4bZBxVQGQgVY0xugKGoRcCbaKjLQ3XZA==", "dependencies": [ - "detect-libc", - "is-glob@4.0.3", - "micromatch@4.0.8", - "node-addon-api" - ], - "optionalDependencies": [ - "@parcel/watcher-android-arm64", - "@parcel/watcher-darwin-arm64", - "@parcel/watcher-darwin-x64", - "@parcel/watcher-freebsd-x64", - "@parcel/watcher-linux-arm-glibc", - "@parcel/watcher-linux-arm-musl", - "@parcel/watcher-linux-arm64-glibc", - "@parcel/watcher-linux-arm64-musl", - "@parcel/watcher-linux-x64-glibc", - "@parcel/watcher-linux-x64-musl", - "@parcel/watcher-win32-arm64", - "@parcel/watcher-win32-ia32", - "@parcel/watcher-win32-x64" - ], - "scripts": true + "@fortawesome/fontawesome-common-types" + ] }, - "@pkgjs/parseargs@0.11.0": { - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==" + "@fortawesome/free-brands-svg-icons@7.1.0": { + "integrity": "sha512-9byUd9bgNfthsZAjBl6GxOu1VPHgBuRUP9juI7ZoM98h8xNPTCTagfwUFyYscdZq4Hr7gD1azMfM9s5tIWKZZA==", + "dependencies": [ + "@fortawesome/fontawesome-common-types" + ] }, - "@rollup/rollup-android-arm-eabi@4.42.0": { - "integrity": "sha512-gldmAyS9hpj+H6LpRNlcjQWbuKUtb94lodB9uCz71Jm+7BxK1VIOo7y62tZZwxhA7j1ylv/yQz080L5WkS+LoQ==", - "os": ["android"], - "cpu": ["arm"] + "@fortawesome/free-regular-svg-icons@7.1.0": { + "integrity": "sha512-0e2fdEyB4AR+e6kU4yxwA/MonnYcw/CsMEP9lH82ORFi9svA6/RhDyhxIv5mlJaldmaHLLYVTb+3iEr+PDSZuQ==", + "dependencies": [ + "@fortawesome/fontawesome-common-types" + ] }, - "@rollup/rollup-android-arm64@4.42.0": { - "integrity": "sha512-bpRipfTgmGFdCZDFLRvIkSNO1/3RGS74aWkJJTFJBH7h3MRV4UijkaEUeOMbi9wxtxYmtAbVcnMtHTPBhLEkaw==", - "os": ["android"], - "cpu": ["arm64"] + "@fortawesome/free-solid-svg-icons@7.1.0": { + "integrity": "sha512-Udu3K7SzAo9N013qt7qmm22/wo2hADdheXtBfxFTecp+ogsc0caQNRKEb7pkvvagUGOpG9wJC1ViH6WXs8oXIA==", + "dependencies": [ + "@fortawesome/fontawesome-common-types" + ] + }, + "@fortawesome/vue-fontawesome@3.1.3_@fortawesome+fontawesome-svg-core@7.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-OHHUTLPEzdwP8kcYIzhioUdUOjZ4zzmi+midwa4bqscza4OJCOvTKJEHkXNz8PgZ23kWci1HkKVX0bm8f9t9gQ==", + "dependencies": [ + "@fortawesome/fontawesome-svg-core", + "vue" + ] + }, + "@humanfs/core@0.19.1": { + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==" }, - "@rollup/rollup-darwin-arm64@4.42.0": { - "integrity": "sha512-JxHtA081izPBVCHLKnl6GEA0w3920mlJPLh89NojpU2GsBSB6ypu4erFg/Wx1qbpUbepn0jY4dVWMGZM8gplgA==", + "@humanfs/node@0.16.7": { + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dependencies": [ + "@humanfs/core", + "@humanwhocodes/retry" + ] + }, + "@humanwhocodes/module-importer@1.0.1": { + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==" + }, + "@humanwhocodes/retry@0.4.3": { + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==" + }, + "@img/colour@1.0.0": { + "integrity": "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==" + }, + "@img/sharp-darwin-arm64@0.34.5": { + "integrity": "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==", + "optionalDependencies": [ + "@img/sharp-libvips-darwin-arm64" + ], "os": ["darwin"], "cpu": ["arm64"] }, - "@rollup/rollup-darwin-x64@4.42.0": { - "integrity": "sha512-rv5UZaWVIJTDMyQ3dCEK+m0SAn6G7H3PRc2AZmExvbDvtaDc+qXkei0knQWcI3+c9tEs7iL/4I4pTQoPbNL2SA==", + "@img/sharp-darwin-x64@0.34.5": { + "integrity": "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==", + "optionalDependencies": [ + "@img/sharp-libvips-darwin-x64" + ], "os": ["darwin"], "cpu": ["x64"] }, - "@rollup/rollup-freebsd-arm64@4.42.0": { - "integrity": "sha512-fJcN4uSGPWdpVmvLuMtALUFwCHgb2XiQjuECkHT3lWLZhSQ3MBQ9pq+WoWeJq2PrNxr9rPM1Qx+IjyGj8/c6zQ==", - "os": ["freebsd"], + "@img/sharp-libvips-darwin-arm64@1.2.4": { + "integrity": "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==", + "os": ["darwin"], "cpu": ["arm64"] }, - "@rollup/rollup-freebsd-x64@4.42.0": { - "integrity": "sha512-CziHfyzpp8hJpCVE/ZdTizw58gr+m7Y2Xq5VOuCSrZR++th2xWAz4Nqk52MoIIrV3JHtVBhbBsJcAxs6NammOQ==", - "os": ["freebsd"], + "@img/sharp-libvips-darwin-x64@1.2.4": { + "integrity": "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==", + "os": ["darwin"], "cpu": ["x64"] }, - "@rollup/rollup-linux-arm-gnueabihf@4.42.0": { - "integrity": "sha512-UsQD5fyLWm2Fe5CDM7VPYAo+UC7+2Px4Y+N3AcPh/LdZu23YcuGPegQly++XEVaC8XUTFVPscl5y5Cl1twEI4A==", - "os": ["linux"], - "cpu": ["arm"] - }, - "@rollup/rollup-linux-arm-musleabihf@4.42.0": { - "integrity": "sha512-/i8NIrlgc/+4n1lnoWl1zgH7Uo0XK5xK3EDqVTf38KvyYgCU/Rm04+o1VvvzJZnVS5/cWSd07owkzcVasgfIkQ==", - "os": ["linux"], - "cpu": ["arm"] - }, - "@rollup/rollup-linux-arm64-gnu@4.42.0": { - "integrity": "sha512-eoujJFOvoIBjZEi9hJnXAbWg+Vo1Ov8n/0IKZZcPZ7JhBzxh2A+2NFyeMZIRkY9iwBvSjloKgcvnjTbGKHE44Q==", + "@img/sharp-libvips-linux-arm64@1.2.4": { + "integrity": "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==", "os": ["linux"], "cpu": ["arm64"] }, - "@rollup/rollup-linux-arm64-musl@4.42.0": { - "integrity": "sha512-/3NrcOWFSR7RQUQIuZQChLND36aTU9IYE4j+TB40VU78S+RA0IiqHR30oSh6P1S9f9/wVOenHQnacs/Byb824g==", + "@img/sharp-libvips-linux-arm@1.2.4": { + "integrity": "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==", "os": ["linux"], - "cpu": ["arm64"] - }, - "@rollup/rollup-linux-loongarch64-gnu@4.42.0": { - "integrity": "sha512-O8AplvIeavK5ABmZlKBq9/STdZlnQo7Sle0LLhVA7QT+CiGpNVe197/t8Aph9bhJqbDVGCHpY2i7QyfEDDStDg==", - "os": ["linux"], - "cpu": ["loong64"] + "cpu": ["arm"] }, - "@rollup/rollup-linux-powerpc64le-gnu@4.42.0": { - "integrity": "sha512-6Qb66tbKVN7VyQrekhEzbHRxXXFFD8QKiFAwX5v9Xt6FiJ3BnCVBuyBxa2fkFGqxOCSGGYNejxd8ht+q5SnmtA==", + "@img/sharp-libvips-linux-ppc64@1.2.4": { + "integrity": "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==", "os": ["linux"], "cpu": ["ppc64"] }, - "@rollup/rollup-linux-riscv64-gnu@4.42.0": { - "integrity": "sha512-KQETDSEBamQFvg/d8jajtRwLNBlGc3aKpaGiP/LvEbnmVUKlFta1vqJqTrvPtsYsfbE/DLg5CC9zyXRX3fnBiA==", - "os": ["linux"], - "cpu": ["riscv64"] - }, - "@rollup/rollup-linux-riscv64-musl@4.42.0": { - "integrity": "sha512-qMvnyjcU37sCo/tuC+JqeDKSuukGAd+pVlRl/oyDbkvPJ3awk6G6ua7tyum02O3lI+fio+eM5wsVd66X0jQtxw==", + "@img/sharp-libvips-linux-riscv64@1.2.4": { + "integrity": "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==", "os": ["linux"], "cpu": ["riscv64"] }, - "@rollup/rollup-linux-s390x-gnu@4.42.0": { - "integrity": "sha512-I2Y1ZUgTgU2RLddUHXTIgyrdOwljjkmcZ/VilvaEumtS3Fkuhbw4p4hgHc39Ypwvo2o7sBFNl2MquNvGCa55Iw==", + "@img/sharp-libvips-linux-s390x@1.2.4": { + "integrity": "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==", "os": ["linux"], "cpu": ["s390x"] }, - "@rollup/rollup-linux-x64-gnu@4.42.0": { - "integrity": "sha512-Gfm6cV6mj3hCUY8TqWa63DB8Mx3NADoFwiJrMpoZ1uESbK8FQV3LXkhfry+8bOniq9pqY1OdsjFWNsSbfjPugw==", + "@img/sharp-libvips-linux-x64@1.2.4": { + "integrity": "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==", "os": ["linux"], "cpu": ["x64"] }, - "@rollup/rollup-linux-x64-musl@4.42.0": { - "integrity": "sha512-g86PF8YZ9GRqkdi0VoGlcDUb4rYtQKyTD1IVtxxN4Hpe7YqLBShA7oHMKU6oKTCi3uxwW4VkIGnOaH/El8de3w==", + "@img/sharp-libvips-linuxmusl-arm64@1.2.4": { + "integrity": "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==", "os": ["linux"], - "cpu": ["x64"] - }, - "@rollup/rollup-win32-arm64-msvc@4.42.0": { - "integrity": "sha512-+axkdyDGSp6hjyzQ5m1pgcvQScfHnMCcsXkx8pTgy/6qBmWVhtRVlgxjWwDp67wEXXUr0x+vD6tp5W4x6V7u1A==", - "os": ["win32"], "cpu": ["arm64"] }, - "@rollup/rollup-win32-ia32-msvc@4.42.0": { - "integrity": "sha512-F+5J9pelstXKwRSDq92J0TEBXn2nfUrQGg+HK1+Tk7VOL09e0gBqUHugZv7SW4MGrYj41oNCUe3IKCDGVlis2g==", - "os": ["win32"], + "@img/sharp-libvips-linuxmusl-x64@1.2.4": { + "integrity": "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@img/sharp-linux-arm64@0.34.5": { + "integrity": "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-arm64" + ], + "os": ["linux"], + "cpu": ["arm64"] + }, + "@img/sharp-linux-arm@0.34.5": { + "integrity": "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-arm" + ], + "os": ["linux"], + "cpu": ["arm"] + }, + "@img/sharp-linux-ppc64@0.34.5": { + "integrity": "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-ppc64" + ], + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@img/sharp-linux-riscv64@0.34.5": { + "integrity": "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-riscv64" + ], + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@img/sharp-linux-s390x@0.34.5": { + "integrity": "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-s390x" + ], + "os": ["linux"], + "cpu": ["s390x"] + }, + "@img/sharp-linux-x64@0.34.5": { + "integrity": "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==", + "optionalDependencies": [ + "@img/sharp-libvips-linux-x64" + ], + "os": ["linux"], + "cpu": ["x64"] + }, + "@img/sharp-linuxmusl-arm64@0.34.5": { + "integrity": "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==", + "optionalDependencies": [ + "@img/sharp-libvips-linuxmusl-arm64" + ], + "os": ["linux"], + "cpu": ["arm64"] + }, + "@img/sharp-linuxmusl-x64@0.34.5": { + "integrity": "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==", + "optionalDependencies": [ + "@img/sharp-libvips-linuxmusl-x64" + ], + "os": ["linux"], + "cpu": ["x64"] + }, + "@img/sharp-wasm32@0.34.5": { + "integrity": "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==", + "dependencies": [ + "@emnapi/runtime" + ], + "cpu": ["wasm32"] + }, + "@img/sharp-win32-arm64@0.34.5": { + "integrity": "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@img/sharp-win32-ia32@0.34.5": { + "integrity": "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==", + "os": ["win32"], "cpu": ["ia32"] }, - "@rollup/rollup-win32-x64-msvc@4.42.0": { - "integrity": "sha512-LpHiJRwkaVz/LqjHjK8LCi8osq7elmpwujwbXKNW88bM8eeGxavJIKKjkjpMHAh/2xfnrt1ZSnhTv41WYUHYmA==", + "@img/sharp-win32-x64@0.34.5": { + "integrity": "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==", "os": ["win32"], "cpu": ["x64"] }, - "detect-libc@1.0.3": { - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", - "bin": true + "@jridgewell/gen-mapping@0.3.13": { + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dependencies": [ + "@jridgewell/sourcemap-codec", + "@jridgewell/trace-mapping" + ] }, - "fsevents@2.3.3": { - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "@jridgewell/remapping@2.3.5": { + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dependencies": [ + "@jridgewell/gen-mapping", + "@jridgewell/trace-mapping" + ] + }, + "@jridgewell/resolve-uri@3.1.2": { + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==" + }, + "@jridgewell/sourcemap-codec@1.5.5": { + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==" + }, + "@jridgewell/trace-mapping@0.3.31": { + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dependencies": [ + "@jridgewell/resolve-uri", + "@jridgewell/sourcemap-codec" + ] + }, + "@lezer/common@1.5.0": { + "integrity": "sha512-PNGcolp9hr4PJdXR4ix7XtixDrClScvtSCYW3rQG106oVMOOI+jFb+0+J3mbeL/53g1Zd6s0kJzaw6Ri68GmAA==" + }, + "@lezer/highlight@1.2.3": { + "integrity": "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g==", + "dependencies": [ + "@lezer/common" + ] + }, + "@lezer/json@1.0.3": { + "integrity": "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ==", + "dependencies": [ + "@lezer/common", + "@lezer/highlight", + "@lezer/lr" + ] + }, + "@lezer/lr@1.4.7": { + "integrity": "sha512-wNIFWdSUfX9Jc6ePMzxSPVgTVB4EOfDIwLQLWASyiUdHKaMsiilj9bYiGkGQCKVodd0x6bgQCV207PILGFCF9Q==", + "dependencies": [ + "@lezer/common" + ] + }, + "@lezer/yaml@1.0.3": { + "integrity": "sha512-GuBLekbw9jDBDhGur82nuwkxKQ+a3W5H0GfaAthDXcAu+XdpS43VlnxA9E9hllkpSP5ellRDKjLLj7Lu9Wr6xA==", + "dependencies": [ + "@lezer/common", + "@lezer/highlight", + "@lezer/lr" + ] + }, + "@lit-labs/ssr-dom-shim@1.5.1": { + "integrity": "sha512-Aou5UdlSpr5whQe8AA/bZG0jMj96CoJIWbGfZ91qieWu5AWUMKw8VR/pAkQkJYvBNhmCcWnZlyyk5oze8JIqYA==" + }, + "@lit/reactive-element@2.1.2": { + "integrity": "sha512-pbCDiVMnne1lYUIaYNN5wrwQXDtHaYtg7YEFPeW+hws6U47WeFvISGUWekPGKWOP1ygrs0ef0o1VJMk1exos5A==", + "dependencies": [ + "@lit-labs/ssr-dom-shim" + ] + }, + "@marijn/find-cluster-break@1.0.2": { + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==" + }, + "@nodelib/fs.scandir@2.1.5": { + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": [ + "@nodelib/fs.stat", + "run-parallel" + ] + }, + "@nodelib/fs.stat@2.0.5": { + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" + }, + "@nodelib/fs.walk@1.2.8": { + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": [ + "@nodelib/fs.scandir", + "fastq" + ] + }, + "@parcel/watcher-android-arm64@2.5.4": { + "integrity": "sha512-hoh0vx4v+b3BNI7Cjoy2/B0ARqcwVNrzN/n7DLq9ZB4I3lrsvhrkCViJyfTj/Qi5xM9YFiH4AmHGK6pgH1ss7g==", + "os": ["android"], + "cpu": ["arm64"] + }, + "@parcel/watcher-darwin-arm64@2.5.4": { + "integrity": "sha512-kphKy377pZiWpAOyTgQYPE5/XEKVMaj6VUjKT5VkNyUJlr2qZAn8gIc7CPzx+kbhvqHDT9d7EqdOqRXT6vk0zw==", + "os": ["darwin"], + "cpu": ["arm64"] + }, + "@parcel/watcher-darwin-x64@2.5.4": { + "integrity": "sha512-UKaQFhCtNJW1A9YyVz3Ju7ydf6QgrpNQfRZ35wNKUhTQ3dxJ/3MULXN5JN/0Z80V/KUBDGa3RZaKq1EQT2a2gg==", "os": ["darwin"], + "cpu": ["x64"] + }, + "@parcel/watcher-freebsd-x64@2.5.4": { + "integrity": "sha512-Dib0Wv3Ow/m2/ttvLdeI2DBXloO7t3Z0oCp4bAb2aqyqOjKPPGrg10pMJJAQ7tt8P4V2rwYwywkDhUia/FgS+Q==", + "os": ["freebsd"], + "cpu": ["x64"] + }, + "@parcel/watcher-linux-arm-glibc@2.5.4": { + "integrity": "sha512-I5Vb769pdf7Q7Sf4KNy8Pogl/URRCKu9ImMmnVKYayhynuyGYMzuI4UOWnegQNa2sGpsPSbzDsqbHNMyeyPCgw==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@parcel/watcher-linux-arm-musl@2.5.4": { + "integrity": "sha512-kGO8RPvVrcAotV4QcWh8kZuHr9bXi9a3bSZw7kFarYR0+fGliU7hd/zevhjw8fnvIKG3J9EO5G6sXNGCSNMYPQ==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@parcel/watcher-linux-arm64-glibc@2.5.4": { + "integrity": "sha512-KU75aooXhqGFY2W5/p8DYYHt4hrjHZod8AhcGAmhzPn/etTa+lYCDB2b1sJy3sWJ8ahFVTdy+EbqSBvMx3iFlw==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@parcel/watcher-linux-arm64-musl@2.5.4": { + "integrity": "sha512-Qx8uNiIekVutnzbVdrgSanM+cbpDD3boB1f8vMtnuG5Zau4/bdDbXyKwIn0ToqFhIuob73bcxV9NwRm04/hzHQ==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@parcel/watcher-linux-x64-glibc@2.5.4": { + "integrity": "sha512-UYBQvhYmgAv61LNUn24qGQdjtycFBKSK3EXr72DbJqX9aaLbtCOO8+1SkKhD/GNiJ97ExgcHBrukcYhVjrnogA==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@parcel/watcher-linux-x64-musl@2.5.4": { + "integrity": "sha512-YoRWCVgxv8akZrMhdyVi6/TyoeeMkQ0PGGOf2E4omODrvd1wxniXP+DBynKoHryStks7l+fDAMUBRzqNHrVOpg==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@parcel/watcher-win32-arm64@2.5.4": { + "integrity": "sha512-iby+D/YNXWkiQNYcIhg8P5hSjzXEHaQrk2SLrWOUD7VeC4Ohu0WQvmV+HDJokZVJ2UjJ4AGXW3bx7Lls9Ln4TQ==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@parcel/watcher-win32-ia32@2.5.4": { + "integrity": "sha512-vQN+KIReG0a2ZDpVv8cgddlf67J8hk1WfZMMP7sMeZmJRSmEax5xNDNWKdgqSe2brOKTQQAs3aCCUal2qBHAyg==", + "os": ["win32"], + "cpu": ["ia32"] + }, + "@parcel/watcher-win32-x64@2.5.4": { + "integrity": "sha512-3A6efb6BOKwyw7yk9ro2vus2YTt2nvcd56AuzxdMiVOxL9umDyN5PKkKfZ/gZ9row41SjVmTVQNWQhaRRGpOKw==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@parcel/watcher@2.5.4": { + "integrity": "sha512-WYa2tUVV5HiArWPB3ydlOc4R2ivq0IDrlqhMi3l7mVsFEXNcTfxYFPIHXHXIh/ca/y/V5N4E1zecyxdIBjYnkQ==", + "dependencies": [ + "detect-libc", + "is-glob", + "node-addon-api", + "picomatch@4.0.3" + ], + "optionalDependencies": [ + "@parcel/watcher-android-arm64", + "@parcel/watcher-darwin-arm64", + "@parcel/watcher-darwin-x64", + "@parcel/watcher-freebsd-x64", + "@parcel/watcher-linux-arm-glibc", + "@parcel/watcher-linux-arm-musl", + "@parcel/watcher-linux-arm64-glibc", + "@parcel/watcher-linux-arm64-musl", + "@parcel/watcher-linux-x64-glibc", + "@parcel/watcher-linux-x64-musl", + "@parcel/watcher-win32-arm64", + "@parcel/watcher-win32-ia32", + "@parcel/watcher-win32-x64" + ], "scripts": true }, - "node-addon-api@7.1.1": { - "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==" + "@pkgr/core@0.2.9": { + "integrity": "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==" + }, + "@polka/url@1.0.0-next.29": { + "integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==" + }, + "@popperjs/core@2.11.8": { + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==" + }, + "@prettier/plugin-pug@3.4.2_prettier@3.8.0": { + "integrity": "sha512-/VOVeIscKYlPpsZrjrRV+44ZftCEIJq9Z/zR8PtAz/EDv82TKscw3z+fhTVqRz68G1TqQ/5COMFUVfPwPBH90w==", + "dependencies": [ + "prettier@3.8.0", + "pug-lexer" + ] + }, + "@replit/codemirror-vim@6.3.0_@codemirror+commands@6.10.1_@codemirror+language@6.12.1_@codemirror+search@6.6.0_@codemirror+state@6.5.4_@codemirror+view@6.39.11": { + "integrity": "sha512-aTx931ULAMuJx6xLf7KQDOL7CxD+Sa05FktTDrtLaSy53uj01ll3Zf17JdKsriER248oS55GBzg0CfCTjEneAQ==", + "dependencies": [ + "@codemirror/commands", + "@codemirror/language", + "@codemirror/search", + "@codemirror/state", + "@codemirror/view" + ] + }, + "@rolldown/pluginutils@1.0.0-beta.53": { + "integrity": "sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==" + }, + "@rollup/rollup-android-arm-eabi@4.55.2": { + "integrity": "sha512-21J6xzayjy3O6NdnlO6aXi/urvSRjm6nCI6+nF6ra2YofKruGixN9kfT+dt55HVNwfDmpDHJcaS3JuP/boNnlA==", + "os": ["android"], + "cpu": ["arm"] + }, + "@rollup/rollup-android-arm64@4.55.2": { + "integrity": "sha512-eXBg7ibkNUZ+sTwbFiDKou0BAckeV6kIigK7y5Ko4mB/5A1KLhuzEKovsmfvsL8mQorkoincMFGnQuIT92SKqA==", + "os": ["android"], + "cpu": ["arm64"] + }, + "@rollup/rollup-darwin-arm64@4.55.2": { + "integrity": "sha512-UCbaTklREjrc5U47ypLulAgg4njaqfOVLU18VrCrI+6E5MQjuG0lSWaqLlAJwsD7NpFV249XgB0Bi37Zh5Sz4g==", + "os": ["darwin"], + "cpu": ["arm64"] + }, + "@rollup/rollup-darwin-x64@4.55.2": { + "integrity": "sha512-dP67MA0cCMHFT2g5XyjtpVOtp7y4UyUxN3dhLdt11at5cPKnSm4lY+EhwNvDXIMzAMIo2KU+mc9wxaAQJTn7sQ==", + "os": ["darwin"], + "cpu": ["x64"] + }, + "@rollup/rollup-freebsd-arm64@4.55.2": { + "integrity": "sha512-WDUPLUwfYV9G1yxNRJdXcvISW15mpvod1Wv3ok+Ws93w1HjIVmCIFxsG2DquO+3usMNCpJQ0wqO+3GhFdl6Fow==", + "os": ["freebsd"], + "cpu": ["arm64"] + }, + "@rollup/rollup-freebsd-x64@4.55.2": { + "integrity": "sha512-Ng95wtHVEulRwn7R0tMrlUuiLVL/HXA8Lt/MYVpy88+s5ikpntzZba1qEulTuPnPIZuOPcW9wNEiqvZxZmgmqQ==", + "os": ["freebsd"], + "cpu": ["x64"] + }, + "@rollup/rollup-linux-arm-gnueabihf@4.55.2": { + "integrity": "sha512-AEXMESUDWWGqD6LwO/HkqCZgUE1VCJ1OhbvYGsfqX2Y6w5quSXuyoy/Fg3nRqiwro+cJYFxiw5v4kB2ZDLhxrw==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@rollup/rollup-linux-arm-musleabihf@4.55.2": { + "integrity": "sha512-ZV7EljjBDwBBBSv570VWj0hiNTdHt9uGznDtznBB4Caj3ch5rgD4I2K1GQrtbvJ/QiB+663lLgOdcADMNVC29Q==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@rollup/rollup-linux-arm64-gnu@4.55.2": { + "integrity": "sha512-uvjwc8NtQVPAJtq4Tt7Q49FOodjfbf6NpqXyW/rjXoV+iZ3EJAHLNAnKT5UJBc6ffQVgmXTUL2ifYiLABlGFqA==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@rollup/rollup-linux-arm64-musl@4.55.2": { + "integrity": "sha512-s3KoWVNnye9mm/2WpOZ3JeUiediUVw6AvY/H7jNA6qgKA2V2aM25lMkVarTDfiicn/DLq3O0a81jncXszoyCFA==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@rollup/rollup-linux-loong64-gnu@4.55.2": { + "integrity": "sha512-gi21faacK+J8aVSyAUptML9VQN26JRxe484IbF+h3hpG+sNVoMXPduhREz2CcYr5my0NE3MjVvQ5bMKX71pfVA==", + "os": ["linux"], + "cpu": ["loong64"] + }, + "@rollup/rollup-linux-loong64-musl@4.55.2": { + "integrity": "sha512-qSlWiXnVaS/ceqXNfnoFZh4IiCA0EwvCivivTGbEu1qv2o+WTHpn1zNmCTAoOG5QaVr2/yhCoLScQtc/7RxshA==", + "os": ["linux"], + "cpu": ["loong64"] + }, + "@rollup/rollup-linux-ppc64-gnu@4.55.2": { + "integrity": "sha512-rPyuLFNoF1B0+wolH277E780NUKf+KoEDb3OyoLbAO18BbeKi++YN6gC/zuJoPPDlQRL3fIxHxCxVEWiem2yXw==", + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@rollup/rollup-linux-ppc64-musl@4.55.2": { + "integrity": "sha512-g+0ZLMook31iWV4PvqKU0i9E78gaZgYpSrYPed/4Bu+nGTgfOPtfs1h11tSSRPXSjC5EzLTjV/1A7L2Vr8pJoQ==", + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@rollup/rollup-linux-riscv64-gnu@4.55.2": { + "integrity": "sha512-i+sGeRGsjKZcQRh3BRfpLsM3LX3bi4AoEVqmGDyc50L6KfYsN45wVCSz70iQMwPWr3E5opSiLOwsC9WB4/1pqg==", + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@rollup/rollup-linux-riscv64-musl@4.55.2": { + "integrity": "sha512-C1vLcKc4MfFV6I0aWsC7B2Y9QcsiEcvKkfxprwkPfLaN8hQf0/fKHwSF2lcYzA9g4imqnhic729VB9Fo70HO3Q==", + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@rollup/rollup-linux-s390x-gnu@4.55.2": { + "integrity": "sha512-68gHUK/howpQjh7g7hlD9DvTTt4sNLp1Bb+Yzw2Ki0xvscm2cOdCLZNJNhd2jW8lsTPrHAHuF751BygifW4bkQ==", + "os": ["linux"], + "cpu": ["s390x"] + }, + "@rollup/rollup-linux-x64-gnu@4.55.2": { + "integrity": "sha512-1e30XAuaBP1MAizaOBApsgeGZge2/Byd6wV4a8oa6jPdHELbRHBiw7wvo4dp7Ie2PE8TZT4pj9RLGZv9N4qwlw==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@rollup/rollup-linux-x64-musl@4.55.2": { + "integrity": "sha512-4BJucJBGbuGnH6q7kpPqGJGzZnYrpAzRd60HQSt3OpX/6/YVgSsJnNzR8Ot74io50SeVT4CtCWe/RYIAymFPwA==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@rollup/rollup-openbsd-x64@4.55.2": { + "integrity": "sha512-cT2MmXySMo58ENv8p6/O6wI/h/gLnD3D6JoajwXFZH6X9jz4hARqUhWpGuQhOgLNXscfZYRQMJvZDtWNzMAIDw==", + "os": ["openbsd"], + "cpu": ["x64"] + }, + "@rollup/rollup-openharmony-arm64@4.55.2": { + "integrity": "sha512-sZnyUgGkuzIXaK3jNMPmUIyJrxu/PjmATQrocpGA1WbCPX8H5tfGgRSuYtqBYAvLuIGp8SPRb1O4d1Fkb5fXaQ==", + "os": ["openharmony"], + "cpu": ["arm64"] + }, + "@rollup/rollup-win32-arm64-msvc@4.55.2": { + "integrity": "sha512-sDpFbenhmWjNcEbBcoTV0PWvW5rPJFvu+P7XoTY0YLGRupgLbFY0XPfwIbJOObzO7QgkRDANh65RjhPmgSaAjQ==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@rollup/rollup-win32-ia32-msvc@4.55.2": { + "integrity": "sha512-GvJ03TqqaweWCigtKQVBErw2bEhu1tyfNQbarwr94wCGnczA9HF8wqEe3U/Lfu6EdeNP0p6R+APeHVwEqVxpUQ==", + "os": ["win32"], + "cpu": ["ia32"] + }, + "@rollup/rollup-win32-x64-gnu@4.55.2": { + "integrity": "sha512-KvXsBvp13oZz9JGe5NYS7FNizLe99Ny+W8ETsuCyjXiKdiGrcz2/J/N8qxZ/RSwivqjQguug07NLHqrIHrqfYw==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@rollup/rollup-win32-x64-msvc@4.55.2": { + "integrity": "sha512-xNO+fksQhsAckRtDSPWaMeT1uIM+JrDRXlerpnWNXhn1TdB3YZ6uKBMBTKP0eX9XtYEP978hHk1f8332i2AW8Q==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@sagold/json-pointer@5.1.2": { + "integrity": "sha512-+wAhJZBXa6MNxRScg6tkqEbChEHMgVZAhTHVJ60Y7sbtXtu9XA49KfUkdWlS2x78D6H9nryiKePiYozumauPfA==" + }, + "@sagold/json-query@6.2.0": { + "integrity": "sha512-7bOIdUE6eHeoWtFm8TvHQHfTVSZuCs+3RpOKmZCDBIOrxpvF/rNFTeuvIyjHva/RR0yVS3kQtr+9TW72LQEZjA==", + "dependencies": [ + "@sagold/json-pointer", + "ebnf" + ] + }, + "@shikijs/core@1.29.2": { + "integrity": "sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ==", + "dependencies": [ + "@shikijs/engine-javascript", + "@shikijs/engine-oniguruma", + "@shikijs/types", + "@shikijs/vscode-textmate", + "@types/hast", + "hast-util-to-html" + ] + }, + "@shikijs/engine-javascript@1.29.2": { + "integrity": "sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A==", + "dependencies": [ + "@shikijs/types", + "@shikijs/vscode-textmate", + "oniguruma-to-es" + ] + }, + "@shikijs/engine-oniguruma@1.29.2": { + "integrity": "sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==", + "dependencies": [ + "@shikijs/types", + "@shikijs/vscode-textmate" + ] + }, + "@shikijs/langs@1.29.2": { + "integrity": "sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ==", + "dependencies": [ + "@shikijs/types" + ] + }, + "@shikijs/markdown-it@1.29.2": { + "integrity": "sha512-RPHqGU8RGQZ2TGMnEqLnSyM9CjPSjb0f8bwSLnJgBmWPWguoygoaFyYkXG0kwMtBtChNYsqQz1C0fLcbo6dY8g==", + "dependencies": [ + "markdown-it", + "shiki" + ] + }, + "@shikijs/themes@1.29.2": { + "integrity": "sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g==", + "dependencies": [ + "@shikijs/types" + ] + }, + "@shikijs/types@1.29.2": { + "integrity": "sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==", + "dependencies": [ + "@shikijs/vscode-textmate", + "@types/hast" + ] + }, + "@shikijs/vscode-textmate@10.0.2": { + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==" + }, + "@tsconfig/node22@22.0.5": { + "integrity": "sha512-hLf2ld+sYN/BtOJjHUWOk568dvjFQkHnLNa6zce25GIH+vxKfvTgm3qpaH6ToF5tu/NN0IH66s+Bb5wElHrLcw==" + }, + "@types/colors@1.2.4": { + "integrity": "sha512-oSQxEVIDcYisAzWLa+wr50GSIPu8ml4PsKNJzgrDX3SmEHVBBqbaUurqsUceFauNlCRxNtENKkQm3yOe3m3nfg==", + "dependencies": [ + "colors" + ], + "deprecated": true + }, + "@types/estree@1.0.8": { + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==" + }, + "@types/hast@3.0.4": { + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dependencies": [ + "@types/unist" + ] + }, + "@types/humanize-duration@3.27.4": { + "integrity": "sha512-yaf7kan2Sq0goxpbcwTQ+8E9RP6HutFBPv74T/IA/ojcHKhuKVlk2YFYyHhWZeLvZPzzLE3aatuQB4h0iqyyUA==" + }, + "@types/js-yaml@4.0.9": { + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==" + }, + "@types/json-schema@7.0.15": { + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" + }, + "@types/mdast@4.0.4": { + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dependencies": [ + "@types/unist" + ] + }, + "@types/node@24.10.9": { + "integrity": "sha512-ne4A0IpG3+2ETuREInjPNhUGis1SFjv1d5asp8MzEAGtOZeTeHVDOYqOgqfhvseqg/iXty2hjBf1zAOb7RNiNw==", + "dependencies": [ + "undici-types" + ] + }, + "@types/react@19.2.8": { + "integrity": "sha512-3MbSL37jEchWZz2p2mjntRZtPt837ij10ApxKfgmXCTuHWagYg7iA5bqPw6C8BMPfwidlvfPI/fxOc42HLhcyg==", + "dependencies": [ + "csstype" + ] + }, + "@types/trusted-types@2.0.7": { + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" + }, + "@types/unist@3.0.3": { + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==" + }, + "@types/web-bluetooth@0.0.21": { + "integrity": "sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==" + }, + "@types/yargs-parser@21.0.3": { + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==" + }, + "@types/yargs@17.0.35": { + "integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==", + "dependencies": [ + "@types/yargs-parser" + ] + }, + "@typescript-eslint/eslint-plugin@8.53.1_@typescript-eslint+parser@8.53.1__eslint@9.39.2___jiti@2.6.1__typescript@5.9.3__jiti@2.6.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1": { + "integrity": "sha512-cFYYFZ+oQFi6hUnBTbLRXfTJiaQtYE3t4O692agbBl+2Zy+eqSKWtPjhPXJu1G7j4RLjKgeJPDdq3EqOwmX5Ag==", + "dependencies": [ + "@eslint-community/regexpp", + "@typescript-eslint/parser", + "@typescript-eslint/scope-manager", + "@typescript-eslint/type-utils", + "@typescript-eslint/utils", + "@typescript-eslint/visitor-keys", + "eslint", + "ignore@7.0.5", + "natural-compare", + "ts-api-utils", + "typescript" + ] + }, + "@typescript-eslint/parser@8.53.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1": { + "integrity": "sha512-nm3cvFN9SqZGXjmw5bZ6cGmvJSyJPn0wU9gHAZZHDnZl2wF9PhHv78Xf06E0MaNk4zLVHL8hb2/c32XvyJOLQg==", + "dependencies": [ + "@typescript-eslint/scope-manager", + "@typescript-eslint/types", + "@typescript-eslint/typescript-estree", + "@typescript-eslint/visitor-keys", + "debug", + "eslint", + "typescript" + ] + }, + "@typescript-eslint/project-service@8.53.1_typescript@5.9.3": { + "integrity": "sha512-WYC4FB5Ra0xidsmlPb+1SsnaSKPmS3gsjIARwbEkHkoWloQmuzcfypljaJcR78uyLA1h8sHdWWPHSLDI+MtNog==", + "dependencies": [ + "@typescript-eslint/tsconfig-utils", + "@typescript-eslint/types", + "debug", + "typescript" + ] + }, + "@typescript-eslint/scope-manager@8.53.1": { + "integrity": "sha512-Lu23yw1uJMFY8cUeq7JlrizAgeQvWugNQzJp8C3x8Eo5Jw5Q2ykMdiiTB9vBVOOUBysMzmRRmUfwFrZuI2C4SQ==", + "dependencies": [ + "@typescript-eslint/types", + "@typescript-eslint/visitor-keys" + ] + }, + "@typescript-eslint/tsconfig-utils@8.53.1_typescript@5.9.3": { + "integrity": "sha512-qfvLXS6F6b1y43pnf0pPbXJ+YoXIC7HKg0UGZ27uMIemKMKA6XH2DTxsEDdpdN29D+vHV07x/pnlPNVLhdhWiA==", + "dependencies": [ + "typescript" + ] + }, + "@typescript-eslint/type-utils@8.53.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1": { + "integrity": "sha512-MOrdtNvyhy0rHyv0ENzub1d4wQYKb2NmIqG7qEqPWFW7Mpy2jzFC3pQ2yKDvirZB7jypm5uGjF2Qqs6OIqu47w==", + "dependencies": [ + "@typescript-eslint/types", + "@typescript-eslint/typescript-estree", + "@typescript-eslint/utils", + "debug", + "eslint", + "ts-api-utils", + "typescript" + ] + }, + "@typescript-eslint/types@8.53.1": { + "integrity": "sha512-jr/swrr2aRmUAUjW5/zQHbMaui//vQlsZcJKijZf3M26bnmLj8LyZUpj8/Rd6uzaek06OWsqdofN/Thenm5O8A==" + }, + "@typescript-eslint/typescript-estree@8.53.1_typescript@5.9.3": { + "integrity": "sha512-RGlVipGhQAG4GxV1s34O91cxQ/vWiHJTDHbXRr0li2q/BGg3RR/7NM8QDWgkEgrwQYCvmJV9ichIwyoKCQ+DTg==", + "dependencies": [ + "@typescript-eslint/project-service", + "@typescript-eslint/tsconfig-utils", + "@typescript-eslint/types", + "@typescript-eslint/visitor-keys", + "debug", + "minimatch@9.0.5", + "semver@7.7.3", + "tinyglobby", + "ts-api-utils", + "typescript" + ] + }, + "@typescript-eslint/utils@8.53.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1": { + "integrity": "sha512-c4bMvGVWW4hv6JmDUEG7fSYlWOl3II2I4ylt0NM+seinYQlZMQIaKaXIIVJWt9Ofh6whrpM+EdDQXKXjNovvrg==", + "dependencies": [ + "@eslint-community/eslint-utils", + "@typescript-eslint/scope-manager", + "@typescript-eslint/types", + "@typescript-eslint/typescript-estree", + "eslint", + "typescript" + ] + }, + "@typescript-eslint/visitor-keys@8.53.1": { + "integrity": "sha512-oy+wV7xDKFPRyNggmXuZQSBzvoLnpmJs+GhzRhPjrxl2b/jIlyjVokzm47CZCDUdXKr2zd7ZLodPfOBpOPyPlg==", + "dependencies": [ + "@typescript-eslint/types", + "eslint-visitor-keys@4.2.1" + ] + }, + "@uiw/codemirror-themes@4.25.4_@codemirror+language@6.12.1_@codemirror+state@6.5.4_@codemirror+view@6.39.11": { + "integrity": "sha512-2SLktItgcZC4p0+PfFusEbAHwbuAWe3bOOntCevVgHtrWGtGZX3IPv2k8IKZMgOXtAHyGKpJvT9/nspPn/uCQg==", + "dependencies": [ + "@codemirror/language", + "@codemirror/state", + "@codemirror/view" + ] + }, + "@ungap/structured-clone@1.3.0": { + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==" + }, + "@vitejs/plugin-vue@6.0.3_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_vue@3.5.27__typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_typescript@5.9.3": { + "integrity": "sha512-TlGPkLFLVOY3T7fZrwdvKpjprR3s4fxRln0ORDo1VQ7HHyxJwTlrjKU3kpVWTlaAjIEuCTokmjkZnr8Tpc925w==", + "dependencies": [ + "@rolldown/pluginutils", + "vite", + "vue" + ] + }, + "@volar/language-core@2.4.27": { + "integrity": "sha512-DjmjBWZ4tJKxfNC1F6HyYERNHPYS7L7OPFyCrestykNdUZMFYzI9WTyvwPcaNaHlrEUwESHYsfEw3isInncZxQ==", + "dependencies": [ + "@volar/source-map" + ] + }, + "@volar/source-map@2.4.27": { + "integrity": "sha512-ynlcBReMgOZj2i6po+qVswtDUeeBRCTgDurjMGShbm8WYZgJ0PA4RmtebBJ0BCYol1qPv3GQF6jK7C9qoVc7lg==" + }, + "@volar/typescript@2.4.27": { + "integrity": "sha512-eWaYCcl/uAPInSK2Lze6IqVWaBu/itVqR5InXcHXFyles4zO++Mglt3oxdgj75BDcv1Knr9Y93nowS8U3wqhxg==", + "dependencies": [ + "@volar/language-core", + "path-browserify", + "vscode-uri" + ] + }, + "@vue/babel-helper-vue-transform-on@1.5.0": { + "integrity": "sha512-0dAYkerNhhHutHZ34JtTl2czVQHUNWv6xEbkdF5W+Yrv5pCWsqjeORdOgbtW2I9gWlt+wBmVn+ttqN9ZxR5tzA==" + }, + "@vue/babel-plugin-jsx@1.5.0_@babel+core@7.28.6": { + "integrity": "sha512-mneBhw1oOqCd2247O0Yw/mRwC9jIGACAJUlawkmMBiNmL4dGA2eMzuNZVNqOUfYTa6vqmND4CtOPzmEEEqLKFw==", + "dependencies": [ + "@babel/core", + "@babel/helper-module-imports", + "@babel/helper-plugin-utils", + "@babel/plugin-syntax-jsx", + "@babel/template", + "@babel/traverse", + "@babel/types", + "@vue/babel-helper-vue-transform-on", + "@vue/babel-plugin-resolve-type", + "@vue/shared" + ], + "optionalPeers": [ + "@babel/core" + ] + }, + "@vue/babel-plugin-resolve-type@1.5.0_@babel+core@7.28.6": { + "integrity": "sha512-Wm/60o+53JwJODm4Knz47dxJnLDJ9FnKnGZJbUUf8nQRAtt6P+undLUAVU3Ha33LxOJe6IPoifRQ6F/0RrU31w==", + "dependencies": [ + "@babel/code-frame", + "@babel/core", + "@babel/helper-module-imports", + "@babel/helper-plugin-utils", + "@babel/parser", + "@vue/compiler-sfc" + ] + }, + "@vue/compiler-core@3.5.27": { + "integrity": "sha512-gnSBQjZA+//qDZen+6a2EdHqJ68Z7uybrMf3SPjEGgG4dicklwDVmMC1AeIHxtLVPT7sn6sH1KOO+tS6gwOUeQ==", + "dependencies": [ + "@babel/parser", + "@vue/shared", + "entities@7.0.0", + "estree-walker", + "source-map-js" + ] + }, + "@vue/compiler-dom@3.5.27": { + "integrity": "sha512-oAFea8dZgCtVVVTEC7fv3T5CbZW9BxpFzGGxC79xakTr6ooeEqmRuvQydIiDAkglZEAd09LgVf1RoDnL54fu5w==", + "dependencies": [ + "@vue/compiler-core", + "@vue/shared" + ] + }, + "@vue/compiler-sfc@3.5.27": { + "integrity": "sha512-sHZu9QyDPeDmN/MRoshhggVOWE5WlGFStKFwu8G52swATgSny27hJRWteKDSUUzUH+wp+bmeNbhJnEAel/auUQ==", + "dependencies": [ + "@babel/parser", + "@vue/compiler-core", + "@vue/compiler-dom", + "@vue/compiler-ssr", + "@vue/shared", + "estree-walker", + "magic-string", + "postcss", + "source-map-js" + ] + }, + "@vue/compiler-ssr@3.5.27": { + "integrity": "sha512-Sj7h+JHt512fV1cTxKlYhg7qxBvack+BGncSpH+8vnN+KN95iPIcqB5rsbblX40XorP+ilO7VIKlkuu3Xq2vjw==", + "dependencies": [ + "@vue/compiler-dom", + "@vue/shared" + ] + }, + "@vue/devtools-api@6.6.4": { + "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==" + }, + "@vue/devtools-core@8.0.5_vue@3.5.27__typescript@5.9.3_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-dpCw8nl0GDBuiL9SaY0mtDxoGIEmU38w+TQiYEPOLhW03VDC0lfNMYXS/qhl4I0YlysGp04NLY4UNn6xgD0VIQ==", + "dependencies": [ + "@vue/devtools-kit", + "@vue/devtools-shared", + "mitt", + "nanoid@5.1.6", + "pathe", + "vite-hot-client", + "vue" + ] + }, + "@vue/devtools-kit@8.0.5": { + "integrity": "sha512-q2VV6x1U3KJMTQPUlRMyWEKVbcHuxhqJdSr6Jtjz5uAThAIrfJ6WVZdGZm5cuO63ZnSUz0RCsVwiUUb0mDV0Yg==", + "dependencies": [ + "@vue/devtools-shared", + "birpc", + "hookable", + "mitt", + "perfect-debounce", + "speakingurl", + "superjson" + ] + }, + "@vue/devtools-shared@8.0.5": { + "integrity": "sha512-bRLn6/spxpmgLk+iwOrR29KrYnJjG9DGpHGkDFG82UM21ZpJ39ztUT9OXX3g+usW7/b2z+h46I9ZiYyB07XMXg==", + "dependencies": [ + "rfdc" + ] + }, + "@vue/eslint-config-prettier@10.2.0_eslint@9.39.2__jiti@2.6.1_prettier@3.8.0_jiti@2.6.1_eslint-config-prettier@10.1.8__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1": { + "integrity": "sha512-GL3YBLwv/+b86yHcNNfPJxOTtVFJ4Mbc9UU3zR+KVoG7SwGTjPT+32fXamscNumElhcpXW3mT0DgzS9w32S7Bw==", + "dependencies": [ + "eslint", + "eslint-config-prettier", + "eslint-plugin-prettier", + "prettier@3.8.0" + ] + }, + "@vue/eslint-config-typescript@14.6.0_eslint@9.39.2__jiti@2.6.1_eslint-plugin-vue@10.7.0__eslint@9.39.2___jiti@2.6.1__vue-eslint-parser@10.2.0___eslint@9.39.2____jiti@2.6.1___jiti@2.6.1__jiti@2.6.1_typescript@5.9.3_jiti@2.6.1_vue-eslint-parser@10.2.0__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1": { + "integrity": "sha512-UpiRY/7go4Yps4mYCjkvlIbVWmn9YvPGQDxTAlcKLphyaD77LjIu3plH4Y9zNT0GB4f3K5tMmhhtRhPOgrQ/bQ==", + "dependencies": [ + "@typescript-eslint/utils", + "eslint", + "eslint-plugin-vue", + "fast-glob", + "typescript", + "typescript-eslint", + "vue-eslint-parser" + ], + "optionalPeers": [ + "typescript" + ] + }, + "@vue/language-core@3.2.2": { + "integrity": "sha512-5DAuhxsxBN9kbriklh3Q5AMaJhyOCNiQJvCskN9/30XOpdLiqZU9Q+WvjArP17ubdGEyZtBzlIeG5nIjEbNOrQ==", + "dependencies": [ + "@volar/language-core", + "@vue/compiler-dom", + "@vue/shared", + "alien-signals", + "muggle-string", + "path-browserify", + "picomatch@4.0.3" + ] + }, + "@vue/reactivity@3.5.27": { + "integrity": "sha512-vvorxn2KXfJ0nBEnj4GYshSgsyMNFnIQah/wczXlsNXt+ijhugmW+PpJ2cNPe4V6jpnBcs0MhCODKllWG+nvoQ==", + "dependencies": [ + "@vue/shared" + ] + }, + "@vue/runtime-core@3.5.27": { + "integrity": "sha512-fxVuX/fzgzeMPn/CLQecWeDIFNt3gQVhxM0rW02Tvp/YmZfXQgcTXlakq7IMutuZ/+Ogbn+K0oct9J3JZfyk3A==", + "dependencies": [ + "@vue/reactivity", + "@vue/shared" + ] + }, + "@vue/runtime-dom@3.5.27": { + "integrity": "sha512-/QnLslQgYqSJ5aUmb5F0z0caZPGHRB8LEAQ1s81vHFM5CBfnun63rxhvE/scVb/j3TbBuoZwkJyiLCkBluMpeg==", + "dependencies": [ + "@vue/reactivity", + "@vue/runtime-core", + "@vue/shared", + "csstype" + ] + }, + "@vue/server-renderer@3.5.27_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-qOz/5thjeP1vAFc4+BY3Nr6wxyLhpeQgAE/8dDtKo6a6xdk+L4W46HDZgNmLOBUDEkFXV3G7pRiUqxjX0/2zWA==", + "dependencies": [ + "@vue/compiler-ssr", + "@vue/shared", + "vue" + ] + }, + "@vue/shared@3.5.27": { + "integrity": "sha512-dXr/3CgqXsJkZ0n9F3I4elY8wM9jMJpP3pvRG52r6m0tu/MsAFIe6JpXVGeNMd/D9F4hQynWT8Rfuj0bdm9kFQ==" + }, + "@vue/tsconfig@0.8.1_typescript@5.9.3_vue@3.5.27__typescript@5.9.3": { + "integrity": "sha512-aK7feIWPXFSUhsCP9PFqPyFOcz4ENkb8hZ2pneL6m2UjCkccvaOhC/5KCKluuBufvp2KzkbdA2W2pk20vLzu3g==", + "dependencies": [ + "typescript", + "vue" + ], + "optionalPeers": [ + "typescript", + "vue" + ] + }, + "@vueuse/core@14.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-rgBinKs07hAYyPF834mDTigH7BtPqvZ3Pryuzt1SD/lg5wEcWqvwzXXYGEDb2/cP0Sj5zSvHl3WkmMELr5kfWw==", + "dependencies": [ + "@types/web-bluetooth", + "@vueuse/metadata", + "@vueuse/shared", + "vue" + ] + }, + "@vueuse/metadata@14.1.0": { + "integrity": "sha512-7hK4g015rWn2PhKcZ99NyT+ZD9sbwm7SGvp7k+k+rKGWnLjS/oQozoIZzWfCewSUeBmnJkIb+CNr7Zc/EyRnnA==" + }, + "@vueuse/shared@14.1.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-EcKxtYvn6gx1F8z9J5/rsg3+lTQnvOruQd8fUecW99DCK04BkWD7z5KQ/wTAx+DazyoEE9dJt/zV8OIEQbM6kw==", + "dependencies": [ + "vue" + ] + }, + "@wokwi/elements@1.9.1": { + "integrity": "sha512-YAEv35q4Ufo3d3MjlRxs2Y7nwEgn0gLFFE7rkYHmjRpUZCgpj6CYeTGVTRwvWewrBHVsTWriKEDKxD7lHmg0VQ==", + "dependencies": [ + "@types/react", + "lit" + ] + }, + "@xterm/addon-fit@0.10.0_@xterm+xterm@5.5.0": { + "integrity": "sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ==", + "dependencies": [ + "@xterm/xterm" + ] + }, + "@xterm/addon-web-links@0.11.0_@xterm+xterm@5.5.0": { + "integrity": "sha512-nIHQ38pQI+a5kXnRaTgwqSHnX7KE6+4SVoceompgHL26unAxdfP6IPqUTSYPQgSwM56hsElfoNrrW5V7BUED/Q==", + "dependencies": [ + "@xterm/xterm" + ] + }, + "@xterm/xterm@5.5.0": { + "integrity": "sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==" + }, + "acorn-jsx@5.3.2_acorn@8.15.0": { + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dependencies": [ + "acorn@8.15.0" + ] + }, + "acorn@7.4.1": { + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "bin": true + }, + "acorn@8.15.0": { + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "bin": true + }, + "ajv@6.12.6": { + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": [ + "fast-deep-equal", + "fast-json-stable-stringify", + "json-schema-traverse@0.4.1", + "uri-js" + ] + }, + "ajv@8.17.1": { + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dependencies": [ + "fast-deep-equal", + "fast-uri", + "json-schema-traverse@1.0.0", + "require-from-string" + ] + }, + "alien-signals@3.1.2": { + "integrity": "sha512-d9dYqZTS90WLiU0I5c6DHj/HcKkF8ZyGN3G5x8wSbslulz70KOxaqCT0hQCo9KOyhVqzqGojvNdJXoTumZOtcw==" + }, + "ansi-colors@4.1.3": { + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==" + }, + "ansi-regex@6.2.2": { + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==" + }, + "ansi-styles@4.3.0": { + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": [ + "color-convert" + ] + }, + "ansi-styles@6.2.3": { + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==" + }, + "ansicolor@2.0.3": { + "integrity": "sha512-pzusTqk9VHrjgMCcTPDTTvfJfx6Q3+L5tQ6yKC8Diexmoit4YROTFIkxFvRTNL9y5s0Q8HrSrgerCD5bIC+Kiw==" + }, + "ansis@4.2.0": { + "integrity": "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig==" + }, + "argparse@2.0.1": { + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "axios@0.26.1": { + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": [ + "follow-redirects" + ] + }, + "balanced-match@1.0.2": { + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "baseline-browser-mapping@2.9.15": { + "integrity": "sha512-kX8h7K2srmDyYnXRIppo4AH/wYgzWVCs+eKr3RusRSQ5PvRYoEFmR/I0PbdTjKFAoKqp5+kbxnNTFO9jOfSVJg==", + "bin": true + }, + "best-effort-json-parser@1.2.1": { + "integrity": "sha512-UICSLibQdzS1f+PBsi3u2YE3SsdXcWicHUg3IMvfuaePS2AYnZJdJeKhGv5OM8/mqJwPt79aDrEJ1oa84tELvw==" + }, + "binary-install@1.1.2": { + "integrity": "sha512-ZS2cqFHPZOy4wLxvzqfQvDjCOifn+7uCPqNmYRIBM/03+yllON+4fNnsD0VJdW0p97y+E+dTRNPStWNqMBq+9g==", + "dependencies": [ + "axios", + "rimraf", + "tar" + ], + "deprecated": true + }, + "birpc@2.9.0": { + "integrity": "sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw==" + }, + "boolbase@1.0.0": { + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, + "bootstrap-vue-next@0.40.9_@floating-ui+vue@1.1.9__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_@vueuse+core@14.1.0__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_vue@3.5.27__typescript@5.9.3_vue-router@4.6.4__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-m4EODlKWIkCFiQzICmKpOTjl3mxqKIpIbsBX0liFsMUip7huZkHDmaZUm6PrqJM2PHrZ7n8l6YRUgBPzFKUcYg==", + "dependencies": [ + "@floating-ui/vue", + "@vueuse/core", + "vue", + "vue-router" + ], + "optionalPeers": [ + "@floating-ui/vue", + "@vueuse/core", + "vue-router" + ] + }, + "bootstrap@5.3.8_@popperjs+core@2.11.8": { + "integrity": "sha512-HP1SZDqaLDPwsNiqRqi5NcP0SSXciX2s9E+RyqJIIqGo+vJeN5AJVM98CXmW/Wux0nQ5L7jeWUdplCEf0Ee+tg==", + "dependencies": [ + "@popperjs/core" + ] + }, + "brace-expansion@1.1.12": { + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dependencies": [ + "balanced-match", + "concat-map" + ] + }, + "brace-expansion@2.0.2": { + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dependencies": [ + "balanced-match" + ] + }, + "braces@3.0.3": { + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": [ + "fill-range" + ] + }, + "browserslist@4.28.1": { + "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "dependencies": [ + "baseline-browser-mapping", + "caniuse-lite", + "electron-to-chromium", + "node-releases", + "update-browserslist-db" + ], + "bin": true + }, + "buffer-builder@0.2.0": { + "integrity": "sha512-7VPMEPuYznPSoR21NE1zvd2Xna6c/CloiZCfcMXR1Jny6PjX0N4Nsa38zcBFo/FMK+BlA+FLKbJCQ0i2yxp+Xg==" + }, + "bundle-name@4.1.0": { + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dependencies": [ + "run-applescript" + ] + }, + "cac@6.7.14": { + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==" + }, + "call-bind-apply-helpers@1.0.2": { + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": [ + "es-errors", + "function-bind" + ] + }, + "call-bound@1.0.4": { + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": [ + "call-bind-apply-helpers", + "get-intrinsic" + ] + }, + "callsites@3.1.0": { + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "caniuse-lite@1.0.30001765": { + "integrity": "sha512-LWcNtSyZrakjECqmpP4qdg0MMGdN368D7X8XvvAqOcqMv0RxnlqVKZl2V6/mBR68oYMxOZPLw/gO7DuisMHUvQ==" + }, + "ccount@2.0.1": { + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==" + }, + "chalk@4.1.2": { + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "character-entities-html4@2.1.0": { + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==" + }, + "character-entities-legacy@3.0.0": { + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==" + }, + "character-parser@2.2.0": { + "integrity": "sha512-+UqJQjFEFaTAs3bNsF2j2kEN1baG/zghZbdqoYEDxGZtJo9LBzl1A+m0D4n3qKx8N2FNv8/Xp6yV9mQmBuptaw==", + "dependencies": [ + "is-regex" + ] + }, + "chokidar@4.0.3": { + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dependencies": [ + "readdirp" + ] + }, + "chownr@2.0.0": { + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" + }, + "cliui@9.0.1": { + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", + "dependencies": [ + "string-width", + "strip-ansi", + "wrap-ansi" + ] + }, + "codemirror-json-schema@0.8.1_@codemirror+language@6.12.1_@codemirror+lint@6.9.2_@codemirror+state@6.5.4_@codemirror+view@6.39.11_@lezer+common@1.5.0": { + "integrity": "sha512-4lKPjW+nugNAmM5MsggJyn6TUxYdCCwAJIr9T4cZeTFPdkbBvPteCOGtDedrTOIeTC2ZFJtVg7VHIXnYU32t8w==", + "dependencies": [ + "@codemirror/language", + "@codemirror/lint", + "@codemirror/state", + "@codemirror/view", + "@lezer/common", + "@sagold/json-pointer", + "@shikijs/markdown-it", + "best-effort-json-parser", + "json-schema", + "json-schema-library", + "loglevel", + "markdown-it", + "shiki", + "yaml" + ], + "optionalDependencies": [ + "@codemirror/autocomplete", + "@codemirror/lang-json", + "@codemirror/lang-yaml", + "codemirror-json5", + "json5" + ] + }, + "codemirror-json5@1.0.3": { + "integrity": "sha512-HmmoYO2huQxoaoG5ARKjqQc9mz7/qmNPvMbISVfIE2Gk1+4vZQg9X3G6g49MYM5IK00Ol3aijd7OKrySuOkA7Q==", + "dependencies": [ + "@codemirror/language", + "@codemirror/state", + "@codemirror/view", + "@lezer/common", + "@lezer/highlight", + "json5", + "lezer-json5" + ] + }, + "codemirror@6.0.2": { + "integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==", + "dependencies": [ + "@codemirror/autocomplete", + "@codemirror/commands", + "@codemirror/language", + "@codemirror/lint", + "@codemirror/search", + "@codemirror/state", + "@codemirror/view" + ] + }, + "color-convert@2.0.1": { + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": [ + "color-name" + ] + }, + "color-name@1.1.4": { + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "colorjs.io@0.5.2": { + "integrity": "sha512-twmVoizEW7ylZSN32OgKdXRmo1qg+wT5/6C3xu5b9QsWzSFAhHLn2xd8ro0diCsKfCj1RdaTP/nrcW+vAoQPIw==" + }, + "colors@1.4.0": { + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, + "comma-separated-tokens@2.0.3": { + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==" + }, + "commander@11.1.0": { + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==" + }, + "commander@2.20.3": { + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "concat-map@0.0.1": { + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "confbox@0.1.8": { + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==" + }, + "confbox@0.2.2": { + "integrity": "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==" + }, + "convert-source-map@2.0.0": { + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" + }, + "copy-anything@4.0.5": { + "integrity": "sha512-7Vv6asjS4gMOuILabD3l739tsaxFQmC+a7pLZm02zyvs8p977bL3zEgq3yDk5rn9B0PbYgIv++jmHcuUab4RhA==", + "dependencies": [ + "is-what" + ] + }, + "crelt@1.0.6": { + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==" + }, + "cross-spawn@7.0.6": { + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dependencies": [ + "path-key", + "shebang-command", + "which@2.0.2" + ] + }, + "css-select@5.2.2": { + "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", + "dependencies": [ + "boolbase", + "css-what", + "domhandler", + "domutils", + "nth-check" + ] + }, + "css-tree@2.2.1": { + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", + "dependencies": [ + "mdn-data@2.0.28", + "source-map-js" + ] + }, + "css-tree@3.1.0": { + "integrity": "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==", + "dependencies": [ + "mdn-data@2.12.2", + "source-map-js" + ] + }, + "css-what@6.2.2": { + "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==" + }, + "cssesc@3.0.0": { + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "bin": true + }, + "csso@5.0.5": { + "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", + "dependencies": [ + "css-tree@2.2.1" + ] + }, + "csstype@3.2.3": { + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==" + }, + "debug@4.4.3": { + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": [ + "ms" + ] + }, + "deep-is@0.1.4": { + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, + "deepmerge@4.3.1": { + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==" + }, + "default-browser-id@5.0.1": { + "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==" + }, + "default-browser@5.4.0": { + "integrity": "sha512-XDuvSq38Hr1MdN47EDvYtx3U0MTqpCEn+F6ft8z2vYDzMrvQhVp0ui9oQdqW3MvK3vqUETglt1tVGgjLuJ5izg==", + "dependencies": [ + "bundle-name", + "default-browser-id" + ] + }, + "define-lazy-prop@3.0.0": { + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==" + }, + "deno@2.6.5": { + "integrity": "sha512-zAEGhAKPyKTA7HwtSVPAmdpj+WQfvw0tPemgkaRsqGLe7oi85iqUPCoCEkItiYp3ZellfQIbDHqQmKUY6fgxig==", + "optionalDependencies": [ + "@deno/darwin-arm64", + "@deno/darwin-x64", + "@deno/linux-arm64-glibc", + "@deno/linux-x64-glibc", + "@deno/win32-arm64", + "@deno/win32-x64" + ], + "scripts": true, + "bin": true + }, + "dequal@2.0.3": { + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==" + }, + "detect-libc@2.1.2": { + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==" + }, + "devlop@1.1.0": { + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dependencies": [ + "dequal" + ] + }, + "discontinuous-range@1.0.0": { + "integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==" + }, + "dom-serializer@2.0.0": { + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dependencies": [ + "domelementtype", + "domhandler", + "entities@4.5.0" + ] + }, + "domelementtype@2.3.0": { + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==" + }, + "domhandler@5.0.3": { + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": [ + "domelementtype" + ] + }, + "dompurify@3.1.7": { + "integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==" + }, + "domutils@3.2.2": { + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", + "dependencies": [ + "dom-serializer", + "domelementtype", + "domhandler" + ] + }, + "dunder-proto@1.0.1": { + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": [ + "call-bind-apply-helpers", + "es-errors", + "gopd" + ] + }, + "ebnf@1.9.1": { + "integrity": "sha512-uW2UKSsuty9ANJ3YByIQE4ANkD8nqUPO7r6Fwcc1ADKPe9FRdcPpMl3VEput4JSvKBJ4J86npIC2MLP0pYkCuw==", + "bin": true + }, + "electron-to-chromium@1.5.267": { + "integrity": "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==" + }, + "emoji-regex-xs@1.0.0": { + "integrity": "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==" + }, + "emoji-regex@10.6.0": { + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==" + }, + "entities@4.5.0": { + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==" + }, + "entities@7.0.0": { + "integrity": "sha512-FDWG5cmEYf2Z00IkYRhbFrwIwvdFKH07uV8dvNy0omp/Qb1xcyCWp2UDtcwJF4QZZvk0sLudP6/hAu42TaqVhQ==" + }, + "error-stack-parser-es@1.0.5": { + "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==" + }, + "es-define-property@1.0.1": { + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==" + }, + "es-errors@1.3.0": { + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==" + }, + "es-module-lexer@1.7.0": { + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==" + }, + "es-object-atoms@1.1.1": { + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": [ + "es-errors" + ] + }, + "esbuild@0.27.2": { + "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", + "optionalDependencies": [ + "@esbuild/aix-ppc64", + "@esbuild/android-arm", + "@esbuild/android-arm64", + "@esbuild/android-x64", + "@esbuild/darwin-arm64", + "@esbuild/darwin-x64", + "@esbuild/freebsd-arm64", + "@esbuild/freebsd-x64", + "@esbuild/linux-arm", + "@esbuild/linux-arm64", + "@esbuild/linux-ia32", + "@esbuild/linux-loong64", + "@esbuild/linux-mips64el", + "@esbuild/linux-ppc64", + "@esbuild/linux-riscv64", + "@esbuild/linux-s390x", + "@esbuild/linux-x64", + "@esbuild/netbsd-arm64", + "@esbuild/netbsd-x64", + "@esbuild/openbsd-arm64", + "@esbuild/openbsd-x64", + "@esbuild/openharmony-arm64", + "@esbuild/sunos-x64", + "@esbuild/win32-arm64", + "@esbuild/win32-ia32", + "@esbuild/win32-x64" + ], + "scripts": true, + "bin": true + }, + "escalade@3.2.0": { + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==" + }, + "escape-string-regexp@4.0.0": { + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + }, + "eslint-config-prettier@10.1.8_eslint@9.39.2__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dependencies": [ + "eslint" + ], + "bin": true + }, + "eslint-plugin-prettier@5.5.5_eslint@9.39.2__jiti@2.6.1_eslint-config-prettier@10.1.8__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1_prettier@3.8.0_jiti@2.6.1": { + "integrity": "sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw==", + "dependencies": [ + "eslint", + "eslint-config-prettier", + "prettier@3.8.0", + "prettier-linter-helpers", + "synckit" + ], + "optionalPeers": [ + "eslint-config-prettier" + ] + }, + "eslint-plugin-vue@10.7.0_eslint@9.39.2__jiti@2.6.1_vue-eslint-parser@10.2.0__eslint@9.39.2___jiti@2.6.1__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-r2XFCK4qlo1sxEoAMIoTTX0PZAdla0JJDt1fmYiworZUX67WeEGqm+JbyAg3M+pGiJ5U6Mp5WQbontXWtIW7TA==", + "dependencies": [ + "@eslint-community/eslint-utils", + "eslint", + "natural-compare", + "nth-check", + "postcss-selector-parser", + "semver@7.7.3", + "vue-eslint-parser", + "xml-name-validator" + ] + }, + "eslint-scope@8.4.0": { + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dependencies": [ + "esrecurse", + "estraverse" + ] + }, + "eslint-visitor-keys@3.4.3": { + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==" + }, + "eslint-visitor-keys@4.2.1": { + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==" + }, + "eslint@9.39.2_jiti@2.6.1": { + "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", + "dependencies": [ + "@eslint-community/eslint-utils", + "@eslint-community/regexpp", + "@eslint/config-array", + "@eslint/config-helpers", + "@eslint/core", + "@eslint/eslintrc", + "@eslint/js", + "@eslint/plugin-kit", + "@humanfs/node", + "@humanwhocodes/module-importer", + "@humanwhocodes/retry", + "@types/estree", + "ajv@6.12.6", + "chalk", + "cross-spawn", + "debug", + "escape-string-regexp", + "eslint-scope", + "eslint-visitor-keys@4.2.1", + "espree", + "esquery", + "esutils", + "fast-deep-equal", + "file-entry-cache", + "find-up", + "glob-parent@6.0.2", + "ignore@5.3.2", + "imurmurhash", + "is-glob", + "jiti", + "json-stable-stringify-without-jsonify", + "lodash.merge", + "minimatch@3.1.2", + "natural-compare", + "optionator" + ], + "optionalPeers": [ + "jiti" + ], + "bin": true + }, + "espree@10.4.0_acorn@8.15.0": { + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dependencies": [ + "acorn@8.15.0", + "acorn-jsx", + "eslint-visitor-keys@4.2.1" + ] + }, + "esquery@1.7.0": { + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dependencies": [ + "estraverse" + ] + }, + "esrecurse@4.3.0": { + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dependencies": [ + "estraverse" + ] + }, + "estraverse@5.3.0": { + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + }, + "estree-walker@2.0.2": { + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, + "esutils@2.0.3": { + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, + "exsolve@1.0.8": { + "integrity": "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==" + }, + "fast-copy@3.0.2": { + "integrity": "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==" + }, + "fast-deep-equal@3.1.3": { + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-diff@1.3.0": { + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==" + }, + "fast-glob@3.3.3": { + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dependencies": [ + "@nodelib/fs.stat", + "@nodelib/fs.walk", + "glob-parent@5.1.2", + "merge2", + "micromatch" + ] + }, + "fast-json-stable-stringify@2.1.0": { + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein@2.0.6": { + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + }, + "fast-uri@3.1.0": { + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==" + }, + "fastq@1.20.1": { + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "dependencies": [ + "reusify" + ] + }, + "fdir@6.5.0_picomatch@4.0.3": { + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dependencies": [ + "picomatch@4.0.3" + ], + "optionalPeers": [ + "picomatch@4.0.3" + ] + }, + "file-entry-cache@8.0.0": { + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dependencies": [ + "flat-cache" + ] + }, + "fill-range@7.1.1": { + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": [ + "to-regex-range" + ] + }, + "find-up@5.0.0": { + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dependencies": [ + "locate-path", + "path-exists" + ] + }, + "flat-cache@4.0.1": { + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dependencies": [ + "flatted", + "keyv" + ] + }, + "flatted@3.3.3": { + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==" + }, + "follow-redirects@1.15.11": { + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==" + }, + "fs-minipass@2.1.0": { + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": [ + "minipass@3.3.6" + ] + }, + "fs.realpath@1.0.0": { + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "fsevents@2.3.3": { + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "os": ["darwin"], + "scripts": true + }, + "function-bind@1.1.2": { + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" + }, + "gensync@1.0.0-beta.2": { + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==" + }, + "get-caller-file@2.0.5": { + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "get-east-asian-width@1.4.0": { + "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==" + }, + "get-intrinsic@1.3.0": { + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": [ + "call-bind-apply-helpers", + "es-define-property", + "es-errors", + "es-object-atoms", + "function-bind", + "get-proto", + "gopd", + "has-symbols", + "hasown", + "math-intrinsics" + ] + }, + "get-proto@1.0.1": { + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": [ + "dunder-proto", + "es-object-atoms" + ] + }, + "glob-parent@5.1.2": { + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": [ + "is-glob" + ] + }, + "glob-parent@6.0.2": { + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": [ + "is-glob" + ] + }, + "glob-to-regexp@0.4.1": { + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "glob@7.2.3": { + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": [ + "fs.realpath", + "inflight", + "inherits", + "minimatch@3.1.2", + "once", + "path-is-absolute" + ], + "deprecated": true + }, + "globals@14.0.0": { + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==" + }, + "globals@16.5.0": { + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==" + }, + "gopd@1.2.0": { + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==" + }, + "graceful-fs@4.2.11": { + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "gradient-parser@1.1.1": { + "integrity": "sha512-Hu0YfNU+38EsTmnUfLXUKFMXq9yz7htGYpF4x+dlbBhUCvIvzLt0yVLT/gJRmvLKFJdqNFrz4eKkIUjIXSr7Tw==" + }, + "has-flag@4.0.0": { + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "has-symbols@1.1.0": { + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==" + }, + "has-tostringtag@1.0.2": { + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dependencies": [ + "has-symbols" + ] + }, + "hasown@2.0.2": { + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": [ + "function-bind" + ] + }, + "hast-util-to-html@9.0.5": { + "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==", + "dependencies": [ + "@types/hast", + "@types/unist", + "ccount", + "comma-separated-tokens", + "hast-util-whitespace", + "html-void-elements", + "mdast-util-to-hast", + "property-information", + "space-separated-tokens", + "stringify-entities", + "zwitch" + ] + }, + "hast-util-whitespace@3.0.0": { + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dependencies": [ + "@types/hast" + ] + }, + "hookable@5.5.3": { + "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==" + }, + "html-void-elements@3.0.0": { + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==" + }, + "humanize-duration@3.33.2": { + "integrity": "sha512-K7Ny/ULO1hDm2nnhvAY+SJV1skxFb61fd073SG1IWJl+D44ULrruCuTyjHKjBVVcSuTlnY99DKtgEG39CM5QOQ==" + }, + "ignore@5.3.2": { + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==" + }, + "ignore@7.0.5": { + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==" + }, + "immutable@5.1.4": { + "integrity": "sha512-p6u1bG3YSnINT5RQmx/yRZBpenIl30kVxkTLDyHLIMk0gict704Q9n+thfDI7lTRm9vXdDYutVzXhzcThxTnXA==" + }, + "import-fresh@3.3.1": { + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dependencies": [ + "parent-module", + "resolve-from" + ] + }, + "imurmurhash@0.1.4": { + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==" + }, + "inflight@1.0.6": { + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": [ + "once", + "wrappy" + ], + "deprecated": true + }, + "inherits@2.0.4": { + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-docker@3.0.0": { + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "bin": true + }, + "is-expression@4.0.0": { + "integrity": "sha512-zMIXX63sxzG3XrkHkrAPvm/OVZVSCPNkwMHU8oTX7/U3AL78I0QXCEICXUM13BIa8TYGZ68PiTKfQz3yaTNr4A==", + "dependencies": [ + "acorn@7.4.1", + "object-assign" + ] + }, + "is-extglob@2.1.1": { + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-glob@4.0.3": { + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": [ + "is-extglob" + ] + }, + "is-inside-container@1.0.0": { + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dependencies": [ + "is-docker" + ], + "bin": true + }, + "is-number@7.0.0": { + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-plain-object@5.0.0": { + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-regex@1.2.1": { + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dependencies": [ + "call-bound", + "gopd", + "has-tostringtag", + "hasown" + ] + }, + "is-what@5.5.0": { + "integrity": "sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw==" + }, + "is-wsl@3.1.0": { + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dependencies": [ + "is-inside-container" + ] + }, + "isexe@2.0.0": { + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "isexe@3.1.1": { + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==" + }, + "jiti@2.6.1": { + "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", + "bin": true + }, + "js-tokens@4.0.0": { + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml@4.1.1": { + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dependencies": [ + "argparse" + ], + "bin": true + }, + "jsesc@3.1.0": { + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "bin": true + }, + "json-buffer@3.0.1": { + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, + "json-parse-even-better-errors@4.0.0": { + "integrity": "sha512-lR4MXjGNgkJc7tkQ97kb2nuEMnNCyU//XYVH0MKTGcXEiSudQ5MKGKen3C5QubYy0vmq+JGitUg92uuywGEwIA==" + }, + "json-schema-library@9.3.5": { + "integrity": "sha512-5eBDx7cbfs+RjylsVO+N36b0GOPtv78rfqgf2uON+uaHUIC62h63Y8pkV2ovKbaL4ZpQcHp21968x5nx/dFwqQ==", + "dependencies": [ + "@sagold/json-pointer", + "@sagold/json-query", + "deepmerge", + "fast-copy", + "fast-deep-equal", + "smtp-address-parser", + "valid-url" + ] + }, + "json-schema-traverse@0.4.1": { + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-schema-traverse@1.0.0": { + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "json-schema@0.4.0": { + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "json-stable-stringify-without-jsonify@1.0.1": { + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" + }, + "json5@2.2.3": { + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": true + }, + "jsonc-parser@3.3.1": { + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==" + }, + "keyv@4.5.4": { + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dependencies": [ + "json-buffer" + ] + }, + "kolorist@1.8.0": { + "integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==" + }, + "levn@0.4.1": { + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dependencies": [ + "prelude-ls", + "type-check" + ] + }, + "lezer-json5@2.0.2": { + "integrity": "sha512-NRmtBlKW/f8mA7xatKq8IUOq045t8GVHI4kZXrUtYYUdiVeGiO6zKGAV7/nUAnf5q+rYTY+SWX/gvQdFXMjNxQ==", + "dependencies": [ + "@lezer/lr" + ] + }, + "linkify-it@5.0.0": { + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dependencies": [ + "uc.micro" + ] + }, + "lit-element@4.2.2": { + "integrity": "sha512-aFKhNToWxoyhkNDmWZwEva2SlQia+jfG0fjIWV//YeTaWrVnOxD89dPKfigCUspXFmjzOEUQpOkejH5Ly6sG0w==", + "dependencies": [ + "@lit-labs/ssr-dom-shim", + "@lit/reactive-element", + "lit-html" + ] + }, + "lit-html@3.3.2": { + "integrity": "sha512-Qy9hU88zcmaxBXcc10ZpdK7cOLXvXpRoBxERdtqV9QOrfpMZZ6pSYP91LhpPtap3sFMUiL7Tw2RImbe0Al2/kw==", + "dependencies": [ + "@types/trusted-types" + ] + }, + "lit@3.3.2": { + "integrity": "sha512-NF9zbsP79l4ao2SNrH3NkfmFgN/hBYSQo90saIVI1o5GpjAdCPVstVzO1MrLOakHoEhYkrtRjPK6Ob521aoYWQ==", + "dependencies": [ + "@lit/reactive-element", + "lit-element", + "lit-html" + ] + }, + "local-pkg@1.1.2": { + "integrity": "sha512-arhlxbFRmoQHl33a0Zkle/YWlmNwoyt6QNZEIJcqNbdrsix5Lvc4HyyI3EnwxTYlZYc32EbYrQ8SzEZ7dqgg9A==", + "dependencies": [ + "mlly", + "pkg-types@2.3.0", + "quansync" + ] + }, + "locate-path@6.0.0": { + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": [ + "p-locate" + ] + }, + "lodash-es@4.17.22": { + "integrity": "sha512-XEawp1t0gxSi9x01glktRZ5HDy0HXqrM0x5pXQM98EaI0NxO6jVM7omDOxsuEo5UIASAnm2bRp1Jt/e0a2XU8Q==" + }, + "lodash.merge@4.6.2": { + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "loglevel@1.9.2": { + "integrity": "sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg==" + }, + "lru-cache@5.1.1": { + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dependencies": [ + "yallist@3.1.1" + ] + }, + "magic-string@0.30.21": { + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dependencies": [ + "@jridgewell/sourcemap-codec" + ] + }, + "markdown-it@14.1.0": { + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dependencies": [ + "argparse", + "entities@4.5.0", + "linkify-it", + "mdurl", + "punycode.js", + "uc.micro" + ], + "bin": true + }, + "marked@14.0.0": { + "integrity": "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==", + "bin": true + }, + "math-intrinsics@1.1.0": { + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==" + }, + "mdast-util-to-hast@13.2.1": { + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "dependencies": [ + "@types/hast", + "@types/mdast", + "@ungap/structured-clone", + "devlop", + "micromark-util-sanitize-uri", + "trim-lines", + "unist-util-position", + "unist-util-visit", + "vfile" + ] + }, + "mdn-data@2.0.28": { + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==" + }, + "mdn-data@2.12.2": { + "integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==" + }, + "mdurl@2.0.0": { + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==" + }, + "memorystream@0.3.1": { + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==" + }, + "merge2@1.4.1": { + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromark-util-character@2.1.1": { + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dependencies": [ + "micromark-util-symbol", + "micromark-util-types" + ] + }, + "micromark-util-encode@2.0.1": { + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==" + }, + "micromark-util-sanitize-uri@2.0.1": { + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "dependencies": [ + "micromark-util-character", + "micromark-util-encode", + "micromark-util-symbol" + ] + }, + "micromark-util-symbol@2.0.1": { + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==" + }, + "micromark-util-types@2.0.2": { + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==" + }, + "micromatch@4.0.8": { + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dependencies": [ + "braces", + "picomatch@2.3.1" + ] + }, + "mime-db@1.52.0": { + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types@2.1.35": { + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": [ + "mime-db" + ] + }, + "minimatch@3.1.2": { + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": [ + "brace-expansion@1.1.12" + ] + }, + "minimatch@9.0.5": { + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dependencies": [ + "brace-expansion@2.0.2" + ] + }, + "minipass@3.3.6": { + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": [ + "yallist@4.0.0" + ] + }, + "minipass@5.0.0": { + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==" + }, + "minizlib@2.1.2": { + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dependencies": [ + "minipass@3.3.6", + "yallist@4.0.0" + ] + }, + "mitt@3.0.1": { + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + }, + "mkdirp@1.0.4": { + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": true + }, + "mlly@1.8.0": { + "integrity": "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==", + "dependencies": [ + "acorn@8.15.0", + "pathe", + "pkg-types@1.3.1", + "ufo" + ] + }, + "monaco-editor@0.54.0": { + "integrity": "sha512-hx45SEUoLatgWxHKCmlLJH81xBo0uXP4sRkESUpmDQevfi+e7K1VuiSprK6UpQ8u4zOcKNiH0pMvHvlMWA/4cw==", + "dependencies": [ + "dompurify", + "marked" + ] + }, + "monaco-languageserver-types@0.4.0": { + "integrity": "sha512-QQ3BZiU5LYkJElGncSNb5AKoJ/LCs6YBMCJMAz9EA7v+JaOdn3kx2cXpPTcZfKA5AEsR0vc97sAw+5mdNhVBmw==", + "dependencies": [ + "monaco-types", + "vscode-languageserver-protocol", + "vscode-uri" + ] + }, + "monaco-marker-data-provider@1.2.5": { + "integrity": "sha512-5ZdcYukhPwgYMCvlZ9H5uWs5jc23BQ8fFF5AhSIdrz5mvYLsqGZ58ZLxTv8rCX6+AxdJ8+vxg1HVSk+F2bLosg==", + "dependencies": [ + "monaco-types" + ] + }, + "monaco-types@0.1.1": { + "integrity": "sha512-cxYEIVVKQ46FsH96b91pn+9jdl/Bz8rJ08oNeUgK2DNMGQUMuZh77USqt+L0ns9Y+/aFItWyPBgj6bkZvtWCsQ==" + }, + "monaco-vim@0.4.4_monaco-editor@0.54.0": { + "integrity": "sha512-LNChAb//WEm/W+eyeHG/0+pdVEHotk2hLTN+M3sQZx5E8cAlSWSgqcxpcRuQnxDybSln7pfHF9i63HmbIQvrWw==", + "dependencies": [ + "monaco-editor" + ] + }, + "monaco-worker-manager@2.0.1_monaco-editor@0.54.0": { + "integrity": "sha512-kdPL0yvg5qjhKPNVjJoym331PY/5JC11aPJXtCZNwWRvBr6jhkIamvYAyiY5P1AWFmNOy0aRDRoMdZfa71h8kg==", + "dependencies": [ + "monaco-editor" + ] + }, + "monaco-yaml@5.4.0_monaco-editor@0.54.0": { + "integrity": "sha512-tuBVDy1KAPrgO905GHTItu8AaA5bIzF5S4X0JVRAE/D66FpRhkDUk7tKi5bwKMVTTugtpMLsXN4ewh4CgE/FtQ==", + "dependencies": [ + "jsonc-parser", + "monaco-editor", + "monaco-languageserver-types", + "monaco-marker-data-provider", + "monaco-types", + "monaco-worker-manager", + "path-browserify", + "prettier@3.8.0", + "vscode-languageserver-textdocument", + "vscode-languageserver-types", + "vscode-uri", + "yaml" + ] + }, + "moo@0.5.2": { + "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==" + }, + "mrmime@2.0.1": { + "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==" + }, + "ms@2.1.3": { + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "muggle-string@0.4.1": { + "integrity": "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==" + }, + "nanoid@3.3.11": { + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "bin": true + }, + "nanoid@5.1.6": { + "integrity": "sha512-c7+7RQ+dMB5dPwwCp4ee1/iV/q2P6aK1mTZcfr1BTuVlyW9hJYiMPybJCcnBlQtuSmTIWNeazm/zqNoZSSElBg==", + "bin": true + }, + "natural-compare@1.4.0": { + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + }, + "nearley@2.20.1": { + "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", + "dependencies": [ + "commander@2.20.3", + "moo", + "railroad-diagrams", + "randexp" + ], + "bin": true + }, + "node-addon-api@7.1.1": { + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==" + }, + "node-releases@2.0.27": { + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==" + }, + "npm-normalize-package-bin@4.0.0": { + "integrity": "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==" + }, + "npm-run-all2@8.0.4": { + "integrity": "sha512-wdbB5My48XKp2ZfJUlhnLVihzeuA1hgBnqB2J9ahV77wLS+/YAJAlN8I+X3DIFIPZ3m5L7nplmlbhNiFDmXRDA==", + "dependencies": [ + "ansi-styles@6.2.3", + "cross-spawn", + "memorystream", + "picomatch@4.0.3", + "pidtree", + "read-package-json-fast", + "shell-quote", + "which@5.0.0" + ], + "bin": true + }, + "nth-check@2.1.1": { + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dependencies": [ + "boolbase" + ] + }, + "object-assign@4.1.1": { + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, + "ohash@2.0.11": { + "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==" + }, + "once@1.4.0": { + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": [ + "wrappy" + ] + }, + "oniguruma-to-es@2.3.0": { + "integrity": "sha512-bwALDxriqfKGfUufKGGepCzu9x7nJQuoRoAFp4AnwehhC2crqrDIAP/uN2qdlsAvSMpeRC3+Yzhqc7hLmle5+g==", + "dependencies": [ + "emoji-regex-xs", + "regex", + "regex-recursion" + ] + }, + "open@10.2.0": { + "integrity": "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==", + "dependencies": [ + "default-browser", + "define-lazy-prop", + "is-inside-container", + "wsl-utils" + ] + }, + "optionator@0.9.4": { + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dependencies": [ + "deep-is", + "fast-levenshtein", + "levn", + "prelude-ls", + "type-check", + "word-wrap" + ] + }, + "p-limit@3.1.0": { + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": [ + "yocto-queue" + ] + }, + "p-locate@5.0.0": { + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dependencies": [ + "p-limit" + ] + }, + "parent-module@1.0.1": { + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dependencies": [ + "callsites" + ] + }, + "path-browserify@1.0.1": { + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, + "path-exists@4.0.0": { + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-is-absolute@1.0.1": { + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-key@3.1.1": { + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "pathe@2.0.3": { + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==" + }, + "perfect-debounce@2.0.0": { + "integrity": "sha512-fkEH/OBiKrqqI/yIgjR92lMfs2K8105zt/VT6+7eTjNwisrsh47CeIED9z58zI7DfKdH3uHAn25ziRZn3kgAow==" + }, + "picocolors@1.1.1": { + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" + }, + "picomatch@2.3.1": { + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "picomatch@4.0.3": { + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==" + }, + "pidtree@0.6.0": { + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "bin": true + }, + "pkg-types@1.3.1": { + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dependencies": [ + "confbox@0.1.8", + "mlly", + "pathe" + ] + }, + "pkg-types@2.3.0": { + "integrity": "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==", + "dependencies": [ + "confbox@0.2.2", + "exsolve", + "pathe" + ] + }, + "postcss-selector-parser@7.1.1": { + "integrity": "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==", + "dependencies": [ + "cssesc", + "util-deprecate" + ] + }, + "postcss@8.5.6": { + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dependencies": [ + "nanoid@3.3.11", + "picocolors", + "source-map-js" + ] + }, + "prelude-ls@1.2.1": { + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" + }, + "prettier-linter-helpers@1.0.1": { + "integrity": "sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg==", + "dependencies": [ + "fast-diff" + ] + }, + "prettier-plugin-vue@1.1.6": { + "integrity": "sha512-trQ/oY+6hSsGe2zPIFThXMIM0TbxMEbk2VOrKjwHWuSz7OEo0rnumbz9a47OxVPCaAnGY9vZG8qDTiTmk9bq0A==", + "dependencies": [ + "prettier@2.8.8" + ] + }, + "prettier@2.8.8": { + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "bin": true + }, + "prettier@3.8.0": { + "integrity": "sha512-yEPsovQfpxYfgWNhCfECjG5AQaO+K3dp6XERmOepyPDVqcJm+bjyCVO3pmU+nAPe0N5dDvekfGezt/EIiRe1TA==", + "bin": true + }, + "property-information@7.1.0": { + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==" + }, + "pug-error@2.1.0": { + "integrity": "sha512-lv7sU9e5Jk8IeUheHata6/UThZ7RK2jnaaNztxfPYUY+VxZyk/ePVaNZ/vwmH8WqGvDz3LrNYt/+gA55NDg6Pg==" + }, + "pug-lexer@5.0.1": { + "integrity": "sha512-0I6C62+keXlZPZkOJeVam9aBLVP2EnbeDw3An+k0/QlqdwH6rv8284nko14Na7c0TtqtogfWXcRoFE4O4Ff20w==", + "dependencies": [ + "character-parser", + "is-expression", + "pug-error" + ] + }, + "punycode.js@2.3.1": { + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==" + }, + "punycode@2.3.1": { + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==" + }, + "qrcode.vue@3.6.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-vQcl2fyHYHMjDO1GguCldJxepq2izQjBkDEEu9NENgfVKP6mv/e2SU62WbqYHGwTgWXLhxZ1NCD1dAZKHQq1fg==", + "dependencies": [ + "vue" + ] + }, + "quansync@0.2.11": { + "integrity": "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA==" + }, + "queue-microtask@1.2.3": { + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "railroad-diagrams@1.0.0": { + "integrity": "sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==" + }, + "randexp@0.4.6": { + "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", + "dependencies": [ + "discontinuous-range", + "ret" + ] + }, + "read-package-json-fast@4.0.0": { + "integrity": "sha512-qpt8EwugBWDw2cgE2W+/3oxC+KTez2uSVR8JU9Q36TXPAGCaozfQUs59v4j4GFpWTaw0i6hAZSvOmu1J0uOEUg==", + "dependencies": [ + "json-parse-even-better-errors", + "npm-normalize-package-bin" + ] + }, + "readdirp@4.1.2": { + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==" + }, + "readline-sync@1.4.10": { + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + }, + "regex-recursion@5.1.1": { + "integrity": "sha512-ae7SBCbzVNrIjgSbh7wMznPcQel1DNlDtzensnFxpiNpXt1U2ju/bHugH422r+4LAVS1FpW1YCwilmnNsjum9w==", + "dependencies": [ + "regex", + "regex-utilities" + ] + }, + "regex-utilities@2.3.0": { + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==" + }, + "regex@5.1.1": { + "integrity": "sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw==", + "dependencies": [ + "regex-utilities" + ] + }, + "require-from-string@2.0.2": { + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + }, + "resolve-from@4.0.0": { + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + }, + "ret@0.1.15": { + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + }, + "reusify@1.1.0": { + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==" + }, + "rfdc@1.4.1": { + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==" + }, + "rimraf@3.0.2": { + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": [ + "glob" + ], + "deprecated": true, + "bin": true + }, + "rollup@4.55.2": { + "integrity": "sha512-PggGy4dhwx5qaW+CKBilA/98Ql9keyfnb7lh4SR6shQ91QQQi1ORJ1v4UinkdP2i87OBs9AQFooQylcrrRfIcg==", + "dependencies": [ + "@types/estree" + ], + "optionalDependencies": [ + "@rollup/rollup-android-arm-eabi", + "@rollup/rollup-android-arm64", + "@rollup/rollup-darwin-arm64", + "@rollup/rollup-darwin-x64", + "@rollup/rollup-freebsd-arm64", + "@rollup/rollup-freebsd-x64", + "@rollup/rollup-linux-arm-gnueabihf", + "@rollup/rollup-linux-arm-musleabihf", + "@rollup/rollup-linux-arm64-gnu", + "@rollup/rollup-linux-arm64-musl", + "@rollup/rollup-linux-loong64-gnu", + "@rollup/rollup-linux-loong64-musl", + "@rollup/rollup-linux-ppc64-gnu", + "@rollup/rollup-linux-ppc64-musl", + "@rollup/rollup-linux-riscv64-gnu", + "@rollup/rollup-linux-riscv64-musl", + "@rollup/rollup-linux-s390x-gnu", + "@rollup/rollup-linux-x64-gnu", + "@rollup/rollup-linux-x64-musl", + "@rollup/rollup-openbsd-x64", + "@rollup/rollup-openharmony-arm64", + "@rollup/rollup-win32-arm64-msvc", + "@rollup/rollup-win32-ia32-msvc", + "@rollup/rollup-win32-x64-gnu", + "@rollup/rollup-win32-x64-msvc", + "fsevents" + ], + "bin": true + }, + "run-applescript@7.1.0": { + "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==" + }, + "run-parallel@1.2.0": { + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dependencies": [ + "queue-microtask" + ] + }, + "rxjs@7.8.2": { + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dependencies": [ + "tslib" + ] }, - "readline-sync@1.4.10": { - "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + "sass-embedded-all-unknown@1.97.2": { + "integrity": "sha512-Fj75+vOIDv1T/dGDwEpQ5hgjXxa2SmMeShPa8yrh2sUz1U44bbmY4YSWPCdg8wb7LnwiY21B2KRFM+HF42yO4g==", + "dependencies": [ + "sass" + ], + "cpu": ["!arm", "!arm64", "!riscv64", "!x64"] }, - "sass-embedded-android-arm64@1.89.2": { - "integrity": "sha512-+pq7a7AUpItNyPu61sRlP6G2A8pSPpyazASb+8AK2pVlFayCSPAEgpwpCE9A2/Xj86xJZeMizzKUHxM2CBCUxA==", + "sass-embedded-android-arm64@1.97.2": { + "integrity": "sha512-pF6I+R5uThrscd3lo9B3DyNTPyGFsopycdx0tDAESN6s+dBbiRgNgE4Zlpv50GsLocj/lDLCZaabeTpL3ubhYA==", "os": ["android"], "cpu": ["arm64"] }, - "sass-embedded-android-arm@1.89.2": { - "integrity": "sha512-oHAPTboBHRZlDBhyRB6dvDKh4KvFs+DZibDHXbkSI6dBZxMTT+Yb2ivocHnctVGucKTLQeT7+OM5DjWHyynL/A==", + "sass-embedded-android-arm@1.97.2": { + "integrity": "sha512-BPT9m19ttY0QVHYYXRa6bmqmS3Fa2EHByNUEtSVcbm5PkIk1ntmYkG9fn5SJpIMbNmFDGwHx+pfcZMmkldhnRg==", "os": ["android"], "cpu": ["arm"] }, - "sass-embedded-android-riscv64@1.89.2": { - "integrity": "sha512-HfJJWp/S6XSYvlGAqNdakeEMPOdhBkj2s2lN6SHnON54rahKem+z9pUbCriUJfM65Z90lakdGuOfidY61R9TYg==", + "sass-embedded-android-riscv64@1.97.2": { + "integrity": "sha512-fprI8ZTJdz+STgARhg8zReI2QhhGIT9G8nS7H21kc3IkqPRzhfaemSxEtCqZyvDbXPcgYiDLV7AGIReHCuATog==", "os": ["android"], "cpu": ["riscv64"] }, - "sass-embedded-android-x64@1.89.2": { - "integrity": "sha512-BGPzq53VH5z5HN8de6jfMqJjnRe1E6sfnCWFd4pK+CAiuM7iw5Fx6BQZu3ikfI1l2GY0y6pRXzsVLdp/j4EKEA==", + "sass-embedded-android-x64@1.97.2": { + "integrity": "sha512-RswwSjURZxupsukEmNt2t6RGvuvIw3IAD5sDq1Pc65JFvWFY3eHqCmH0lG0oXqMg6KJcF0eOxHOp2RfmIm2+4w==", "os": ["android"], "cpu": ["x64"] }, - "sass-embedded-darwin-arm64@1.89.2": { - "integrity": "sha512-UCm3RL/tzMpG7DsubARsvGUNXC5pgfQvP+RRFJo9XPIi6elopY5B6H4m9dRYDpHA+scjVthdiDwkPYr9+S/KGw==", + "sass-embedded-darwin-arm64@1.97.2": { + "integrity": "sha512-xcsZNnU1XZh21RE/71OOwNqPVcGBU0qT9A4k4QirdA34+ts9cDIaR6W6lgHOBR/Bnnu6w6hXJR4Xth7oFrefPA==", "os": ["darwin"], "cpu": ["arm64"] }, - "sass-embedded-darwin-x64@1.89.2": { - "integrity": "sha512-D9WxtDY5VYtMApXRuhQK9VkPHB8R79NIIR6xxVlN2MIdEid/TZWi1MHNweieETXhWGrKhRKglwnHxxyKdJYMnA==", + "sass-embedded-darwin-x64@1.97.2": { + "integrity": "sha512-T/9DTMpychm6+H4slHCAsYJRJ6eM+9H9idKlBPliPrP4T8JdC2Cs+ZOsYqrObj6eOtAD0fGf+KgyNhnW3xVafA==", "os": ["darwin"], "cpu": ["x64"] }, - "sass-embedded-linux-arm64@1.89.2": { - "integrity": "sha512-2N4WW5LLsbtrWUJ7iTpjvhajGIbmDR18ZzYRywHdMLpfdPApuHPMDF5CYzHbS+LLx2UAx7CFKBnj5LLjY6eFgQ==", + "sass-embedded-linux-arm64@1.97.2": { + "integrity": "sha512-Wh+nQaFer9tyE5xBPv5murSUZE/+kIcg8MyL5uqww6be9Iq+UmZpcJM7LUk+q8klQ9LfTmoDSNFA74uBqxD6IA==", "os": ["linux"], "cpu": ["arm64"] }, - "sass-embedded-linux-arm@1.89.2": { - "integrity": "sha512-leP0t5U4r95dc90o8TCWfxNXwMAsQhpWxTkdtySDpngoqtTy3miMd7EYNYd1znI0FN1CBaUvbdCMbnbPwygDlA==", + "sass-embedded-linux-arm@1.97.2": { + "integrity": "sha512-yDRe1yifGHl6kibkDlRIJ2ZzAU03KJ1AIvsAh4dsIDgK5jx83bxZLV1ZDUv7a8KK/iV/80LZnxnu/92zp99cXQ==", "os": ["linux"], "cpu": ["arm"] }, - "sass-embedded-linux-musl-arm64@1.89.2": { - "integrity": "sha512-nTyuaBX6U1A/cG7WJh0pKD1gY8hbg1m2SnzsyoFG+exQ0lBX/lwTLHq3nyhF+0atv7YYhYKbmfz+sjPP8CZ9lw==", + "sass-embedded-linux-musl-arm64@1.97.2": { + "integrity": "sha512-NfUqZSjHwnHvpSa7nyNxbWfL5obDjNBqhHUYmqbHUcmqBpFfHIQsUPgXME9DKn1yBlBc3mWnzMxRoucdYTzd2Q==", "os": ["linux"], "cpu": ["arm64"] }, - "sass-embedded-linux-musl-arm@1.89.2": { - "integrity": "sha512-Z6gG2FiVEEdxYHRi2sS5VIYBmp17351bWtOCUZ/thBM66+e70yiN6Eyqjz80DjL8haRUegNQgy9ZJqsLAAmr9g==", + "sass-embedded-linux-musl-arm@1.97.2": { + "integrity": "sha512-GIO6xfAtahJAWItvsXZ3MD1HM6s8cKtV1/HL088aUpKJaw/2XjTCveiOO2AdgMpLNztmq9DZ1lx5X5JjqhS45g==", "os": ["linux"], "cpu": ["arm"] }, - "sass-embedded-linux-musl-riscv64@1.89.2": { - "integrity": "sha512-N6oul+qALO0SwGY8JW7H/Vs0oZIMrRMBM4GqX3AjM/6y8JsJRxkAwnfd0fDyK+aICMFarDqQonQNIx99gdTZqw==", + "sass-embedded-linux-musl-riscv64@1.97.2": { + "integrity": "sha512-qtM4dJ5gLfvyTZ3QencfNbsTEShIWImSEpkThz+Y2nsCMbcMP7/jYOA03UWgPfEOKSehQQ7EIau7ncbFNoDNPQ==", "os": ["linux"], "cpu": ["riscv64"] }, - "sass-embedded-linux-musl-x64@1.89.2": { - "integrity": "sha512-K+FmWcdj/uyP8GiG9foxOCPfb5OAZG0uSVq80DKgVSC0U44AdGjvAvVZkrgFEcZ6cCqlNC2JfYmslB5iqdL7tg==", + "sass-embedded-linux-musl-x64@1.97.2": { + "integrity": "sha512-ZAxYOdmexcnxGnzdsDjYmNe3jGj+XW3/pF/n7e7r8y+5c6D2CQRrCUdapLgaqPt1edOPQIlQEZF8q5j6ng21yw==", "os": ["linux"], "cpu": ["x64"] }, - "sass-embedded-linux-riscv64@1.89.2": { - "integrity": "sha512-g9nTbnD/3yhOaskeqeBQETbtfDQWRgsjHok6bn7DdAuwBsyrR3JlSFyqKc46pn9Xxd9SQQZU8AzM4IR+sY0A0w==", + "sass-embedded-linux-riscv64@1.97.2": { + "integrity": "sha512-reVwa9ZFEAOChXpDyNB3nNHHyAkPMD+FTctQKECqKiVJnIzv2EaFF6/t0wzyvPgBKeatA8jszAIeOkkOzbYVkQ==", "os": ["linux"], "cpu": ["riscv64"] }, - "sass-embedded-linux-x64@1.89.2": { - "integrity": "sha512-Ax7dKvzncyQzIl4r7012KCMBvJzOz4uwSNoyoM5IV6y5I1f5hEwI25+U4WfuTqdkv42taCMgpjZbh9ERr6JVMQ==", + "sass-embedded-linux-x64@1.97.2": { + "integrity": "sha512-bvAdZQsX3jDBv6m4emaU2OMTpN0KndzTAMgJZZrKUgiC0qxBmBqbJG06Oj/lOCoXGCxAvUOheVYpezRTF+Feog==", "os": ["linux"], "cpu": ["x64"] }, - "sass-embedded-win32-arm64@1.89.2": { - "integrity": "sha512-j96iJni50ZUsfD6tRxDQE2QSYQ2WrfHxeiyAXf41Kw0V4w5KYR/Sf6rCZQLMTUOHnD16qTMVpQi20LQSqf4WGg==", + "sass-embedded-unknown-all@1.97.2": { + "integrity": "sha512-86tcYwohjPgSZtgeU9K4LikrKBJNf8ZW/vfsFbdzsRlvc73IykiqanufwQi5qIul0YHuu9lZtDWyWxM2dH/Rsg==", + "dependencies": [ + "sass" + ], + "os": ["!android", "!darwin", "!linux", "!win32"] + }, + "sass-embedded-win32-arm64@1.97.2": { + "integrity": "sha512-Cv28q8qNjAjZfqfzTrQvKf4JjsZ6EOQ5FxyHUQQeNzm73R86nd/8ozDa1Vmn79Hq0kwM15OCM9epanDuTG1ksA==", "os": ["win32"], "cpu": ["arm64"] }, - "sass-embedded-win32-x64@1.89.2": { - "integrity": "sha512-cS2j5ljdkQsb4PaORiClaVYynE9OAPZG/XjbOMxpQmjRIf7UroY4PEIH+Waf+y47PfXFX9SyxhYuw2NIKGbEng==", + "sass-embedded-win32-x64@1.97.2": { + "integrity": "sha512-DVxLxkeDCGIYeyHLAvWW3yy9sy5Ruk5p472QWiyfyyG1G1ASAR8fgfIY5pT0vE6Rv+VAKVLwF3WTspUYu7S1/Q==", "os": ["win32"], "cpu": ["x64"] + }, + "sass-embedded@1.97.2": { + "integrity": "sha512-lKJcskySwAtJ4QRirKrikrWMFa2niAuaGenY2ElHjd55IwHUiur5IdKu6R1hEmGYMs4Qm+6rlRW0RvuAkmcryg==", + "dependencies": [ + "@bufbuild/protobuf", + "buffer-builder", + "colorjs.io", + "immutable", + "rxjs", + "supports-color@8.1.1", + "sync-child-process", + "varint" + ], + "optionalDependencies": [ + "sass-embedded-all-unknown", + "sass-embedded-android-arm", + "sass-embedded-android-arm64", + "sass-embedded-android-riscv64", + "sass-embedded-android-x64", + "sass-embedded-darwin-arm64", + "sass-embedded-darwin-x64", + "sass-embedded-linux-arm", + "sass-embedded-linux-arm64", + "sass-embedded-linux-musl-arm", + "sass-embedded-linux-musl-arm64", + "sass-embedded-linux-musl-riscv64", + "sass-embedded-linux-musl-x64", + "sass-embedded-linux-riscv64", + "sass-embedded-linux-x64", + "sass-embedded-unknown-all", + "sass-embedded-win32-arm64", + "sass-embedded-win32-x64" + ], + "bin": true + }, + "sass@1.97.2": { + "integrity": "sha512-y5LWb0IlbO4e97Zr7c3mlpabcbBtS+ieiZ9iwDooShpFKWXf62zz5pEPdwrLYm+Bxn1fnbwFGzHuCLSA9tBmrw==", + "dependencies": [ + "chokidar", + "immutable", + "source-map-js" + ], + "optionalDependencies": [ + "@parcel/watcher" + ], + "bin": true + }, + "sax@1.4.4": { + "integrity": "sha512-1n3r/tGXO6b6VXMdFT54SHzT9ytu9yr7TaELowdYpMqY/Ao7EnlQGmAQ1+RatX7Tkkdm6hONI2owqNx2aZj5Sw==" + }, + "semver@6.3.1": { + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "bin": true + }, + "semver@7.7.3": { + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "bin": true + }, + "sharp@0.34.5": { + "integrity": "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==", + "dependencies": [ + "@img/colour", + "detect-libc", + "semver@7.7.3" + ], + "optionalDependencies": [ + "@img/sharp-darwin-arm64", + "@img/sharp-darwin-x64", + "@img/sharp-libvips-darwin-arm64", + "@img/sharp-libvips-darwin-x64", + "@img/sharp-libvips-linux-arm", + "@img/sharp-libvips-linux-arm64", + "@img/sharp-libvips-linux-ppc64", + "@img/sharp-libvips-linux-riscv64", + "@img/sharp-libvips-linux-s390x", + "@img/sharp-libvips-linux-x64", + "@img/sharp-libvips-linuxmusl-arm64", + "@img/sharp-libvips-linuxmusl-x64", + "@img/sharp-linux-arm", + "@img/sharp-linux-arm64", + "@img/sharp-linux-ppc64", + "@img/sharp-linux-riscv64", + "@img/sharp-linux-s390x", + "@img/sharp-linux-x64", + "@img/sharp-linuxmusl-arm64", + "@img/sharp-linuxmusl-x64", + "@img/sharp-wasm32", + "@img/sharp-win32-arm64", + "@img/sharp-win32-ia32", + "@img/sharp-win32-x64" + ], + "scripts": true + }, + "shebang-command@2.0.0": { + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": [ + "shebang-regex" + ] + }, + "shebang-regex@3.0.0": { + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "shell-quote@1.8.3": { + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==" + }, + "shiki@1.29.2": { + "integrity": "sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==", + "dependencies": [ + "@shikijs/core", + "@shikijs/engine-javascript", + "@shikijs/engine-oniguruma", + "@shikijs/langs", + "@shikijs/themes", + "@shikijs/types", + "@shikijs/vscode-textmate", + "@types/hast" + ] + }, + "sirv@3.0.2": { + "integrity": "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==", + "dependencies": [ + "@polka/url", + "mrmime", + "totalist" + ] + }, + "smtp-address-parser@1.0.10": { + "integrity": "sha512-Osg9LmvGeAG/hyao4mldbflLOkkr3a+h4m1lwKCK5U8M6ZAr7tdXEz/+/vr752TSGE4MNUlUl9cIK2cB8cgzXg==", + "dependencies": [ + "nearley" + ] + }, + "source-map-js@1.2.1": { + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==" + }, + "space-separated-tokens@2.0.2": { + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==" + }, + "speakingurl@14.0.1": { + "integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==" + }, + "string-width@7.2.0": { + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dependencies": [ + "emoji-regex", + "get-east-asian-width", + "strip-ansi" + ] + }, + "stringify-entities@4.0.4": { + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dependencies": [ + "character-entities-html4", + "character-entities-legacy" + ] + }, + "strip-ansi@7.1.2": { + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dependencies": [ + "ansi-regex" + ] + }, + "strip-json-comments@3.1.1": { + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" + }, + "style-mod@4.1.3": { + "integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==" + }, + "superjson@2.2.6": { + "integrity": "sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==", + "dependencies": [ + "copy-anything" + ] + }, + "supports-color@7.2.0": { + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": [ + "has-flag" + ] + }, + "supports-color@8.1.1": { + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": [ + "has-flag" + ] + }, + "svgo@4.0.0": { + "integrity": "sha512-VvrHQ+9uniE+Mvx3+C9IEe/lWasXCU0nXMY2kZeLrHNICuRiC8uMPyM14UEaMOFA5mhyQqEkB02VoQ16n3DLaw==", + "dependencies": [ + "commander@11.1.0", + "css-select", + "css-tree@3.1.0", + "css-what", + "csso", + "picocolors", + "sax" + ], + "bin": true + }, + "sync-child-process@1.0.2": { + "integrity": "sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==", + "dependencies": [ + "sync-message-port" + ] + }, + "sync-message-port@1.1.3": { + "integrity": "sha512-GTt8rSKje5FilG+wEdfCkOcLL7LWqpMlr2c3LRuKt/YXxcJ52aGSbGBAdI4L3aaqfrBt6y711El53ItyH1NWzg==" + }, + "synckit@0.11.12": { + "integrity": "sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ==", + "dependencies": [ + "@pkgr/core" + ] + }, + "tar@6.2.1": { + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dependencies": [ + "chownr", + "fs-minipass", + "minipass@5.0.0", + "minizlib", + "mkdirp", + "yallist@4.0.0" + ], + "deprecated": true + }, + "tinycolor2@1.6.0": { + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "tinyglobby@0.2.15_picomatch@4.0.3": { + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dependencies": [ + "fdir", + "picomatch@4.0.3" + ] + }, + "to-regex-range@5.0.1": { + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": [ + "is-number" + ] + }, + "totalist@3.0.1": { + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==" + }, + "trim-lines@3.0.1": { + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==" + }, + "ts-api-utils@2.4.0_typescript@5.9.3": { + "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", + "dependencies": [ + "typescript" + ] + }, + "tslib@2.8.1": { + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, + "type-check@0.4.0": { + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dependencies": [ + "prelude-ls" + ] + }, + "typescript-eslint@8.53.1_eslint@9.39.2__jiti@2.6.1_typescript@5.9.3_@typescript-eslint+parser@8.53.1__eslint@9.39.2___jiti@2.6.1__typescript@5.9.3__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-gB+EVQfP5RDElh9ittfXlhZJdjSU4jUSTyE2+ia8CYyNvet4ElfaLlAIqDvQV9JPknKx0jQH1racTYe/4LaLSg==", + "dependencies": [ + "@typescript-eslint/eslint-plugin", + "@typescript-eslint/parser", + "@typescript-eslint/typescript-estree", + "@typescript-eslint/utils", + "eslint", + "typescript" + ] + }, + "typescript@5.9.3": { + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "bin": true + }, + "uc.micro@2.1.0": { + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==" + }, + "ufo@1.6.3": { + "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==" + }, + "undici-types@7.16.0": { + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==" + }, + "unist-util-is@6.0.1": { + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "dependencies": [ + "@types/unist" + ] + }, + "unist-util-position@5.0.0": { + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dependencies": [ + "@types/unist" + ] + }, + "unist-util-stringify-position@4.0.0": { + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dependencies": [ + "@types/unist" + ] + }, + "unist-util-visit-parents@6.0.2": { + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "dependencies": [ + "@types/unist", + "unist-util-is" + ] + }, + "unist-util-visit@5.0.0": { + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dependencies": [ + "@types/unist", + "unist-util-is", + "unist-util-visit-parents" + ] + }, + "unplugin-utils@0.3.1": { + "integrity": "sha512-5lWVjgi6vuHhJ526bI4nlCOmkCIF3nnfXkCMDeMJrtdvxTs6ZFCM8oNufGTsDbKv/tJ/xj8RpvXjRuPBZJuJog==", + "dependencies": [ + "pathe", + "picomatch@4.0.3" + ] + }, + "unplugin-vue-components@30.0.0_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-4qVE/lwCgmdPTp6h0qsRN2u642tt4boBQtcpn4wQcWZAsr8TQwq+SPT3NDu/6kBFxzo/sSEK4ioXhOOBrXc3iw==", + "dependencies": [ + "chokidar", + "debug", + "local-pkg", + "magic-string", + "mlly", + "tinyglobby", + "unplugin", + "unplugin-utils", + "vue" + ] + }, + "unplugin@2.3.11": { + "integrity": "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww==", + "dependencies": [ + "@jridgewell/remapping", + "acorn@8.15.0", + "picomatch@4.0.3", + "webpack-virtual-modules" + ] + }, + "update-browserslist-db@1.2.3_browserslist@4.28.1": { + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dependencies": [ + "browserslist", + "escalade", + "picocolors" + ], + "bin": true + }, + "uri-js@4.4.1": { + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": [ + "punycode" + ] + }, + "util-deprecate@1.0.2": { + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "valid-url@1.0.9": { + "integrity": "sha512-QQDsV8OnSf5Uc30CKSwG9lnhMPe6exHtTXLRYX8uMwKENy640pU+2BgBL0LRbDh/eYRahNCS7aewCx0wf3NYVA==" + }, + "varint@6.0.0": { + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==" + }, + "vfile-message@4.0.3": { + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "dependencies": [ + "@types/unist", + "unist-util-stringify-position" + ] + }, + "vfile@6.0.3": { + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dependencies": [ + "@types/unist", + "vfile-message" + ] + }, + "vite-dev-rpc@1.1.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-pKXZlgoXGoE8sEKiKJSng4hI1sQ4wi5YT24FCrwrLt6opmkjlqPPVmiPWWJn8M8byMxRGzp1CrFuqQs4M/Z39A==", + "dependencies": [ + "birpc", + "vite", + "vite-hot-client" + ] + }, + "vite-hot-client@2.1.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-7SpgZmU7R+dDnSmvXE1mfDtnHLHQSisdySVR7lO8ceAXvM0otZeuQQ6C8LrS5d/aYyP/QZ0hI0L+dIPrm4YlFQ==", + "dependencies": [ + "vite" + ] + }, + "vite-multiple-assets@2.2.6_mime-types@2.1.35_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-biJ+c7mXGXlr0nLYgkiRzQC+pfuNoNfe2XaCzv149FgulCrR1oKE2psk6RXnJ+phUOuw+tCmE2TrlL09zyzHrg==", + "dependencies": [ + "fast-glob", + "micromatch", + "mime-types", + "rollup", + "vite", + "watchpack" + ] + }, + "vite-node@3.2.4_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", + "dependencies": [ + "cac", + "debug", + "es-module-lexer", + "pathe", + "vite" + ], + "bin": true + }, + "vite-plugin-image-optimizer@2.0.3_sharp@0.34.5_svgo@4.0.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-1vrFOTcpSvv6DCY7h8UXab4wqMAjTJB/ndOzG/Kmj1oDOuPF6mbjkNQoGzzCEYeWGe7qU93jc8oQqvoJ57al3A==", + "dependencies": [ + "ansi-colors", + "pathe", + "sharp", + "svgo", + "vite" + ], + "optionalPeers": [ + "sharp", + "svgo" + ] + }, + "vite-plugin-inspect@11.3.3_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-u2eV5La99oHoYPHE6UvbwgEqKKOQGz86wMg40CCosP6q8BkB6e5xPneZfYagK4ojPJSj5anHCrnvC20DpwVdRA==", + "dependencies": [ + "ansis", + "debug", + "error-stack-parser-es", + "ohash", + "open", + "perfect-debounce", + "sirv", + "unplugin-utils", + "vite", + "vite-dev-rpc" + ] + }, + "vite-plugin-vue-devtools@8.0.5_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_vue@3.5.27__typescript@5.9.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_typescript@5.9.3": { + "integrity": "sha512-p619BlKFOqQXJ6uDWS1vUPQzuJOD6xJTfftj57JXBGoBD/yeQCowR7pnWcr/FEX4/HVkFbreI6w2uuGBmQOh6A==", + "dependencies": [ + "@vue/devtools-core", + "@vue/devtools-kit", + "@vue/devtools-shared", + "sirv", + "vite", + "vite-plugin-inspect", + "vite-plugin-vue-inspector" + ] + }, + "vite-plugin-vue-inspector@5.3.2_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@babel+core@7.28.6_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-YvEKooQcSiBTAs0DoYLfefNja9bLgkFM7NI2b07bE2SruuvX0MEa9cMaxjKVMkeCp5Nz9FRIdcN1rOdFVBeL6Q==", + "dependencies": [ + "@babel/core", + "@babel/plugin-proposal-decorators", + "@babel/plugin-syntax-import-attributes", + "@babel/plugin-syntax-import-meta", + "@babel/plugin-transform-typescript", + "@vue/babel-plugin-jsx", + "@vue/compiler-dom", + "kolorist", + "magic-string", + "vite" + ] + }, + "vite-plugin-wasm@3.5.0_vite@7.3.1__@types+node@24.10.9__jiti@2.6.1__sass-embedded@1.97.2__picomatch@4.0.3_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2": { + "integrity": "sha512-X5VWgCnqiQEGb+omhlBVsvTfxikKtoOgAzQ95+BZ8gQ+VfMHIjSHr0wyvXFQCa0eKQ0fKyaL0kWcEnYqBac4lQ==", + "dependencies": [ + "vite" + ] + }, + "vite@7.3.1_@types+node@24.10.9_jiti@2.6.1_sass-embedded@1.97.2_picomatch@4.0.3": { + "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", + "dependencies": [ + "@types/node", + "esbuild", + "fdir", + "jiti", + "picomatch@4.0.3", + "postcss", + "rollup", + "sass-embedded", + "tinyglobby" + ], + "optionalDependencies": [ + "fsevents" + ], + "optionalPeers": [ + "@types/node", + "jiti", + "sass-embedded" + ], + "bin": true + }, + "vscode-jsonrpc@8.2.0": { + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==" + }, + "vscode-languageserver-protocol@3.17.5": { + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "dependencies": [ + "vscode-jsonrpc", + "vscode-languageserver-types" + ] + }, + "vscode-languageserver-textdocument@1.0.12": { + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==" + }, + "vscode-languageserver-types@3.17.5": { + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" + }, + "vscode-uri@3.1.0": { + "integrity": "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==" + }, + "vue-codemirror6@1.4.1_@codemirror+autocomplete@6.20.0_@codemirror+commands@6.10.1_@codemirror+language@6.12.1_@codemirror+lint@6.9.2_@codemirror+search@6.6.0_@codemirror+state@6.5.4_@codemirror+view@6.39.11_codemirror@6.0.2_style-mod@4.1.3_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-mokK4q89TvxtGXzdEv3YyvfX3RJJs7VxyNjBNpdNbP+jpum/ttLvWB+TEh/ziVZq5mFrQazVPCfUV8TVI/Ji2A==", + "dependencies": [ + "@codemirror/autocomplete", + "@codemirror/commands", + "@codemirror/language", + "@codemirror/lint", + "@codemirror/search", + "@codemirror/state", + "@codemirror/view", + "codemirror", + "style-mod", + "vue", + "vue-demi" + ] + }, + "vue-demi@0.14.10_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "dependencies": [ + "vue" + ], + "scripts": true, + "bin": true + }, + "vue-eslint-parser@10.2.0_eslint@9.39.2__jiti@2.6.1_jiti@2.6.1": { + "integrity": "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==", + "dependencies": [ + "debug", + "eslint", + "eslint-scope", + "eslint-visitor-keys@4.2.1", + "espree", + "esquery", + "semver@7.7.3" + ] + }, + "vue-router@4.6.4_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-Hz9q5sa33Yhduglwz6g9skT8OBPii+4bFn88w6J+J4MfEo4KRRpmiNG/hHHkdbRFlLBOqxN8y8gf2Fb0MTUgVg==", + "dependencies": [ + "@vue/devtools-api", + "vue" + ] + }, + "vue-tsc@3.2.2_typescript@5.9.3": { + "integrity": "sha512-r9YSia/VgGwmbbfC06hDdAatH634XJ9nVl6Zrnz1iK4ucp8Wu78kawplXnIDa3MSu1XdQQePTHLXYwPDWn+nyQ==", + "dependencies": [ + "@volar/typescript", + "@vue/language-core", + "typescript" + ], + "bin": true + }, + "vue-types@4.2.1_vue@3.5.27__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-DNQZmJuOvovLUIp0BENRkdnZHbI0V4e2mNvjAZOAXKD56YGvRchtUYOXA/XqTxdv7Ng5SJLZqRKRpAhm5NLaPQ==", + "dependencies": [ + "is-plain-object", + "vue" + ] + }, + "vue3-colorpicker@2.3.0_@aesoper+normal-utils@0.1.5_@popperjs+core@2.11.8_@vueuse+core@14.1.0__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_gradient-parser@1.1.1_lodash-es@4.17.22_tinycolor2@1.6.0_vue@3.5.27__typescript@5.9.3_vue-types@4.2.1__vue@3.5.27___typescript@5.9.3__typescript@5.9.3_typescript@5.9.3": { + "integrity": "sha512-e3lLmBcy7mkRrNQVeUny1DjOd6E11L8H5ok5Bx4MdXmrG+RzyacRF7KkhrEWmRYPhKAsaoUrWsFkmpPAaYnE5A==", + "dependencies": [ + "@aesoper/normal-utils", + "@popperjs/core", + "@vueuse/core", + "gradient-parser", + "lodash-es", + "tinycolor2", + "vue", + "vue-types" + ] + }, + "vue@3.5.27_typescript@5.9.3": { + "integrity": "sha512-aJ/UtoEyFySPBGarREmN4z6qNKpbEguYHMmXSiOGk69czc+zhs0NF6tEFrY8TZKAl8N/LYAkd4JHVd5E/AsSmw==", + "dependencies": [ + "@vue/compiler-dom", + "@vue/compiler-sfc", + "@vue/runtime-dom", + "@vue/server-renderer", + "@vue/shared", + "typescript" + ], + "optionalPeers": [ + "typescript" + ] + }, + "w3c-keyname@2.2.8": { + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==" + }, + "wasm-pack@0.13.1": { + "integrity": "sha512-P9exD4YkjpDbw68xUhF3MDm/CC/3eTmmthyG5bHJ56kalxOTewOunxTke4SyF8MTXV6jUtNjXggPgrGmMtczGg==", + "dependencies": [ + "binary-install" + ], + "scripts": true, + "bin": true + }, + "watchpack@2.5.1": { + "integrity": "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==", + "dependencies": [ + "glob-to-regexp", + "graceful-fs" + ] + }, + "webpack-virtual-modules@0.6.2": { + "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==" + }, + "which@2.0.2": { + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": [ + "isexe@2.0.0" + ], + "bin": true + }, + "which@5.0.0": { + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "dependencies": [ + "isexe@3.1.1" + ], + "bin": true + }, + "word-wrap@1.2.5": { + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==" + }, + "wrap-ansi@9.0.2": { + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "dependencies": [ + "ansi-styles@6.2.3", + "string-width", + "strip-ansi" + ] + }, + "wrappy@1.0.2": { + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "wsl-utils@0.1.0": { + "integrity": "sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==", + "dependencies": [ + "is-wsl" + ] + }, + "xml-name-validator@4.0.0": { + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==" + }, + "xterm@5.3.0": { + "integrity": "sha512-8QqjlekLUFTrU6x7xck1MsPzPA571K5zNqWm0M0oroYEWVOptZ0+ubQSkQ3uxIEhcIHRujJy6emDWX4A7qyFzg==", + "deprecated": true + }, + "y18n@5.0.8": { + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yallist@3.1.1": { + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "yallist@4.0.0": { + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "yaml@2.8.2": { + "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", + "bin": true + }, + "yargs-parser@22.0.0": { + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==" + }, + "yargs@18.0.0": { + "integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", + "dependencies": [ + "cliui", + "escalade", + "get-caller-file", + "string-width", + "y18n", + "yargs-parser" + ] + }, + "yocto-queue@0.1.0": { + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" + }, + "zwitch@2.0.4": { + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==" } }, "redirects": { @@ -451,39 +4143,10 @@ "https://deno.land/std@0.224.0/assert/mod.ts": "48b8cb8a619ea0b7958ad7ee9376500fe902284bb36f0e32c598c3dc34cbd6f3", "https://deno.land/std@0.224.0/assert/unimplemented.ts": "8c55a5793e9147b4f1ef68cd66496b7d5ba7a9e7ca30c6da070c1a58da723d73", "https://deno.land/std@0.224.0/assert/unreachable.ts": "5ae3dbf63ef988615b93eb08d395dda771c96546565f9e521ed86f6510c29e19", - "https://deno.land/std@0.224.0/bytes/concat.ts": "86161274b5546a02bdb3154652418efe7af8c9310e8d54107a68aaa148e0f5ed", - "https://deno.land/std@0.224.0/bytes/copy.ts": "08d85062240a7223e6ec4e2af193ad1a50c59a43f0d86ac3a7b16f3e0d77c028", "https://deno.land/std@0.224.0/fmt/colors.ts": "508563c0659dd7198ba4bbf87e97f654af3c34eb56ba790260f252ad8012e1c5", "https://deno.land/std@0.224.0/internal/diff.ts": "6234a4b493ebe65dc67a18a0eb97ef683626a1166a1906232ce186ae9f65f4e6", "https://deno.land/std@0.224.0/internal/format.ts": "0a98ee226fd3d43450245b1844b47003419d34d210fa989900861c79820d21c2", - "https://deno.land/std@0.224.0/internal/mod.ts": "534125398c8e7426183e12dc255bb635d94e06d0f93c60a297723abe69d3b22e", - "https://deno.land/std@0.224.0/io/_common.ts": "36705cdb4dfcd338d6131bca1b16e48a4d5bf0d1dada6ce397268e88c17a5835", - "https://deno.land/std@0.224.0/io/_constants.ts": "3c7ad4695832e6e4a32e35f218c70376b62bc78621ef069a4a0a3d55739f8856", - "https://deno.land/std@0.224.0/io/buf_reader.ts": "aa6d589e567c964c8ba1f582648f3feac45e88ab2e3d2cc2c9f84fd73c05d051", - "https://deno.land/std@0.224.0/io/buf_writer.ts": "3fab3fbeae7a6ed1672207b640b6781a2369890878f8a7bb35f95d364dd6dae6", - "https://deno.land/std@0.224.0/io/buffer.ts": "4d1f805f350433e418002accec798bc6c33ce18f614afa65f987c202d7b2234e", - "https://deno.land/std@0.224.0/io/copy.ts": "63c6a4acf71fb1e89f5e47a7b3b2972f9d2c56dd645560975ead72db7eb23f61", - "https://deno.land/std@0.224.0/io/copy_n.ts": "1bad1525b1f78737cb4c11084e2f7cf22359210fea89e2f0e784bd9a4b221fca", - "https://deno.land/std@0.224.0/io/iterate_reader.ts": "1e5e4fea22d8965afb7df4ee9ab9adda0a0fc581adbea31bc2f2d25453f8a6e9", - "https://deno.land/std@0.224.0/io/limited_reader.ts": "bbe3f7dafe9dd076d0c92d88b1b94e91ecad4825997064f44c2a767737ad2526", - "https://deno.land/std@0.224.0/io/mod.ts": "f0a3f9d419394cec27099ba15ab0c8100da1e70928f95ebe646caaf667c6870c", - "https://deno.land/std@0.224.0/io/multi_reader.ts": "dd8f06d50adec0e1befb92a1d354fcf28733a4b1669b23bf534ace161ce61b1c", - "https://deno.land/std@0.224.0/io/read_all.ts": "876c1cb20adea15349c72afc86cecd3573335845ae778967aefb5e55fe5a8a4a", - "https://deno.land/std@0.224.0/io/read_delim.ts": "d26cfed53b0c2c127ec3453ccd65f474ecc36a331209e246448885434afffc4e", - "https://deno.land/std@0.224.0/io/read_int.ts": "2412f106103a271f5d770b2a61c97b13eebcd18de414a0a092ed82dfcb875903", - "https://deno.land/std@0.224.0/io/read_lines.ts": "17b96f87dbebc5edb976b3d83dc7713bddb994e9c8cb688012d6c6c26803fb9e", - "https://deno.land/std@0.224.0/io/read_long.ts": "d7cd367ab5c1263014c32a76afa0f0584c3bf3a3d860963c7368a6825094df46", - "https://deno.land/std@0.224.0/io/read_range.ts": "2ddfedbfff44e4ea8d60c0463cddb2b1860293d932d6a72a0fb78bdf412538fc", - "https://deno.land/std@0.224.0/io/read_short.ts": "f6dff570e685ade917dcb5188e8ecf0b701d6581b0cd186f08e6efe7f5ce33f7", - "https://deno.land/std@0.224.0/io/read_string_delim.ts": "f6beafa8969e6d9d6d7d679f846cd6595d8b6e99091a20a0aecbd50eb30a391e", - "https://deno.land/std@0.224.0/io/reader_from_stream_reader.ts": "a75bbc93f39df8b0e372cc1fbdc416a7cbf2a39fc4c09ddb057f1241100191c5", - "https://deno.land/std@0.224.0/io/slice_long_to_bytes.ts": "bc59a7aaac64845371dbd44debf3e864ae7b7e453127751d96e30adb29fb633b", - "https://deno.land/std@0.224.0/io/string_reader.ts": "279e9ea72e0ed7af6a9cb6da84f4148af93df849d308c31f124ca21f16d09cf2", - "https://deno.land/std@0.224.0/io/string_writer.ts": "923954c2038a622b84c294b94a3a322565fa0d67e8b4c62942b154fc1ad3bb9b", - "https://deno.land/std@0.224.0/io/to_readable_stream.ts": "ed03a44a1ec1cc55a85a857acf6cac472035298f6f3b6207ea209f93b4aefb39", - "https://deno.land/std@0.224.0/io/to_writable_stream.ts": "ef422e0425963c8a1e0481674e66c3023da50f0acbe5ef51ec9789efc3c1e2ed", - "https://deno.land/std@0.224.0/io/types.ts": "acecb3074c730b5ff487ba4fe9ce51e67bd982aa07c95e5f5679b7b2f24ad129", - "https://deno.land/std@0.224.0/io/write_all.ts": "24aac2312bb21096ae3ae0b102b22c26164d3249dff96dbac130958aa736f038" + "https://deno.land/std@0.224.0/internal/mod.ts": "534125398c8e7426183e12dc255bb635d94e06d0f93c60a297723abe69d3b22e" }, "workspace": { "packageJson": { @@ -526,20 +4189,20 @@ "npm:globals@^16.5.0", "npm:humanize-duration@^3.33.0", "npm:jiti@^2.6.1", - "npm:js-yaml@^4.1.0", + "npm:js-yaml@^4.1.1", "npm:mitt@^3.0.1", "npm:monaco-editor@0.54", "npm:monaco-vim@~0.4.2", "npm:monaco-yaml@^5.4.0", "npm:npm-run-all2@^8.0.4", "npm:prettier-plugin-vue@^1.1.6", - "npm:prettier@^3.7.3", + "npm:prettier@^3.7.4", "npm:qrcode.vue@^3.6.0", "npm:readline-sync@^1.4.10", "npm:sass-embedded@^1.93.3", "npm:sharp@~0.34.5", "npm:svgo@4", - "npm:typescript@~5.9.3", + "npm:typescript@^5.8.3", "npm:unplugin-vue-components@30", "npm:vite-multiple-assets@^2.2.6", "npm:vite-node@^3.2.4", diff --git a/docs/dev.md b/docs/dev.md index 15369b840..ede2329b7 100644 --- a/docs/dev.md +++ b/docs/dev.md @@ -80,12 +80,23 @@ bun format ``` ### Run Tests + Unit tests (with [Deno](https://deno.com/)) + ```sh deno test -A --unstable-node-globals --parallel ``` +Integration tests use [Deno's snapshot testing](https://docs.deno.com/examples/snapshot_test_tutorial/). +They store the last known good result, and compare new results against the +stored snapshots to verify them (showing the differences if they don't match). +For this reason, the snapshots should always be committed to the repo. They are +run along with the other tests using the command above. The snapshots can be +created/updated automatically with: +```sh +deno test -A --unstable-node-globals --parallel -- --update +``` ## Backend RPC Server This project includes a JSON RPC server that exposes the CREATOR emulator's core functionalities. diff --git a/docs/interrupts.md b/docs/interrupts.md index 44645fc74..d420c525b 100644 --- a/docs/interrupts.md +++ b/docs/interrupts.md @@ -1,55 +1,35 @@ # Managing interrupts in CREATOR -Interrupts are handled in the `execute_instruction()` function, after -fetching the instruction. -Interrupts are marked as enabled through the `interruptsEnabled` -flag in status, and checked through the `checkinterrupt()` function (which -uses the architecture-defined `check`). +Interrupts are handled in the `execute_instruction()` function, after fetching the instruction. +Interrupts are marked as enabled through the `interruptsEnabled` flag in status, and checked through the `checkinterrupt()` function (which uses the architecture-defined `check`). -When an interrupt is detected, and interrupts are enabled, the -`handleInterrupt()` function is executed. This function changes the -execution mode to `ExecutionMode.Kernel`, stores the `program_counter` -register in the `exception_program_counter` register, and jumps to the -interruption handler address obtained through the architecture-defined -`get_handler_addr`. Finally, it clears the interruption through the -architechitecture-defined `clear`. +When an interrupt is detected, and interrupts are enabled, the `handleInterrupt()` function is executed. +This function changes the execution mode to `ExecutionMode.Kernel`, stores the `program_counter` register in the `exception_program_counter` register, and jumps to the interruption handler address obtained through the architecture-defined `get_handler_addr`. +Finally, it clears the interruption through the architechitecture-defined `clear`. -The execution mode change is required for the execution of privileged -instructions (see [Privileged instructions in CREATOR](privileged.md)). +The execution mode change is required for the execution of privileged instructions (see [Privileged instructions in CREATOR](privileged.md)). ## Architecture definition -For interrupts to be managed correctly, the architecture definition file -must include the following properties: -- `interrupts.enabled: boolean`: Controls whether interrupts are enabled -by default. -- `interrupts.check: string`: JS code to be executed in order -to check whether an interrupt happened. It must return a +For interrupts to be managed correctly, the architecture definition file must include the following properties: +- `interrupts.enabled: boolean`: Controls whether interrupts are enabled by default. +- `interrupts.check: string`: JS code to be executed in order to check whether an interrupt happened. It must return a `InterruptType` (if an interrupt happened) or `null` (if it didn't). -- `interrupts.is_enabled: string`: JS code to be executed in order to -check whether interrupts are enabled. -- `interrupts.enable: string`: JS code to be executed in order -to enable interrupts. -- `interrupts.disable: string`: JS code to be executed in order -to disable interrupts. -- `interrupts.get_handler_addr: string`: JS code to be executed in order -to obtain the interrupt handler address. -- `interrupts.clear: string`: JS code to be executed in order -to clear an interrupt. -- `interrupts.create: (InterruptType) => null`: JS arrow -(lambda) function to be executed in order to set an interrupt given an -interrupt type. +- `interrupts.is_enabled: string`: JS code to be executed in order to check whether interrupts are enabled. +- `interrupts.enable: string`: JS code to be executed in order to enable interrupts. +- `interrupts.disable: string`: JS code to be executed in order to disable interrupts. +- `interrupts.get_handler_addr: string`: JS code to be executed in order to obtain the interrupt handler address. +- `interrupts.clear: string`: JS code to be executed in order to clear an interrupt. +- `interrupts.create: (InterruptType) => null`: JS arrow (lambda) function to be executed in order to set an interrupt given an interrupt type. ## API ### Functions The following functions, belonging to -[`core/executor/interrupts.mts`](../src/core/executor/interrupts.mts), were implemented: -- `enableInterrupts(null) -> null`: Enables interrupts by calling -`architecture.interrupts.enable`. -- `disableInterrupts(null) -> null`: Disables interrupts by calling -`architecture.interrupts.disable`. +[`core/executor/interrupts.mts`](../src/core/executor/InterruptManager.mts), were implemented: +- `enableInterrupts(null) -> null`: Enables interrupts by calling `architecture.interrupts.enable`. +- `disableInterrupts(null) -> null`: Disables interrupts by calling `architecture.interrupts.disable`. - `checkInterrupt(null) -> null`: Checks whether interrupts are enabled - `handleInterrupt(null) -> null`: Handles an interrupt. @@ -72,71 +52,53 @@ The variables that control the interrupts are stored in `core:status`: ## Example: Interrupts in RISC-V An example of RISC-V with interruptions can be found in the -[`RISC_V_RV32IMFD_Interrupts.json`](../architecture/RISC_V_RV32IMFD_Interrupts.json) -file. +[`RISC_V_RV32IMFD_Interrupts.json`](../architecture/RISCV/RV32IMFD.yml) + ### Interrupt mechanism -In RISC-V, when an interrupt happens, a bit is set in the `MIP` (_Machine -Interrupt Pending_) control register. -Depending on the type of interrupt, it sets a different bit. For example: +In RISC-V, when an interrupt happens, a bit is set in the `MIP` (_Machine Interrupt Pending_) control register. +Depending on the type of interrupt, it sets a different bit. +For example: - Bit `3` (`MSIP`) is set to indicate a _software_ interrupt - Bit `11` (`MEIP`) is set to indicate an _external_ interrupt -Therefore, `check` must read these values in order to determine the -type of the interrupt. +Therefore, `check` must read these values in order to determine the type of the interrupt. -Then, the value of the current instruction is stored in the `MEPC` control -register (tagged as `exception_program_counter`). The value for the interrupt -handler is stored in the `MTVEC` control register, where bits `1` and `0` (MODE) -determine the vector mode, and the rest of the register encodes the base address -(BASE). +Then, the value of the current instruction is stored in the `MEPC` control register (tagged as `exception_program_counter`). +The value for the interrupt handler is stored in the `MTVEC` control register, where bits `1` and `0` (MODE) determine the vector mode, and the rest of the register encodes the base address (BASE). The different modes are: - `0` (direct): All traps set `pc` to the base address - `1` (vectored): Asynchronous interrupts set `pc` to $BASE+4\times cause$ -Here we implemented the _direct_ mode, meaning that `MTVEC` holds `0x00000000`, -the address of the handler. +Here we implemented the _direct_ mode, meaning that `MTVEC` holds `0x00000000`, the address of the handler. > [!NOTE] > As we'll see in [Interrupt handling](#interrupt-handling), this requires the > handling routine to be at the start of the text (`.text`) segment. + Also, the cause of the interrupt is stored in the `MCAUSE` (_Machine Cause_). -This control register is divided into bit `31`, which holds the interrupt type, -and the rest of the bits, each bit corresponding to a specific exception code. +This control register is divided into bit `31`, which holds the interrupt type, and the rest of the bits, each bit corresponding to a specific exception code. Some of the most used are: - `0`-`3` (`0x00000008`): Machine software interrupt -- `0`-`8` (`0x00000100`): Machine external interrupt - `1`-`11` (`0x80000800`): -Environment call from U-mode +- `0`-`8` (`0x00000100`): Machine external interrupt - `1`-`11` (`0x80000800`): Environment call from U-mode -Therefore, in the case of the `ecall` instruction, bit `3` of `MIP` and bit 8 of -`MCAUSE` are set. +Therefore, in the case of the `ecall` instruction, bit `3` of `MIP` and bit 8 of `MCAUSE` are set. ### Interrupt enabling -The `MIE` control register is in charge, together with `MSTATUS`, of -enabling/disabling interrupt types. The types use the same bits as in the `MIP` -register. +The `MIE` control register is in charge, together with `MSTATUS`, of enabling/disabling interrupt types. The types use the same bits as in the `MIP` register. ### Interrupt handling A full example of handling an environment call is provided in -[`examples/riscv-interrupts/ex0.s`](../examples/riscv-interrupts/ex0.s). +[`examples/riscv-interrupts/ex0.s`](../examples/RISCV-32-interrupts/example1.s). First, we need to talk about some new privileged instructions: -- `mret`: This instruction is used to return from an interrupt, which saves the -`MEPC` to the `PC`, clears the interrupt by clearing bits `3` and `11` in `MIP`, -and resetting `MCAUSE` to `0`. It also changes the execution mode back to -`ExecutionMode.User` (U-mode) -- `csrrw`: This instruction switches the values of a control register and a user -register. It's mainly used to store the values of user registers while handling -the interrupt, as we can't operate with control registers. The `MSCRATCH` -control register is provided in order to add an extra register. - -Reference: [The RISC-V Instruction Set Manual Volume II: Privileged -Architecture](https://github.com/riscv/riscv-isa-manual/), chapters 3.1, 3.3.1 -and 3.3.2. - +- `mret`: This instruction is used to return from an interrupt, which saves the `MEPC` to the `PC`, clears the interrupt by clearing bits `3` and `11` in `MIP`, and resetting `MCAUSE` to `0`. It also changes the execution mode back to `ExecutionMode.User` (U-mode) +- `csrrw`: This instruction switches the values of a control register and a user register. It's mainly used to store the values of user registers while handling the interrupt, as we can't operate with control registers. +The `MSCRATCH` control register is provided in order to add an extra register. +Reference: [The RISC-V Instruction Set Manual Volume II: Privileged Architecture](https://github.com/riscv/riscv-isa-manual/), chapters 3.1, 3.3.1 and 3.3.2. ### Implemented features @@ -147,11 +109,11 @@ Here is the table of implemented RISC-V features: | I.7.1 | CSR Instructions | :white_check_mark: | Only `csrrw`, and without checking for register `x0` | | II.3.1.1 - II.3.1.5 | Processor and ISA information (`misa`, `mvendorid`, etc.) | :x: | | | II.3.1.6 | `mstatus`/`mstatush` | :white_check_mark: | Only _Privilege and Global Interrupt-Enable_ (chapter II.3.1.6.1). Only `mstatus`, as only the 32-bit version is implemented | -| II.3.1.7, II.3.1.9, II.3.1.13 - II.3.1.16 | Interrupts (`mtvec`, `mip`, `mie`, `mscratch`, `mepc`, `mcause`) | :white_check_mark: | No `mtval` | +| II.3.1.7, II.3.1.9, II.3.1.13 - II.3.1.16 | Interrupts (`mtvec`, `mip`, `mie`, `mscratch`, `mepc`, `mcause`) | :white_check_mark: | No `mtval` | | II.3.1.8 | Trap Delegation | :x: | | | II.3.1.10 | Hardware performance Monitor | :x: | | | II.3.1.11 - II.3.1.12 | Counters | :x: | | | II.3.2.1 - II.3.3.2 | Environmen Calls and Trap-return | :white_check_mark: | Not breakpoints | | II.3.1.17 - II.3.2, II.3.6 - II.3.7 | Environment, Security and Memory | :x: | | | II.10 | Supervisor-Level ISA | :x: | | -| II.4 - II.9, II.11 - II.18 | Volume II Extensions | :x: | | \ No newline at end of file +| II.4 - II.9, II.11 - II.18 | Volume II Extensions | :x: | | diff --git a/docs/schema/architecture.json b/docs/schema/architecture.json index 7a9649a5d..0c4a102b0 100644 --- a/docs/schema/architecture.json +++ b/docs/schema/architecture.json @@ -201,6 +201,16 @@ "description": "Floating point registers", "type": "string", "enum": ["fp_registers"] + }, + { + "description": "Vector registers", + "type": "string", + "enum": ["v_registers"] + }, + { + "description": "Control state registers", + "type": "string", + "enum": ["csr_registers"] } ] }, @@ -307,6 +317,11 @@ "properties": { "name": { "oneOf": [ + { + "description": "Architecture compiled with Sail specification", + "type": "string", + "enum": ["Sail"] + }, { "description": "Default architecture-agnostic CREATOR assembler", "type": "string", @@ -501,6 +516,10 @@ "description": "Name of the instruction", "type": "string" }, + "extension": { + "description": "Extension of the instruction", + "type": "string" + }, "nwords": { "description": "Size of the instruction", "type": "integer", @@ -1145,6 +1164,7 @@ "Function call", "Transfer between registers", "Memory access", + "Vector Set Length Instruction with an inmediate", "Other" ] }, @@ -1355,10 +1375,14 @@ "required": ["end", "start"], "properties": { "end": { - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 18446744073709551615 }, "start": { - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 18446744073709551615 } } }, diff --git a/docs/version-management.md b/docs/version-management.md index 430c839e9..d44655fe3 100644 --- a/docs/version-management.md +++ b/docs/version-management.md @@ -12,7 +12,7 @@ The version is determined using the following priority order: 1. **`CREATOR_VERSION` environment variable** (highest priority) - Allows manual override for testing or special builds - - Example: `export CREATOR_VERSION=6.1.0-rc1` + - Example: `export CREATOR_VERSION=6.1.1-rc1` 2. **`CREATOR_CHANNEL` environment variable** - `CREATOR_CHANNEL=nightly`: Generates `nightly-YYYYMMDD` format @@ -27,7 +27,7 @@ The version is determined using the following priority order: ## Version Formats ### Stable Channel -- Format: `major.minor.patch` (e.g., `6.0.0`, `6.1.0`) +- Format: `major.minor.patch` (e.g., `6.0.0`, `6.1.0`, `6.1.1`) - Source: `package.json` version field - Used for: Official releases with version tags @@ -168,7 +168,7 @@ checkForUpdates(currentVersion); 3. Users will see update notifications daily if they run nightly builds ### For Stable Releases -1. Update `package.json` version to proper semantic version (e.g., `6.0.0`, `6.1.0`) +1. Update `package.json` version to proper semantic version (e.g., `6.0.0`, `6.1.0`, `6.1.1`) 2. Remove prerelease identifiers from package.json version 3. Set `CREATOR_CHANNEL=stable` or leave unset 4. Create a git tag matching the version @@ -183,7 +183,7 @@ checkForUpdates(currentVersion); // For development/beta - keep prerelease: { - "version": "6.1.0-beta" // Automatically treated as nightly + "version": "6.1.1-beta" // Automatically treated as nightly } ``` diff --git a/examples/MIPS-32/list.json b/examples/MIPS-32/list.json index a76b10e50..817c2bf88 100644 --- a/examples/MIPS-32/list.json +++ b/examples/MIPS-32/list.json @@ -9,7 +9,7 @@ "name": "Example 2", "id": "e2", "url": "examples/MIPS-32/example2.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 3", @@ -21,7 +21,7 @@ "name": "Example 4", "id": "e4", "url": "examples/MIPS-32/example4.s", - "description": "FPU operations" + "description": "FPU Operations" }, { "name": "Example 5", @@ -45,7 +45,7 @@ "name": "Example 8", "id": "e8", "url": "examples/MIPS-32/example8.s", - "description": "Copy of matrices" + "description": "Copy of Matrices" }, { "name": "Example 9", diff --git a/examples/RISCV-32-Sail-Validation/list.json b/examples/RISCV-32-Sail-Validation/list.json new file mode 100644 index 000000000..a1f9cebb2 --- /dev/null +++ b/examples/RISCV-32-Sail-Validation/list.json @@ -0,0 +1,536 @@ +[ + { + "name": "rv32ua-p-lrsc.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-lrsc.elf", + "doubleen": false, + "vectoren": true + }, + { + "name": "rv32ud-p-fmin.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ud-p-fmin.elf", + "doubleen": true, + "vectoren": true + }, + { + "name": "rv32mi-p-breakpoint.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-breakpoint.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32mi-p-csr.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-csr.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32mi-p-illegal.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-illegal.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32mi-p-ma_addr.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-ma_addr.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32mi-p-ma_fetch.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-ma_fetch.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32mi-p-mcsr.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-mcsr.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32mi-p-sbreak.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-sbreak.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32mi-p-scall.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-scall.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32mi-p-shamt.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32mi-p-shamt.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32si-p-csr.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32si-p-csr.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32si-p-dirty.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32si-p-dirty.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32si-p-ma_fetch.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32si-p-ma_fetch.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32si-p-sbreak.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32si-p-sbreak.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32si-p-scall.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32si-p-scall.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32si-p-wfi.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32si-p-wfi.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amoadd_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amoadd_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amoand_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amoand_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amomaxu_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amomaxu_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amomax_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amomax_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amominu_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amominu_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amomin_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amomin_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amoor_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amoor_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amoswap_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amoswap_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ua-p-amoxor_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ua-p-amoxor_w.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32uc-p-rvc.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uc-p-rvc.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ud-p-fadd.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ud-p-fadd.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32ud-p-fclass.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ud-p-fclass.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32ud-p-fcmp.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ud-p-fcmp.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32ud-p-fcvt.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ud-p-fcvt.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32ud-p-fcvt_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ud-p-fcvt_w.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32ud-p-fdiv.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ud-p-fdiv.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32ud-p-fmadd.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ud-p-fmadd.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32uf-p-fadd.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uf-p-fadd.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32uf-p-fclass.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uf-p-fclass.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32uf-p-fcmp.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uf-p-fcmp.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32uf-p-fcvt.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uf-p-fcvt.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32uf-p-fcvt_w.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uf-p-fcvt_w.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32uf-p-fdiv.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uf-p-fdiv.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32uf-p-fmadd.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uf-p-fmadd.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32uf-p-fmin.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32uf-p-fmin.elf", + "doubleen": true, + "vectoren": false + }, + { + "name": "rv32ui-p-add.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-add.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-addi.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-addi.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-and.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-and.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-andi.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-andi.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-auipc.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-auipc.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-beq.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-beq.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-bge.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-bge.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-bgeu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-bgeu.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-blt.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-blt.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-bltu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-bltu.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-bne.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-bne.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-fence_i.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-fence_i.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-jal.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-jal.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-jalr.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-jalr.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-lb.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-lb.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-lbu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-lbu.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-lh.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-lh.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-lhu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-lhu.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-lui.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-lui.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-lw.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-lw.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-or.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-or.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-ori.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-ori.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-sb.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-sb.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-sh.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-sh.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-simple.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-simple.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-sll.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-sll.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-slli.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-slli.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-slt.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-slt.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-slti.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-slti.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-sltiu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-sltiu.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-sltu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-sltu.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-sra.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-sra.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-srai.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-srai.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-srl.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-srl.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-srli.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-srli.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-sub.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-sub.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-sw.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-sw.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-xor.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-xor.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32ui-p-xori.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32ui-p-xori.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32um-p-div.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32um-p-div.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32um-p-divu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32um-p-divu.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32um-p-mul.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32um-p-mul.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32um-p-mulh.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32um-p-mulh.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32um-p-mulhsu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32um-p-mulhsu.elf", + "doubleen": true, + "vectoren": true + }, + { + "name": "rv32um-p-mulhu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32um-p-mulhu.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32um-p-rem.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32um-p-rem.elf", + "doubleen": false, + "vectoren": false + }, + { + "name": "rv32um-p-remu.elf", + "url": "examples/RISCV-32-Sail-Validation/rv32um-p-remu.elf", + "doubleen": false, + "vectoren": false + } +] \ No newline at end of file diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-breakpoint.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-breakpoint.elf new file mode 100644 index 000000000..b05473758 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-breakpoint.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-csr.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-csr.elf new file mode 100644 index 000000000..bdd015b69 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-csr.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-illegal.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-illegal.elf new file mode 100644 index 000000000..c4175e8cd Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-illegal.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-ma_addr.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-ma_addr.elf new file mode 100644 index 000000000..954fcccac Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-ma_addr.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-ma_fetch.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-ma_fetch.elf new file mode 100644 index 000000000..523433e63 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-ma_fetch.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-mcsr.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-mcsr.elf new file mode 100644 index 000000000..9c15c5890 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-mcsr.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-sbreak.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-sbreak.elf new file mode 100644 index 000000000..867e1d76f Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-sbreak.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-scall.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-scall.elf new file mode 100644 index 000000000..20c633102 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-scall.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32mi-p-shamt.elf b/examples/RISCV-32-Sail-Validation/rv32mi-p-shamt.elf new file mode 100644 index 000000000..5f4964f8d Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32mi-p-shamt.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32si-p-csr.elf b/examples/RISCV-32-Sail-Validation/rv32si-p-csr.elf new file mode 100644 index 000000000..a0f14b7bd Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32si-p-csr.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32si-p-dirty.elf b/examples/RISCV-32-Sail-Validation/rv32si-p-dirty.elf new file mode 100644 index 000000000..693451c60 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32si-p-dirty.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32si-p-ma_fetch.elf b/examples/RISCV-32-Sail-Validation/rv32si-p-ma_fetch.elf new file mode 100644 index 000000000..7a5fc3ccf Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32si-p-ma_fetch.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32si-p-sbreak.elf b/examples/RISCV-32-Sail-Validation/rv32si-p-sbreak.elf new file mode 100644 index 000000000..13af3541b Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32si-p-sbreak.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32si-p-scall.elf b/examples/RISCV-32-Sail-Validation/rv32si-p-scall.elf new file mode 100644 index 000000000..a73522ae9 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32si-p-scall.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32si-p-wfi.elf b/examples/RISCV-32-Sail-Validation/rv32si-p-wfi.elf new file mode 100644 index 000000000..b5471c1c0 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32si-p-wfi.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amoadd_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoadd_w.elf new file mode 100644 index 000000000..7e01c3580 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoadd_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amoand_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoand_w.elf new file mode 100644 index 000000000..0196fd606 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoand_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amomax_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amomax_w.elf new file mode 100644 index 000000000..b6e91a5b3 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amomax_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amomaxu_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amomaxu_w.elf new file mode 100644 index 000000000..81eeb29a1 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amomaxu_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amomin_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amomin_w.elf new file mode 100644 index 000000000..959194f68 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amomin_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amominu_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amominu_w.elf new file mode 100644 index 000000000..c8180700c Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amominu_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amoor_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoor_w.elf new file mode 100644 index 000000000..b62c0e82c Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoor_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amoswap_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoswap_w.elf new file mode 100644 index 000000000..3094b78b8 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoswap_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-amoxor_w.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoxor_w.elf new file mode 100644 index 000000000..a893682f4 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-amoxor_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ua-p-lrsc.elf b/examples/RISCV-32-Sail-Validation/rv32ua-p-lrsc.elf new file mode 100644 index 000000000..4f0e3edef Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ua-p-lrsc.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uc-p-rvc.elf b/examples/RISCV-32-Sail-Validation/rv32uc-p-rvc.elf new file mode 100644 index 000000000..7813b7124 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uc-p-rvc.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ud-p-fadd.elf b/examples/RISCV-32-Sail-Validation/rv32ud-p-fadd.elf new file mode 100644 index 000000000..d1835614b Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ud-p-fadd.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ud-p-fclass.elf b/examples/RISCV-32-Sail-Validation/rv32ud-p-fclass.elf new file mode 100644 index 000000000..7e67e8ba0 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ud-p-fclass.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ud-p-fcmp.elf b/examples/RISCV-32-Sail-Validation/rv32ud-p-fcmp.elf new file mode 100644 index 000000000..110986d39 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ud-p-fcmp.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ud-p-fcvt.elf b/examples/RISCV-32-Sail-Validation/rv32ud-p-fcvt.elf new file mode 100644 index 000000000..fda1e44f6 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ud-p-fcvt.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ud-p-fcvt_w.elf b/examples/RISCV-32-Sail-Validation/rv32ud-p-fcvt_w.elf new file mode 100644 index 000000000..77b06c093 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ud-p-fcvt_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ud-p-fdiv.elf b/examples/RISCV-32-Sail-Validation/rv32ud-p-fdiv.elf new file mode 100644 index 000000000..56fe7eb29 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ud-p-fdiv.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ud-p-fmadd.elf b/examples/RISCV-32-Sail-Validation/rv32ud-p-fmadd.elf new file mode 100644 index 000000000..33a8d1242 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ud-p-fmadd.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ud-p-fmin.elf b/examples/RISCV-32-Sail-Validation/rv32ud-p-fmin.elf new file mode 100644 index 000000000..1ff030465 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ud-p-fmin.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uf-p-fadd.elf b/examples/RISCV-32-Sail-Validation/rv32uf-p-fadd.elf new file mode 100644 index 000000000..a783f7ae3 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uf-p-fadd.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uf-p-fclass.elf b/examples/RISCV-32-Sail-Validation/rv32uf-p-fclass.elf new file mode 100644 index 000000000..3a520ad37 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uf-p-fclass.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uf-p-fcmp.elf b/examples/RISCV-32-Sail-Validation/rv32uf-p-fcmp.elf new file mode 100644 index 000000000..b0f64b185 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uf-p-fcmp.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uf-p-fcvt.elf b/examples/RISCV-32-Sail-Validation/rv32uf-p-fcvt.elf new file mode 100644 index 000000000..da776a266 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uf-p-fcvt.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uf-p-fcvt_w.elf b/examples/RISCV-32-Sail-Validation/rv32uf-p-fcvt_w.elf new file mode 100644 index 000000000..05dc1ab0f Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uf-p-fcvt_w.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uf-p-fdiv.elf b/examples/RISCV-32-Sail-Validation/rv32uf-p-fdiv.elf new file mode 100644 index 000000000..481285249 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uf-p-fdiv.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uf-p-fmadd.elf b/examples/RISCV-32-Sail-Validation/rv32uf-p-fmadd.elf new file mode 100644 index 000000000..e68a2ce80 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uf-p-fmadd.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32uf-p-fmin.elf b/examples/RISCV-32-Sail-Validation/rv32uf-p-fmin.elf new file mode 100644 index 000000000..e1774aa45 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32uf-p-fmin.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-add.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-add.elf new file mode 100644 index 000000000..a32ea3309 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-add.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-addi.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-addi.elf new file mode 100644 index 000000000..25f1c02c7 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-addi.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-and.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-and.elf new file mode 100644 index 000000000..f1468e41a Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-and.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-andi.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-andi.elf new file mode 100644 index 000000000..5c02664e0 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-andi.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-auipc.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-auipc.elf new file mode 100644 index 000000000..c50a29c14 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-auipc.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-beq.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-beq.elf new file mode 100644 index 000000000..0d2a410bf Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-beq.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-bge.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-bge.elf new file mode 100644 index 000000000..8979b9ef5 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-bge.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-bgeu.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-bgeu.elf new file mode 100644 index 000000000..80510421f Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-bgeu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-blt.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-blt.elf new file mode 100644 index 000000000..d46af0447 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-blt.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-bltu.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-bltu.elf new file mode 100644 index 000000000..e4e90ec3f Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-bltu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-bne.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-bne.elf new file mode 100644 index 000000000..3c3460bb1 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-bne.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-fence_i.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-fence_i.elf new file mode 100644 index 000000000..5a14522fb Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-fence_i.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-jal.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-jal.elf new file mode 100644 index 000000000..2f309033a Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-jal.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-jalr.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-jalr.elf new file mode 100644 index 000000000..78f985d44 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-jalr.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-lb.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-lb.elf new file mode 100644 index 000000000..5e070c89e Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-lb.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-lbu.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-lbu.elf new file mode 100644 index 000000000..b094c86c4 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-lbu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-lh.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-lh.elf new file mode 100644 index 000000000..348fa069d Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-lh.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-lhu.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-lhu.elf new file mode 100644 index 000000000..2849a586d Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-lhu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-lui.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-lui.elf new file mode 100644 index 000000000..c38c7f205 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-lui.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-lw.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-lw.elf new file mode 100644 index 000000000..d28a7f2a9 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-lw.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-or.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-or.elf new file mode 100644 index 000000000..0f505c0d7 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-or.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-ori.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-ori.elf new file mode 100644 index 000000000..eb13ca2df Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-ori.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-sb.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-sb.elf new file mode 100644 index 000000000..f51313b36 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-sb.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-sh.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-sh.elf new file mode 100644 index 000000000..5d8c24418 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-sh.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-simple.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-simple.elf new file mode 100644 index 000000000..5880eadeb Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-simple.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-sll.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-sll.elf new file mode 100644 index 000000000..eb8029fc2 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-sll.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-slli.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-slli.elf new file mode 100644 index 000000000..fdaf7c23e Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-slli.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-slt.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-slt.elf new file mode 100644 index 000000000..844410a0a Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-slt.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-slti.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-slti.elf new file mode 100644 index 000000000..faccd5130 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-slti.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-sltiu.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-sltiu.elf new file mode 100644 index 000000000..ada45e2ae Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-sltiu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-sltu.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-sltu.elf new file mode 100644 index 000000000..893aeb408 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-sltu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-sra.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-sra.elf new file mode 100644 index 000000000..ab4e4fbbe Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-sra.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-srai.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-srai.elf new file mode 100644 index 000000000..9a21c3501 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-srai.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-srl.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-srl.elf new file mode 100644 index 000000000..996dc3bfa Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-srl.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-srli.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-srli.elf new file mode 100644 index 000000000..19c592783 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-srli.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-sub.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-sub.elf new file mode 100644 index 000000000..90ed5543b Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-sub.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-sw.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-sw.elf new file mode 100644 index 000000000..eb1ae2b99 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-sw.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-xor.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-xor.elf new file mode 100644 index 000000000..1fcbf5b85 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-xor.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32ui-p-xori.elf b/examples/RISCV-32-Sail-Validation/rv32ui-p-xori.elf new file mode 100644 index 000000000..34f87171e Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32ui-p-xori.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32um-p-div.elf b/examples/RISCV-32-Sail-Validation/rv32um-p-div.elf new file mode 100644 index 000000000..121c055ed Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32um-p-div.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32um-p-divu.elf b/examples/RISCV-32-Sail-Validation/rv32um-p-divu.elf new file mode 100644 index 000000000..0c3335f4d Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32um-p-divu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32um-p-mul.elf b/examples/RISCV-32-Sail-Validation/rv32um-p-mul.elf new file mode 100644 index 000000000..75eebf3e5 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32um-p-mul.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32um-p-mulh.elf b/examples/RISCV-32-Sail-Validation/rv32um-p-mulh.elf new file mode 100644 index 000000000..38e8ca72b Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32um-p-mulh.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32um-p-mulhsu.elf b/examples/RISCV-32-Sail-Validation/rv32um-p-mulhsu.elf new file mode 100644 index 000000000..48f64a141 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32um-p-mulhsu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32um-p-mulhu.elf b/examples/RISCV-32-Sail-Validation/rv32um-p-mulhu.elf new file mode 100644 index 000000000..5010a3deb Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32um-p-mulhu.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32um-p-rem.elf b/examples/RISCV-32-Sail-Validation/rv32um-p-rem.elf new file mode 100644 index 000000000..605e403a4 Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32um-p-rem.elf differ diff --git a/examples/RISCV-32-Sail-Validation/rv32um-p-remu.elf b/examples/RISCV-32-Sail-Validation/rv32um-p-remu.elf new file mode 100644 index 000000000..6814ffa3c Binary files /dev/null and b/examples/RISCV-32-Sail-Validation/rv32um-p-remu.elf differ diff --git a/examples/RISCV-32-arduino/example10.s b/examples/RISCV-32-arduino/example10.s index 0719e901d..e51c50043 100644 --- a/examples/RISCV-32-arduino/example10.s +++ b/examples/RISCV-32-arduino/example10.s @@ -18,16 +18,16 @@ not_found: lw ra, 0(sp) addi sp, sp, 4 - #li a0, 10000 - #addi sp, sp, -4 - #sw ra, 0(sp) - #jal ra, delay - #lw ra, 0(sp) - #addi sp, sp, 4 + li a0, 10000 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, delay + lw ra, 0(sp) + addi sp, sp, 4 jal ra, loop -founded: +found_text: la a0, found addi sp, sp, -4 sw ra, 0(sp) @@ -35,12 +35,12 @@ founded: lw ra, 0(sp) addi sp, sp, 4 - #li a0, 10000 - #addi sp, sp, -4 - #sw ra, 0(sp) - #jal ra, delay - #lw ra, 0(sp) - #addi sp, sp, 4 + li a0, 10000 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, delay + lw ra, 0(sp) + addi sp, sp, 4 jal ra, loop @@ -75,7 +75,7 @@ loop: addi sp, sp, 4 beqz a0, not_found - jal ra, founded + jal ra, found_text diff --git a/examples/RISCV-32-arduino/example11.s b/examples/RISCV-32-arduino/example11.s index 47ee83428..0e16ee683 100644 --- a/examples/RISCV-32-arduino/example11.s +++ b/examples/RISCV-32-arduino/example11.s @@ -1,24 +1,55 @@ -# Creatino Example: Starting Monitor Print + +#Creatino example: parseInt .data - msg: .string "Hello! Serial here" + msg: .string "Enter a integer number:\n" + sol: .string "You entered %d" + lookahead: .string "SKIP_NONE" - msg2: .string "Come soon!!" .text - main: - # ESP-IDF needs to initiate Arduino component first - jal ra, initArduino - # Baud rate depends on the board you are using. Maybe the same values don't fit everywhere - li a0, 115200 - jal ra, serial_begin - la a0, msg - jal ra, serial_printf - - #Now, we will wait all the data is transmitted - jal ra, serial_flush - - #Print again!! - la a0, msg2 - jal ra, serial_printf - - - jr ra \ No newline at end of file + +number: + mv a1, a0 + la a0, sol + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_printf + lw ra, 0(sp) + addi sp, sp, 4 + jal ra, loop + +setup: + li a0, 115200 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_begin + lw ra, 0(sp) + addi sp, sp, 4 + + jr ra + +loop: + la a0, msg + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_printf + lw ra, 0(sp) + addi sp, sp, 4 + + la a0, lookahead + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_parseInt + lw ra, 0(sp) + addi sp, sp, 4 + bnez a0, number + jal ra, loop + + +main: + jal ra, initArduino + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, setup + lw ra, 0(sp) + addi sp, sp, 4 + j loop \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example12.s b/examples/RISCV-32-arduino/example12.s new file mode 100644 index 000000000..bb3910e8c --- /dev/null +++ b/examples/RISCV-32-arduino/example12.s @@ -0,0 +1,40 @@ +#Template for Arduino proyects +.data +space: .zero 100 + +.text +setup: + li a0, 115200 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_begin + lw ra, 0(sp) + addi sp, sp, 4 + jr ra +loop: + + addi sp, sp, -4 + sw ra, 0(sp) + la a0, space + li a1, 5 + jal ra, serial_readBytes + lw ra, 0(sp) + addi sp, sp, 4 + + + addi sp, sp, -4 + sw ra, 0(sp) + la a0, space + jal ra, serial_printf + lw ra, 0(sp) + addi sp, sp, 4 + + j loop +main: + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, initArduino + jal ra, setup + lw ra, 12(sp) + addi sp, sp, 16 + j loop \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example13.s b/examples/RISCV-32-arduino/example13.s new file mode 100644 index 000000000..1de9d30b2 --- /dev/null +++ b/examples/RISCV-32-arduino/example13.s @@ -0,0 +1,47 @@ +# Creatino example:readBytes +.data + space: .zero 100 #Buffer to place the string + print: .string "%s\n" + char: .byte 65 #A + +.text +setup: + li a0, 115200 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_begin + lw ra, 0(sp) + addi sp, sp, 4 + jr ra +loop: + + # read int + la a0, char + lb a0, 0(a0) + la a1, space + la a2, 5 # number of letters it will have + + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_readBytesUntil + lw ra, 0(sp) + addi sp, sp, 4 + + # print: + la a0, space + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, serial_printf + lw ra, 0(sp) + addi sp, sp, 4 + + # return + j loop +main: + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, initArduino + jal ra, setup + lw ra, 12(sp) + addi sp, sp, 16 + j loop \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example14.s b/examples/RISCV-32-arduino/example14.s new file mode 100644 index 000000000..96972db52 --- /dev/null +++ b/examples/RISCV-32-arduino/example14.s @@ -0,0 +1,96 @@ +# Creatino example: GPIO Interrupts +.data + ledPin: .byte 4 + interruptpin: .byte 6 + state: .byte 0 #LOW + change: .byte 0x04 +.text +blink: + la t1, ledPin + lb a0, 0(t1) + li a1, 1 + addi sp, sp, -4 + sw ra,0(sp) + jal ra, digitalWrite# digitalWrite(ledPin, state) + lw ra,0(sp) + addi sp, sp, 4 + jr ra + + +loop: + la t1, ledPin + lb a0, 0(t1) + li a1,0 + addi sp, sp, -4 + sw ra,0(sp) + jal ra, digitalWrite# digitalWrite(ledPin, state) + lw ra,0(sp) + addi sp, sp, 4 + + li a0, 100 + addi sp, sp, -4 + sw ra,0(sp) + jal ra, delay # delay(1000) + lw ra,0(sp) + addi sp, sp, 4 + j loop + +setup: + #Start pins + la t1, ledPin + lb a0, 0(t1) + li a1, 0x03 #OUTPUT + addi sp, sp, -4 + sw ra,0(sp) + jal ra, pinMode #pinMode(ledPin, OUTPUT); + lw ra,0(sp) + addi sp, sp, 4 + la t1, interruptpin + lb a0, 0(t1) + li a1, 0x05 #INPUT_PULLUP + addi sp, sp, -4 + sw ra,0(sp) + jal ra, pinMode# pinMode(ledPin, INPUT_PULLUP); + lw ra,0(sp) + addi sp, sp, 4 + + la t1, interruptpin + lb a0, 0(t1) + addi sp, sp, -4 + sw ra,0(sp) + jal ra, digitalPinToInterrupt #digitalPinToInterrupt(interruptpin); + lw ra,0(sp) + addi sp, sp, 4 + + la a1, blink + + la t1, change + lb a2, 0(t1) + + addi sp, sp, -4 + sw ra,0(sp) + jal ra, attachInterrupt #attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE); + lw ra,0(sp) + addi sp, sp, 4 + jr ra + +main: + # Llamar a cr_initArduino() + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, initArduino + lw ra, 0(sp) + addi sp, sp, 4 + + # Llamar a setup() + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, setup + lw ra, 0(sp) + addi sp, sp, 4 + + # Bucle infinito + j loop + + + \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example1_b.s b/examples/RISCV-32-arduino/example1_b.s new file mode 100644 index 000000000..5c64afe4e --- /dev/null +++ b/examples/RISCV-32-arduino/example1_b.s @@ -0,0 +1,52 @@ +# Creatino Example: Blink for BUILTIN RGB Led boards (ESP32-C6) +.data + time: + .word 1000 +.text + +main: + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, initArduino + jal ra, setup + lw ra, 0(sp) + addi sp, sp, 4 + j loop + +setup: + nop +loop: + #digitalWrite(LED_BUILTIN, HIGH); + li a0,8 + li a1, 0x1 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, digitalWrite + lw ra, 0(sp) + addi sp, sp, 4 + #delay(1000); + la a0, time + lw a0, 0(a0) + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, delay + lw ra, 0(sp) + addi sp, sp, 4 + #digitalWrite(LED_BUILTIN, LOW); + li a0,8 + li a1, 0x0 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, digitalWrite + lw ra, 0(sp) + addi sp, sp, 4 + #delay(1000); + la a0, time + lw a0, 0(a0) + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, delay + lw ra, 0(sp) + addi sp, sp, 4 + j loop + \ No newline at end of file diff --git a/examples/RISCV-32-arduino/example4.s b/examples/RISCV-32-arduino/example4.s index 9b6623574..850910891 100644 --- a/examples/RISCV-32-arduino/example4.s +++ b/examples/RISCV-32-arduino/example4.s @@ -76,6 +76,8 @@ lightUp: loop: #read LDR + la t0, ledPin + lw a0, 0(t0) addi sp, sp, -4 sw ra,0(sp) jal ra, analogRead #analogRead(lightSensorPin); diff --git a/examples/RISCV-32-arduino/example_semmaphore.s b/examples/RISCV-32-arduino/example_semmaphore.s new file mode 100644 index 000000000..7c7ad3e05 --- /dev/null +++ b/examples/RISCV-32-arduino/example_semmaphore.s @@ -0,0 +1,114 @@ +#Creatino example: Semaphore with 3 LEDs + +.data + time: + .word 1000 +.text +setup: + li a0, 4 #RED PIN GPIO + li a1, 0x03 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, pinMode + lw ra, 0(sp) + addi sp, sp, 4 + + li a0, 5 #YELLOW PIN GPIO + li a1, 0x03 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, pinMode + lw ra, 0(sp) + addi sp, sp, 4 + + li a0, 6 #GREEN PIN GPIO + li a1, 0x03 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, pinMode + lw ra, 0(sp) + addi sp, sp, 4 + + jr ra +loop: + ## ---------------------RED PIN--------------------- + li a0,4 + li a1, 0x1 + addi sp, sp, -4 + sw ra, 0(sp) + jal ra, digitalWrite + lw ra, 0(sp) + addi sp, sp, 4 + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + li a0,4 + li a1, 0x0 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + + ## ---------------------Yellow PIN--------------------- + li a0,5 + li a1, 0x1 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + li a0,5 + li a1, 0x0 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + + ## ---------------------Green PIN--------------------- + li a0,6 + li a1, 0x1 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + li a0,6 + li a1, 0x0 + jal ra, digitalWrite + la a0, time + lw a0, 0(a0) + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, delay + lw ra, 12(sp) + addi sp, sp, 16 + + j loop + +main: + #Initialize Arduino + addi sp, sp, -16 + sw ra, 12(sp) + jal ra, initArduino + jal ra, setup + lw ra, 12(sp) + addi sp, sp, 16 + j loop \ No newline at end of file diff --git a/examples/RISCV-32-arduino/list.json b/examples/RISCV-32-arduino/list.json index ac6538332..640a1f39b 100644 --- a/examples/RISCV-32-arduino/list.json +++ b/examples/RISCV-32-arduino/list.json @@ -7,68 +7,93 @@ }, { "name": "Example 1", - "id": "example1", + "id": "e1", "url": "examples/RISCV-32-arduino/example1.s", "description": "ESP32-C3 Blink LED example" + }, + { + "name": "Example 1_b", + "id": "e1_b", + "url": "examples/RISCV-32-arduino/example1_b.s", + "description": "ESP32-C6 Blink LED example" }, { "name": "Example 2", - "id": "example2", + "id": "e2", "url": "examples/RISCV-32-arduino/example2.s", "description": "Button + LED example" }, { "name": "Example 3", - "id": "example3", + "id": "e3", "url": "examples/RISCV-32-arduino/example3.s", "description": "Serial communication example" }, { "name": "Example 4", - "id": "example4", + "id": "e4", "url": "examples/RISCV-32-arduino/example4.s", "description": "LDR example" }, { "name": "Example 5", - "id": "example5", + "id": "e5", "url": "examples/RISCV-32-arduino/example5.s", "description": "Piano using interruptions example" }, { "name": "Example 6", - "id": "example6", + "id": "e6", "url": "examples/RISCV-32-arduino/example6.s", "description": "Math functions (min.max, map, constrain) example" }, { "name": "Example 7", - "id": "example7", + "id": "e7", "url": "examples/RISCV-32-arduino/example7.s", "description": "Check if a char is a number example" }, { "name": "Example 8", - "id": "example8", + "id": "e8", "url": "examples/RISCV-32-arduino/example8.s", "description": "Random function example" }, { "name": "Example 9", - "id": "example9", + "id": "e9", "url": "examples/RISCV-32-arduino/example9.s", "description": "Serial Find example" }, { "name": "Example 10", - "id": "example10", + "id": "e10", "url": "examples/RISCV-32-arduino/example10.s", "description": "Serial FindUntil example" }, { "name": "Example 11", - "id": "example11", + "id": "e11", "url": "examples/RISCV-32-arduino/example11.s", - "description": "Serial Flush example" + "description": "Serial parseInt example" + }, + { + "name": "Example 12", + "id": "e12", + "url": "examples/RISCV-32-arduino/example12.s", + "description": "Serial readBytes example" + }, + { + "name": "Example 13", + "id": "e13", + "url": "examples/RISCV-32-arduino/example13.s", + "description": "Serial readBytesUntil example" + }, + { + "name": "Example 14", + "id": "e14", + "url": "examples/RISCV-32-arduino/example14.s", + "description": "High level interrupts example" } + ] diff --git a/examples/RISCV-32-devices/example1.s b/examples/RISCV-32-devices/example1.s index 7623d67b1..20544c478 100644 --- a/examples/RISCV-32-devices/example1.s +++ b/examples/RISCV-32-devices/example1.s @@ -1,13 +1,9 @@ .data - console_ctrl_addr: .word 0xF0000000 - console_data_addr: .word 0xF0000008 - string1: .string "Insert the string length (no more than 100 characters) " - string2: .string "Insert the string " - space: .zero 100 - + console_ctrl_addr: .word 0xF0000000 + console_data_addr: .word 0xF0000008 + string: .string "This is a string" .text - main: # load console data addr to t0 la t0, console_data_addr @@ -17,37 +13,28 @@ la t1, console_ctrl_addr lw t1, 0(t1) - - # print "Insert string length..." - la t2, string1 + # write 69 + li t2, 69 sw t2, 0(t0) # store value in console data - li t2, 4 - sw t2, 0(t1) # signal device to write a string - # read int - li t2, 5 - sw t2, 0(t1) - lw t3, 0(t0) # t3: lenght + li t2, 1 + sw t2, 0(t1) # signal device to write an integer - # print "Insert string..." - la t2, string2 - sw t2, 0(t0) - li t2, 4 - sw t2, 0(t1) # signal device + li t2, 2 + sw t2, 0(t1) # signal device to write a float - # read string - la t2, space - sw t2, 0(t0) # store addr - sw t3, 4(t0) # store lenght - li t2, 8 - sw t2, 0(t1) # signal device + li t2, 3 + sw t2, 0(t1) # signal device to write a double + li t2, 11 + sw t2, 0(t1) # signal device to write a char - # print string - la t2, space + # write string addr + la t2, string sw t2, 0(t0) # store value in console data li t2, 4 sw t2, 0(t1) # signal device to write a string # return - jr ra + li a7, 10 + ecall \ No newline at end of file diff --git a/examples/RISCV-32-devices/example2.s b/examples/RISCV-32-devices/example2.s new file mode 100644 index 000000000..016e545be --- /dev/null +++ b/examples/RISCV-32-devices/example2.s @@ -0,0 +1,54 @@ +.data + console_ctrl_addr: .word 0xF0000000 + console_data_addr: .word 0xF0000008 + string1: .string "Insert the string length (no more than 100 characters) " + string2: .string "Insert the string " + space: .zero 100 + + +.text + + main: + # load console data addr to t0 + la t0, console_data_addr + lw t0, 0(t0) + + # load console ctrl addr to t1 + la t1, console_ctrl_addr + lw t1, 0(t1) + + + # print "Insert string length..." + la t2, string1 + sw t2, 0(t0) # store value in console data + li t2, 4 + sw t2, 0(t1) # signal device to write a string + + # read int + li t2, 5 + sw t2, 0(t1) + lw t3, 0(t0) # t3: lenght + + # print "Insert string..." + la t2, string2 + sw t2, 0(t0) + li t2, 4 + sw t2, 0(t1) # signal device + + # read string + la t2, space + sw t2, 0(t0) # store addr + sw t3, 4(t0) # store lenght + li t2, 8 + sw t2, 0(t1) # signal device + + + # print string + la t2, space + sw t2, 0(t0) # store value in console data + li t2, 4 + sw t2, 0(t1) # signal device to write a string + + # return + li a7, 10 + ecall diff --git a/examples/RISCV-32-devices/list.json b/examples/RISCV-32-devices/list.json index ebdab73a8..c624a0088 100644 --- a/examples/RISCV-32-devices/list.json +++ b/examples/RISCV-32-devices/list.json @@ -1,14 +1,14 @@ [ { - "name": "Example 0", - "id": "example0", - "url": "examples/RISCV-32-devices/example0.s", - "description": "Writting to console" + "name": "Example 1", + "id": "e1", + "url": "examples/RISCV-32-devices/example1.s", + "description": "Writting to Console" }, { - "name": "Example 1", - "id": "example1", - "url": "examples/RISCV-32-devices/example0.s", + "name": "Example 2", + "id": "e2", + "url": "examples/RISCV-32-devices/example2.s", "description": "Echo" } ] diff --git a/examples/RISCV-32-interrupts/example1.s b/examples/RISCV-32-interrupts/example1.s new file mode 100644 index 000000000..acfd0e895 --- /dev/null +++ b/examples/RISCV-32-interrupts/example1.s @@ -0,0 +1,32 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# + +.data + +.text + rti: + # ... + + # return from interrupt + mret + + main: + # enable interrupts (MIE=1) + csrrw zero, mstatus, t0 + ori t0, t0, 8 + csrrw zero, mstatus, t0 + + # enable software interrupts (MSIE=1) + csrrw zero, mie, t0 + ori t0, t0, 8 + csrrw zero, mie, t0 + + # load rti addr to mtvec + la t0, rti + csrrw zero, mtvec, t0 + + # generate interrupt + ecall + + li t0, 0 diff --git a/examples/RISCV-32-interrupts/ex0.s b/examples/RISCV-32-interrupts/example2.s similarity index 100% rename from examples/RISCV-32-interrupts/ex0.s rename to examples/RISCV-32-interrupts/example2.s diff --git a/examples/RISCV-32-interrupts/list.json b/examples/RISCV-32-interrupts/list.json index 31b7e0ab8..561a12dc4 100644 --- a/examples/RISCV-32-interrupts/list.json +++ b/examples/RISCV-32-interrupts/list.json @@ -1,8 +1,8 @@ [ { - "name": "Example 0", - "id": "e0", - "url": "examples/RISCV-32-interrupts/ex0.s", - "description": "" + "name": "Example 1", + "id": "e1", + "url": "examples/RISCV-32-interrupts/example1.s", + "description": "Interrupt Handler" } ] diff --git a/examples/RISCV-32/list.json b/examples/RISCV-32/list.json index 29c83c810..dacdc9f62 100644 --- a/examples/RISCV-32/list.json +++ b/examples/RISCV-32/list.json @@ -9,7 +9,7 @@ "name": "Example 2", "id": "e2", "url": "examples/RISCV-32/example2.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 3", @@ -21,7 +21,7 @@ "name": "Example 4", "id": "e4", "url": "examples/RISCV-32/example4.s", - "description": "FPU operations" + "description": "FPU Operations" }, { "name": "Example 5", @@ -45,7 +45,7 @@ "name": "Example 8", "id": "e8", "url": "examples/RISCV-32/example8.s", - "description": "Copy of matrices" + "description": "Copy of Matrices" }, { "name": "Example 9", diff --git a/examples/RISCV-64-Sail-Validation/list.json b/examples/RISCV-64-Sail-Validation/list.json new file mode 100644 index 000000000..831ac9e77 --- /dev/null +++ b/examples/RISCV-64-Sail-Validation/list.json @@ -0,0 +1,490 @@ +[ + { + "name": "rv64mi-p-access.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-access.elf" + }, + { + "name": "rv64mi-p-breakpoint.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-breakpoint.elf" + }, + { + "name": "rv64mi-p-csr.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-csr.elf" + }, + { + "name": "rv64mi-p-illegal.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-illegal.elf" + }, + { + "name": "rv64mi-p-ma_addr.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-ma_addr.elf" + }, + { + "name": "rv64mi-p-ma_fetch.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-ma_fetch.elf" + }, + { + "name": "rv64mi-p-mcsr.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-mcsr.elf" + }, + { + "name": "rv64mi-p-sbreak.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-sbreak.elf" + }, + { + "name": "rv64mi-p-scall.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64mi-p-scall.elf" + }, + { + "name": "rv64si-p-csr.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64si-p-csr.elf" + }, + { + "name": "rv64si-p-dirty.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64si-p-dirty.elf" + }, + { + "name": "rv64si-p-ma_fetch.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64si-p-ma_fetch.elf" + }, + { + "name": "rv64si-p-sbreak.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64si-p-sbreak.elf" + }, + { + "name": "rv64si-p-scall.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64si-p-scall.elf" + }, + { + "name": "rv64si-p-wfi.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64si-p-wfi.elf" + }, + { + "name": "rv64ua-p-amoadd_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoadd_d.elf" + }, + { + "name": "rv64ua-p-amoadd_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoadd_w.elf" + }, + { + "name": "rv64ua-p-amoand_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoand_d.elf" + }, + { + "name": "rv64ua-p-amoand_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoand_w.elf" + }, + { + "name": "rv64ua-p-amomax_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amomax_d.elf" + }, + { + "name": "rv64ua-p-amomaxu_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amomaxu_d.elf" + }, + { + "name": "rv64ua-p-amomaxu_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amomaxu_w.elf" + }, + { + "name": "rv64ua-p-amomax_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amomax_w.elf" + }, + { + "name": "rv64ua-p-amomin_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amomin_d.elf" + }, + { + "name": "rv64ua-p-amominu_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amominu_d.elf" + }, + { + "name": "rv64ua-p-amominu_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amominu_w.elf" + }, + { + "name": "rv64ua-p-amomin_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amomin_w.elf" + }, + { + "name": "rv64ua-p-amoor_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoor_d.elf" + }, + { + "name": "rv64ua-p-amoor_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoor_w.elf" + }, + { + "name": "rv64ua-p-amoswap_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoswap_d.elf" + }, + { + "name": "rv64ua-p-amoswap_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoswap_w.elf" + }, + { + "name": "rv64ua-p-amoxor_d.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoxor_d.elf" + }, + { + "name": "rv64ua-p-amoxor_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-amoxor_w.elf" + }, + { + "name": "rv64ua-p-lrsc.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ua-p-lrsc.elf" + }, + { + "name": "rv64uc-p-rvc.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uc-p-rvc.elf" + }, + { + "name": "rv64ud-p-fadd.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-fadd.elf" + }, + { + "name": "rv64ud-p-fclass.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-fclass.elf" + }, + { + "name": "rv64ud-p-fcmp.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-fcmp.elf" + }, + { + "name": "rv64ud-p-fcvt.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-fcvt.elf" + }, + { + "name": "rv64ud-p-fcvt_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-fcvt_w.elf" + }, + { + "name": "rv64ud-p-fdiv.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-fdiv.elf" + }, + { + "name": "rv64ud-p-fmadd.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-fmadd.elf" + }, + { + "name": "rv64ud-p-fmin.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-fmin.elf" + }, + { + "name": "rv64ud-p-ldst.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-ldst.elf" + }, + { + "name": "rv64ud-p-recoding.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-recoding.elf" + }, + { + "name": "rv64ud-p-structural.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-structural.elf" + }, + { + "name": "rv64uf-p-fadd.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-fadd.elf" + }, + { + "name": "rv64uf-p-fclass.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-fclass.elf" + }, + { + "name": "rv64ud-p-move.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ud-p-move.elf" + }, + { + "name": "rv64uf-p-fcmp.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-fcmp.elf" + }, + { + "name": "rv64uf-p-fcvt.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-fcvt.elf" + }, + { + "name": "rv64uf-p-fcvt_w.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-fcvt_w.elf" + }, + { + "name": "rv64uf-p-fdiv.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-fdiv.elf" + }, + { + "name": "rv64uf-p-fmadd.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-fmadd.elf" + }, + { + "name": "rv64uf-p-fmin.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-fmin.elf" + }, + { + "name": "rv64uf-p-ldst.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-ldst.elf" + }, + { + "name": "rv64uf-p-move.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-move.elf" + }, + { + "name": "rv64uf-p-recoding.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64uf-p-recoding.elf" + }, + { + "name": "rv64ui-p-add.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-add.elf" + }, + { + "name": "rv64ui-p-addi.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-addi.elf" + }, + { + "name": "rv64ui-p-addiw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-addiw.elf" + }, + { + "name": "rv64ui-p-addw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-addw.elf" + }, + { + "name": "rv64ui-p-and.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-and.elf" + }, + { + "name": "rv64ui-p-andi.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-andi.elf" + }, + { + "name": "rv64ui-p-auipc.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-auipc.elf" + }, + { + "name": "rv64ui-p-beq.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-beq.elf" + }, + { + "name": "rv64ui-p-bge.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-bge.elf" + }, + { + "name": "rv64ui-p-bgeu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-bgeu.elf" + }, + { + "name": "rv64ui-p-blt.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-blt.elf" + }, + { + "name": "rv64ui-p-bltu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-bltu.elf" + }, + { + "name": "rv64ui-p-bne.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-bne.elf" + }, + { + "name": "rv64ui-p-fence_i.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-fence_i.elf" + }, + { + "name": "rv64ui-p-jal.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-jal.elf" + }, + { + "name": "rv64ui-p-jalr.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-jalr.elf" + }, + { + "name": "rv64ui-p-lb.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-lb.elf" + }, + { + "name": "rv64ui-p-lbu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-lbu.elf" + }, + { + "name": "rv64ui-p-ld.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-ld.elf" + }, + { + "name": "rv64ui-p-lh.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-lh.elf" + }, + { + "name": "rv64ui-p-lhu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-lhu.elf" + }, + { + "name": "rv64ui-p-lui.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-lui.elf" + }, + { + "name": "rv64ui-p-lw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-lw.elf" + }, + { + "name": "rv64ui-p-lwu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-lwu.elf" + }, + { + "name": "rv64ui-p-or.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-or.elf" + }, + { + "name": "rv64ui-p-ori.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-ori.elf" + }, + { + "name": "rv64ui-p-sb.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sb.elf" + }, + { + "name": "rv64ui-p-sd.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sd.elf" + }, + { + "name": "rv64ui-p-sh.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sh.elf" + }, + { + "name": "rv64ui-p-simple.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-simple.elf" + }, + { + "name": "rv64ui-p-sll.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sll.elf" + }, + { + "name": "rv64ui-p-slli.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-slli.elf" + }, + { + "name": "rv64ui-p-slliw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-slliw.elf" + }, + { + "name": "rv64ui-p-sllw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sllw.elf" + }, + { + "name": "rv64ui-p-slt.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-slt.elf" + }, + { + "name": "rv64ui-p-slti.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-slti.elf" + }, + { + "name": "rv64ui-p-sltiu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sltiu.elf" + }, + { + "name": "rv64ui-p-sltu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sltu.elf" + }, + { + "name": "rv64ui-p-sra.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sra.elf" + }, + { + "name": "rv64ui-p-srai.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-srai.elf" + }, + { + "name": "rv64ui-p-sraiw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sraiw.elf" + }, + { + "name": "rv64ui-p-sraw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sraw.elf" + }, + { + "name": "rv64ui-p-srl.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-srl.elf" + }, + { + "name": "rv64ui-p-srli.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-srli.elf" + }, + { + "name": "rv64ui-p-srliw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-srliw.elf" + }, + { + "name": "rv64ui-p-srlw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-srlw.elf" + }, + { + "name": "rv64ui-p-sub.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sub.elf" + }, + { + "name": "rv64ui-p-subw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-subw.elf" + }, + { + "name": "rv64ui-p-sw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-sw.elf" + }, + { + "name": "rv64ui-p-xor.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-xor.elf" + }, + { + "name": "rv64ui-p-xori.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64ui-p-xori.elf" + }, + { + "name": "rv64um-p-div.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-div.elf" + }, + { + "name": "rv64um-p-divu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-divu.elf" + }, + { + "name": "rv64um-p-divuw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-divuw.elf" + }, + { + "name": "rv64um-p-divw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-divw.elf" + }, + { + "name": "rv64um-p-mul.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-mul.elf" + }, + { + "name": "rv64um-p-mulh.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-mulh.elf" + }, + { + "name": "rv64um-p-mulhsu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-mulhsu.elf" + }, + { + "name": "rv64um-p-mulhu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-mulhu.elf" + }, + { + "name": "rv64um-p-mulw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-mulw.elf" + }, + { + "name": "rv64um-p-rem.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-rem.elf" + }, + { + "name": "rv64um-p-remu.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-remu.elf" + }, + { + "name": "rv64um-p-remuw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-remuw.elf" + }, + { + "name": "rv64um-p-remw.elf", + "url": "examples/RISCV-64-Sail-Validation/rv64um-p-remw.elf" + } +] \ No newline at end of file diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-access.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-access.elf new file mode 100755 index 000000000..6335b6c04 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-access.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-breakpoint.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-breakpoint.elf new file mode 100644 index 000000000..571bfd716 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-breakpoint.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-csr.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-csr.elf new file mode 100644 index 000000000..be0792258 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-csr.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-illegal.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-illegal.elf new file mode 100644 index 000000000..d30104921 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-illegal.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-ma_addr.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-ma_addr.elf new file mode 100644 index 000000000..e5eadd5c9 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-ma_addr.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-ma_fetch.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-ma_fetch.elf new file mode 100644 index 000000000..4d66e6904 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-ma_fetch.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-mcsr.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-mcsr.elf new file mode 100644 index 000000000..796100bc2 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-mcsr.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-sbreak.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-sbreak.elf new file mode 100755 index 000000000..4bcd37ceb Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-sbreak.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64mi-p-scall.elf b/examples/RISCV-64-Sail-Validation/rv64mi-p-scall.elf new file mode 100644 index 000000000..f82dea52f Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64mi-p-scall.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64si-p-csr.elf b/examples/RISCV-64-Sail-Validation/rv64si-p-csr.elf new file mode 100644 index 000000000..a6290ef67 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64si-p-csr.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64si-p-dirty.elf b/examples/RISCV-64-Sail-Validation/rv64si-p-dirty.elf new file mode 100644 index 000000000..a15a03329 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64si-p-dirty.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64si-p-ma_fetch.elf b/examples/RISCV-64-Sail-Validation/rv64si-p-ma_fetch.elf new file mode 100644 index 000000000..02155e5a3 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64si-p-ma_fetch.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64si-p-sbreak.elf b/examples/RISCV-64-Sail-Validation/rv64si-p-sbreak.elf new file mode 100755 index 000000000..cf0a8ca37 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64si-p-sbreak.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64si-p-scall.elf b/examples/RISCV-64-Sail-Validation/rv64si-p-scall.elf new file mode 100644 index 000000000..5eb47e1f6 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64si-p-scall.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64si-p-wfi.elf b/examples/RISCV-64-Sail-Validation/rv64si-p-wfi.elf new file mode 100644 index 000000000..46e1115bb Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64si-p-wfi.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoadd_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoadd_d.elf new file mode 100644 index 000000000..359f6047d Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoadd_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoadd_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoadd_w.elf new file mode 100644 index 000000000..a76f6044d Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoadd_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoand_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoand_d.elf new file mode 100644 index 000000000..091e7f715 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoand_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoand_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoand_w.elf new file mode 100644 index 000000000..edf0588fc Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoand_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amomax_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomax_d.elf new file mode 100644 index 000000000..c8867f8b9 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomax_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amomax_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomax_w.elf new file mode 100644 index 000000000..e7d9ea5cf Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomax_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amomaxu_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomaxu_d.elf new file mode 100644 index 000000000..dab40262a Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomaxu_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amomaxu_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomaxu_w.elf new file mode 100644 index 000000000..6486fa463 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomaxu_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amomin_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomin_d.elf new file mode 100644 index 000000000..425c72ced Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomin_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amomin_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomin_w.elf new file mode 100644 index 000000000..2cdb17e73 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amomin_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amominu_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amominu_d.elf new file mode 100644 index 000000000..20d1b6fd5 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amominu_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amominu_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amominu_w.elf new file mode 100644 index 000000000..6a73fc4ee Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amominu_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoor_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoor_d.elf new file mode 100644 index 000000000..71a32159b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoor_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoor_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoor_w.elf new file mode 100644 index 000000000..33196ad26 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoor_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoswap_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoswap_d.elf new file mode 100644 index 000000000..2b2200cae Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoswap_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoswap_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoswap_w.elf new file mode 100644 index 000000000..39ee63f35 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoswap_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoxor_d.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoxor_d.elf new file mode 100644 index 000000000..cb45e313c Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoxor_d.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-amoxor_w.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoxor_w.elf new file mode 100644 index 000000000..c2d3412c1 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-amoxor_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ua-p-lrsc.elf b/examples/RISCV-64-Sail-Validation/rv64ua-p-lrsc.elf new file mode 100644 index 000000000..c443cf22c Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ua-p-lrsc.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uc-p-rvc.elf b/examples/RISCV-64-Sail-Validation/rv64uc-p-rvc.elf new file mode 100644 index 000000000..ee821eba0 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uc-p-rvc.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-fadd.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-fadd.elf new file mode 100644 index 000000000..eaa35c67e Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-fadd.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-fclass.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-fclass.elf new file mode 100644 index 000000000..7c23d4998 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-fclass.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-fcmp.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-fcmp.elf new file mode 100644 index 000000000..4ae6c9bea Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-fcmp.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-fcvt.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-fcvt.elf new file mode 100644 index 000000000..995bc818d Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-fcvt.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-fcvt_w.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-fcvt_w.elf new file mode 100644 index 000000000..4db28d5f3 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-fcvt_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-fdiv.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-fdiv.elf new file mode 100644 index 000000000..d62c776cd Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-fdiv.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-fmadd.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-fmadd.elf new file mode 100644 index 000000000..e1b977b38 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-fmadd.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-fmin.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-fmin.elf new file mode 100644 index 000000000..34c1ccbc5 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-fmin.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-ldst.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-ldst.elf new file mode 100755 index 000000000..42e53302c Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-ldst.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-move.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-move.elf new file mode 100755 index 000000000..2f32db96d Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-move.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-recoding.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-recoding.elf new file mode 100755 index 000000000..3fb62d7b0 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-recoding.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ud-p-structural.elf b/examples/RISCV-64-Sail-Validation/rv64ud-p-structural.elf new file mode 100755 index 000000000..0331e2bf5 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ud-p-structural.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-fadd.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-fadd.elf new file mode 100644 index 000000000..e4c4a5b78 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-fadd.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-fclass.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-fclass.elf new file mode 100644 index 000000000..eae8b2788 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-fclass.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-fcmp.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-fcmp.elf new file mode 100644 index 000000000..42039b2c0 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-fcmp.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-fcvt.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-fcvt.elf new file mode 100644 index 000000000..bfcbcf05b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-fcvt.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-fcvt_w.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-fcvt_w.elf new file mode 100644 index 000000000..2994eb4e2 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-fcvt_w.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-fdiv.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-fdiv.elf new file mode 100644 index 000000000..3501db357 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-fdiv.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-fmadd.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-fmadd.elf new file mode 100644 index 000000000..bc5121e9d Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-fmadd.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-fmin.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-fmin.elf new file mode 100644 index 000000000..b5548fbb3 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-fmin.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-ldst.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-ldst.elf new file mode 100755 index 000000000..d08002364 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-ldst.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-move.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-move.elf new file mode 100755 index 000000000..5a16f6319 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-move.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64uf-p-recoding.elf b/examples/RISCV-64-Sail-Validation/rv64uf-p-recoding.elf new file mode 100755 index 000000000..b8f54ed82 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64uf-p-recoding.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-add.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-add.elf new file mode 100644 index 000000000..74330e9e1 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-add.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-addi.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-addi.elf new file mode 100644 index 000000000..d83a9a79f Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-addi.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-addiw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-addiw.elf new file mode 100644 index 000000000..1556eea47 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-addiw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-addw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-addw.elf new file mode 100644 index 000000000..794963148 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-addw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-and.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-and.elf new file mode 100644 index 000000000..9dda5d195 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-and.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-andi.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-andi.elf new file mode 100644 index 000000000..39d71d328 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-andi.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-auipc.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-auipc.elf new file mode 100644 index 000000000..cf2211ce8 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-auipc.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-beq.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-beq.elf new file mode 100644 index 000000000..5b8986582 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-beq.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-bge.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-bge.elf new file mode 100644 index 000000000..972d7fabe Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-bge.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-bgeu.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-bgeu.elf new file mode 100644 index 000000000..cd7e7e34f Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-bgeu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-blt.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-blt.elf new file mode 100644 index 000000000..e3676a33f Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-blt.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-bltu.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-bltu.elf new file mode 100644 index 000000000..e4e6077e9 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-bltu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-bne.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-bne.elf new file mode 100644 index 000000000..d28d9aaee Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-bne.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-fence_i.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-fence_i.elf new file mode 100644 index 000000000..682802e02 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-fence_i.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-jal.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-jal.elf new file mode 100644 index 000000000..8250b7554 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-jal.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-jalr.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-jalr.elf new file mode 100644 index 000000000..4d111a587 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-jalr.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-lb.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-lb.elf new file mode 100644 index 000000000..13970acc7 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-lb.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-lbu.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-lbu.elf new file mode 100644 index 000000000..b68b1991b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-lbu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-ld.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-ld.elf new file mode 100644 index 000000000..b4e659610 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-ld.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-lh.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-lh.elf new file mode 100644 index 000000000..5d6b965e1 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-lh.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-lhu.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-lhu.elf new file mode 100644 index 000000000..1b2550d9b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-lhu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-lui.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-lui.elf new file mode 100644 index 000000000..300ef0d20 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-lui.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-lw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-lw.elf new file mode 100644 index 000000000..6c77ab8c9 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-lw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-lwu.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-lwu.elf new file mode 100644 index 000000000..b920704cc Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-lwu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-or.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-or.elf new file mode 100644 index 000000000..b3772ca73 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-or.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-ori.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-ori.elf new file mode 100644 index 000000000..d3a6b6d26 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-ori.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sb.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sb.elf new file mode 100644 index 000000000..20fdd3c04 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sb.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sd.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sd.elf new file mode 100644 index 000000000..d3e68eaef Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sd.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sh.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sh.elf new file mode 100644 index 000000000..4a38a063a Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sh.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-simple.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-simple.elf new file mode 100644 index 000000000..68457c21b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-simple.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sll.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sll.elf new file mode 100644 index 000000000..0c615ca2e Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sll.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-slli.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-slli.elf new file mode 100644 index 000000000..c5f99f546 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-slli.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-slliw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-slliw.elf new file mode 100644 index 000000000..cb8909f4d Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-slliw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sllw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sllw.elf new file mode 100644 index 000000000..e839d1b5b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sllw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-slt.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-slt.elf new file mode 100644 index 000000000..1feb7df6b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-slt.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-slti.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-slti.elf new file mode 100644 index 000000000..681c96311 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-slti.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sltiu.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sltiu.elf new file mode 100644 index 000000000..a52072b12 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sltiu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sltu.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sltu.elf new file mode 100644 index 000000000..16264ccda Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sltu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sra.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sra.elf new file mode 100644 index 000000000..fc9a1d975 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sra.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-srai.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-srai.elf new file mode 100644 index 000000000..8efee5815 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-srai.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sraiw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sraiw.elf new file mode 100644 index 000000000..d3a9099b5 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sraiw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sraw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sraw.elf new file mode 100644 index 000000000..2b83afc3f Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sraw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-srl.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-srl.elf new file mode 100644 index 000000000..1ca262941 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-srl.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-srli.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-srli.elf new file mode 100644 index 000000000..a8dd4e3f2 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-srli.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-srliw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-srliw.elf new file mode 100644 index 000000000..452617c0e Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-srliw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-srlw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-srlw.elf new file mode 100644 index 000000000..f1e87436b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-srlw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sub.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sub.elf new file mode 100644 index 000000000..d86768510 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sub.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-subw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-subw.elf new file mode 100644 index 000000000..d6c7c3b12 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-subw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-sw.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-sw.elf new file mode 100644 index 000000000..6ca080c51 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-sw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-xor.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-xor.elf new file mode 100644 index 000000000..7403f0533 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-xor.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64ui-p-xori.elf b/examples/RISCV-64-Sail-Validation/rv64ui-p-xori.elf new file mode 100644 index 000000000..f759bbafe Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64ui-p-xori.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-div.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-div.elf new file mode 100644 index 000000000..c33b9549c Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-div.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-divu.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-divu.elf new file mode 100644 index 000000000..6c7c99285 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-divu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-divuw.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-divuw.elf new file mode 100644 index 000000000..d28d92d3b Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-divuw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-divw.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-divw.elf new file mode 100644 index 000000000..62998ebe1 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-divw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-mul.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-mul.elf new file mode 100644 index 000000000..7db8e67f2 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-mul.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-mulh.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-mulh.elf new file mode 100644 index 000000000..9a7009a03 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-mulh.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-mulhsu.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-mulhsu.elf new file mode 100644 index 000000000..eb825f7a8 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-mulhsu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-mulhu.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-mulhu.elf new file mode 100644 index 000000000..b398098ec Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-mulhu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-mulw.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-mulw.elf new file mode 100644 index 000000000..865196096 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-mulw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-rem.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-rem.elf new file mode 100644 index 000000000..45a427e39 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-rem.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-remu.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-remu.elf new file mode 100644 index 000000000..ce63b5f65 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-remu.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-remuw.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-remuw.elf new file mode 100644 index 000000000..3e1fea532 Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-remuw.elf differ diff --git a/examples/RISCV-64-Sail-Validation/rv64um-p-remw.elf b/examples/RISCV-64-Sail-Validation/rv64um-p-remw.elf new file mode 100644 index 000000000..e079595ce Binary files /dev/null and b/examples/RISCV-64-Sail-Validation/rv64um-p-remw.elf differ diff --git a/examples/RISCV-32-devices/example0.s b/examples/RISCV-64-devices/example0.s similarity index 100% rename from examples/RISCV-32-devices/example0.s rename to examples/RISCV-64-devices/example0.s diff --git a/examples/RISCV-64-devices/example1.s b/examples/RISCV-64-devices/example1.s new file mode 100644 index 000000000..7623d67b1 --- /dev/null +++ b/examples/RISCV-64-devices/example1.s @@ -0,0 +1,53 @@ +.data + console_ctrl_addr: .word 0xF0000000 + console_data_addr: .word 0xF0000008 + string1: .string "Insert the string length (no more than 100 characters) " + string2: .string "Insert the string " + space: .zero 100 + + +.text + + main: + # load console data addr to t0 + la t0, console_data_addr + lw t0, 0(t0) + + # load console ctrl addr to t1 + la t1, console_ctrl_addr + lw t1, 0(t1) + + + # print "Insert string length..." + la t2, string1 + sw t2, 0(t0) # store value in console data + li t2, 4 + sw t2, 0(t1) # signal device to write a string + + # read int + li t2, 5 + sw t2, 0(t1) + lw t3, 0(t0) # t3: lenght + + # print "Insert string..." + la t2, string2 + sw t2, 0(t0) + li t2, 4 + sw t2, 0(t1) # signal device + + # read string + la t2, space + sw t2, 0(t0) # store addr + sw t3, 4(t0) # store lenght + li t2, 8 + sw t2, 0(t1) # signal device + + + # print string + la t2, space + sw t2, 0(t0) # store value in console data + li t2, 4 + sw t2, 0(t1) # signal device to write a string + + # return + jr ra diff --git a/examples/RISCV-64-devices/list.json b/examples/RISCV-64-devices/list.json new file mode 100644 index 000000000..88a90c071 --- /dev/null +++ b/examples/RISCV-64-devices/list.json @@ -0,0 +1,14 @@ +[ + { + "name": "Example 1", + "id": "e1", + "url": "examples/RISCV-64-devices/example1.s", + "description": "Writting to Console" + }, + { + "name": "Example 2", + "id": "e2", + "url": "examples/RISCV-64-devices/example2.s", + "description": "Echo" + } +] diff --git a/examples/RISCV-64-interrupts/example1.s b/examples/RISCV-64-interrupts/example1.s new file mode 100644 index 000000000..acfd0e895 --- /dev/null +++ b/examples/RISCV-64-interrupts/example1.s @@ -0,0 +1,32 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# + +.data + +.text + rti: + # ... + + # return from interrupt + mret + + main: + # enable interrupts (MIE=1) + csrrw zero, mstatus, t0 + ori t0, t0, 8 + csrrw zero, mstatus, t0 + + # enable software interrupts (MSIE=1) + csrrw zero, mie, t0 + ori t0, t0, 8 + csrrw zero, mie, t0 + + # load rti addr to mtvec + la t0, rti + csrrw zero, mtvec, t0 + + # generate interrupt + ecall + + li t0, 0 diff --git a/examples/RISCV-64-interrupts/example2.s b/examples/RISCV-64-interrupts/example2.s new file mode 100644 index 000000000..bb9e1774b --- /dev/null +++ b/examples/RISCV-64-interrupts/example2.s @@ -0,0 +1,29 @@ +.data + +.text + +rti: # load mcause to t0 + csrrw t0, MCAUSE, t0 + csrrw t1, MSCRATCH, t1 # swap t1 w/ mscratch + + # treat interruption + + # if ecall + li t1, 256 + beq t0, t1, rti_ecall + +rti_ecall: li t1, 1 + beq a7, t1, rti_print_int + +rti_print_int: print_int + j rti_end + +rti_end: csrrw t0, MCAUSE, t0 # restore t0 + csrrw t1, MSCRATCH, t1 # restore t1 + mret + + +main: li a7, 1 + li a0, 69 + ecall + jr ra # TODO: Implement proper exit \ No newline at end of file diff --git a/examples/RISCV-64-interrupts/list.json b/examples/RISCV-64-interrupts/list.json new file mode 100644 index 000000000..b481b96d6 --- /dev/null +++ b/examples/RISCV-64-interrupts/list.json @@ -0,0 +1,8 @@ +[ + { + "name": "Example 1", + "id": "e1", + "url": "examples/RISCV-64-interrupts/example1.s", + "description": "Interrupt Handler" + } +] diff --git a/examples/RISCV-64/list.json b/examples/RISCV-64/list.json index fd2e5998f..b7f7ae41a 100644 --- a/examples/RISCV-64/list.json +++ b/examples/RISCV-64/list.json @@ -9,7 +9,7 @@ "name": "Example 2", "id": "e2", "url": "examples/RISCV-64/example2.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 3", @@ -21,7 +21,7 @@ "name": "Example 4", "id": "e4", "url": "examples/RISCV-64/example4.s", - "description": "FPU operations" + "description": "FPU Operations" }, { "name": "Example 5", @@ -45,7 +45,7 @@ "name": "Example 8", "id": "e8", "url": "examples/RISCV-64/example8.s", - "description": "Copy of matrices" + "description": "Copy of Matrices" }, { "name": "Example 9", diff --git a/examples/RISCV-Sail/example1.s b/examples/RISCV-Sail/example1.s new file mode 100755 index 000000000..e3db566a0 --- /dev/null +++ b/examples/RISCV-Sail/example1.s @@ -0,0 +1,44 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .data + + byte: .byte 12 + + .align 1 + half: .half 34 + + .align 2 + word: .word -5678 + float: .float 456.322 + double: .double 9741.34 + stringz: .asciz "This is a string" + string: .ascii "This is another string" + space: .zero 32 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + + _main: + + # print byte value + la a0, byte + lb a0, 0(a0) + li a7, 1 + ecall + + # print half value + la a0, half + lh a0, 0(a0) + li a7, 1 + ecall + + #return + # li a7, 10 + # ecall + jr ra diff --git a/examples/RISCV-Sail/example10.s b/examples/RISCV-Sail/example10.s new file mode 100755 index 000000000..3b97e7e9f --- /dev/null +++ b/examples/RISCV-Sail/example10.s @@ -0,0 +1,49 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .data + string1: .asciz "Insert the string length (no more than 100 characters) " + string2: .asciz "Insert the string " + space: .zero 100 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + # print "Insert string length..." + la a0, string1 + li a7, 4 + ecall + + # read int + li a7, 5 + ecall + + add t0, a0, zero + + # print "Insert string..." + la a0, string2 + li a7, 4 + ecall + + # read string + la a0, space + add a1, t0, zero + li a7, 8 + ecall + + # print string + la a0, space + li a7, 4 + ecall + + # return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example11.s b/examples/RISCV-Sail/example11.s new file mode 100755 index 000000000..b482e39c1 --- /dev/null +++ b/examples/RISCV-Sail/example11.s @@ -0,0 +1,40 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + +_main: + addi sp, sp, -4 + sw ra, 0(sp) + + li a0, 23 + li a1, -77 + li a2, 45 + jal x1, sum + jal x1, sub + li a7, 1 + ecall + + lw ra, 0(sp) + addi sp, sp, 4 + # li a7, 10 + # ecall + jr ra + +sum: + add t1, a0, a1 + add t2, a2, a2 + add a0, t1, zero + add a1, t2, zero + jr ra + +sub: + sub a0, a0, a1 + jr ra diff --git a/examples/RISCV-Sail/example12.s b/examples/RISCV-Sail/example12.s new file mode 100755 index 000000000..ab222c246 --- /dev/null +++ b/examples/RISCV-Sail/example12.s @@ -0,0 +1,63 @@ + +# +# ARCOS.INF.UC3M.ES +# BY-NC-SA (https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es) +# + +.section .bss +.align 8 +tohost: .dword 0 + + +.section .text.init +.globl _main + + _main: + addi sp, sp, -4 + sw ra, 0(sp) + + # t1 = factorial(5) + li a0, 5 + jal x1, factorial + + # print_int(t1) + li a7, 1 + ecall + + # return + lw ra, 0(sp) + addi sp, sp, 4 + # li a7, 10 + # ecall + jr ra + + +factorial: + # crear "stack frame" para $ra, $fp y una variable local + addi sp, sp, -12 + sw ra, 8(sp) + sw fp, 4(sp) + addi fp, sp, 4 + + # if (a0 < 2): + # return 1 + li x5, 2 + bge a0, t0, b_else + li a0, 1 + beq x0, x0, b_efs + # else: + # return a0 * factorial(a0 - 1) + b_else: sw a0, -4(fp) + addi a0, a0, -1 + jal x1, factorial + lw t1, -4(fp) + mul a0, a0, t1 + + # finalizar "stack frame" + b_efs: lw ra, 8(sp) + lw fp, 4(sp) + addi sp, sp, 12 + + # return t0 + + jr ra diff --git a/examples/RISCV-Sail/example13a.s b/examples/RISCV-Sail/example13a.s new file mode 100644 index 000000000..b54859d16 --- /dev/null +++ b/examples/RISCV-Sail/example13a.s @@ -0,0 +1,142 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: + .dword 0 + +.section .text.init +.globl _main + +kernel: + j reset_vector + + syscall: + li t0, 13 + bgeu a7, t0, fail + addi t0, t0, -3 + beq t0, a7, exit + + csrr t0, mepc + addi t0, t0, 4 + csrw mepc, t0 + mret + + exit: + fence + li gp, 1 + li a0, 0 + li a7, 10 + j exception+4 + + fail: + fence + beqz gp, fail+0x4 + slli gp, gp, 1 + ori gp, gp, 1 + li a7, 10 + mv a0, gp + j syscall + + trap_vec: + csrr t5, mcause + li t6, 8 + beq t5, t6, syscall + li t6, 9 + beq t5, t6, syscall + li t6, 11 + beq t5, t6, syscall + j exception + + exception: + ori gp, gp, 1337 + la t5, tohost + sw gp, 0(t5) + sw zero, 4(t5) + + j exception + + reset_vector: + li ra, 0 + li sp, 0x80006FFC + li gp, 0 + li tp, 0 + li t0, 0 + li t1, 0 + li t2, 0 + li fp, 0 + li s1, 0 + li a0, 0 + li a1, 0 + li a2, 0 + li a3, 0 + li a4, 0 + li a5, 0 + li a6, 0 + li a7, 0 + li s2, 0 + li s3, 0 + li s4, 0 + li s5, 0 + li s6, 0 + li s7, 0 + li s8, 0 + li s9, 0 + li s10, 0 + li s11, 0 + li t3, 0 + li t4, 0 + li t5, 0 + li t6, 0 + + initial: + csrr a0, mhartid + bnez a0, initial + auipc t0, 0 + addi t0, t0, 16 + csrw mtvec, t0 + csrwi mstatus, 8 + auipc t0, 0 + addi t0, t0, 16 + csrw mtvec, t0 + csrwi satp, 0 + + auipc t0, 0 + addi t0, t0, 36 + csrw mtvec, t0 + addi t0, zero, 1 + slli t0, t0, 0x1f + csrw pmpaddr0, t0 + li t0, 31 + csrwi mie, 0 + auipc t0, 0 + addi t0, t0, 20 + + csrwi medeleg, 0 + csrwi mideleg, 0 + la t0, trap_vec + csrw mtvec, t0 + csrw mepc, t0 + lui t0, 0x2 + addi t0, t0, -2048 + csrrc zero, mstatus, t0 + + csrr t0, mstatus + lui t1, 0xffffe + addi t1, t1, 2047 + and t0, t0, t1 + li t1, 0 + slli t1, t1, 11 + or t0, t0, t1 + csrw mstatus, t0 + + la t0, _main + csrw mepc, t0 + mret + +_main: + + li a7, 10 + ecall diff --git a/examples/RISCV-Sail/example13b.s b/examples/RISCV-Sail/example13b.s new file mode 100644 index 000000000..308d501f1 --- /dev/null +++ b/examples/RISCV-Sail/example13b.s @@ -0,0 +1,142 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: + .dword 0 + +.section .text.init +.globl _main + +kernel: + j reset_vector + + syscall: + li t0, 13 + bgeu a7, t0, fail + addi t0, t0, -3 + beq t0, a7, exit + + csrr t0, mepc + addi t0, t0, 4 + csrw mepc, t0 + mret + + exit: + fence + li gp, 1 + li a0, 0 + li a7, 10 + j exception+4 + + fail: + fence + beqz gp, fail+0x4 + slli gp, gp, 1 + ori gp, gp, 1 + li a7, 10 + mv a0, gp + j syscall + + trap_vec: + csrr t5, mcause + li t6, 8 + beq t5, t6, syscall + li t6, 9 + beq t5, t6, syscall + li t6, 11 + beq t5, t6, syscall + j exception + + exception: + ori gp, gp, 1337 + la t5, tohost + sw gp, 0(t5) + sw zero, 4(t5) + + j exception + + reset_vector: + li ra, 0 + li sp, 0x3FFFFFFC + li gp, 0 + li tp, 0 + li t0, 0 + li t1, 0 + li t2, 0 + li fp, 0 + li s1, 0 + li a0, 0 + li a1, 0 + li a2, 0 + li a3, 0 + li a4, 0 + li a5, 0 + li a6, 0 + li a7, 0 + li s2, 0 + li s3, 0 + li s4, 0 + li s5, 0 + li s6, 0 + li s7, 0 + li s8, 0 + li s9, 0 + li s10, 0 + li s11, 0 + li t3, 0 + li t4, 0 + li t5, 0 + li t6, 0 + + initial: + csrr a0, mhartid + bnez a0, initial + auipc t0, 0 + addi t0, t0, 16 + csrw mtvec, t0 + csrwi mstatus, 8 + auipc t0, 0 + addi t0, t0, 16 + csrw mtvec, t0 + csrwi satp, 0 + + auipc t0, 0 + addi t0, t0, 36 + csrw mtvec, t0 + addi t0, zero, 1 + slli t0, t0, 0x1f + csrw pmpaddr0, t0 + li t0, 31 + csrwi mie, 0 + auipc t0, 0 + addi t0, t0, 20 + + csrwi medeleg, 0 + csrwi mideleg, 0 + la t0, trap_vec + csrw mtvec, t0 + csrw mepc, t0 + lui t0, 0x2 + addi t0, t0, -2048 + csrrc zero, mstatus, t0 + + csrr t0, mstatus + lui t1, 0xffffe + addi t1, t1, 2047 + and t0, t0, t1 + li t1, 0 + slli t1, t1, 11 + or t0, t0, t1 + csrw mstatus, t0 + + la t0, _main + csrw mepc, t0 + mret + +_main: + + li a7, 10 + ecall diff --git a/examples/RISCV-Sail/example14.s b/examples/RISCV-Sail/example14.s new file mode 100644 index 000000000..e500f09c6 --- /dev/null +++ b/examples/RISCV-Sail/example14.s @@ -0,0 +1,19 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .bss + .align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + +# Entry point of the program +_main: + li t0, 10 + li t1, 2 + myadd t0, t1 + + jr ra + diff --git a/examples/RISCV-Sail/example2.s b/examples/RISCV-Sail/example2.s new file mode 100755 index 000000000..f4a83dd94 --- /dev/null +++ b/examples/RISCV-Sail/example2.s @@ -0,0 +1,33 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + + li t0, 10 + li t1, 13 + li t2, 45 + li t3, 33 + + add t4, t0, t1 # 10+13 + sub t4, t2, t3 # 45-33 + mul t4, t3, t3 # 33*33 + div t4, t2, t0 # 45/10 + + # print last t4 + mv a0, t4 + li a7, 1 + ecall + + # return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example3.s b/examples/RISCV-Sail/example3.s new file mode 100755 index 000000000..488346911 --- /dev/null +++ b/examples/RISCV-Sail/example3.s @@ -0,0 +1,47 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .data + w1: .word 14 + b1: .byte 120 + + .align 1 + h1: .half 22 + w2: .zero 4 + b2: .zero 1 + + .align 1 + h2: .zero 2 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + + la t0, w1 # w1 address -> t0 + la t1, b1 # b1 address -> t1 + la t2, h1 # h1 address -> t2 + + lw t3, 0(t0) # Memory[t0] -> t3 + + lb t4, 0(t1) # Memory[t1] -> t4 + + lh t5, 0 (t2) # Memory[t2] -> t5 + + la t0, w2 # w2 address -> t0 + sw t3, 0(t0) # t3 -> Memory[w2] + + la t0, b2 # b2 address -> t0 + sb t4, 0(t0) # t4 -> Memory[b2] + + la t0, h2 # h2 address -> t0 + sh t5, 0(t0) # t5 -> Memory[h2] + + # return + # li a7, 10 + # ecall + jr ra diff --git a/examples/RISCV-Sail/example4.s b/examples/RISCV-Sail/example4.s new file mode 100755 index 000000000..a2e76fb69 --- /dev/null +++ b/examples/RISCV-Sail/example4.s @@ -0,0 +1,44 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .data + a: .double 34.544 + b: .double 11.443 + c: .double 665.4 + + d: .zero 24 + +.section .bss + .align 8 + tohost: .dword 0 + +.section .text.init +.globl _main + +_main: + + la x5, a + la x6, b + la x7, c + la x28, d + + fld f0, 0(x5) + fld f2, 0(x6) + fld f10, 0(x7) + fadd.d f0, f0, f0 + fsub.d f4, f10, f0 + fdiv.d f12, f10, f2 + + fsd f0, 0(x28) + addi x28, x28, 8 + fsd f4, 0(x28) + addi x28, x28, 8 + fsd f12, 0(x28) + + #return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example5.s b/examples/RISCV-Sail/example5.s new file mode 100755 index 000000000..0d0f3e610 --- /dev/null +++ b/examples/RISCV-Sail/example5.s @@ -0,0 +1,34 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +# Sum of the first 10 numbers from 0 to 9 + +.section .data + max: .byte 10 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + _main: + la t0, max + lb t0, 0 (t0) + li t1, 0 + li a0, 0 + + while: bge t1, t0, end_while + add a0, a0, t1 + addi t1, t1, 1 + beq zero, zero, while + + end_while: li a7, 1 + ecall # print_int + + #return + # li a7, 10 + # ecall + jr ra diff --git a/examples/RISCV-Sail/example6.s b/examples/RISCV-Sail/example6.s new file mode 100755 index 000000000..e40cdb783 --- /dev/null +++ b/examples/RISCV-Sail/example6.s @@ -0,0 +1,33 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + _main: + + li t0, 4 + li t1, 2 + li t3, 5 + bge t3, t0, jump1 + + jump2: + li t3, 34 + li a7, 10 + ecall + + jump1: + li t4, 11 + li t5, 555 + beq x0, x0, jump2 + + #return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example7.s b/examples/RISCV-Sail/example7.s new file mode 100755 index 000000000..90c765fdc --- /dev/null +++ b/examples/RISCV-Sail/example7.s @@ -0,0 +1,45 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .data + w3: .word 1, 2, 3, 4, 5 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + + li t3, 1 + li t4, 4 + la t5, w3 + li s7, 0 + + # loop initialization + li t1, 0 + li t2, 5 + + # loop header +loop1: beq t1, t2, end1 # if(t1 == t2) --> jump to fin1 + + # loop body + mul t6, t1, t4 # t1 * t4 -> t6 + lw t6, 0(t5) # Memory[t5] -> t6 + add s7, s7, t6 # t6 + s7 -> s7 + + # loop next... + add t1, t1, t3 # t1 + t3 -> t1 + addi t5, t5, 4 + beq x0, x0, loop1 + + # loop end +end1: + #return + # li a7, 10 + # ecall + jr ra + + diff --git a/examples/RISCV-Sail/example8.s b/examples/RISCV-Sail/example8.s new file mode 100644 index 000000000..273097b07 --- /dev/null +++ b/examples/RISCV-Sail/example8.s @@ -0,0 +1,33 @@ +.section .data +.align 3 +v_1: + .double 7.7 ,8.8 ,9.9 ,-13.13 +.align 3 +v_2: + .double 62.62 , 54.54, -684.684, 379.379 +.align 3 +v_mem: + .space 64 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main + +_main: + + li t0, 4 + vsetvli t1, t0, e64 + la t2, v_1 + la t3, v_2 + vle64.v v1, 0(t2) + vle64.v v2, 0(t3) + vfadd.vv v3, v1, v2 + la t1, v_mem + vse64.v v3, 0(t1) + + li a7, 10 + ecall + \ No newline at end of file diff --git a/examples/RISCV-Sail/example81.s b/examples/RISCV-Sail/example81.s new file mode 100755 index 000000000..a9f1be276 --- /dev/null +++ b/examples/RISCV-Sail/example81.s @@ -0,0 +1,48 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.section .data + +matrixA: .word 0x34000000, 0x34000000, 0x34000000, 0x34000000 + .word 0x23450000, 0x00432210, 0x77512120, 0x14141414 + .word 0x00000214, 0x44551122, 0xAABFF012, 0x77D00000 + .word 0x0000FF23, 0x12345678, 0x87654321, 0x33441124 + +matrixB: .float 0.0, 0.0, 0.0, 0.0 + .float 0.0, 0.0, 0.0, 0.0 + .float 0.0, 0.0, 0.0, 0.0 + .float 0.0, 0.0, 0.0, 0.0 + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + la t0, matrixA + la t1, matrixB + li t2, 4 + li t3, 4 + add t4, zero, zero + add t5, zero, zero + +loop1: beq t2, t4, end1 +loop2: beq t3, t5, end2 + flw f0, 0(t0) + fsw f0, 0(t1) + addi t0, t0, 4 + addi t1, t1, 4 + addi t5, t5, 1 + beq x0, x0, loop2 +end2: addi t4, t4, 1 + add t5, zero, zero + beq x0, x0, loop1 +end1: + # return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/example9.s b/examples/RISCV-Sail/example9.s new file mode 100755 index 000000000..f18146761 --- /dev/null +++ b/examples/RISCV-Sail/example9.s @@ -0,0 +1,54 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# +.section .data + msg: .asciz "Please, insert the first number: " + msg2: .asciz "Please, insert the second number: " + msg3: .asciz "The result is: " + +.section .bss +.align 8 +tohost: .dword 0 + +.section .text.init +.globl _main +_main: + # print "insert first..." + la a0, msg + li a7, 4 + ecall + + # read int + li a7, 5 + ecall + + add t0, a0, zero + + # print "insert second..." + la a0, msg2 + li a7, 4 + ecall + + # read int + li a7, 5 + ecall + + add t1, a0, zero + add t2, t0, t1 + + # print "result..." + la a0, msg3 + li a7, 4 + ecall + + # print t2 + add a0, t2, zero + li a7, 1 + ecall + + # return + # li a7, 10 + # ecall + jr ra + diff --git a/examples/RISCV-Sail/list32.json b/examples/RISCV-Sail/list32.json new file mode 100755 index 000000000..689de64d8 --- /dev/null +++ b/examples/RISCV-Sail/list32.json @@ -0,0 +1,86 @@ +[ + { + "name": "Example 1", + "id": "e1", + "url":"examples/RISCV-Sail/example1.s", + "description": "Data Storage" + }, + { + "name": "Example 2", + "id": "e2", + "url":"examples/RISCV-Sail/example2.s", + "description": "ALU Operations" + }, + { + "name": "Example 3", + "id": "e3", + "url":"examples/RISCV-Sail/example3.s", + "description": "Store/Load Data in Memory" + }, + { + "name": "Example 4", + "id": "e4", + "url":"examples/RISCV-Sail/example4.s", + "description": "FPU Operations" + }, + { + "name": "Example 5", + "id": "e5", + "url":"examples/RISCV-Sail/example5.s", + "description": "Loop" + }, + { + "name": "Example 6", + "id": "e6", + "url":"examples/RISCV-Sail/example6.s", + "description": "Branch" + }, + { + "name": "Example 7", + "id": "e7", + "url":"examples/RISCV-Sail/example7.s", + "description": "Loop + Memory" + }, + { + "name": "Example 8", + "id": "e8", + "url":"examples/RISCV-Sail/example8.s", + "description": "Vector Instructions" + }, + { + "name": "Example 9", + "id": "e9", + "url":"examples/RISCV-Sail/example9.s", + "description": "I/O Syscalls" + }, + { + "name": "Example 10", + "id": "e10", + "url":"examples/RISCV-Sail/example10.s", + "description": "I/O Syscalls + Strings" + }, + { + "name": "Example 11", + "id": "e11", + "url":"examples/RISCV-Sail/example11.s", + "description": "Subrutines" + }, + { + "name": "Example 12", + "id": "e12", + "url":"examples/RISCV-Sail/example12.s", + "description": "Factorial" + }, + { + "name": "Example 13", + "id": "e13", + "url":"examples/RISCV-Sail/example13a.s", + "description": "Custom Kernel" + }, + { + "name": "Example 14", + "id": "e14", + "url":"examples/RISCV-Sail/example14.s", + "description": "Use Custom Instruction" + } +] diff --git a/examples/RISCV-Sail/list64.json b/examples/RISCV-Sail/list64.json new file mode 100755 index 000000000..b4cda0d21 --- /dev/null +++ b/examples/RISCV-Sail/list64.json @@ -0,0 +1,86 @@ +[ + { + "name": "Example 1", + "id": "e1", + "url":"examples/RISCV-Sail/example1.s", + "description": "Data Storage" + }, + { + "name": "Example 2", + "id": "e2", + "url":"examples/RISCV-Sail/example2.s", + "description": "ALU Operations" + }, + { + "name": "Example 3", + "id": "e3", + "url":"examples/RISCV-Sail/example3.s", + "description": "Store/Load Data in Memory" + }, + { + "name": "Example 4", + "id": "e4", + "url":"examples/RISCV-Sail/example4.s", + "description": "FPU Operations" + }, + { + "name": "Example 5", + "id": "e5", + "url":"examples/RISCV-Sail/example5.s", + "description": "Loop" + }, + { + "name": "Example 6", + "id": "e6", + "url":"examples/RISCV-Sail/example6.s", + "description": "Branch" + }, + { + "name": "Example 7", + "id": "e7", + "url":"examples/RISCV-Sail/example7.s", + "description": "Loop + Memory" + }, + { + "name": "Example 8", + "id": "e8", + "url":"examples/RISCV-Sail/example8.s", + "description": "Vector Instructions" + }, + { + "name": "Example 9", + "id": "e9", + "url":"examples/RISCV-Sail/example9.s", + "description": "I/O Syscalls" + }, + { + "name": "Example 10", + "id": "e10", + "url":"examples/RISCV-Sail/example10.s", + "description": "I/O Syscalls + Strings" + }, + { + "name": "Example 11", + "id": "e11", + "url":"examples/RISCV-Sail/example11.s", + "description": "Subrutines" + }, + { + "name": "Example 12", + "id": "e12", + "url":"examples/RISCV-Sail/example12.s", + "description": "Factorial" + }, + { + "name": "Example 13", + "id": "e13", + "url":"examples/RISCV-Sail/example13b.s", + "description": "Custom Kernel" + }, + { + "name": "Example 14", + "id": "e14", + "url":"examples/RISCV-Sail/example14.s", + "description": "Use Custom Instruction" + } +] diff --git a/examples/RISCV-simple/list.json b/examples/RISCV-simple/list.json index 2d5e7cf5b..ec338c160 100644 --- a/examples/RISCV-simple/list.json +++ b/examples/RISCV-simple/list.json @@ -3,19 +3,19 @@ "name": "Example 1", "id": "e1", "url": "examples/RISCV/example1.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 2", "id": "e2", "url": "examples/RISCV/example2.s", - "description": "ALU operations" + "description": "ALU Operations" }, { "name": "Example 3", "id": "e3", "url": "examples/RISCV/example3.s", - "description": "Memory access" + "description": "Memory Access" }, { "name": "Example 4", diff --git a/examples/example_set.json b/examples/example_set.json index 7063bf635..c85f437bd 100644 --- a/examples/example_set.json +++ b/examples/example_set.json @@ -7,33 +7,51 @@ "description": "RISC-V (RV32IMFD) Examples" }, { - "name": "RISC-V (RV64IMFD) Examples", - "id": "default", - "architecture": "RISC-V (RV64IMFD)", - "url": "examples/RISCV-64/list.json", - "description": "RISC-V (RV64IMFD) Examples" + "name": "RISC-V (RV32IM) Arduino Examples", + "id": "arduino", + "architecture": "RISC-V (RV32IMFD)", + "url": "examples/RISCV-32-arduino/list.json", + "description": "RISC-V (RV32IM, Interrupts) Arduino Examples" }, { "name": "RISC-V (RV32IMFD, Interrupts) Examples", - "id": "default", - "architecture": "RISC-V (RV32IMFD, Interrupts)", + "id": "interrupts", + "architecture": "RISC-V (RV32IMFD)", "url": "examples/RISCV-32-interrupts/list.json", "description": "RISC-V (RV32IMFD, Interrupts) Examples" }, { - "name": "RISC-V (RV32IM) Arduino Examples", + "name": "RISC-V (RV32IMFD, Interrupts) Devices Examples", "id": "devices", "architecture": "RISC-V (RV32IMFD)", - "url": "examples/RISCV-32-arduino/list.json", - "description": "RISC-V (RV32IM, Interrupts) Arduino Examples" + "url": "examples/RISCV-32-devices/list.json", + "description": "RISC-V (RV32IMFD, Interrupts) Devices Examples" }, + + { - "name": "RISC-V (RV32IMFD, Interrupts) Devices Examples", + "name": "RISC-V (RV64IMFD) Examples", + "id": "default", + "architecture": "RISC-V (RV64IMFD)", + "url": "examples/RISCV-64/list.json", + "description": "RISC-V (RV64IMFD) Examples" + }, + { + "name": "RISC-V (RV64IMFD, Interrupts) Examples", + "id": "interrupts", + "architecture": "RISC-V (RV64IMFD)", + "url": "examples/RISCV-64-interrupts/list.json", + "description": "RISC-V (RV64IMFD, Interrupts) Examples" + }, + { + "name": "RISC-V (RV64IMFD, Interrupts) Devices Examples", "id": "devices", - "architecture": "RISC-V (RV32IMFD, Interrupts)", - "url": "examples/RISCV-32-devices/list.json", - "description": "RISC-V (RV32IMFD, Interrupts) Devices Examples" + "architecture": "RISC-V (RV64IMFD)", + "url": "examples/RISCV-64-devices/list.json", + "description": "RISC-V (RV64IMFD, Interrupts) Devices Examples" }, + + { "name": "MIPS-32 Examples", "id": "default", @@ -41,18 +59,22 @@ "url": "examples/MIPS-32/list.json", "description": "MIPS-32 Examples" }, + + { - "name": "MIPS-32 from UC3M-OCW", - "id": "uc3m-ec", - "architecture": "MIPS-32", - "url": "examples/ocw-uc3m-ec/list.json", - "description": "MIPS-32 examples from UC3M course" + "name": "RISC-V Sail 32 Examples", + "id": "default", + "architecture": "RISC-V Sail 32 - Full Specification", + "url": "examples/RISCV-Sail/list32.json", + "description": "RISC-V Sail 32 examples" }, + + { - "name": "RISC-V (RV32IMFD) from UC3M-AG", - "id": "uc3m-ec-ag", - "architecture": "RISC-V (RV32IMFD)", - "url": "examples/ag-uc3m-ec/list.json", - "description": "RISC-V (RV32IMFD) examples for Aula Global at UC3M" + "name": "RISC-V Sail 64 Examples", + "id": "default", + "architecture": "RISC-V Sail 64 - Full Specification", + "url": "examples/RISCV-Sail/list64.json", + "description": "RISC-V Sail 64 examples" } ] diff --git a/index.html b/index.html index 1460d9956..9e26390d7 100644 --- a/index.html +++ b/index.html @@ -48,7 +48,7 @@ } - CREATOR - didaCtic and geneRic assEmbly progrAmming simulaTOR + CREATOR diff --git a/package.json b/package.json index 9dd194aa3..4e04622b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "creator", - "version": "6.0.0", + "version": "6.1.1", "private": true, "type": "module", "scripts": { @@ -44,7 +44,7 @@ "colors": "^1.4.0", "deno": "^2.5.4", "humanize-duration": "^3.33.0", - "js-yaml": "^4.1.0", + "js-yaml": "^4.1.1", "mitt": "^3.0.1", "monaco-editor": "^0.54.0", "monaco-vim": "^0.4.2", @@ -76,12 +76,12 @@ "globals": "^16.5.0", "jiti": "^2.6.1", "npm-run-all2": "^8.0.4", - "prettier": "^3.7.3", + "prettier": "^3.7.4", "prettier-plugin-vue": "^1.1.6", "sass-embedded": "^1.93.3", "sharp": "^0.34.5", "svgo": "^4.0.0", - "typescript": "~5.9.3", + "typescript": "^5.8.3", "unplugin-vue-components": "^30.0.0", "vite": "^7.2.4", "vite-multiple-assets": "^2.2.6", diff --git a/public/img/logos/mips.png b/public/img/logos/mips.png index db9e4abac..eef9bffcc 100644 Binary files a/public/img/logos/mips.png and b/public/img/logos/mips.png differ diff --git a/public/img/logos/uc3m.png b/public/img/logos/uc3m.png new file mode 100644 index 000000000..15e50b2ed Binary files /dev/null and b/public/img/logos/uc3m.png differ diff --git a/public/libraries/creatino.o b/public/libraries/creatino.o new file mode 100644 index 000000000..722c079d5 --- /dev/null +++ b/public/libraries/creatino.o @@ -0,0 +1,159 @@ +{ + "instructions_binary": [ + { "Address": "0x0", "Label": "initArduino", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x4", "Label": "digitalRead", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x8", "Label": "pinMode", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xc", "Label": "digitalWrite", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x10", "Label": "analogRead", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x14", "Label": "analogReadResolution", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x18", "Label": "analogWrite", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x1c", "Label": "map", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x20", "Label": "constrain", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x24", "Label": "abs", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x28", "Label": "max", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x2c", "Label": "min", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x30", "Label": "pow", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x34", "Label": "bit", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x38", "Label": "bitClear", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x3c", "Label": "bitRead", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x40", "Label": "bitSet", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x44", "Label": "bitWrite", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x48", "Label": "highByte", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x4c", "Label": "lowByte", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x50", "Label": "sqrt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x54", "Label": "sq", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x58", "Label": "cos", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x5c", "Label": "sin", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x60", "Label": "tan", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x64", "Label": "attachInterrupt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x68", "Label": "detachInterrupt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x6c", "Label": "digitalPinToInterrupt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x70", "Label": "pulseIn", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x74", "Label": "pulseInLong", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x78", "Label": "shiftIn", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x7c", "Label": "shiftOut", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x80", "Label": "interrupts", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x84", "Label": "nointerrupts", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x88", "Label": "isDigit", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x8c", "Label": "isAlpha", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x90", "Label": "isAlphaNumeric", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x94", "Label": "isAscii", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x98", "Label": "isControl", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x9c", "Label": "isPunct", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xa0", "Label": "isHexadecimalDigit", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xa4", "Label": "isUpperCase", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xa8", "Label": "isLowerCase", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xac", "Label": "isPrintable", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xb0", "Label": "isGraph", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xb4", "Label": "isSpace", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xb8", "Label": "isWhiteSpace", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xbc", "Label": "delay", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xc0", "Label": "delayMicroseconds", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xc4", "Label": "randomSeed", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xc8", "Label": "random", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xcc", "Label": "serial_available", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xd0", "Label": "serial_availableForWrite", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xd4", "Label": "serial_begin", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xd8", "Label": "serial_end", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xdc", "Label": "serial_find", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xe0", "Label": "serial_findUntil", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xe4", "Label": "serial_flush", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xe8", "Label": "serial_parseFloat", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xec", "Label": "serial_parseInt", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xf0", "Label": "serial_read", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xf4", "Label": "serial_readBytes", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xf8", "Label": "serial_readBytesUntil", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0xfc", "Label": "serial_write", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x100", "Label": "serial_printf", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x104", "Label": "fabs", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x108", "Label": "fmax", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x10c", "Label": "fmin", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x110", "Label": "sqrtf", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x114", "Label": "sqf", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x118", "Label": "tone", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x11c", "Label": "noTone", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x120", "Label": "pulseIn", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x124", "Label": "pulseInLong", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x128", "Label": "shiftIn", "loaded": "00000000100000001000001000000000", "globl": true }, + { "Address": "0x12c", "Label": "shiftOut", "loaded": "00000000100000001000001000000000", "globl": true } + ], + "instructions_tag": [ + { "tag": "initArduino", "addr": 0, "globl": true }, + { "tag": "digitalRead", "addr": 4, "globl": true }, + { "tag": "pinMode", "addr": 8, "globl": true }, + { "tag": "digitalWrite", "addr": 12, "globl": true }, + { "tag": "analogRead", "addr": 16, "globl": true }, + { "tag": "analogReadResolution", "addr": 20, "globl": true }, + { "tag": "analogWrite", "addr": 24, "globl": true }, + { "tag": "map", "addr": 28, "globl": true }, + { "tag": "constrain", "addr": 32, "globl": true }, + { "tag": "abs", "addr": 36, "globl": true }, + { "tag": "max", "addr": 40, "globl": true }, + { "tag": "min", "addr": 44, "globl": true }, + { "tag": "pow", "addr": 48, "globl": true }, + { "tag": "bit", "addr": 52, "globl": true }, + { "tag": "bitClear", "addr": 56, "globl": true }, + { "tag": "bitRead", "addr": 60, "globl": true }, + { "tag": "bitSet", "addr": 64, "globl": true }, + { "tag": "bitWrite", "addr": 68, "globl": true }, + { "tag": "highByte", "addr": 72, "globl": true }, + { "tag": "lowByte", "addr": 76, "globl": true }, + { "tag": "sqrt", "addr": 80, "globl": true }, + { "tag": "sq", "addr": 84, "globl": true }, + { "tag": "cos", "addr": 88, "globl": true }, + { "tag": "sin", "addr": 92, "globl": true }, + { "tag": "tan", "addr": 96, "globl": true }, + { "tag": "attachInterrupt", "addr": 100, "globl": true }, + { "tag": "detachInterrupt", "addr": 104, "globl": true }, + { "tag": "digitalPinToInterrupt", "addr": 108, "globl": true }, + { "tag": "pulseIn", "addr": 112, "globl": true }, + { "tag": "pulseInLong", "addr": 116, "globl": true }, + { "tag": "shiftIn", "addr": 120, "globl": true }, + { "tag": "shiftOut", "addr": 124, "globl": true }, + { "tag": "interrupts", "addr": 128, "globl": true }, + { "tag": "nointerrupts", "addr": 132, "globl": true }, + { "tag": "isDigit", "addr": 136, "globl": true }, + { "tag": "isAlpha", "addr": 140, "globl": true }, + { "tag": "isAlphaNumeric", "addr": 144, "globl": true }, + { "tag": "isAscii", "addr": 148, "globl": true }, + { "tag": "isControl", "addr": 152, "globl": true }, + { "tag": "isPunct", "addr": 156, "globl": true }, + { "tag": "isHexadecimalDigit", "addr": 160, "globl": true }, + { "tag": "isUpperCase", "addr": 164, "globl": true }, + { "tag": "isLowerCase", "addr": 168, "globl": true }, + { "tag": "isPrintable", "addr": 172, "globl": true }, + { "tag": "isGraph", "addr": 176, "globl": true }, + { "tag": "isSpace", "addr": 180, "globl": true }, + { "tag": "isWhiteSpace", "addr": 184, "globl": true }, + { "tag": "delay", "addr": 188, "globl": true }, + { "tag": "delayMicroseconds", "addr": 192, "globl": true }, + { "tag": "randomSeed", "addr": 196, "globl": true }, + { "tag": "random", "addr": 200, "globl": true }, + { "tag": "serial_available", "addr": 204, "globl": true }, + { "tag": "serial_availableForWrite", "addr": 208, "globl": true }, + { "tag": "serial_begin", "addr": 212, "globl": true }, + { "tag": "serial_end", "addr": 216, "globl": true }, + { "tag": "serial_find", "addr": 220, "globl": true }, + { "tag": "serial_findUntil", "addr": 224, "globl": true }, + { "tag": "serial_flush", "addr": 228, "globl": true }, + { "tag": "serial_parseFloat", "addr": 232, "globl": true }, + { "tag": "serial_parseInt", "addr": 236, "globl": true }, + { "tag": "serial_read", "addr": 240, "globl": true }, + { "tag": "serial_readBytes", "addr": 244, "globl": true }, + { "tag": "serial_readBytesUntil", "addr": 248, "globl": true }, + { "tag": "serial_write", "addr": 252, "globl": true }, + { "tag": "serial_printf", "addr": 256, "globl": true }, + { "tag": "fabs", "addr": 260, "globl": true }, + { "tag": "fmax", "addr": 264, "globl": true }, + { "tag": "fmin", "addr": 268, "globl": true }, + { "tag": "sqrtf", "addr": 272, "globl": true }, + { "tag": "sqf", "addr": 276, "globl": true }, + { "tag": "tone", "addr": 280, "globl": true }, + { "tag": "noTone", "addr": 284, "globl": true }, + { "tag": "pulseIn", "addr": 288, "globl": true }, + { "tag": "pulseInLong", "addr": 292, "globl": true }, + { "tag": "shiftIn", "addr": 296, "globl": true }, + { "tag": "shiftOut", "addr": 300, "globl": true } + + ] +} \ No newline at end of file diff --git a/public/libraries/creatino.yml b/public/libraries/creatino.yml index cb36186ce..583d48de0 100644 --- a/public/libraries/creatino.yml +++ b/public/libraries/creatino.yml @@ -1,5 +1,7 @@ version: '1.0' -binary: 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 + +binary: + 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000009 0000000a 0000000b 0000000c 0000000d 0000000e 0000000f 00000010 00000011 00000012 00000013 00000014 00000015 00000016 00000017 00000018 00000019 0000001a 0000001b 0000001c 0000001d 0000001e 0000001f 00000020 @@ -12,658 +14,187 @@ binary: 00000001 00000002 00000003 00000004 00000005 00000006 00000007 0000000 symbols: initArduino: addr: 0 - help: - description: Initializes Arduino system - parameters: {} - returns: {} - + help: {description: "Initializes Arduino system", parameters: {}, returns: {}} digitalRead: addr: 4 - help: - description: Reads digital value from a pin - parameters: - pin: Pin number - returns: - value: Digital value (HIGH or LOW) - + help: {description: "Reads digital value from a pin", parameters: {pin: "Pin number"}, returns: {value: "Digital value"}} pinMode: addr: 8 - help: - description: Configures a pin as input or output - parameters: - pin: Pin number - mode: INPUT/OUTPUT/INPUT_PULLUP - returns: {} - + help: {description: "Configures a pin", parameters: {pin: "Pin number", mode: "INPUT/OUTPUT"}, returns: {}} digitalWrite: addr: 12 - help: - description: Writes digital value to a pin - parameters: - pin: Pin number - value: HIGH or LOW - returns: {} - - analogRead: + help: {description: "Writes digital value", parameters: {pin: "Pin number", value: "HIGH/LOW"}, returns: {}} + rgbLedWrite: addr: 16 - help: - description: Reads analog value from a pin - parameters: - pin: Pin number - returns: - value: Analog value (0-1023 or resolution) - - analogReadResolution: + help: {description: "Writes digital value in a RGB WS2812 LED (ex. BUILTIN LED in ESP32-C6 and ESP32-H2 Devkit)", parameters: {pin: "Pin number", value1: "Red value", value2: "Green value", value3: "Blue value"}, returns: {}} + analogRead: addr: 20 - help: - description: Sets resolution for analogRead - parameters: - bits: Resolution in bits - returns: {} - - analogWrite: + help: {description: "Reads analog value", parameters: {pin: "Pin number"}, returns: {value: "0-1023"}} + analogReadResolution: addr: 24 - help: - description: Writes analog value to a pin (PWM) - parameters: - pin: Pin number - value: PWM value - returns: {} - - map: + help: {description: "Sets resolution for analogRead", parameters: {bits: "Resolution"}, returns: {}} + analogWrite: addr: 28 - help: - description: Maps a number from one range to another - parameters: - value: Number to map - fromLow: Source range low - fromHigh: Source range high - toLow: Target range low - toHigh: Target range high - returns: - mappedValue: Mapped number - - constrain: + help: {description: "Writes PWM value", parameters: {pin: "Pin number", value: "PWM value"}, returns: {}} + map: addr: 32 - help: - description: Constrains a number to be within a range - parameters: - value: Number to constrain - low: Minimum value - high: Maximum value - returns: - constrainedValue: Number within [low, high] - - abs: + help: {description: "Maps a number range", parameters: {value: "Number", fromLow: "Source low", fromHigh: "Source high", toLow: "Target low", toHigh: "Target high"}, returns: {mappedValue: "Mapped number"}} + constrain: addr: 36 - help: - description: Returns the absolute value - parameters: - x: Number - returns: - absValue: Absolute value of x - - max: + help: {description: "Constrains a number", parameters: {value: "Number", low: "Min", high: "Max"}, returns: {constrainedValue: "Number in range"}} + abs: addr: 40 - help: - description: Returns the maximum of two integers - parameters: - a0: First Integer - a1: Second Integer - returns: - a0: Maximum - - min: + help: {description: "Absolute value", parameters: {x: "Number"}, returns: {absValue: "Absolute value"}} + max: addr: 44 - help: - description: Returns the minimum of two integers - parameters: - a0: First Integer - a1: Second Integer - returns: - a0: Minimum - - pow: + help: {description: "Maximum of two integers", parameters: {a0: "First", a1: "Second"}, returns: {a0: "Max"}} + min: addr: 48 - help: - description: Calculates power of a number - parameters: - base: Base number - exponent: Exponent - returns: - result: base^exponent - - bit: + help: {description: "Minimum of two integers", parameters: {a0: "First", a1: "Second"}, returns: {a0: "Min"}} + pow: addr: 52 - help: - description: Returns the value of the bit at given position - parameters: - bitNumber: Bit position - returns: - bitValue: 2^bitNumber - - bitClear: + help: {description: "Calculates power", parameters: {base: "Base", exponent: "Exponent"}, returns: {result: "base^exponent"}} + bit: addr: 56 - help: - description: Clears a bit in a number - parameters: - value: Number - bitNumber: Bit position - returns: - result: Number with bit cleared - - bitRead: + help: {description: "Value of bit at position", parameters: {bitNumber: "Position"}, returns: {bitValue: "2^bitNumber"}} + bitClear: addr: 60 - help: - description: Reads a bit from a number - parameters: - value: Number - bitNumber: Bit position - returns: - bit: 0 or 1 - - bitSet: + help: {description: "Clears a bit", parameters: {value: "Number", bitNumber: "Position"}, returns: {result: "Number cleared"}} + bitRead: addr: 64 - help: - description: Sets a bit in a number - parameters: - value: Number - bitNumber: Bit position - returns: - result: Number with bit set - - bitWrite: + help: {description: "Reads a bit", parameters: {value: "Number", bitNumber: "Position"}, returns: {bit: "0 or 1"}} + bitSet: addr: 68 - help: - description: Writes a bit in a number - parameters: - value: Number - bitNumber: Bit position - bitValue: 0 or 1 - returns: - result: Number with bit written - - highByte: + help: {description: "Sets a bit", parameters: {value: "Number", bitNumber: "Position"}, returns: {result: "Number set"}} + bitWrite: addr: 72 - help: - description: Extracts high byte of a word - parameters: - word: Number - returns: - highByte: High byte - - lowByte: + help: {description: "Writes a bit", parameters: {value: "Number", bitNumber: "Position", bitValue: "0 or 1"}, returns: {result: "Number written"}} + highByte: addr: 76 - help: - description: Extracts low byte of a word - parameters: - word: Number - returns: - lowByte: Low byte - - sqrt: + help: {description: "Extracts high byte", parameters: {word: "Number"}, returns: {highByte: "High byte"}} + lowByte: addr: 80 - help: - description: Calculates square root - parameters: - x: Number - returns: - result: Square root of x - - sq: + help: {description: "Extracts low byte", parameters: {word: "Number"}, returns: {lowByte: "Low byte"}} + attachInterrupt: addr: 84 - help: - description: Squares a number - parameters: - x: Number - returns: - result: x squared - - cos: + help: {description: "Attaches interrupt", parameters: {pin: "Pin", function: "Handler", mode: "Mode"}, returns: {}} + detachInterrupt: addr: 88 - help: - description: Calculates cosine - parameters: - angle: Angle in radians - returns: - result: Cosine of angle - - sin: + help: {description: "Detaches interrupt", parameters: {pin: "Pin"}, returns: {}} + digitalPinToInterrupt: addr: 92 - help: - description: Calculates sine - parameters: - angle: Angle in radians - returns: - result: Sine of angle - - tan: + help: {description: "Pin to interrupt number", parameters: {pin: "Pin"}, returns: {interruptNumber: "Number"}} + pulseIn: addr: 96 - help: - description: Calculates tangent - parameters: - angle: Angle in radians - returns: - result: Tangent of angle - - attachInterrupt: + help: {description: "Reads pulse duration", parameters: {pin: "Pin", value: "HIGH/LOW", timeout: "us"}, returns: {duration: "Pulse duration"}} + pulseInLong: addr: 100 - help: - description: Attaches an interrupt to a pin - parameters: - pin: Pin number - function: Interrupt handler - mode: Interrupt mode - returns: {} - - detachInterrupt: + help: {description: "Reads long pulse duration", parameters: {pin: "Pin", value: "HIGH/LOW", timeout: "us"}, returns: {duration: "Pulse duration"}} + shiftIn: addr: 104 - help: - description: Detaches an interrupt from a pin - parameters: - pin: Pin number - returns: {} - - digitalPinToInterrupt: + help: {description: "Shifts in a byte", parameters: {dataPin: "Pin", clockPin: "Pin", bitOrder: "Order"}, returns: {value: "Byte"}} + shiftOut: addr: 108 - help: - description: Converts digital pin to interrupt number - parameters: - pin: Pin number - returns: - interruptNumber: Interrupt number - - pulseIn: + help: {description: "Shifts out a byte", parameters: {dataPin: "Pin", clockPin: "Pin", bitOrder: "Order", value: "Byte"}, returns: {}} + tone: addr: 112 - help: - description: Reads pulse duration on a pin (microseconds) - parameters: - pin: Pin number - value: HIGH or LOW - timeout: Timeout in microseconds - returns: - duration: Pulse duration - - pulseInLong: + help: {description: "Generates tone", parameters: {pin: "Pin", frequency: "Hz", duration: "ms"}, returns: {}} + noTone: addr: 116 - help: - description: Reads long pulse duration on a pin (microseconds) - parameters: - pin: Pin number - value: HIGH or LOW - timeout: Timeout in microseconds - returns: - duration: Pulse duration - - shiftIn: - addr: 120 - help: - description: Shifts in a byte of data one bit at a time - parameters: - dataPin: Data pin number - clockPin: Clock pin number - bitOrder: MSBFIRST or LSBFIRST - returns: - value: Shifted in byte - - shiftOut: - addr: 124 - help: - description: Shifts out a byte of data one bit at a time - parameters: - dataPin: Data pin number - clockPin: Clock pin number - bitOrder: MSBFIRST or LSBFIRST - value: Byte to shift out - returns: {} - + help: {description: "Stops tone", parameters: {pin: "Pin"}, returns: {}} interrupts: - addr: 128 - help: - description: Enables interrupts - parameters: {} - returns: {} - + addr: 120 + help: {description: "Enables interrupts", parameters: {}, returns: {}} nointerrupts: - addr: 132 - help: - description: Disables interrupts - parameters: {} - returns: {} - + addr: 124 + help: {description: "Disables interrupts", parameters: {}, returns: {}} isDigit: - addr: 136 - help: - description: Checks if character is digit - parameters: - c: Character - returns: - result: true or false - + addr: 128 + help: {description: "Checks if digit", parameters: {c: "Char"}, returns: {result: "bool"}} isAlpha: - addr: 140 - help: - description: Checks if character is alphabetic - parameters: - c: Character - returns: - result: true or false - + addr: 132 + help: {description: "Checks if alpha", parameters: {c: "Char"}, returns: {result: "bool"}} isAlphaNumeric: - addr: 144 - help: - description: Checks if character is alphanumeric - parameters: - c: Character - returns: - result: true or false - + addr: 136 + help: {description: "Checks if alphanumeric", parameters: {c: "Char"}, returns: {result: "bool"}} isAscii: - addr: 148 - help: - description: Checks if character is ASCII - parameters: - c: Character - returns: - result: true or false - + addr: 140 + help: {description: "Checks if ASCII", parameters: {c: "Char"}, returns: {result: "bool"}} isControl: - addr: 152 - help: - description: Checks if character is control character - parameters: - c: Character - returns: - result: true or false - + addr: 144 + help: {description: "Checks if control char", parameters: {c: "Char"}, returns: {result: "bool"}} isPunct: - addr: 156 - help: - description: Checks if character is punctuation - parameters: - c: Character - returns: - result: true or false - + addr: 148 + help: {description: "Checks if punctuation", parameters: {c: "Char"}, returns: {result: "bool"}} isHexadecimalDigit: - addr: 160 - help: - description: Checks if character is a hexadecimal digit - parameters: - c: Character - returns: - result: true or false - + addr: 152 + help: {description: "Checks if hex digit", parameters: {c: "Char"}, returns: {result: "bool"}} isUpperCase: - addr: 164 - help: - description: Checks if character is uppercase - parameters: - c: Character - returns: - result: true or false - + addr: 156 + help: {description: "Checks if uppercase", parameters: {c: "Char"}, returns: {result: "bool"}} isLowerCase: - addr: 168 - help: - description: Checks if character is lowercase - parameters: - c: Character - returns: - result: true or false - + addr: 160 + help: {description: "Checks if lowercase", parameters: {c: "Char"}, returns: {result: "bool"}} isPrintable: - addr: 172 - help: - description: Checks if character is printable - parameters: - c: Character - returns: - result: true or false - + addr: 164 + help: {description: "Checks if printable", parameters: {c: "Char"}, returns: {result: "bool"}} isGraph: - addr: 176 - help: - description: Checks if character has graphical representation - parameters: - c: Character - returns: - result: true or false - + addr: 168 + help: {description: "Checks if graphical", parameters: {c: "Char"}, returns: {result: "bool"}} isSpace: - addr: 180 - help: - description: Checks if character is a space - parameters: - c: Character - returns: - result: true or false - + addr: 172 + help: {description: "Checks if space", parameters: {c: "Char"}, returns: {result: "bool"}} isWhiteSpace: - addr: 184 - help: - description: Checks if character is whitespace - parameters: - c: Character - returns: - result: true or false - + addr: 176 + help: {description: "Checks if whitespace", parameters: {c: "Char"}, returns: {result: "bool"}} delay: - addr: 188 - help: - description: Delays execution for milliseconds - parameters: - ms: Milliseconds - returns: {} - + addr: 180 + help: {description: "Delays ms", parameters: {ms: "ms"}, returns: {}} delayMicroseconds: - addr: 192 - help: - description: Delays execution for microseconds - parameters: - us: Microseconds - returns: {} - + addr: 184 + help: {description: "Delays us", parameters: {us: "us"}, returns: {}} randomSeed: - addr: 196 - help: - description: Sets seed for random number generator - parameters: - seed: Seed value - returns: {} - + addr: 188 + help: {description: "Sets random seed", parameters: {seed: "Value"}, returns: {}} random: - addr: 200 - help: - description: Generates a random number - parameters: - min: Minimum value - max: Maximum value - returns: - value: Random number in range - + addr: 192 + help: {description: "Generates random number", parameters: {min: "Min", max: "Max"}, returns: {value: "Random"}} serial_available: - addr: 204 - help: - description: Returns number of bytes available for reading on serial - parameters: {} - returns: - bytes: Number of bytes available - + addr: 196 + help: {description: "Bytes available to read", parameters: {}, returns: {bytes: "Count"}} serial_availableForWrite: - addr: 208 - help: - description: Returns number of bytes available for writing on serial - parameters: {} - returns: - bytes: Number of bytes available - + addr: 200 + help: {description: "Bytes available to write", parameters: {}, returns: {bytes: "Count"}} serial_begin: - addr: 212 - help: - description: Initializes serial communication - parameters: - baudRate: Baud rate - returns: {} - + addr: 204 + help: {description: "Starts serial", parameters: {baudRate: "Baud"}, returns: {}} serial_end: - addr: 216 - help: - description: Ends serial communication - parameters: {} - returns: {} - + addr: 208 + help: {description: "Ends serial", parameters: {}, returns: {}} serial_find: - addr: 220 - help: - description: Finds data on serial buffer - parameters: - target: Data to find - returns: - found: true or false - + addr: 212 + help: {description: "Finds data", parameters: {target: "Data"}, returns: {found: "bool"}} serial_findUntil: - addr: 224 - help: - description: Finds data on serial buffer until a terminator - parameters: - target: Data to find - terminator: Terminator character - returns: - found: true or false - + addr: 216 + help: {description: "Finds until terminator", parameters: {target: "Data", terminator: "Char"}, returns: {found: "bool"}} serial_flush: - addr: 228 - help: - description: Flushes serial buffer - parameters: {} - returns: {} - - serial_parseFloat: - addr: 232 - help: - description: Parses float from serial - parameters: {} - returns: - value: Parsed float - + addr: 220 + help: {description: "Flushes buffer", parameters: {}, returns: {}} serial_parseInt: - addr: 236 - help: - description: Parses integer from serial - parameters: {} - returns: - value: Parsed integer - + addr: 224 + help: {description: "Parses integer", parameters: {}, returns: {value: "int"}} serial_read: - addr: 240 - help: - description: Reads a byte from serial - parameters: {} - returns: - byte: Read byte - + addr: 228 + help: {description: "Reads byte", parameters: {}, returns: {byte: "Read"}} serial_readBytes: - addr: 244 - help: - description: Reads multiple bytes from serial - parameters: - length: Number of bytes to read - returns: - bytes: Array of bytes read - + addr: 232 + help: {description: "Reads bytes", parameters: {length: "Count"}, returns: {bytes: "Array"}} serial_readBytesUntil: - addr: 248 - help: - description: Reads bytes from serial until a terminator - parameters: - terminator: Terminator character - length: Maximum number of bytes - returns: - bytes: Array of bytes read - + addr: 236 + help: {description: "Reads until terminator", parameters: {terminator: "Char", length: "Max"}, returns: {bytes: "Array"}} serial_write: - addr: 252 - help: - description: Writes byte(s) to serial - parameters: - data: Byte or array of bytes - returns: - written: Number of bytes written - + addr: 240 + help: {description: "Writes data", parameters: {data: "Data"}, returns: {written: "Count"}} serial_printf: - addr: 256 - help: - description: Writes formatted string to serial - parameters: - format: Format string - args: Arguments - returns: - written: Number of bytes written - - fabs: - addr: 260 - help: - description: Returns absolute value of float - parameters: - x: Float number - returns: - absValue: Absolute value - - fmax: - addr: 264 - help: - description: Returns maximum of two floats - parameters: - a: Float 1 - b: Float 2 - returns: - maxValue: Maximum - - fmin: - addr: 268 - help: - description: Returns minimum of two floats - parameters: - a: Float 1 - b: Float 2 - returns: - minValue: Minimum - - sqrtf: - addr: 272 - help: - description: Calculates square root of float - parameters: - x: Float number - returns: - result: Square root - - sqf: - addr: 276 - help: - description: Squares a float number - parameters: - x: Float number - returns: - result: Squared value - - tone: - addr: 280 - help: - description: Generates tone on a pin - parameters: - pin: Pin number - frequency: Frequency in Hz - duration: Duration in milliseconds (optional) - returns: {} - - noTone: - addr: 284 - help: - description: Stops tone on a pin - parameters: - pin: Pin number - returns: {} - - + addr: 244 + help: {description: "Formatted print", parameters: {format: "String", args: "Args"}, returns: {written: "Count"}} \ No newline at end of file diff --git a/public/maker/boards/esp32c3devkit2.svg b/public/maker/boards/esp32c3devkit2.svg new file mode 100644 index 000000000..5321e03ad --- /dev/null +++ b/public/maker/boards/esp32c3devkit2.svg @@ -0,0 +1,918 @@ + +GPIO7ESP32-C3GND3v3RSTGPIO4GPIO5GPIO6GPIO8RSTBOOTCP21023v3GNDGPIO895v55v5GNDGPIO1GND1819GNDGNDGNDGPIO0GPIO2GPIO3GNDGND201021 diff --git a/public/maker/boards/esp32c6devkit1.svg b/public/maker/boards/esp32c6devkit1.svg new file mode 100644 index 000000000..e9992bdc5 --- /dev/null +++ b/public/maker/boards/esp32c6devkit1.svg @@ -0,0 +1,1329 @@ + + + +ESP32-C63v3RST457081011235VG16GTXRX15222119189G1312G2023 + diff --git a/src/cli/commands/info.mts b/src/cli/commands/info.mts index b23b95343..ce6b8805a 100644 --- a/src/cli/commands/info.mts +++ b/src/cli/commands/info.mts @@ -56,7 +56,7 @@ export function handleAboutCommand(): void { "║" + colorText(" 🚀 CREATOR Core Version:", "33") + ` ${creatorVersion}`.padEnd( - 35 - creatorVersion.length + " 6.0.0".length, + 35 - creatorVersion.length + " 6.1.1".length, ) + "║", ); @@ -108,7 +108,7 @@ export function handleAboutCommand(): void { console.log("\n"); } else { console.log( - "CREATOR - didaCtic and geneRic assEmbly progrAmming simulaTOR", + "CREATOR", ); console.log("\nCREATOR Information"); console.log("CREATOR CLI Version: " + CLI_VERSION); diff --git a/src/cli/commands/instructions.mts b/src/cli/commands/instructions.mts index 7ba9e72ad..62eac4b77 100644 --- a/src/cli/commands/instructions.mts +++ b/src/cli/commands/instructions.mts @@ -50,7 +50,7 @@ function displayInstruction( hideLibrary = false, ): void { const address = instr.Address.padEnd(8); - const label = (instr.Label || "").padEnd(11); + const label = instr.Label.join(",").padEnd(11); let loaded = (instr.loaded || "").padEnd(23); const loadedIsBinary = /^[01]+$/.test(loaded); const rightColumn = instr.user || ""; @@ -100,7 +100,7 @@ export function handleInstructionsCommand(limit?: number): void { : instructions.length; for (let i = 0; i < count; i++) { - displayInstruction(instructions[i], currentPC); + displayInstruction(instructions[i]!, currentPC); } } @@ -117,7 +117,7 @@ export function findInstructionByAddressOrLabel( address = userInput.toLowerCase(); } else { const labelMatch = instructions.find( - instr => instr.Label === userInput, + instr => instr.Label.includes(userInput), ); if (labelMatch) { @@ -159,7 +159,7 @@ export function toggleBreakpoint(index: number): void { console.log( `Breakpoint ${status} at ${instr!.Address}${ - instr!.Label ? ` (${instr!.Label})` : "" + instr!.Label.length > 0 ? ` (${instr!.Label.join(",")})` : "" }: ${instr!.loaded}`, ); } @@ -179,7 +179,7 @@ function listBreakpoints(): void { for (const bp of breakpoints) { console.log( - ` ${bp.Address}${bp.Label ? ` (${bp.Label})` : ""}: ${bp.loaded}`, + ` ${bp.Address}${bp.Label.length > 0 ? ` (${bp.Label.join(",")})` : ""}: ${bp.loaded}`, ); } } diff --git a/src/cli/commands/memory.mts b/src/cli/commands/memory.mts index 48d4d1a88..9f92fb711 100644 --- a/src/cli/commands/memory.mts +++ b/src/cli/commands/memory.mts @@ -36,7 +36,7 @@ function applyHintHighlighting( const colors = getHintColors(); for (let k = hintsInRange.length - 1; k >= 0; k--) { - const { hint, offset } = hintsInRange[k]; + const { hint, offset } = hintsInRange[k]!; if (!hint.sizeInBits) continue; const sizeInBytes = Math.ceil(hint.sizeInBits / 8); @@ -68,7 +68,7 @@ function displayMemory(address: number, count: number): void { const formattedAddr = `0x${currentAddr.toString(16).padStart(8, "0")}`; const hintsInRange: Array<{ - hint: { tag: string; type: string; sizeInBits?: number }; + hint: { tag: string[]; type: string; sizeInBits?: number }; offset: number; }> = []; for (let j = 0; j < wordSize; j++) { @@ -95,8 +95,8 @@ function displayMemory(address: number, count: number): void { const colors = getHintColors(); for (let k = 0; k < hintsInRange.length; k++) { - const { hint, offset } = hintsInRange[k]; - const tag = hint.tag || ""; + const { hint, offset } = hintsInRange[k]!; + const tag = hint.tag.join(","); const type = hint.type || ""; const shortHint = type && tag ? `${tag}:${type}` : type || tag; const sizeInfo = hint.sizeInBits diff --git a/src/cli/display.mts b/src/cli/display.mts index 5be470828..1bd66ee8f 100644 --- a/src/cli/display.mts +++ b/src/cli/display.mts @@ -28,7 +28,6 @@ export const CREATOR_ASCII = ` ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██║ ██║██╔══██╗ ╚██████╗██║ ██║███████╗██║ ██║ ██║ ╚██████╔╝██║ ██║ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ - didaCtic and geneRic assEmbly progrAmming simulaTOR `; /** diff --git a/src/cli/tutorial.mts b/src/cli/tutorial.mts index 0bc8d3a2e..634c5d15c 100644 --- a/src/cli/tutorial.mts +++ b/src/cli/tutorial.mts @@ -156,7 +156,7 @@ const TUTORIAL_ASSEMBLY = ` // Tutorial steps - each one has a title, explanation text, and an optional command to execute const tutorialSteps: TutorialStep[] = [ { - title: "Welcome to CREATOR - didaCtic and geneRic assEmbly progrAmming simulaTOR", + title: "Welcome to CREATOR", text: "This tutorial will guide you through understanding the CREATOR simulator with a simple RISC-V program.\n\nCREATOR is a simulator that allows you to run and debug multiple architectures. You'll learn how to examine registers, memory, and control program execution.", waitForCommand: false, }, @@ -513,7 +513,6 @@ export function startTutorial(): void { ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██║ ██║██╔══██╗ ╚██████╗██║ ██║███████╗██║ ██║ ██║ ╚██████╔╝██║ ██║ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ - didaCtic and geneRic assEmbly progrAmming simulaTOR `; // Display welcome message diff --git a/src/cli/types.mts b/src/cli/types.mts index cbe69b2f8..37b0a1b15 100644 --- a/src/cli/types.mts +++ b/src/cli/types.mts @@ -61,7 +61,7 @@ export interface ReturnType { */ export interface Instruction { Address: string; - Label: string | null; + Label: string[]; loaded: string; user: string; Break: boolean | null; diff --git a/src/cli/validator.mts b/src/cli/validator.mts index 219b5623c..56cfce404 100644 --- a/src/cli/validator.mts +++ b/src/cli/validator.mts @@ -23,7 +23,8 @@ import { crex_findReg } from "../../src/core/register/registerLookup.mjs"; import { readRegister } from "../../src/core/register/registerOperations.mjs"; import { raise } from "@/core/capi/validation.mts"; import { ARCH as RISCV } from "@/core/capi/arch/riscv.mjs"; -import { coreEvents, CoreEventTypes } from "@/core/events.mts"; +import { sentinel as sentinelApi } from "@/core/sentinel/sentinel.mts"; +import { coreEvents, CoreEventTypes, type SentinelErrorEvent } from "@/core/events.mts"; interface ExpectedState { registers?: { [name: string]: number }; @@ -58,11 +59,6 @@ export function executeN(n: number): { error: boolean; msg: string } { return ret; } -interface SentinelEvent { - functionName: string; - message: string; - ok: boolean; -} /** * Validates the execution of a program. @@ -79,9 +75,9 @@ export function validate( sentinel: boolean = true, ): { error: boolean; msg: string } { // subscribe to sentinel events - const sentinelErrors: SentinelEvent[] = []; - coreEvents.on(CoreEventTypes.SENTINEL_ERROR, (event: unknown) => { - sentinelErrors.push(event as SentinelEvent); + const sentinelErrors: SentinelErrorEvent[] = []; + coreEvents.on(CoreEventTypes.SENTINEL_ERROR, event => { + sentinelErrors.push(event); }); // execute program @@ -177,7 +173,7 @@ export function validate( error: true, msg: `Found ${sentinelErrors.length} sentinel errors:\n` + - sentinelErrors.map(e => e.message).join("\n"), + sentinelErrors.map(sentinelApi.formatErrors).join("\n"), }; } diff --git a/src/core/assembler/assembler.d.ts b/src/core/assembler/assembler.d.ts index eebd4e3d6..f48b08041 100644 --- a/src/core/assembler/assembler.d.ts +++ b/src/core/assembler/assembler.d.ts @@ -1,7 +1,7 @@ type Instruction = { Address: string; Break: boolean | null; - Label: string; + Label: string[]; binary: string; hide: boolean; loaded: string; @@ -16,3 +16,6 @@ export declare const instructions: Instruction[]; type InstructionTagMap = { [addr: number]: { tag: string; global: boolean } }; export declare let tag_instructions: InstructionTagMap; + +type CompilerFn = (code: string, library: boolean, ansi_color: boolean) + => Promise | object diff --git a/src/core/assembler/assembler.mjs b/src/core/assembler/assembler.mjs index b6021f5ff..c501c99eb 100644 --- a/src/core/assembler/assembler.mjs +++ b/src/core/assembler/assembler.mjs @@ -103,11 +103,20 @@ export function formatErrorWithColors(error) { return htmlMsg; } -export function getCleanErrorMessage(error) { +export function getCleanErrorMessage(error, ansi_color = true) { const errorMsg = String(error); - const parsed = ansicolor.parse(errorMsg); - const cleanMsg = parsed.spans.map(span => span.text).join(""); - return cleanMsg; + if (ansi_color) { + const parsed = ansicolor.parse(errorMsg); + return parsed.spans.map(span => span.text).join(""); + } else { + return errorMsg + .replace(/<.+?>/g, "") + .replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/"/g, '"') + .replace(/'/g, "'"); + } } /** @@ -319,10 +328,11 @@ export function parseDebugSymbols(debugSymbols) { /** * Dispatcher for assembly compilers. * @param {string} code - * @param {any} library - * @param {string} compiler + * @param {boolean} library + * @param {import("./assembler.d.ts").CompilerFn} compiler + * @param {boolean} ansi_color */ -export function assembly_compiler(code, library, compiler) { +export function assembly_compiler(code, library, compiler, ansi_color = false) { // If no compiler is specified, error out if (!compiler) { raise("No compiler specified for assembly compilation"); @@ -333,5 +343,5 @@ export function assembly_compiler(code, library, compiler) { status.executedInstructions = 0; status.clkCycles = 0; - return compiler(code, library); + return compiler(code, library, ansi_color); } diff --git a/src/core/assembler/creatorAssembler/creatorAssemblerBase.mjs b/src/core/assembler/creatorAssembler/creatorAssemblerBase.mjs index 5b133417f..5abb5cddb 100644 --- a/src/core/assembler/creatorAssembler/creatorAssemblerBase.mjs +++ b/src/core/assembler/creatorAssembler/creatorAssemblerBase.mjs @@ -36,18 +36,53 @@ import { setAddress, setInstructions, setLibraryInstructions, - formatErrorWithColors, getCleanErrorMessage, parseErrorForLinter, } from "../assembler.mjs"; import { logger } from "../../utils/creator_logger.mjs"; +// NOTE: the types are the same in the web and deno versions, so we can use +// either. However, tests download only the deno binaries, so it's better to use +// that + +/** + * Assembler's WASM modules + * @typedef {import("./deno/wasm/creator_assembler.d.ts")} WasmModules + */ + +/** + * @typedef {import("./deno/wasm/creator_assembler.d.ts").ArchitectureJS} ArchitectureJS + */ + +/** + * @typedef {import("./deno/wasm/creator_assembler.d.ts").DataJS} DataJS + */ + let libraryInstructions = []; +/** + * Handle compilation error + * @param {String} error - Error message returned by the assembler + * @param {boolean} ansi_color - Whether errors are formatted with ANSI or HTML colors + * @returns {Object} Structured error data + */ +function handleError(error, ansi_color) { + const cleanErrorText = getCleanErrorMessage(error, ansi_color); + const linterInfo = parseErrorForLinter(cleanErrorText); + return { + errorcode: "101", + type: "error", + bgcolor: "danger", + status: "error", + msg: error, + linter: linterInfo, + }; +} + /** * Initialize architecture and prepare for compilation - * @param {Object} wasmModules - WASM modules containing ArchitectureJS - * @returns {Object|null} Architecture instance or null if error occurred + * @param {WasmModules} wasmModules - Assembler's WASM modules + * @returns {ArchitectureJS} Architecture instance. If an error occurs, an exception is raised */ function initializeArchitecture(wasmModules) { const { ArchitectureJS } = wasmModules; @@ -107,7 +142,7 @@ function loadLibraryIfPresent(instructions) { // Convert hex string to binary string let binaryString = ""; for (let i = 0; i < loadedLibrary.binary.length; i += 2) { - const hexByte = loadedLibrary.binary.substr(i, 2); + const hexByte = loadedLibrary.binary.slice(i, i + 2); const byte = parseInt(hexByte, 16); binaryString += byte.toString(2).padStart(8, "0"); } @@ -126,14 +161,17 @@ function loadLibraryIfPresent(instructions) { // Process each instruction let currentAddr = 0; for (let i = 0; i < binaryString.length; i += instructionSizeBits) { - const instructionBinary = binaryString.substr(i, instructionSizeBits); + const instructionBinary = binaryString.slice( + i, + i + instructionSizeBits, + ); const symbolName = symbolsByAddr.get(currentAddr); const hasSymbol = symbolName !== undefined; const instruction = { Break: null, Address: `0x${currentAddr.toString(16)}`, - Label: hasSymbol ? symbolName : "", + Label: hasSymbol ? [symbolName] : [], loaded: instructionBinary, user: null, _rowVariant: "", @@ -153,17 +191,22 @@ function loadLibraryIfPresent(instructions) { /** * Load data elements from compilation into memory - * @param {Array} data_mem - Array of data elements from compiler - * @param {Object} DataCategoryJS - WASM DataCategory module + * @param {DataJS[]} data_mem - Array of data elements from compiler + * @param {WasmModules} wasmModules - Assembler's WASM modules */ // eslint-disable-next-line max-lines-per-function -function loadDataIntoMemory(data_mem, DataCategoryJS) { +function loadDataIntoMemory(data_mem, wasmModules) { + const { DataCategoryJS } = wasmModules; + const wordSizeBytes = + newArchitecture.config.word_size / newArchitecture.config.byte_size; for (let i = 0; i < data_mem.length; i++) { const data = data_mem[i]; - const addr = BigInt(data.address()); + const addr = data.address(); + const size = data.size(); const labels = data.labels(); + const category = data.data_category(); - switch (data.data_category()) { + switch (category) { case DataCategoryJS.Number: switch (data.type()) { case "float": { @@ -172,10 +215,6 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { const view = new DataView(buffer); view.setFloat32(0, floatValue, false); - const wordSizeBytes = - newArchitecture.config.word_size / - newArchitecture.config.byte_size; - const floatBytes = new Uint8Array(4); for (let i = 0; i < 4; i++) { floatBytes[i] = view.getUint8(i); @@ -187,9 +226,8 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { wordSizeBytes, ); - const floatTag = labels[0] ?? ""; const floatType = "float32"; - main_memory.addHint(addr, floatTag, floatType, 32); + main_memory.addHint(addr, labels, floatType, 32); break; } case "double": { @@ -198,10 +236,6 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { const view = new DataView(buffer); view.setFloat64(0, doubleValue, false); - const wordSizeBytes = - newArchitecture.config.word_size / - newArchitecture.config.byte_size; - const doubleBytes = new Uint8Array(8); for (let i = 0; i < 8; i++) { doubleBytes[i] = view.getUint8(i); @@ -213,26 +247,21 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { wordSizeBytes, ); - const doubleTag = labels[0] ?? ""; const doubleType = "float64"; - main_memory.addHint(addr, doubleTag, doubleType, 64); + main_memory.addHint(addr, labels, doubleType, 64); break; } case "byte": { const byteValue = Number("0x" + data.value(false)); main_memory.write(addr, byteValue); - const byteTag = labels[0] ?? ""; const byteType = "byte"; - main_memory.addHint(addr, byteTag, byteType, 8); + main_memory.addHint(addr, labels, byteType, 8); break; } case "word": { const wordValue = BigInt("0x" + data.value(false)); - const wordSizeBytes = - newArchitecture.config.word_size / - newArchitecture.config.byte_size; const wordBytes = new Uint8Array(wordSizeBytes); for (let i = 0; i < wordSizeBytes; i++) { @@ -253,11 +282,10 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { main_memory.writeWord(addr, wordBytes); - const wordTag = labels[0] ?? ""; const wordType = "word"; main_memory.addHint( addr, - wordTag, + labels, wordType, newArchitecture.config.word_size, ); @@ -266,9 +294,6 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { case "double_word": { const dwordValue = BigInt("0x" + data.value(false)); - const wordSizeBytes = - newArchitecture.config.word_size / - newArchitecture.config.byte_size; const highWord = dwordValue >> @@ -313,9 +338,8 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { lowWordBytes, ); - const dwordTag = labels[0] ?? ""; const dwordType = "dword"; - main_memory.addHint(addr, dwordTag, dwordType, 64); + main_memory.addHint(addr, labels, dwordType, 64); break; } @@ -340,9 +364,8 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { main_memory.write(addr, orderedBytes[0]); main_memory.write(addr + 1n, orderedBytes[1]); - const halfTag = labels[0] ?? ""; const halfType = "half"; - main_memory.addHint(addr, halfTag, halfType, 16); + main_memory.addHint(addr, labels, halfType, 16); break; } default: { @@ -354,67 +377,57 @@ function loadDataIntoMemory(data_mem, DataCategoryJS) { break; case DataCategoryJS.String: { - const encoder = new TextEncoder(); - let currentAddr = addr; - const startAddr = addr; - - for (const ch_h of data.value(false)) { - const bytes = new Uint8Array(4); - const n = encoder.encodeInto(ch_h, bytes).written; - for (let j = 0; j < n; j++) { - main_memory.write(currentAddr, bytes[j]); - currentAddr++; - } + const bytes = new TextEncoder().encode(data.value(false)); + for (let i = 0n; i < bytes.length; i++) { + main_memory.write(addr + i, bytes[i]); } - const stringLength = Number(currentAddr - startAddr); - const stringTag = labels[0] ?? ""; + const stringLength = Number(size); const stringType = "string"; - main_memory.addHint( - startAddr, - stringTag, - stringType, - stringLength * 8, - ); + main_memory.addHint(addr, labels, stringType, stringLength * 8); break; } case DataCategoryJS.Padding: case DataCategoryJS.Space: { - const space_size = BigInt(data.size()); - if (space_size < 0n) { - throw new Error( - "The space directive value should be positive and greater than zero", - ); - } - if (space_size > 50n * 1024n * 1024n) { - throw new Error( - ".space value out of range (greater than 50MiB)", - ); - } - for (let j = 0n; j < space_size; j++) { + for (let j = 0n; j < size; j++) { main_memory.write(addr + j, 0); } - const spaceTag = labels[0] ?? ""; const spaceType = - data.data_category() === DataCategoryJS.Padding - ? "padding" - : "space"; - main_memory.addHint( - addr, - spaceTag, - spaceType, - Number(space_size) * 8, - ); + category === DataCategoryJS.Padding ? "padding" : "space"; + main_memory.addHint(addr, labels, spaceType, Number(size) * 8); break; } default: - throw new Error( - `Unknown data category: ${data.data_category()}`, - ); + throw new Error(`Unknown data category: ${category}`); + } + } +} + +/** + * Write binary to memory + * @param {string} binary - Binary string to write + */ +function writeBinaryToMemory(binary, baseAddr) { + // Split into words, reverse order, and concatenate + const words = []; + for (let j = 0; j < binary.length; j += WORDSIZE) { + words.push(binary.slice(j, j + WORDSIZE)); + } + const reversedBinary = words.reverse().join(""); + + for (let j = 0; j < reversedBinary.length; j += WORDSIZE) { + const wordBinary = reversedBinary.slice(j, j + WORDSIZE); + const wordBytes = []; + + for (let k = 0; k < wordBinary.length; k += BYTESIZE) { + const byte = parseInt(wordBinary.slice(k, k + BYTESIZE), 2); + wordBytes.push(byte); } + + main_memory.writeWord(BigInt(baseAddr + j / BYTESIZE), wordBytes); } } @@ -428,7 +441,7 @@ function writeLibraryToMemory() { let binaryString = ""; for (let i = 0; i < loadedLibrary.binary.length; i += 2) { - const hexByte = loadedLibrary.binary.substr(i, 2); + const hexByte = loadedLibrary.binary.slice(i, i + 2); const byte = parseInt(hexByte, 16); binaryString += byte.toString(2).padStart(8, "0"); } @@ -438,30 +451,11 @@ function writeLibraryToMemory() { const instructionSizeBytes = instructionSizeBits / 8; for (let i = 0; i < binaryString.length; i += instructionSizeBits) { - const instructionBinary = binaryString.substr(i, instructionSizeBits); - - // Split into words, reverse order, and concatenate - const words = []; - for (let j = 0; j < instructionBinary.length; j += WORDSIZE) { - words.push(instructionBinary.substr(j, WORDSIZE)); - } - const reversedBinary = words.reverse().join(""); - - for (let j = 0; j < reversedBinary.length; j += WORDSIZE) { - const wordBinary = reversedBinary.substr(j, WORDSIZE); - const wordBytes = []; - - for (let k = 0; k < wordBinary.length; k += BYTESIZE) { - const byte = parseInt(wordBinary.substr(k, BYTESIZE), 2); - wordBytes.push(byte); - } - - main_memory.writeWord( - BigInt(currentAddr + j / BYTESIZE), - wordBytes, - ); - } - + const instructionBinary = binaryString.slice( + i, + i + instructionSizeBits, + ); + writeBinaryToMemory(instructionBinary, currentAddr); currentAddr += instructionSizeBytes; } } @@ -474,41 +468,23 @@ function writeLibraryToMemory() { function writeInstructionsToMemory(instructions, library_instructions) { for (let i = library_instructions; i < instructions.length; i++) { const instruction = instructions[i]; - const baseAddr = parseInt(instruction.Address, 16); - - // Split into words, reverse order, and concatenate - const words = []; - for (let j = 0; j < instruction.binary.length; j += WORDSIZE) { - words.push(instruction.binary.substr(j, WORDSIZE)); - } - const reversedBinary = words.reverse().join(""); - - for (let j = 0; j < reversedBinary.length; j += WORDSIZE) { - const wordBinary = reversedBinary.substr(j, WORDSIZE); - const wordBytes = []; - - for (let k = 0; k < wordBinary.length; k += BYTESIZE) { - const byte = parseInt(wordBinary.substr(k, BYTESIZE), 2); - wordBytes.push(byte); - } - - main_memory.writeWord(BigInt(baseAddr + j / BYTESIZE), wordBytes); - } + const addr = parseInt(instruction.Address, 16); + writeBinaryToMemory(instruction.binary, addr); } } /** * Compile assembly code as a library * @param {string} code - Assembly code to compile - * @param {Object} wasmModules - WASM modules containing ArchitectureJS and DataCategoryJS + * @param {WasmModules} wasmModules - Assembler's WASM modules + * @param {boolean} ansi_color - Whether to use ANSI or HTML colors (default: HTML) * @returns {Object} Compilation result */ -export function assembleCreatorLibrary(code, wasmModules) { +export function assembleCreatorLibrary(code, wasmModules, ansi_color) { /* Google Analytics */ - creator_ga("compile", "compile.libraray"); - const color = 1; + creator_ga("compile", "compile.library"); - const { DataCategoryJS } = wasmModules; + const { Color } = wasmModules; let arch; try { @@ -527,13 +503,13 @@ export function assembleCreatorLibrary(code, wasmModules) { 0, // library_offset (not used for library compilation) "{}", // no library labels true, // library flag - color, + ansi_color ? Color.Ansi : Color.Html, ); // Library compilation: only binary instructions libraryInstructions = compiled.instructions.map(x => ({ Address: x.address, - Label: x.labels[0] ?? "", + Label: x.labels, Break: null, loaded: "0x" + @@ -552,28 +528,18 @@ export function assembleCreatorLibrary(code, wasmModules) { // Extract data elements and load them on memory const data_mem = compiled.data; - loadDataIntoMemory(data_mem, DataCategoryJS); + loadDataIntoMemory(data_mem, wasmModules); } catch (error) { - const cleanErrorText = getCleanErrorMessage(error); - const linterInfo = parseErrorForLinter(cleanErrorText); - return { - errorcode: "101", - type: "error", - bgcolor: "danger", - status: "error", - msg: formatErrorWithColors(error), - linter: linterInfo, - }; + return handleError(error, ansi_color); } // Mark global labels on library instructions for (const instruction of libraryInstructions) { - if (instruction.Label !== "") { - if (label_table[instruction.Label].global === true) { - instruction.globl = true; - } else { - instruction.Label = ""; - } + instruction.Label = instruction.Label.filter( + label => label_table[label].global, + ); + if (instruction.Label.length > 0) { + instruction.globl = true; } } @@ -592,15 +558,15 @@ export function assembleCreatorLibrary(code, wasmModules) { /** * Compile assembly code as a normal program * @param {string} code - Assembly code to compile - * @param {Object} wasmModules - WASM modules containing ArchitectureJS and DataCategoryJS + * @param {WasmModules} wasmModules - Assembler's WASM modules + * @param {boolean} ansi_color - Whether to use ANSI or HTML colors (default: HTML) * @returns {Object} Compilation result */ -export function assembleCreatorProgram(code, wasmModules) { +export function assembleCreatorProgram(code, wasmModules, ansi_color) { /* Google Analytics */ creator_ga("compile", "compile.assembly"); - const color = 1; - const { DataCategoryJS } = wasmModules; + const { Color } = wasmModules; let arch; try { @@ -625,14 +591,14 @@ export function assembleCreatorProgram(code, wasmModules) { library_offset, labels_json, false, // not a library - color, + ansi_color ? Color.Ansi : Color.Html, ); // Normal compilation: populate instructions for execution/display instructions.push( ...compiled.instructions.map(x => ({ Address: x.address, - Label: x.labels[0] ?? "", + Label: x.labels, loaded: x.loaded, binary: x.binary, user: x.user, @@ -650,18 +616,9 @@ export function assembleCreatorProgram(code, wasmModules) { // Extract data elements and load them on memory const data_mem = compiled.data; - loadDataIntoMemory(data_mem, DataCategoryJS); + loadDataIntoMemory(data_mem, wasmModules); } catch (error) { - const cleanErrorText = getCleanErrorMessage(error); - const linterInfo = parseErrorForLinter(cleanErrorText); - return { - errorcode: "101", - type: "error", - bgcolor: "danger", - status: "error", - msg: formatErrorWithColors(error), - linter: linterInfo, - }; + return handleError(error, ansi_color); } // Write library binary to memory if present @@ -695,13 +652,19 @@ export function assembleCreatorProgram(code, wasmModules) { * Common assembly compiler implementation shared between web and deno versions * @param {string} code - Assembly code to compile * @param {boolean} library - Whether this is a library compilation - * @param {Object} wasmModules - WASM modules containing ArchitectureJS and DataCategoryJS + * @param {WasmModules} wasmModules - Assembler's WASM modules + * @param {boolean} ansi_color - Whether to use ANSI or HTML colors (default: HTML) * @returns {Object} Compilation result */ -export function assembleCreatorBase(code, library, wasmModules) { +export function assembleCreatorBase( + code, + library, + wasmModules, + ansi_color = false, +) { if (library) { - return assembleCreatorLibrary(code, wasmModules); + return assembleCreatorLibrary(code, wasmModules, ansi_color); } else { - return assembleCreatorProgram(code, wasmModules); + return assembleCreatorProgram(code, wasmModules, ansi_color); } } diff --git a/src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs b/src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs index de608113a..df9ab5991 100644 --- a/src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs +++ b/src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs @@ -19,22 +19,17 @@ import { assembleCreatorBase } from "../creatorAssemblerBase.mjs"; -import { ArchitectureJS, DataCategoryJS } from "./wasm/creator_assembler.js"; +import * as wasmModules from "./wasm/creator_assembler.js"; /** - * Deno-specific assembly compiler that uses ANSI color configuration + * Deno-specific assembly compiler * WASM is automatically initialized in Deno version * @param {string} code - Assembly code to compile * @param {boolean} library - Whether this is a library compilation + * @param {boolean} ansi_color - Whether to use ANSI or HTML colors (default: ANSI) * @returns {Object} Compilation result */ -export function assembleCreator(code, library) { - // Prepare WASM modules for the base compiler - const wasmModules = { - ArchitectureJS, - DataCategoryJS, - }; - +export function assembleCreator(code, library, ansi_color = true) { // Call the common base implementation - return assembleCreatorBase(code, library, wasmModules); + return assembleCreatorBase(code, library, wasmModules, ansi_color); } diff --git a/src/core/assembler/creatorAssembler/web/creatorAssembler.mjs b/src/core/assembler/creatorAssembler/web/creatorAssembler.mjs index ddf576fd1..bd1dd1d19 100644 --- a/src/core/assembler/creatorAssembler/web/creatorAssembler.mjs +++ b/src/core/assembler/creatorAssembler/web/creatorAssembler.mjs @@ -19,10 +19,7 @@ import { assembleCreatorBase } from "../creatorAssemblerBase.mjs"; -import wasm_web_init, { - ArchitectureJS, - DataCategoryJS, -} from "./wasm/creator_assembler.js"; +import wasm_web_init, * as wasmModules from "./wasm/creator_assembler.js"; /** * Web-specific assembly compiler that initializes WASM @@ -34,12 +31,6 @@ export async function assembleCreator(code, library) { // In the web, we MUST call the default WASM initialization await wasm_web_init(); - // Prepare WASM modules for the base compiler - const wasmModules = { - ArchitectureJS, - DataCategoryJS, - }; - // Call the common base implementation - return assembleCreatorBase(code, library, wasmModules); + return assembleCreatorBase(code, library, wasmModules, false); } diff --git a/src/core/assembler/rasm/deno/rasm.mjs b/src/core/assembler/rasm/deno/rasm.mjs index 8f6699093..e41e7a926 100644 --- a/src/core/assembler/rasm/deno/rasm.mjs +++ b/src/core/assembler/rasm/deno/rasm.mjs @@ -126,7 +126,7 @@ export function rasmAssemble(code) { // Add hints to memory based on the parsed labels for (const [name, addr] of Object.entries(parsedSymbols)) { - main_memory.addHint(addr, name); + main_memory.addHint(addr, [name]); } // Set the tag instructions for the parsed symbols diff --git a/src/core/assembler/rasm/web/rasm.mjs b/src/core/assembler/rasm/web/rasm.mjs index f1190bb74..04fd01ba8 100644 --- a/src/core/assembler/rasm/web/rasm.mjs +++ b/src/core/assembler/rasm/web/rasm.mjs @@ -205,7 +205,7 @@ export async function rasmAssemble(code) { // Add hints to memory based on the parsed labels for (const [name, addr] of Object.entries(parsedSymbols)) { - main_memory.addHint(addr, name); + main_memory.addHint(addr, [name]); } // Set the tag instructions for the parsed symbols diff --git a/src/core/assembler/sailAssembler/CREATORNAssembler.mjs b/src/core/assembler/sailAssembler/CREATORNAssembler.mjs new file mode 100644 index 000000000..9fb073fc5 --- /dev/null +++ b/src/core/assembler/sailAssembler/CREATORNAssembler.mjs @@ -0,0 +1,78 @@ +let linkerText = null; +export let vectorins = [ "vaadd.vv", "vaadd.vx", "vaaddu.vv", + "vaaddu.vx", "vadc.vim", "vadc.vvm", "vadc.vxm", "vadd.vi", "vadd.vv", + "vadd.vx", "vand.vi", "vand.vv", "vand.vx", "vasub.vv", "vasub.vx", + "vasubu.vv", "vasubu.vx", "vcompress.vm", "vcpop.m", "vdiv.vv", "vdiv.vx", + "vdivu.vv", "vdivu.vx", "vfadd.vf", "vfadd.vv", "vfclass.v", "vfcvt.f.x.v", + "vfcvt.f.xu.v", "vfcvt.rtz.x.f.v", "vfcvt.rtz.xu.f.v", "vfcvt.x.f.v", + "vfcvt.xu.f.v", "vfdiv.vf", "vfdiv.vv", "vfirst.m", "vfmacc.vf", "vfmacc.vv", + "vfmadd.vf", "vfmadd.vv", "vfmax.vf", "vfmax.vv", "vfmerge.vfm", "vfmin.vf", + "vfmin.vv", "vfmsac.vf", "vfmsac.vv", "vfmsub.vf", "vfmsub.vv", "vfmul.vf", "vfmul.vv", + "vfmv.f.s", "vfmv.s.f", "vfmv.v.f", "vfncvt.f.f.w", "vfncvt.f.x.w", "vfncvt.f.xu.w", + "vfncvt.rod.f.f.w", "vfncvt.rtz.x.f.w", "vfncvt.rtz.xu.f.w", "vfncvt.x.f.w", + "vfncvt.xu.f.w", "vfnmacc.vf", "vfnmacc.vv", "vfnmadd.vf", "vfnmadd.vv", "vfnmsac.vf", + "vfnmsac.vv", "vfnmsub.vf", "vfnmsub.vv", "vfrdiv.vf", "vfrec7.v", "vfredmax.vs", + "vfredmin.vs", "vfredosum.vs", "vfredusum.vs", "vfrsqrt7.v", "vfrsub.vf", "vfsgnj.vf", + "vfsgnj.vv", "vfsgnjn.vf", "vfsgnjn.vv", "vfsgnjx.vf", "vfsgnjx.vv", "vfslide1down.vf", + "vfslide1up.vf", "vfsqrt.v", "vfsub.vf", "vfsub.vv", "vfwadd.vf", "vfwadd.vv", + "vfwadd.wf", "vfwadd.wv", "vfwcvt.f.f.v", "vfwcvt.f.x.v", "vfwcvt.f.xu.v", + "vfwcvt.rtz.x.f.v", "vfwcvt.rtz.xu.f.v", "vfwcvt.x.f.v", "vfwcvt.xu.f.v", + "vfwmacc.vf", "vfwmacc.vv", "vfwmsac.vf", "vfwmsac.vv", "vfwmul.vf", "vfwmul.vv", + "vfwnmacc.vf", "vfwnmacc.vv", "vfwnmsac.vf", "vfwnmsac.vv", "vfwredosum.vs", + "vfwredusum.vs", "vfwsub.vf", "vfwsub.vv", "vfwsub.wf", "vfwsub.wv", "vid.v", + "viota.m", "vl1re16.v", "vl1re32.v", "vl1re64.v", "vl1re8.v", "vl2re16.v", + "vl2re32.v", "vl2re64.v", "vl2re8.v", "vl4re16.v", "vl4re32.v", "vl4re64.v", + "vl4re8.v", "vl8re16.v", "vl8re32.v", "vl8re64.v", "vl8re8.v", "vle16.v", + "vle16ff.v", "vle32.v", "vle32ff.v", "vle64.v", "vle64ff.v", "vle8.v", + "vle8ff.v", "vlm.v", "vloxei16.v", "vloxei32.v", "vloxei64.v", "vloxei8.v", + "vlse16.v", "vlse32.v", "vlse64.v", "vlse8.v", "vluxei16.v", "vluxei32.v", + "vluxei64.v", "vluxei8.v", "vmacc.vv", "vmacc.vx", "vmadc.vi", "vmadc.vim", + "vmadc.vv", "vmadc.vvm", "vmadc.vx", "vmadc.vxm", "vmadd.vv", "vmadd.vx", + "vmand.mm", "vmandn.mm", "vmax.vv", "vmax.vx", "vmaxu.vv", "vmaxu.vx", "vmerge.vim", + "vmerge.vvm", "vmerge.vxm", "vmfeq.vf", "vmfeq.vv", "vmfge.vf", "vmfgt.vf", + "vmfle.vf", "vmfle.vv", "vmflt.vf", "vmflt.vv", "vmfne.vf", "vmfne.vv", "vmin.vv", + "vmin.vx", "vminu.vv", "vminu.vx", "vmnand.mm", "vmnor.mm", "vmor.mm", "vmorn.mm", + "vmsbc.vv", "vmsbc.vvm", "vmsbc.vx", "vmsbc.vxm", "vmsbf.m", "vmseq.vi", "vmseq.vv", + "vmseq.vx", "vmsgt.vi", "vmsgt.vx", "vmsgtu.vi", "vmsgtu.vx", "vmsif.m", "vmsle.vi", + "vmsle.vv", "vmsle.vx", "vmsleu.vi", "vmsleu.vv", "vmsleu.vx", "vmslt.vv", "vmslt.vx", + "vmsltu.vv", "vmsltu.vx", "vmsne.vi", "vmsne.vv", "vmsne.vx", "vmsof.m", "vmul.vv", + "vmul.vx", "vmulh.vv", "vmulh.vx", "vmulhsu.vv", "vmulhsu.vx", "vmulhu.vv", "vmulhu.vx", + "vmv.s.x", "vmv.v.i", "vmv.v.v", "vmv.v.x", "vmv.x.s", "vmv1r.v", "vmv2r.v", "vmv4r.v", + "vmv8r.v", "vmxnor.mm", "vmxor.mm", "vnclip.wi", "vnclip.wv", "vnclip.wx", "vnclipu.wi", + "vnclipu.wv", "vnclipu.wx", "vnmsac.vv", "vnmsac.vx", "vnmsub.vv", "vnmsub.vx", + "vnsra.wi", "vnsra.wv", "vnsra.wx", "vnsrl.wi", "vnsrl.wv", "vnsrl.wx", "vor.vi", + "vor.vv", "vor.vx", "vredand.vs", "vredmax.vs", "vredmaxu.vs", "vredmin.vs", + "vredminu.vs", "vredor.vs", "vredsum.vs", "vredxor.vs", "vrem.vv", "vrem.vx", + "vremu.vv", "vremu.vx", "vrgather.vi", "vrgather.vv", "vrgather.vx", "vrgatherei16.vv", + "vrsub.vi", "vrsub.vx", "vs1r.v", "vs2r.v", "vs4r.v", "vs8r.v", "vsadd.vi", "vsadd.vv", + "vsadd.vx", "vsaddu.vi", "vsaddu.vv", "vsaddu.vx", "vsbc.vvm", "vsbc.vxm", "vse16.v", + "vse32.v", "vse64.v", "vse8.v", "vsetivli", "vsetvl", "vsetvli", "vsext.vf2", + "vsext.vf4", "vsext.vf8", "vslide1down.vx", "vslide1up.vx", "vslidedown.vi", + "vslidedown.vx", "vslideup.vi", "vslideup.vx", "vsll.vi", "vsll.vv", "vsll.vx", + "vsm.v", "vsmul.vv", "vsmul.vx", "vsoxei16.v", "vsoxei32.v", "vsoxei64.v", + "vsoxei8.v", "vsra.vi", "vsra.vv", "vsra.vx", "vsrl.vi", "vsrl.vv", "vsrl.vx", + "vsse16.v", "vsse32.v", "vsse64.v", "vsse8.v", "vssra.vi", "vssra.vv", + "vssra.vx", "vssrl.vi", "vssrl.vv", "vssrl.vx", "vssub.vv", "vssub.vx", + "vssubu.vv", "vssubu.vx", "vsub.vv", "vsub.vx", "vsuxei16.v", "vsuxei32.v", + "vsuxei64.v", "vsuxei8.v", "vwadd.vv", "vwadd.vx", "vwadd.wv", "vwadd.wx", + "vwaddu.vv", "vwaddu.vx", "vwaddu.wv", "vwaddu.wx", "vwmacc.vv", "vwmacc.vx", + "vwmaccsu.vv", "vwmaccsu.vx", "vwmaccu.vv", "vwmaccu.vx", "vwmaccus.vx", + "vwmul.vv", "vwmul.vx", "vwmulsu.vv", "vwmulsu.vx", "vwmulu.vv", "vwmulu.vx", + "vwredsum.vs", "vwredsumu.vs", "vwsub.vv", "vwsub.vx", "vwsub.wv", "vwsub.wx", + "vwsubu.vv", "vwsubu.vx", "vwsubu.wv", "vwsubu.wx", "vxor.vi", "vxor.vv", + "vxor.vx", "vzext.vf2", "vzext.vf4", "vzext.vf8"]; + +export let privins = ["csrrw", "csrrs", "csrrc", "csrrwi", "csrrsi", "csrrci"]; + +export async function loadlinker(is32b) { + const file = is32b ? 'linker32.ld' : 'linker64.ld'; + const url = new URL(`./linkers/${file}`, import.meta.url); + const res = await fetch(url); + if (!res.ok) { + throw new Error(`No se pudo cargar ${file}: ${res.status} ${res.statusText}`); + } + + linkerText = await res.text(); + + return linkerText; +} \ No newline at end of file diff --git a/src/core/assembler/sailAssembler/README.md b/src/core/assembler/sailAssembler/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/core/assembler/sailAssembler/linkers/linker32.ld b/src/core/assembler/sailAssembler/linkers/linker32.ld new file mode 100644 index 000000000..908399216 --- /dev/null +++ b/src/core/assembler/sailAssembler/linkers/linker32.ld @@ -0,0 +1,61 @@ +ENTRY(_main) + +MEMORY +{ + /* Definir la región de memoria para el código */ + text_mem (rx) : ORIGIN = 0x80000000, LENGTH = 0x4000 + data_mem (rw) : ORIGIN = 0x80004000, LENGTH = 0x2000 + bss_mem (rw) : ORIGIN = 0x80006000, LENGTH = 0x3000 + heap_mem (rw) : ORIGIN = 0x80009000, LENGTH = 0x1000 + stack_mem (rw) : ORIGIN = 0x8000A000, LENGTH = 0x1000 +} + + + +SECTIONS +{ + /* Sección de código de inicialización */ + .text.init : { *(.text.init) } > text_mem + + /* Alineación de la siguiente sección */ + . = ALIGN(0x1000); + + /* Sección .text desde 0x80000000 */ + .text : { + *(.text) + } > text_mem + + /* Sección .data desde 0x80001000 */ + .data : { + *(.data) + } > data_mem + + /* Sección .bss desde 0x80002000 */ + .bss : { + *(.bss) + + /* tohost y fromhost ubicados dentro de la sección .bss */ + . = ALIGN(0x1000); /* Alinear a 4 KB */ + PROVIDE(tohost = .); /* Marca la dirección de tohost */ + . += 8; /* Reserva 8 bytes para tohost */ + PROVIDE(fromhost = .); /* Marca la dirección de fromhost */ + . += 8; /* Reserva 8 bytes para fromhost */ + } > bss_mem + + /* Sección .heap desde 0x80005000 */ + .heap : { + *(.heap) + } > heap_mem + + /* Seccion .stack desde 0x80006000 */ + .stack : { + . = ALIGN(16); + _stack_top = .; + . += LENGTH(stack_mem); + _stack_bottom = .; + } > stack_mem + + + /* Marca el final del programa */ + _end = .; +} diff --git a/src/core/assembler/sailAssembler/linkers/linker64.ld b/src/core/assembler/sailAssembler/linkers/linker64.ld new file mode 100644 index 000000000..bdfc7e1e5 --- /dev/null +++ b/src/core/assembler/sailAssembler/linkers/linker64.ld @@ -0,0 +1,58 @@ +ENTRY(_main) + +MEMORY +{ + /* Definir la región de memoria para el código */ + + /* + text_mem (rx) : ORIGIN = 0x0000000000000000, LENGTH = 0x0000000000020000 + data_mem (rw) : ORIGIN = 0x0000000000020000, LENGTH = 0x00001FFFFFFE0000 + bss_mem (rw) : ORIGIN = 0x0000400000000000, LENGTH = 0x0000200000000000 + heap_mem (rw) : ORIGIN = 0x0000600000000000, LENGTH = 0x0000200000000000 + */ + + + text_mem (rx) : ORIGIN = 0x0000000000000000, LENGTH = 0x0000000000020000 /* 0x00020000 */ + data_mem (rw) : ORIGIN = 0x0000000000020000, LENGTH = 0x000000000FFE0000 /* 0x */ + bss_mem (rw) : ORIGIN = 0x0000000010000000, LENGTH = 0x0000000010000000 /* 0x */ + heap_mem (rw) : ORIGIN = 0x0000000020000000, LENGTH = 0x0000000010000000 /* 0x */ +} + +SECTIONS +{ + /* Sección de código de inicialización */ + .text.init : { *(.text.init) } > text_mem + + /* Alineación de la siguiente sección */ + . = ALIGN(0x1000); + + /* Sección .text desde 0x00000000 */ + .text : { + *(.text) + } > text_mem + + /* Sección .data desde 0x0000200000000000 */ + .data : { + *(.data) + } > data_mem + + /* Sección .bss desde 0x0000400000000000 */ + .bss : { + *(.bss) + + /* tohost y fromhost ubicados dentro de la sección .bss */ + . = ALIGN(0x1000); /* Alinear a 4 KB */ + PROVIDE(tohost = .); /* Marca la dirección de tohost */ + . += 8; /* Reserva 8 bytes para tohost */ + PROVIDE(fromhost = .); /* Marca la dirección de fromhost */ + . += 8; /* Reserva 8 bytes para fromhost */ + } > bss_mem + + /* Sección .heap desde 0x0000600000000000 */ + .heap : { + *(.heap) + } > heap_mem + + /* Marca el final del programa */ + _end = .; +} diff --git a/src/core/assembler/sailAssembler/web/CNAssambler.mjs b/src/core/assembler/sailAssembler/web/CNAssambler.mjs new file mode 100644 index 000000000..d0a8ad000 --- /dev/null +++ b/src/core/assembler/sailAssembler/web/CNAssambler.mjs @@ -0,0 +1,1234 @@ + +/* For 32 bits architecture */ +import as32Module from "./wasm/as-new.js" +//import wasmUrl from "./wasm/as-new.wasm?url"; +import ld32Module from "./wasm/ld-new.js" +import dump32Module, { islib32 } from "./wasm/objdump.js" +import { /*entry_elf,*/ dumpdatainstructions32, dumptextinstructions32, dumplabels32, sectionasm32, inside_label32 } from "./wasm/objdump.js" +import { /*entry_elf,*/ dumpdatainstructions64, dumptextinstructions64, dumplabels64, sectionasm64, inside_label64, islib64 } from "./wasm/objdump64.js" +import { writeMultiByteValueAsWords, instructions, setInstructions, setAddress } from "../../assembler.mjs"; +import as64Module from "./wasm/as-new64.js" +import ld64Module from "./wasm/ld-new64.js" +import dump64Module from "./wasm/objdump64.js" +import { vectorins, loadlinker, privins} from "../CREATORNAssembler.mjs" +import { architecture, loadedLibrary, setPC, status, updateMainMemoryBackup, main_memory, WORDSIZE, BYTESIZE, backup_stack_address, backup_data_address } from "@/core/core.mjs"; +import { show_notification } from "@/core/utils/notifications.mts"; +import { assembly_files } from "@/web/components/assembly/MultifileEditor.mjs"; + +let sailas, sailld, saildump = null; +export const statecode = { codeerror: false }; +export var libs_to_load = []; +var list_data_instructions = []; +var list_user_instructions = []; +var align = 1; +var stack_address = 0; +var ins_filter; +var extensions = []; +var filesToCompile = []; +export var outfile = null; +export var vectoren = false; +export var doubleen = false; +export var priven = false; + +const locateFile = (path) => { + // Cuando Emscripten pida el .wasm, dale la URL real + // if (path.endsWith('.wasm')) return wasmUrl; + // Para cualquier otro asset (data, worker…), resuélvelo relativo a este JS + return new URL(path, import.meta.url).href; +}; + +function identify_pseudo(instruction_assembly){ + const extensionid = ins_filter.findIndex(insn => instruction_assembly.includes(insn.opcode)); + if (extensionid !== -1) { + if(extensions.findIndex(ext => (ins_filter[extensionid].type).includes(ext)) === -1) + extensions.push(ins_filter[extensionid].type); + } + if(instruction_assembly.search("li") != -1 && instruction_assembly.search("slli") === -1 && instruction_assembly.search("vsetvli") === -1 && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))){ + list_user_instructions.push(instruction_assembly); + let parts = instruction_assembly.split(','); + if (!(-2048 >= parseInt(parts[1]?.trim(), 16)) && !(parseInt(parts[1]?.trim(), 16) <= 2047)){ + if (architecture.config.word_size !== 32) { + list_user_instructions.push(""); + } + list_user_instructions.push(""); + }else if(!(-2048 >= parseInt(parts[1]?.trim(), 10)) && !(parseInt(parts[1]?.trim(), 10) <= 2047)){ + if (architecture.config.word_size !== 32) + list_user_instructions.push(""); + list_user_instructions.push(""); + } + } + else if (instruction_assembly.search("la") != -1 && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + { + list_user_instructions.push(instruction_assembly); + list_user_instructions.push(""); + } + else if (instruction_assembly.search("ecall") != -1 && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + list_user_instructions.push(instruction_assembly); + else if (instruction_assembly.search("call") != -1 && (/^call\t/.test(instruction_assembly)) && !(instruction_assembly.search("ecall") != -1) && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + { + list_user_instructions.push(instruction_assembly); + if (architecture.config.word_size == 32) + list_user_instructions.push(""); + } + else if (instruction_assembly.search("lw") != -1 && !(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + { + list_user_instructions.push(instruction_assembly); + let parts = instruction_assembly.split(','); + if( isNaN(parts[1]?.trim()) && !(parts[1]?.trim()).includes("(") ){ + + list_user_instructions.push(""); + return; + } + } + else if(!(instruction_assembly.includes(".section") || instruction_assembly.includes(".globl") || instruction_assembly.includes(".include") || instruction_assembly.includes(".init"))) + list_user_instructions.push(instruction_assembly); + +} + +function process_data_to_store_memory32(){ + for (let i = 0; i < list_data_instructions.length; i++) { + const dump_ins = dumpdatainstructions32.findIndex(insn => insn[4] === list_data_instructions[i].label) + if (dumpdatainstructions32[dump_ins] !== undefined){ + dumpdatainstructions32[dump_ins].push(list_data_instructions[i].align); + dumpdatainstructions32[dump_ins].push(list_data_instructions[i].type); + + if(list_data_instructions[i].type === "asciz" || list_data_instructions[i].type === "ascii"){ + if (dumpdatainstructions32[dump_ins][1].length % 2 !== 0) { + console.warn("String missaligned in memory."); + } + + let bytes = dumpdatainstructions32[dump_ins][1].match(/.{1,2}/g); + + let reversedBytes = bytes.reverse().join(''); + + + if (reversedBytes.endsWith("00") && list_data_instructions[i].type === "ascii") + reversedBytes = reversedBytes.slice(0, -2); + + dumpdatainstructions32[dump_ins][1] = reversedBytes.match(/.{1,2}/g) + .map(byte => String.fromCharCode(parseInt(byte, 16))) + .join(''); + } + else if (list_data_instructions[i].type === "space" || list_data_instructions[i].type === "zero"){ + dumpdatainstructions32[dump_ins][1] = parseInt(list_data_instructions[i].value,10); + } + } + } +} + +function process_data_to_store_memory64(){ + for (let i = 0; i < list_data_instructions.length; i++) { + const dump_ins = dumpdatainstructions64.findIndex(insn => insn[4] === list_data_instructions[i].label) + if (dumpdatainstructions64[dump_ins] !== undefined){ + dumpdatainstructions64[dump_ins].push(list_data_instructions[i].align); + dumpdatainstructions64[dump_ins].push(list_data_instructions[i].type); + + if(list_data_instructions[i].type === "asciz" || list_data_instructions[i].type === "ascii"){ + if (dumpdatainstructions64[dump_ins][1].length % 2 !== 0) { + console.warn("String missaligned in memory."); + } + + let bytes = dumpdatainstructions64[dump_ins][1].match(/.{1,2}/g); + + let reversedBytes = bytes.reverse().join(''); + + + if (reversedBytes.endsWith("00") && list_data_instructions[i].type === "ascii") + reversedBytes = reversedBytes.slice(0, -2); + + dumpdatainstructions64[dump_ins][1] = reversedBytes.match(/.{1,2}/g) + .map(byte => String.fromCharCode(parseInt(byte, 16))) + .join(''); + } + else if (list_data_instructions[i].type === "space" || list_data_instructions[i].type === "zero"){ + dumpdatainstructions64[dump_ins][1] = parseInt(list_data_instructions[i].value,10); + } + } + } +} + +export function writeDataDumpMemory32(){ + for (let i = 0; i < dumpdatainstructions32.length; i++){ + + switch(dumpdatainstructions32[i][6]){ + case "half": + + if(dumpdatainstructions32[i][1].length > 4){ + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 4); + if(dumpdatainstructions32[i][1].length % 4 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*4,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j * 2 + 2) * 2, dumpdatainstructions32[i][1].length - (4 * j)); + if (j === 0 ) + main_memory.write(BigInt(init_add), Number("0x" + element_to_insert)); + else + main_memory.write(BigInt(init_add + j * 2), Number("0x" + element_to_insert)); + + } + }else { + main_memory.write(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), Number("0x" + dumpdatainstructions32[i][1])); + } + + const halfTag = dumpdatainstructions32[i][4] ?? ""; + const halfType = "half"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), halfTag, halfType, 16); + break; + case "byte": + main_memory.write(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), Number("0x"+dumpdatainstructions32[i][1].substring(2))); + const byteTag = dumpdatainstructions32[i][4] ?? ""; + const byteType = "byte"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), byteTag, byteType, 8); + break; + case "word": + case "integer": + if(dumpdatainstructions32[i][1].length > 8){ + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 8); + if(dumpdatainstructions32[i][1].length % 8 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*8,"0"); + } + for (var j = 0; j < elements; j++){ + + var element_to_insert = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j + 1) * 8, dumpdatainstructions32[i][1].length - (8 * j)); + main_memory.write(BigInt(init_add + j * 4), Number(element_to_insert)); + } + }else { + const wordValue = BigInt("0x" + dumpdatainstructions32[i][1]); + const wordBytes = new Uint8Array(4); + for (let j = 0; j < 4; j++) { + const shiftAmount = BigInt((4 - 1 - j) * 8); + wordBytes[j] = Number((wordValue >> shiftAmount) & BigInt( + ( (1 << 8) - 1) + )); + } + main_memory.writeWord(BigInt("0x"+dumpdatainstructions32[i][0]), wordBytes); + } + const wordTag = dumpdatainstructions32[i][4] ?? ""; + const wordType = "word"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), wordTag, wordType, 32); + break; + case "dword": + if(dumpdatainstructions32[i][1].length > 16){ + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 16); + if(dumpdatainstructions32[i][1].length % 16 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*16,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j + 1) * 16, dumpdatainstructions32[i][1].length - (16 * j)); + main_memory.write(BigInt(init_add + j * 8), Number(element_to_insert)); + } + }else { + const dwordValue = BigInt("0x" + dumpdatainstructions32[i][1]); + const wordBytes = new Uint8Array(4); + const highWord = dwordValue >> BigInt(32); + + const lowWord = dwordValue & BigInt( (1n << BigInt(32)) - 1n); + + const highWordBytes = new Uint8Array(4); + const lowWordBytes = new Uint8Array(4); + + for (let j = 0; j < 4; j++){ + const shiftAmount = BigInt( + (4 - 1 - j) * 8); + highWordBytes[j] = Number((highWord >> shiftAmount) & BigInt((1 << 8) - 1)); + lowWordBytes[j] = Number((lowWord >> shiftAmount) & BigInt((1 << 8) - 1)); + } + main_memory.writeWord(BigInt("0x" + dumpdatainstructions32[i][0]), highWordBytes); + main_memory.writeWord(BigInt("0x" + dumpdatainstructions32[i][0]) + BigInt(4), lowWordBytes); + } + const dwordTag = dumpdatainstructions32[i][4] ?? ""; + const dwordType = "dword"; + main_memory.addHint(BigInt("0x" + dumpdatainstructions32[i][0]), dwordTag, dwordType, 64); + break; + + case "float": + align = 2; + + if(dumpdatainstructions32[i][1].length > 8){ // Vector Float Case + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 8); + if(dumpdatainstructions32[i][1].length % 8 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*8,"0"); + } + for (var j = 0; j < elements; j++){ + + var element_to_insert = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j + 1) * 8, dumpdatainstructions32[i][1].length - (8 * j)); + const floatValue = Number("0x" + element_to_insert); + const buffer = new ArrayBuffer(4); + const view = new DataView(buffer); + + view.setFloat32(0, floatValue, false); + const floatBytes = new Uint8Array(4); + for (let k = 0; k < 4; k++) { + floatBytes[k]= view.getUint8(k); + } + writeMultiByteValueAsWords(BigInt(init_add + (j *4)), floatBytes, 4); + } + const floatTag = dumpdatainstructions32[i][4] ?? ""; + const floatType = "float"; + main_memory.addHint(BigInt(init_add), floatTag, floatType, (elements * 32)); + + }else { + const floatValue = Number("0x" + dumpdatainstructions32[i][1]); + const buffer = new ArrayBuffer(4); + const view = new DataView(buffer); + + view.setFloat32(0, floatValue, false); + const floatBytes = new Uint8Array(4); + for(let j = 0; j < 4; j++) { + floatBytes[j] = view.getUint8(j); + } + writeMultiByteValueAsWords(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), floatBytes, 4); + const floatTag = dumpdatainstructions32[i][4] ?? ""; + const floatType = "float"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), floatTag, floatType, 32); + } + break; + case "double": + if (dumpdatainstructions32[i][5] === 0){ + align = 2; + } else { + align = dumpdatainstructions32[i][5]; + } + if(dumpdatainstructions32[i][1].length > 16){ // Vector double case + var init_add = parseInt(dumpdatainstructions32[i][0], 16); + var elements = Math.floor(dumpdatainstructions32[i][1].length / 16); + if(dumpdatainstructions32[i][1].length % 16 !== 0){ + elements = elements + 1; + dumpdatainstructions32[i][1] = dumpdatainstructions32[i][1].padStart(elements*16,"0"); + } + for (var j = 0; j < elements; j++){ + + const doubleValue = dumpdatainstructions32[i][1].slice(dumpdatainstructions32[i][1].length - (j + 1) * 16, dumpdatainstructions32[i][1].length - (16 * j)); + + let bufferd = new ArrayBuffer(8); + let viewd = new DataView(bufferd); + for (let j = 0; j < 8; j++){ + viewd.setUint8(7 - j, parseInt(doubleValue.slice(j * 2, j * 2 + 2), 16)); + + } + const doubleBytes = new Uint8Array(8); + for (let j = 0; j < 8; j++) { + doubleBytes[j] = viewd.getUint8(7 - j); + } + + + writeMultiByteValueAsWords(BigInt(init_add + j *8), doubleBytes, 4); + + } + + const doubleTag = dumpdatainstructions32[i][4] ?? ""; + const doubleType = "float64"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), doubleTag, doubleType, 64 * elements); + }else { + const doubleValue = dumpdatainstructions32[i][1]; + let bufferd = new ArrayBuffer(8); + let viewd = new DataView(bufferd); + for (let j = 0; j < 8; j++){ + viewd.setUint8(7 - j, parseInt(doubleValue.slice(j * 2, j * 2 + 2), 16)); + + } + const doubleBytes = new Uint8Array(8); + for (let j = 0; j < 8; j++) { + doubleBytes[j] = viewd.getUint8(7 - j); + } + + + writeMultiByteValueAsWords(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), doubleBytes, 4); + + const doubleTag = dumpdatainstructions32[i][4] ?? ""; + const doubleType = "float64"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions32[i][0], 16)), doubleTag, doubleType, 64); + } + align = 1; + break; + + case "asciz": + case "ascii": + const encoder = new TextEncoder(); + let curraddr = BigInt(parseInt(dumpdatainstructions32[i][0], 16)); + const startAddr = BigInt(parseInt(dumpdatainstructions32[i][0], 16)); + for (const ch_h of dumpdatainstructions32[i][1]) { + const bytes = new Uint8Array(4); + const n = encoder.encodeInto(ch_h, bytes).written; + for (let j = 0; j < n; j++) { + main_memory.write(curraddr, bytes[j]); + curraddr++; + } + } + const stringLength = Number(curraddr - startAddr); + const stringTag = dumpdatainstructions32[i][4] ?? ""; + const stringType = "string"; + main_memory.addHint(startAddr, stringTag, stringType, stringLength * 8); + break; + case "space": + case "zero": + let space_addr = BigInt(parseInt(dumpdatainstructions32[i][0], 16)); + const size = BigInt(dumpdatainstructions32[i][1]); + if (size < 0n) { + throw new Error("The space directives value should be positive and greater than zero"); + } + for (let j = 0n; j < size; j++) { + main_memory.write(space_addr + j, 0); + } + + const spaceTag = dumpdatainstructions32[i][4] ?? ""; + const spaceType = "space"; + main_memory.addHint(space_addr, spaceTag, spaceType, Number(size) * 8); + break; + } + } + + // Initialize stack + stack_address = parseInt(architecture.memory_layout.stack.start); + + main_memory.writeWord(BigInt(stack_address), [0x0, 0x0, 0x0, 0x0]); // writeMemory("00", parseInt(stack_address), "word") ; + if (architecture.config.word_size == 32) { + architecture.components[1].elements[2].value = + BigInt(parseInt(stack_address) >>> 0, 10); + architecture.components[1].elements[2].default_value = + BigInt(parseInt(stack_address) >>> 0, 10); + }else { + architecture.components[1].elements[2].value = stack_address; + architecture.components[1].elements[2].default_value = stack_address; + } +} + +export function writeDataDumpMemory64(){ + for (let i = 0; i < dumpdatainstructions64.length; i++){ + + switch(dumpdatainstructions64[i][6]){ + case "half": + + if(dumpdatainstructions64[i][1].length > 4){ + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 4); + if(dumpdatainstructions64[i][1].length % 4 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*4,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j * 2 + 2) * 2, dumpdatainstructions64[i][1].length - (4 * j)); + if (j === 0 ) + main_memory.write(BigInt(init_add), Number("0x" + element_to_insert)); + else + main_memory.write(BigInt(init_add + j * 2), Number("0x" + element_to_insert)); + } + }else { + main_memory.write(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), Number("0x" + dumpdatainstructions64[i][1])); + } + + const halfTag = dumpdatainstructions64[i][4] ?? ""; + const halfType = "half"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), halfTag, halfType, 16); + break; + case "byte": + main_memory.write(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), Number("0x"+dumpdatainstructions64[i][1].substring(2))); + const byteTag = dumpdatainstructions64[i][4] ?? ""; + const byteType = "byte"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), byteTag, byteType, 8); + + break; + case "word": + case "integer": + if(dumpdatainstructions64[i][1].length > 8){ + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 8); + if(dumpdatainstructions64[i][1].length % 8 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*8,"0"); + } + for (var j = 0; j < elements; j++) { + var element_to_insert = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j + 1) * 8, dumpdatainstructions64[i][1].length - (8 * j)); + main_memory.write(BigInt(init_add + j * 4), Number(element_to_insert)); + } + }else { + const wordValue = BigInt("0x" + dumpdatainstructions64[i][1]); + const wordBytes = new Uint8Array(4); + for (let j = 0; j < 4; j++) { + const shiftAmount = BigInt((4 - 1 - j) * 8); + wordBytes[j] = Number((wordValue >> shiftAmount) & BigInt( + ( (1 << 8) - 1) + )); + } + main_memory.writeWord(BigInt("0x"+dumpdatainstructions64[i][0]), wordBytes); + } + const wordTag = dumpdatainstructions64[i][4] ?? ""; + const wordType = "word"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), wordTag, wordType, 32); + break; + case "dword": + if(dumpdatainstructions64[i][1].length > 16){ + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 16); + if(dumpdatainstructions64[i][1].length % 16 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*16,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j + 1) * 16, dumpdatainstructions64[i][1].length - (16 * j)); + main_memory.write(BigInt(init_add + j * 8), Number(element_to_insert)); + } + }else { + const dwordValue = BigInt("0x" + dumpdatainstructions64[i][1]); + const wordBytes = new Uint8Array(4); + const highWord = dwordValue >> BigInt(32); + + const lowWord = dwordValue & BigInt( (1n << BigInt(32)) - 1n); + + const highWordBytes = new Uint8Array(4); + const lowWordBytes = new Uint8Array(4); + + for (let j = 0; j < 4; j++){ + const shiftAmount = BigInt( + (4 - 1 - j) * 8); + highWordBytes[j] = Number((highWord >> shiftAmount) & BigInt((1 << 8) - 1)); + lowWordBytes[j] = Number((lowWord >> shiftAmount) & BigInt((1 << 8) - 1)); + } + main_memory.writeWord(BigInt("0x" + dumpdatainstructions64[i][0]), highWordBytes); + main_memory.writeWord(BigInt("0x" + dumpdatainstructions64[i][0]) + BigInt(4), lowWordBytes); + } + const dwordTag = dumpdatainstructions64[i][4] ?? ""; + const dwordType = "dword"; + main_memory.addHint(BigInt("0x" + dumpdatainstructions64[i][0]), dwordTag, dwordType, 64); + break; + + case "float": + align = 2; + + if(dumpdatainstructions64[i][1].length > 8){ // Vector float case + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 8); + if(dumpdatainstructions64[i][1].length % 8 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*8,"0"); + } + for (var j = 0; j < elements; j++){ + var element_to_insert = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j + 1) * 8, dumpdatainstructions64[i][1].length - (8 * j)); + const floatValue = Number("0x" + element_to_insert); + const buffer = new ArrayBuffer(4); + const view = new DataView(buffer); + + view.setFloat32(0, floatValue, false); + const floatBytes = new Uint8Array(4); + for (let k = 0; k < 4; k++) { + floatBytes[k]= view.getUint8(k); + } + writeMultiByteValueAsWords(BigInt(init_add + (j *4)), floatBytes, 4); + } + const floatTag = dumpdatainstructions64[i][4] ?? ""; + const floatType = "float"; + main_memory.addHint(BigInt(init_add), floatTag, floatType, (elements * 32)); + } else { + const floatValue = Number("0x" + dumpdatainstructions64[i][1]); + const buffer = new ArrayBuffer(4); // 4 bytes para float + const view = new DataView(buffer); + + view.setFloat32(0, floatValue, false); + const floatBytes = new Uint8Array(4); + for(let j = 0; j < 4; j++) { + floatBytes[j] = view.getUint8(j); + } + writeMultiByteValueAsWords(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), floatBytes, 4); + const floatTag = dumpdatainstructions64[i][4] ?? ""; + const floatType = "float"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), floatTag, floatType, 32); + } + + break; + case "double": + if (dumpdatainstructions64[i][5] === 0) + align = 2; + else + align = dumpdatainstructions64[i][5]; + + if(dumpdatainstructions64[i][1].length > 16){ + var init_add = parseInt(dumpdatainstructions64[i][0], 16); + var elements = Math.floor(dumpdatainstructions64[i][1].length / 16); + if(dumpdatainstructions64[i][1].length % 16 !== 0){ + elements = elements + 1; + dumpdatainstructions64[i][1] = dumpdatainstructions64[i][1].padStart(elements*16,"0"); + } + for (var j = 0; j < elements; j++){ + const doubleValue = dumpdatainstructions64[i][1].slice(dumpdatainstructions64[i][1].length - (j + 1) * 16, dumpdatainstructions64[i][1].length - (16 * j)); + // console.log(doubleValue); + let bufferd = new ArrayBuffer(8); // 8 bytes para double + let viewd = new DataView(bufferd); + for (let j = 0; j < 8; j++){ + viewd.setUint8(7 - j, parseInt(doubleValue.slice(j * 2, j * 2 + 2), 16)); + + } + const doubleBytes = new Uint8Array(8); + for (let j = 0; j < 8; j++) { + doubleBytes[j] = viewd.getUint8(7 - j); + } + writeMultiByteValueAsWords(BigInt(init_add + j *8), doubleBytes, 4); + + } + const doubleTag = dumpdatainstructions64[i][4] ?? ""; + const doubleType = "float64"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), doubleTag, doubleType, 64 * elements); + + }else { + const doubleValue = dumpdatainstructions64[i][1]; + let bufferd = new ArrayBuffer(8); + let viewd = new DataView(bufferd); + for (let j = 0; j < 8; j++){ + viewd.setUint8(7 - j, parseInt(doubleValue.slice(j * 2, j * 2 + 2), 16)); + + } + const doubleBytes = new Uint8Array(8); + for (let j = 0; j < 8; j++) { + doubleBytes[j] = viewd.getUint8(7 - j); + } + writeMultiByteValueAsWords(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), doubleBytes, 4); + + const doubleTag = dumpdatainstructions64[i][4] ?? ""; + const doubleType = "float64"; + main_memory.addHint(BigInt(parseInt(dumpdatainstructions64[i][0], 16)), doubleTag, doubleType, 64) + } + align = 1; + break; + + case "asciz": + case "ascii": + const encoder = new TextEncoder(); + let curraddr = BigInt(parseInt(dumpdatainstructions64[i][0], 16)); + const startAddr = BigInt(parseInt(dumpdatainstructions64[i][0], 16)); + for (const ch_h of dumpdatainstructions64[i][1]) { + const bytes = new Uint8Array(4); + const n = encoder.encodeInto(ch_h, bytes).written; + for (let j = 0; j < n; j++) { + main_memory.write(curraddr, bytes[j]); + curraddr++; + } + } + const stringLength = Number(curraddr - startAddr); + const stringTag = dumpdatainstructions64[i][4] ?? ""; + const stringType = "string"; + main_memory.addHint(startAddr, stringTag, stringType, stringLength * 8); + break; + + case "space": + case "zero": + let space_addr = BigInt(parseInt(dumpdatainstructions64[i][0], 16)); + const size = BigInt(dumpdatainstructions64[i][1]); + if (size < 0n) { + throw new Error("The space directives value should be positive and greater than zero"); + } + for (let j = 0n; j < size; j++) { + main_memory.write(space_addr + j, 0); + } + + const spaceTag = dumpdatainstructions64[i][4] ?? ""; + const spaceType = "space"; + main_memory.addHint(space_addr, spaceTag, spaceType, Number(size) * 8); + break; + } + } + // Initialize stack + stack_address = parseInt(architecture.memory_layout.stack.start); + + main_memory.writeWord(BigInt(stack_address), [0x0, 0x0, 0x0, 0x0]); // writeMemory("00", parseInt(stack_address), "word") ; + if (architecture.config.word_size == 32) { + architecture.components[1].elements[2].value = + BigInt(parseInt(stack_address) >>> 0, 10); + + architecture.components[1].elements[2].default_value = + BigInt(parseInt(stack_address) >>> 0, 10); + }else { + architecture.components[1].elements[2].value = stack_address; + architecture.components[1].elements[2].default_value = stack_address; + } +} +export async function as(files){ + /* Initialize the assembler compiler */ + let depsLeft = Infinity; + if (architecture.config.name === "SRV32") { + sailas = await as32Module({ + // locateFile, + // locateFile, + noInitialRun: true, + print: (t) => console.log('[as32]', t), + printErr: (t) => console.error('[as32:err]', t), + onAbort: (r) => console.error('[as32:abort]', r), + monitorRunDependencies(left) { + depsLeft = left; + console.log('[as32] deps pendientes:', left); + }, + }); + } else { + sailas = await as64Module({ + noInitialRun: true, + print: (t) => console.log('[as64]', t), + printErr: (t) => console.error('[as64:err]', t), + onAbort: (r) => console.error('[as64:abort]', r), + monitorRunDependencies(left) { + depsLeft = left; + console.log('[as64] deps pendientes:', left); + }, + }); + } + + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); // check every 10ms + }; + check(); + }); + /* Now we have to check which extensions are enabled during the process */ + var march = "-march=rv"; + var mabi = "-mabi=ilp"; + if (architecture.config.name === "SRV32") { + march = march + "32i"; + mabi = mabi + "32"; + for(const ext of extensions ?? []){ + switch(ext){ + case "M": + march = march + "m"; + break; + case "I": + march = march + ""; + break; + case "F": + march = march + "f"; + if(!mabi.includes("d")) + mabi = "-mabi=ilp32f"; + break; + case "D": + march = march + "d"; + mabi = "-mabi=ilp32d"; + doubleen = true; + break; + case "V": + march = march + "v"; + mabi = "-mabi=ilp32d"; + vectoren = true; + break; + } + } + for (const vext of vectorins ?? []) { + for (let j = 0; j < files.length; j++){ + var code = files[j].code; + if (code.includes(vext) && !vectoren){ + march = march + "v"; + mabi = "-mabi=ilp32d"; + vectoren = !vectoren; + } + } + } + for (const priv of privins ?? []) { + for (let j = 0; j < files.length; j++){ + var code = files[j].code; + if (code.includes(priv) && !priven){ + march = march + "_zicsr"; + priven = !priven; + document.app.$data.c_kernel = false; + + } + } + } + + + } else { + march = march + "64i"; + mabi = "-mabi=lp64"; + for(const ext of extensions ?? []){ + switch(ext){ + case "M": + march = march + "m"; + break; + case "I": + march = march + ""; + break; + case "F": + march = march + "f"; + if(!mabi.includes("d")) + mabi = "-mabi=lp64f"; + break; + case "D": + march = march + "d"; + mabi = "-mabi=lp64d"; + break; + case "V": + march = march + "v"; + mabi = "-mabi=lp64d"; + break; + } + } + for (const vext of vectorins ?? []) { + for (let j = 0; j < files.length; j++){ + var code = files[j].code; + if (code.includes(vext) && !vectoren){ + march = march + "v"; + mabi = "-mabi=lp64d"; + vectoren = !vectoren; + } + } + } + for (const priv of privins ?? []) { + for (let j = 0; j < files.length; j++){ + var code = files[j].code; + if (code.includes(priv) && !priven){ + march = march + "_zicsr"; + priven = !priven; + document.app.$data.c_kernel = false; + } + } + } + + } + + let asargs = [march, mabi, files]; + console.log(asargs); + let outfile = null; + outfile = await sailas.run(asargs); + return outfile/* REturn objfile to next step*/; +} + +export async function ld(objfile, libs) { + let depsLeft = Infinity; + if (architecture.config.name === "SRV32") { + sailld = await ld32Module({ + noInitialRun: true, + print: (t) => console.log('[ld32]', t), + printErr: (t) => console.error('[ld32:err]', t), + onAbort: (r) => console.error('[ld32:abort]', r), + monitorRunDependencies(left) { + depsLeft = left; + console.log('[ld32] deps pendientes:', left); + }, + }); + + } else { + sailld = await ld64Module({ + noInitialRun: true, + print: (t) => console.log('[ld64]', t), + printErr: (t) => console.error('[ld64:err]', t), + onAbort: (r) => console.error('[ld64:abort]', r), + monitorRunDependencies(left) { + depsLeft = left; + console.log('[ld64] deps pendientes:', left); + }, + }); + + } + + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); // check every 10ms + }; + check(); + }); + + var linker; + + + /* Load linker script to generate elffile */ + if (architecture.config.name === "SRV32") { + linker = await loadlinker(true); + } + else { + linker = await loadlinker(false); + } + var elf; + if (libs){ + libs_to_load.push({name: loadedLibrary.name, file: loadedLibrary.library_file}); + elf = sailld.run([linker, objfile, "-T", "linker.ld", "-o", "output.elf", "input.o", loadedLibrary.name]); + } else { + elf = sailld.run([linker, objfile, "-T", "linker.ld", "-o", "output.elf", "input.o"]); + + } + + return elf/* Return elfile to dump it*/; +} + +export async function dump(file){ + let depsLeft = Infinity; + + if (architecture.config.name === "SRV32") { + + saildump = await dump32Module({ + noInitialRun: true, + monitorRunDependencies(left) { + depsLeft = left; + console.log('[dump32] deps pendientes:', left); + }, + }); + } + else { + saildump = await dump64Module({ + noInitialRun: true, + // print: (t) => console.log('[dump32]', t), + // printErr: (t) => console.error('[dump32:err]', t), + // onAbort: (r) => console.error('[dump32:abort]', r), + + // Ver qué dependencia está pendiente (wasm, data, worker…) + monitorRunDependencies(left) { + depsLeft = left; + console.log('[dump64] deps pendientes:', left); + }, + }); + } + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); // check every 10ms + }; + check(); + }); + /* Load file into environment and executes dump*/ + saildump.run([file, "-D", "input.elf"]); + if (architecture.config.name === "SRV32") { + // console.log("Instructions:", dumptextinstructions32); + // console.log("Data:", dumpdatainstructions32); + + align = 1; + for (let i = 0; i < dumptextinstructions32.length; i++){ + instructions.push({ + Break: null, + Address: "0x" + dumptextinstructions32[i][0], + Label: [dumptextinstructions32[i][4]], + loaded: dumptextinstructions32[i][2], + user : list_user_instructions[i], + L1_I: 0, + L1_D: 0, + L2_I: 0, + L2_D: 0, + hex: dumptextinstructions32[i][1].replace(/^0x/i, "") + .split("") + .map(c => parseInt(c, 16) + .toString(2) + .padStart(4, "0") + ) + .join(""), + _rowVariant: "", + visible: true, + hide: false, + }); + if(architecture.config.word_size == 32){ + if (dumptextinstructions32[i][0] === document.app.$data.entry_elf || ("0x"+dumptextinstructions32[i][0]) === document.app.$data.entry_elf ) + instructions[i]._rowVariant = 'success'; + } else { + if ((dumptextinstructions32[i][0]) === document.app.$data.entry_elf || ("0x"+dumptextinstructions32[i][0]) === document.app.$data.entry_elf) + instructions[i]._rowVariant = 'success'; + } + } + // Split binary into words and write to memory + for (const instruction of instructions ?? []){ + const auxAddr = parseInt(instruction.Address,16); + for (let j = 0; j < instruction.hex.length; j += 32) { + const wordBinary = instruction.hex.substr(j, 32); + const wordBytes = []; + + // Split word into bytes + for (let k = 0; k < wordBinary.length; k += 8) { + const byte = parseInt(wordBinary.substr(k, 8), 2); + wordBytes.push(byte); + } + + main_memory.writeWord(BigInt(auxAddr + j / 8), wordBytes); + } + } + + + + + process_data_to_store_memory32(); + + writeDataDumpMemory32(); + updateMainMemoryBackup(main_memory.dump()); + + + } else { + + console.log("Instructions:", dumptextinstructions64); + console.log("Data:", dumpdatainstructions64); + + align = 1; + for (let i = 0; i < dumptextinstructions64.length; i++){ + instructions.push({ + Break: null, + Address: "0x" + dumptextinstructions64[i][0], + Label: [dumptextinstructions64[i][4]], + loaded: dumptextinstructions64[i][2], + user : list_user_instructions[i], + L1_I: 0, + L1_D: 0, + L2_I: 0, + L2_D: 0, + hex: dumptextinstructions64[i][1].replace(/^0x/i, "") + .split("") + .map(c => parseInt(c, 16) + .toString(2) + .padStart(4, "0") + ) + .join(""), + _rowVariant: "", + visible: true, + hide: false, + }); + if(architecture.config.word_size == 32){ + if (dumptextinstructions64[i][0] === document.app.$data.entry_elf || ("0x"+dumptextinstructions64[i][0]) === document.app.$data.entry_elf ) + instructions[i]._rowVariant = 'success'; + } else { + if ((dumptextinstructions64[i][0]) === document.app.$data.entry_elf || ("0x"+dumptextinstructions64[i][0]) === document.app.$data.entry_elf) + instructions[i]._rowVariant = 'success'; + } + } + // Split binary into words and write to memory + for (const instruction of instructions ?? []){ + const auxAddr = parseInt(instruction.Address,16); + for (let j = 0; j < instruction.hex.length; j += 32) { + const wordBinary = instruction.hex.substr(j, 32); + const wordBytes = []; + + // Split word into bytes + for (let k = 0; k < wordBinary.length; k += 8) { + const byte = parseInt(wordBinary.substr(k, 8), 2); + wordBytes.push(byte); + } + + main_memory.writeWord(BigInt(auxAddr + j / 8), wordBytes); + } + } + + + + + process_data_to_store_memory64(); + + writeDataDumpMemory64(); + updateMainMemoryBackup(main_memory.dump()); + + } + + setInstructions(instructions); + if (document.app.$data.entry_elf !== undefined) + setPC(BigInt(parseInt(document.app.$data.entry_elf, 16))); + else { // Set first function to entry elf + let ind = instructions.findIndex(insn => (insn.Label !== undefined && insn.Label !== "")); + if (ind !== -1) { + document.app.$data.entry_elf = instructions[ind].Address; + setPC(BigInt(parseInt(document.app.$data.entry_elf, 16))); + } + } + setAddress(parseInt(document.app.$data.entry_elf, 16)); + status.execution_index = instructions.findIndex(insn => insn.Address === document.app.$data.entry_elf); + + return {status: "ok", msg: ""}/* Return list of instructions and data to display in simulator view */; +} + +export async function SailCompile(files, libs){ + + // update the last state of code + let a = assembly_files.findIndex(file => file.editing_now); + if (a !== -1) + assembly_files[a].code = files; + + statecode.codeerror = false; + vectoren = false; + doubleen = false; + priven = false; + extensions.length = 0; + ins_filter = (ins_filter === undefined) ? architecture.instructions.map(insn => ({opcode: insn.name, type: insn.extension})) : ins_filter; + libs_to_load.length = 0; + + dumptextinstructions64.length = 0; + dumpdatainstructions64.length = 0; + dumptextinstructions32.length = 0; + dumpdatainstructions32.length = 0; + list_data_instructions.length = 0; + list_user_instructions.length = 0; + filesToCompile.length = 0; + document.app.$data.c_kernel = true; + // files now create a struct to store files to compile + for (var j = 0; j < assembly_files.length; j++){ + if (assembly_files[j].to_compile){ + filesToCompile.push({name: assembly_files[j].filename, code: assembly_files[j].code}); + } + } + main_memory.zeroOut(); + main_memory.clearHints(); + instructions.length = 0; + var explabel = /^(\w+):/; + var expvalue = /\.(\w+)\s+(.+)/; + var expalign = /^\.align\s+(\d+)/; + var data_alignment = 0; + var is_text = false; + var is_data = false; + var labeltext = ""; + var data_to_store = { + align: 0, + value: 0, + label: "", + type: "" + } + var ret = { + errorcode: "", + token: "", + type: "", + update: "", + status: "ok" + }; + + if (filesToCompile.length === 0){ + ret.status = "error"; + ret.msg = "There is no assembly files selected to compile. Check if it is any file selected to compile."; + return ret; + } + for (let k = 0; k < filesToCompile.length; k++) { + var code_assembly_array = filesToCompile[k].code.split('\n').map(line => line.split('#')[0].trim()).filter(line => line !== ''); + + for (let i = 0; i < code_assembly_array.length; i++){ + if (code_assembly_array[i].search(".text") != -1){ + is_data = false; + is_text = true; + } + else if(code_assembly_array[i].search(".data") != -1){ + is_data = true; + is_text = false; + } + + if (is_data){ + let matchlabel = code_assembly_array[i].match(explabel); + let matchalign = code_assembly_array[i].match(expalign); + let matchvalue = code_assembly_array[i].match(expvalue); + if (matchlabel){ + + data_to_store.label = matchlabel[1]; + } + if (matchalign){ + + data_to_store.align = parseInt(matchalign[1], 10); + } + if (matchvalue && !(code_assembly_array[i].includes(".align") || code_assembly_array[i].includes("section") || code_assembly_array[i].includes("data") )){ + data_to_store.type = matchvalue[1]; + switch(data_to_store.type){ + case "half": + if(matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = matchvalue[2]; + break; + case "byte": + if (matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = parseInt(matchvalue[2]).toString(16); + break; + case "word": + case "dword": + case "integer": + if (matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = parseInt(matchvalue[2]).toString(16); + break; + + case "float": + if (matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = parseFloat(matchvalue[2]); + if (extensions.findIndex(ext => "F".includes(ext)) === -1) + extensions.push("F"); + break; + case "double": + if (matchvalue[2].includes(",")) + data_to_store.value = matchvalue[2].trim().split(","); + else + data_to_store.value = parseFloat(matchvalue[2]).toString(16); + if (extensions.findIndex(ext => "D".includes(ext)) === -1) + extensions.push("D"); + break; + + case "asciz": + data_to_store.value = matchvalue[2]; + break; + + case "ascii": + data_to_store.value = matchvalue[2]; + break; + + case "space": + case "zero": + data_to_store.value = matchvalue[2]; + break; + } + list_data_instructions.push(data_to_store); + data_to_store = Object.assign({}, { + align: 0, + value: 0, + label: "", + type: "" + }); + } + } + + if (is_text && code_assembly_array[i].endsWith(':')) + labeltext = code_assembly_array[i].slice(0, -1); + else if (is_text && labeltext !== ""){ + identify_pseudo(code_assembly_array[i]); + } + } + is_data = false; + is_text = false; + + } + + + + + if (sailas !== null || sailld !== null || saildump !== null) + { + sailas = null; + sailld = null; + saildump = null; + outfile = null; + } + + outfile = await as(filesToCompile); + if (statecode.codeerror) { + return outfile; + } + let elffile = await ld(outfile, libs); + let outdump = await dump(elffile); + // document.app.$data.v_length = 64; + // document.app.$data.L1_I_num_lines = 32; + // document.app.$data.L1_D_num_lines = 32; + // document.app.$data.L1_num_lines = 32; + // document.app.$data.L2_num_lines = 32; + // document.app.$data.L2_I_num_lines = 32; + // document.app.$data.L2_D_num_lines = 32; + // document.app.$data.L1_size = 32; + // document.app.$data.L1_I_size = 32; + // document.app.$data.L1_D_size = 32; + // document.app.$data.L1_size_block = 32; + // document.app.$data.L1_I_size_block = 32; + // document.app.$data.L1_D_size_block = 32; + // document.app.$data.L2_size = 32; + // document.app.$data.L2_I_size = 32; + // document.app.$data.L2_D_size = 32; + // document.app.$data.L2_size_block = 32; + // document.app.$data.L2_I_size_block = 32; + // document.app.$data.L2_D_size_block = 32; + // document.app.$data.cache_type = 0; + // document.app.$data.isDirect = 0; + // document.app.$data.cache_location = "Associative"; + // document.app.$data.cache_policy = "FIFO"; + document.app.$data.execution_mode_run = -1; + document.app.$data.is_breakpoint = 0; + document.app.$data.binary = elffile; + document.app.$data.instructions = instructions; + return outdump; +} diff --git a/src/core/assembler/sailAssembler/web/wasm/as-new.js b/src/core/assembler/sailAssembler/web/wasm/as-new.js new file mode 100644 index 000000000..bf8cc22eb --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/as-new.js @@ -0,0 +1,5868 @@ +import { statecode } from "../CNAssambler.mjs"; +let ofile = null; +var Module = (() => { + var _scriptDir = import.meta.url; + + return ( +function(Module) { + Module = Module || {}; + +var Module = typeof Module != "undefined" ? Module : {}; + +var readyPromiseResolve, readyPromiseReject; + +Module["ready"] = new Promise(function(resolve, reject) { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "_main")) { + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + get: function() { + abort("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + set: function() { + abort("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "___stdio_exit")) { + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + get: function() { + abort("You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + set: function() { + abort("You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized")) { + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + get: function() { + abort("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + set: function() { + abort("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; + +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)"); +} + +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +var read_, readAsync, readBinary, setWindowTitle; + +function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + let toLog = e; + if (e && typeof e == "object" && e.stack) { + toLog = [ e, e.stack ]; + } + err("exiting due to exception: " + toLog); +} + +var fs; + +var nodePath; + +var requireNodeFS; + +if (ENVIRONMENT_IS_NODE) { + if (!(typeof process == "object" && typeof require == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = require("path").dirname(scriptDirectory) + "/"; + } else { + scriptDirectory = __dirname + "/"; + } + requireNodeFS = (() => { + if (!nodePath) { + fs = require("fs"); + nodePath = require("path"); + } + }); + read_ = function shell_read(filename, binary) { + requireNodeFS(); + filename = nodePath["normalize"](filename); + return fs.readFileSync(filename, binary ? undefined : "utf8"); + }; + readBinary = (filename => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + assert(ret.buffer); + return ret; + }); + readAsync = ((filename, onload, onerror) => { + requireNodeFS(); + filename = nodePath["normalize"](filename); + fs.readFile(filename, function(err, data) { + if (err) onerror(err); else onload(data.buffer); + }); + }); + if (process["argv"].length > 1) { + thisProgram = process["argv"][1].replace(/\\/g, "/"); + } + arguments_ = process["argv"].slice(2); + process["on"]("uncaughtException", function(ex) { + if (!(ex instanceof ExitStatus)) { + throw ex; + } + }); + process["on"]("unhandledRejection", function(reason) { + throw reason; + }); + quit_ = ((status, toThrow) => { + if (keepRuntimeAlive()) { + process["exitCode"] = status; + throw toThrow; + } + logExceptionOnExit(toThrow); + process["exit"](status); + }); + Module["inspect"] = function() { + return "[Emscripten Module object]"; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (typeof read != "undefined") { + read_ = function shell_read(f) { + return read(f); + }; + } + readBinary = function readBinary(f) { + let data; + if (typeof readbuffer == "function") { + return new Uint8Array(readbuffer(f)); + } + data = read(f, "binary"); + assert(typeof data == "object"); + return data; + }; + readAsync = function readAsync(f, onload, onerror) { + setTimeout(() => onload(readBinary(f)), 0); + }; + if (typeof scriptArgs != "undefined") { + arguments_ = scriptArgs; + } else if (typeof arguments != "undefined") { + arguments_ = arguments; + } + if (typeof quit == "function") { + quit_ = ((status, toThrow) => { + logExceptionOnExit(toThrow); + quit(status); + }); + } + if (typeof print != "undefined") { + if (typeof console == "undefined") console = {}; + console.log = print; + console.warn = console.error = typeof printErr != "undefined" ? printErr : print; + } +} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } else { + scriptDirectory = ""; + } + if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + read_ = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }); + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }); + } + readAsync = ((url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = (() => { + if (xhr.status == 200 || xhr.status == 0 && xhr.response) { + onload(xhr.response); + return; + } + onerror(); + }); + xhr.onerror = onerror; + xhr.send(null); + }); + } + setWindowTitle = (title => document.title = title); +} else { + throw new Error("environment detection error"); +} + +var out = Module["print"] || console.log.bind(console); + +var instErrExp = /^\.\/([^:]+):(\d+):\s*Error:\s*(.+)$/; +var errstatus; + +Module["printErr"] = function (message) { + console.error(message); + let asmerror = message.match(instErrExp); + + if (asmerror && !statecode.codeerror){ + console.error(asmerror); + errstatus = {status: "error", msg: asmerror[1] + " at line " + asmerror[2] + ": " + asmerror[3]}; + statecode.codeerror = true; + } + +}; + +var err = Module["printErr"] || console.warn.bind(console); + +Object.assign(Module, moduleOverrides); + +moduleOverrides = null; + +if (Module["arguments"]) arguments_ = Module["arguments"]; + +if (!Object.getOwnPropertyDescriptor(Module, "arguments")) { + Object.defineProperty(Module, "arguments", { + configurable: true, + get: function() { + abort("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) { + Object.defineProperty(Module, "thisProgram", { + configurable: true, + get: function() { + abort("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["quit"]) quit_ = Module["quit"]; + +if (!Object.getOwnPropertyDescriptor(Module, "quit")) { + Object.defineProperty(Module, "quit", { + configurable: true, + get: function() { + abort("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed (modify read_ in JS)"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +if (!Object.getOwnPropertyDescriptor(Module, "read")) { + Object.defineProperty(Module, "read", { + configurable: true, + get: function() { + abort("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) { + Object.defineProperty(Module, "readAsync", { + configurable: true, + get: function() { + abort("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) { + Object.defineProperty(Module, "readBinary", { + configurable: true, + get: function() { + abort("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) { + Object.defineProperty(Module, "setWindowTitle", { + configurable: true, + get: function() { + abort("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable."); + +var STACK_ALIGN = 16; + +var POINTER_SIZE = 4; + +function getNativeTypeSize(type) { + switch (type) { + case "i1": + case "i8": + return 1; + + case "i16": + return 2; + + case "i32": + return 4; + + case "i64": + return 8; + + case "float": + return 4; + + case "double": + return 8; + + default: + { + if (type[type.length - 1] === "*") { + return POINTER_SIZE; + } else if (type[0] === "i") { + const bits = Number(type.substr(1)); + assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type); + return bits / 8; + } else { + return 0; + } + } + } +} + +function warnOnce(text) { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } +} + +function convertJsFunctionToWasm(func, sig) { + if (typeof WebAssembly.Function == "function") { + var typeNames = { + "i": "i32", + "j": "i64", + "f": "f32", + "d": "f64" + }; + var type = { + parameters: [], + results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ] + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return new WebAssembly.Function(type, func); + } + var typeSection = [ 1, 0, 1, 96 ]; + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { + "i": 127, + "j": 126, + "f": 125, + "d": 124 + }; + typeSection.push(sigParam.length); + for (var i = 0; i < sigParam.length; ++i) { + typeSection.push(typeCodes[sigParam[i]]); + } + if (sigRet == "v") { + typeSection.push(0); + } else { + typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]); + } + typeSection[1] = typeSection.length - 2; + var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])); + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { + "e": { + "f": func + } + }); + var wrappedFunc = instance.exports["f"]; + return wrappedFunc; +} + +var freeTableIndexes = []; + +var functionsInTableMap; + +function getEmptyTableSlot() { + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; + } + return wasmTable.length - 1; +} + +function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + if (item) { + functionsInTableMap.set(item, i); + } + } +} + +function addFunction(func, sig) { + assert(typeof func != "undefined"); + if (!functionsInTableMap) { + functionsInTableMap = new WeakMap(); + updateTableMap(0, wasmTable.length); + } + if (functionsInTableMap.has(func)) { + return functionsInTableMap.get(func); + } + var ret = getEmptyTableSlot(); + try { + setWasmTableEntry(ret, func); + } catch (err) { + if (!(err instanceof TypeError)) { + throw err; + } + assert(typeof sig != "undefined", "Missing signature argument to addFunction: " + func); + var wrapped = convertJsFunctionToWasm(func, sig); + setWasmTableEntry(ret, wrapped); + } + functionsInTableMap.set(func, ret); + return ret; +} + +function removeFunction(index) { + functionsInTableMap.delete(getWasmTableEntry(index)); + freeTableIndexes.push(index); +} + +var tempRet0 = 0; + +var setTempRet0 = value => { + tempRet0 = value; +}; + +var getTempRet0 = () => tempRet0; + +var wasmBinary; + +if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + +if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) { + Object.defineProperty(Module, "wasmBinary", { + configurable: true, + get: function() { + abort("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) { + Object.defineProperty(Module, "noExitRuntime", { + configurable: true, + get: function() { + abort("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); +} + +function setValue(ptr, value, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + HEAP8[ptr >> 0] = value; + break; + + case "i8": + HEAP8[ptr >> 0] = value; + break; + + case "i16": + HEAP16[ptr >> 1] = value; + break; + + case "i32": + HEAP32[ptr >> 2] = value; + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1]; + break; + + case "float": + HEAPF32[ptr >> 2] = value; + break; + + case "double": + HEAPF64[ptr >> 3] = value; + break; + + default: + abort("invalid type for setValue: " + type); + } + } else { + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i16": + SAFE_HEAP_STORE(ptr | 0, value | 0, 2); + break; + + case "i32": + SAFE_HEAP_STORE(ptr | 0, value | 0, 4); + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(ptr | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(ptr + 4 | 0, tempI64[1] | 0, 4); + break; + + case "float": + SAFE_HEAP_STORE_D(ptr | 0, Math.fround(value), 4); + break; + + case "double": + SAFE_HEAP_STORE_D(ptr | 0, +value, 8); + break; + + default: + abort("invalid type for setValue: " + type); + } + } +} + +function getValue(ptr, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + return HEAP8[ptr >> 0]; + + case "i8": + return HEAP8[ptr >> 0]; + + case "i16": + return HEAP16[ptr >> 1]; + + case "i32": + return HEAP32[ptr >> 2]; + + case "i64": + return HEAP32[ptr >> 2]; + + case "float": + return HEAPF32[ptr >> 2]; + + case "double": + return Number(HEAPF64[ptr >> 3]); + + default: + abort("invalid type for getValue: " + type); + } + } else { + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i8": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i16": + return SAFE_HEAP_LOAD(ptr | 0, 2, 0) | 0; + + case "i32": + return SAFE_HEAP_LOAD(ptr | 0, 4, 0) | 0; + + case "i64": + return SAFE_HEAP_LOAD(ptr | 0, 8, 0) | 0; + + case "float": + return Math.fround(SAFE_HEAP_LOAD_D(ptr | 0, 4, 0)); + + case "double": + return +SAFE_HEAP_LOAD_D(ptr | 0, 8, 0); + + default: + abort("invalid type for getValue: " + type); + } + } + return null; +} + +function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + assert(0); + } +} + +function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort("segmentation fault storing " + bytes + " bytes to address " + dest); + if (dest % bytes !== 0) abort("alignment error storing to address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when storing " + bytes + " bytes to address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort("segmentation fault loading " + bytes + " bytes from address " + dest); + if (dest % bytes !== 0) abort("alignment error loading from address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when loading " + bytes + " bytes from address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue(dest, type, 1); + if (unsigned) ret = unSign(ret, parseInt(type.substr(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort("Function table mask error: function pointer is " + value + " which is masked by " + mask + ", the likely cause of this is that the function pointer is being called by the wrong type."); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +var wasmMemory; + +var ABORT = false; + +var EXITSTATUS; + +function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +function getCFunc(ident) { + var func = Module["_" + ident]; + assert(func, "Cannot call unknown function " + ident + ", make sure it is exported"); + return func; +} + +function ccall(ident, returnType, argTypes, args, opts) { + var toC = { + "string": function(str) { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); + } + return ret; + }, + "array": function(arr) { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + } + }; + function convertReturnValue(ret) { + if (returnType === "string") return UTF8ToString(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func.apply(null, cArgs); + function onDone(ret) { + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + ret = onDone(ret); + return ret; +} + +function cwrap(ident, returnType, argTypes, opts) { + return function() { + return ccall(ident, returnType, argTypes, arguments, opts); + }; +} + +var ALLOC_NORMAL = 0; + +var ALLOC_STACK = 1; + +function allocate(slab, allocator) { + var ret; + assert(typeof allocator == "number", "allocate no longer takes a type argument"); + assert(typeof slab != "number", "allocate no longer takes a number as arg0"); + if (allocator == ALLOC_STACK) { + ret = stackAlloc(slab.length); + } else { + ret = _malloc(slab.length); + } + if (!slab.subarray && !slab.slice) { + slab = new Uint8Array(slab); + } + HEAPU8.set(slab, ret); + return ret; +} + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + +function UTF8ArrayToString(heap, idx, maxBytesToRead) { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { + return UTF8Decoder.decode(heap.subarray(idx, endPtr)); + } else { + var str = ""; + while (idx < endPtr) { + var u0 = heap[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heap[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode((u0 & 31) << 6 | u1); + continue; + } + var u2 = heap[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = (u0 & 15) << 12 | u1 << 6 | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63; + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } + } + } + return str; +} + +function UTF8ToString(ptr, maxBytesToRead) { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +} + +function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | u1 & 1023; + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | u >> 6; + heap[outIdx++] = 128 | u & 63; + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | u >> 12; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | u >> 18; + heap[outIdx++] = 128 | u >> 12 & 63; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } + } + heap[outIdx] = 0; + return outIdx - startIdx; +} + +function stringToUTF8(str, outPtr, maxBytesToWrite) { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +} + +function lengthBytesUTF8(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023; + if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4; + } + return len; +} + +function AsciiToString(ptr) { + var str = ""; + while (1) { + var ch = SAFE_HEAP_LOAD(ptr++ | 0, 1, 1) >>> 0; + if (!ch) return str; + str += String.fromCharCode(ch); + } +} + +function stringToAscii(str, outPtr) { + return writeAsciiToMemory(str, outPtr, false); +} + +var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : undefined; + +function UTF16ToString(ptr, maxBytesToRead) { + assert(ptr % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!"); + var endPtr = ptr; + var idx = endPtr >> 1; + var maxIdx = idx + maxBytesToRead / 2; + while (!(idx >= maxIdx) && SAFE_HEAP_LOAD(idx * 2, 2, 1)) ++idx; + endPtr = idx << 1; + if (endPtr - ptr > 32 && UTF16Decoder) { + return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr)); + } else { + var str = ""; + for (var i = 0; !(i >= maxBytesToRead / 2); ++i) { + var codeUnit = SAFE_HEAP_LOAD(ptr + i * 2 | 0, 2, 0) | 0; + if (codeUnit == 0) break; + str += String.fromCharCode(codeUnit); + } + return str; + } +} + +function stringToUTF16(str, outPtr, maxBytesToWrite) { + assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 2) return 0; + maxBytesToWrite -= 2; + var startPtr = outPtr; + var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length; + for (var i = 0; i < numCharsToWrite; ++i) { + var codeUnit = str.charCodeAt(i); + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 2); + outPtr += 2; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 2); + return outPtr - startPtr; +} + +function lengthBytesUTF16(str) { + return str.length * 2; +} + +function UTF32ToString(ptr, maxBytesToRead) { + assert(ptr % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!"); + var i = 0; + var str = ""; + while (!(i >= maxBytesToRead / 4)) { + var utf32 = SAFE_HEAP_LOAD(ptr + i * 4 | 0, 4, 0) | 0; + if (utf32 == 0) break; + ++i; + if (utf32 >= 65536) { + var ch = utf32 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } else { + str += String.fromCharCode(utf32); + } + } + return str; +} + +function stringToUTF32(str, outPtr, maxBytesToWrite) { + assert(outPtr % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 4) return 0; + var startPtr = outPtr; + var endPtr = startPtr + maxBytesToWrite - 4; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) { + var trailSurrogate = str.charCodeAt(++i); + codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023; + } + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 4); + outPtr += 4; + if (outPtr + 4 > endPtr) break; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 4); + return outPtr - startPtr; +} + +function lengthBytesUTF32(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) ++i; + len += 4; + } + return len; +} + +function allocateUTF8(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function allocateUTF8OnStack(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function writeStringToMemory(string, buffer, dontAddNull) { + warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!"); + var lastChar, end; + if (dontAddNull) { + end = buffer + lengthBytesUTF8(string); + lastChar = SAFE_HEAP_LOAD(end, 1, 0); + } + stringToUTF8(string, buffer, Infinity); + if (dontAddNull) SAFE_HEAP_STORE(end, lastChar, 1); +} + +function writeArrayToMemory(array, buffer) { + assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"); + HEAP8.set(array, buffer); +} + +function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++ | 0, str.charCodeAt(i) | 0, 1); + } + if (!dontAddNull) SAFE_HEAP_STORE(buffer | 0, 0 | 0, 1); +} + +function alignUp(x, multiple) { + if (x % multiple > 0) { + x += multiple - x % multiple; + } + return x; +} + +var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + +function updateGlobalBufferAndViews(buf) { + buffer = buf; + Module["HEAP8"] = HEAP8 = new Int8Array(buf); + Module["HEAP16"] = HEAP16 = new Int16Array(buf); + Module["HEAP32"] = HEAP32 = new Int32Array(buf); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); + Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); + Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); +} + +var TOTAL_STACK = 5242880; + +if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime"); + +var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; + +if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) { + Object.defineProperty(Module, "INITIAL_MEMORY", { + configurable: true, + get: function() { + abort("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"); + +assert(INITIAL_MEMORY == 16777216, "Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically"); + +var wasmTable; + +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + SAFE_HEAP_STORE(max + 4 | 0, 34821223 | 0, 4); + SAFE_HEAP_STORE(max + 8 | 0, 2310721022 | 0, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + var cookie1 = SAFE_HEAP_LOAD(max + 4 | 0, 4, 1) >>> 0; + var cookie2 = SAFE_HEAP_LOAD(max + 8 | 0, 4, 1) >>> 0; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16)); + } +} + +(function() { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"; +})(); + +var __ATPRERUN__ = []; + +var __ATINIT__ = []; + +var __ATMAIN__ = []; + +var __ATEXIT__ = []; + +var __ATPOSTRUN__ = []; + +var runtimeInitialized = false; + +var runtimeExited = false; + +var runtimeKeepaliveCounter = 0; + +function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; +} + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + checkStackCookie(); + assert(!runtimeInitialized); + runtimeInitialized = true; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + callRuntimeCallbacks(__ATINIT__); +} + +function preMain() { + checkStackCookie(); + callRuntimeCallbacks(__ATMAIN__); +} + +function exitRuntime() { + checkStackCookie(); + ___funcs_on_exit(); + callRuntimeCallbacks(__ATEXIT__); + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnPreMain(cb) { + __ATMAIN__.unshift(cb); +} + +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +var runDependencies = 0; + +var runDependencyWatcher = null; + +var dependenciesFulfilled = null; + +var runDependencyTracking = {}; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + runDependencyWatcher = setInterval(function() { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err("dependency: " + dep); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +Module["preloadedImages"] = {}; + +Module["preloadedAudios"] = {}; + +function abort(what) { + { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + } + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + EXITSTATUS = 1; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; +} + +var dataURIPrefix = "data:application/octet-stream;base64,"; + +function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); +} + +function isFileURI(filename) { + return filename.startsWith("file://"); +} + +function createExportWrapper(name, fixedasm) { + return function() { + var displayName = name; + var asm = fixedasm; + if (!fixedasm) { + asm = Module["asm"]; + } + assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization"); + assert(!runtimeExited, "native function `" + displayName + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)"); + if (!asm[name]) { + assert(asm[name], "exported native function `" + displayName + "` not found"); + } + return asm[name].apply(null, arguments); + }; +} + +var wasmBinaryFile; + +if (Module["locateFile"]) { + wasmBinaryFile = "as-new.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } +} else { + wasmBinaryFile = new URL("as-new.wasm", import.meta.url).toString(); +} + +function getBinary(file) { + try { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } else { + throw "both async and sync fetching of the wasm failed"; + } + } catch (err) { + abort(err); + } +} + +function getBinaryPromise() { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function" && !isFileURI(wasmBinaryFile)) { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + if (!response["ok"]) { + throw "failed to load wasm binary file at '" + wasmBinaryFile + "'"; + } + return response["arrayBuffer"](); + }).catch(function() { + return getBinary(wasmBinaryFile); + }); + } else { + if (readAsync) { + return new Promise(function(resolve, reject) { + readAsync(wasmBinaryFile, function(response) { + resolve(new Uint8Array(response)); + }, reject); + }); + } + } + } + return Promise.resolve().then(function() { + return getBinary(wasmBinaryFile); + }); +} + +function createWasm() { + var info = { + "env": asmLibraryArg, + "wasi_snapshot_preview1": asmLibraryArg + }; + function receiveInstance(instance, module) { + var exports = instance.exports; + Module["asm"] = exports; + wasmMemory = Module["asm"]["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateGlobalBufferAndViews(wasmMemory.buffer); + wasmTable = Module["asm"]["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + addOnInit(Module["asm"]["__wasm_call_ctors"]); + removeRunDependency("wasm-instantiate"); + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + receiveInstance(result["instance"]); + } + function instantiateArrayBuffer(receiver) { + return getBinaryPromise().then(function(binary) { + return WebAssembly.instantiate(binary, info); + }).then(function(instance) { + return instance; + }).then(receiver, function(reason) { + err("failed to asynchronously prepare wasm: " + reason); + if (isFileURI(wasmBinaryFile)) { + err("warning: Loading from a file URI (" + wasmBinaryFile + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"); + } + abort(reason); + }); + } + function instantiateAsync() { + if (!wasmBinary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch == "function") { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + var result = WebAssembly.instantiateStreaming(response, info); + return result.then(receiveInstantiationResult, function(reason) { + err("wasm streaming compile failed: " + reason); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(receiveInstantiationResult); + }); + }); + } else { + return instantiateArrayBuffer(receiveInstantiationResult); + } + } + if (Module["instantiateWasm"]) { + try { + var exports = Module["instantiateWasm"](info, receiveInstance); + return exports; + } catch (e) { + err("Module.instantiateWasm callback failed with error: " + e); + return false; + } + } + instantiateAsync().catch(readyPromiseReject); + return {}; +} + +var tempDouble; + +var tempI64; + +var ASM_CONSTS = {}; + +function callRuntimeCallbacks(callbacks) { + while (callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == "function") { + callback(Module); + continue; + } + var func = callback.func; + if (typeof func == "number") { + if (callback.arg === undefined) { + getWasmTableEntry(func)(); + } else { + getWasmTableEntry(func)(callback.arg); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } +} + +function withStackSave(f) { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; +} + +function demangle(func) { + warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"); + return func; +} + +function demangleAll(text) { + var regex = /\b_Z[\w\d_]+/g; + return text.replace(regex, function(x) { + var y = demangle(x); + return x === y ? x : y + " [" + x + "]"; + }); +} + +var wasmTableMirror = []; + +function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; +} + +function handleException(e) { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); +} + +function jsStackTrace() { + var error = new Error(); + if (!error.stack) { + try { + throw new Error(); + } catch (e) { + error = e; + } + if (!error.stack) { + return "(no stack trace available)"; + } + } + return error.stack.toString(); +} + +function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; +} + +function stackTrace() { + var js = jsStackTrace(); + if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"](); + return demangleAll(js); +} + +function unSign(value, bits) { + if (value >= 0) { + return value; + } + return bits <= 32 ? 2 * Math.abs(1 << bits - 1) + value : Math.pow(2, bits) + value; +} + +function ___assert_fail(condition, filename, line, func) { + abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var PATH = { + splitPath: function(filename) { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: function(parts, allowAboveRoot) { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: function(path) { + var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray(path.split("/").filter(function(p) { + return !!p; + }), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: function(path) { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: function(path) { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + extname: function(path) { + return PATH.splitPath(path)[3]; + }, + join: function() { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.join("/")); + }, + join2: function(l, r) { + return PATH.normalize(l + "/" + r); + } +}; + +function getRandomDevice() { + if (typeof crypto == "object" && typeof crypto["getRandomValues"] == "function") { + var randomBuffer = new Uint8Array(1); + return function() { + crypto.getRandomValues(randomBuffer); + return randomBuffer[0]; + }; + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require("crypto"); + return function() { + return crypto_module["randomBytes"](1)[0]; + }; + } catch (e) {} + } + return function() { + abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };"); + }; +} + +var PATH_FS = { + resolve: function() { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(function(p) { + return !!p; + }), !resolvedAbsolute).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: function(from, to) { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var TTY = { + ttys: [], + init: function() {}, + shutdown: function() {}, + register: function(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops: ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + flush: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + read: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char: function(tty) { + if (!tty.input.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + try { + bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE, -1); + } catch (e) { + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } else { + result = null; + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + }, + put_char: function(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + }, + default_tty1_ops: { + put_char: function(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + } +}; + +function zeroMemory(address, size) { + HEAPU8.fill(0, address, address + size); +} + +function alignMemory(size, alignment) { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +} + +function mmapAlloc(size) { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +} + +var MEMFS = { + ops_table: null, + mount: function(mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode: function(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray: function(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage: function(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage: function(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr: function(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr: function(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup: function(parent, name) { + throw FS.genericErrors[44]; + }, + mknod: function(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename: function(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink: function(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir: function(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir: function(node) { + var entries = [ ".", ".." ]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink: function(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink: function(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read: function(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write: function(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek: function(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate: function(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap: function(stream, address, length, position, prot, flags) { + if (address !== 0) { + throw new FS.ErrnoError(28); + } + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { + ptr: ptr, + allocated: allocated + }; + }, + msync: function(stream, buffer, offset, length, mmapFlags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (mmapFlags & 2) { + return 0; + } + var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + } + } +}; + +function asyncLoad(url, onload, onerror, noRunDep) { + var dep = !noRunDep ? getUniqueRunDependency("al " + url) : ""; + readAsync(url, function(arrayBuffer) { + assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).'); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, function(event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }); + if (dep) addRunDependency(dep); +} + +var ERRNO_MESSAGES = { + 0: "Success", + 1: "Arg list too long", + 2: "Permission denied", + 3: "Address already in use", + 4: "Address not available", + 5: "Address family not supported by protocol family", + 6: "No more processes", + 7: "Socket already connected", + 8: "Bad file number", + 9: "Trying to read unreadable message", + 10: "Mount device busy", + 11: "Operation canceled", + 12: "No children", + 13: "Connection aborted", + 14: "Connection refused", + 15: "Connection reset by peer", + 16: "File locking deadlock error", + 17: "Destination address required", + 18: "Math arg out of domain of func", + 19: "Quota exceeded", + 20: "File exists", + 21: "Bad address", + 22: "File too large", + 23: "Host is unreachable", + 24: "Identifier removed", + 25: "Illegal byte sequence", + 26: "Connection already in progress", + 27: "Interrupted system call", + 28: "Invalid argument", + 29: "I/O error", + 30: "Socket is already connected", + 31: "Is a directory", + 32: "Too many symbolic links", + 33: "Too many open files", + 34: "Too many links", + 35: "Message too long", + 36: "Multihop attempted", + 37: "File or path name too long", + 38: "Network interface is not configured", + 39: "Connection reset by network", + 40: "Network is unreachable", + 41: "Too many open files in system", + 42: "No buffer space available", + 43: "No such device", + 44: "No such file or directory", + 45: "Exec format error", + 46: "No record locks available", + 47: "The link has been severed", + 48: "Not enough core", + 49: "No message of desired type", + 50: "Protocol not available", + 51: "No space left on device", + 52: "Function not implemented", + 53: "Socket is not connected", + 54: "Not a directory", + 55: "Directory not empty", + 56: "State not recoverable", + 57: "Socket operation on non-socket", + 59: "Not a typewriter", + 60: "No such device or address", + 61: "Value too large for defined data type", + 62: "Previous owner died", + 63: "Not super-user", + 64: "Broken pipe", + 65: "Protocol error", + 66: "Unknown protocol", + 67: "Protocol wrong type for socket", + 68: "Math result not representable", + 69: "Read only file system", + 70: "Illegal seek", + 71: "No such process", + 72: "Stale file handle", + 73: "Connection timed out", + 74: "Text file busy", + 75: "Cross-device link", + 100: "Device not a stream", + 101: "Bad font file fmt", + 102: "Invalid slot", + 103: "Invalid request code", + 104: "No anode", + 105: "Block device required", + 106: "Channel number out of range", + 107: "Level 3 halted", + 108: "Level 3 reset", + 109: "Link number out of range", + 110: "Protocol driver not attached", + 111: "No CSI structure available", + 112: "Level 2 halted", + 113: "Invalid exchange", + 114: "Invalid request descriptor", + 115: "Exchange full", + 116: "No data (for no delay io)", + 117: "Timer expired", + 118: "Out of streams resources", + 119: "Machine is not on the network", + 120: "Package not installed", + 121: "The object is remote", + 122: "Advertise error", + 123: "Srmount error", + 124: "Communication error on send", + 125: "Cross mount point (not really error)", + 126: "Given log. name not unique", + 127: "f.d. invalid for this operation", + 128: "Remote address changed", + 129: "Can access a needed shared lib", + 130: "Accessing a corrupted shared lib", + 131: ".lib section in a.out corrupted", + 132: "Attempting to link in too many libs", + 133: "Attempting to exec a shared library", + 135: "Streams pipe error", + 136: "Too many users", + 137: "Socket type not supported", + 138: "Not supported", + 139: "Protocol family not supported", + 140: "Can't send after socket shutdown", + 141: "Too many references", + 142: "Host is down", + 148: "No medium (in tape drive)", + 156: "Level 2 not synchronized" +}; + +var ERRNO_CODES = {}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(FS.cwd(), path); + if (!path) return { + path: "", + node: null + }; + var defaults = { + follow_mount: true, + recurse_count: 0 + }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = PATH.normalizeArray(path.split("/").filter(p => !!p), false); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || islast && opts.follow_mount) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { + path: current_path, + node: current + }; + }, + getPath: node => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path; + } + path = path ? node.name + "/" + path : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = (hash << 5) - hash + name.charCodeAt(i) | 0; + } + return (parentid + hash >>> 0) % FS.nameTable.length; + }, + hashAddNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: node => { + FS.hashRemoveNode(node); + }, + isRoot: node => { + return node === node.parent; + }, + isMountpoint: node => { + return !!node.mounted; + }, + isFile: mode => { + return (mode & 61440) === 32768; + }, + isDir: mode => { + return (mode & 61440) === 16384; + }, + isLink: mode => { + return (mode & 61440) === 40960; + }, + isChrdev: mode => { + return (mode & 61440) === 8192; + }, + isBlkdev: mode => { + return (mode & 61440) === 24576; + }, + isFIFO: mode => { + return (mode & 61440) === 4096; + }, + isSocket: mode => { + return (mode & 49152) === 49152; + }, + flagModes: { + "r": 0, + "r+": 2, + "w": 577, + "w+": 578, + "a": 1089, + "a+": 1090 + }, + modeStringToFlags: str => { + var flags = FS.flagModes[str]; + if (typeof flags == "undefined") { + throw new Error("Unknown file open mode: " + str); + } + return flags; + }, + flagsToPermissionString: flag => { + var perms = [ "r", "w", "rw" ][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: dir => { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: (fd_start = 0, fd_end = FS.MAX_OPEN_FDS) => { + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStream: fd => FS.streams[fd], + createStream: (stream, fd_start, fd_end) => { + if (!FS.FSStream) { + FS.FSStream = function() {}; + FS.FSStream.prototype = { + object: { + get: function() { + return this.node; + }, + set: function(val) { + this.node = val; + } + }, + isRead: { + get: function() { + return (this.flags & 2097155) !== 1; + } + }, + isWrite: { + get: function() { + return (this.flags & 2097155) !== 0; + } + }, + isAppend: { + get: function() { + return this.flags & 1024; + } + } + }; + } + stream = Object.assign(new FS.FSStream(), stream); + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: fd => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: stream => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + } + }, + major: dev => dev >> 8, + minor: dev => dev & 255, + makedev: (ma, mi) => ma << 8 | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts: mount => { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err("warning: " + FS.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work"); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [] + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: mountpoint => { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => { + return parent.node_ops.lookup(parent, name); + }, + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: path => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link)); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: path => { + return FS.stat(path, true); + }, + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: mode & 4095 | node.mode & ~4095, + timestamp: Date.now() + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now() + }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now() + }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime) + }); + }, + open: (path, flags, mode, fd_start, fd_end) => { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = mode & 4095 | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072) + }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false + }, fd_start, fd_end); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: stream => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: stream => { + return stream.fd === null; + }, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, address, length, position, prot, flags) => { + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, address, length, position, prot, flags); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream || !stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + munmap: stream => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices: () => { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var random_device = getRandomDevice(); + FS.createDevice("/dev", "random", random_device); + FS.createDevice("/dev", "urandom", random_device); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories: () => { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount: () => { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + } + }; + ret.parent = ret; + return ret; + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams: () => { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")"); + assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")"); + assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")"); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.node = node; + this.setErrno = function(errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + }; + this.setErrno(errno); + this.message = ERRNO_MESSAGES[errno]; + if (this.stack) { + Object.defineProperty(this, "stack", { + value: new Error().stack, + writable: true + }); + this.stack = demangleAll(this.stack); + } + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [ 44 ].forEach(code => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init: (input, output, error) => { + assert(!FS.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + ___stdio_exit(); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + getMode: (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + return null; + } + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: stream => { + stream.seekable = false; + }, + close: stream => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: obj => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = idx / this.chunkSize | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || "", true); + } + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + }, + chunkSize: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + }); + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url: url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + stream_ops.read = ((stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }); + node.stream_ops = stream_ops; + return node; + }, + createPreloadedFile: (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency("cp " + fullname); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + if (onload) onload(); + removeRunDependency(dep); + } + if (Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, byteArray => processData(byteArray), onerror); + } else { + processData(url); + } + }, + indexedDB: () => { + return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + }, + DB_NAME: () => { + return "EM_FS_" + window.location.pathname; + }, + DB_VERSION: 20, + DB_STORE_NAME: "FILE_DATA", + saveFilesToDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = (() => { + out("creating db"); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }); + openRequest.onsuccess = (() => { + var db = openRequest.result; + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readwrite"); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var putRequest = files.put(FS.analyzePath(path).object.contents, path); + putRequest.onsuccess = (() => { + ok++; + if (ok + fail == total) finish(); + }); + putRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + loadFilesFromDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; + openRequest.onsuccess = (() => { + var db = openRequest.result; + try { + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readonly"); + } catch (e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var getRequest = files.get(path); + getRequest.onsuccess = (() => { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true); + ok++; + if (ok + fail == total) finish(); + }); + getRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + absolutePath: () => { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder: () => { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink: () => { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath: () => { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc: () => { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath: () => { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function(dirfd, path, allowEmpty) { + if (path[0] === "/") { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = FS.getStream(dirfd); + if (!dirstream) throw new FS.ErrnoError(8); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function(func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) { + return -54; + } + throw e; + } + SAFE_HEAP_STORE(buf | 0, stat.dev | 0, 4); + SAFE_HEAP_STORE(buf + 4 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 8 | 0, stat.ino | 0, 4); + SAFE_HEAP_STORE(buf + 12 | 0, stat.mode | 0, 4); + SAFE_HEAP_STORE(buf + 16 | 0, stat.nlink | 0, 4); + SAFE_HEAP_STORE(buf + 20 | 0, stat.uid | 0, 4); + SAFE_HEAP_STORE(buf + 24 | 0, stat.gid | 0, 4); + SAFE_HEAP_STORE(buf + 28 | 0, stat.rdev | 0, 4); + SAFE_HEAP_STORE(buf + 32 | 0, 0 | 0, 4); + tempI64 = [ stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 40 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 44 | 0, tempI64[1] | 0, 4); + SAFE_HEAP_STORE(buf + 48 | 0, 4096 | 0, 4); + SAFE_HEAP_STORE(buf + 52 | 0, stat.blocks | 0, 4); + SAFE_HEAP_STORE(buf + 56 | 0, stat.atime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 60 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 64 | 0, stat.mtime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 68 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 72 | 0, stat.ctime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 76 | 0, 0 | 0, 4); + tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 80 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 84 | 0, tempI64[1] | 0, 4); + return 0; + }, + doMsync: function(addr, stream, len, flags, offset) { + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + doMkdir: function(path, mode) { + path = PATH.normalize(path); + if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + }, + doMknod: function(path, mode, dev) { + switch (mode & 61440) { + case 32768: + case 8192: + case 24576: + case 4096: + case 49152: + break; + + default: + return -28; + } + FS.mknod(path, mode, dev); + return 0; + }, + doReadlink: function(path, buf, bufsize) { + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + }, + doAccess: function(path, amode) { + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + }, + doDup: function(path, flags, suggestFD) { + var suggest = FS.getStream(suggestFD); + if (suggest) FS.close(suggest); + return FS.open(path, flags, 0, suggestFD, suggestFD).fd; + }, + doReadv: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + } + return ret; + }, + doWritev: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + } + return ret; + }, + varargs: undefined, + get: function() { + assert(SYSCALLS.varargs != undefined); + SYSCALLS.varargs += 4; + var ret = SAFE_HEAP_LOAD(SYSCALLS.varargs - 4 | 0, 4, 0) | 0; + return ret; + }, + getStr: function(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function(fd) { + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + return stream; + }, + get64: function(low, high) { + if (low >= 0) assert(high === 0); else assert(high === -1); + return low; + } +}; + +function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function setErrNo(value) { + SAFE_HEAP_STORE(___errno_location() | 0, value | 0, 4); + return value; +} + +function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.open(stream.path, stream.flags, 0, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + case 3: + return stream.flags; + + case 4: + { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = SYSCALLS.get(); + var offset = 0; + SAFE_HEAP_STORE(arg + offset | 0, 2 | 0, 2); + return 0; + } + + case 6: + case 7: + return 0; + + case 16: + case 8: + return -28; + + case 9: + setErrNo(28); + return -1; + + default: + { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstatat64(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~4352; + assert(!flags, flags); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd); + if (size < cwdLengthInBytes + 1) return -68; + stringToUTF8(cwd, buf, size); + return buf; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getegid32() { + return 0; +} + +function ___syscall_getgid32() { + return ___syscall_getegid32(); +} + +function ___syscall_getuid32() { + return ___syscall_getegid32(); +} + +function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + case 21505: + { + if (!stream.tty) return -59; + return 0; + } + + case 21510: + case 21511: + case 21512: + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + SAFE_HEAP_STORE(argp | 0, 0 | 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + if (!stream.tty) return -59; + return 0; + } + + case 21524: + { + if (!stream.tty) return -59; + return 0; + } + + default: + abort("bad ioctl syscall " + op); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_open(path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + var pathname = SYSCALLS.getStr(path); + var mode = varargs ? SYSCALLS.get() : 0; + var stream = FS.open(pathname, flags, mode); + return stream.fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_readlink(path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doReadlink(path, buf, bufsize); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_unlink(path) { + try { + path = SYSCALLS.getStr(path); + FS.unlink(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function __localtime_js(time, tmPtr) { + var date = new Date((SAFE_HEAP_LOAD(time | 0, 4, 0) | 0) * 1e3); + SAFE_HEAP_STORE(tmPtr | 0, date.getSeconds() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 4 | 0, date.getMinutes() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 8 | 0, date.getHours() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 12 | 0, date.getDate() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 16 | 0, date.getMonth() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 20 | 0, date.getFullYear() - 1900 | 0, 4); + SAFE_HEAP_STORE(tmPtr + 24 | 0, date.getDay() | 0, 4); + var start = new Date(date.getFullYear(), 0, 1); + var yday = (date.getTime() - start.getTime()) / (1e3 * 60 * 60 * 24) | 0; + SAFE_HEAP_STORE(tmPtr + 28 | 0, yday | 0, 4); + SAFE_HEAP_STORE(tmPtr + 36 | 0, -(date.getTimezoneOffset() * 60) | 0, 4); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE(tmPtr + 32 | 0, dst | 0, 4); +} + +function _tzset_impl(timezone, daylight, tzname) { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + SAFE_HEAP_STORE(timezone | 0, stdTimezoneOffset * 60 | 0, 4); + SAFE_HEAP_STORE(daylight | 0, Number(winterOffset != summerOffset) | 0, 4); + function extractZone(date) { + var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return match ? match[1] : "GMT"; + } + var winterName = extractZone(winter); + var summerName = extractZone(summer); + var winterNamePtr = allocateUTF8(winterName); + var summerNamePtr = allocateUTF8(summerName); + if (summerOffset < winterOffset) { + SAFE_HEAP_STORE(tzname | 0, winterNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, summerNamePtr | 0, 4); + } else { + SAFE_HEAP_STORE(tzname | 0, summerNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, winterNamePtr | 0, 4); + } +} + +function __tzset_js(timezone, daylight, tzname) { + if (__tzset_js.called) return; + __tzset_js.called = true; + _tzset_impl(timezone, daylight, tzname); +} + +function _abort() { + abort("native code called abort()"); +} + +function _emscripten_console_error(str) { + assert(typeof str == "number"); + console.error(UTF8ToString(str)); +} + +function _emscripten_memcpy_big(dest, src, num) { + HEAPU8.copyWithin(dest, src, src + num); +} + +function _emscripten_get_heap_max() { + return 2147483648; +} + +function emscripten_realloc_buffer(size) { + try { + wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16); + updateGlobalBufferAndViews(wasmMemory.buffer); + return 1; + } catch (e) { + err("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e); + } +} + +function _emscripten_resize_heap(requestedSize) { + var oldSize = HEAPU8.length; + requestedSize = requestedSize >>> 0; + assert(requestedSize > oldSize); + var maxHeapSize = _emscripten_get_heap_max(); + if (requestedSize > maxHeapSize) { + err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!"); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = emscripten_realloc_buffer(newSize); + if (replacement) { + return true; + } + } + err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!"); + return false; +} + +var ENV = {}; + +function getExecutableName() { + return thisProgram || "./this.program"; +} + +function getEnvStrings() { + if (!getEnvStrings.strings) { + var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(x + "=" + env[x]); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +} + +function _environ_get(__environ, environ_buf) { + var bufSize = 0; + getEnvStrings().forEach(function(string, i) { + var ptr = environ_buf + bufSize; + SAFE_HEAP_STORE(__environ + i * 4 | 0, ptr | 0, 4); + writeAsciiToMemory(string, ptr); + bufSize += string.length + 1; + }); + return 0; +} + +function _environ_sizes_get(penviron_count, penviron_buf_size) { + var strings = getEnvStrings(); + SAFE_HEAP_STORE(penviron_count | 0, strings.length | 0, 4); + var bufSize = 0; + strings.forEach(function(string) { + bufSize += string.length + 1; + }); + SAFE_HEAP_STORE(penviron_buf_size | 0, bufSize | 0, 4); + return 0; +} + +function _exit(status) { + exit(status); +} + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var HIGH_OFFSET = 4294967296; + var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0); + var DOUBLE_LIMIT = 9007199254740992; + if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) { + return -61; + } + FS.llseek(stream, offset, whence); + tempI64 = [ stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(newOffset | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(newOffset + 4 | 0, tempI64[1] | 0, 4); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doWritev(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _proc_exit(code) { + procExit(code); +} + +function _setTempRet0(val) { + setTempRet0(val); +} + +function __isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} + +function __arraySum(array, index) { + var sum = 0; + for (var i = 0; i <= index; sum += array[i++]) {} + return sum; +} + +var __MONTH_DAYS_LEAP = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; + +var __MONTH_DAYS_REGULAR = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; + +function __addDays(date, days) { + var newDate = new Date(date.getTime()); + while (days > 0) { + var leap = __isLeapYear(newDate.getFullYear()); + var currentMonth = newDate.getMonth(); + var daysInCurrentMonth = (leap ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR)[currentMonth]; + if (days > daysInCurrentMonth - newDate.getDate()) { + days -= daysInCurrentMonth - newDate.getDate() + 1; + newDate.setDate(1); + if (currentMonth < 11) { + newDate.setMonth(currentMonth + 1); + } else { + newDate.setMonth(0); + newDate.setFullYear(newDate.getFullYear() + 1); + } + } else { + newDate.setDate(newDate.getDate() + days); + return newDate; + } + } + return newDate; +} + +function _strftime(s, maxsize, format, tm) { + var tm_zone = SAFE_HEAP_LOAD(tm + 40 | 0, 4, 0) | 0; + var date = { + tm_sec: SAFE_HEAP_LOAD(tm | 0, 4, 0) | 0, + tm_min: SAFE_HEAP_LOAD(tm + 4 | 0, 4, 0) | 0, + tm_hour: SAFE_HEAP_LOAD(tm + 8 | 0, 4, 0) | 0, + tm_mday: SAFE_HEAP_LOAD(tm + 12 | 0, 4, 0) | 0, + tm_mon: SAFE_HEAP_LOAD(tm + 16 | 0, 4, 0) | 0, + tm_year: SAFE_HEAP_LOAD(tm + 20 | 0, 4, 0) | 0, + tm_wday: SAFE_HEAP_LOAD(tm + 24 | 0, 4, 0) | 0, + tm_yday: SAFE_HEAP_LOAD(tm + 28 | 0, 4, 0) | 0, + tm_isdst: SAFE_HEAP_LOAD(tm + 32 | 0, 4, 0) | 0, + tm_gmtoff: SAFE_HEAP_LOAD(tm + 36 | 0, 4, 0) | 0, + tm_zone: tm_zone ? UTF8ToString(tm_zone) : "" + }; + var pattern = UTF8ToString(format); + var EXPANSION_RULES_1 = { + "%c": "%a %b %d %H:%M:%S %Y", + "%D": "%m/%d/%y", + "%F": "%Y-%m-%d", + "%h": "%b", + "%r": "%I:%M:%S %p", + "%R": "%H:%M", + "%T": "%H:%M:%S", + "%x": "%m/%d/%y", + "%X": "%H:%M:%S", + "%Ec": "%c", + "%EC": "%C", + "%Ex": "%m/%d/%y", + "%EX": "%H:%M:%S", + "%Ey": "%y", + "%EY": "%Y", + "%Od": "%d", + "%Oe": "%e", + "%OH": "%H", + "%OI": "%I", + "%Om": "%m", + "%OM": "%M", + "%OS": "%S", + "%Ou": "%u", + "%OU": "%U", + "%OV": "%V", + "%Ow": "%w", + "%OW": "%W", + "%Oy": "%y" + }; + for (var rule in EXPANSION_RULES_1) { + pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_1[rule]); + } + var WEEKDAYS = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; + var MONTHS = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; + function leadingSomething(value, digits, character) { + var str = typeof value == "number" ? value.toString() : value || ""; + while (str.length < digits) { + str = character[0] + str; + } + return str; + } + function leadingNulls(value, digits) { + return leadingSomething(value, digits, "0"); + } + function compareByDay(date1, date2) { + function sgn(value) { + return value < 0 ? -1 : value > 0 ? 1 : 0; + } + var compare; + if ((compare = sgn(date1.getFullYear() - date2.getFullYear())) === 0) { + if ((compare = sgn(date1.getMonth() - date2.getMonth())) === 0) { + compare = sgn(date1.getDate() - date2.getDate()); + } + } + return compare; + } + function getFirstWeekStartDate(janFourth) { + switch (janFourth.getDay()) { + case 0: + return new Date(janFourth.getFullYear() - 1, 11, 29); + + case 1: + return janFourth; + + case 2: + return new Date(janFourth.getFullYear(), 0, 3); + + case 3: + return new Date(janFourth.getFullYear(), 0, 2); + + case 4: + return new Date(janFourth.getFullYear(), 0, 1); + + case 5: + return new Date(janFourth.getFullYear() - 1, 11, 31); + + case 6: + return new Date(janFourth.getFullYear() - 1, 11, 30); + } + } + function getWeekBasedYear(date) { + var thisDate = __addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday); + var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4); + var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4); + var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear); + var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear); + if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) { + if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) { + return thisDate.getFullYear() + 1; + } else { + return thisDate.getFullYear(); + } + } else { + return thisDate.getFullYear() - 1; + } + } + var EXPANSION_RULES_2 = { + "%a": function(date) { + return WEEKDAYS[date.tm_wday].substring(0, 3); + }, + "%A": function(date) { + return WEEKDAYS[date.tm_wday]; + }, + "%b": function(date) { + return MONTHS[date.tm_mon].substring(0, 3); + }, + "%B": function(date) { + return MONTHS[date.tm_mon]; + }, + "%C": function(date) { + var year = date.tm_year + 1900; + return leadingNulls(year / 100 | 0, 2); + }, + "%d": function(date) { + return leadingNulls(date.tm_mday, 2); + }, + "%e": function(date) { + return leadingSomething(date.tm_mday, 2, " "); + }, + "%g": function(date) { + return getWeekBasedYear(date).toString().substring(2); + }, + "%G": function(date) { + return getWeekBasedYear(date); + }, + "%H": function(date) { + return leadingNulls(date.tm_hour, 2); + }, + "%I": function(date) { + var twelveHour = date.tm_hour; + if (twelveHour == 0) twelveHour = 12; else if (twelveHour > 12) twelveHour -= 12; + return leadingNulls(twelveHour, 2); + }, + "%j": function(date) { + return leadingNulls(date.tm_mday + __arraySum(__isLeapYear(date.tm_year + 1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date.tm_mon - 1), 3); + }, + "%m": function(date) { + return leadingNulls(date.tm_mon + 1, 2); + }, + "%M": function(date) { + return leadingNulls(date.tm_min, 2); + }, + "%n": function() { + return "\n"; + }, + "%p": function(date) { + if (date.tm_hour >= 0 && date.tm_hour < 12) { + return "AM"; + } else { + return "PM"; + } + }, + "%S": function(date) { + return leadingNulls(date.tm_sec, 2); + }, + "%t": function() { + return "\t"; + }, + "%u": function(date) { + return date.tm_wday || 7; + }, + "%U": function(date) { + var janFirst = new Date(date.tm_year + 1900, 0, 1); + var firstSunday = janFirst.getDay() === 0 ? janFirst : __addDays(janFirst, 7 - janFirst.getDay()); + var endDate = new Date(date.tm_year + 1900, date.tm_mon, date.tm_mday); + if (compareByDay(firstSunday, endDate) < 0) { + var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth() - 1) - 31; + var firstSundayUntilEndJanuary = 31 - firstSunday.getDate(); + var days = firstSundayUntilEndJanuary + februaryFirstUntilEndMonth + endDate.getDate(); + return leadingNulls(Math.ceil(days / 7), 2); + } + return compareByDay(firstSunday, janFirst) === 0 ? "01" : "00"; + }, + "%V": function(date) { + var janFourthThisYear = new Date(date.tm_year + 1900, 0, 4); + var janFourthNextYear = new Date(date.tm_year + 1901, 0, 4); + var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear); + var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear); + var endDate = __addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday); + if (compareByDay(endDate, firstWeekStartThisYear) < 0) { + return "53"; + } + if (compareByDay(firstWeekStartNextYear, endDate) <= 0) { + return "01"; + } + var daysDifference; + if (firstWeekStartThisYear.getFullYear() < date.tm_year + 1900) { + daysDifference = date.tm_yday + 32 - firstWeekStartThisYear.getDate(); + } else { + daysDifference = date.tm_yday + 1 - firstWeekStartThisYear.getDate(); + } + return leadingNulls(Math.ceil(daysDifference / 7), 2); + }, + "%w": function(date) { + return date.tm_wday; + }, + "%W": function(date) { + var janFirst = new Date(date.tm_year, 0, 1); + var firstMonday = janFirst.getDay() === 1 ? janFirst : __addDays(janFirst, janFirst.getDay() === 0 ? 1 : 7 - janFirst.getDay() + 1); + var endDate = new Date(date.tm_year + 1900, date.tm_mon, date.tm_mday); + if (compareByDay(firstMonday, endDate) < 0) { + var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth() - 1) - 31; + var firstMondayUntilEndJanuary = 31 - firstMonday.getDate(); + var days = firstMondayUntilEndJanuary + februaryFirstUntilEndMonth + endDate.getDate(); + return leadingNulls(Math.ceil(days / 7), 2); + } + return compareByDay(firstMonday, janFirst) === 0 ? "01" : "00"; + }, + "%y": function(date) { + return (date.tm_year + 1900).toString().substring(2); + }, + "%Y": function(date) { + return date.tm_year + 1900; + }, + "%z": function(date) { + var off = date.tm_gmtoff; + var ahead = off >= 0; + off = Math.abs(off) / 60; + off = off / 60 * 100 + off % 60; + return (ahead ? "+" : "-") + String("0000" + off).slice(-4); + }, + "%Z": function(date) { + return date.tm_zone; + }, + "%%": function() { + return "%"; + } + }; + pattern = pattern.replace(/%%/g, "\0\0"); + for (var rule in EXPANSION_RULES_2) { + if (pattern.includes(rule)) { + pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_2[rule](date)); + } + } + pattern = pattern.replace(/\0\0/g, "%"); + var bytes = intArrayFromString(pattern, false); + if (bytes.length > maxsize) { + return 0; + } + writeArrayToMemory(bytes, s); + return bytes.length - 1; +} + +function _time(ptr) { + var ret = Date.now() / 1e3 | 0; + if (ptr) { + SAFE_HEAP_STORE(ptr | 0, ret | 0, 4); + } + return ret; +} + +var FSNode = function(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; +}; + +var readMode = 292 | 73; + +var writeMode = 146; + +Object.defineProperties(FSNode.prototype, { + read: { + get: function() { + return (this.mode & readMode) === readMode; + }, + set: function(val) { + val ? this.mode |= readMode : this.mode &= ~readMode; + } + }, + write: { + get: function() { + return (this.mode & writeMode) === writeMode; + }, + set: function(val) { + val ? this.mode |= writeMode : this.mode &= ~writeMode; + } + }, + isFolder: { + get: function() { + return FS.isDir(this.mode); + } + }, + isDevice: { + get: function() { + return FS.isChrdev(this.mode); + } + } +}); + +FS.FSNode = FSNode; + +FS.staticInit(); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var ASSERTIONS = true; + +function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +} + +function intArrayToString(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + var chr = array[i]; + if (chr > 255) { + if (ASSERTIONS) { + assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF."); + } + chr &= 255; + } + ret.push(String.fromCharCode(chr)); + } + return ret.join(""); +} + +var decodeBase64 = typeof atob == "function" ? atob : function(input) { + var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + do { + enc1 = keyStr.indexOf(input.charAt(i++)); + enc2 = keyStr.indexOf(input.charAt(i++)); + enc3 = keyStr.indexOf(input.charAt(i++)); + enc4 = keyStr.indexOf(input.charAt(i++)); + chr1 = enc1 << 2 | enc2 >> 4; + chr2 = (enc2 & 15) << 4 | enc3 >> 2; + chr3 = (enc3 & 3) << 6 | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 !== 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output = output + String.fromCharCode(chr3); + } + } while (i < input.length); + return output; +}; + +function intArrayFromBase64(s) { + if (typeof ENVIRONMENT_IS_NODE == "boolean" && ENVIRONMENT_IS_NODE) { + var buf = Buffer.from(s, "base64"); + return new Uint8Array(buf["buffer"], buf["byteOffset"], buf["byteLength"]); + } + try { + var decoded = decodeBase64(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0; i < decoded.length; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; + } catch (_) { + throw new Error("Converting base64 string to bytes failed."); + } +} + +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} + +var asmLibraryArg = { + "__assert_fail": ___assert_fail, + "__syscall_chmod": ___syscall_chmod, + "__syscall_fcntl64": ___syscall_fcntl64, + "__syscall_fstat64": ___syscall_fstat64, + "__syscall_fstatat64": ___syscall_fstatat64, + "__syscall_getcwd": ___syscall_getcwd, + "__syscall_getgid32": ___syscall_getgid32, + "__syscall_getuid32": ___syscall_getuid32, + "__syscall_ioctl": ___syscall_ioctl, + "__syscall_lstat64": ___syscall_lstat64, + "__syscall_open": ___syscall_open, + "__syscall_readlink": ___syscall_readlink, + "__syscall_stat64": ___syscall_stat64, + "__syscall_unlink": ___syscall_unlink, + "_localtime_js": __localtime_js, + "_tzset_js": __tzset_js, + "abort": _abort, + "alignfault": alignfault, + "emscripten_console_error": _emscripten_console_error, + "emscripten_memcpy_big": _emscripten_memcpy_big, + "emscripten_resize_heap": _emscripten_resize_heap, + "environ_get": _environ_get, + "environ_sizes_get": _environ_sizes_get, + "exit": _exit, + "fd_close": _fd_close, + "fd_read": _fd_read, + "fd_seek": _fd_seek, + "fd_write": _fd_write, + "proc_exit": _proc_exit, + "segfault": segfault, + "setTempRet0": _setTempRet0, + "strftime": _strftime, + "time": _time +}; + +var asm = createWasm(); + +var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors"); + +var _free = Module["_free"] = createExportWrapper("free"); + +var _main = Module["_main"] = createExportWrapper("main"); + +var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location"); + +var _malloc = Module["_malloc"] = createExportWrapper("malloc"); + +var _sbrk = Module["_sbrk"] = createExportWrapper("sbrk"); + +var ___stdio_exit = Module["___stdio_exit"] = createExportWrapper("__stdio_exit"); + +var ___funcs_on_exit = Module["___funcs_on_exit"] = createExportWrapper("__funcs_on_exit"); + +var ___dl_seterr = Module["___dl_seterr"] = createExportWrapper("__dl_seterr"); + +var _emscripten_get_sbrk_ptr = Module["_emscripten_get_sbrk_ptr"] = createExportWrapper("emscripten_get_sbrk_ptr"); + +var _emscripten_stack_init = Module["_emscripten_stack_init"] = function() { + return (_emscripten_stack_init = Module["_emscripten_stack_init"] = Module["asm"]["emscripten_stack_init"]).apply(null, arguments); +}; + +var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() { + return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); +}; + +var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = function() { + return (_emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); +}; + +var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() { + return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); +}; + +var stackSave = Module["stackSave"] = createExportWrapper("stackSave"); + +var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore"); + +var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc"); + +var dynCall_iiij = Module["dynCall_iiij"] = createExportWrapper("dynCall_iiij"); + +var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji"); + +var dynCall_ji = Module["dynCall_ji"] = createExportWrapper("dynCall_ji"); + +var dynCall_iiiiiijjjiii = Module["dynCall_iiiiiijjjiii"] = createExportWrapper("dynCall_iiiiiijjjiii"); + +var dynCall_iiijiiii = Module["dynCall_iiijiiii"] = createExportWrapper("dynCall_iiijiiii"); + +var dynCall_jj = Module["dynCall_jj"] = createExportWrapper("dynCall_jj"); + +var dynCall_jjj = Module["dynCall_jjj"] = createExportWrapper("dynCall_jjj"); + +var dynCall_viiiiij = Module["dynCall_viiiiij"] = createExportWrapper("dynCall_viiiiij"); + +var dynCall_viiiiji = Module["dynCall_viiiiji"] = createExportWrapper("dynCall_viiiiji"); + +var dynCall_viiiijiij = Module["dynCall_viiiijiij"] = createExportWrapper("dynCall_viiiijiij"); + +var dynCall_viiiij = Module["dynCall_viiiij"] = createExportWrapper("dynCall_viiiij"); + +var dynCall_iij = Module["dynCall_iij"] = createExportWrapper("dynCall_iij"); + +var dynCall_jiij = Module["dynCall_jiij"] = createExportWrapper("dynCall_jiij"); + +var dynCall_iiji = Module["dynCall_iiji"] = createExportWrapper("dynCall_iiji"); + +var dynCall_iiijiijii = Module["dynCall_iiijiijii"] = createExportWrapper("dynCall_iiijiijii"); + +var dynCall_vji = Module["dynCall_vji"] = createExportWrapper("dynCall_vji"); + +var dynCall_iiiijj = Module["dynCall_iiiijj"] = createExportWrapper("dynCall_iiiijj"); + +var dynCall_iiiijiiii = Module["dynCall_iiiijiiii"] = createExportWrapper("dynCall_iiiijiiii"); + +var dynCall_iiiiijiiii = Module["dynCall_iiiiijiiii"] = createExportWrapper("dynCall_iiiiijiiii"); + +var dynCall_ijii = Module["dynCall_ijii"] = createExportWrapper("dynCall_ijii"); + +var dynCall_iiiijiji = Module["dynCall_iiiijiji"] = createExportWrapper("dynCall_iiiijiji"); + +var dynCall_iijjii = Module["dynCall_iijjii"] = createExportWrapper("dynCall_iijjii"); + +var dynCall_jjii = Module["dynCall_jjii"] = createExportWrapper("dynCall_jjii"); + +var dynCall_jiii = Module["dynCall_jiii"] = createExportWrapper("dynCall_jiii"); + +var dynCall_jiiiii = Module["dynCall_jiiiii"] = createExportWrapper("dynCall_jiiiii"); + +var dynCall_iiiiiijiiii = Module["dynCall_iiiiiijiiii"] = createExportWrapper("dynCall_iiiiiijiiii"); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) Module["intArrayFromString"] = (() => abort("'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) Module["intArrayToString"] = (() => abort("'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ccall")) Module["ccall"] = (() => abort("'ccall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) Module["cwrap"] = (() => abort("'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setValue")) Module["setValue"] = (() => abort("'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getValue")) Module["getValue"] = (() => abort("'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocate")) Module["allocate"] = (() => abort("'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) Module["UTF8ArrayToString"] = (() => abort("'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) Module["UTF8ToString"] = (() => abort("'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) Module["stringToUTF8Array"] = (() => abort("'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8")) Module["stringToUTF8"] = (() => abort("'stringToUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF8")) Module["lengthBytesUTF8"] = (() => abort("'lengthBytesUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) Module["addOnPreRun"] = (() => abort("'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) Module["addOnInit"] = (() => abort("'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) Module["addOnPreMain"] = (() => abort("'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) Module["addOnExit"] = (() => abort("'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) Module["addOnPostRun"] = (() => abort("'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) Module["writeStringToMemory"] = (() => abort("'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) Module["writeArrayToMemory"] = (() => abort("'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) Module["writeAsciiToMemory"] = (() => abort("'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["addRunDependency"] = addRunDependency; + +Module["removeRunDependency"] = removeRunDependency; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) Module["FS_createFolder"] = (() => abort("'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) Module["FS_createLink"] = (() => abort("'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) Module["getLEB"] = (() => abort("'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) Module["getFunctionTables"] = (() => abort("'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) Module["alignFunctionTables"] = (() => abort("'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) Module["registerFunctions"] = (() => abort("'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) Module["addFunction"] = (() => abort("'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) Module["removeFunction"] = (() => abort("'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) Module["prettyPrint"] = (() => abort("'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) Module["getCompilerSetting"] = (() => abort("'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "print")) Module["print"] = (() => abort("'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "printErr")) Module["printErr"] = (() => abort("'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) Module["getTempRet0"] = (() => abort("'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) Module["setTempRet0"] = (() => abort("'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callMain")) Module["callMain"] = (() => abort("'callMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "abort")) Module["abort"] = (() => abort("'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) Module["keepRuntimeAlive"] = (() => abort("'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) Module["zeroMemory"] = (() => abort("'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringToNewUTF8"] = (() => abort("'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = (() => abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = (() => abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) Module["withStackSave"] = (() => abort("'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = (() => abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = (() => abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = (() => abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) Module["inetPton4"] = (() => abort("'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) Module["inetNtop4"] = (() => abort("'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) Module["inetPton6"] = (() => abort("'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) Module["inetNtop6"] = (() => abort("'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) Module["readSockaddr"] = (() => abort("'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) Module["writeSockaddr"] = (() => abort("'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "DNS")) Module["DNS"] = (() => abort("'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) Module["getHostByName"] = (() => abort("'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) Module["Protocols"] = (() => abort("'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = (() => abort("'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = (() => abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = (() => abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertFrameToPC")) Module["convertFrameToPC"] = (() => abort("'convertFrameToPC' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = (() => abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "saveInUnwindCache")) Module["saveInUnwindCache"] = (() => abort("'saveInUnwindCache' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertPCtoSourceLocation")) Module["convertPCtoSourceLocation"] = (() => abort("'convertPCtoSourceLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = (() => abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = (() => abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = (() => abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) Module["jstoi_q"] = (() => abort("'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) Module["jstoi_s"] = (() => abort("'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) Module["getExecutableName"] = (() => abort("'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) Module["listenOnce"] = (() => abort("'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) Module["autoResumeAudioContext"] = (() => abort("'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLegacy"] = (() => abort("'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = (() => abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = (() => abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) Module["wasmTableMirror"] = (() => abort("'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) Module["setWasmTableEntry"] = (() => abort("'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) Module["getWasmTableEntry"] = (() => abort("'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "handleException")) Module["handleException"] = (() => abort("'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = (() => abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = (() => abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) Module["callUserCallback"] = (() => abort("'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) Module["maybeExit"] = (() => abort("'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) Module["safeSetTimeout"] = (() => abort("'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) Module["asmjsMangle"] = (() => abort("'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) Module["asyncLoad"] = (() => abort("'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) Module["alignMemory"] = (() => abort("'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) Module["mmapAlloc"] = (() => abort("'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) Module["reallyNegative"] = (() => abort("'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "unSign")) Module["unSign"] = (() => abort("'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reSign")) Module["reSign"] = (() => abort("'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "formatString")) Module["formatString"] = (() => abort("'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH")) Module["PATH"] = (() => abort("'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) Module["PATH_FS"] = (() => abort("'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) Module["SYSCALLS"] = (() => abort("'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) Module["getSocketFromFD"] = (() => abort("'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) Module["getSocketAddress"] = (() => abort("'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) Module["JSEvents"] = (() => abort("'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) Module["registerKeyEventCallback"] = (() => abort("'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) Module["specialHTMLTargets"] = (() => abort("'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) Module["maybeCStringToJsString"] = (() => abort("'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) Module["findEventTarget"] = (() => abort("'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) Module["findCanvasEventTarget"] = (() => abort("'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) Module["getBoundingClientRect"] = (() => abort("'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) Module["fillMouseEventData"] = (() => abort("'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) Module["registerMouseEventCallback"] = (() => abort("'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) Module["registerWheelEventCallback"] = (() => abort("'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) Module["registerUiEventCallback"] = (() => abort("'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) Module["registerFocusEventCallback"] = (() => abort("'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData")) Module["fillDeviceOrientationEventData"] = (() => abort("'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceOrientationEventCallback")) Module["registerDeviceOrientationEventCallback"] = (() => abort("'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) Module["fillDeviceMotionEventData"] = (() => abort("'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceMotionEventCallback")) Module["registerDeviceMotionEventCallback"] = (() => abort("'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) Module["screenOrientation"] = (() => abort("'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData")) Module["fillOrientationChangeEventData"] = (() => abort("'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerOrientationChangeEventCallback")) Module["registerOrientationChangeEventCallback"] = (() => abort("'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData")) Module["fillFullscreenChangeEventData"] = (() => abort("'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFullscreenChangeEventCallback")) Module["registerFullscreenChangeEventCallback"] = (() => abort("'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) Module["registerRestoreOldStyle"] = (() => abort("'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "hideEverythingExceptGivenElement")) Module["hideEverythingExceptGivenElement"] = (() => abort("'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) Module["restoreHiddenElements"] = (() => abort("'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) Module["setLetterbox"] = (() => abort("'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) Module["currentFullscreenStrategy"] = (() => abort("'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) Module["restoreOldWindowedStyle"] = (() => abort("'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "softFullscreenResizeWebGLRenderTarget")) Module["softFullscreenResizeWebGLRenderTarget"] = (() => abort("'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) Module["doRequestFullscreen"] = (() => abort("'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData")) Module["fillPointerlockChangeEventData"] = (() => abort("'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockChangeEventCallback")) Module["registerPointerlockChangeEventCallback"] = (() => abort("'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockErrorEventCallback")) Module["registerPointerlockErrorEventCallback"] = (() => abort("'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) Module["requestPointerLock"] = (() => abort("'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData")) Module["fillVisibilityChangeEventData"] = (() => abort("'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerVisibilityChangeEventCallback")) Module["registerVisibilityChangeEventCallback"] = (() => abort("'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) Module["registerTouchEventCallback"] = (() => abort("'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) Module["fillGamepadEventData"] = (() => abort("'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback")) Module["registerGamepadEventCallback"] = (() => abort("'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBeforeUnloadEventCallback")) Module["registerBeforeUnloadEventCallback"] = (() => abort("'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) Module["fillBatteryEventData"] = (() => abort("'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = (() => abort("'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = (() => abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = (() => abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = (() => abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = (() => abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = (() => abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = (() => abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) Module["getEnvStrings"] = (() => abort("'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) Module["checkWasiClock"] = (() => abort("'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) Module["writeI53ToI64"] = (() => abort("'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) Module["writeI53ToI64Clamped"] = (() => abort("'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) Module["writeI53ToI64Signaling"] = (() => abort("'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) Module["writeI53ToU64Clamped"] = (() => abort("'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) Module["writeI53ToU64Signaling"] = (() => abort("'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53FromI64"] = (() => abort("'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = (() => abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = (() => abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = (() => abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) Module["setImmediateWrapped"] = (() => abort("'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) Module["clearImmediateWrapped"] = (() => abort("'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = (() => abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = (() => abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = (() => abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = (() => abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) Module["ExceptionInfo"] = (() => abort("'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) Module["CatchInfo"] = (() => abort("'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) Module["exception_addRef"] = (() => abort("'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) Module["exception_decRef"] = (() => abort("'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Browser")) Module["Browser"] = (() => abort("'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) Module["funcWrappers"] = (() => abort("'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) Module["setMainLoop"] = (() => abort("'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wget")) Module["wget"] = (() => abort("'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS"] = FS; + +if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) Module["MEMFS"] = (() => abort("'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "TTY")) Module["TTY"] = (() => abort("'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) Module["PIPEFS"] = (() => abort("'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) Module["SOCKFS"] = (() => abort("'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) Module["_setNetworkCallback"] = (() => abort("'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) Module["tempFixedLengthArray"] = (() => abort("'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) Module["miniTempWebGLFloatBuffers"] = (() => abort("'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) Module["heapObjectForWebGLType"] = (() => abort("'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) Module["heapAccessShiftForWebGLHeap"] = (() => abort("'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GL")) Module["GL"] = (() => abort("'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) Module["emscriptenWebGLGet"] = (() => abort("'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize")) Module["computeUnpackAlignedImageSize"] = (() => abort("'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData")) Module["emscriptenWebGLGetTexPixelData"] = (() => abort("'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) Module["emscriptenWebGLGetUniform"] = (() => abort("'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) Module["webglGetUniformLocation"] = (() => abort("'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglPrepareUniformLocationsBeforeFirstUse")) Module["webglPrepareUniformLocationsBeforeFirstUse"] = (() => abort("'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) Module["webglGetLeftBracePos"] = (() => abort("'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib")) Module["emscriptenWebGLGetVertexAttrib"] = (() => abort("'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) Module["writeGLArray"] = (() => abort("'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AL")) Module["AL"] = (() => abort("'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) Module["SDL_unicode"] = (() => abort("'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) Module["SDL_ttfContext"] = (() => abort("'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) Module["SDL_audio"] = (() => abort("'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL")) Module["SDL"] = (() => abort("'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) Module["SDL_gfx"] = (() => abort("'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) Module["GLUT"] = (() => abort("'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "EGL")) Module["EGL"] = (() => abort("'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) Module["GLFW_Window"] = (() => abort("'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) Module["GLFW"] = (() => abort("'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) Module["GLEW"] = (() => abort("'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) Module["IDBStore"] = (() => abort("'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) Module["runAndAbortIfError"] = (() => abort("'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) Module["warnOnce"] = (() => abort("'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) Module["stackSave"] = (() => abort("'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) Module["stackRestore"] = (() => abort("'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) Module["stackAlloc"] = (() => abort("'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) Module["AsciiToString"] = (() => abort("'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) Module["stringToAscii"] = (() => abort("'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) Module["UTF16ToString"] = (() => abort("'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) Module["stringToUTF16"] = (() => abort("'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) Module["lengthBytesUTF16"] = (() => abort("'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) Module["UTF32ToString"] = (() => abort("'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) Module["stringToUTF32"] = (() => abort("'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) Module["lengthBytesUTF32"] = (() => abort("'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) Module["allocateUTF8"] = (() => abort("'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) Module["allocateUTF8OnStack"] = (() => abort("'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["writeStackCookie"] = writeStackCookie; + +Module["checkStackCookie"] = checkStackCookie; + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) Object.defineProperty(Module, "ALLOC_NORMAL", { + configurable: true, + get: function() { + abort("'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) Object.defineProperty(Module, "ALLOC_STACK", { + configurable: true, + get: function() { + abort("'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +var calledRun; + +function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; +} + +var calledMain = false; + +// dependenciesFulfilled = function runCaller() { +// if (!calledRun) run(); +// if (!calledRun) dependenciesFulfilled = runCaller; +// }; + +function callMain(args) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(__ATPRERUN__.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = Module["_main"]; + args = args || []; + var argc = args.length + 1; + var argv = stackAlloc((argc + 1) * 4); + SAFE_HEAP_STORE((argv >> 2) * 4, allocateUTF8OnStack(thisProgram), 4); + for (var i = 1; i < argc; i++) { + SAFE_HEAP_STORE(((argv >> 2) + i) * 4, allocateUTF8OnStack(args[i - 1]), 4); + } + SAFE_HEAP_STORE(((argv >> 2) + argc) * 4, 0, 4); + try { + var ret = entryFunction(argc, argv); + + // console.log(FS.readFile("./out.o")); + exit(ret, true); + return ret; + } catch (e) { + return handleException(e); + } finally { + calledMain = true; + } +} + +function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); +} + +function run(args) { + shouldRunNow = true; +// if (args === undefined) { +// readyPromiseResolve(Module); +// return; +// } + + args = args || arguments_; + if (runDependencies > 0) { + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + return run(args); + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + // at args[2], we have a list of assembly programs to compile + var asm_files = args.pop(); + for (let i = 0; i < asm_files.length; i ++ ){ + FS.writeFile('./'+asm_files[i].name, asm_files[i].code); + args.push('./'+asm_files[i].name); + } + // for(var i = 2; i < args.length; i++) { + // FS.writeFile('./code' + (i - 2) + '.s', args[i]); + // args[i] = 'code' + (i - 2) + '.s'; + // } + // console.log(FS.readdir("./")); + args = ["-o","out.o", ...args /*"-march=rv32imfdv", "-mabi=ilp32d", "code.s"*/]; + preMain(); + // readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + if (shouldRunNow) callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function() { + setTimeout(function() { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + +// readyPromiseResolve(Module); +// return Module.ready; + if (!statecode.codeerror) + return ofile; + else + return errstatus; +} + +Module["run"] = run; + +function exit(status, implicit) { + + if (!statecode.codeerror){ + ofile = FS.readFile("./out.o"); + console.log(ofile); + } + EXITSTATUS = status; + if (keepRuntimeAlive()) { + if (!implicit) { + var msg = "program exited (with status: " + status + "), but keepRuntimeAlive() is set (counter=" + runtimeKeepaliveCounter + ") due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)"; + readyPromiseReject(msg); + err(msg); + } + } else { + exitRuntime(); + } + procExit(status); +} + +function procExit(code) { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +var shouldRunNow = false; + +if (Module["noInitialRun"]) shouldRunNow = false; + +// run(); + + + readyPromiseResolve(Module); + + + return Module.ready +} +); +})(); +export default Module; \ No newline at end of file diff --git a/src/core/assembler/sailAssembler/web/wasm/as-new.wasm b/src/core/assembler/sailAssembler/web/wasm/as-new.wasm new file mode 100755 index 000000000..8968d3122 Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/as-new.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/as-new64.js b/src/core/assembler/sailAssembler/web/wasm/as-new64.js new file mode 100644 index 000000000..952000151 --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/as-new64.js @@ -0,0 +1,4918 @@ +import { statecode } from "../CNAssambler.mjs"; +let ofile = null; +var Module = (() => { + var _scriptName = import.meta.url; + + return ( +async function(moduleArg = {}) { + var moduleRtn; + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(moduleArg) => Promise +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; + +var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined"; + +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (ENVIRONMENT_IS_NODE) { + // When building an ES module `require` is not normally available. + // We need to use `createRequire()` to construct the require()` function. + const {createRequire} = await import("module"); + /** @suppress{duplicate} */ var require = createRequire(import.meta.url); +} + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var readAsync, readBinary; + +if (ENVIRONMENT_IS_NODE) { + if (typeof process == "undefined" || !process.release || process.release.name !== "node") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + var nodeVersion = process.versions.node; + var numericVersion = nodeVersion.split(".").slice(0, 3); + numericVersion = (numericVersion[0] * 1e4) + (numericVersion[1] * 100) + (numericVersion[2].split("-")[0] * 1); + var minVersion = 23e4; + if (numericVersion < 23e4) { + throw new Error("This emscripten-generated code requires node v23.0.0 (detected v" + nodeVersion + ")"); + } + // These modules will usually be used on Node.js. Load them eagerly to avoid + // the complexity of lazy-loading. + var fs = require("fs"); + var nodePath = require("path"); + // EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url, + // since there's no way getting the current absolute path of the module when + // support for that is not available. + if (!import.meta.url.startsWith("data:")) { + scriptDirectory = nodePath.dirname(require("url").fileURLToPath(import.meta.url)) + "/"; + } + // include: node_shell_read.js + readBinary = filename => { + // We need to re-wrap `file://` strings to URLs. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename); + assert(Buffer.isBuffer(ret)); + return ret; + }; + readAsync = async (filename, binary = true) => { + // See the comment in the `readBinary` function. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename, binary ? undefined : "utf8"); + assert(binary ? Buffer.isBuffer(ret) : typeof ret == "string"); + return ret; + }; + // end include: node_shell_read.js + if (!Module["thisProgram"] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, "/"); + } + arguments_ = process.argv.slice(2); + // MODULARIZE will export the module in the proper place outside, we don't need to export here + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if ((typeof process == "object" && typeof require === "function") || typeof window == "object" || typeof WorkerGlobalScope != "undefined") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); +} else // Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (_scriptName) { + scriptDirectory = _scriptName; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } + if (!(typeof window == "object" || typeof WorkerGlobalScope != "undefined")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + // include: web_or_worker_shell_read.js + if (ENVIRONMENT_IS_WORKER) { + readBinary = url => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response)); + }; + } + readAsync = async url => { + // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url. + // See https://github.com/github/fetch/pull/92#issuecomment-140665932 + // Cordova or Electron apps are typically loaded from a file:// url. + // So use XHR on webview if URL is a file URL. + if (isFileURI(url)) { + return new Promise((resolve, reject) => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + // file URLs can return 0 + resolve(xhr.response); + return; + } + reject(xhr.status); + }; + xhr.onerror = reject; + xhr.send(null); + }); + } + var response = await fetch(url, { + credentials: "same-origin" + }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } +} else { + throw new Error("environment detection error"); +} + +var out = Module["print"] || console.log.bind(console); + +var instErrExp = /^\.\/([^:]+):(\d+):\s*Error:\s*(.+)$/; +var errstatus; + +Module["printErr"] = function (message) { + + let asmerror = message.match(instErrExp); + + if (asmerror && !statecode.codeerror){ + console.error(asmerror); + errstatus = {status: "error", msg: asmerror[1] + " at line " + asmerror[2] + ": " + asmerror[3]}; + statecode.codeerror = true; + } else + console.error(message); + +}; + +var err = Module["printErr"] || console.error.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); + +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used. +moduleOverrides = null; + +checkIncomingModuleAPI(); + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. +if (Module["arguments"]) arguments_ = Module["arguments"]; + +legacyModuleProp("arguments", "arguments_"); + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +legacyModuleProp("thisProgram", "thisProgram"); + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// Assertions on removed incoming Module JS APIs. +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +legacyModuleProp("asm", "wasmExports"); + +legacyModuleProp("readAsync", "readAsync"); + +legacyModuleProp("readBinary", "readBinary"); + +legacyModuleProp("setWindowTitle", "setWindowTitle"); + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var FETCHFS = "FETCHFS is no longer included by default; build with -lfetchfs.js"; + +var ICASEFS = "ICASEFS is no longer included by default; build with -licasefs.js"; + +var JSFILEFS = "JSFILEFS is no longer included by default; build with -ljsfilefs.js"; + +var OPFS = "OPFS is no longer included by default; build with -lopfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable."); + +// end include: shell.js +// include: preamble.js +// === Preamble library stuff === +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html +var wasmBinary = Module["wasmBinary"]; + +legacyModuleProp("wasmBinary", "wasmBinary"); + +if (typeof WebAssembly != "object") { + err("no native wasm support detected"); +} + +// Wasm globals +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we +// don't define it at all in release modes. This matches the behaviour of +// MINIMAL_RUNTIME. +// TODO(sbc): Make this the default even without STRICT enabled. +/** @type {function(*, string=)} */ function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +// We used to include malloc/free by default in the past. Show a helpful error in +// builds with assertions. +function _malloc() { + abort("malloc() called but not included in the build - add `_malloc` to EXPORTED_FUNCTIONS"); +} + +function _free() { + // Show a helpful error since we used to include free by default in the past. + abort("free() called but not included in the build - add `_free` to EXPORTED_FUNCTIONS"); +} + +// Memory management +var HEAP, /** @type {!Int8Array} */ HEAP8, /** @type {!Uint8Array} */ HEAPU8, /** @type {!Int16Array} */ HEAP16, /** @type {!Uint16Array} */ HEAPU16, /** @type {!Int32Array} */ HEAP32, /** @type {!Uint32Array} */ HEAPU32, /** @type {!Float32Array} */ HEAPF32, /* BigInt64Array type is not correctly defined in closure +/** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure +/** not-t@type {!BigUint64Array} */ HEAPU64, /** @type {!Float64Array} */ HEAPF64; + +var runtimeInitialized = false; + +var runtimeExited = false; + +/** + * Indicates whether filename is delivered via file protocol (as opposed to http/https) + * @noinline + */ var isFileURI = filename => filename.startsWith("file://"); + +// include: runtime_shared.js +// include: runtime_stack_check.js +// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + // If the stack ends at address zero we write our cookies 4 bytes into the + // stack. This prevents interference with SAFE_HEAP and ASAN which also + // monitor writes to address zero. + if (max == 0) { + max += 4; + } + // The stack grow downwards towards _emscripten_stack_get_end. + // We write cookies to the final two words in the stack and detect if they are + // ever overwritten. + SAFE_HEAP_STORE(((max) / 4) * 4, 34821223, 4); + SAFE_HEAP_STORE((((max) + (4)) / 4) * 4, 2310721022, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + // See writeStackCookie(). + if (max == 0) { + max += 4; + } + var cookie1 = SAFE_HEAP_LOAD(((max) / 4) * 4, 4, 1); + var cookie2 = SAFE_HEAP_LOAD((((max) + (4)) / 4) * 4, 4, 1); + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`); + } +} + +// end include: runtime_stack_check.js +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +// include: runtime_debug.js +// Endianness check +(() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; +})(); + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"); +} + +function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : ""; + abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra); + } + }); + } +} + +function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`); + } +} + +// forcing the filesystem exports a few things by default +function isExportedByForceFilesystem(name) { + return name === "FS_createPath" || name === "FS_createDataFile" || name === "FS_createPreloadedFile" || name === "FS_unlink" || name === "addRunDependency" || // The old FS has some functionality that WasmFS lacks. + name === "FS_createLazyFile" || name === "FS_createDevice" || name === "removeRunDependency"; +} + +/** + * Intercept access to a global symbol. This enables us to give informative + * warnings/errors when folks attempt to use symbols they did not include in + * their build, or no symbols that no longer exist. + */ function hookGlobalSymbolAccess(sym, func) { + if (typeof globalThis != "undefined" && !Object.getOwnPropertyDescriptor(globalThis, sym)) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + } + }); + } +} + +function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); +} + +missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + +missingGlobal("asm", "Please use wasmExports instead"); + +function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + // Can't `abort()` here because it would break code that does runtime + // checks. e.g. `if (typeof SDL === 'undefined')`. + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in + // library.js, which means $name for a JS name with no prefix, or name + // for a JS name like _name. + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + // Any symbol that is not included from the JS library is also (by definition) + // not exported on the Module object. + unexportedRuntimeSymbol(sym); +} + +function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + } + }); + } +} + +// Used by XXXXX_DEBUG settings to output debug messages. +function dbg(...args) { + // TODO(sbc): Make this configurable somehow. Its not always convenient for + // logging to show up as warnings. + console.warn(...args); +} + +// end include: runtime_debug.js +// include: memoryprofiler.js +// end include: memoryprofiler.js +// include: runtime_safe_heap.js +/** @param {number|boolean=} isFloat */ function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + abort(`getSafeHeapType() invalid bytes=${bytes}`); + } +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort(`segmentation fault storing ${bytes} bytes to address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error storing to address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when storing ${bytes} bytes to address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + setValue_safe(dest, value, getSafeHeapType(bytes, isFloat)); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort(`segmentation fault loading ${bytes} bytes from address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error loading from address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when loading ${bytes} bytes from address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue_safe(dest, type); + if (unsigned) ret = unSign(ret, parseInt(type.slice(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort(`Function table mask error: function pointer is ${value} which is masked by ${mask}, the likely cause of this is that the function pointer is being called by the wrong type.`); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +// end include: runtime_safe_heap.js +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); +} + +// end include: runtime_shared.js +assert(!Module["STACK_SIZE"], "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"); + +assert(!Module["INITIAL_MEMORY"], "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"); + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); +} + +function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; +} + +function preMain() { + checkStackCookie(); +} + +function exitRuntime() { + assert(!runtimeExited); + checkStackCookie(); + ___funcs_on_exit(); + // Native atexit() functions + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); +} + +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; + +var dependenciesFulfilled = null; + +// overridden to take different actions when all run dependencies are fulfilled +var runDependencyTracking = {}; + +var runDependencyWatcher = null; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + // Check for missing dependencies every few seconds + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +/** @param {string|number=} what */ function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + ABORT = true; + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + // Suppress closure compiler warning here. Closure compiler's builtin extern + // definition for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +function createExportWrapper(name, nargs) { + return (...args) => { + assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`); + assert(!runtimeExited, `native function \`${name}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled. + assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`); + return f(...args); + }; +} + +var wasmBinaryFile; + +function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("as-new64.wasm"); + } + // Use bundler-friendly `new URL(..., import.meta.url)` pattern; works in browsers too. + return new URL("as-new64.wasm", import.meta.url).href; +} + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; +} + +async function getWasmBinary(binaryFile) { + // If we don't have the binary yet, load it asynchronously using readAsync. + if (!wasmBinary) { + // Fetch the binary using readAsync + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + // Otherwise, getBinarySync should be able to get it synchronously + return getBinarySync(binaryFile); +} + +async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + // Warn on some common problems. + if (isFileURI(wasmBinaryFile)) { + err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`); + } + abort(reason); + } +} + +async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) { + try { + var response = fetch(binaryFile, { + credentials: "same-origin" + }); + var instantiationResult = await WebAssembly.instantiateStreaming(response, imports); + return instantiationResult; + } catch (reason) { + // We expect the most common failure cause to be a bad MIME type for the binary, + // in which case falling back to ArrayBuffer instantiation should work. + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); +} + +function getWasmImports() { + // prepare imports + return { + "env": wasmImports, + "wasi_snapshot_preview1": wasmImports + }; +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +async function createWasm() { + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + wasmTable = wasmExports["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + // wait for the pthread pool (if any) + addRunDependency("wasm-instantiate"); + // Prefer streaming instantiation if available. + // Async compilation can be confusing when an error on the page overwrites Module + // (for example, if the order of elements is wrong, and the one defining Module is + // later), so we save Module and check it later. + var trueModule = Module; + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + return Promise.reject(e); + } +} + +// === Body === +// end include: preamble.js +class ExitStatus { + name="ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } +} + +var callRuntimeCallbacks = callbacks => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } +}; + +var onPostRuns = []; + +var addOnPostRun = cb => onPostRuns.unshift(cb); + +var onPreRuns = []; + +var addOnPreRun = cb => onPreRuns.unshift(cb); + +/** + * @param {number} ptr + * @param {string} type + */ function getValue(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i8": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i16": + return SAFE_HEAP_LOAD(((ptr) / 2) * 2, 2, 0); + + case "i32": + return SAFE_HEAP_LOAD(((ptr) / 4) * 4, 4, 0); + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return SAFE_HEAP_LOAD_D(((ptr) / 4) * 4, 4, 0); + + case "double": + return SAFE_HEAP_LOAD_D(((ptr) / 8) * 8, 8, 0); + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +function getValue_safe(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return HEAP8[ptr]; + + case "i8": + return HEAP8[ptr]; + + case "i16": + return HEAP16[((ptr) / 2)]; + + case "i32": + return HEAP32[((ptr) / 4)]; + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return HEAPF32[((ptr) / 4)]; + + case "double": + return HEAPF64[((ptr) / 8)]; + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +var ptrToString = ptr => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); +}; + +/** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ function setValue(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i16": + SAFE_HEAP_STORE(((ptr) / 2) * 2, value, 2); + break; + + case "i32": + SAFE_HEAP_STORE(((ptr) / 4) * 4, value, 4); + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + SAFE_HEAP_STORE_D(((ptr) / 4) * 4, value, 4); + break; + + case "double": + SAFE_HEAP_STORE_D(((ptr) / 8) * 8, value, 8); + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +function setValue_safe(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + HEAP8[ptr] = value; + break; + + case "i8": + HEAP8[ptr] = value; + break; + + case "i16": + HEAP16[((ptr) / 2)] = value; + break; + + case "i32": + HEAP32[((ptr) / 4)] = value; + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + HEAPF32[((ptr) / 4)] = value; + break; + + case "double": + HEAPF64[((ptr) / 8)] = value; + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +var stackRestore = val => __emscripten_stack_restore(val); + +var stackSave = () => _emscripten_stack_get_current(); + +var unSign = (value, bits) => { + if (value >= 0) { + return value; + } + // Need some trickery, since if bits == 32, we are right at the limit of the + // bits JS uses in bitshifts + return bits <= 32 ? 2 * Math.abs(1 << (bits - 1)) + value : Math.pow(2, bits) + value; +}; + +var warnOnce = text => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = "warning: " + text; + err(text); + } +}; + +var INT53_MAX = 9007199254740992; + +var INT53_MIN = -9007199254740992; + +var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num); + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined; + +/** + * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given + * array that contains uint8 values, returns a copy of that string as a + * Javascript String object. + * heapOrArray is either a regular array, or a JavaScript typed array view. + * @param {number=} idx + * @param {number=} maxBytesToRead + * @return {string} + */ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + // TextDecoder needs to know the byte length in advance, it doesn't stop on + // null terminator by itself. Also, use the length info to avoid running tiny + // strings through TextDecoder, since .subarray() allocates garbage. + // (As a tiny code save trick, compare endPtr against endIdx using a negation, + // so that undefined/NaN means Infinity) + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + // If building with TextDecoder, we have already computed the string length + // above, so test loop end condition against that + while (idx < endPtr) { + // For UTF8 byte structure, see: + // http://en.wikipedia.org/wiki/UTF-8#Description + // https://www.ietf.org/rfc/rfc2279.txt + // https://tools.ietf.org/html/rfc3629 + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; +}; + +/** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index (i.e. maxBytesToRead will not + * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing + * frequent uses of UTF8ToString() with and without maxBytesToRead may throw + * JS JIT optimizations off, so it is worth to consider consistently using one + * @return {string} + */ var UTF8ToString = (ptr, maxBytesToRead) => { + assert(typeof ptr == "number", `UTF8ToString expects a number (got ${typeof ptr})`); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +}; + +function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var wasmTableMirror = []; + +/** @type {WebAssembly.Table} */ var wasmTable; + +var getWasmTableEntry = funcPtr => { + // Function pointers should show up as numbers, even under wasm64, but + // we still have some places where bigint values can flow here. + // https://github.com/emscripten-core/emscripten/issues/18200 + funcPtr = Number(funcPtr); + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + /** @suppress {checkTypes} */ wasmTableMirror[funcPtr] = func = wasmTable.get(BigInt(funcPtr)); + } + /** @suppress {checkTypes} */ assert(wasmTable.get(BigInt(funcPtr)) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; +}; + +function ___call_sighandler(fp, sig) { + fp = bigintToI53Checked(fp); + return getWasmTableEntry(fp)(sig); +} + +var PATH = { + isAbs: path => path.charAt(0) === "/", + splitPath: filename => { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: path => { + var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/"; + // Normalize the path + path = PATH.normalizeArray(path.split("/").filter(p => !!p), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: path => { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + // No dirname whatsoever + return "."; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: path => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r) +}; + +var initRandomFill = () => view => crypto.getRandomValues(view); + +var randomFill = view => { + // Lazily init on the first invocation. + (randomFill = initRandomFill())(view); +}; + +var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? args[i] : FS.cwd(); + // Skip empty and invalid entries + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(p => !!p), !resolvedAbsolute).join("/"); + return ((resolvedAbsolute ? "/" : "") + resolvedPath) || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var FS_stdin_getChar_buffer = []; + +var lengthBytesUTF8 = str => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + var c = str.charCodeAt(i); + // possibly a lead surrogate + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; +}; + +var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert(typeof str === "string", `stringToUTF8Array expects a string (got ${typeof str})`); + // Parameter maxBytesToWrite is not optional. Negative values, 0, null, + // undefined and false each don't write out any bytes. + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + // -1 for string null terminator. + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description + // and https://www.ietf.org/rfc/rfc2279.txt + // and https://tools.ietf.org/html/rfc3629 + var u = str.charCodeAt(i); + // possibly a lead surrogate + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + // Null-terminate the pointer to the buffer. + heap[outIdx] = 0; + return outIdx - startIdx; +}; + +/** @type {function(string, boolean=, number=)} */ var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +}; + +var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + // we will read data by chunks of BUFSIZE + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + // For some reason we must suppress a closure warning here, even though + // fd definitely exists on process.stdin, and is even the proper way to + // get the fd of stdin, + // https://github.com/nodejs/help/issues/2136#issuecomment-523649904 + // This started to happen after moving this logic out of library_tty.js, + // so it is related to the surrounding code in some unclear manner. + /** @suppress {missingProperties} */ var fd = process.stdin.fd; + try { + bytesRead = fs.readSync(fd, buf, 0, BUFSIZE); + } catch (e) { + // Cross-platform differences: on Windows, reading EOF throws an + // exception, but on other OSes, reading EOF returns 0. Uniformize + // behavior by treating the EOF exception to return 0. + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + // Browser. + result = window.prompt("Input: "); + // returns null on cancel + if (result !== null) { + result += "\n"; + } + } else {} + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); +}; + +var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + // typical setting + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + // currently just ignore + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [ 24, 80 ]; + } + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + } + } +}; + +var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); +}; + +var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +}; + +var mmapAlloc = size => { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +}; + +var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity. + // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred + // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size + // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme. + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + // Make sure to not return excess unused bytes. + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + // No need to expand, the storage was already large enough. + // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity. + // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to + // avoid overshooting the allocation cap by a very large margin. + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + // At minimum allocate 256b for each file when expanding. + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + // Allocate new storage. + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + // Fully decommit when requesting a resize to zero. + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + // Allocate new storage. + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of [ "mode", "atime", "mtime", "ctime" ]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + // if we're overwriting a directory at new_name, make sure it's empty. + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = new_dir.mtime = old_node.parent.ctime = old_node.parent.mtime = Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [ ".", "..", ...Object.keys(node.contents) ]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + // The data buffer should be a typed array view + assert(!(buffer instanceof ArrayBuffer)); + // If the buffer is located in main memory (HEAP), and if + // memory can grow, we can't hold on to references of the + // memory buffer, as they may get invalidated. That means we + // need to do copy its contents. + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + // This write is from a typed array to a typed array? + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + // Writing to an already allocated and used subrange of the file? + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + // Appending to an existing file and we need to reallocate, or source data did not come as a typed array. + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + // Use typed array write which is available. + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + // We can't emulate MAP_SHARED when the file is not backed by the + // buffer we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + HEAP8.set(contents, ptr); + } + } + return { + ptr, + allocated + }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + // should we check if bytesWritten and length are the same? + return 0; + } + } +}; + +var asyncLoad = async url => { + var arrayBuffer = await readAsync(url); + assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`); + return new Uint8Array(arrayBuffer); +}; + +var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); +}; + +var preloadPlugins = Module["preloadPlugins"] || []; + +var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + // Ensure plugins are ready. + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach(plugin => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; +}; + +var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + // TODO we should allow people to just pass in a complete filename instead + // of parent and name being that we just join them anyways + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + // might have several active requests for the same fullname + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + onload?.(); + removeRunDependency(dep); + } + if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } +}; + +var FS_modeStringToFlags = str => { + var flagModes = { + "r": 0, + "r+": 2, + "w": 512 | 64 | 1, + "w+": 512 | 64 | 2, + "a": 1024 | 64 | 1, + "a+": 1024 | 64 | 2 + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; +}; + +var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; +}; + +var strError = errno => UTF8ToString(_strerror(errno)); + +var ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name="ErrnoError"; + // We set the `name` property to be able to identify `FS.ErrnoError` + // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. + // - when using PROXYFS, an error can come from an underlying FS + // as different FS objects have their own FS.ErrnoError each, + // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs. + // we'll use the reliable test `err.name == "ErrnoError"` instead + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared={}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return (this.flags & 1024); + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops={}; + stream_ops={}; + readMode=292 | 73; + writeMode=146; + mounted=null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? this.mode |= this.readMode : this.mode &= ~this.readMode; + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode; + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + // split the absolute path + var parts = path.split("/").filter(p => !!p); + // start at the root + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length - 1); + if (islast && opts.parent) { + // stop resolving + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + // if noent_okay is true, suppress a ENOENT in the last component + // and return an object with an undefined node. This is needed for + // resolving symlinks in the path when creating a file. + if ((e?.errno === 44) && islast && opts.noent_okay) { + return { + path: current_path + }; + } + throw e; + } + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { + path: current_path, + node: current + }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + // if we failed to find it in the cache, call into the VFS + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = [ "r", "w", "rw" ][flag & 3]; + if ((flag & 512)) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + // return 0 if any user, group or owner bits are set. + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || (flags & (512 | 64))) { + // TODO: check for O_SEARCH? (== search for dir only) + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: fd => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + // clone it, so we can return an instance of FSStream + stream = Object.assign(new FS.FSStream, stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + } + }, + major: dev => ((dev) >> 8), + minor: dev => ((dev) & 255), + makedev: (ma, mi) => ((ma) << 8 | (mi)), + registerDevice(dev, ops) { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + // sync all mounts + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + // The filesystem was not included, and instead we have an error + // message stored in the variable. + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + // use the absolute path + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type, + opts, + mountpoint, + mounts: [] + }; + // create a root node for the fs + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + // set as a mountpoint + node.mounted = mount; + // add the new mount to the current mount's children + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + // destroy the nodes for this mount, and all its child mounts + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + // no longer a mountpoint + node.mounted = null; + // remove this mount from the child mounts + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { + follow: true + }).node); + }, + statfsStream(stream) { + // We keep a separate statfsStream function because noderawfs overrides + // it. In noderawfs, stream.node is sometimes null. Instead, we need to + // look at stream.path. + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + // NOTE: None of the defaults here are true. We're just returning safe and + // sane values. Currently nodefs and rawfs replace these defaults, + // other file systems leave them alone. + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255 + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + // parents must exist + var lookup, old_dir, new_dir; + // let the errors from non existent directories percolate up + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + // new path should not be an ancestor of the old path + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) { + throw new FS.ErrnoError(10); + } + // if we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + // update old node (we do this here to avoid each backend + // needing to) + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + // According to POSIX, we should map EISDIR to EPERM, but + // we instead do what Linux does (and we must, as we use + // the musl linux libc). + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { + timestamp: Date.now(), + dontFollow + }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { + size: len, + timestamp: Date.now() + }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { + atime, + mtime + }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if ((flags & 64)) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + // noent_okay makes it so that if the final component of the path + // doesn't exist, lookupPath returns `node: undefined`. `path` will be + // updated to point to the target of all symlinks. + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true + }); + node = lookup.node; + path = lookup.path; + } + // perhaps we need to create the node + var created = false; + if ((flags & 64)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 128)) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + // node doesn't exist, try to create it + // Ignore the permission bits here to ensure we can `open` this new + // file below. We use chmod below the apply the permissions once the + // file is open. + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + // if asked only for a directory, then this must be one + if ((flags & 65536) && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + // check permissions, if this is not a file we just created now (it is ok to + // create and write to a file with read-only permissions; it is read-only + // for later use) + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // do truncation if necessary + if ((flags & 512) && !created) { + FS.truncate(node, 0); + } + // we've already handled these, don't pass down to the underlying vfs + flags &= ~(128 | 512 | 131072); + // register the stream with the filesystem + var stream = FS.createStream({ + node, + path: FS.getPath(node), + // we want the absolute path to the node + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }); + // call the new stream's open function + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + // free readdir state + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + // User requests writing to file (prot & PROT_WRITE != 0). + // Checking if we have permissions to write to the file unless + // MAP_PRIVATE flag is set. According to POSIX spec it is possible + // to write to file opened in read-only mode with MAP_PRIVATE flag, + // as all modifications will be visible only in the memory of + // the current process. + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + // create /dev + FS.mkdir("/dev"); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0 + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using err() rather than out() + // so we register a second tty just for it. + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + // setup /dev/[u]random + // use a buffer to avoid overhead of individual crypto calls per byte + var randomBuffer = new Uint8Array(1024), randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the + // name of the stream for fd 6 (see test_unistd_ttyname) + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { + llseek: MEMFS.stream_ops.llseek + }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + }, + id: fd + 1 + }; + ret.parent = ret; + // make it look like a simple root node + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()).filter(([k, v]) => v).map(([k, v]) => k.toString()); + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams(input, output, error) { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + // open default streams for the stdin, stdout and stderr devices + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init(input, output, error) { + assert(!FS.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.initialized = true; + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + // force-flush all streams, so we get musl std streams printed out + _fflush(0); + // close all of our streams + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + // operate from within the context of the symlink's target + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + // make sure we can write to the file + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + // Create a fake device that a set of stream ops to emulate + // the old behavior. + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else { + // Command-line. + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + // Lazy chunked Uint8Array (implements get and length from Uint8Array). + // Actual getting is abstracted away for eventual reuse. + class LazyUint8Array { + lengthKnown=false; + chunks=[]; + // Loaded chunks. Index is the chunk number + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + // Find length + var xhr = new XMLHttpRequest; + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + // Chunk size in bytes + if (!hasByteServing) chunkSize = datalength; + // Function to get a range from the remote URL. + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + // Some hints to the browser that we want binary data. + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(/** @type{Array} */ (xhr.response || [])); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + // including this byte + end = Math.min(end, datalength - 1); + // if datalength-1 is selected, this is the last block + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length + chunkSize = datalength = 1; + // this will force getter(0)/doXHR do download the whole file + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array; + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + // This is a total hack, but I want to get this lazy file code out of the + // core of MEMFS. If we want to keep this lazy file concept I feel it should + // be its own thin LAZYFS proxying calls to MEMFS. + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + // Add a function that defers querying the file size until it is asked the first time. + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + // override each stream op with one that tries to force load the lazy file first + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + // normal array + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + // LazyUint8Array from sync binary XHR + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + // use a custom read function + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + // use a custom mmap function + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { + ptr, + allocated: true + }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath() { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + // relative path + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + SAFE_HEAP_STORE(((buf) / 4) * 4, stat.dev, 4); + SAFE_HEAP_STORE((((buf) + (4)) / 4) * 4, stat.mode, 4); + HEAPU64[(((buf) + (8)) / 8)] = BigInt(stat.nlink); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stat.uid, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stat.gid, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stat.rdev, 4); + HEAP64[(((buf) + (32)) / 8)] = BigInt(stat.size); + SAFE_HEAP_STORE((((buf) + (40)) / 4) * 4, 4096, 4); + SAFE_HEAP_STORE((((buf) + (44)) / 4) * 4, stat.blocks, 4); + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(((buf) + (48)) / 8)] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(((buf) + (56)) / 8)] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (64)) / 8)] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(((buf) + (72)) / 8)] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (80)) / 8)] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(((buf) + (88)) / 8)] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (96)) / 8)] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + SAFE_HEAP_STORE((((buf) + (8)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (56)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stats.blocks, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stats.bfree, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stats.bavail, 4); + SAFE_HEAP_STORE((((buf) + (28)) / 4) * 4, stats.files, 4); + SAFE_HEAP_STORE((((buf) + (32)) / 4) * 4, stats.ffree, 4); + SAFE_HEAP_STORE((((buf) + (36)) / 4) * 4, stats.fsid, 4); + SAFE_HEAP_STORE((((buf) + (64)) / 4) * 4, stats.flags, 4); + // ST_NOSUID + SAFE_HEAP_STORE((((buf) + (48)) / 4) * 4, stats.namelen, 4); + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + // MAP_PRIVATE calls need not to be synced back to underlying fs + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + } +}; + +function ___syscall_chmod(path, mode) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[((SYSCALLS.varargs) / 8)]); + SYSCALLS.varargs += 8; + return ret; +}; + +var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + // the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number. + var ret = SAFE_HEAP_LOAD(((+SYSCALLS.varargs) / 4) * 4, 4, 0); + SYSCALLS.varargs += 4; + return ret; +}; + +function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + // FD_CLOEXEC makes no sense for a single process. + case 3: + return stream.flags; + + case 4: + { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = syscallGetVarargP(); + var offset = 0; + // We're always unlocked. + SAFE_HEAP_STORE((((arg) + (offset)) / 2) * 2, 2, 2); + return 0; + } + + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +}; + +function ___syscall_getcwd(buf, size) { + buf = bigintToI53Checked(buf); + size = bigintToI53Checked(size); + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + { + if (!stream.tty) return -59; + return 0; + } + + case 21505: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, termios.c_iflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (4)) / 4) * 4, termios.c_oflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (8)) / 4) * 4, termios.c_cflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (12)) / 4) * 4, termios.c_lflag || 0, 4); + for (var i = 0; i < 32; i++) { + SAFE_HEAP_STORE((argp + i) + (17), termios.c_cc[i] || 0, 1); + } + return 0; + } + return 0; + } + + case 21510: + case 21511: + case 21512: + { + if (!stream.tty) return -59; + return 0; + } + + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = SAFE_HEAP_LOAD(((argp) / 4) * 4, 4, 0); + var c_oflag = SAFE_HEAP_LOAD((((argp) + (4)) / 4) * 4, 4, 0); + var c_cflag = SAFE_HEAP_LOAD((((argp) + (8)) / 4) * 4, 4, 0); + var c_lflag = SAFE_HEAP_LOAD((((argp) + (12)) / 4) * 4, 4, 0); + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(SAFE_HEAP_LOAD((argp + i) + (17), 1, 0)); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc + }); + } + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + // TODO: in theory we should write to the winsize struct that gets + // passed in, but for now musl doesn't read anything on it + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 2) * 2, winsize[0], 2); + SAFE_HEAP_STORE((((argp) + (2)) / 2) * 2, winsize[1], 2); + } + return 0; + } + + case 21524: + { + // TODO: technically, this ioctl call should change the window size. + // but, since emscripten doesn't have any concept of a terminal window + // yet, we'll just silently throw it away as we do TIOCGWINSZ + if (!stream.tty) return -59; + return 0; + } + + case 21515: + { + if (!stream.tty) return -59; + return 0; + } + + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.lstat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_newfstatat(dirfd, path, buf, flags) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & (~6400); + assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + bufsize = bigintToI53Checked(bufsize); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + // readlink is one of the rare functions that write out a C string, but does never append a null to the output buffer(!) + // stringToUTF8() always appends a null byte, so restore the character under the null byte after the write. + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_unlinkat(dirfd, path, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort("Invalid flags passed to unlinkat"); + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var __abort_js = () => abort("native code called abort()"); + +var runtimeKeepaliveCounter = 0; + +var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; +}; + +var isLeapYear = year => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + +var MONTH_DAYS_LEAP_CUMULATIVE = [ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 ]; + +var MONTH_DAYS_REGULAR_CUMULATIVE = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ]; + +var ydayFromDate = date => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = (leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE); + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + // -1 since it's days since Jan 1 + return yday; +}; + +function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + tmPtr = bigintToI53Checked(tmPtr); + var date = new Date(time * 1e3); + SAFE_HEAP_STORE(((tmPtr) / 4) * 4, date.getSeconds(), 4); + SAFE_HEAP_STORE((((tmPtr) + (4)) / 4) * 4, date.getMinutes(), 4); + SAFE_HEAP_STORE((((tmPtr) + (8)) / 4) * 4, date.getHours(), 4); + SAFE_HEAP_STORE((((tmPtr) + (12)) / 4) * 4, date.getDate(), 4); + SAFE_HEAP_STORE((((tmPtr) + (16)) / 4) * 4, date.getMonth(), 4); + SAFE_HEAP_STORE((((tmPtr) + (20)) / 4) * 4, date.getFullYear() - 1900, 4); + SAFE_HEAP_STORE((((tmPtr) + (24)) / 4) * 4, date.getDay(), 4); + var yday = ydayFromDate(date) | 0; + SAFE_HEAP_STORE((((tmPtr) + (28)) / 4) * 4, yday, 4); + HEAP64[(((tmPtr) + (40)) / 8)] = BigInt(-(date.getTimezoneOffset() * 60)); + // Attention: DST is in December in South, and some regions don't have DST at all. + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE((((tmPtr) + (32)) / 4) * 4, dst, 4); +} + +var timers = {}; + +var handleException = e => { + // Certain exception types we do not treat as errors since they are used for + // internal control flow. + // 1. ExitStatus, which is thrown by exit() + // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others + // that wish to return to JS event loop. + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"); + } + } + quit_(1, e); +}; + +var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + +var _proc_exit = code => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +}; + +/** @suppress {duplicate } */ /** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => { + ofile = FS.readFile("./out.o"); + console.log(ofile); + EXITSTATUS = status; + if (!keepRuntimeAlive()) { + exitRuntime(); + } + // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down + if (keepRuntimeAlive() && !implicit) { + var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + _proc_exit(status); +}; + +var _exit = exitJS; + +var maybeExit = () => { + if (runtimeExited) { + return; + } + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } +}; + +var callUserCallback = func => { + if (runtimeExited || ABORT) { + err("user callback triggered after runtime exited or application aborted. Ignoring."); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } +}; + +var _emscripten_get_now = () => performance.now(); + +var __setitimer_js = (which, timeout_ms) => { + // First, clear any existing timer. + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + // A timeout of zero simply cancels the current timeout so we have nothing + // more to do. + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now())); + }, timeout_ms); + timers[which] = { + id, + timeout_ms + }; + return 0; +}; + +var __tzset_js = function(timezone, daylight, std_name, dst_name) { + timezone = bigintToI53Checked(timezone); + daylight = bigintToI53Checked(daylight); + std_name = bigintToI53Checked(std_name); + dst_name = bigintToI53Checked(dst_name); + // TODO: Use (malleable) environment variables instead of system settings. + var currentYear = (new Date).getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + // Local standard timezone offset. Local standard time is not adjusted for + // daylight savings. This code uses the fact that getTimezoneOffset returns + // a greater value during Standard Time versus Daylight Saving Time (DST). + // Thus it determines the expected output during Standard Time, and it + // compares whether the output of the given date the same (Standard) or less + // (DST). + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + // timezone is specified as seconds west of UTC ("The external variable + // `timezone` shall be set to the difference, in seconds, between + // Coordinated Universal Time (UTC) and local standard time."), the same + // as returned by stdTimezoneOffset. + // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html + HEAPU64[((timezone) / 8)] = BigInt(stdTimezoneOffset * 60); + SAFE_HEAP_STORE(((daylight) / 4) * 4, Number(winterOffset != summerOffset), 4); + var extractZone = timezoneOffset => { + // Why inverse sign? + // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset + var sign = timezoneOffset >= 0 ? "-" : "+"; + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, "0"); + var minutes = String(absOffset % 60).padStart(2, "0"); + return `UTC${sign}${hours}${minutes}`; + }; + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + assert(winterName); + assert(summerName); + assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`); + assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`); + if (summerOffset < winterOffset) { + // Northern hemisphere + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } +}; + +var _emscripten_date_now = () => Date.now(); + +function _emscripten_err(str) { + str = bigintToI53Checked(str); + return err(UTF8ToString(str)); +} + +var getHeapMax = () => 2147483648; + +var growMemory = size => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + // round size grow request up to wasm page size (fixed 64KB per spec) + wasmMemory.grow(BigInt(pages)); + // .grow() takes a delta compared to the previous size + updateMemoryViews(); + return 1; + } catch (e) { + err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`); + } +}; + +function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + // With multithreaded builds, races can happen (another thread might increase the size + // in between), so return a failure, and let the caller retry. + assert(requestedSize > oldSize); + // Memory resize rules: + // 1. Always increase heap size to at least the requested size, rounded up + // to next page multiple. + // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap + // geometrically: increase the heap size according to + // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most + // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB). + // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap + // linearly: increase the heap size by at least + // MEMORY_GROWTH_LINEAR_STEP bytes. + // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by + // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest + // 4. If we were unable to allocate as much memory, it may be due to + // over-eager decision to excessively reserve due to (3) above. + // Hence if an allocation fails, cut down on the amount of excess + // growth, in an attempt to succeed to perform a smaller allocation. + // A limit is set for how much we can grow. We should not exceed that + // (the wasm binary specifies it, so if we tried, we'd fail anyhow). + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`); + return false; + } + // Loop through potential heap size increases. If we attempt a too eager + // reservation that fails, cut down on the attempted size and reserve a + // smaller bump instead. (max 3 times, chosen somewhat arbitrarily) + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + // ensure geometric growth + // but limit overreserving (default to capping at +96MB overgrowth at most) + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`); + return false; +} + +var ENV = {}; + +var getExecutableName = () => thisProgram || "./this.program"; + +var getEnvStrings = () => { + if (!getEnvStrings.strings) { + // Default values. + // Browser language detection #8751 + var lang = ((typeof navigator == "object" && navigator.languages && navigator.languages[0]) || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + // Apply the user-provided values, if any. + for (var x in ENV) { + // x is a key in ENV; if ENV[x] is undefined, that means it was + // explicitly set to be so. We allow user code to do that to + // force variables with default values to remain unset. + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +}; + +var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++, str.charCodeAt(i), 1); + } + // Null-terminate the string + SAFE_HEAP_STORE(buffer, 0, 1); +}; + +var _environ_get = function(__environ, environ_buf) { + __environ = bigintToI53Checked(__environ); + environ_buf = bigintToI53Checked(environ_buf); + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU64[(((__environ) + (i * 8)) / 8)] = BigInt(ptr); + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; +}; + +var _environ_sizes_get = function(penviron_count, penviron_buf_size) { + penviron_count = bigintToI53Checked(penviron_count); + penviron_buf_size = bigintToI53Checked(penviron_buf_size); + var strings = getEnvStrings(); + HEAPU64[((penviron_count) / 8)] = BigInt(strings.length); + var bufSize = 0; + strings.forEach(string => bufSize += string.length + 1); + HEAPU64[((penviron_buf_size) / 8)] = BigInt(bufSize); + return 0; +}; + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + // nothing more to read + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[((newOffset) / 8)] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + // reset readdir state + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + // No more space to write. + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +var stackAlloc = sz => __emscripten_stack_alloc(sz); + +var stringToUTF8OnStack = str => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; +}; + +FS.createPreloadedFile = FS_createPreloadedFile; + +FS.staticInit(); + +function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); +} + +var wasmImports = { + /** @export */ __assert_fail: ___assert_fail, + /** @export */ __call_sighandler: ___call_sighandler, + /** @export */ __syscall_chmod: ___syscall_chmod, + /** @export */ __syscall_fcntl64: ___syscall_fcntl64, + /** @export */ __syscall_fstat64: ___syscall_fstat64, + /** @export */ __syscall_getcwd: ___syscall_getcwd, + /** @export */ __syscall_ioctl: ___syscall_ioctl, + /** @export */ __syscall_lstat64: ___syscall_lstat64, + /** @export */ __syscall_newfstatat: ___syscall_newfstatat, + /** @export */ __syscall_openat: ___syscall_openat, + /** @export */ __syscall_readlinkat: ___syscall_readlinkat, + /** @export */ __syscall_stat64: ___syscall_stat64, + /** @export */ __syscall_unlinkat: ___syscall_unlinkat, + /** @export */ _abort_js: __abort_js, + /** @export */ _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + /** @export */ _localtime_js: __localtime_js, + /** @export */ _setitimer_js: __setitimer_js, + /** @export */ _tzset_js: __tzset_js, + /** @export */ alignfault, + /** @export */ emscripten_date_now: _emscripten_date_now, + /** @export */ emscripten_err: _emscripten_err, + /** @export */ emscripten_resize_heap: _emscripten_resize_heap, + /** @export */ environ_get: _environ_get, + /** @export */ environ_sizes_get: _environ_sizes_get, + /** @export */ exit: _exit, + /** @export */ fd_close: _fd_close, + /** @export */ fd_read: _fd_read, + /** @export */ fd_seek: _fd_seek, + /** @export */ fd_write: _fd_write, + /** @export */ proc_exit: _proc_exit, + /** @export */ segfault +}; + +var wasmExports = await createWasm(); + +var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + +var _main = Module["_main"] = createExportWrapper("__main_argc_argv", 2); + +var _fflush = createExportWrapper("fflush", 1); + +var _sbrk = createExportWrapper("sbrk", 1); + +var _strerror = createExportWrapper("strerror", 1); + +var ___funcs_on_exit = createExportWrapper("__funcs_on_exit", 0); + +var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + +var _emscripten_get_sbrk_ptr = createExportWrapper("emscripten_get_sbrk_ptr", 0); + +var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + +var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + +var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + +var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + +var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + +var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + +var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"]; + +var ___cxa_increment_exception_refcount = createExportWrapper("__cxa_increment_exception_refcount", 1); + +// Argument name here must shadow the `wasmExports` global so +// that it is recognised by metadce and minify-import-export-names +// passes. +function applySignatureConversions(wasmExports) { + // First, make a copy of the incoming exports object + wasmExports = Object.assign({}, wasmExports); + var makeWrapper___PP = f => (a0, a1, a2) => f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper__p = f => a0 => f(BigInt(a0)); + var makeWrapper_pP = f => a0 => Number(f(BigInt(a0 ? a0 : 0))); + var makeWrapper_p_ = f => a0 => Number(f(a0)); + var makeWrapper_p = f => () => Number(f()); + var makeWrapper_pp = f => a0 => Number(f(BigInt(a0))); + wasmExports["__main_argc_argv"] = makeWrapper___PP(wasmExports["__main_argc_argv"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["sbrk"] = makeWrapper_pP(wasmExports["sbrk"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p(wasmExports["emscripten_stack_get_base"]); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p(wasmExports["emscripten_stack_get_end"]); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p(wasmExports["_emscripten_stack_restore"]); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp(wasmExports["_emscripten_stack_alloc"]); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p(wasmExports["emscripten_stack_get_current"]); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p(wasmExports["__cxa_increment_exception_refcount"]); + return wasmExports; +} + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === +Module["run"] = run; + +Module["FS"] = FS; + + +var missingLibrarySymbols = [ "writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "emscriptenLog", "readEmAsmArgs", "jstoi_q", "listenOnce", "autoResumeAudioContext", "getDynCaller", "dynCall", "runtimeKeepalivePush", "runtimeKeepalivePop", "asmjsMangle", "HandleAllocator", "getNativeTypeSize", "addOnInit", "addOnPostCtor", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "getCFunc", "ccall", "cwrap", "uleb128Encode", "sigToWasmTypes", "generateFuncType", "convertJsFunctionToWasm", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "removeFunction", "reallyNegative", "strLen", "reSign", "formatString", "intArrayToString", "AsciiToString", "UTF16ToString", "stringToUTF16", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "battery", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "checkWasiClock", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "ExceptionInfo", "findMatchingCatch", "Browser_asyncPrepareDataCounter", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "FS_unlink", "FS_mkdirTree", "_setNetworkCallback", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "setErrNo", "demangle", "stackTrace" ]; + +missingLibrarySymbols.forEach(missingLibrarySymbol); + +var unexportedSymbols = [ "addRunDependency", "removeRunDependency", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "zeroMemory", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "strError", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "jstoi_s", "getExecutableName", "handleException", "keepRuntimeAlive", "callUserCallback", "maybeExit", "asyncLoad", "alignMemory", "mmapAlloc", "wasmTable", "noExitRuntime", "addOnPreRun", "addOnPostRun", "freeTableIndexes", "functionsInTableMap", "unSign", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "UTF8ToString", "stringToUTF8Array", "stringToUTF8", "lengthBytesUTF8", "intArrayFromString", "stringToAscii", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "getEnvStrings", "doReadv", "doWritev", "initRandomFill", "randomFill", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "uncaughtExceptionCount", "exceptionLast", "exceptionCaught", "Browser", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "isLeapYear", "ydayFromDate", "SYSCALLS", "preloadPlugins", "FS_createPreloadedFile", "FS_modeStringToFlags", "FS_getMode", "FS_stdin_getChar_buffer", "FS_stdin_getChar", "FS_createPath", "FS_createDevice", "FS_readFile", "FS_createDataFile", "FS_createLazyFile", "MEMFS", "TTY", "PIPEFS", "SOCKFS", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr" ]; + +unexportedSymbols.forEach(unexportedRuntimeSymbol); + +var calledRun; + +function callMain(args = []) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(typeof onPreRuns === "undefined" || onPreRuns.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach(arg => { + HEAPU64[((argv_ptr) / 8)] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[((argv_ptr) / 8)] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + ofile = FS.readFile("./out.o"); + console.log(ofile); + // if we're not running an evented main loop, it's time to exit + exitJS(ret, /* implicit = */ true); + return ret; + } catch (e) { + ofile = FS.readFile("./out.o"); + console.log(ofile); + return handleException(e); + } +} + +function stackCheckInit() { + // This is normally called automatically during __wasm_call_ctors but need to + // get these values before even running any of the ctors so we call it redundantly + // here. + _emscripten_stack_init(); + // TODO(sbc): Move writeStackCookie to native to to avoid this. + writeStackCookie(); +} + +function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + dependenciesFulfilled = run; + return; + } + function doRun() { + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + var asm_files = args.pop(); + for (let i = 0; i < asm_files.length; i ++ ){ + FS.writeFile('./'+asm_files[i].name, asm_files[i].code); + args.push('./'+asm_files[i].name); + } + // for(var i = 2; i < args.length; i++) { + // FS.writeFile('./code' + (i - 2) + '.s', args[i]); + // args[i] = 'code' + (i - 2) + '.s'; + // } + args = ["-o","out.o", ...args, /*"-march=rv64imfdv", "-mabi=lp64d", "code.s"*/]; + preMain(); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"] || true; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + return ofile; +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +// run(); + +// end include: postamble.js +// include: postamble_modularize.js +// In MODULARIZE mode we wrap the generated code in a factory function +// and return either the Module itself, or a promise of the module. +// We assign to the `moduleRtn` global here and configure closure to see +// this as and extern so it won't get minified. +moduleRtn = readyPromise; + +// Assertion for attempting to access module properties on the incoming +// moduleArg. In the past we used this object as the prototype of the module +// and assigned properties to it, but now we return a distinct object. This +// keeps the instance private until it is ready (i.e the promise has been +// resolved). +for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`); + } + }); + } +} + + readyPromiseResolve(Module); + return moduleRtn; +} +); +})(); +// (() => { +// // Create a small, never-async wrapper around Module which +// // checks for callers incorrectly using it with `new`. +// var real_Module = Module; +// Module = function(arg) { +// if (new.target) throw new Error("Module() should not be called with `new Module()`"); +// return real_Module(arg); +// } +// })(); +export default Module; diff --git a/src/core/assembler/sailAssembler/web/wasm/as-new64.wasm b/src/core/assembler/sailAssembler/web/wasm/as-new64.wasm new file mode 100755 index 000000000..dcfeb4efa Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/as-new64.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/ld-new.js b/src/core/assembler/sailAssembler/web/wasm/ld-new.js new file mode 100644 index 000000000..46fffe15b --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/ld-new.js @@ -0,0 +1,5899 @@ +let elfile = null; +import { libs_to_load } from "../CNAssambler.mjs"; +var Module = (() => { + var _scriptDir = import.meta.url; + + return ( +function(Module) { + Module = Module || {}; + +var Module = typeof Module != "undefined" ? Module : {}; + +var readyPromiseResolve, readyPromiseReject; + +Module["ready"] = new Promise(function(resolve, reject) { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "_main")) { + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + get: function() { + abort("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + set: function() { + abort("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "___stdio_exit")) { + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + get: function() { + abort("You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + set: function() { + abort("You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized")) { + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + get: function() { + abort("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + set: function() { + abort("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; + +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)"); +} + +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +var read_, readAsync, readBinary, setWindowTitle; + +function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + let toLog = e; + if (e && typeof e == "object" && e.stack) { + toLog = [ e, e.stack ]; + } + err("exiting due to exception: " + toLog); +} + +var fs; + +var nodePath; + +var requireNodeFS; + +if (ENVIRONMENT_IS_NODE) { + if (!(typeof process == "object" && typeof require == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = require("path").dirname(scriptDirectory) + "/"; + } else { + scriptDirectory = __dirname + "/"; + } + requireNodeFS = (() => { + if (!nodePath) { + fs = require("fs"); + nodePath = require("path"); + } + }); + read_ = function shell_read(filename, binary) { + requireNodeFS(); + filename = nodePath["normalize"](filename); + return fs.readFileSync(filename, binary ? undefined : "utf8"); + }; + readBinary = (filename => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + assert(ret.buffer); + return ret; + }); + readAsync = ((filename, onload, onerror) => { + requireNodeFS(); + filename = nodePath["normalize"](filename); + fs.readFile(filename, function(err, data) { + if (err) onerror(err); else onload(data.buffer); + }); + }); + if (process["argv"].length > 1) { + thisProgram = process["argv"][1].replace(/\\/g, "/"); + } + arguments_ = process["argv"].slice(2); + process["on"]("uncaughtException", function(ex) { + if (!(ex instanceof ExitStatus)) { + throw ex; + } + }); + process["on"]("unhandledRejection", function(reason) { + throw reason; + }); + quit_ = ((status, toThrow) => { + if (keepRuntimeAlive()) { + process["exitCode"] = status; + throw toThrow; + } + logExceptionOnExit(toThrow); + process["exit"](status); + }); + Module["inspect"] = function() { + return "[Emscripten Module object]"; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (typeof read != "undefined") { + read_ = function shell_read(f) { + return read(f); + }; + } + readBinary = function readBinary(f) { + let data; + if (typeof readbuffer == "function") { + return new Uint8Array(readbuffer(f)); + } + data = read(f, "binary"); + assert(typeof data == "object"); + return data; + }; + readAsync = function readAsync(f, onload, onerror) { + setTimeout(() => onload(readBinary(f)), 0); + }; + if (typeof scriptArgs != "undefined") { + arguments_ = scriptArgs; + } else if (typeof arguments != "undefined") { + arguments_ = arguments; + } + if (typeof quit == "function") { + quit_ = ((status, toThrow) => { + logExceptionOnExit(toThrow); + quit(status); + }); + } + if (typeof print != "undefined") { + if (typeof console == "undefined") console = {}; + console.log = print; + console.warn = console.error = typeof printErr != "undefined" ? printErr : print; + } +} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } else { + scriptDirectory = ""; + } + if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + read_ = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }); + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }); + } + readAsync = ((url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = (() => { + if (xhr.status == 200 || xhr.status == 0 && xhr.response) { + onload(xhr.response); + return; + } + onerror(); + }); + xhr.onerror = onerror; + xhr.send(null); + }); + } + setWindowTitle = (title => document.title = title); +} else { + throw new Error("environment detection error"); +} + +var out = Module["print"] || console.log.bind(console); + +var err = Module["printErr"] || console.warn.bind(console); + +Object.assign(Module, moduleOverrides); + +moduleOverrides = null; + +if (Module["arguments"]) arguments_ = Module["arguments"]; + +if (!Object.getOwnPropertyDescriptor(Module, "arguments")) { + Object.defineProperty(Module, "arguments", { + configurable: true, + get: function() { + abort("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) { + Object.defineProperty(Module, "thisProgram", { + configurable: true, + get: function() { + abort("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["quit"]) quit_ = Module["quit"]; + +if (!Object.getOwnPropertyDescriptor(Module, "quit")) { + Object.defineProperty(Module, "quit", { + configurable: true, + get: function() { + abort("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed (modify read_ in JS)"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +if (!Object.getOwnPropertyDescriptor(Module, "read")) { + Object.defineProperty(Module, "read", { + configurable: true, + get: function() { + abort("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) { + Object.defineProperty(Module, "readAsync", { + configurable: true, + get: function() { + abort("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) { + Object.defineProperty(Module, "readBinary", { + configurable: true, + get: function() { + abort("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) { + Object.defineProperty(Module, "setWindowTitle", { + configurable: true, + get: function() { + abort("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable."); + +var STACK_ALIGN = 16; + +var POINTER_SIZE = 4; + +function getNativeTypeSize(type) { + switch (type) { + case "i1": + case "i8": + return 1; + + case "i16": + return 2; + + case "i32": + return 4; + + case "i64": + return 8; + + case "float": + return 4; + + case "double": + return 8; + + default: + { + if (type[type.length - 1] === "*") { + return POINTER_SIZE; + } else if (type[0] === "i") { + const bits = Number(type.substr(1)); + assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type); + return bits / 8; + } else { + return 0; + } + } + } +} + +function warnOnce(text) { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } +} + +function convertJsFunctionToWasm(func, sig) { + if (typeof WebAssembly.Function == "function") { + var typeNames = { + "i": "i32", + "j": "i64", + "f": "f32", + "d": "f64" + }; + var type = { + parameters: [], + results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ] + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return new WebAssembly.Function(type, func); + } + var typeSection = [ 1, 0, 1, 96 ]; + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { + "i": 127, + "j": 126, + "f": 125, + "d": 124 + }; + typeSection.push(sigParam.length); + for (var i = 0; i < sigParam.length; ++i) { + typeSection.push(typeCodes[sigParam[i]]); + } + if (sigRet == "v") { + typeSection.push(0); + } else { + typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]); + } + typeSection[1] = typeSection.length - 2; + var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])); + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { + "e": { + "f": func + } + }); + var wrappedFunc = instance.exports["f"]; + return wrappedFunc; +} + +var freeTableIndexes = []; + +var functionsInTableMap; + +function getEmptyTableSlot() { + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; + } + return wasmTable.length - 1; +} + +function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + if (item) { + functionsInTableMap.set(item, i); + } + } +} + +function addFunction(func, sig) { + assert(typeof func != "undefined"); + if (!functionsInTableMap) { + functionsInTableMap = new WeakMap(); + updateTableMap(0, wasmTable.length); + } + if (functionsInTableMap.has(func)) { + return functionsInTableMap.get(func); + } + var ret = getEmptyTableSlot(); + try { + setWasmTableEntry(ret, func); + } catch (err) { + if (!(err instanceof TypeError)) { + throw err; + } + assert(typeof sig != "undefined", "Missing signature argument to addFunction: " + func); + var wrapped = convertJsFunctionToWasm(func, sig); + setWasmTableEntry(ret, wrapped); + } + functionsInTableMap.set(func, ret); + return ret; +} + +function removeFunction(index) { + functionsInTableMap.delete(getWasmTableEntry(index)); + freeTableIndexes.push(index); +} + +var tempRet0 = 0; + +var setTempRet0 = value => { + tempRet0 = value; +}; + +var getTempRet0 = () => tempRet0; + +var wasmBinary; + +if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + +if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) { + Object.defineProperty(Module, "wasmBinary", { + configurable: true, + get: function() { + abort("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) { + Object.defineProperty(Module, "noExitRuntime", { + configurable: true, + get: function() { + abort("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); +} + +function setValue(ptr, value, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + HEAP8[ptr >> 0] = value; + break; + + case "i8": + HEAP8[ptr >> 0] = value; + break; + + case "i16": + HEAP16[ptr >> 1] = value; + break; + + case "i32": + HEAP32[ptr >> 2] = value; + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1]; + break; + + case "float": + HEAPF32[ptr >> 2] = value; + break; + + case "double": + HEAPF64[ptr >> 3] = value; + break; + + default: + abort("invalid type for setValue: " + type); + } + } else { + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i16": + SAFE_HEAP_STORE(ptr | 0, value | 0, 2); + break; + + case "i32": + SAFE_HEAP_STORE(ptr | 0, value | 0, 4); + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(ptr | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(ptr + 4 | 0, tempI64[1] | 0, 4); + break; + + case "float": + SAFE_HEAP_STORE_D(ptr | 0, Math.fround(value), 4); + break; + + case "double": + SAFE_HEAP_STORE_D(ptr | 0, +value, 8); + break; + + default: + abort("invalid type for setValue: " + type); + } + } +} + +function getValue(ptr, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + return HEAP8[ptr >> 0]; + + case "i8": + return HEAP8[ptr >> 0]; + + case "i16": + return HEAP16[ptr >> 1]; + + case "i32": + return HEAP32[ptr >> 2]; + + case "i64": + return HEAP32[ptr >> 2]; + + case "float": + return HEAPF32[ptr >> 2]; + + case "double": + return Number(HEAPF64[ptr >> 3]); + + default: + abort("invalid type for getValue: " + type); + } + } else { + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i8": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i16": + return SAFE_HEAP_LOAD(ptr | 0, 2, 0) | 0; + + case "i32": + return SAFE_HEAP_LOAD(ptr | 0, 4, 0) | 0; + + case "i64": + return SAFE_HEAP_LOAD(ptr | 0, 8, 0) | 0; + + case "float": + return Math.fround(SAFE_HEAP_LOAD_D(ptr | 0, 4, 0)); + + case "double": + return +SAFE_HEAP_LOAD_D(ptr | 0, 8, 0); + + default: + abort("invalid type for getValue: " + type); + } + } + return null; +} + +function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + assert(0); + } +} + +function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort("segmentation fault storing " + bytes + " bytes to address " + dest); + if (dest % bytes !== 0) abort("alignment error storing to address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when storing " + bytes + " bytes to address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort("segmentation fault loading " + bytes + " bytes from address " + dest); + if (dest % bytes !== 0) abort("alignment error loading from address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when loading " + bytes + " bytes from address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue(dest, type, 1); + if (unsigned) ret = unSign(ret, parseInt(type.substr(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort("Function table mask error: function pointer is " + value + " which is masked by " + mask + ", the likely cause of this is that the function pointer is being called by the wrong type."); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +var wasmMemory; + +var ABORT = false; + +var EXITSTATUS; + +function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +function getCFunc(ident) { + var func = Module["_" + ident]; + assert(func, "Cannot call unknown function " + ident + ", make sure it is exported"); + return func; +} + +function ccall(ident, returnType, argTypes, args, opts) { + var toC = { + "string": function(str) { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); + } + return ret; + }, + "array": function(arr) { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + } + }; + function convertReturnValue(ret) { + if (returnType === "string") return UTF8ToString(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func.apply(null, cArgs); + function onDone(ret) { + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + ret = onDone(ret); + return ret; +} + +function cwrap(ident, returnType, argTypes, opts) { + return function() { + return ccall(ident, returnType, argTypes, arguments, opts); + }; +} + +var ALLOC_NORMAL = 0; + +var ALLOC_STACK = 1; + +function allocate(slab, allocator) { + var ret; + assert(typeof allocator == "number", "allocate no longer takes a type argument"); + assert(typeof slab != "number", "allocate no longer takes a number as arg0"); + if (allocator == ALLOC_STACK) { + ret = stackAlloc(slab.length); + } else { + ret = _malloc(slab.length); + } + if (!slab.subarray && !slab.slice) { + slab = new Uint8Array(slab); + } + HEAPU8.set(slab, ret); + return ret; +} + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + +function UTF8ArrayToString(heap, idx, maxBytesToRead) { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { + return UTF8Decoder.decode(heap.subarray(idx, endPtr)); + } else { + var str = ""; + while (idx < endPtr) { + var u0 = heap[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heap[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode((u0 & 31) << 6 | u1); + continue; + } + var u2 = heap[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = (u0 & 15) << 12 | u1 << 6 | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63; + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } + } + } + return str; +} + +function UTF8ToString(ptr, maxBytesToRead) { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +} + +function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | u1 & 1023; + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | u >> 6; + heap[outIdx++] = 128 | u & 63; + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | u >> 12; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | u >> 18; + heap[outIdx++] = 128 | u >> 12 & 63; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } + } + heap[outIdx] = 0; + return outIdx - startIdx; +} + +function stringToUTF8(str, outPtr, maxBytesToWrite) { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +} + +function lengthBytesUTF8(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023; + if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4; + } + return len; +} + +function AsciiToString(ptr) { + var str = ""; + while (1) { + var ch = SAFE_HEAP_LOAD(ptr++ | 0, 1, 1) >>> 0; + if (!ch) return str; + str += String.fromCharCode(ch); + } +} + +function stringToAscii(str, outPtr) { + return writeAsciiToMemory(str, outPtr, false); +} + +var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : undefined; + +function UTF16ToString(ptr, maxBytesToRead) { + assert(ptr % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!"); + var endPtr = ptr; + var idx = endPtr >> 1; + var maxIdx = idx + maxBytesToRead / 2; + while (!(idx >= maxIdx) && SAFE_HEAP_LOAD(idx * 2, 2, 1)) ++idx; + endPtr = idx << 1; + if (endPtr - ptr > 32 && UTF16Decoder) { + return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr)); + } else { + var str = ""; + for (var i = 0; !(i >= maxBytesToRead / 2); ++i) { + var codeUnit = SAFE_HEAP_LOAD(ptr + i * 2 | 0, 2, 0) | 0; + if (codeUnit == 0) break; + str += String.fromCharCode(codeUnit); + } + return str; + } +} + +function stringToUTF16(str, outPtr, maxBytesToWrite) { + assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 2) return 0; + maxBytesToWrite -= 2; + var startPtr = outPtr; + var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length; + for (var i = 0; i < numCharsToWrite; ++i) { + var codeUnit = str.charCodeAt(i); + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 2); + outPtr += 2; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 2); + return outPtr - startPtr; +} + +function lengthBytesUTF16(str) { + return str.length * 2; +} + +function UTF32ToString(ptr, maxBytesToRead) { + assert(ptr % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!"); + var i = 0; + var str = ""; + while (!(i >= maxBytesToRead / 4)) { + var utf32 = SAFE_HEAP_LOAD(ptr + i * 4 | 0, 4, 0) | 0; + if (utf32 == 0) break; + ++i; + if (utf32 >= 65536) { + var ch = utf32 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } else { + str += String.fromCharCode(utf32); + } + } + return str; +} + +function stringToUTF32(str, outPtr, maxBytesToWrite) { + assert(outPtr % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 4) return 0; + var startPtr = outPtr; + var endPtr = startPtr + maxBytesToWrite - 4; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) { + var trailSurrogate = str.charCodeAt(++i); + codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023; + } + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 4); + outPtr += 4; + if (outPtr + 4 > endPtr) break; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 4); + return outPtr - startPtr; +} + +function lengthBytesUTF32(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) ++i; + len += 4; + } + return len; +} + +function allocateUTF8(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function allocateUTF8OnStack(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function writeStringToMemory(string, buffer, dontAddNull) { + warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!"); + var lastChar, end; + if (dontAddNull) { + end = buffer + lengthBytesUTF8(string); + lastChar = SAFE_HEAP_LOAD(end, 1, 0); + } + stringToUTF8(string, buffer, Infinity); + if (dontAddNull) SAFE_HEAP_STORE(end, lastChar, 1); +} + +function writeArrayToMemory(array, buffer) { + assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"); + HEAP8.set(array, buffer); +} + +function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++ | 0, str.charCodeAt(i) | 0, 1); + } + if (!dontAddNull) SAFE_HEAP_STORE(buffer | 0, 0 | 0, 1); +} + +function alignUp(x, multiple) { + if (x % multiple > 0) { + x += multiple - x % multiple; + } + return x; +} + +var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + +function updateGlobalBufferAndViews(buf) { + buffer = buf; + Module["HEAP8"] = HEAP8 = new Int8Array(buf); + Module["HEAP16"] = HEAP16 = new Int16Array(buf); + Module["HEAP32"] = HEAP32 = new Int32Array(buf); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); + Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); + Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); +} + +var TOTAL_STACK = 5242880; + +if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime"); + +var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; + +if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) { + Object.defineProperty(Module, "INITIAL_MEMORY", { + configurable: true, + get: function() { + abort("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"); + +assert(INITIAL_MEMORY == 16777216, "Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically"); + +var wasmTable; + +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + SAFE_HEAP_STORE(max + 4 | 0, 34821223 | 0, 4); + SAFE_HEAP_STORE(max + 8 | 0, 2310721022 | 0, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + var cookie1 = SAFE_HEAP_LOAD(max + 4 | 0, 4, 1) >>> 0; + var cookie2 = SAFE_HEAP_LOAD(max + 8 | 0, 4, 1) >>> 0; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16)); + } +} + +(function() { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"; +})(); + +var __ATPRERUN__ = []; + +var __ATINIT__ = []; + +var __ATMAIN__ = []; + +var __ATEXIT__ = []; + +var __ATPOSTRUN__ = []; + +var runtimeInitialized = false; + +var runtimeExited = false; + +var runtimeKeepaliveCounter = 0; + +function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; +} + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + checkStackCookie(); + assert(!runtimeInitialized); + runtimeInitialized = true; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + PIPEFS.root = FS.mount(PIPEFS, {}, null); + callRuntimeCallbacks(__ATINIT__); +} + +function preMain() { + checkStackCookie(); + callRuntimeCallbacks(__ATMAIN__); +} + +function exitRuntime() { + checkStackCookie(); + ___funcs_on_exit(); + callRuntimeCallbacks(__ATEXIT__); + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnPreMain(cb) { + __ATMAIN__.unshift(cb); +} + +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +var runDependencies = 0; + +var runDependencyWatcher = null; + +var dependenciesFulfilled = null; + +var runDependencyTracking = {}; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + runDependencyWatcher = setInterval(function() { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err("dependency: " + dep); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +Module["preloadedImages"] = {}; + +Module["preloadedAudios"] = {}; + +function abort(what) { + { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + } + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + EXITSTATUS = 1; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; +} + +var dataURIPrefix = "data:application/octet-stream;base64,"; + +function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); +} + +function isFileURI(filename) { + return filename.startsWith("file://"); +} + +function createExportWrapper(name, fixedasm) { + return function() { + var displayName = name; + var asm = fixedasm; + if (!fixedasm) { + asm = Module["asm"]; + } + assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization"); + assert(!runtimeExited, "native function `" + displayName + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)"); + if (!asm[name]) { + assert(asm[name], "exported native function `" + displayName + "` not found"); + } + return asm[name].apply(null, arguments); + }; +} + +var wasmBinaryFile; + +if (Module["locateFile"]) { + wasmBinaryFile = "ld-new.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } +} else { + wasmBinaryFile = new URL("ld-new.wasm", import.meta.url).toString(); +} + +function getBinary(file) { + try { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } else { + throw "both async and sync fetching of the wasm failed"; + } + } catch (err) { + abort(err); + } +} + +function getBinaryPromise() { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function" && !isFileURI(wasmBinaryFile)) { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + if (!response["ok"]) { + throw "failed to load wasm binary file at '" + wasmBinaryFile + "'"; + } + return response["arrayBuffer"](); + }).catch(function() { + return getBinary(wasmBinaryFile); + }); + } else { + if (readAsync) { + return new Promise(function(resolve, reject) { + readAsync(wasmBinaryFile, function(response) { + resolve(new Uint8Array(response)); + }, reject); + }); + } + } + } + return Promise.resolve().then(function() { + return getBinary(wasmBinaryFile); + }); +} + +function createWasm() { + var info = { + "env": asmLibraryArg, + "wasi_snapshot_preview1": asmLibraryArg + }; + function receiveInstance(instance, module) { + var exports = instance.exports; + Module["asm"] = exports; + wasmMemory = Module["asm"]["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateGlobalBufferAndViews(wasmMemory.buffer); + wasmTable = Module["asm"]["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + addOnInit(Module["asm"]["__wasm_call_ctors"]); + removeRunDependency("wasm-instantiate"); + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + receiveInstance(result["instance"]); + } + function instantiateArrayBuffer(receiver) { + return getBinaryPromise().then(function(binary) { + return WebAssembly.instantiate(binary, info); + }).then(function(instance) { + return instance; + }).then(receiver, function(reason) { + err("failed to asynchronously prepare wasm: " + reason); + if (isFileURI(wasmBinaryFile)) { + err("warning: Loading from a file URI (" + wasmBinaryFile + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"); + } + abort(reason); + }); + } + function instantiateAsync() { + if (!wasmBinary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch == "function") { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + var result = WebAssembly.instantiateStreaming(response, info); + return result.then(receiveInstantiationResult, function(reason) { + err("wasm streaming compile failed: " + reason); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(receiveInstantiationResult); + }); + }); + } else { + return instantiateArrayBuffer(receiveInstantiationResult); + } + } + if (Module["instantiateWasm"]) { + try { + var exports = Module["instantiateWasm"](info, receiveInstance); + return exports; + } catch (e) { + err("Module.instantiateWasm callback failed with error: " + e); + return false; + } + } + instantiateAsync().catch(readyPromiseReject); + return {}; +} + +var tempDouble; + +var tempI64; + +var ASM_CONSTS = {}; + +function callRuntimeCallbacks(callbacks) { + while (callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == "function") { + callback(Module); + continue; + } + var func = callback.func; + if (typeof func == "number") { + if (callback.arg === undefined) { + getWasmTableEntry(func)(); + } else { + getWasmTableEntry(func)(callback.arg); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } +} + +function withStackSave(f) { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; +} + +function demangle(func) { + warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"); + return func; +} + +function demangleAll(text) { + var regex = /\b_Z[\w\d_]+/g; + return text.replace(regex, function(x) { + var y = demangle(x); + return x === y ? x : y + " [" + x + "]"; + }); +} + +var wasmTableMirror = []; + +function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; +} + +function handleException(e) { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); +} + +function jsStackTrace() { + var error = new Error(); + if (!error.stack) { + try { + throw new Error(); + } catch (e) { + error = e; + } + if (!error.stack) { + return "(no stack trace available)"; + } + } + return error.stack.toString(); +} + +function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; +} + +function stackTrace() { + var js = jsStackTrace(); + if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"](); + return demangleAll(js); +} + +function unSign(value, bits) { + if (value >= 0) { + return value; + } + return bits <= 32 ? 2 * Math.abs(1 << bits - 1) + value : Math.pow(2, bits) + value; +} + +function ___assert_fail(condition, filename, line, func) { + abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var _emscripten_get_now; + +if (ENVIRONMENT_IS_NODE) { + _emscripten_get_now = (() => { + var t = process["hrtime"](); + return t[0] * 1e3 + t[1] / 1e6; + }); +} else _emscripten_get_now = (() => performance.now()); + +var _emscripten_get_now_is_monotonic = true; + +function setErrNo(value) { + SAFE_HEAP_STORE(___errno_location() | 0, value | 0, 4); + return value; +} + +function _clock_gettime(clk_id, tp) { + var now; + if (clk_id === 0) { + now = Date.now(); + } else if ((clk_id === 1 || clk_id === 4) && _emscripten_get_now_is_monotonic) { + now = _emscripten_get_now(); + } else { + setErrNo(28); + return -1; + } + SAFE_HEAP_STORE(tp | 0, now / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(tp + 4 | 0, now % 1e3 * 1e3 * 1e3 | 0 | 0, 4); + return 0; +} + +function ___clock_gettime(a0, a1) { + return _clock_gettime(a0, a1); +} + +var PATH = { + splitPath: function(filename) { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: function(parts, allowAboveRoot) { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: function(path) { + var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray(path.split("/").filter(function(p) { + return !!p; + }), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: function(path) { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: function(path) { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + extname: function(path) { + return PATH.splitPath(path)[3]; + }, + join: function() { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.join("/")); + }, + join2: function(l, r) { + return PATH.normalize(l + "/" + r); + } +}; + +function getRandomDevice() { + if (typeof crypto == "object" && typeof crypto["getRandomValues"] == "function") { + var randomBuffer = new Uint8Array(1); + return function() { + crypto.getRandomValues(randomBuffer); + return randomBuffer[0]; + }; + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require("crypto"); + return function() { + return crypto_module["randomBytes"](1)[0]; + }; + } catch (e) {} + } + return function() { + abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };"); + }; +} + +var PATH_FS = { + resolve: function() { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(function(p) { + return !!p; + }), !resolvedAbsolute).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: function(from, to) { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var TTY = { + ttys: [], + init: function() {}, + shutdown: function() {}, + register: function(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops: ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + flush: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + read: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char: function(tty) { + if (!tty.input.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + try { + bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE, -1); + } catch (e) { + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } else { + result = null; + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + }, + put_char: function(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + }, + default_tty1_ops: { + put_char: function(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + } +}; + +function zeroMemory(address, size) { + HEAPU8.fill(0, address, address + size); +} + +function alignMemory(size, alignment) { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +} + +function mmapAlloc(size) { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +} + +var MEMFS = { + ops_table: null, + mount: function(mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode: function(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray: function(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage: function(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage: function(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr: function(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr: function(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup: function(parent, name) { + throw FS.genericErrors[44]; + }, + mknod: function(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename: function(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink: function(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir: function(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir: function(node) { + var entries = [ ".", ".." ]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink: function(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink: function(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read: function(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write: function(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek: function(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate: function(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap: function(stream, address, length, position, prot, flags) { + if (address !== 0) { + throw new FS.ErrnoError(28); + } + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { + ptr: ptr, + allocated: allocated + }; + }, + msync: function(stream, buffer, offset, length, mmapFlags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (mmapFlags & 2) { + return 0; + } + var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + } + } +}; + +function asyncLoad(url, onload, onerror, noRunDep) { + var dep = !noRunDep ? getUniqueRunDependency("al " + url) : ""; + readAsync(url, function(arrayBuffer) { + assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).'); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, function(event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }); + if (dep) addRunDependency(dep); +} + +var ERRNO_MESSAGES = { + 0: "Success", + 1: "Arg list too long", + 2: "Permission denied", + 3: "Address already in use", + 4: "Address not available", + 5: "Address family not supported by protocol family", + 6: "No more processes", + 7: "Socket already connected", + 8: "Bad file number", + 9: "Trying to read unreadable message", + 10: "Mount device busy", + 11: "Operation canceled", + 12: "No children", + 13: "Connection aborted", + 14: "Connection refused", + 15: "Connection reset by peer", + 16: "File locking deadlock error", + 17: "Destination address required", + 18: "Math arg out of domain of func", + 19: "Quota exceeded", + 20: "File exists", + 21: "Bad address", + 22: "File too large", + 23: "Host is unreachable", + 24: "Identifier removed", + 25: "Illegal byte sequence", + 26: "Connection already in progress", + 27: "Interrupted system call", + 28: "Invalid argument", + 29: "I/O error", + 30: "Socket is already connected", + 31: "Is a directory", + 32: "Too many symbolic links", + 33: "Too many open files", + 34: "Too many links", + 35: "Message too long", + 36: "Multihop attempted", + 37: "File or path name too long", + 38: "Network interface is not configured", + 39: "Connection reset by network", + 40: "Network is unreachable", + 41: "Too many open files in system", + 42: "No buffer space available", + 43: "No such device", + 44: "No such file or directory", + 45: "Exec format error", + 46: "No record locks available", + 47: "The link has been severed", + 48: "Not enough core", + 49: "No message of desired type", + 50: "Protocol not available", + 51: "No space left on device", + 52: "Function not implemented", + 53: "Socket is not connected", + 54: "Not a directory", + 55: "Directory not empty", + 56: "State not recoverable", + 57: "Socket operation on non-socket", + 59: "Not a typewriter", + 60: "No such device or address", + 61: "Value too large for defined data type", + 62: "Previous owner died", + 63: "Not super-user", + 64: "Broken pipe", + 65: "Protocol error", + 66: "Unknown protocol", + 67: "Protocol wrong type for socket", + 68: "Math result not representable", + 69: "Read only file system", + 70: "Illegal seek", + 71: "No such process", + 72: "Stale file handle", + 73: "Connection timed out", + 74: "Text file busy", + 75: "Cross-device link", + 100: "Device not a stream", + 101: "Bad font file fmt", + 102: "Invalid slot", + 103: "Invalid request code", + 104: "No anode", + 105: "Block device required", + 106: "Channel number out of range", + 107: "Level 3 halted", + 108: "Level 3 reset", + 109: "Link number out of range", + 110: "Protocol driver not attached", + 111: "No CSI structure available", + 112: "Level 2 halted", + 113: "Invalid exchange", + 114: "Invalid request descriptor", + 115: "Exchange full", + 116: "No data (for no delay io)", + 117: "Timer expired", + 118: "Out of streams resources", + 119: "Machine is not on the network", + 120: "Package not installed", + 121: "The object is remote", + 122: "Advertise error", + 123: "Srmount error", + 124: "Communication error on send", + 125: "Cross mount point (not really error)", + 126: "Given log. name not unique", + 127: "f.d. invalid for this operation", + 128: "Remote address changed", + 129: "Can access a needed shared lib", + 130: "Accessing a corrupted shared lib", + 131: ".lib section in a.out corrupted", + 132: "Attempting to link in too many libs", + 133: "Attempting to exec a shared library", + 135: "Streams pipe error", + 136: "Too many users", + 137: "Socket type not supported", + 138: "Not supported", + 139: "Protocol family not supported", + 140: "Can't send after socket shutdown", + 141: "Too many references", + 142: "Host is down", + 148: "No medium (in tape drive)", + 156: "Level 2 not synchronized" +}; + +var ERRNO_CODES = {}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(FS.cwd(), path); + if (!path) return { + path: "", + node: null + }; + var defaults = { + follow_mount: true, + recurse_count: 0 + }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = PATH.normalizeArray(path.split("/").filter(p => !!p), false); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || islast && opts.follow_mount) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { + path: current_path, + node: current + }; + }, + getPath: node => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path; + } + path = path ? node.name + "/" + path : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = (hash << 5) - hash + name.charCodeAt(i) | 0; + } + return (parentid + hash >>> 0) % FS.nameTable.length; + }, + hashAddNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: node => { + FS.hashRemoveNode(node); + }, + isRoot: node => { + return node === node.parent; + }, + isMountpoint: node => { + return !!node.mounted; + }, + isFile: mode => { + return (mode & 61440) === 32768; + }, + isDir: mode => { + return (mode & 61440) === 16384; + }, + isLink: mode => { + return (mode & 61440) === 40960; + }, + isChrdev: mode => { + return (mode & 61440) === 8192; + }, + isBlkdev: mode => { + return (mode & 61440) === 24576; + }, + isFIFO: mode => { + return (mode & 61440) === 4096; + }, + isSocket: mode => { + return (mode & 49152) === 49152; + }, + flagModes: { + "r": 0, + "r+": 2, + "w": 577, + "w+": 578, + "a": 1089, + "a+": 1090 + }, + modeStringToFlags: str => { + var flags = FS.flagModes[str]; + if (typeof flags == "undefined") { + throw new Error("Unknown file open mode: " + str); + } + return flags; + }, + flagsToPermissionString: flag => { + var perms = [ "r", "w", "rw" ][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: dir => { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: (fd_start = 0, fd_end = FS.MAX_OPEN_FDS) => { + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStream: fd => FS.streams[fd], + createStream: (stream, fd_start, fd_end) => { + if (!FS.FSStream) { + FS.FSStream = function() {}; + FS.FSStream.prototype = { + object: { + get: function() { + return this.node; + }, + set: function(val) { + this.node = val; + } + }, + isRead: { + get: function() { + return (this.flags & 2097155) !== 1; + } + }, + isWrite: { + get: function() { + return (this.flags & 2097155) !== 0; + } + }, + isAppend: { + get: function() { + return this.flags & 1024; + } + } + }; + } + stream = Object.assign(new FS.FSStream(), stream); + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: fd => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: stream => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + } + }, + major: dev => dev >> 8, + minor: dev => dev & 255, + makedev: (ma, mi) => ma << 8 | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts: mount => { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err("warning: " + FS.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work"); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [] + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: mountpoint => { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => { + return parent.node_ops.lookup(parent, name); + }, + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: path => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link)); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: path => { + return FS.stat(path, true); + }, + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: mode & 4095 | node.mode & ~4095, + timestamp: Date.now() + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now() + }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now() + }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime) + }); + }, + open: (path, flags, mode, fd_start, fd_end) => { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = mode & 4095 | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072) + }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false + }, fd_start, fd_end); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: stream => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: stream => { + return stream.fd === null; + }, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, address, length, position, prot, flags) => { + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, address, length, position, prot, flags); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream || !stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + munmap: stream => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices: () => { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var random_device = getRandomDevice(); + FS.createDevice("/dev", "random", random_device); + FS.createDevice("/dev", "urandom", random_device); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories: () => { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount: () => { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + } + }; + ret.parent = ret; + return ret; + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams: () => { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")"); + assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")"); + assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")"); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.node = node; + this.setErrno = function(errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + }; + this.setErrno(errno); + this.message = ERRNO_MESSAGES[errno]; + if (this.stack) { + Object.defineProperty(this, "stack", { + value: new Error().stack, + writable: true + }); + this.stack = demangleAll(this.stack); + } + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [ 44 ].forEach(code => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init: (input, output, error) => { + assert(!FS.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + ___stdio_exit(); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + getMode: (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + return null; + } + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: stream => { + stream.seekable = false; + }, + close: stream => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: obj => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = idx / this.chunkSize | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || "", true); + } + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + }, + chunkSize: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + }); + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url: url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + stream_ops.read = ((stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }); + node.stream_ops = stream_ops; + return node; + }, + createPreloadedFile: (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency("cp " + fullname); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + if (onload) onload(); + removeRunDependency(dep); + } + if (Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, byteArray => processData(byteArray), onerror); + } else { + processData(url); + } + }, + indexedDB: () => { + return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + }, + DB_NAME: () => { + return "EM_FS_" + window.location.pathname; + }, + DB_VERSION: 20, + DB_STORE_NAME: "FILE_DATA", + saveFilesToDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = (() => { + out("creating db"); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }); + openRequest.onsuccess = (() => { + var db = openRequest.result; + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readwrite"); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var putRequest = files.put(FS.analyzePath(path).object.contents, path); + putRequest.onsuccess = (() => { + ok++; + if (ok + fail == total) finish(); + }); + putRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + loadFilesFromDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; + openRequest.onsuccess = (() => { + var db = openRequest.result; + try { + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readonly"); + } catch (e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var getRequest = files.get(path); + getRequest.onsuccess = (() => { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true); + ok++; + if (ok + fail == total) finish(); + }); + getRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + absolutePath: () => { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder: () => { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink: () => { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath: () => { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc: () => { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath: () => { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function(dirfd, path, allowEmpty) { + if (path[0] === "/") { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = FS.getStream(dirfd); + if (!dirstream) throw new FS.ErrnoError(8); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function(func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) { + return -54; + } + throw e; + } + SAFE_HEAP_STORE(buf | 0, stat.dev | 0, 4); + SAFE_HEAP_STORE(buf + 4 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 8 | 0, stat.ino | 0, 4); + SAFE_HEAP_STORE(buf + 12 | 0, stat.mode | 0, 4); + SAFE_HEAP_STORE(buf + 16 | 0, stat.nlink | 0, 4); + SAFE_HEAP_STORE(buf + 20 | 0, stat.uid | 0, 4); + SAFE_HEAP_STORE(buf + 24 | 0, stat.gid | 0, 4); + SAFE_HEAP_STORE(buf + 28 | 0, stat.rdev | 0, 4); + SAFE_HEAP_STORE(buf + 32 | 0, 0 | 0, 4); + tempI64 = [ stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 40 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 44 | 0, tempI64[1] | 0, 4); + SAFE_HEAP_STORE(buf + 48 | 0, 4096 | 0, 4); + SAFE_HEAP_STORE(buf + 52 | 0, stat.blocks | 0, 4); + SAFE_HEAP_STORE(buf + 56 | 0, stat.atime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 60 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 64 | 0, stat.mtime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 68 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 72 | 0, stat.ctime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 76 | 0, 0 | 0, 4); + tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 80 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 84 | 0, tempI64[1] | 0, 4); + return 0; + }, + doMsync: function(addr, stream, len, flags, offset) { + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + doMkdir: function(path, mode) { + path = PATH.normalize(path); + if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + }, + doMknod: function(path, mode, dev) { + switch (mode & 61440) { + case 32768: + case 8192: + case 24576: + case 4096: + case 49152: + break; + + default: + return -28; + } + FS.mknod(path, mode, dev); + return 0; + }, + doReadlink: function(path, buf, bufsize) { + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + }, + doAccess: function(path, amode) { + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + }, + doDup: function(path, flags, suggestFD) { + var suggest = FS.getStream(suggestFD); + if (suggest) FS.close(suggest); + return FS.open(path, flags, 0, suggestFD, suggestFD).fd; + }, + doReadv: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + } + return ret; + }, + doWritev: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + } + return ret; + }, + varargs: undefined, + get: function() { + assert(SYSCALLS.varargs != undefined); + SYSCALLS.varargs += 4; + var ret = SAFE_HEAP_LOAD(SYSCALLS.varargs - 4 | 0, 4, 0) | 0; + return ret; + }, + getStr: function(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function(fd) { + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + return stream; + }, + get64: function(low, high) { + if (low >= 0) assert(high === 0); else assert(high === -1); + return low; + } +}; + +function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_dup(fd) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + return FS.open(old.path, old.flags, 0).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_dup3(fd, suggestFD, flags) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + assert(!flags); + if (old.fd === suggestFD) return -28; + return SYSCALLS.doDup(old.path, old.flags, suggestFD); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + assert(flags === 0); + path = SYSCALLS.calculateAt(dirfd, path); + return SYSCALLS.doAccess(path, amode); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.open(stream.path, stream.flags, 0, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + case 3: + return stream.flags; + + case 4: + { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = SYSCALLS.get(); + var offset = 0; + SAFE_HEAP_STORE(arg + offset | 0, 2 | 0, 2); + return 0; + } + + case 6: + case 7: + return 0; + + case 16: + case 8: + return -28; + + case 9: + setErrNo(28); + return -1; + + default: + { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstatat64(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~4352; + assert(!flags, flags); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd); + if (size < cwdLengthInBytes + 1) return -68; + stringToUTF8(cwd, buf, size); + return buf; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getdents64(fd, dirp, count) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (!stream.getdents) { + stream.getdents = FS.readdir(stream.path); + } + var struct_size = 280; + var pos = 0; + var off = FS.llseek(stream, 0, 1); + var idx = Math.floor(off / struct_size); + while (idx < stream.getdents.length && pos + struct_size <= count) { + var id; + var type; + var name = stream.getdents[idx]; + if (name === ".") { + id = stream.node.id; + type = 4; + } else if (name === "..") { + var lookup = FS.lookupPath(stream.path, { + parent: true + }); + id = lookup.node.id; + type = 4; + } else { + var child = FS.lookupNode(stream.node, name); + id = child.id; + type = FS.isChrdev(child.mode) ? 2 : FS.isDir(child.mode) ? 4 : FS.isLink(child.mode) ? 10 : 8; + } + assert(id); + tempI64 = [ id >>> 0, (tempDouble = id, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(dirp + pos | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(dirp + pos + 4 | 0, tempI64[1] | 0, 4); + tempI64 = [ (idx + 1) * struct_size >>> 0, (tempDouble = (idx + 1) * struct_size, + +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(dirp + pos + 8 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(dirp + pos + 12 | 0, tempI64[1] | 0, 4); + SAFE_HEAP_STORE(dirp + pos + 16 | 0, 280 | 0, 2); + SAFE_HEAP_STORE(dirp + pos + 18 | 0, type | 0, 1); + stringToUTF8(name, dirp + pos + 19, 256); + pos += struct_size; + idx += 1; + } + FS.llseek(stream, idx * struct_size, 0); + return pos; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getegid32() { + return 0; +} + +function ___syscall_getgid32() { + return ___syscall_getegid32(); +} + +function ___syscall_getuid32() { + return ___syscall_getegid32(); +} + +function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + case 21505: + { + if (!stream.tty) return -59; + return 0; + } + + case 21510: + case 21511: + case 21512: + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + SAFE_HEAP_STORE(argp | 0, 0 | 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + if (!stream.tty) return -59; + return 0; + } + + case 21524: + { + if (!stream.tty) return -59; + return 0; + } + + default: + abort("bad ioctl syscall " + op); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_open(path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + var pathname = SYSCALLS.getStr(path); + var mode = varargs ? SYSCALLS.get() : 0; + var stream = FS.open(pathname, flags, mode); + return stream.fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +var PIPEFS = { + BUCKET_BUFFER_SIZE: 8192, + mount: function(mount) { + return FS.createNode(null, "/", 16384 | 511, 0); + }, + createPipe: function() { + var pipe = { + buckets: [], + refcnt: 2 + }; + pipe.buckets.push({ + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0 + }); + var rName = PIPEFS.nextname(); + var wName = PIPEFS.nextname(); + var rNode = FS.createNode(PIPEFS.root, rName, 4096, 0); + var wNode = FS.createNode(PIPEFS.root, wName, 4096, 0); + rNode.pipe = pipe; + wNode.pipe = pipe; + var readableStream = FS.createStream({ + path: rName, + node: rNode, + flags: 0, + seekable: false, + stream_ops: PIPEFS.stream_ops + }); + rNode.stream = readableStream; + var writableStream = FS.createStream({ + path: wName, + node: wNode, + flags: 1, + seekable: false, + stream_ops: PIPEFS.stream_ops + }); + wNode.stream = writableStream; + return { + readable_fd: readableStream.fd, + writable_fd: writableStream.fd + }; + }, + stream_ops: { + poll: function(stream) { + var pipe = stream.node.pipe; + if ((stream.flags & 2097155) === 1) { + return 256 | 4; + } else { + if (pipe.buckets.length > 0) { + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + if (bucket.offset - bucket.roffset > 0) { + return 64 | 1; + } + } + } + } + return 0; + }, + ioctl: function(stream, request, varargs) { + return 28; + }, + fsync: function(stream) { + return 28; + }, + read: function(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + var currentLength = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + currentLength += bucket.offset - bucket.roffset; + } + assert(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer)); + var data = buffer.subarray(offset, offset + length); + if (length <= 0) { + return 0; + } + if (currentLength == 0) { + throw new FS.ErrnoError(6); + } + var toRead = Math.min(currentLength, length); + var totalRead = toRead; + var toRemove = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var currBucket = pipe.buckets[i]; + var bucketSize = currBucket.offset - currBucket.roffset; + if (toRead <= bucketSize) { + var tmpSlice = currBucket.buffer.subarray(currBucket.roffset, currBucket.offset); + if (toRead < bucketSize) { + tmpSlice = tmpSlice.subarray(0, toRead); + currBucket.roffset += toRead; + } else { + toRemove++; + } + data.set(tmpSlice); + break; + } else { + var tmpSlice = currBucket.buffer.subarray(currBucket.roffset, currBucket.offset); + data.set(tmpSlice); + data = data.subarray(tmpSlice.byteLength); + toRead -= tmpSlice.byteLength; + toRemove++; + } + } + if (toRemove && toRemove == pipe.buckets.length) { + toRemove--; + pipe.buckets[toRemove].offset = 0; + pipe.buckets[toRemove].roffset = 0; + } + pipe.buckets.splice(0, toRemove); + return totalRead; + }, + write: function(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + assert(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer)); + var data = buffer.subarray(offset, offset + length); + var dataLen = data.byteLength; + if (dataLen <= 0) { + return 0; + } + var currBucket = null; + if (pipe.buckets.length == 0) { + currBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0 + }; + pipe.buckets.push(currBucket); + } else { + currBucket = pipe.buckets[pipe.buckets.length - 1]; + } + assert(currBucket.offset <= PIPEFS.BUCKET_BUFFER_SIZE); + var freeBytesInCurrBuffer = PIPEFS.BUCKET_BUFFER_SIZE - currBucket.offset; + if (freeBytesInCurrBuffer >= dataLen) { + currBucket.buffer.set(data, currBucket.offset); + currBucket.offset += dataLen; + return dataLen; + } else if (freeBytesInCurrBuffer > 0) { + currBucket.buffer.set(data.subarray(0, freeBytesInCurrBuffer), currBucket.offset); + currBucket.offset += freeBytesInCurrBuffer; + data = data.subarray(freeBytesInCurrBuffer, data.byteLength); + } + var numBuckets = data.byteLength / PIPEFS.BUCKET_BUFFER_SIZE | 0; + var remElements = data.byteLength % PIPEFS.BUCKET_BUFFER_SIZE; + for (var i = 0; i < numBuckets; i++) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: PIPEFS.BUCKET_BUFFER_SIZE, + roffset: 0 + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data.subarray(0, PIPEFS.BUCKET_BUFFER_SIZE)); + data = data.subarray(PIPEFS.BUCKET_BUFFER_SIZE, data.byteLength); + } + if (remElements > 0) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: data.byteLength, + roffset: 0 + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data); + } + return dataLen; + }, + close: function(stream) { + var pipe = stream.node.pipe; + pipe.refcnt--; + if (pipe.refcnt === 0) { + pipe.buckets = null; + } + } + }, + nextname: function() { + if (!PIPEFS.nextname.current) { + PIPEFS.nextname.current = 0; + } + return "pipe[" + PIPEFS.nextname.current++ + "]"; + } +}; + +function ___syscall_pipe(fdPtr) { + try { + if (fdPtr == 0) { + throw new FS.ErrnoError(21); + } + var res = PIPEFS.createPipe(); + SAFE_HEAP_STORE(fdPtr | 0, res.readable_fd | 0, 4); + SAFE_HEAP_STORE(fdPtr + 4 | 0, res.writable_fd | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_readlink(path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doReadlink(path, buf, bufsize); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_rmdir(path) { + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_unlink(path) { + try { + path = SYSCALLS.getStr(path); + FS.unlink(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function __dlopen_js(filename, flag) { + abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking"); +} + +function __dlsym_js(handle, symbol) { + abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking"); +} + +function __localtime_js(time, tmPtr) { + var date = new Date((SAFE_HEAP_LOAD(time | 0, 4, 0) | 0) * 1e3); + SAFE_HEAP_STORE(tmPtr | 0, date.getSeconds() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 4 | 0, date.getMinutes() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 8 | 0, date.getHours() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 12 | 0, date.getDate() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 16 | 0, date.getMonth() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 20 | 0, date.getFullYear() - 1900 | 0, 4); + SAFE_HEAP_STORE(tmPtr + 24 | 0, date.getDay() | 0, 4); + var start = new Date(date.getFullYear(), 0, 1); + var yday = (date.getTime() - start.getTime()) / (1e3 * 60 * 60 * 24) | 0; + SAFE_HEAP_STORE(tmPtr + 28 | 0, yday | 0, 4); + SAFE_HEAP_STORE(tmPtr + 36 | 0, -(date.getTimezoneOffset() * 60) | 0, 4); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE(tmPtr + 32 | 0, dst | 0, 4); +} + +function _tzset_impl(timezone, daylight, tzname) { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + SAFE_HEAP_STORE(timezone | 0, stdTimezoneOffset * 60 | 0, 4); + SAFE_HEAP_STORE(daylight | 0, Number(winterOffset != summerOffset) | 0, 4); + function extractZone(date) { + var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return match ? match[1] : "GMT"; + } + var winterName = extractZone(winter); + var summerName = extractZone(summer); + var winterNamePtr = allocateUTF8(winterName); + var summerNamePtr = allocateUTF8(summerName); + if (summerOffset < winterOffset) { + SAFE_HEAP_STORE(tzname | 0, winterNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, summerNamePtr | 0, 4); + } else { + SAFE_HEAP_STORE(tzname | 0, summerNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, winterNamePtr | 0, 4); + } +} + +function __tzset_js(timezone, daylight, tzname) { + if (__tzset_js.called) return; + __tzset_js.called = true; + _tzset_impl(timezone, daylight, tzname); +} + +function _abort() { + abort("native code called abort()"); +} + +function _emscripten_console_error(str) { + assert(typeof str == "number"); + console.error(UTF8ToString(str)); +} + +function _emscripten_memcpy_big(dest, src, num) { + HEAPU8.copyWithin(dest, src, src + num); +} + +function _emscripten_get_heap_max() { + return 2147483648; +} + +function emscripten_realloc_buffer(size) { + try { + wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16); + updateGlobalBufferAndViews(wasmMemory.buffer); + return 1; + } catch (e) { + err("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e); + } +} + +function _emscripten_resize_heap(requestedSize) { + var oldSize = HEAPU8.length; + requestedSize = requestedSize >>> 0; + assert(requestedSize > oldSize); + var maxHeapSize = _emscripten_get_heap_max(); + if (requestedSize > maxHeapSize) { + err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!"); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = emscripten_realloc_buffer(newSize); + if (replacement) { + return true; + } + } + err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!"); + return false; +} + +var ENV = {}; + +function getExecutableName() { + return thisProgram || "./this.program"; +} + +function getEnvStrings() { + if (!getEnvStrings.strings) { + var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(x + "=" + env[x]); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +} + +function _environ_get(__environ, environ_buf) { + var bufSize = 0; + getEnvStrings().forEach(function(string, i) { + var ptr = environ_buf + bufSize; + SAFE_HEAP_STORE(__environ + i * 4 | 0, ptr | 0, 4); + writeAsciiToMemory(string, ptr); + bufSize += string.length + 1; + }); + return 0; +} + +function _environ_sizes_get(penviron_count, penviron_buf_size) { + var strings = getEnvStrings(); + SAFE_HEAP_STORE(penviron_count | 0, strings.length | 0, 4); + var bufSize = 0; + strings.forEach(function(string) { + bufSize += string.length + 1; + }); + SAFE_HEAP_STORE(penviron_buf_size | 0, bufSize | 0, 4); + return 0; +} + +function _exit(status) { + exit(status); +} + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_fdstat_get(fd, pbuf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4; + SAFE_HEAP_STORE(pbuf | 0, type | 0, 1); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) { + try { + assert(!offset_high, "offsets over 2^32 not yet supported"); + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt, offset_low); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var HIGH_OFFSET = 4294967296; + var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0); + var DOUBLE_LIMIT = 9007199254740992; + if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) { + return -61; + } + FS.llseek(stream, offset, whence); + tempI64 = [ stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(newOffset | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(newOffset + 4 | 0, tempI64[1] | 0, 4); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doWritev(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _proc_exit(code) { + procExit(code); +} + +function _setTempRet0(val) { + setTempRet0(val); +} + +function _time(ptr) { + var ret = Date.now() / 1e3 | 0; + if (ptr) { + SAFE_HEAP_STORE(ptr | 0, ret | 0, 4); + } + return ret; +} + +var FSNode = function(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; +}; + +var readMode = 292 | 73; + +var writeMode = 146; + +Object.defineProperties(FSNode.prototype, { + read: { + get: function() { + return (this.mode & readMode) === readMode; + }, + set: function(val) { + val ? this.mode |= readMode : this.mode &= ~readMode; + } + }, + write: { + get: function() { + return (this.mode & writeMode) === writeMode; + }, + set: function(val) { + val ? this.mode |= writeMode : this.mode &= ~writeMode; + } + }, + isFolder: { + get: function() { + return FS.isDir(this.mode); + } + }, + isDevice: { + get: function() { + return FS.isChrdev(this.mode); + } + } +}); + +FS.FSNode = FSNode; + +FS.staticInit(); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var ASSERTIONS = true; + +function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +} + +function intArrayToString(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + var chr = array[i]; + if (chr > 255) { + if (ASSERTIONS) { + assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF."); + } + chr &= 255; + } + ret.push(String.fromCharCode(chr)); + } + return ret.join(""); +} + +var decodeBase64 = typeof atob == "function" ? atob : function(input) { + var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + do { + enc1 = keyStr.indexOf(input.charAt(i++)); + enc2 = keyStr.indexOf(input.charAt(i++)); + enc3 = keyStr.indexOf(input.charAt(i++)); + enc4 = keyStr.indexOf(input.charAt(i++)); + chr1 = enc1 << 2 | enc2 >> 4; + chr2 = (enc2 & 15) << 4 | enc3 >> 2; + chr3 = (enc3 & 3) << 6 | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 !== 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output = output + String.fromCharCode(chr3); + } + } while (i < input.length); + return output; +}; + +function intArrayFromBase64(s) { + if (typeof ENVIRONMENT_IS_NODE == "boolean" && ENVIRONMENT_IS_NODE) { + var buf = Buffer.from(s, "base64"); + return new Uint8Array(buf["buffer"], buf["byteOffset"], buf["byteLength"]); + } + try { + var decoded = decodeBase64(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0; i < decoded.length; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; + } catch (_) { + throw new Error("Converting base64 string to bytes failed."); + } +} + +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} + +var asmLibraryArg = { + "__assert_fail": ___assert_fail, + "__clock_gettime": ___clock_gettime, + "__syscall_chmod": ___syscall_chmod, + "__syscall_dup": ___syscall_dup, + "__syscall_dup3": ___syscall_dup3, + "__syscall_faccessat": ___syscall_faccessat, + "__syscall_fcntl64": ___syscall_fcntl64, + "__syscall_fstat64": ___syscall_fstat64, + "__syscall_fstatat64": ___syscall_fstatat64, + "__syscall_getcwd": ___syscall_getcwd, + "__syscall_getdents64": ___syscall_getdents64, + "__syscall_getgid32": ___syscall_getgid32, + "__syscall_getuid32": ___syscall_getuid32, + "__syscall_ioctl": ___syscall_ioctl, + "__syscall_lstat64": ___syscall_lstat64, + "__syscall_open": ___syscall_open, + "__syscall_pipe": ___syscall_pipe, + "__syscall_readlink": ___syscall_readlink, + "__syscall_rmdir": ___syscall_rmdir, + "__syscall_stat64": ___syscall_stat64, + "__syscall_unlink": ___syscall_unlink, + "_dlopen_js": __dlopen_js, + "_dlsym_js": __dlsym_js, + "_localtime_js": __localtime_js, + "_tzset_js": __tzset_js, + "abort": _abort, + "alignfault": alignfault, + "emscripten_console_error": _emscripten_console_error, + "emscripten_get_now": _emscripten_get_now, + "emscripten_memcpy_big": _emscripten_memcpy_big, + "emscripten_resize_heap": _emscripten_resize_heap, + "environ_get": _environ_get, + "environ_sizes_get": _environ_sizes_get, + "exit": _exit, + "fd_close": _fd_close, + "fd_fdstat_get": _fd_fdstat_get, + "fd_pread": _fd_pread, + "fd_read": _fd_read, + "fd_seek": _fd_seek, + "fd_write": _fd_write, + "proc_exit": _proc_exit, + "segfault": segfault, + "setTempRet0": _setTempRet0, + "time": _time +}; + +var asm = createWasm(); + +var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors"); + +var _malloc = Module["_malloc"] = createExportWrapper("malloc"); + +var _free = Module["_free"] = createExportWrapper("free"); + +var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location"); + +var _main = Module["_main"] = createExportWrapper("main"); + +var _sbrk = Module["_sbrk"] = createExportWrapper("sbrk"); + +var ___stdio_exit = Module["___stdio_exit"] = createExportWrapper("__stdio_exit"); + +var ___funcs_on_exit = Module["___funcs_on_exit"] = createExportWrapper("__funcs_on_exit"); + +var ___dl_seterr = Module["___dl_seterr"] = createExportWrapper("__dl_seterr"); + +var _emscripten_get_sbrk_ptr = Module["_emscripten_get_sbrk_ptr"] = createExportWrapper("emscripten_get_sbrk_ptr"); + +var _emscripten_stack_init = Module["_emscripten_stack_init"] = function() { + return (_emscripten_stack_init = Module["_emscripten_stack_init"] = Module["asm"]["emscripten_stack_init"]).apply(null, arguments); +}; + +var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() { + return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); +}; + +var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = function() { + return (_emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); +}; + +var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() { + return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); +}; + +var stackSave = Module["stackSave"] = createExportWrapper("stackSave"); + +var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore"); + +var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc"); + +var dynCall_iiiiiiji = Module["dynCall_iiiiiiji"] = createExportWrapper("dynCall_iiiiiiji"); + +var dynCall_ji = Module["dynCall_ji"] = createExportWrapper("dynCall_ji"); + +var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji"); + +var dynCall_iiiiiijjjiii = Module["dynCall_iiiiiijjjiii"] = createExportWrapper("dynCall_iiiiiijjjiii"); + +var dynCall_iiijiiii = Module["dynCall_iiijiiii"] = createExportWrapper("dynCall_iiijiiii"); + +var dynCall_iji = Module["dynCall_iji"] = createExportWrapper("dynCall_iji"); + +var dynCall_jj = Module["dynCall_jj"] = createExportWrapper("dynCall_jj"); + +var dynCall_jjj = Module["dynCall_jjj"] = createExportWrapper("dynCall_jjj"); + +var dynCall_viiiiij = Module["dynCall_viiiiij"] = createExportWrapper("dynCall_viiiiij"); + +var dynCall_viiiiji = Module["dynCall_viiiiji"] = createExportWrapper("dynCall_viiiiji"); + +var dynCall_viiiijiij = Module["dynCall_viiiijiij"] = createExportWrapper("dynCall_viiiijiij"); + +var dynCall_viiiij = Module["dynCall_viiiij"] = createExportWrapper("dynCall_viiiij"); + +var dynCall_jiij = Module["dynCall_jiij"] = createExportWrapper("dynCall_jiij"); + +var dynCall_iiji = Module["dynCall_iiji"] = createExportWrapper("dynCall_iiji"); + +var dynCall_iiijiijii = Module["dynCall_iiijiijii"] = createExportWrapper("dynCall_iiijiijii"); + +var dynCall_vji = Module["dynCall_vji"] = createExportWrapper("dynCall_vji"); + +var dynCall_iiiijj = Module["dynCall_iiiijj"] = createExportWrapper("dynCall_iiiijj"); + +var dynCall_iiiijiiii = Module["dynCall_iiiijiiii"] = createExportWrapper("dynCall_iiiijiiii"); + +var dynCall_iiiiijiiii = Module["dynCall_iiiiijiiii"] = createExportWrapper("dynCall_iiiiijiiii"); + +var dynCall_ijii = Module["dynCall_ijii"] = createExportWrapper("dynCall_ijii"); + +var dynCall_iiiijiji = Module["dynCall_iiiijiji"] = createExportWrapper("dynCall_iiiijiji"); + +var dynCall_iijjii = Module["dynCall_iijjii"] = createExportWrapper("dynCall_iijjii"); + +var dynCall_iij = Module["dynCall_iij"] = createExportWrapper("dynCall_iij"); + +var dynCall_jjii = Module["dynCall_jjii"] = createExportWrapper("dynCall_jjii"); + +var dynCall_jiii = Module["dynCall_jiii"] = createExportWrapper("dynCall_jiii"); + +var dynCall_jiiiii = Module["dynCall_jiiiii"] = createExportWrapper("dynCall_jiiiii"); + +var dynCall_iiiiiijiiii = Module["dynCall_iiiiiijiiii"] = createExportWrapper("dynCall_iiiiiijiiii"); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) Module["intArrayFromString"] = (() => abort("'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) Module["intArrayToString"] = (() => abort("'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ccall")) Module["ccall"] = (() => abort("'ccall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) Module["cwrap"] = (() => abort("'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setValue")) Module["setValue"] = (() => abort("'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getValue")) Module["getValue"] = (() => abort("'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocate")) Module["allocate"] = (() => abort("'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) Module["UTF8ArrayToString"] = (() => abort("'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) Module["UTF8ToString"] = (() => abort("'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) Module["stringToUTF8Array"] = (() => abort("'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8")) Module["stringToUTF8"] = (() => abort("'stringToUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF8")) Module["lengthBytesUTF8"] = (() => abort("'lengthBytesUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) Module["addOnPreRun"] = (() => abort("'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) Module["addOnInit"] = (() => abort("'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) Module["addOnPreMain"] = (() => abort("'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) Module["addOnExit"] = (() => abort("'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) Module["addOnPostRun"] = (() => abort("'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) Module["writeStringToMemory"] = (() => abort("'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) Module["writeArrayToMemory"] = (() => abort("'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) Module["writeAsciiToMemory"] = (() => abort("'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["addRunDependency"] = addRunDependency; + +Module["removeRunDependency"] = removeRunDependency; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) Module["FS_createFolder"] = (() => abort("'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) Module["FS_createLink"] = (() => abort("'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) Module["getLEB"] = (() => abort("'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) Module["getFunctionTables"] = (() => abort("'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) Module["alignFunctionTables"] = (() => abort("'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) Module["registerFunctions"] = (() => abort("'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) Module["addFunction"] = (() => abort("'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) Module["removeFunction"] = (() => abort("'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) Module["prettyPrint"] = (() => abort("'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) Module["getCompilerSetting"] = (() => abort("'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "print")) Module["print"] = (() => abort("'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "printErr")) Module["printErr"] = (() => abort("'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) Module["getTempRet0"] = (() => abort("'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) Module["setTempRet0"] = (() => abort("'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callMain")) Module["callMain"] = (() => abort("'callMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "abort")) Module["abort"] = (() => abort("'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) Module["keepRuntimeAlive"] = (() => abort("'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) Module["zeroMemory"] = (() => abort("'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringToNewUTF8"] = (() => abort("'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = (() => abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = (() => abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) Module["withStackSave"] = (() => abort("'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = (() => abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = (() => abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = (() => abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) Module["inetPton4"] = (() => abort("'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) Module["inetNtop4"] = (() => abort("'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) Module["inetPton6"] = (() => abort("'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) Module["inetNtop6"] = (() => abort("'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) Module["readSockaddr"] = (() => abort("'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) Module["writeSockaddr"] = (() => abort("'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "DNS")) Module["DNS"] = (() => abort("'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) Module["getHostByName"] = (() => abort("'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) Module["Protocols"] = (() => abort("'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = (() => abort("'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = (() => abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = (() => abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertFrameToPC")) Module["convertFrameToPC"] = (() => abort("'convertFrameToPC' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = (() => abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "saveInUnwindCache")) Module["saveInUnwindCache"] = (() => abort("'saveInUnwindCache' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertPCtoSourceLocation")) Module["convertPCtoSourceLocation"] = (() => abort("'convertPCtoSourceLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = (() => abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = (() => abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = (() => abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) Module["jstoi_q"] = (() => abort("'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) Module["jstoi_s"] = (() => abort("'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) Module["getExecutableName"] = (() => abort("'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) Module["listenOnce"] = (() => abort("'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) Module["autoResumeAudioContext"] = (() => abort("'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLegacy"] = (() => abort("'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = (() => abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = (() => abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) Module["wasmTableMirror"] = (() => abort("'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) Module["setWasmTableEntry"] = (() => abort("'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) Module["getWasmTableEntry"] = (() => abort("'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "handleException")) Module["handleException"] = (() => abort("'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = (() => abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = (() => abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) Module["callUserCallback"] = (() => abort("'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) Module["maybeExit"] = (() => abort("'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) Module["safeSetTimeout"] = (() => abort("'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) Module["asmjsMangle"] = (() => abort("'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) Module["asyncLoad"] = (() => abort("'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) Module["alignMemory"] = (() => abort("'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) Module["mmapAlloc"] = (() => abort("'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) Module["reallyNegative"] = (() => abort("'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "unSign")) Module["unSign"] = (() => abort("'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reSign")) Module["reSign"] = (() => abort("'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "formatString")) Module["formatString"] = (() => abort("'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH")) Module["PATH"] = (() => abort("'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) Module["PATH_FS"] = (() => abort("'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) Module["SYSCALLS"] = (() => abort("'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) Module["getSocketFromFD"] = (() => abort("'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) Module["getSocketAddress"] = (() => abort("'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) Module["JSEvents"] = (() => abort("'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) Module["registerKeyEventCallback"] = (() => abort("'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) Module["specialHTMLTargets"] = (() => abort("'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) Module["maybeCStringToJsString"] = (() => abort("'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) Module["findEventTarget"] = (() => abort("'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) Module["findCanvasEventTarget"] = (() => abort("'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) Module["getBoundingClientRect"] = (() => abort("'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) Module["fillMouseEventData"] = (() => abort("'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) Module["registerMouseEventCallback"] = (() => abort("'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) Module["registerWheelEventCallback"] = (() => abort("'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) Module["registerUiEventCallback"] = (() => abort("'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) Module["registerFocusEventCallback"] = (() => abort("'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData")) Module["fillDeviceOrientationEventData"] = (() => abort("'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceOrientationEventCallback")) Module["registerDeviceOrientationEventCallback"] = (() => abort("'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) Module["fillDeviceMotionEventData"] = (() => abort("'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceMotionEventCallback")) Module["registerDeviceMotionEventCallback"] = (() => abort("'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) Module["screenOrientation"] = (() => abort("'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData")) Module["fillOrientationChangeEventData"] = (() => abort("'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerOrientationChangeEventCallback")) Module["registerOrientationChangeEventCallback"] = (() => abort("'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData")) Module["fillFullscreenChangeEventData"] = (() => abort("'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFullscreenChangeEventCallback")) Module["registerFullscreenChangeEventCallback"] = (() => abort("'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) Module["registerRestoreOldStyle"] = (() => abort("'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "hideEverythingExceptGivenElement")) Module["hideEverythingExceptGivenElement"] = (() => abort("'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) Module["restoreHiddenElements"] = (() => abort("'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) Module["setLetterbox"] = (() => abort("'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) Module["currentFullscreenStrategy"] = (() => abort("'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) Module["restoreOldWindowedStyle"] = (() => abort("'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "softFullscreenResizeWebGLRenderTarget")) Module["softFullscreenResizeWebGLRenderTarget"] = (() => abort("'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) Module["doRequestFullscreen"] = (() => abort("'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData")) Module["fillPointerlockChangeEventData"] = (() => abort("'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockChangeEventCallback")) Module["registerPointerlockChangeEventCallback"] = (() => abort("'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockErrorEventCallback")) Module["registerPointerlockErrorEventCallback"] = (() => abort("'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) Module["requestPointerLock"] = (() => abort("'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData")) Module["fillVisibilityChangeEventData"] = (() => abort("'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerVisibilityChangeEventCallback")) Module["registerVisibilityChangeEventCallback"] = (() => abort("'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) Module["registerTouchEventCallback"] = (() => abort("'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) Module["fillGamepadEventData"] = (() => abort("'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback")) Module["registerGamepadEventCallback"] = (() => abort("'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBeforeUnloadEventCallback")) Module["registerBeforeUnloadEventCallback"] = (() => abort("'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) Module["fillBatteryEventData"] = (() => abort("'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = (() => abort("'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = (() => abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = (() => abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = (() => abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = (() => abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = (() => abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = (() => abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) Module["getEnvStrings"] = (() => abort("'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) Module["checkWasiClock"] = (() => abort("'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) Module["writeI53ToI64"] = (() => abort("'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) Module["writeI53ToI64Clamped"] = (() => abort("'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) Module["writeI53ToI64Signaling"] = (() => abort("'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) Module["writeI53ToU64Clamped"] = (() => abort("'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) Module["writeI53ToU64Signaling"] = (() => abort("'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53FromI64"] = (() => abort("'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = (() => abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = (() => abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = (() => abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) Module["setImmediateWrapped"] = (() => abort("'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) Module["clearImmediateWrapped"] = (() => abort("'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = (() => abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = (() => abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = (() => abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = (() => abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) Module["ExceptionInfo"] = (() => abort("'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) Module["CatchInfo"] = (() => abort("'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) Module["exception_addRef"] = (() => abort("'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) Module["exception_decRef"] = (() => abort("'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Browser")) Module["Browser"] = (() => abort("'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) Module["funcWrappers"] = (() => abort("'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) Module["setMainLoop"] = (() => abort("'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wget")) Module["wget"] = (() => abort("'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS"] = FS; + +if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) Module["MEMFS"] = (() => abort("'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "TTY")) Module["TTY"] = (() => abort("'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) Module["PIPEFS"] = (() => abort("'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) Module["SOCKFS"] = (() => abort("'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) Module["_setNetworkCallback"] = (() => abort("'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) Module["tempFixedLengthArray"] = (() => abort("'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) Module["miniTempWebGLFloatBuffers"] = (() => abort("'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) Module["heapObjectForWebGLType"] = (() => abort("'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) Module["heapAccessShiftForWebGLHeap"] = (() => abort("'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GL")) Module["GL"] = (() => abort("'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) Module["emscriptenWebGLGet"] = (() => abort("'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize")) Module["computeUnpackAlignedImageSize"] = (() => abort("'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData")) Module["emscriptenWebGLGetTexPixelData"] = (() => abort("'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) Module["emscriptenWebGLGetUniform"] = (() => abort("'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) Module["webglGetUniformLocation"] = (() => abort("'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglPrepareUniformLocationsBeforeFirstUse")) Module["webglPrepareUniformLocationsBeforeFirstUse"] = (() => abort("'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) Module["webglGetLeftBracePos"] = (() => abort("'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib")) Module["emscriptenWebGLGetVertexAttrib"] = (() => abort("'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) Module["writeGLArray"] = (() => abort("'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AL")) Module["AL"] = (() => abort("'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) Module["SDL_unicode"] = (() => abort("'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) Module["SDL_ttfContext"] = (() => abort("'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) Module["SDL_audio"] = (() => abort("'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL")) Module["SDL"] = (() => abort("'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) Module["SDL_gfx"] = (() => abort("'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) Module["GLUT"] = (() => abort("'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "EGL")) Module["EGL"] = (() => abort("'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) Module["GLFW_Window"] = (() => abort("'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) Module["GLFW"] = (() => abort("'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) Module["GLEW"] = (() => abort("'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) Module["IDBStore"] = (() => abort("'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) Module["runAndAbortIfError"] = (() => abort("'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) Module["warnOnce"] = (() => abort("'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) Module["stackSave"] = (() => abort("'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) Module["stackRestore"] = (() => abort("'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) Module["stackAlloc"] = (() => abort("'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) Module["AsciiToString"] = (() => abort("'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) Module["stringToAscii"] = (() => abort("'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) Module["UTF16ToString"] = (() => abort("'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) Module["stringToUTF16"] = (() => abort("'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) Module["lengthBytesUTF16"] = (() => abort("'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) Module["UTF32ToString"] = (() => abort("'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) Module["stringToUTF32"] = (() => abort("'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) Module["lengthBytesUTF32"] = (() => abort("'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) Module["allocateUTF8"] = (() => abort("'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) Module["allocateUTF8OnStack"] = (() => abort("'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["writeStackCookie"] = writeStackCookie; + +Module["checkStackCookie"] = checkStackCookie; + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) Object.defineProperty(Module, "ALLOC_NORMAL", { + configurable: true, + get: function() { + abort("'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) Object.defineProperty(Module, "ALLOC_STACK", { + configurable: true, + get: function() { + abort("'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +var calledRun; + +function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; +} + +var calledMain = false; + +// dependenciesFulfilled = function runCaller() { +// if (!calledRun) run(); +// if (!calledRun) dependenciesFulfilled = runCaller; +// }; + +function callMain(args) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(__ATPRERUN__.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = Module["_main"]; + args = args || []; + var argc = args.length + 1; + var argv = stackAlloc((argc + 1) * 4); + SAFE_HEAP_STORE((argv >> 2) * 4, allocateUTF8OnStack(thisProgram), 4); + for (var i = 1; i < argc; i++) { + SAFE_HEAP_STORE(((argv >> 2) + i) * 4, allocateUTF8OnStack(args[i - 1]), 4); + } + SAFE_HEAP_STORE(((argv >> 2) + argc) * 4, 0, 4); + try { + var ret = entryFunction(argc, argv); + exit(ret, true); + return ret; + } catch (e) { + return handleException(e); + } finally { + calledMain = true; + } +} + +function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); +} + +function run(args) { + shouldRunNow = true; + args = args || arguments_; + if (runDependencies > 0) { + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("./linker.ld", args[0]); + args.shift(); + FS.writeFile("./input.o", args[0]); + args.shift(); + for (let i = 0; i < libs_to_load.length; i++){ + FS.writeFile("./" + libs_to_load[i].name, libs_to_load[i].file); + } + preMain(); + readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + if (shouldRunNow) callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function() { + setTimeout(function() { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); +// FS.readFile("./output.elf"); +return elfile; +} + +Module["run"] = run; + +function exit(status, implicit) { + elfile = FS.readFile("./output.elf"); + console.log(elfile); + EXITSTATUS = status; + if (keepRuntimeAlive()) { + if (!implicit) { + var msg = "program exited (with status: " + status + "), but keepRuntimeAlive() is set (counter=" + runtimeKeepaliveCounter + ") due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)"; + readyPromiseReject(msg); + err(msg); + } + } else { + exitRuntime(); + } + procExit(status); +} + +function procExit(code) { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +var shouldRunNow = false; + +if (Module["noInitialRun"]) shouldRunNow = false; + +// run(); + readyPromiseResolve(Module); + + return Module.ready +} +); +})(); +export default Module; \ No newline at end of file diff --git a/src/core/assembler/sailAssembler/web/wasm/ld-new.wasm b/src/core/assembler/sailAssembler/web/wasm/ld-new.wasm new file mode 100755 index 000000000..1270fd39a Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/ld-new.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/ld-new64.js b/src/core/assembler/sailAssembler/web/wasm/ld-new64.js new file mode 100644 index 000000000..963e1aa96 --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/ld-new64.js @@ -0,0 +1,5299 @@ +let elfile = null; +import { libs_to_load } from "../CNAssambler.mjs"; +var Module = (() => { + var _scriptName = import.meta.url; + + return ( +async function(moduleArg = {}) { + var moduleRtn; + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(moduleArg) => Promise +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; + +var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined"; + +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (ENVIRONMENT_IS_NODE) { + // When building an ES module `require` is not normally available. + // We need to use `createRequire()` to construct the require()` function. + const {createRequire} = await import("module"); + /** @suppress{duplicate} */ var require = createRequire(import.meta.url); +} + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var readAsync, readBinary; + +if (ENVIRONMENT_IS_NODE) { + if (typeof process == "undefined" || !process.release || process.release.name !== "node") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + var nodeVersion = process.versions.node; + var numericVersion = nodeVersion.split(".").slice(0, 3); + numericVersion = (numericVersion[0] * 1e4) + (numericVersion[1] * 100) + (numericVersion[2].split("-")[0] * 1); + var minVersion = 23e4; + if (numericVersion < 23e4) { + throw new Error("This emscripten-generated code requires node v23.0.0 (detected v" + nodeVersion + ")"); + } + // These modules will usually be used on Node.js. Load them eagerly to avoid + // the complexity of lazy-loading. + var fs = require("fs"); + var nodePath = require("path"); + // EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url, + // since there's no way getting the current absolute path of the module when + // support for that is not available. + if (!import.meta.url.startsWith("data:")) { + scriptDirectory = nodePath.dirname(require("url").fileURLToPath(import.meta.url)) + "/"; + } + // include: node_shell_read.js + readBinary = filename => { + // We need to re-wrap `file://` strings to URLs. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename); + assert(Buffer.isBuffer(ret)); + return ret; + }; + readAsync = async (filename, binary = true) => { + // See the comment in the `readBinary` function. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename, binary ? undefined : "utf8"); + assert(binary ? Buffer.isBuffer(ret) : typeof ret == "string"); + return ret; + }; + // end include: node_shell_read.js + if (!Module["thisProgram"] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, "/"); + } + arguments_ = process.argv.slice(2); + // MODULARIZE will export the module in the proper place outside, we don't need to export here + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if ((typeof process == "object" && typeof require === "function") || typeof window == "object" || typeof WorkerGlobalScope != "undefined") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); +} else // Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (_scriptName) { + scriptDirectory = _scriptName; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } + if (!(typeof window == "object" || typeof WorkerGlobalScope != "undefined")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + // include: web_or_worker_shell_read.js + if (ENVIRONMENT_IS_WORKER) { + readBinary = url => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response)); + }; + } + readAsync = async url => { + // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url. + // See https://github.com/github/fetch/pull/92#issuecomment-140665932 + // Cordova or Electron apps are typically loaded from a file:// url. + // So use XHR on webview if URL is a file URL. + if (isFileURI(url)) { + return new Promise((resolve, reject) => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + // file URLs can return 0 + resolve(xhr.response); + return; + } + reject(xhr.status); + }; + xhr.onerror = reject; + xhr.send(null); + }); + } + var response = await fetch(url, { + credentials: "same-origin" + }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } +} else { + throw new Error("environment detection error"); +} + +var out = Module["print"] || console.log.bind(console); + +var err = Module["printErr"] || console.error.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); + +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used. +moduleOverrides = null; + +checkIncomingModuleAPI(); + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. +if (Module["arguments"]) arguments_ = Module["arguments"]; + +legacyModuleProp("arguments", "arguments_"); + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +legacyModuleProp("thisProgram", "thisProgram"); + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// Assertions on removed incoming Module JS APIs. +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +legacyModuleProp("asm", "wasmExports"); + +legacyModuleProp("readAsync", "readAsync"); + +legacyModuleProp("readBinary", "readBinary"); + +legacyModuleProp("setWindowTitle", "setWindowTitle"); + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var FETCHFS = "FETCHFS is no longer included by default; build with -lfetchfs.js"; + +var ICASEFS = "ICASEFS is no longer included by default; build with -licasefs.js"; + +var JSFILEFS = "JSFILEFS is no longer included by default; build with -ljsfilefs.js"; + +var OPFS = "OPFS is no longer included by default; build with -lopfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable."); + +// end include: shell.js +// include: preamble.js +// === Preamble library stuff === +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html +var wasmBinary = Module["wasmBinary"]; + +legacyModuleProp("wasmBinary", "wasmBinary"); + +if (typeof WebAssembly != "object") { + err("no native wasm support detected"); +} + +// Wasm globals +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we +// don't define it at all in release modes. This matches the behaviour of +// MINIMAL_RUNTIME. +// TODO(sbc): Make this the default even without STRICT enabled. +/** @type {function(*, string=)} */ function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +// We used to include malloc/free by default in the past. Show a helpful error in +// builds with assertions. +function _malloc() { + abort("malloc() called but not included in the build - add `_malloc` to EXPORTED_FUNCTIONS"); +} + +function _free() { + // Show a helpful error since we used to include free by default in the past. + abort("free() called but not included in the build - add `_free` to EXPORTED_FUNCTIONS"); +} + +// Memory management +var HEAP, /** @type {!Int8Array} */ HEAP8, /** @type {!Uint8Array} */ HEAPU8, /** @type {!Int16Array} */ HEAP16, /** @type {!Uint16Array} */ HEAPU16, /** @type {!Int32Array} */ HEAP32, /** @type {!Uint32Array} */ HEAPU32, /** @type {!Float32Array} */ HEAPF32, /* BigInt64Array type is not correctly defined in closure +/** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure +/** not-t@type {!BigUint64Array} */ HEAPU64, /** @type {!Float64Array} */ HEAPF64; + +var runtimeInitialized = false; + +var runtimeExited = false; + +/** + * Indicates whether filename is delivered via file protocol (as opposed to http/https) + * @noinline + */ var isFileURI = filename => filename.startsWith("file://"); + +// include: runtime_shared.js +// include: runtime_stack_check.js +// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + // If the stack ends at address zero we write our cookies 4 bytes into the + // stack. This prevents interference with SAFE_HEAP and ASAN which also + // monitor writes to address zero. + if (max == 0) { + max += 4; + } + // The stack grow downwards towards _emscripten_stack_get_end. + // We write cookies to the final two words in the stack and detect if they are + // ever overwritten. + SAFE_HEAP_STORE(((max) / 4) * 4, 34821223, 4); + SAFE_HEAP_STORE((((max) + (4)) / 4) * 4, 2310721022, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + // See writeStackCookie(). + if (max == 0) { + max += 4; + } + var cookie1 = SAFE_HEAP_LOAD(((max) / 4) * 4, 4, 1); + var cookie2 = SAFE_HEAP_LOAD((((max) + (4)) / 4) * 4, 4, 1); + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`); + } +} + +// end include: runtime_stack_check.js +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +// include: runtime_debug.js +// Endianness check +(() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; +})(); + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"); +} + +function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : ""; + abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra); + } + }); + } +} + +function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`); + } +} + +// forcing the filesystem exports a few things by default +function isExportedByForceFilesystem(name) { + return name === "FS_createPath" || name === "FS_createDataFile" || name === "FS_createPreloadedFile" || name === "FS_unlink" || name === "addRunDependency" || // The old FS has some functionality that WasmFS lacks. + name === "FS_createLazyFile" || name === "FS_createDevice" || name === "removeRunDependency"; +} + +/** + * Intercept access to a global symbol. This enables us to give informative + * warnings/errors when folks attempt to use symbols they did not include in + * their build, or no symbols that no longer exist. + */ function hookGlobalSymbolAccess(sym, func) { + if (typeof globalThis != "undefined" && !Object.getOwnPropertyDescriptor(globalThis, sym)) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + } + }); + } +} + +function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); +} + +missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + +missingGlobal("asm", "Please use wasmExports instead"); + +function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + // Can't `abort()` here because it would break code that does runtime + // checks. e.g. `if (typeof SDL === 'undefined')`. + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in + // library.js, which means $name for a JS name with no prefix, or name + // for a JS name like _name. + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + // Any symbol that is not included from the JS library is also (by definition) + // not exported on the Module object. + unexportedRuntimeSymbol(sym); +} + +function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + } + }); + } +} + +// Used by XXXXX_DEBUG settings to output debug messages. +function dbg(...args) { + // TODO(sbc): Make this configurable somehow. Its not always convenient for + // logging to show up as warnings. + console.warn(...args); +} + +// end include: runtime_debug.js +// include: memoryprofiler.js +// end include: memoryprofiler.js +// include: runtime_safe_heap.js +/** @param {number|boolean=} isFloat */ function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + abort(`getSafeHeapType() invalid bytes=${bytes}`); + } +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort(`segmentation fault storing ${bytes} bytes to address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error storing to address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when storing ${bytes} bytes to address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + setValue_safe(dest, value, getSafeHeapType(bytes, isFloat)); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort(`segmentation fault loading ${bytes} bytes from address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error loading from address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when loading ${bytes} bytes from address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue_safe(dest, type); + if (unsigned) ret = unSign(ret, parseInt(type.slice(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort(`Function table mask error: function pointer is ${value} which is masked by ${mask}, the likely cause of this is that the function pointer is being called by the wrong type.`); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +// end include: runtime_safe_heap.js +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); +} + +// end include: runtime_shared.js +assert(!Module["STACK_SIZE"], "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"); + +assert(!Module["INITIAL_MEMORY"], "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"); + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); +} + +function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + PIPEFS.root = FS.mount(PIPEFS, {}, null); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; +} + +function preMain() { + checkStackCookie(); +} + +function exitRuntime() { + assert(!runtimeExited); + checkStackCookie(); + ___funcs_on_exit(); + // Native atexit() functions + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); +} + +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; + +var dependenciesFulfilled = null; + +// overridden to take different actions when all run dependencies are fulfilled +var runDependencyTracking = {}; + +var runDependencyWatcher = null; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + // Check for missing dependencies every few seconds + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +/** @param {string|number=} what */ function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + ABORT = true; + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + // Suppress closure compiler warning here. Closure compiler's builtin extern + // definition for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +function createExportWrapper(name, nargs) { + return (...args) => { + assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`); + assert(!runtimeExited, `native function \`${name}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled. + assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`); + return f(...args); + }; +} + +var wasmBinaryFile; + +function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("ld-new64.wasm"); + } + // Use bundler-friendly `new URL(..., import.meta.url)` pattern; works in browsers too. + return new URL("ld-new64.wasm", import.meta.url).href; +} + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; +} + +async function getWasmBinary(binaryFile) { + // If we don't have the binary yet, load it asynchronously using readAsync. + if (!wasmBinary) { + // Fetch the binary using readAsync + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + // Otherwise, getBinarySync should be able to get it synchronously + return getBinarySync(binaryFile); +} + +async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + // Warn on some common problems. + if (isFileURI(wasmBinaryFile)) { + err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`); + } + abort(reason); + } +} + +async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) { + try { + var response = fetch(binaryFile, { + credentials: "same-origin" + }); + var instantiationResult = await WebAssembly.instantiateStreaming(response, imports); + return instantiationResult; + } catch (reason) { + // We expect the most common failure cause to be a bad MIME type for the binary, + // in which case falling back to ArrayBuffer instantiation should work. + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); +} + +function getWasmImports() { + // prepare imports + return { + "env": wasmImports, + "wasi_snapshot_preview1": wasmImports + }; +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +async function createWasm() { + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + // wait for the pthread pool (if any) + addRunDependency("wasm-instantiate"); + // Prefer streaming instantiation if available. + // Async compilation can be confusing when an error on the page overwrites Module + // (for example, if the order of elements is wrong, and the one defining Module is + // later), so we save Module and check it later. + var trueModule = Module; + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + return Promise.reject(e); + } +} + +// === Body === +// end include: preamble.js +class ExitStatus { + name="ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } +} + +var callRuntimeCallbacks = callbacks => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } +}; + +var onPostRuns = []; + +var addOnPostRun = cb => onPostRuns.unshift(cb); + +var onPreRuns = []; + +var addOnPreRun = cb => onPreRuns.unshift(cb); + +/** + * @param {number} ptr + * @param {string} type + */ function getValue(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i8": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i16": + return SAFE_HEAP_LOAD(((ptr) / 2) * 2, 2, 0); + + case "i32": + return SAFE_HEAP_LOAD(((ptr) / 4) * 4, 4, 0); + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return SAFE_HEAP_LOAD_D(((ptr) / 4) * 4, 4, 0); + + case "double": + return SAFE_HEAP_LOAD_D(((ptr) / 8) * 8, 8, 0); + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +function getValue_safe(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return HEAP8[ptr]; + + case "i8": + return HEAP8[ptr]; + + case "i16": + return HEAP16[((ptr) / 2)]; + + case "i32": + return HEAP32[((ptr) / 4)]; + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return HEAPF32[((ptr) / 4)]; + + case "double": + return HEAPF64[((ptr) / 8)]; + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +var ptrToString = ptr => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); +}; + +/** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ function setValue(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i16": + SAFE_HEAP_STORE(((ptr) / 2) * 2, value, 2); + break; + + case "i32": + SAFE_HEAP_STORE(((ptr) / 4) * 4, value, 4); + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + SAFE_HEAP_STORE_D(((ptr) / 4) * 4, value, 4); + break; + + case "double": + SAFE_HEAP_STORE_D(((ptr) / 8) * 8, value, 8); + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +function setValue_safe(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + HEAP8[ptr] = value; + break; + + case "i8": + HEAP8[ptr] = value; + break; + + case "i16": + HEAP16[((ptr) / 2)] = value; + break; + + case "i32": + HEAP32[((ptr) / 4)] = value; + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + HEAPF32[((ptr) / 4)] = value; + break; + + case "double": + HEAPF64[((ptr) / 8)] = value; + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +var stackRestore = val => __emscripten_stack_restore(val); + +var stackSave = () => _emscripten_stack_get_current(); + +var unSign = (value, bits) => { + if (value >= 0) { + return value; + } + // Need some trickery, since if bits == 32, we are right at the limit of the + // bits JS uses in bitshifts + return bits <= 32 ? 2 * Math.abs(1 << (bits - 1)) + value : Math.pow(2, bits) + value; +}; + +var warnOnce = text => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = "warning: " + text; + err(text); + } +}; + +var INT53_MAX = 9007199254740992; + +var INT53_MIN = -9007199254740992; + +var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num); + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined; + +/** + * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given + * array that contains uint8 values, returns a copy of that string as a + * Javascript String object. + * heapOrArray is either a regular array, or a JavaScript typed array view. + * @param {number=} idx + * @param {number=} maxBytesToRead + * @return {string} + */ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + // TextDecoder needs to know the byte length in advance, it doesn't stop on + // null terminator by itself. Also, use the length info to avoid running tiny + // strings through TextDecoder, since .subarray() allocates garbage. + // (As a tiny code save trick, compare endPtr against endIdx using a negation, + // so that undefined/NaN means Infinity) + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + // If building with TextDecoder, we have already computed the string length + // above, so test loop end condition against that + while (idx < endPtr) { + // For UTF8 byte structure, see: + // http://en.wikipedia.org/wiki/UTF-8#Description + // https://www.ietf.org/rfc/rfc2279.txt + // https://tools.ietf.org/html/rfc3629 + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; +}; + +/** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index (i.e. maxBytesToRead will not + * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing + * frequent uses of UTF8ToString() with and without maxBytesToRead may throw + * JS JIT optimizations off, so it is worth to consider consistently using one + * @return {string} + */ var UTF8ToString = (ptr, maxBytesToRead) => { + assert(typeof ptr == "number", `UTF8ToString expects a number (got ${typeof ptr})`); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +}; + +function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var PATH = { + isAbs: path => path.charAt(0) === "/", + splitPath: filename => { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: path => { + var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/"; + // Normalize the path + path = PATH.normalizeArray(path.split("/").filter(p => !!p), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: path => { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + // No dirname whatsoever + return "."; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: path => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r) +}; + +var initRandomFill = () => view => crypto.getRandomValues(view); + +var randomFill = view => { + // Lazily init on the first invocation. + (randomFill = initRandomFill())(view); +}; + +var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? args[i] : FS.cwd(); + // Skip empty and invalid entries + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(p => !!p), !resolvedAbsolute).join("/"); + return ((resolvedAbsolute ? "/" : "") + resolvedPath) || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var FS_stdin_getChar_buffer = []; + +var lengthBytesUTF8 = str => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + var c = str.charCodeAt(i); + // possibly a lead surrogate + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; +}; + +var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert(typeof str === "string", `stringToUTF8Array expects a string (got ${typeof str})`); + // Parameter maxBytesToWrite is not optional. Negative values, 0, null, + // undefined and false each don't write out any bytes. + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + // -1 for string null terminator. + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description + // and https://www.ietf.org/rfc/rfc2279.txt + // and https://tools.ietf.org/html/rfc3629 + var u = str.charCodeAt(i); + // possibly a lead surrogate + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + // Null-terminate the pointer to the buffer. + heap[outIdx] = 0; + return outIdx - startIdx; +}; + +/** @type {function(string, boolean=, number=)} */ var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +}; + +var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + // we will read data by chunks of BUFSIZE + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + // For some reason we must suppress a closure warning here, even though + // fd definitely exists on process.stdin, and is even the proper way to + // get the fd of stdin, + // https://github.com/nodejs/help/issues/2136#issuecomment-523649904 + // This started to happen after moving this logic out of library_tty.js, + // so it is related to the surrounding code in some unclear manner. + /** @suppress {missingProperties} */ var fd = process.stdin.fd; + try { + bytesRead = fs.readSync(fd, buf, 0, BUFSIZE); + } catch (e) { + // Cross-platform differences: on Windows, reading EOF throws an + // exception, but on other OSes, reading EOF returns 0. Uniformize + // behavior by treating the EOF exception to return 0. + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + // Browser. + result = window.prompt("Input: "); + // returns null on cancel + if (result !== null) { + result += "\n"; + } + } else {} + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); +}; + +var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + // typical setting + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + // currently just ignore + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [ 24, 80 ]; + } + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + } + } +}; + +var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); +}; + +var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +}; + +var mmapAlloc = size => { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +}; + +var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity. + // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred + // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size + // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme. + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + // Make sure to not return excess unused bytes. + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + // No need to expand, the storage was already large enough. + // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity. + // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to + // avoid overshooting the allocation cap by a very large margin. + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + // At minimum allocate 256b for each file when expanding. + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + // Allocate new storage. + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + // Fully decommit when requesting a resize to zero. + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + // Allocate new storage. + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of [ "mode", "atime", "mtime", "ctime" ]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + // if we're overwriting a directory at new_name, make sure it's empty. + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = new_dir.mtime = old_node.parent.ctime = old_node.parent.mtime = Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [ ".", "..", ...Object.keys(node.contents) ]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + // The data buffer should be a typed array view + assert(!(buffer instanceof ArrayBuffer)); + // If the buffer is located in main memory (HEAP), and if + // memory can grow, we can't hold on to references of the + // memory buffer, as they may get invalidated. That means we + // need to do copy its contents. + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + // This write is from a typed array to a typed array? + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + // Writing to an already allocated and used subrange of the file? + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + // Appending to an existing file and we need to reallocate, or source data did not come as a typed array. + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + // Use typed array write which is available. + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + // We can't emulate MAP_SHARED when the file is not backed by the + // buffer we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + HEAP8.set(contents, ptr); + } + } + return { + ptr, + allocated + }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + // should we check if bytesWritten and length are the same? + return 0; + } + } +}; + +var asyncLoad = async url => { + var arrayBuffer = await readAsync(url); + assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`); + return new Uint8Array(arrayBuffer); +}; + +var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); +}; + +var preloadPlugins = Module["preloadPlugins"] || []; + +var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + // Ensure plugins are ready. + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach(plugin => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; +}; + +var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + // TODO we should allow people to just pass in a complete filename instead + // of parent and name being that we just join them anyways + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + // might have several active requests for the same fullname + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + onload?.(); + removeRunDependency(dep); + } + if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } +}; + +var FS_modeStringToFlags = str => { + var flagModes = { + "r": 0, + "r+": 2, + "w": 512 | 64 | 1, + "w+": 512 | 64 | 2, + "a": 1024 | 64 | 1, + "a+": 1024 | 64 | 2 + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; +}; + +var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; +}; + +var strError = errno => UTF8ToString(_strerror(errno)); + +var ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name="ErrnoError"; + // We set the `name` property to be able to identify `FS.ErrnoError` + // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. + // - when using PROXYFS, an error can come from an underlying FS + // as different FS objects have their own FS.ErrnoError each, + // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs. + // we'll use the reliable test `err.name == "ErrnoError"` instead + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared={}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return (this.flags & 1024); + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops={}; + stream_ops={}; + readMode=292 | 73; + writeMode=146; + mounted=null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? this.mode |= this.readMode : this.mode &= ~this.readMode; + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode; + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + // split the absolute path + var parts = path.split("/").filter(p => !!p); + // start at the root + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length - 1); + if (islast && opts.parent) { + // stop resolving + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + // if noent_okay is true, suppress a ENOENT in the last component + // and return an object with an undefined node. This is needed for + // resolving symlinks in the path when creating a file. + if ((e?.errno === 44) && islast && opts.noent_okay) { + return { + path: current_path + }; + } + throw e; + } + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { + path: current_path, + node: current + }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + // if we failed to find it in the cache, call into the VFS + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = [ "r", "w", "rw" ][flag & 3]; + if ((flag & 512)) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + // return 0 if any user, group or owner bits are set. + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || (flags & (512 | 64))) { + // TODO: check for O_SEARCH? (== search for dir only) + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: fd => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + // clone it, so we can return an instance of FSStream + stream = Object.assign(new FS.FSStream, stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + } + }, + major: dev => ((dev) >> 8), + minor: dev => ((dev) & 255), + makedev: (ma, mi) => ((ma) << 8 | (mi)), + registerDevice(dev, ops) { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + // sync all mounts + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + // The filesystem was not included, and instead we have an error + // message stored in the variable. + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + // use the absolute path + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type, + opts, + mountpoint, + mounts: [] + }; + // create a root node for the fs + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + // set as a mountpoint + node.mounted = mount; + // add the new mount to the current mount's children + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + // destroy the nodes for this mount, and all its child mounts + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + // no longer a mountpoint + node.mounted = null; + // remove this mount from the child mounts + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { + follow: true + }).node); + }, + statfsStream(stream) { + // We keep a separate statfsStream function because noderawfs overrides + // it. In noderawfs, stream.node is sometimes null. Instead, we need to + // look at stream.path. + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + // NOTE: None of the defaults here are true. We're just returning safe and + // sane values. Currently nodefs and rawfs replace these defaults, + // other file systems leave them alone. + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255 + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + // parents must exist + var lookup, old_dir, new_dir; + // let the errors from non existent directories percolate up + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + // new path should not be an ancestor of the old path + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) { + throw new FS.ErrnoError(10); + } + // if we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + // update old node (we do this here to avoid each backend + // needing to) + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + // According to POSIX, we should map EISDIR to EPERM, but + // we instead do what Linux does (and we must, as we use + // the musl linux libc). + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { + timestamp: Date.now(), + dontFollow + }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { + size: len, + timestamp: Date.now() + }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { + atime, + mtime + }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if ((flags & 64)) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + // noent_okay makes it so that if the final component of the path + // doesn't exist, lookupPath returns `node: undefined`. `path` will be + // updated to point to the target of all symlinks. + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true + }); + node = lookup.node; + path = lookup.path; + } + // perhaps we need to create the node + var created = false; + if ((flags & 64)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 128)) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + // node doesn't exist, try to create it + // Ignore the permission bits here to ensure we can `open` this new + // file below. We use chmod below the apply the permissions once the + // file is open. + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + // if asked only for a directory, then this must be one + if ((flags & 65536) && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + // check permissions, if this is not a file we just created now (it is ok to + // create and write to a file with read-only permissions; it is read-only + // for later use) + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // do truncation if necessary + if ((flags & 512) && !created) { + FS.truncate(node, 0); + } + // we've already handled these, don't pass down to the underlying vfs + flags &= ~(128 | 512 | 131072); + // register the stream with the filesystem + var stream = FS.createStream({ + node, + path: FS.getPath(node), + // we want the absolute path to the node + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }); + // call the new stream's open function + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + // free readdir state + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + // User requests writing to file (prot & PROT_WRITE != 0). + // Checking if we have permissions to write to the file unless + // MAP_PRIVATE flag is set. According to POSIX spec it is possible + // to write to file opened in read-only mode with MAP_PRIVATE flag, + // as all modifications will be visible only in the memory of + // the current process. + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + // create /dev + FS.mkdir("/dev"); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0 + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using err() rather than out() + // so we register a second tty just for it. + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + // setup /dev/[u]random + // use a buffer to avoid overhead of individual crypto calls per byte + var randomBuffer = new Uint8Array(1024), randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the + // name of the stream for fd 6 (see test_unistd_ttyname) + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { + llseek: MEMFS.stream_ops.llseek + }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + }, + id: fd + 1 + }; + ret.parent = ret; + // make it look like a simple root node + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()).filter(([k, v]) => v).map(([k, v]) => k.toString()); + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams(input, output, error) { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + // open default streams for the stdin, stdout and stderr devices + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init(input, output, error) { + assert(!FS.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.initialized = true; + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + // force-flush all streams, so we get musl std streams printed out + _fflush(0); + // close all of our streams + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + // operate from within the context of the symlink's target + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + // make sure we can write to the file + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + // Create a fake device that a set of stream ops to emulate + // the old behavior. + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else { + // Command-line. + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + // Lazy chunked Uint8Array (implements get and length from Uint8Array). + // Actual getting is abstracted away for eventual reuse. + class LazyUint8Array { + lengthKnown=false; + chunks=[]; + // Loaded chunks. Index is the chunk number + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + // Find length + var xhr = new XMLHttpRequest; + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + // Chunk size in bytes + if (!hasByteServing) chunkSize = datalength; + // Function to get a range from the remote URL. + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + // Some hints to the browser that we want binary data. + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(/** @type{Array} */ (xhr.response || [])); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + // including this byte + end = Math.min(end, datalength - 1); + // if datalength-1 is selected, this is the last block + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length + chunkSize = datalength = 1; + // this will force getter(0)/doXHR do download the whole file + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array; + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + // This is a total hack, but I want to get this lazy file code out of the + // core of MEMFS. If we want to keep this lazy file concept I feel it should + // be its own thin LAZYFS proxying calls to MEMFS. + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + // Add a function that defers querying the file size until it is asked the first time. + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + // override each stream op with one that tries to force load the lazy file first + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + // normal array + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + // LazyUint8Array from sync binary XHR + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + // use a custom read function + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + // use a custom mmap function + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { + ptr, + allocated: true + }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath() { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + // relative path + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + SAFE_HEAP_STORE(((buf) / 4) * 4, stat.dev, 4); + SAFE_HEAP_STORE((((buf) + (4)) / 4) * 4, stat.mode, 4); + HEAPU64[(((buf) + (8)) / 8)] = BigInt(stat.nlink); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stat.uid, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stat.gid, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stat.rdev, 4); + HEAP64[(((buf) + (32)) / 8)] = BigInt(stat.size); + SAFE_HEAP_STORE((((buf) + (40)) / 4) * 4, 4096, 4); + SAFE_HEAP_STORE((((buf) + (44)) / 4) * 4, stat.blocks, 4); + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(((buf) + (48)) / 8)] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(((buf) + (56)) / 8)] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (64)) / 8)] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(((buf) + (72)) / 8)] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (80)) / 8)] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(((buf) + (88)) / 8)] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (96)) / 8)] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + SAFE_HEAP_STORE((((buf) + (8)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (56)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stats.blocks, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stats.bfree, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stats.bavail, 4); + SAFE_HEAP_STORE((((buf) + (28)) / 4) * 4, stats.files, 4); + SAFE_HEAP_STORE((((buf) + (32)) / 4) * 4, stats.ffree, 4); + SAFE_HEAP_STORE((((buf) + (36)) / 4) * 4, stats.fsid, 4); + SAFE_HEAP_STORE((((buf) + (64)) / 4) * 4, stats.flags, 4); + // ST_NOSUID + SAFE_HEAP_STORE((((buf) + (48)) / 4) * 4, stats.namelen, 4); + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + // MAP_PRIVATE calls need not to be synced back to underlying fs + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + } +}; + +function ___syscall_chmod(path, mode) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_dup(fd) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + return FS.dupStream(old).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_dup3(fd, newfd, flags) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + assert(!flags); + if (old.fd === newfd) return -28; + // Check newfd is within range of valid open file descriptors. + if (newfd < 0 || newfd >= FS.MAX_OPEN_FDS) return -8; + var existing = FS.getStream(newfd); + if (existing) FS.close(existing); + return FS.dupStream(old, newfd).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_faccessat(dirfd, path, amode, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + assert(flags === 0 || flags == 512); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + // need a valid mode + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[((SYSCALLS.varargs) / 8)]); + SYSCALLS.varargs += 8; + return ret; +}; + +var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + // the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number. + var ret = SAFE_HEAP_LOAD(((+SYSCALLS.varargs) / 4) * 4, 4, 0); + SYSCALLS.varargs += 4; + return ret; +}; + +function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + // FD_CLOEXEC makes no sense for a single process. + case 3: + return stream.flags; + + case 4: + { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = syscallGetVarargP(); + var offset = 0; + // We're always unlocked. + SAFE_HEAP_STORE((((arg) + (offset)) / 2) * 2, 2, 2); + return 0; + } + + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +}; + +function ___syscall_getcwd(buf, size) { + buf = bigintToI53Checked(buf); + size = bigintToI53Checked(size); + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_getdents64(fd, dirp, count) { + dirp = bigintToI53Checked(dirp); + count = bigintToI53Checked(count); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + stream.getdents ||= FS.readdir(stream.path); + var struct_size = 280; + var pos = 0; + var off = FS.llseek(stream, 0, 1); + var startIdx = Math.floor(off / struct_size); + var endIdx = Math.min(stream.getdents.length, startIdx + Math.floor(count / struct_size)); + for (var idx = startIdx; idx < endIdx; idx++) { + var id; + var type; + var name = stream.getdents[idx]; + if (name === ".") { + id = stream.node.id; + type = 4; + } else if (name === "..") { + var lookup = FS.lookupPath(stream.path, { + parent: true + }); + id = lookup.node.id; + type = 4; + } else { + var child; + try { + child = FS.lookupNode(stream.node, name); + } catch (e) { + // If the entry is not a directory, file, or symlink, nodefs + // lookupNode will raise EINVAL. Skip these and continue. + if (e?.errno === 28) { + continue; + } + throw e; + } + id = child.id; + type = FS.isChrdev(child.mode) ? 2 : // DT_CHR, character device. + FS.isDir(child.mode) ? 4 : // DT_DIR, directory. + FS.isLink(child.mode) ? 10 : // DT_LNK, symbolic link. + 8; + } + assert(id); + HEAP64[((dirp + pos) / 8)] = BigInt(id); + HEAP64[(((dirp + pos) + (8)) / 8)] = BigInt((idx + 1) * struct_size); + SAFE_HEAP_STORE((((dirp + pos) + (16)) / 2) * 2, 280, 2); + SAFE_HEAP_STORE((dirp + pos) + (18), type, 1); + stringToUTF8(name, dirp + pos + 19, 256); + pos += struct_size; + } + FS.llseek(stream, idx * struct_size, 0); + return pos; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + { + if (!stream.tty) return -59; + return 0; + } + + case 21505: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, termios.c_iflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (4)) / 4) * 4, termios.c_oflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (8)) / 4) * 4, termios.c_cflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (12)) / 4) * 4, termios.c_lflag || 0, 4); + for (var i = 0; i < 32; i++) { + SAFE_HEAP_STORE((argp + i) + (17), termios.c_cc[i] || 0, 1); + } + return 0; + } + return 0; + } + + case 21510: + case 21511: + case 21512: + { + if (!stream.tty) return -59; + return 0; + } + + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = SAFE_HEAP_LOAD(((argp) / 4) * 4, 4, 0); + var c_oflag = SAFE_HEAP_LOAD((((argp) + (4)) / 4) * 4, 4, 0); + var c_cflag = SAFE_HEAP_LOAD((((argp) + (8)) / 4) * 4, 4, 0); + var c_lflag = SAFE_HEAP_LOAD((((argp) + (12)) / 4) * 4, 4, 0); + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(SAFE_HEAP_LOAD((argp + i) + (17), 1, 0)); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc + }); + } + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + // TODO: in theory we should write to the winsize struct that gets + // passed in, but for now musl doesn't read anything on it + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 2) * 2, winsize[0], 2); + SAFE_HEAP_STORE((((argp) + (2)) / 2) * 2, winsize[1], 2); + } + return 0; + } + + case 21524: + { + // TODO: technically, this ioctl call should change the window size. + // but, since emscripten doesn't have any concept of a terminal window + // yet, we'll just silently throw it away as we do TIOCGWINSZ + if (!stream.tty) return -59; + return 0; + } + + case 21515: + { + if (!stream.tty) return -59; + return 0; + } + + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.lstat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_newfstatat(dirfd, path, buf, flags) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & (~6400); + assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var PIPEFS = { + BUCKET_BUFFER_SIZE: 8192, + mount(mount) { + // Do not pollute the real root directory or its child nodes with pipes + // Looks like it is OK to create another pseudo-root node not linked to the FS.root hierarchy this way + return FS.createNode(null, "/", 16384 | 511, 0); + }, + createPipe() { + var pipe = { + buckets: [], + // refcnt 2 because pipe has a read end and a write end. We need to be + // able to read from the read end after write end is closed. + refcnt: 2, + timestamp: new Date + }; + pipe.buckets.push({ + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0 + }); + var rName = PIPEFS.nextname(); + var wName = PIPEFS.nextname(); + var rNode = FS.createNode(PIPEFS.root, rName, 4096, 0); + var wNode = FS.createNode(PIPEFS.root, wName, 4096, 0); + rNode.pipe = pipe; + wNode.pipe = pipe; + var readableStream = FS.createStream({ + path: rName, + node: rNode, + flags: 0, + seekable: false, + stream_ops: PIPEFS.stream_ops + }); + rNode.stream = readableStream; + var writableStream = FS.createStream({ + path: wName, + node: wNode, + flags: 1, + seekable: false, + stream_ops: PIPEFS.stream_ops + }); + wNode.stream = writableStream; + return { + readable_fd: readableStream.fd, + writable_fd: writableStream.fd + }; + }, + stream_ops: { + getattr(stream) { + var node = stream.node; + var timestamp = node.pipe.timestamp; + return { + dev: 14, + ino: node.id, + mode: 4480, + nlink: 1, + uid: 0, + gid: 0, + rdev: 0, + size: 0, + atime: timestamp, + mtime: timestamp, + ctime: timestamp, + blksize: 4096, + blocks: 0 + }; + }, + poll(stream) { + var pipe = stream.node.pipe; + if ((stream.flags & 2097155) === 1) { + return (256 | 4); + } + if (pipe.buckets.length > 0) { + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + if (bucket.offset - bucket.roffset > 0) { + return (64 | 1); + } + } + } + return 0; + }, + dup(stream) { + stream.node.pipe.refcnt++; + }, + ioctl(stream, request, varargs) { + return 28; + }, + fsync(stream) { + return 28; + }, + read(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + var currentLength = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + currentLength += bucket.offset - bucket.roffset; + } + assert(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer)); + var data = buffer.subarray(offset, offset + length); + if (length <= 0) { + return 0; + } + if (currentLength == 0) { + // Behave as if the read end is always non-blocking + throw new FS.ErrnoError(6); + } + var toRead = Math.min(currentLength, length); + var totalRead = toRead; + var toRemove = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var currBucket = pipe.buckets[i]; + var bucketSize = currBucket.offset - currBucket.roffset; + if (toRead <= bucketSize) { + var tmpSlice = currBucket.buffer.subarray(currBucket.roffset, currBucket.offset); + if (toRead < bucketSize) { + tmpSlice = tmpSlice.subarray(0, toRead); + currBucket.roffset += toRead; + } else { + toRemove++; + } + data.set(tmpSlice); + break; + } else { + var tmpSlice = currBucket.buffer.subarray(currBucket.roffset, currBucket.offset); + data.set(tmpSlice); + data = data.subarray(tmpSlice.byteLength); + toRead -= tmpSlice.byteLength; + toRemove++; + } + } + if (toRemove && toRemove == pipe.buckets.length) { + // Do not generate excessive garbage in use cases such as + // write several bytes, read everything, write several bytes, read everything... + toRemove--; + pipe.buckets[toRemove].offset = 0; + pipe.buckets[toRemove].roffset = 0; + } + pipe.buckets.splice(0, toRemove); + return totalRead; + }, + write(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + assert(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer)); + var data = buffer.subarray(offset, offset + length); + var dataLen = data.byteLength; + if (dataLen <= 0) { + return 0; + } + var currBucket = null; + if (pipe.buckets.length == 0) { + currBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0 + }; + pipe.buckets.push(currBucket); + } else { + currBucket = pipe.buckets[pipe.buckets.length - 1]; + } + assert(currBucket.offset <= PIPEFS.BUCKET_BUFFER_SIZE); + var freeBytesInCurrBuffer = PIPEFS.BUCKET_BUFFER_SIZE - currBucket.offset; + if (freeBytesInCurrBuffer >= dataLen) { + currBucket.buffer.set(data, currBucket.offset); + currBucket.offset += dataLen; + return dataLen; + } else if (freeBytesInCurrBuffer > 0) { + currBucket.buffer.set(data.subarray(0, freeBytesInCurrBuffer), currBucket.offset); + currBucket.offset += freeBytesInCurrBuffer; + data = data.subarray(freeBytesInCurrBuffer, data.byteLength); + } + var numBuckets = (data.byteLength / PIPEFS.BUCKET_BUFFER_SIZE) | 0; + var remElements = data.byteLength % PIPEFS.BUCKET_BUFFER_SIZE; + for (var i = 0; i < numBuckets; i++) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: PIPEFS.BUCKET_BUFFER_SIZE, + roffset: 0 + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data.subarray(0, PIPEFS.BUCKET_BUFFER_SIZE)); + data = data.subarray(PIPEFS.BUCKET_BUFFER_SIZE, data.byteLength); + } + if (remElements > 0) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: data.byteLength, + roffset: 0 + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data); + } + return dataLen; + }, + close(stream) { + var pipe = stream.node.pipe; + pipe.refcnt--; + if (pipe.refcnt === 0) { + pipe.buckets = null; + } + } + }, + nextname() { + if (!PIPEFS.nextname.current) { + PIPEFS.nextname.current = 0; + } + return "pipe[" + (PIPEFS.nextname.current++) + "]"; + } +}; + +function ___syscall_pipe(fdPtr) { + fdPtr = bigintToI53Checked(fdPtr); + try { + if (fdPtr == 0) { + throw new FS.ErrnoError(21); + } + var res = PIPEFS.createPipe(); + SAFE_HEAP_STORE(((fdPtr) / 4) * 4, res.readable_fd, 4); + SAFE_HEAP_STORE((((fdPtr) + (4)) / 4) * 4, res.writable_fd, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + bufsize = bigintToI53Checked(bufsize); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + // readlink is one of the rare functions that write out a C string, but does never append a null to the output buffer(!) + // stringToUTF8() always appends a null byte, so restore the character under the null byte after the write. + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_rmdir(path) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_unlinkat(dirfd, path, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort("Invalid flags passed to unlinkat"); + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var __abort_js = () => abort("native code called abort()"); + +var runtimeKeepaliveCounter = 0; + +var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; +}; + +var isLeapYear = year => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + +var MONTH_DAYS_LEAP_CUMULATIVE = [ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 ]; + +var MONTH_DAYS_REGULAR_CUMULATIVE = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ]; + +var ydayFromDate = date => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = (leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE); + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + // -1 since it's days since Jan 1 + return yday; +}; + +function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + tmPtr = bigintToI53Checked(tmPtr); + var date = new Date(time * 1e3); + SAFE_HEAP_STORE(((tmPtr) / 4) * 4, date.getSeconds(), 4); + SAFE_HEAP_STORE((((tmPtr) + (4)) / 4) * 4, date.getMinutes(), 4); + SAFE_HEAP_STORE((((tmPtr) + (8)) / 4) * 4, date.getHours(), 4); + SAFE_HEAP_STORE((((tmPtr) + (12)) / 4) * 4, date.getDate(), 4); + SAFE_HEAP_STORE((((tmPtr) + (16)) / 4) * 4, date.getMonth(), 4); + SAFE_HEAP_STORE((((tmPtr) + (20)) / 4) * 4, date.getFullYear() - 1900, 4); + SAFE_HEAP_STORE((((tmPtr) + (24)) / 4) * 4, date.getDay(), 4); + var yday = ydayFromDate(date) | 0; + SAFE_HEAP_STORE((((tmPtr) + (28)) / 4) * 4, yday, 4); + HEAP64[(((tmPtr) + (40)) / 8)] = BigInt(-(date.getTimezoneOffset() * 60)); + // Attention: DST is in December in South, and some regions don't have DST at all. + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE((((tmPtr) + (32)) / 4) * 4, dst, 4); +} + +var timers = {}; + +var handleException = e => { + // Certain exception types we do not treat as errors since they are used for + // internal control flow. + // 1. ExitStatus, which is thrown by exit() + // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others + // that wish to return to JS event loop. + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"); + } + } + quit_(1, e); +}; + +var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + +var _proc_exit = code => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +}; + +/** @suppress {duplicate } */ /** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => { + elfile = FS.readFile("./output.elf"); + console.log(elfile); + EXITSTATUS = status; + if (!keepRuntimeAlive()) { + exitRuntime(); + } + // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down + if (keepRuntimeAlive() && !implicit) { + var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + _proc_exit(status); +}; + +var _exit = exitJS; + +var maybeExit = () => { + if (runtimeExited) { + return; + } + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } +}; + +var callUserCallback = func => { + if (runtimeExited || ABORT) { + err("user callback triggered after runtime exited or application aborted. Ignoring."); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } +}; + +var _emscripten_get_now = () => performance.now(); + +var __setitimer_js = (which, timeout_ms) => { + // First, clear any existing timer. + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + // A timeout of zero simply cancels the current timeout so we have nothing + // more to do. + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now())); + }, timeout_ms); + timers[which] = { + id, + timeout_ms + }; + return 0; +}; + +var __tzset_js = function(timezone, daylight, std_name, dst_name) { + timezone = bigintToI53Checked(timezone); + daylight = bigintToI53Checked(daylight); + std_name = bigintToI53Checked(std_name); + dst_name = bigintToI53Checked(dst_name); + // TODO: Use (malleable) environment variables instead of system settings. + var currentYear = (new Date).getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + // Local standard timezone offset. Local standard time is not adjusted for + // daylight savings. This code uses the fact that getTimezoneOffset returns + // a greater value during Standard Time versus Daylight Saving Time (DST). + // Thus it determines the expected output during Standard Time, and it + // compares whether the output of the given date the same (Standard) or less + // (DST). + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + // timezone is specified as seconds west of UTC ("The external variable + // `timezone` shall be set to the difference, in seconds, between + // Coordinated Universal Time (UTC) and local standard time."), the same + // as returned by stdTimezoneOffset. + // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html + HEAPU64[((timezone) / 8)] = BigInt(stdTimezoneOffset * 60); + SAFE_HEAP_STORE(((daylight) / 4) * 4, Number(winterOffset != summerOffset), 4); + var extractZone = timezoneOffset => { + // Why inverse sign? + // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset + var sign = timezoneOffset >= 0 ? "-" : "+"; + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, "0"); + var minutes = String(absOffset % 60).padStart(2, "0"); + return `UTC${sign}${hours}${minutes}`; + }; + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + assert(winterName); + assert(summerName); + assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`); + assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`); + if (summerOffset < winterOffset) { + // Northern hemisphere + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } +}; + +var _emscripten_date_now = () => Date.now(); + +var nowIsMonotonic = 1; + +var checkWasiClock = clock_id => clock_id >= 0 && clock_id <= 3; + +function _clock_time_get(clk_id, ignored_precision, ptime) { + ignored_precision = bigintToI53Checked(ignored_precision); + ptime = bigintToI53Checked(ptime); + if (!checkWasiClock(clk_id)) { + return 28; + } + var now; + // all wasi clocks but realtime are monotonic + if (clk_id === 0) { + now = _emscripten_date_now(); + } else if (nowIsMonotonic) { + now = _emscripten_get_now(); + } else { + return 52; + } + // "now" is in ms, and wasi times are in ns. + var nsec = Math.round(now * 1e3 * 1e3); + HEAP64[((ptime) / 8)] = BigInt(nsec); + return 0; +} + +function _emscripten_err(str) { + str = bigintToI53Checked(str); + return err(UTF8ToString(str)); +} + +var getHeapMax = () => 2147483648; + +var growMemory = size => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + // round size grow request up to wasm page size (fixed 64KB per spec) + wasmMemory.grow(BigInt(pages)); + // .grow() takes a delta compared to the previous size + updateMemoryViews(); + return 1; + } catch (e) { + err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`); + } +}; + +function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + // With multithreaded builds, races can happen (another thread might increase the size + // in between), so return a failure, and let the caller retry. + assert(requestedSize > oldSize); + // Memory resize rules: + // 1. Always increase heap size to at least the requested size, rounded up + // to next page multiple. + // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap + // geometrically: increase the heap size according to + // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most + // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB). + // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap + // linearly: increase the heap size by at least + // MEMORY_GROWTH_LINEAR_STEP bytes. + // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by + // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest + // 4. If we were unable to allocate as much memory, it may be due to + // over-eager decision to excessively reserve due to (3) above. + // Hence if an allocation fails, cut down on the amount of excess + // growth, in an attempt to succeed to perform a smaller allocation. + // A limit is set for how much we can grow. We should not exceed that + // (the wasm binary specifies it, so if we tried, we'd fail anyhow). + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`); + return false; + } + // Loop through potential heap size increases. If we attempt a too eager + // reservation that fails, cut down on the attempted size and reserve a + // smaller bump instead. (max 3 times, chosen somewhat arbitrarily) + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + // ensure geometric growth + // but limit overreserving (default to capping at +96MB overgrowth at most) + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`); + return false; +} + +var ENV = {}; + +var getExecutableName = () => thisProgram || "./this.program"; + +var getEnvStrings = () => { + if (!getEnvStrings.strings) { + // Default values. + // Browser language detection #8751 + var lang = ((typeof navigator == "object" && navigator.languages && navigator.languages[0]) || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + // Apply the user-provided values, if any. + for (var x in ENV) { + // x is a key in ENV; if ENV[x] is undefined, that means it was + // explicitly set to be so. We allow user code to do that to + // force variables with default values to remain unset. + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +}; + +var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++, str.charCodeAt(i), 1); + } + // Null-terminate the string + SAFE_HEAP_STORE(buffer, 0, 1); +}; + +var _environ_get = function(__environ, environ_buf) { + __environ = bigintToI53Checked(__environ); + environ_buf = bigintToI53Checked(environ_buf); + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU64[(((__environ) + (i * 8)) / 8)] = BigInt(ptr); + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; +}; + +var _environ_sizes_get = function(penviron_count, penviron_buf_size) { + penviron_count = bigintToI53Checked(penviron_count); + penviron_buf_size = bigintToI53Checked(penviron_buf_size); + var strings = getEnvStrings(); + HEAPU64[((penviron_count) / 8)] = BigInt(strings.length); + var bufSize = 0; + strings.forEach(string => bufSize += string.length + 1); + HEAPU64[((penviron_buf_size) / 8)] = BigInt(bufSize); + return 0; +}; + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_fdstat_get(fd, pbuf) { + pbuf = bigintToI53Checked(pbuf); + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + // All character devices are terminals (other things a Linux system would + // assume is a character device, like the mouse, we have special APIs for). + var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4; + } + SAFE_HEAP_STORE(pbuf, type, 1); + SAFE_HEAP_STORE((((pbuf) + (2)) / 2) * 2, flags, 2); + HEAP64[(((pbuf) + (8)) / 8)] = BigInt(rightsBase); + HEAP64[(((pbuf) + (16)) / 8)] = BigInt(rightsInheriting); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + // nothing more to read + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_pread(fd, iov, iovcnt, offset, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + offset = bigintToI53Checked(offset); + pnum = bigintToI53Checked(pnum); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt, offset); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[((newOffset) / 8)] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + // reset readdir state + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + // No more space to write. + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +var stackAlloc = sz => __emscripten_stack_alloc(sz); + +var stringToUTF8OnStack = str => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; +}; + +FS.createPreloadedFile = FS_createPreloadedFile; + +FS.staticInit(); + +function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); +} + +var wasmImports = { + /** @export */ __assert_fail: ___assert_fail, + /** @export */ __syscall_chmod: ___syscall_chmod, + /** @export */ __syscall_dup: ___syscall_dup, + /** @export */ __syscall_dup3: ___syscall_dup3, + /** @export */ __syscall_faccessat: ___syscall_faccessat, + /** @export */ __syscall_fcntl64: ___syscall_fcntl64, + /** @export */ __syscall_fstat64: ___syscall_fstat64, + /** @export */ __syscall_getcwd: ___syscall_getcwd, + /** @export */ __syscall_getdents64: ___syscall_getdents64, + /** @export */ __syscall_ioctl: ___syscall_ioctl, + /** @export */ __syscall_lstat64: ___syscall_lstat64, + /** @export */ __syscall_newfstatat: ___syscall_newfstatat, + /** @export */ __syscall_openat: ___syscall_openat, + /** @export */ __syscall_pipe: ___syscall_pipe, + /** @export */ __syscall_readlinkat: ___syscall_readlinkat, + /** @export */ __syscall_rmdir: ___syscall_rmdir, + /** @export */ __syscall_stat64: ___syscall_stat64, + /** @export */ __syscall_unlinkat: ___syscall_unlinkat, + /** @export */ _abort_js: __abort_js, + /** @export */ _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + /** @export */ _localtime_js: __localtime_js, + /** @export */ _setitimer_js: __setitimer_js, + /** @export */ _tzset_js: __tzset_js, + /** @export */ alignfault, + /** @export */ clock_time_get: _clock_time_get, + /** @export */ emscripten_date_now: _emscripten_date_now, + /** @export */ emscripten_err: _emscripten_err, + /** @export */ emscripten_get_now: _emscripten_get_now, + /** @export */ emscripten_resize_heap: _emscripten_resize_heap, + /** @export */ environ_get: _environ_get, + /** @export */ environ_sizes_get: _environ_sizes_get, + /** @export */ exit: _exit, + /** @export */ fd_close: _fd_close, + /** @export */ fd_fdstat_get: _fd_fdstat_get, + /** @export */ fd_pread: _fd_pread, + /** @export */ fd_read: _fd_read, + /** @export */ fd_seek: _fd_seek, + /** @export */ fd_write: _fd_write, + /** @export */ proc_exit: _proc_exit, + /** @export */ segfault +}; + +var wasmExports = await createWasm(); + +var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + +var _main = Module["_main"] = createExportWrapper("__main_argc_argv", 2); + +var _fflush = createExportWrapper("fflush", 1); + +var _strerror = createExportWrapper("strerror", 1); + +var _sbrk = createExportWrapper("sbrk", 1); + +var ___funcs_on_exit = createExportWrapper("__funcs_on_exit", 0); + +var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + +var _emscripten_get_sbrk_ptr = createExportWrapper("emscripten_get_sbrk_ptr", 0); + +var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + +var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + +var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + +var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + +var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + +var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + +var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"]; + +var ___cxa_increment_exception_refcount = createExportWrapper("__cxa_increment_exception_refcount", 1); + +// Argument name here must shadow the `wasmExports` global so +// that it is recognised by metadce and minify-import-export-names +// passes. +function applySignatureConversions(wasmExports) { + // First, make a copy of the incoming exports object + wasmExports = Object.assign({}, wasmExports); + var makeWrapper___PP = f => (a0, a1, a2) => f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper__p = f => a0 => f(BigInt(a0)); + var makeWrapper_p_ = f => a0 => Number(f(a0)); + var makeWrapper_pP = f => a0 => Number(f(BigInt(a0 ? a0 : 0))); + var makeWrapper_p = f => () => Number(f()); + var makeWrapper_pp = f => a0 => Number(f(BigInt(a0))); + wasmExports["__main_argc_argv"] = makeWrapper___PP(wasmExports["__main_argc_argv"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["sbrk"] = makeWrapper_pP(wasmExports["sbrk"]); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p(wasmExports["emscripten_stack_get_base"]); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p(wasmExports["emscripten_stack_get_end"]); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p(wasmExports["_emscripten_stack_restore"]); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp(wasmExports["_emscripten_stack_alloc"]); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p(wasmExports["emscripten_stack_get_current"]); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p(wasmExports["__cxa_increment_exception_refcount"]); + return wasmExports; +} + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === +Module["run"] = run; + +Module["FS"] = FS; + +var missingLibrarySymbols = [ "writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "emscriptenLog", "readEmAsmArgs", "jstoi_q", "listenOnce", "autoResumeAudioContext", "getDynCaller", "dynCall", "runtimeKeepalivePush", "runtimeKeepalivePop", "asmjsMangle", "HandleAllocator", "getNativeTypeSize", "addOnInit", "addOnPostCtor", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "getCFunc", "ccall", "cwrap", "uleb128Encode", "sigToWasmTypes", "generateFuncType", "convertJsFunctionToWasm", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "removeFunction", "reallyNegative", "strLen", "reSign", "formatString", "intArrayToString", "AsciiToString", "UTF16ToString", "stringToUTF16", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "battery", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "ExceptionInfo", "findMatchingCatch", "Browser_asyncPrepareDataCounter", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "FS_unlink", "FS_mkdirTree", "_setNetworkCallback", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "setErrNo", "demangle", "stackTrace" ]; + +missingLibrarySymbols.forEach(missingLibrarySymbol); + +var unexportedSymbols = [ "addRunDependency", "removeRunDependency", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "zeroMemory", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "strError", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "jstoi_s", "getExecutableName", "handleException", "keepRuntimeAlive", "callUserCallback", "maybeExit", "asyncLoad", "alignMemory", "mmapAlloc", "wasmTable", "noExitRuntime", "addOnPreRun", "addOnPostRun", "freeTableIndexes", "functionsInTableMap", "unSign", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "UTF8ToString", "stringToUTF8Array", "stringToUTF8", "lengthBytesUTF8", "intArrayFromString", "stringToAscii", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "getEnvStrings", "checkWasiClock", "doReadv", "doWritev", "initRandomFill", "randomFill", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "uncaughtExceptionCount", "exceptionLast", "exceptionCaught", "Browser", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "isLeapYear", "ydayFromDate", "SYSCALLS", "preloadPlugins", "FS_createPreloadedFile", "FS_modeStringToFlags", "FS_getMode", "FS_stdin_getChar_buffer", "FS_stdin_getChar", "FS_createPath", "FS_createDevice", "FS_readFile", "FS_createDataFile", "FS_createLazyFile", "MEMFS", "TTY", "PIPEFS", "SOCKFS", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr" ]; + +unexportedSymbols.forEach(unexportedRuntimeSymbol); + +var calledRun; + +function callMain(args = []) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(typeof onPreRuns === "undefined" || onPreRuns.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach(arg => { + HEAPU64[((argv_ptr) / 8)] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[((argv_ptr) / 8)] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + // if we're not running an evented main loop, it's time to exit + exitJS(ret, /* implicit = */ true); + return ret; + } catch (e) { + return handleException(e); + } +} + +function stackCheckInit() { + // This is normally called automatically during __wasm_call_ctors but need to + // get these values before even running any of the ctors so we call it redundantly + // here. + _emscripten_stack_init(); + // TODO(sbc): Move writeStackCookie to native to to avoid this. + writeStackCookie(); +} + +function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + function doRun() { + console.log(args); + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("./linker.ld", args[0]); + args.shift(); + FS.writeFile("./input.o", args[0]); + args.shift(); + for (let i = 0; i < libs_to_load.length; i++){ + FS.writeFile("./" + libs_to_load[i].name, libs_to_load[i].file); + } + preMain(); + // readyPromiseResolve(Module); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"] || true; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + return elfile; +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +// run(); + +// end include: postamble.js +// include: postamble_modularize.js +// In MODULARIZE mode we wrap the generated code in a factory function +// and return either the Module itself, or a promise of the module. +// We assign to the `moduleRtn` global here and configure closure to see +// this as and extern so it won't get minified. +moduleRtn = readyPromise; + +// Assertion for attempting to access module properties on the incoming +// moduleArg. In the past we used this object as the prototype of the module +// and assigned properties to it, but now we return a distinct object. This +// keeps the instance private until it is ready (i.e the promise has been +// resolved). +for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`); + } + }); + } +} + + readyPromiseResolve(Module); + return moduleRtn; +} +); +})(); +(() => { + // Create a small, never-async wrapper around Module which + // checks for callers incorrectly using it with `new`. + var real_Module = Module; + Module = function(arg) { + if (new.target) throw new Error("Module() should not be called with `new Module()`"); + return real_Module(arg); + } +})(); +export default Module; diff --git a/src/core/assembler/sailAssembler/web/wasm/ld-new64.wasm b/src/core/assembler/sailAssembler/web/wasm/ld-new64.wasm new file mode 100755 index 000000000..68a56cd8c Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/ld-new64.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/objdump.js b/src/core/assembler/sailAssembler/web/wasm/objdump.js new file mode 100644 index 000000000..cb016561c --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/objdump.js @@ -0,0 +1,5776 @@ + + +export var dumptextinstructions32 = []; +export var dumpdatainstructions32 = []; +export var dumplabels32 = []; +export var sectionasm32 = 0; +export var inside_label32 = 0; +export var islib32 = 0; +export var libtags32 = []; +// export var entry_elf = 0; +var Module = (() => { + var _scriptDir = import.meta.url; + + return ( +function(Module) { + Module = Module || {}; + +var Module = typeof Module != "undefined" ? Module : {}; + +var readyPromiseResolve, readyPromiseReject; + +Module["ready"] = new Promise(function(resolve, reject) { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "_main")) { + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + get: function() { + abort("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + set: function() { + abort("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "___stdio_exit")) { + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + get: function() { + abort("You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + set: function() { + abort("You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized")) { + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + get: function() { + abort("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + set: function() { + abort("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); + } + }); +} + +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; + +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)"); +} + +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +var read_, readAsync, readBinary, setWindowTitle; + +function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + let toLog = e; + if (e && typeof e == "object" && e.stack) { + toLog = [ e, e.stack ]; + } + err("exiting due to exception: " + toLog); +} + +var fs; + +var nodePath; + +var requireNodeFS; + +if (ENVIRONMENT_IS_NODE) { + if (!(typeof process == "object" && typeof require == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = require("path").dirname(scriptDirectory) + "/"; + } else { + scriptDirectory = __dirname + "/"; + } + requireNodeFS = (() => { + if (!nodePath) { + fs = require("fs"); + nodePath = require("path"); + } + }); + read_ = function shell_read(filename, binary) { + requireNodeFS(); + filename = nodePath["normalize"](filename); + return fs.readFileSync(filename, binary ? undefined : "utf8"); + }; + readBinary = (filename => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + assert(ret.buffer); + return ret; + }); + readAsync = ((filename, onload, onerror) => { + requireNodeFS(); + filename = nodePath["normalize"](filename); + fs.readFile(filename, function(err, data) { + if (err) onerror(err); else onload(data.buffer); + }); + }); + if (process["argv"].length > 1) { + thisProgram = process["argv"][1].replace(/\\/g, "/"); + } + arguments_ = process["argv"].slice(2); + process["on"]("uncaughtException", function(ex) { + if (!(ex instanceof ExitStatus)) { + throw ex; + } + }); + process["on"]("unhandledRejection", function(reason) { + throw reason; + }); + quit_ = ((status, toThrow) => { + if (keepRuntimeAlive()) { + process["exitCode"] = status; + throw toThrow; + } + logExceptionOnExit(toThrow); + process["exit"](status); + }); + Module["inspect"] = function() { + return "[Emscripten Module object]"; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + if (typeof read != "undefined") { + read_ = function shell_read(f) { + return read(f); + }; + } + readBinary = function readBinary(f) { + let data; + if (typeof readbuffer == "function") { + return new Uint8Array(readbuffer(f)); + } + data = read(f, "binary"); + assert(typeof data == "object"); + return data; + }; + readAsync = function readAsync(f, onload, onerror) { + setTimeout(() => onload(readBinary(f)), 0); + }; + if (typeof scriptArgs != "undefined") { + arguments_ = scriptArgs; + } else if (typeof arguments != "undefined") { + arguments_ = arguments; + } + if (typeof quit == "function") { + quit_ = ((status, toThrow) => { + logExceptionOnExit(toThrow); + quit(status); + }); + } + if (typeof print != "undefined") { + if (typeof console == "undefined") console = {}; + console.log = print; + console.warn = console.error = typeof printErr != "undefined" ? printErr : print; + } +} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } else { + scriptDirectory = ""; + } + if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + read_ = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }); + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }); + } + readAsync = ((url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = (() => { + if (xhr.status == 200 || xhr.status == 0 && xhr.response) { + onload(xhr.response); + return; + } + onerror(); + }); + xhr.onerror = onerror; + xhr.send(null); + }); + } + setWindowTitle = (title => document.title = title); +} else { + throw new Error("environment detection error"); +} + + + Module['print'] = function (message) { + if (islib32) { + + + // Regex to get name function + if (sectionasm32 === 1){ + const name_function = message.match(/^([0-9a-f]{8})\s+<(.+?)>:$/); + if (name_function && !libtags32.includes(name_function[2])) + libtags32.push(name_function[2]); + } + + // Check which section + if (message.search(".text") != -1) + sectionasm32 = 1; + if (message.search(".data") != -1) + sectionasm32 = 2; + if (message.search(".riscv.attributes") != -1) + sectionasm32 = 0; + + + + console.log(message); + + } else { + + // console.log(typeof message); + + // console.log("En que seccion estoy: ", sectionasm32); + var auxinsn = []; + const auxiliar = message.trim(); + const datamatch = auxiliar.match(/^([0-9a-fA-F]+):\s+((?:[0-9a-fA-F]{2,8}(?:\s+[0-9a-fA-F]{2,8})*))(?:.*?0x([0-9a-fA-F]+))?/); // /^([0-9a-fA-F]+):.*?0x([0-9a-fA-F]+)/ + const insnmatch = auxiliar.match(/^(\w+):\s+((?:fnmadd\.s|\w+|\.\w+))\s+([^\#]*)(?:#(.*))?$/); // /^(\w+):\s+(\w+)\s+([^\#]*)(?:#(.*))?$/ + const labelmatch = auxiliar.match(/^([0-9a-f]{8})\s+<(.+?)>:$/); + if (insnmatch !== null && sectionasm32 === 1) { + const address = insnmatch[1].trim(); // Parte 1: dirección + const hexInstruction = insnmatch[2].trim(); // Parte 2: instrucción hexadecimal + const asmInstruction = (insnmatch[3].trim()).replace(/\\t/g, ' '); // Parte 3: instrucción ensamblador (sin el comentario) + // const comment = match[4] ? insnmatchmatch[4].trim() : null; // Parte 4: comentario (opcional) + let axx = dumptextinstructions32.findIndex(sublist => sublist.includes(address)); + if (axx != -1 && sectionasm32 === 1) { + dumptextinstructions32[axx][1] = hexInstruction; + dumptextinstructions32[axx][2] = asmInstruction.replace(/\\t/g, ' '); + } + else if (sectionasm32 === 1){ + auxinsn.push(address); + auxinsn.push(hexInstruction); + auxinsn.push(asmInstruction.replace(/\\t/g, ' ')); + auxinsn.push(0); + auxinsn.push(""); + dumptextinstructions32.push(auxinsn); + } + } + else if (datamatch !== null && sectionasm32 === 2){ + let axx = dumpdatainstructions32.findIndex(sublist => sublist.includes(datamatch[1])); + if (axx !== -1 && sectionasm32 === 2) { + dumpdatainstructions32[axx][1] = datamatch[2]; + dumpdatainstructions32[axx][2] = ""; // asmInstruction.replace(/\\t/g, ' '); + } + else if (sectionasm32 === 2) { + auxinsn.push(datamatch[1]); + auxinsn.push(datamatch[2]); + auxinsn.push(""/*asmInstruction.replace(/\\t/g, ' ')*/); + auxinsn.push(0); + auxinsn.push(""); + if(auxinsn[3] === 0){ + // console.log("Exaa que se va a insertar en un dumpdata anterior: ", auxinsn); + // console.log("Que es esto: ", /[^0-9a-fA-F]/.test(auxinsn[1])); + if(/[^0-9a-fA-F]/.test(auxinsn[1])/* auxinsn[1].includes("madd.s")*/){ + //buscamos la palabra completa almacenada por el list_data_instructions + var auxda = list_data_instructions.findIndex(data => data.label === dumpdatainstructions32[dumpdatainstructions32.length -1][4]); + var list_data_elem; + var aux_index_value = list_data_instructions[auxda].value.length; + if (typeof list_data_instructions[auxda].value === "object"){ + if (list_data_instructions[auxda].value[aux_index_value - 1].includes("-")){ + // caso de ser el valor negativo + let buff, buff_view; + switch (list_data_instructions[auxda].type){ + case "half": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) & 0xFFFF).toString(16).padStart(4, "0"); + break; + case "word": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) >>> 0).toString(16).padStart(8, "0"); + break; + case "byte": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) & 0xFF).toString(16).padStart(2, "0"); + break; + case "float": + buff = new ArrayBuffer(4); + buff_view = new DataView(buff); + buff_view.setFloat32(0, parseFloat(list_data_instructions[auxda].value[aux_index_value - 1]), true); + list_data_elem = buff_view.getUint32(0, true).toString(16).padStart(8, '0'); + + // list_data_elem = (parseFloat(list_data_instructions[auxda].value[aux_index_value - 1])).toString(16); + break; + case "double": + buff = new ArrayBuffer(8); + buff_view = new DataView(buff); + buff_view.setFloat64(0, parseFloat(list_data_instructions[auxda].value[aux_index_value - 1]), true); + let lo = buff_view.getUint32(0, true).toString(16).padStart(8, '0'); + let hi = buff_view.getUint32(4, true).toString(16).padStart(8, '0'); + + list_data_elem = lo + hi; + break; + } + dumpdatainstructions32[dumpdatainstructions32.length - 1][1] = list_data_elem + dumpdatainstructions32[dumpdatainstructions32.length -1][1]; + }else { // Caso de ser el valor positivo o sin signo + dumpdatainstructions32[dumpdatainstructions32.length -1][1] = list_data_instructions[auxda].value[aux_index_value - 1].toString(16) + dumpdatainstructions32[dumpdatainstructions32.length -1][1]; + } + } + } + else dumpdatainstructions32[dumpdatainstructions32.length -1][1] = auxinsn[1] + dumpdatainstructions32[dumpdatainstructions32.length -1][1]; + inside_label32 += 1; + }else + dumpdatainstructions32.push(auxinsn); + } + } + else if(labelmatch && sectionasm32 != 0){ + // console.log("Identificado:", labelmatch); + auxinsn.push(labelmatch[1].trim()); + auxinsn.push(""); + auxinsn.push(""); + auxinsn.push(1); + auxinsn.push(labelmatch[2].trim()); + console.log("labelmatch: ", labelmatch); + if (!document.app.$data.c_kernel && labelmatch[2].trim().includes("kernel")) + document.app.$data.entry_elf = labelmatch[1].trim(); + else if(labelmatch[2].trim() === "_main" && document.app.$data.c_kernel){ + document.app.$data.entry_elf = labelmatch[1].trim(); + } + + if (document.app.$data.entry_elf !== undefined && !document.app.$data.entry_elf.startsWith("0x")) + document.app.$data.entry_elf = "0x" + document.app.$data.entry_elf; + + if (sectionasm32 === 1){ + dumptextinstructions32.push(auxinsn); + }else if (sectionasm32 === 2){ + dumpdatainstructions32.push(auxinsn); + inside_label32 = 0; + } + + } + + // else { + // // console.log("objdump: 1", message); + // } + + // identificacion de que seccion de codigo entramos. + if (message.search(".text") != -1) + sectionasm32 = 1; + if (message.search(".data") != -1) + sectionasm32 = 2; + if (message.search(".riscv.attributes") != -1) + sectionasm32 = 0; + + console.log(message); + // console.log(dumpdatainstructions32); + } + } + + var out = Module["print"] || console.log.bind(console); + + var err = Module["printErr"] || console.warn.bind(console); + +Object.assign(Module, moduleOverrides); + +moduleOverrides = null; + +if (Module["arguments"]) arguments_ = Module["arguments"]; + +if (!Object.getOwnPropertyDescriptor(Module, "arguments")) { + Object.defineProperty(Module, "arguments", { + configurable: true, + get: function() { + abort("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) { + Object.defineProperty(Module, "thisProgram", { + configurable: true, + get: function() { + abort("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (Module["quit"]) quit_ = Module["quit"]; + +if (!Object.getOwnPropertyDescriptor(Module, "quit")) { + Object.defineProperty(Module, "quit", { + configurable: true, + get: function() { + abort("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed (modify read_ in JS)"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +if (!Object.getOwnPropertyDescriptor(Module, "read")) { + Object.defineProperty(Module, "read", { + configurable: true, + get: function() { + abort("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) { + Object.defineProperty(Module, "readAsync", { + configurable: true, + get: function() { + abort("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) { + Object.defineProperty(Module, "readBinary", { + configurable: true, + get: function() { + abort("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) { + Object.defineProperty(Module, "setWindowTitle", { + configurable: true, + get: function() { + abort("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable."); + +var STACK_ALIGN = 16; + +var POINTER_SIZE = 4; + +function getNativeTypeSize(type) { + switch (type) { + case "i1": + case "i8": + return 1; + + case "i16": + return 2; + + case "i32": + return 4; + + case "i64": + return 8; + + case "float": + return 4; + + case "double": + return 8; + + default: + { + if (type[type.length - 1] === "*") { + return POINTER_SIZE; + } else if (type[0] === "i") { + const bits = Number(type.substr(1)); + assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type); + return bits / 8; + } else { + return 0; + } + } + } +} + +function warnOnce(text) { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } +} + +function convertJsFunctionToWasm(func, sig) { + if (typeof WebAssembly.Function == "function") { + var typeNames = { + "i": "i32", + "j": "i64", + "f": "f32", + "d": "f64" + }; + var type = { + parameters: [], + results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ] + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return new WebAssembly.Function(type, func); + } + var typeSection = [ 1, 0, 1, 96 ]; + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { + "i": 127, + "j": 126, + "f": 125, + "d": 124 + }; + typeSection.push(sigParam.length); + for (var i = 0; i < sigParam.length; ++i) { + typeSection.push(typeCodes[sigParam[i]]); + } + if (sigRet == "v") { + typeSection.push(0); + } else { + typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]); + } + typeSection[1] = typeSection.length - 2; + var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])); + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { + "e": { + "f": func + } + }); + var wrappedFunc = instance.exports["f"]; + return wrappedFunc; +} + +var freeTableIndexes = []; + +var functionsInTableMap; + +function getEmptyTableSlot() { + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; + } + return wasmTable.length - 1; +} + +function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + if (item) { + functionsInTableMap.set(item, i); + } + } +} + +function addFunction(func, sig) { + assert(typeof func != "undefined"); + if (!functionsInTableMap) { + functionsInTableMap = new WeakMap(); + updateTableMap(0, wasmTable.length); + } + if (functionsInTableMap.has(func)) { + return functionsInTableMap.get(func); + } + var ret = getEmptyTableSlot(); + try { + setWasmTableEntry(ret, func); + } catch (err) { + if (!(err instanceof TypeError)) { + throw err; + } + assert(typeof sig != "undefined", "Missing signature argument to addFunction: " + func); + var wrapped = convertJsFunctionToWasm(func, sig); + setWasmTableEntry(ret, wrapped); + } + functionsInTableMap.set(func, ret); + return ret; +} + +function removeFunction(index) { + functionsInTableMap.delete(getWasmTableEntry(index)); + freeTableIndexes.push(index); +} + +var tempRet0 = 0; + +var setTempRet0 = value => { + tempRet0 = value; +}; + +var getTempRet0 = () => tempRet0; + +var wasmBinary; + +if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + +if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) { + Object.defineProperty(Module, "wasmBinary", { + configurable: true, + get: function() { + abort("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) { + Object.defineProperty(Module, "noExitRuntime", { + configurable: true, + get: function() { + abort("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); +} + +function setValue(ptr, value, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + HEAP8[ptr >> 0] = value; + break; + + case "i8": + HEAP8[ptr >> 0] = value; + break; + + case "i16": + HEAP16[ptr >> 1] = value; + break; + + case "i32": + HEAP32[ptr >> 2] = value; + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1]; + break; + + case "float": + HEAPF32[ptr >> 2] = value; + break; + + case "double": + HEAPF64[ptr >> 3] = value; + break; + + default: + abort("invalid type for setValue: " + type); + } + } else { + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr | 0, value | 0, 1); + break; + + case "i16": + SAFE_HEAP_STORE(ptr | 0, value | 0, 2); + break; + + case "i32": + SAFE_HEAP_STORE(ptr | 0, value | 0, 4); + break; + + case "i64": + tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(ptr | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(ptr + 4 | 0, tempI64[1] | 0, 4); + break; + + case "float": + SAFE_HEAP_STORE_D(ptr | 0, Math.fround(value), 4); + break; + + case "double": + SAFE_HEAP_STORE_D(ptr | 0, +value, 8); + break; + + default: + abort("invalid type for setValue: " + type); + } + } +} + +function getValue(ptr, type = "i8", noSafe) { + if (type.charAt(type.length - 1) === "*") type = "i32"; + if (noSafe) { + switch (type) { + case "i1": + return HEAP8[ptr >> 0]; + + case "i8": + return HEAP8[ptr >> 0]; + + case "i16": + return HEAP16[ptr >> 1]; + + case "i32": + return HEAP32[ptr >> 2]; + + case "i64": + return HEAP32[ptr >> 2]; + + case "float": + return HEAPF32[ptr >> 2]; + + case "double": + return Number(HEAPF64[ptr >> 3]); + + default: + abort("invalid type for getValue: " + type); + } + } else { + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i8": + return SAFE_HEAP_LOAD(ptr | 0, 1, 0) | 0; + + case "i16": + return SAFE_HEAP_LOAD(ptr | 0, 2, 0) | 0; + + case "i32": + return SAFE_HEAP_LOAD(ptr | 0, 4, 0) | 0; + + case "i64": + return SAFE_HEAP_LOAD(ptr | 0, 8, 0) | 0; + + case "float": + return Math.fround(SAFE_HEAP_LOAD_D(ptr | 0, 4, 0)); + + case "double": + return +SAFE_HEAP_LOAD_D(ptr | 0, 8, 0); + + default: + abort("invalid type for getValue: " + type); + } + } + return null; +} + +function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + assert(0); + } +} + +function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort("segmentation fault storing " + bytes + " bytes to address " + dest); + if (dest % bytes !== 0) abort("alignment error storing to address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when storing " + bytes + " bytes to address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort("segmentation fault loading " + bytes + " bytes from address " + dest); + if (dest % bytes !== 0) abort("alignment error loading from address " + dest + ", which was expected to be aligned to a multiple of " + bytes); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk() >>> 0; + if (dest + bytes > brk) abort("segmentation fault, exceeded the top of the available dynamic heap when loading " + bytes + " bytes from address " + dest + ". DYNAMICTOP=" + brk); + assert(brk >= _emscripten_stack_get_base()); + assert(brk <= HEAP8.length); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue(dest, type, 1); + if (unsigned) ret = unSign(ret, parseInt(type.substr(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort("Function table mask error: function pointer is " + value + " which is masked by " + mask + ", the likely cause of this is that the function pointer is being called by the wrong type."); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +var wasmMemory; + +var ABORT = false; + +var EXITSTATUS; + +function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +function getCFunc(ident) { + var func = Module["_" + ident]; + assert(func, "Cannot call unknown function " + ident + ", make sure it is exported"); + return func; +} + +function ccall(ident, returnType, argTypes, args, opts) { + var toC = { + "string": function(str) { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); + } + return ret; + }, + "array": function(arr) { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + } + }; + function convertReturnValue(ret) { + if (returnType === "string") return UTF8ToString(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func.apply(null, cArgs); + function onDone(ret) { + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + ret = onDone(ret); + return ret; +} + +function cwrap(ident, returnType, argTypes, opts) { + return function() { + return ccall(ident, returnType, argTypes, arguments, opts); + }; +} + +var ALLOC_NORMAL = 0; + +var ALLOC_STACK = 1; + +function allocate(slab, allocator) { + var ret; + assert(typeof allocator == "number", "allocate no longer takes a type argument"); + assert(typeof slab != "number", "allocate no longer takes a number as arg0"); + if (allocator == ALLOC_STACK) { + ret = stackAlloc(slab.length); + } else { + ret = _malloc(slab.length); + } + if (!slab.subarray && !slab.slice) { + slab = new Uint8Array(slab); + } + HEAPU8.set(slab, ret); + return ret; +} + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + +function UTF8ArrayToString(heap, idx, maxBytesToRead) { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { + return UTF8Decoder.decode(heap.subarray(idx, endPtr)); + } else { + var str = ""; + while (idx < endPtr) { + var u0 = heap[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heap[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode((u0 & 31) << 6 | u1); + continue; + } + var u2 = heap[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = (u0 & 15) << 12 | u1 << 6 | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63; + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } + } + } + return str; +} + +function UTF8ToString(ptr, maxBytesToRead) { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +} + +function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | u1 & 1023; + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | u >> 6; + heap[outIdx++] = 128 | u & 63; + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | u >> 12; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | u >> 18; + heap[outIdx++] = 128 | u >> 12 & 63; + heap[outIdx++] = 128 | u >> 6 & 63; + heap[outIdx++] = 128 | u & 63; + } + } + heap[outIdx] = 0; + return outIdx - startIdx; +} + +function stringToUTF8(str, outPtr, maxBytesToWrite) { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +} + +function lengthBytesUTF8(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023; + if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4; + } + return len; +} + +function AsciiToString(ptr) { + var str = ""; + while (1) { + var ch = SAFE_HEAP_LOAD(ptr++ | 0, 1, 1) >>> 0; + if (!ch) return str; + str += String.fromCharCode(ch); + } +} + +function stringToAscii(str, outPtr) { + return writeAsciiToMemory(str, outPtr, false); +} + +var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : undefined; + +function UTF16ToString(ptr, maxBytesToRead) { + assert(ptr % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!"); + var endPtr = ptr; + var idx = endPtr >> 1; + var maxIdx = idx + maxBytesToRead / 2; + while (!(idx >= maxIdx) && SAFE_HEAP_LOAD(idx * 2, 2, 1)) ++idx; + endPtr = idx << 1; + if (endPtr - ptr > 32 && UTF16Decoder) { + return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr)); + } else { + var str = ""; + for (var i = 0; !(i >= maxBytesToRead / 2); ++i) { + var codeUnit = SAFE_HEAP_LOAD(ptr + i * 2 | 0, 2, 0) | 0; + if (codeUnit == 0) break; + str += String.fromCharCode(codeUnit); + } + return str; + } +} + +function stringToUTF16(str, outPtr, maxBytesToWrite) { + assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 2) return 0; + maxBytesToWrite -= 2; + var startPtr = outPtr; + var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length; + for (var i = 0; i < numCharsToWrite; ++i) { + var codeUnit = str.charCodeAt(i); + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 2); + outPtr += 2; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 2); + return outPtr - startPtr; +} + +function lengthBytesUTF16(str) { + return str.length * 2; +} + +function UTF32ToString(ptr, maxBytesToRead) { + assert(ptr % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!"); + var i = 0; + var str = ""; + while (!(i >= maxBytesToRead / 4)) { + var utf32 = SAFE_HEAP_LOAD(ptr + i * 4 | 0, 4, 0) | 0; + if (utf32 == 0) break; + ++i; + if (utf32 >= 65536) { + var ch = utf32 - 65536; + str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); + } else { + str += String.fromCharCode(utf32); + } + } + return str; +} + +function stringToUTF32(str, outPtr, maxBytesToWrite) { + assert(outPtr % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"); + assert(typeof maxBytesToWrite == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + if (maxBytesToWrite === undefined) { + maxBytesToWrite = 2147483647; + } + if (maxBytesToWrite < 4) return 0; + var startPtr = outPtr; + var endPtr = startPtr + maxBytesToWrite - 4; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) { + var trailSurrogate = str.charCodeAt(++i); + codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023; + } + SAFE_HEAP_STORE(outPtr | 0, codeUnit | 0, 4); + outPtr += 4; + if (outPtr + 4 > endPtr) break; + } + SAFE_HEAP_STORE(outPtr | 0, 0 | 0, 4); + return outPtr - startPtr; +} + +function lengthBytesUTF32(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var codeUnit = str.charCodeAt(i); + if (codeUnit >= 55296 && codeUnit <= 57343) ++i; + len += 4; + } + return len; +} + +function allocateUTF8(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function allocateUTF8OnStack(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8Array(str, HEAP8, ret, size); + return ret; +} + +function writeStringToMemory(string, buffer, dontAddNull) { + warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!"); + var lastChar, end; + if (dontAddNull) { + end = buffer + lengthBytesUTF8(string); + lastChar = SAFE_HEAP_LOAD(end, 1, 0); + } + stringToUTF8(string, buffer, Infinity); + if (dontAddNull) SAFE_HEAP_STORE(end, lastChar, 1); +} + +function writeArrayToMemory(array, buffer) { + assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"); + HEAP8.set(array, buffer); +} + +function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++ | 0, str.charCodeAt(i) | 0, 1); + } + if (!dontAddNull) SAFE_HEAP_STORE(buffer | 0, 0 | 0, 1); +} + +function alignUp(x, multiple) { + if (x % multiple > 0) { + x += multiple - x % multiple; + } + return x; +} + +var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + +function updateGlobalBufferAndViews(buf) { + buffer = buf; + Module["HEAP8"] = HEAP8 = new Int8Array(buf); + Module["HEAP16"] = HEAP16 = new Int16Array(buf); + Module["HEAP32"] = HEAP32 = new Int32Array(buf); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); + Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); + Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); +} + +var TOTAL_STACK = 5242880; + +if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime"); + +var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; + +if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) { + Object.defineProperty(Module, "INITIAL_MEMORY", { + configurable: true, + get: function() { + abort("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); + } + }); +} + +assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"); + +assert(INITIAL_MEMORY == 16777216, "Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically"); + +var wasmTable; + +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + SAFE_HEAP_STORE(max + 4 | 0, 34821223 | 0, 4); + SAFE_HEAP_STORE(max + 8 | 0, 2310721022 | 0, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + var cookie1 = SAFE_HEAP_LOAD(max + 4 | 0, 4, 1) >>> 0; + var cookie2 = SAFE_HEAP_LOAD(max + 8 | 0, 4, 1) >>> 0; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16)); + } +} + +(function() { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"; +})(); + +var __ATPRERUN__ = []; + +var __ATINIT__ = []; + +var __ATMAIN__ = []; + +var __ATEXIT__ = []; + +var __ATPOSTRUN__ = []; + +var runtimeInitialized = false; + +var runtimeExited = false; + +var runtimeKeepaliveCounter = 0; + +function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; +} + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + checkStackCookie(); + assert(!runtimeInitialized); + runtimeInitialized = true; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + callRuntimeCallbacks(__ATINIT__); +} + +function preMain() { + checkStackCookie(); + callRuntimeCallbacks(__ATMAIN__); +} + +function exitRuntime() { + checkStackCookie(); + ___funcs_on_exit(); + callRuntimeCallbacks(__ATEXIT__); + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnPreMain(cb) { + __ATMAIN__.unshift(cb); +} + +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); + +var runDependencies = 0; + +var runDependencyWatcher = null; + +var dependenciesFulfilled = null; + +var runDependencyTracking = {}; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + runDependencyWatcher = setInterval(function() { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err("dependency: " + dep); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +Module["preloadedImages"] = {}; + +Module["preloadedAudios"] = {}; + +function abort(what) { + { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + } + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + EXITSTATUS = 1; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; +} + +var dataURIPrefix = "data:application/octet-stream;base64,"; + +function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); +} + +function isFileURI(filename) { + return filename.startsWith("file://"); +} + +function createExportWrapper(name, fixedasm) { + return function() { + var displayName = name; + var asm = fixedasm; + if (!fixedasm) { + asm = Module["asm"]; + } + assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization"); + assert(!runtimeExited, "native function `" + displayName + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)"); + if (!asm[name]) { + assert(asm[name], "exported native function `" + displayName + "` not found"); + } + return asm[name].apply(null, arguments); + }; +} + +var wasmBinaryFile; + +if (Module["locateFile"]) { + wasmBinaryFile = "objdump.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } +} else { + wasmBinaryFile = new URL("objdump.wasm", import.meta.url).toString(); +} + +function getBinary(file) { + try { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } else { + throw "both async and sync fetching of the wasm failed"; + } + } catch (err) { + abort(err); + } +} + +function getBinaryPromise() { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function" && !isFileURI(wasmBinaryFile)) { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + if (!response["ok"]) { + throw "failed to load wasm binary file at '" + wasmBinaryFile + "'"; + } + return response["arrayBuffer"](); + }).catch(function() { + return getBinary(wasmBinaryFile); + }); + } else { + if (readAsync) { + return new Promise(function(resolve, reject) { + readAsync(wasmBinaryFile, function(response) { + resolve(new Uint8Array(response)); + }, reject); + }); + } + } + } + return Promise.resolve().then(function() { + return getBinary(wasmBinaryFile); + }); +} + +function createWasm() { + var info = { + "env": asmLibraryArg, + "wasi_snapshot_preview1": asmLibraryArg + }; + function receiveInstance(instance, module) { + var exports = instance.exports; + Module["asm"] = exports; + wasmMemory = Module["asm"]["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateGlobalBufferAndViews(wasmMemory.buffer); + wasmTable = Module["asm"]["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + addOnInit(Module["asm"]["__wasm_call_ctors"]); + removeRunDependency("wasm-instantiate"); + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + receiveInstance(result["instance"]); + } + function instantiateArrayBuffer(receiver) { + return getBinaryPromise().then(function(binary) { + return WebAssembly.instantiate(binary, info); + }).then(function(instance) { + return instance; + }).then(receiver, function(reason) { + err("failed to asynchronously prepare wasm: " + reason); + if (isFileURI(wasmBinaryFile)) { + err("warning: Loading from a file URI (" + wasmBinaryFile + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"); + } + abort(reason); + }); + } + function instantiateAsync() { + if (!wasmBinary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch == "function") { + return fetch(wasmBinaryFile, { + credentials: "same-origin" + }).then(function(response) { + var result = WebAssembly.instantiateStreaming(response, info); + return result.then(receiveInstantiationResult, function(reason) { + err("wasm streaming compile failed: " + reason); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(receiveInstantiationResult); + }); + }); + } else { + return instantiateArrayBuffer(receiveInstantiationResult); + } + } + if (Module["instantiateWasm"]) { + try { + var exports = Module["instantiateWasm"](info, receiveInstance); + return exports; + } catch (e) { + err("Module.instantiateWasm callback failed with error: " + e); + return false; + } + } + instantiateAsync().catch(readyPromiseReject); + return {}; +} + +var tempDouble; + +var tempI64; + +var ASM_CONSTS = {}; + +function callRuntimeCallbacks(callbacks) { + while (callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == "function") { + callback(Module); + continue; + } + var func = callback.func; + if (typeof func == "number") { + if (callback.arg === undefined) { + getWasmTableEntry(func)(); + } else { + getWasmTableEntry(func)(callback.arg); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } +} + +function withStackSave(f) { + var stack = stackSave(); + var ret = f(); + stackRestore(stack); + return ret; +} + +function demangle(func) { + warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"); + return func; +} + +function demangleAll(text) { + var regex = /\b_Z[\w\d_]+/g; + return text.replace(regex, function(x) { + var y = demangle(x); + return x === y ? x : y + " [" + x + "]"; + }); +} + +var wasmTableMirror = []; + +function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); + return func; +} + +function handleException(e) { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); +} + +function jsStackTrace() { + var error = new Error(); + if (!error.stack) { + try { + throw new Error(); + } catch (e) { + error = e; + } + if (!error.stack) { + return "(no stack trace available)"; + } + } + return error.stack.toString(); +} + +function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; +} + +function stackTrace() { + var js = jsStackTrace(); + if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"](); + return demangleAll(js); +} + +function unSign(value, bits) { + if (value >= 0) { + return value; + } + return bits <= 32 ? 2 * Math.abs(1 << bits - 1) + value : Math.pow(2, bits) + value; +} + +function ___assert_fail(condition, filename, line, func) { + abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var _emscripten_get_now; + +if (ENVIRONMENT_IS_NODE) { + _emscripten_get_now = (() => { + var t = process["hrtime"](); + return t[0] * 1e3 + t[1] / 1e6; + }); +} else _emscripten_get_now = (() => performance.now()); + +var _emscripten_get_now_is_monotonic = true; + +function setErrNo(value) { + SAFE_HEAP_STORE(___errno_location() | 0, value | 0, 4); + return value; +} + +function _clock_gettime(clk_id, tp) { + var now; + if (clk_id === 0) { + now = Date.now(); + } else if ((clk_id === 1 || clk_id === 4) && _emscripten_get_now_is_monotonic) { + now = _emscripten_get_now(); + } else { + setErrNo(28); + return -1; + } + SAFE_HEAP_STORE(tp | 0, now / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(tp + 4 | 0, now % 1e3 * 1e3 * 1e3 | 0 | 0, 4); + return 0; +} + +function ___clock_gettime(a0, a1) { + return _clock_gettime(a0, a1); +} + +var PATH = { + splitPath: function(filename) { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: function(parts, allowAboveRoot) { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: function(path) { + var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray(path.split("/").filter(function(p) { + return !!p; + }), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: function(path) { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: function(path) { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + extname: function(path) { + return PATH.splitPath(path)[3]; + }, + join: function() { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.join("/")); + }, + join2: function(l, r) { + return PATH.normalize(l + "/" + r); + } +}; + +function getRandomDevice() { + if (typeof crypto == "object" && typeof crypto["getRandomValues"] == "function") { + var randomBuffer = new Uint8Array(1); + return function() { + crypto.getRandomValues(randomBuffer); + return randomBuffer[0]; + }; + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require("crypto"); + return function() { + return crypto_module["randomBytes"](1)[0]; + }; + } catch (e) {} + } + return function() { + abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };"); + }; +} + +var PATH_FS = { + resolve: function() { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(function(p) { + return !!p; + }), !resolvedAbsolute).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: function(from, to) { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var TTY = { + ttys: [], + init: function() {}, + shutdown: function() {}, + register: function(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops: ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + flush: function(stream) { + stream.tty.ops.flush(stream.tty); + }, + read: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char: function(tty) { + if (!tty.input.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + try { + bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE, -1); + } catch (e) { + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } else { + result = null; + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + }, + put_char: function(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + }, + default_tty1_ops: { + put_char: function(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + } + } +}; + +function zeroMemory(address, size) { + HEAPU8.fill(0, address, address + size); +} + +function alignMemory(size, alignment) { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +} + +function mmapAlloc(size) { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +} + +var MEMFS = { + ops_table: null, + mount: function(mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode: function(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray: function(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage: function(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage: function(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr: function(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr: function(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup: function(parent, name) { + throw FS.genericErrors[44]; + }, + mknod: function(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename: function(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink: function(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir: function(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir: function(node) { + var entries = [ ".", ".." ]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink: function(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink: function(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read: function(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write: function(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek: function(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate: function(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap: function(stream, address, length, position, prot, flags) { + if (address !== 0) { + throw new FS.ErrnoError(28); + } + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { + ptr: ptr, + allocated: allocated + }; + }, + msync: function(stream, buffer, offset, length, mmapFlags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (mmapFlags & 2) { + return 0; + } + var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + } + } +}; + +function asyncLoad(url, onload, onerror, noRunDep) { + var dep = !noRunDep ? getUniqueRunDependency("al " + url) : ""; + readAsync(url, function(arrayBuffer) { + assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).'); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, function(event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }); + if (dep) addRunDependency(dep); +} + +var ERRNO_MESSAGES = { + 0: "Success", + 1: "Arg list too long", + 2: "Permission denied", + 3: "Address already in use", + 4: "Address not available", + 5: "Address family not supported by protocol family", + 6: "No more processes", + 7: "Socket already connected", + 8: "Bad file number", + 9: "Trying to read unreadable message", + 10: "Mount device busy", + 11: "Operation canceled", + 12: "No children", + 13: "Connection aborted", + 14: "Connection refused", + 15: "Connection reset by peer", + 16: "File locking deadlock error", + 17: "Destination address required", + 18: "Math arg out of domain of func", + 19: "Quota exceeded", + 20: "File exists", + 21: "Bad address", + 22: "File too large", + 23: "Host is unreachable", + 24: "Identifier removed", + 25: "Illegal byte sequence", + 26: "Connection already in progress", + 27: "Interrupted system call", + 28: "Invalid argument", + 29: "I/O error", + 30: "Socket is already connected", + 31: "Is a directory", + 32: "Too many symbolic links", + 33: "Too many open files", + 34: "Too many links", + 35: "Message too long", + 36: "Multihop attempted", + 37: "File or path name too long", + 38: "Network interface is not configured", + 39: "Connection reset by network", + 40: "Network is unreachable", + 41: "Too many open files in system", + 42: "No buffer space available", + 43: "No such device", + 44: "No such file or directory", + 45: "Exec format error", + 46: "No record locks available", + 47: "The link has been severed", + 48: "Not enough core", + 49: "No message of desired type", + 50: "Protocol not available", + 51: "No space left on device", + 52: "Function not implemented", + 53: "Socket is not connected", + 54: "Not a directory", + 55: "Directory not empty", + 56: "State not recoverable", + 57: "Socket operation on non-socket", + 59: "Not a typewriter", + 60: "No such device or address", + 61: "Value too large for defined data type", + 62: "Previous owner died", + 63: "Not super-user", + 64: "Broken pipe", + 65: "Protocol error", + 66: "Unknown protocol", + 67: "Protocol wrong type for socket", + 68: "Math result not representable", + 69: "Read only file system", + 70: "Illegal seek", + 71: "No such process", + 72: "Stale file handle", + 73: "Connection timed out", + 74: "Text file busy", + 75: "Cross-device link", + 100: "Device not a stream", + 101: "Bad font file fmt", + 102: "Invalid slot", + 103: "Invalid request code", + 104: "No anode", + 105: "Block device required", + 106: "Channel number out of range", + 107: "Level 3 halted", + 108: "Level 3 reset", + 109: "Link number out of range", + 110: "Protocol driver not attached", + 111: "No CSI structure available", + 112: "Level 2 halted", + 113: "Invalid exchange", + 114: "Invalid request descriptor", + 115: "Exchange full", + 116: "No data (for no delay io)", + 117: "Timer expired", + 118: "Out of streams resources", + 119: "Machine is not on the network", + 120: "Package not installed", + 121: "The object is remote", + 122: "Advertise error", + 123: "Srmount error", + 124: "Communication error on send", + 125: "Cross mount point (not really error)", + 126: "Given log. name not unique", + 127: "f.d. invalid for this operation", + 128: "Remote address changed", + 129: "Can access a needed shared lib", + 130: "Accessing a corrupted shared lib", + 131: ".lib section in a.out corrupted", + 132: "Attempting to link in too many libs", + 133: "Attempting to exec a shared library", + 135: "Streams pipe error", + 136: "Too many users", + 137: "Socket type not supported", + 138: "Not supported", + 139: "Protocol family not supported", + 140: "Can't send after socket shutdown", + 141: "Too many references", + 142: "Host is down", + 148: "No medium (in tape drive)", + 156: "Level 2 not synchronized" +}; + +var ERRNO_CODES = {}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(FS.cwd(), path); + if (!path) return { + path: "", + node: null + }; + var defaults = { + follow_mount: true, + recurse_count: 0 + }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = PATH.normalizeArray(path.split("/").filter(p => !!p), false); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || islast && opts.follow_mount) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { + path: current_path, + node: current + }; + }, + getPath: node => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path; + } + path = path ? node.name + "/" + path : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = (hash << 5) - hash + name.charCodeAt(i) | 0; + } + return (parentid + hash >>> 0) % FS.nameTable.length; + }, + hashAddNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: node => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: node => { + FS.hashRemoveNode(node); + }, + isRoot: node => { + return node === node.parent; + }, + isMountpoint: node => { + return !!node.mounted; + }, + isFile: mode => { + return (mode & 61440) === 32768; + }, + isDir: mode => { + return (mode & 61440) === 16384; + }, + isLink: mode => { + return (mode & 61440) === 40960; + }, + isChrdev: mode => { + return (mode & 61440) === 8192; + }, + isBlkdev: mode => { + return (mode & 61440) === 24576; + }, + isFIFO: mode => { + return (mode & 61440) === 4096; + }, + isSocket: mode => { + return (mode & 49152) === 49152; + }, + flagModes: { + "r": 0, + "r+": 2, + "w": 577, + "w+": 578, + "a": 1089, + "a+": 1090 + }, + modeStringToFlags: str => { + var flags = FS.flagModes[str]; + if (typeof flags == "undefined") { + throw new Error("Unknown file open mode: " + str); + } + return flags; + }, + flagsToPermissionString: flag => { + var perms = [ "r", "w", "rw" ][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: dir => { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: (fd_start = 0, fd_end = FS.MAX_OPEN_FDS) => { + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStream: fd => FS.streams[fd], + createStream: (stream, fd_start, fd_end) => { + if (!FS.FSStream) { + FS.FSStream = function() {}; + FS.FSStream.prototype = { + object: { + get: function() { + return this.node; + }, + set: function(val) { + this.node = val; + } + }, + isRead: { + get: function() { + return (this.flags & 2097155) !== 1; + } + }, + isWrite: { + get: function() { + return (this.flags & 2097155) !== 0; + } + }, + isAppend: { + get: function() { + return this.flags & 1024; + } + } + }; + } + stream = Object.assign(new FS.FSStream(), stream); + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: fd => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: stream => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + } + }, + major: dev => dev >> 8, + minor: dev => dev & 255, + makedev: (ma, mi) => ma << 8 | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts: mount => { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err("warning: " + FS.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work"); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [] + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: mountpoint => { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => { + return parent.node_ops.lookup(parent, name); + }, + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: path => { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: path => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link)); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: path => { + return FS.stat(path, true); + }, + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: mode & 4095 | node.mode & ~4095, + timestamp: Date.now() + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now() + }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now() + }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime) + }); + }, + open: (path, flags, mode, fd_start, fd_end) => { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = mode & 4095 | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072) + }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false + }, fd_start, fd_end); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: stream => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: stream => { + return stream.fd === null; + }, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, address, length, position, prot, flags) => { + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap(stream, address, length, position, prot, flags); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream || !stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + munmap: stream => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: path => { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices: () => { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var random_device = getRandomDevice(); + FS.createDevice("/dev", "random", random_device); + FS.createDevice("/dev", "urandom", random_device); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories: () => { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount: () => { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + } + }; + ret.parent = ret; + return ret; + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams: () => { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")"); + assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")"); + assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")"); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.node = node; + this.setErrno = function(errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + }; + this.setErrno(errno); + this.message = ERRNO_MESSAGES[errno]; + if (this.stack) { + Object.defineProperty(this, "stack", { + value: new Error().stack, + writable: true + }); + this.stack = demangleAll(this.stack); + } + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [ 44 ].forEach(code => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init: (input, output, error) => { + assert(!FS.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + ___stdio_exit(); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + getMode: (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + return null; + } + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: stream => { + stream.seekable = false; + }, + close: stream => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: obj => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = idx / this.chunkSize | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || "", true); + } + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + }, + chunkSize: { + get: function() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + }); + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url: url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + stream_ops.read = ((stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }); + node.stream_ops = stream_ops; + return node; + }, + createPreloadedFile: (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency("cp " + fullname); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + if (onload) onload(); + removeRunDependency(dep); + } + if (Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, byteArray => processData(byteArray), onerror); + } else { + processData(url); + } + }, + indexedDB: () => { + return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + }, + DB_NAME: () => { + return "EM_FS_" + window.location.pathname; + }, + DB_VERSION: 20, + DB_STORE_NAME: "FILE_DATA", + saveFilesToDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = (() => { + out("creating db"); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }); + openRequest.onsuccess = (() => { + var db = openRequest.result; + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readwrite"); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var putRequest = files.put(FS.analyzePath(path).object.contents, path); + putRequest.onsuccess = (() => { + ok++; + if (ok + fail == total) finish(); + }); + putRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + loadFilesFromDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; + openRequest.onsuccess = (() => { + var db = openRequest.result; + try { + var transaction = db.transaction([ FS.DB_STORE_NAME ], "readonly"); + } catch (e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(path => { + var getRequest = files.get(path); + getRequest.onsuccess = (() => { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true); + ok++; + if (ok + fail == total) finish(); + }); + getRequest.onerror = (() => { + fail++; + if (ok + fail == total) finish(); + }); + }); + transaction.onerror = onerror; + }); + openRequest.onerror = onerror; + }, + absolutePath: () => { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder: () => { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink: () => { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath: () => { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc: () => { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath: () => { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function(dirfd, path, allowEmpty) { + if (path[0] === "/") { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = FS.getStream(dirfd); + if (!dirstream) throw new FS.ErrnoError(8); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function(func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) { + return -54; + } + throw e; + } + SAFE_HEAP_STORE(buf | 0, stat.dev | 0, 4); + SAFE_HEAP_STORE(buf + 4 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 8 | 0, stat.ino | 0, 4); + SAFE_HEAP_STORE(buf + 12 | 0, stat.mode | 0, 4); + SAFE_HEAP_STORE(buf + 16 | 0, stat.nlink | 0, 4); + SAFE_HEAP_STORE(buf + 20 | 0, stat.uid | 0, 4); + SAFE_HEAP_STORE(buf + 24 | 0, stat.gid | 0, 4); + SAFE_HEAP_STORE(buf + 28 | 0, stat.rdev | 0, 4); + SAFE_HEAP_STORE(buf + 32 | 0, 0 | 0, 4); + tempI64 = [ stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 40 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 44 | 0, tempI64[1] | 0, 4); + SAFE_HEAP_STORE(buf + 48 | 0, 4096 | 0, 4); + SAFE_HEAP_STORE(buf + 52 | 0, stat.blocks | 0, 4); + SAFE_HEAP_STORE(buf + 56 | 0, stat.atime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 60 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 64 | 0, stat.mtime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 68 | 0, 0 | 0, 4); + SAFE_HEAP_STORE(buf + 72 | 0, stat.ctime.getTime() / 1e3 | 0 | 0, 4); + SAFE_HEAP_STORE(buf + 76 | 0, 0 | 0, 4); + tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(buf + 80 | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(buf + 84 | 0, tempI64[1] | 0, 4); + return 0; + }, + doMsync: function(addr, stream, len, flags, offset) { + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + doMkdir: function(path, mode) { + path = PATH.normalize(path); + if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + }, + doMknod: function(path, mode, dev) { + switch (mode & 61440) { + case 32768: + case 8192: + case 24576: + case 4096: + case 49152: + break; + + default: + return -28; + } + FS.mknod(path, mode, dev); + return 0; + }, + doReadlink: function(path, buf, bufsize) { + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + }, + doAccess: function(path, amode) { + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + }, + doDup: function(path, flags, suggestFD) { + var suggest = FS.getStream(suggestFD); + if (suggest) FS.close(suggest); + return FS.open(path, flags, 0, suggestFD, suggestFD).fd; + }, + doReadv: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + } + return ret; + }, + doWritev: function(stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = SAFE_HEAP_LOAD(iov + i * 8 | 0, 4, 0) | 0; + var len = SAFE_HEAP_LOAD(iov + (i * 8 + 4) | 0, 4, 0) | 0; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + } + return ret; + }, + varargs: undefined, + get: function() { + assert(SYSCALLS.varargs != undefined); + SYSCALLS.varargs += 4; + var ret = SAFE_HEAP_LOAD(SYSCALLS.varargs - 4 | 0, 4, 0) | 0; + return ret; + }, + getStr: function(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function(fd) { + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + return stream; + }, + get64: function(low, high) { + if (low >= 0) assert(high === 0); else assert(high === -1); + return low; + } +}; + +function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + assert(flags === 0); + path = SYSCALLS.calculateAt(dirfd, path); + return SYSCALLS.doAccess(path, amode); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.open(stream.path, stream.flags, 0, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + case 3: + return stream.flags; + + case 4: + { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = SYSCALLS.get(); + var offset = 0; + SAFE_HEAP_STORE(arg + offset | 0, 2 | 0, 2); + return 0; + } + + case 6: + case 7: + return 0; + + case 16: + case 8: + return -28; + + case 9: + setErrNo(28); + return -1; + + default: + { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_fstatat64(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~4352; + assert(!flags, flags); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd); + if (size < cwdLengthInBytes + 1) return -68; + stringToUTF8(cwd, buf, size); + return buf; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_getegid32() { + return 0; +} + +function ___syscall_getgid32() { + return ___syscall_getegid32(); +} + +function ___syscall_getuid32() { + return ___syscall_getegid32(); +} + +function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + case 21505: + { + if (!stream.tty) return -59; + return 0; + } + + case 21510: + case 21511: + case 21512: + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + SAFE_HEAP_STORE(argp | 0, 0 | 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + if (!stream.tty) return -59; + return 0; + } + + case 21524: + { + if (!stream.tty) return -59; + return 0; + } + + default: + abort("bad ioctl syscall " + op); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_open(path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + var pathname = SYSCALLS.getStr(path); + var mode = varargs ? SYSCALLS.get() : 0; + var stream = FS.open(pathname, flags, mode); + return stream.fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_readlink(path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doReadlink(path, buf, bufsize); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function ___syscall_unlink(path) { + try { + path = SYSCALLS.getStr(path); + FS.unlink(path); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } +} + +function __localtime_js(time, tmPtr) { + var date = new Date((SAFE_HEAP_LOAD(time | 0, 4, 0) | 0) * 1e3); + SAFE_HEAP_STORE(tmPtr | 0, date.getSeconds() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 4 | 0, date.getMinutes() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 8 | 0, date.getHours() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 12 | 0, date.getDate() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 16 | 0, date.getMonth() | 0, 4); + SAFE_HEAP_STORE(tmPtr + 20 | 0, date.getFullYear() - 1900 | 0, 4); + SAFE_HEAP_STORE(tmPtr + 24 | 0, date.getDay() | 0, 4); + var start = new Date(date.getFullYear(), 0, 1); + var yday = (date.getTime() - start.getTime()) / (1e3 * 60 * 60 * 24) | 0; + SAFE_HEAP_STORE(tmPtr + 28 | 0, yday | 0, 4); + SAFE_HEAP_STORE(tmPtr + 36 | 0, -(date.getTimezoneOffset() * 60) | 0, 4); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE(tmPtr + 32 | 0, dst | 0, 4); +} + +function _tzset_impl(timezone, daylight, tzname) { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + SAFE_HEAP_STORE(timezone | 0, stdTimezoneOffset * 60 | 0, 4); + SAFE_HEAP_STORE(daylight | 0, Number(winterOffset != summerOffset) | 0, 4); + function extractZone(date) { + var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return match ? match[1] : "GMT"; + } + var winterName = extractZone(winter); + var summerName = extractZone(summer); + var winterNamePtr = allocateUTF8(winterName); + var summerNamePtr = allocateUTF8(summerName); + if (summerOffset < winterOffset) { + SAFE_HEAP_STORE(tzname | 0, winterNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, summerNamePtr | 0, 4); + } else { + SAFE_HEAP_STORE(tzname | 0, summerNamePtr | 0, 4); + SAFE_HEAP_STORE(tzname + 4 | 0, winterNamePtr | 0, 4); + } +} + +function __tzset_js(timezone, daylight, tzname) { + if (__tzset_js.called) return; + __tzset_js.called = true; + _tzset_impl(timezone, daylight, tzname); +} + +function _abort() { + abort("native code called abort()"); +} + +function _emscripten_console_error(str) { + assert(typeof str == "number"); + console.error(UTF8ToString(str)); +} + +function _emscripten_memcpy_big(dest, src, num) { + HEAPU8.copyWithin(dest, src, src + num); +} + +function _emscripten_get_heap_max() { + return 2147483648; +} + +function emscripten_realloc_buffer(size) { + try { + wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16); + updateGlobalBufferAndViews(wasmMemory.buffer); + return 1; + } catch (e) { + err("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e); + } +} + +function _emscripten_resize_heap(requestedSize) { + var oldSize = HEAPU8.length; + requestedSize = requestedSize >>> 0; + assert(requestedSize > oldSize); + var maxHeapSize = _emscripten_get_heap_max(); + if (requestedSize > maxHeapSize) { + err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!"); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = emscripten_realloc_buffer(newSize); + if (replacement) { + return true; + } + } + err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!"); + return false; +} + +var ENV = {}; + +function getExecutableName() { + return thisProgram || "./this.program"; +} + +function getEnvStrings() { + if (!getEnvStrings.strings) { + var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(x + "=" + env[x]); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +} + +function _environ_get(__environ, environ_buf) { + var bufSize = 0; + getEnvStrings().forEach(function(string, i) { + var ptr = environ_buf + bufSize; + SAFE_HEAP_STORE(__environ + i * 4 | 0, ptr | 0, 4); + writeAsciiToMemory(string, ptr); + bufSize += string.length + 1; + }); + return 0; +} + +function _environ_sizes_get(penviron_count, penviron_buf_size) { + var strings = getEnvStrings(); + SAFE_HEAP_STORE(penviron_count | 0, strings.length | 0, 4); + var bufSize = 0; + strings.forEach(function(string) { + bufSize += string.length + 1; + }); + SAFE_HEAP_STORE(penviron_buf_size | 0, bufSize | 0, 4); + return 0; +} + +function _exit(status) { + exit(status); +} + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_fdstat_get(fd, pbuf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4; + SAFE_HEAP_STORE(pbuf | 0, type | 0, 1); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var HIGH_OFFSET = 4294967296; + var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0); + var DOUBLE_LIMIT = 9007199254740992; + if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) { + return -61; + } + FS.llseek(stream, offset, whence); + tempI64 = [ stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], + SAFE_HEAP_STORE(newOffset | 0, tempI64[0] | 0, 4), SAFE_HEAP_STORE(newOffset + 4 | 0, tempI64[1] | 0, 4); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doWritev(stream, iov, iovcnt); + SAFE_HEAP_STORE(pnum | 0, num | 0, 4); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } +} + +function _proc_exit(code) { + procExit(code); +} + +function _setTempRet0(val) { + setTempRet0(val); +} + +function _time(ptr) { + var ret = Date.now() / 1e3 | 0; + if (ptr) { + SAFE_HEAP_STORE(ptr | 0, ret | 0, 4); + } + return ret; +} + +var FSNode = function(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; +}; + +var readMode = 292 | 73; + +var writeMode = 146; + +Object.defineProperties(FSNode.prototype, { + read: { + get: function() { + return (this.mode & readMode) === readMode; + }, + set: function(val) { + val ? this.mode |= readMode : this.mode &= ~readMode; + } + }, + write: { + get: function() { + return (this.mode & writeMode) === writeMode; + }, + set: function(val) { + val ? this.mode |= writeMode : this.mode &= ~writeMode; + } + }, + isFolder: { + get: function() { + return FS.isDir(this.mode); + } + }, + isDevice: { + get: function() { + return FS.isChrdev(this.mode); + } + } +}); + +FS.FSNode = FSNode; + +FS.staticInit(); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var ASSERTIONS = true; + +function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +} + +function intArrayToString(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + var chr = array[i]; + if (chr > 255) { + if (ASSERTIONS) { + assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF."); + } + chr &= 255; + } + ret.push(String.fromCharCode(chr)); + } + return ret.join(""); +} + +var decodeBase64 = typeof atob == "function" ? atob : function(input) { + var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + do { + enc1 = keyStr.indexOf(input.charAt(i++)); + enc2 = keyStr.indexOf(input.charAt(i++)); + enc3 = keyStr.indexOf(input.charAt(i++)); + enc4 = keyStr.indexOf(input.charAt(i++)); + chr1 = enc1 << 2 | enc2 >> 4; + chr2 = (enc2 & 15) << 4 | enc3 >> 2; + chr3 = (enc3 & 3) << 6 | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 !== 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output = output + String.fromCharCode(chr3); + } + } while (i < input.length); + return output; +}; + +function intArrayFromBase64(s) { + if (typeof ENVIRONMENT_IS_NODE == "boolean" && ENVIRONMENT_IS_NODE) { + var buf = Buffer.from(s, "base64"); + return new Uint8Array(buf["buffer"], buf["byteOffset"], buf["byteLength"]); + } + try { + var decoded = decodeBase64(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0; i < decoded.length; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; + } catch (_) { + throw new Error("Converting base64 string to bytes failed."); + } +} + +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} + +var asmLibraryArg = { + "__assert_fail": ___assert_fail, + "__clock_gettime": ___clock_gettime, + "__syscall_chmod": ___syscall_chmod, + "__syscall_faccessat": ___syscall_faccessat, + "__syscall_fcntl64": ___syscall_fcntl64, + "__syscall_fstat64": ___syscall_fstat64, + "__syscall_fstatat64": ___syscall_fstatat64, + "__syscall_getcwd": ___syscall_getcwd, + "__syscall_getgid32": ___syscall_getgid32, + "__syscall_getuid32": ___syscall_getuid32, + "__syscall_ioctl": ___syscall_ioctl, + "__syscall_lstat64": ___syscall_lstat64, + "__syscall_open": ___syscall_open, + "__syscall_readlink": ___syscall_readlink, + "__syscall_stat64": ___syscall_stat64, + "__syscall_unlink": ___syscall_unlink, + "_localtime_js": __localtime_js, + "_tzset_js": __tzset_js, + "abort": _abort, + "alignfault": alignfault, + "emscripten_console_error": _emscripten_console_error, + "emscripten_memcpy_big": _emscripten_memcpy_big, + "emscripten_resize_heap": _emscripten_resize_heap, + "environ_get": _environ_get, + "environ_sizes_get": _environ_sizes_get, + "exit": _exit, + "fd_close": _fd_close, + "fd_fdstat_get": _fd_fdstat_get, + "fd_read": _fd_read, + "fd_seek": _fd_seek, + "fd_write": _fd_write, + "proc_exit": _proc_exit, + "segfault": segfault, + "setTempRet0": _setTempRet0, + "time": _time +}; + +var asm = createWasm(); + +var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors"); + +var _free = Module["_free"] = createExportWrapper("free"); + +var _main = Module["_main"] = createExportWrapper("main"); + +var _malloc = Module["_malloc"] = createExportWrapper("malloc"); + +var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location"); + +var _sbrk = Module["_sbrk"] = createExportWrapper("sbrk"); + +var ___stdio_exit = Module["___stdio_exit"] = createExportWrapper("__stdio_exit"); + +var ___funcs_on_exit = Module["___funcs_on_exit"] = createExportWrapper("__funcs_on_exit"); + +var ___dl_seterr = Module["___dl_seterr"] = createExportWrapper("__dl_seterr"); + +var _emscripten_get_sbrk_ptr = Module["_emscripten_get_sbrk_ptr"] = createExportWrapper("emscripten_get_sbrk_ptr"); + +var _emscripten_stack_init = Module["_emscripten_stack_init"] = function() { + return (_emscripten_stack_init = Module["_emscripten_stack_init"] = Module["asm"]["emscripten_stack_init"]).apply(null, arguments); +}; + +var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() { + return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); +}; + +var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = function() { + return (_emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); +}; + +var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() { + return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); +}; + +var stackSave = Module["stackSave"] = createExportWrapper("stackSave"); + +var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore"); + +var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc"); + +var dynCall_viiiiij = Module["dynCall_viiiiij"] = createExportWrapper("dynCall_viiiiij"); + +var dynCall_viiiiji = Module["dynCall_viiiiji"] = createExportWrapper("dynCall_viiiiji"); + +var dynCall_viiiijiij = Module["dynCall_viiiijiij"] = createExportWrapper("dynCall_viiiijiij"); + +var dynCall_viiiij = Module["dynCall_viiiij"] = createExportWrapper("dynCall_viiiij"); + +var dynCall_jii = Module["dynCall_jii"] = createExportWrapper("dynCall_jii"); + +var dynCall_vji = Module["dynCall_vji"] = createExportWrapper("dynCall_vji"); + +var dynCall_iji = Module["dynCall_iji"] = createExportWrapper("dynCall_iji"); + +var dynCall_ijiii = Module["dynCall_ijiii"] = createExportWrapper("dynCall_ijiii"); + +var dynCall_viji = Module["dynCall_viji"] = createExportWrapper("dynCall_viji"); + +var dynCall_ijjii = Module["dynCall_ijjii"] = createExportWrapper("dynCall_ijjii"); + +var dynCall_ji = Module["dynCall_ji"] = createExportWrapper("dynCall_ji"); + +var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji"); + +var dynCall_iiiiiijjjiii = Module["dynCall_iiiiiijjjiii"] = createExportWrapper("dynCall_iiiiiijjjiii"); + +var dynCall_iiijiiii = Module["dynCall_iiijiiii"] = createExportWrapper("dynCall_iiijiiii"); + +var dynCall_jj = Module["dynCall_jj"] = createExportWrapper("dynCall_jj"); + +var dynCall_jjj = Module["dynCall_jjj"] = createExportWrapper("dynCall_jjj"); + +var dynCall_iijj = Module["dynCall_iijj"] = createExportWrapper("dynCall_iijj"); + +var dynCall_iijji = Module["dynCall_iijji"] = createExportWrapper("dynCall_iijji"); + +var dynCall_iiijji = Module["dynCall_iiijji"] = createExportWrapper("dynCall_iiijji"); + +var dynCall_iijii = Module["dynCall_iijii"] = createExportWrapper("dynCall_iijii"); + +var dynCall_iiiiiiji = Module["dynCall_iiiiiiji"] = createExportWrapper("dynCall_iiiiiiji"); + +var dynCall_iiij = Module["dynCall_iiij"] = createExportWrapper("dynCall_iiij"); + +var dynCall_iiiij = Module["dynCall_iiiij"] = createExportWrapper("dynCall_iiiij"); + +var dynCall_iij = Module["dynCall_iij"] = createExportWrapper("dynCall_iij"); + +var dynCall_jiij = Module["dynCall_jiij"] = createExportWrapper("dynCall_jiij"); + +var dynCall_iiji = Module["dynCall_iiji"] = createExportWrapper("dynCall_iiji"); + +var dynCall_iiijiijii = Module["dynCall_iiijiijii"] = createExportWrapper("dynCall_iiijiijii"); + +var dynCall_iiiijj = Module["dynCall_iiiijj"] = createExportWrapper("dynCall_iiiijj"); + +var dynCall_iiiijiiii = Module["dynCall_iiiijiiii"] = createExportWrapper("dynCall_iiiijiiii"); + +var dynCall_iiiiijiiii = Module["dynCall_iiiiijiiii"] = createExportWrapper("dynCall_iiiiijiiii"); + +var dynCall_ijii = Module["dynCall_ijii"] = createExportWrapper("dynCall_ijii"); + +var dynCall_iiiijiji = Module["dynCall_iiiijiji"] = createExportWrapper("dynCall_iiiijiji"); + +var dynCall_iijjii = Module["dynCall_iijjii"] = createExportWrapper("dynCall_iijjii"); + +var dynCall_jjii = Module["dynCall_jjii"] = createExportWrapper("dynCall_jjii"); + +var dynCall_jiii = Module["dynCall_jiii"] = createExportWrapper("dynCall_jiii"); + +var dynCall_jiiiii = Module["dynCall_jiiiii"] = createExportWrapper("dynCall_jiiiii"); + +var dynCall_iiiiiijiiii = Module["dynCall_iiiiiijiiii"] = createExportWrapper("dynCall_iiiiiijiiii"); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) Module["intArrayFromString"] = (() => abort("'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) Module["intArrayToString"] = (() => abort("'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ccall")) Module["ccall"] = (() => abort("'ccall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) Module["cwrap"] = (() => abort("'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setValue")) Module["setValue"] = (() => abort("'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getValue")) Module["getValue"] = (() => abort("'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocate")) Module["allocate"] = (() => abort("'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) Module["UTF8ArrayToString"] = (() => abort("'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) Module["UTF8ToString"] = (() => abort("'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) Module["stringToUTF8Array"] = (() => abort("'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8")) Module["stringToUTF8"] = (() => abort("'stringToUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF8")) Module["lengthBytesUTF8"] = (() => abort("'lengthBytesUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) Module["addOnPreRun"] = (() => abort("'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) Module["addOnInit"] = (() => abort("'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) Module["addOnPreMain"] = (() => abort("'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) Module["addOnExit"] = (() => abort("'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) Module["addOnPostRun"] = (() => abort("'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) Module["writeStringToMemory"] = (() => abort("'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) Module["writeArrayToMemory"] = (() => abort("'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) Module["writeAsciiToMemory"] = (() => abort("'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["addRunDependency"] = addRunDependency; + +Module["removeRunDependency"] = removeRunDependency; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) Module["FS_createFolder"] = (() => abort("'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createPath"] = FS.createPath; + +Module["FS_createDataFile"] = FS.createDataFile; + +Module["FS_createPreloadedFile"] = FS.createPreloadedFile; + +Module["FS_createLazyFile"] = FS.createLazyFile; + +if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) Module["FS_createLink"] = (() => abort("'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS_createDevice"] = FS.createDevice; + +Module["FS_unlink"] = FS.unlink; + +if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) Module["getLEB"] = (() => abort("'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) Module["getFunctionTables"] = (() => abort("'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) Module["alignFunctionTables"] = (() => abort("'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) Module["registerFunctions"] = (() => abort("'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) Module["addFunction"] = (() => abort("'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) Module["removeFunction"] = (() => abort("'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) Module["prettyPrint"] = (() => abort("'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) Module["getCompilerSetting"] = (() => abort("'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "print")) Module["print"] = (() => abort("'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "printErr")) Module["printErr"] = (() => abort("'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) Module["getTempRet0"] = (() => abort("'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) Module["setTempRet0"] = (() => abort("'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callMain")) Module["callMain"] = (() => abort("'callMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "abort")) Module["abort"] = (() => abort("'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) Module["keepRuntimeAlive"] = (() => abort("'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) Module["zeroMemory"] = (() => abort("'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringToNewUTF8"] = (() => abort("'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = (() => abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = (() => abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) Module["withStackSave"] = (() => abort("'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = (() => abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = (() => abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = (() => abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) Module["inetPton4"] = (() => abort("'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) Module["inetNtop4"] = (() => abort("'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) Module["inetPton6"] = (() => abort("'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) Module["inetNtop6"] = (() => abort("'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) Module["readSockaddr"] = (() => abort("'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) Module["writeSockaddr"] = (() => abort("'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "DNS")) Module["DNS"] = (() => abort("'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) Module["getHostByName"] = (() => abort("'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) Module["Protocols"] = (() => abort("'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = (() => abort("'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = (() => abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = (() => abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertFrameToPC")) Module["convertFrameToPC"] = (() => abort("'convertFrameToPC' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = (() => abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "saveInUnwindCache")) Module["saveInUnwindCache"] = (() => abort("'saveInUnwindCache' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertPCtoSourceLocation")) Module["convertPCtoSourceLocation"] = (() => abort("'convertPCtoSourceLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = (() => abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = (() => abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = (() => abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) Module["jstoi_q"] = (() => abort("'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) Module["jstoi_s"] = (() => abort("'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) Module["getExecutableName"] = (() => abort("'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) Module["listenOnce"] = (() => abort("'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) Module["autoResumeAudioContext"] = (() => abort("'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLegacy"] = (() => abort("'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = (() => abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = (() => abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = (() => abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) Module["wasmTableMirror"] = (() => abort("'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) Module["setWasmTableEntry"] = (() => abort("'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) Module["getWasmTableEntry"] = (() => abort("'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "handleException")) Module["handleException"] = (() => abort("'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = (() => abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = (() => abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) Module["callUserCallback"] = (() => abort("'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) Module["maybeExit"] = (() => abort("'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) Module["safeSetTimeout"] = (() => abort("'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) Module["asmjsMangle"] = (() => abort("'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) Module["asyncLoad"] = (() => abort("'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) Module["alignMemory"] = (() => abort("'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) Module["mmapAlloc"] = (() => abort("'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) Module["reallyNegative"] = (() => abort("'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "unSign")) Module["unSign"] = (() => abort("'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "reSign")) Module["reSign"] = (() => abort("'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "formatString")) Module["formatString"] = (() => abort("'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH")) Module["PATH"] = (() => abort("'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) Module["PATH_FS"] = (() => abort("'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) Module["SYSCALLS"] = (() => abort("'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) Module["getSocketFromFD"] = (() => abort("'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) Module["getSocketAddress"] = (() => abort("'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) Module["JSEvents"] = (() => abort("'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) Module["registerKeyEventCallback"] = (() => abort("'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) Module["specialHTMLTargets"] = (() => abort("'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) Module["maybeCStringToJsString"] = (() => abort("'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) Module["findEventTarget"] = (() => abort("'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) Module["findCanvasEventTarget"] = (() => abort("'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) Module["getBoundingClientRect"] = (() => abort("'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) Module["fillMouseEventData"] = (() => abort("'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) Module["registerMouseEventCallback"] = (() => abort("'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) Module["registerWheelEventCallback"] = (() => abort("'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) Module["registerUiEventCallback"] = (() => abort("'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) Module["registerFocusEventCallback"] = (() => abort("'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData")) Module["fillDeviceOrientationEventData"] = (() => abort("'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceOrientationEventCallback")) Module["registerDeviceOrientationEventCallback"] = (() => abort("'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) Module["fillDeviceMotionEventData"] = (() => abort("'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceMotionEventCallback")) Module["registerDeviceMotionEventCallback"] = (() => abort("'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) Module["screenOrientation"] = (() => abort("'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData")) Module["fillOrientationChangeEventData"] = (() => abort("'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerOrientationChangeEventCallback")) Module["registerOrientationChangeEventCallback"] = (() => abort("'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData")) Module["fillFullscreenChangeEventData"] = (() => abort("'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerFullscreenChangeEventCallback")) Module["registerFullscreenChangeEventCallback"] = (() => abort("'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) Module["registerRestoreOldStyle"] = (() => abort("'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "hideEverythingExceptGivenElement")) Module["hideEverythingExceptGivenElement"] = (() => abort("'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) Module["restoreHiddenElements"] = (() => abort("'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) Module["setLetterbox"] = (() => abort("'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) Module["currentFullscreenStrategy"] = (() => abort("'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) Module["restoreOldWindowedStyle"] = (() => abort("'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "softFullscreenResizeWebGLRenderTarget")) Module["softFullscreenResizeWebGLRenderTarget"] = (() => abort("'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) Module["doRequestFullscreen"] = (() => abort("'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData")) Module["fillPointerlockChangeEventData"] = (() => abort("'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockChangeEventCallback")) Module["registerPointerlockChangeEventCallback"] = (() => abort("'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockErrorEventCallback")) Module["registerPointerlockErrorEventCallback"] = (() => abort("'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) Module["requestPointerLock"] = (() => abort("'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData")) Module["fillVisibilityChangeEventData"] = (() => abort("'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerVisibilityChangeEventCallback")) Module["registerVisibilityChangeEventCallback"] = (() => abort("'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) Module["registerTouchEventCallback"] = (() => abort("'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) Module["fillGamepadEventData"] = (() => abort("'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback")) Module["registerGamepadEventCallback"] = (() => abort("'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBeforeUnloadEventCallback")) Module["registerBeforeUnloadEventCallback"] = (() => abort("'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) Module["fillBatteryEventData"] = (() => abort("'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = (() => abort("'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = (() => abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = (() => abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = (() => abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = (() => abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = (() => abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = (() => abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = (() => abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) Module["getEnvStrings"] = (() => abort("'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) Module["checkWasiClock"] = (() => abort("'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) Module["writeI53ToI64"] = (() => abort("'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) Module["writeI53ToI64Clamped"] = (() => abort("'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) Module["writeI53ToI64Signaling"] = (() => abort("'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) Module["writeI53ToU64Clamped"] = (() => abort("'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) Module["writeI53ToU64Signaling"] = (() => abort("'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53FromI64"] = (() => abort("'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = (() => abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = (() => abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = (() => abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) Module["setImmediateWrapped"] = (() => abort("'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) Module["clearImmediateWrapped"] = (() => abort("'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = (() => abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = (() => abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = (() => abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = (() => abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) Module["ExceptionInfo"] = (() => abort("'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) Module["CatchInfo"] = (() => abort("'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) Module["exception_addRef"] = (() => abort("'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) Module["exception_decRef"] = (() => abort("'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "Browser")) Module["Browser"] = (() => abort("'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) Module["funcWrappers"] = (() => abort("'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = (() => abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) Module["setMainLoop"] = (() => abort("'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "wget")) Module["wget"] = (() => abort("'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["FS"] = FS; + +if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) Module["MEMFS"] = (() => abort("'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "TTY")) Module["TTY"] = (() => abort("'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) Module["PIPEFS"] = (() => abort("'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) Module["SOCKFS"] = (() => abort("'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) Module["_setNetworkCallback"] = (() => abort("'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) Module["tempFixedLengthArray"] = (() => abort("'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) Module["miniTempWebGLFloatBuffers"] = (() => abort("'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) Module["heapObjectForWebGLType"] = (() => abort("'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) Module["heapAccessShiftForWebGLHeap"] = (() => abort("'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GL")) Module["GL"] = (() => abort("'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) Module["emscriptenWebGLGet"] = (() => abort("'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize")) Module["computeUnpackAlignedImageSize"] = (() => abort("'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData")) Module["emscriptenWebGLGetTexPixelData"] = (() => abort("'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) Module["emscriptenWebGLGetUniform"] = (() => abort("'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) Module["webglGetUniformLocation"] = (() => abort("'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglPrepareUniformLocationsBeforeFirstUse")) Module["webglPrepareUniformLocationsBeforeFirstUse"] = (() => abort("'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) Module["webglGetLeftBracePos"] = (() => abort("'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib")) Module["emscriptenWebGLGetVertexAttrib"] = (() => abort("'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) Module["writeGLArray"] = (() => abort("'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AL")) Module["AL"] = (() => abort("'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) Module["SDL_unicode"] = (() => abort("'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) Module["SDL_ttfContext"] = (() => abort("'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) Module["SDL_audio"] = (() => abort("'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL")) Module["SDL"] = (() => abort("'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) Module["SDL_gfx"] = (() => abort("'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) Module["GLUT"] = (() => abort("'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "EGL")) Module["EGL"] = (() => abort("'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) Module["GLFW_Window"] = (() => abort("'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) Module["GLFW"] = (() => abort("'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) Module["GLEW"] = (() => abort("'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) Module["IDBStore"] = (() => abort("'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) Module["runAndAbortIfError"] = (() => abort("'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) Module["warnOnce"] = (() => abort("'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) Module["stackSave"] = (() => abort("'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) Module["stackRestore"] = (() => abort("'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) Module["stackAlloc"] = (() => abort("'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) Module["AsciiToString"] = (() => abort("'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) Module["stringToAscii"] = (() => abort("'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) Module["UTF16ToString"] = (() => abort("'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) Module["stringToUTF16"] = (() => abort("'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) Module["lengthBytesUTF16"] = (() => abort("'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) Module["UTF32ToString"] = (() => abort("'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) Module["stringToUTF32"] = (() => abort("'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) Module["lengthBytesUTF32"] = (() => abort("'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) Module["allocateUTF8"] = (() => abort("'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) Module["allocateUTF8OnStack"] = (() => abort("'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)")); + +Module["writeStackCookie"] = writeStackCookie; + +Module["checkStackCookie"] = checkStackCookie; + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) Object.defineProperty(Module, "ALLOC_NORMAL", { + configurable: true, + get: function() { + abort("'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) Object.defineProperty(Module, "ALLOC_STACK", { + configurable: true, + get: function() { + abort("'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"); + } +}); + +var calledRun; + +function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; +} + +var calledMain = false; + +// dependenciesFulfilled = function runCaller() { +// if (!calledRun) run(); +// if (!calledRun) dependenciesFulfilled = runCaller; +// }; + +function callMain(args) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(__ATPRERUN__.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = Module["_main"]; + args = args || []; + var argc = args.length + 1; + var argv = stackAlloc((argc + 1) * 4); + SAFE_HEAP_STORE((argv >> 2) * 4, allocateUTF8OnStack(thisProgram), 4); + for (var i = 1; i < argc; i++) { + SAFE_HEAP_STORE(((argv >> 2) + i) * 4, allocateUTF8OnStack(args[i - 1]), 4); + } + SAFE_HEAP_STORE(((argv >> 2) + argc) * 4, 0, 4); + try { + var ret = entryFunction(argc, argv); + exit(ret, true); + return ret; + } catch (e) { + return handleException(e); + } finally { + calledMain = true; + } +} + +function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); +} + +function run(args) { + shouldRunNow = true; + args = args || arguments_; + if (runDependencies > 0) { + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + if (args[2].includes(".o")) { // Disassemble library + FS.writeFile("./" + args[2], args[0]); + islib32 = 1; + }else { + FS.writeFile("./input.elf", args[0]); + } + args.shift(); + preMain(); + // readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + if (shouldRunNow) callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function() { + setTimeout(function() { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); +} + +Module["run"] = run; + +function exit(status, implicit) { + EXITSTATUS = status; + if (keepRuntimeAlive()) { + if (!implicit) { + var msg = "program exited (with status: " + status + "), but keepRuntimeAlive() is set (counter=" + runtimeKeepaliveCounter + ") due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)"; + readyPromiseReject(msg); + err(msg); + } + } else { + exitRuntime(); + } + islib32 = 0; + procExit(status); +} + +function procExit(code) { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +var shouldRunNow = false; + +if (Module["noInitialRun"]) shouldRunNow = false; + +// run(); + readyPromiseResolve(Module); + + return Module.ready +} +); +})(); +export default Module; \ No newline at end of file diff --git a/src/core/assembler/sailAssembler/web/wasm/objdump.wasm b/src/core/assembler/sailAssembler/web/wasm/objdump.wasm new file mode 100755 index 000000000..c4d5dcc3a Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/objdump.wasm differ diff --git a/src/core/assembler/sailAssembler/web/wasm/objdump64.js b/src/core/assembler/sailAssembler/web/wasm/objdump64.js new file mode 100644 index 000000000..8f3360ae6 --- /dev/null +++ b/src/core/assembler/sailAssembler/web/wasm/objdump64.js @@ -0,0 +1,5114 @@ + +export var dumptextinstructions64 = []; +export var dumpdatainstructions64 = []; +export var dumplabels64 = []; +export var sectionasm64 = 0; +export var inside_label64 = 0; +export var islib64 = 0; +export var libtags64 = []; +// export var entry_elf = 0; +var Module = (() => { + var _scriptName = import.meta.url; + + return ( +async function(moduleArg = {}) { + var moduleRtn; + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(moduleArg) => Promise +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; + +var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == "object"; + +var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined"; + +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer"; + +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (ENVIRONMENT_IS_NODE) { + // When building an ES module `require` is not normally available. + // We need to use `createRequire()` to construct the require()` function. + const {createRequire} = await import("module"); + /** @suppress{duplicate} */ var require = createRequire(import.meta.url); +} + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; + +var thisProgram = "./this.program"; + +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ""; + +function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var readAsync, readBinary; + +if (ENVIRONMENT_IS_NODE) { + if (typeof process == "undefined" || !process.release || process.release.name !== "node") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + var nodeVersion = process.versions.node; + var numericVersion = nodeVersion.split(".").slice(0, 3); + numericVersion = (numericVersion[0] * 1e4) + (numericVersion[1] * 100) + (numericVersion[2].split("-")[0] * 1); + var minVersion = 23e4; + if (numericVersion < 23e4) { + throw new Error("This emscripten-generated code requires node v23.0.0 (detected v" + nodeVersion + ")"); + } + // These modules will usually be used on Node.js. Load them eagerly to avoid + // the complexity of lazy-loading. + var fs = require("fs"); + var nodePath = require("path"); + // EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url, + // since there's no way getting the current absolute path of the module when + // support for that is not available. + if (!import.meta.url.startsWith("data:")) { + scriptDirectory = nodePath.dirname(require("url").fileURLToPath(import.meta.url)) + "/"; + } + // include: node_shell_read.js + readBinary = filename => { + // We need to re-wrap `file://` strings to URLs. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename); + assert(Buffer.isBuffer(ret)); + return ret; + }; + readAsync = async (filename, binary = true) => { + // See the comment in the `readBinary` function. + filename = isFileURI(filename) ? new URL(filename) : filename; + var ret = fs.readFileSync(filename, binary ? undefined : "utf8"); + assert(binary ? Buffer.isBuffer(ret) : typeof ret == "string"); + return ret; + }; + // end include: node_shell_read.js + if (!Module["thisProgram"] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, "/"); + } + arguments_ = process.argv.slice(2); + // MODULARIZE will export the module in the proper place outside, we don't need to export here + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; +} else if (ENVIRONMENT_IS_SHELL) { + if ((typeof process == "object" && typeof require === "function") || typeof window == "object" || typeof WorkerGlobalScope != "undefined") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); +} else // Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (_scriptName) { + scriptDirectory = _scriptName; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); + } + if (!(typeof window == "object" || typeof WorkerGlobalScope != "undefined")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); + { + // include: web_or_worker_shell_read.js + if (ENVIRONMENT_IS_WORKER) { + readBinary = url => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response)); + }; + } + readAsync = async url => { + // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url. + // See https://github.com/github/fetch/pull/92#issuecomment-140665932 + // Cordova or Electron apps are typically loaded from a file:// url. + // So use XHR on webview if URL is a file URL. + if (isFileURI(url)) { + return new Promise((resolve, reject) => { + var xhr = new XMLHttpRequest; + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + // file URLs can return 0 + resolve(xhr.response); + return; + } + reject(xhr.status); + }; + xhr.onerror = reject; + xhr.send(null); + }); + } + var response = await fetch(url, { + credentials: "same-origin" + }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } +} else { + throw new Error("environment detection error"); +} + + + Module['print'] = function (message) { + + if (islib64) { + // Regex to get name function + if (sectionasm64 === 1){ + const name_function = message.match(/^([0-9a-f]{16})\s+<(.+?)>:$/); + libtags64.push(name_function[2]); + } + + // Check which section + if (message.search(".text") != -1) + sectionasm64 = 1; + if (message.search(".data") != -1) + sectionasm64 = 2; + if (message.search(".riscv.attributes") != -1) + sectionasm64 = 0; + + + } else { + + // console.log(typeof message); + + // console.log("En que seccion estoy: ", sectionasm64); + var auxinsn = []; + const auxiliar = message.trim(); + const datamatch = auxiliar.match(/^([0-9a-fA-F]+):\s+((?:[0-9a-fA-F]{2,8}(?:\s+[0-9a-fA-F]{2,8})*))(?:.*?0x([0-9a-fA-F]+))?/); // /^([0-9a-fA-F]+):.*?0x([0-9a-fA-F]+)/ + const insnmatch = auxiliar.match(/^(\w+):\s+((?:fnmadd\.s|\w+|\.\w+))\s+([^\#]*)(?:#(.*))?$/); // /^(\w+):\s+(\w+)\s+([^\#]*)(?:#(.*))?$/ + const labelmatch = auxiliar.match(/^([0-9a-f]{16})\s+<(.+?)>:$/); + if (insnmatch !== null && sectionasm64 === 1) { + const address = parseInt(insnmatch[1].trim(), 16).toString(16)//(insnmatch[1].trim().replace(/0+/,"") === "") ? "0" : insnmatch[1].trim().replace(/0+/,""); // Parte 1: dirección + const hexInstruction = insnmatch[2].trim(); // Parte 2: instrucción hexadecimal + const asmInstruction = (insnmatch[3].trim()).replace(/\\t/g, ' '); // Parte 3: instrucción ensamblador (sin el comentario) + // const comment = match[4] ? insnmatchmatch[4].trim() : null; // Parte 4: comentario (opcional) + let axx = dumptextinstructions64.findIndex(sublist => sublist.includes(address)); + if (axx != -1 && sectionasm64 === 1) { + dumptextinstructions64[axx][1] = hexInstruction; + dumptextinstructions64[axx][2] = asmInstruction.replace(/\\t/g, ' '); + } + else if (sectionasm64 === 1){ + auxinsn.push(address); + auxinsn.push(hexInstruction); + auxinsn.push(asmInstruction.replace(/\\t/g, ' ')); + auxinsn.push(0); + auxinsn.push(""); + dumptextinstructions64.push(auxinsn); + } + } + else if (datamatch !== null && sectionasm64 === 2){ + let axx = dumpdatainstructions64.findIndex(sublist => sublist.includes(datamatch[1])); + if (axx !== -1 && sectionasm64 === 2) { + dumpdatainstructions64[axx][1] = datamatch[2]; + dumpdatainstructions64[axx][2] = ""; // asmInstruction.replace(/\\t/g, ' '); + } + else if (sectionasm64 === 2) { + auxinsn.push(datamatch[1]); + auxinsn.push(datamatch[2]); + auxinsn.push(""/*asmInstruction.replace(/\\t/g, ' ')*/); + auxinsn.push(0); + auxinsn.push(""); + if(auxinsn[3] === 0){ + // console.log("Exaa que se va a insertar en un dumpdata anterior: ", auxinsn); + // console.log("Que es esto: ", /[^0-9a-fA-F]/.test(auxinsn[1])); + if(/[^0-9a-fA-F]/.test(auxinsn[1])/* auxinsn[1].includes("madd.s")*/){ + //buscamos la palabra completa almacenada por el list_data_instructions + var auxda = list_data_instructions.findIndex(data => data.label === dumpdatainstructions64[dumpdatainstructions64.length -1][4]); + var list_data_elem; + var aux_index_value = list_data_instructions[auxda].value.length; + if (typeof list_data_instructions[auxda].value === "object"){ + if (list_data_instructions[auxda].value[aux_index_value - 1].includes("-")){ + // caso de ser el valor negativo + let buff, buff_view; + switch (list_data_instructions[auxda].type){ + case "half": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) & 0xFFFF).toString(16).padStart(4, "0"); + break; + case "word": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) >>> 0).toString(16).padStart(8, "0"); + break; + case "byte": + list_data_elem = (parseInt(list_data_instructions[auxda].value[aux_index_value - 1]) & 0xFF).toString(16).padStart(2, "0"); + break; + case "float": + buff = new ArrayBuffer(4); + buff_view = new DataView(buff); + buff_view.setFloat32(0, parseFloat(list_data_instructions[auxda].value[aux_index_value - 1]), true); + list_data_elem = buff_view.getUint32(0, true).toString(16).padStart(8, '0'); + + // list_data_elem = (parseFloat(list_data_instructions[auxda].value[aux_index_value - 1])).toString(16); + break; + case "double": + buff = new ArrayBuffer(8); + buff_view = new DataView(buff); + buff_view.setFloat64(0, parseFloat(list_data_instructions[auxda].value[aux_index_value - 1]), true); + let lo = buff_view.getUint32(0, true).toString(16).padStart(8, '0'); + let hi = buff_view.getUint32(4, true).toString(16).padStart(8, '0'); + + list_data_elem = lo + hi; + break; + } + dumpdatainstructions64[dumpdatainstructions64.length - 1][1] = list_data_elem + dumpdatainstructions64[dumpdatainstructions64.length -1][1]; + }else { // Caso de ser el valor positivo o sin signo + dumpdatainstructions64[dumpdatainstructions64.length -1][1] = list_data_instructions[auxda].value[aux_index_value - 1].toString(16) + dumpdatainstructions64[dumpdatainstructions64.length -1][1]; + } + } + } + else dumpdatainstructions64[dumpdatainstructions64.length -1][1] = auxinsn[1] + dumpdatainstructions64[dumpdatainstructions64.length -1][1]; + inside_label64 += 1; + }else + dumpdatainstructions64.push(auxinsn); + } + } + else if(labelmatch && sectionasm64 != 0){ + // console.log("Identificado:", labelmatch); + auxinsn.push((labelmatch[1].trim().replace(/0+/,"") === "") ? "0" : labelmatch[1].trim().replace(/0+/,"")); + auxinsn.push(""); + auxinsn.push(""); + auxinsn.push(1); + auxinsn.push(labelmatch[2].trim()); + console.log("labelmatch: ", labelmatch); + if (!document.app.$data.c_kernel && labelmatch[2].trim().includes("kernel")) + document.app.$data.entry_elf = parseInt(labelmatch[1].trim(), 16).toString(16); // (labelmatch[1].trim().replace(/0+/,"") === "") ? "0" : labelmatch[1].trim().replace(/0+/,""); + else if(labelmatch[2].trim() === "_main" && document.app.$data.c_kernel){ + document.app.$data.entry_elf = parseInt(labelmatch[1].trim(), 16).toString(16); // (labelmatch[1].trim().replace(/0+/,"") === "") ? "0" : labelmatch[1].trim().replace(/0+/,""); + } + + if (document.app.$data.entry_elf !== undefined && !document.app.$data.entry_elf.startsWith("0x")) + document.app.$data.entry_elf = "0x" + document.app.$data.entry_elf; + + if (sectionasm64 === 1){ + dumptextinstructions64.push(auxinsn); + }else if (sectionasm64 === 2){ + dumpdatainstructions64.push(auxinsn); + inside_label64 = 0; + } + + } + + // else { + // // console.log("objdump: 1", message); + // } + + // identificacion de que seccion de codigo entramos. + if (message.search(".text") != -1) + sectionasm64 = 1; + if (message.search(".data") != -1) + sectionasm64 = 2; + if (message.search(".riscv.attributes") != -1) + sectionasm64 = 0; + + console.log(message); + // console.log(dumpdatainstructions64); + } + + } + + var out = Module["print"] || console.log.bind(console); + + var err = Module["printErr"] || console.warn.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); + +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used. +moduleOverrides = null; + +checkIncomingModuleAPI(); + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. +if (Module["arguments"]) arguments_ = Module["arguments"]; + +legacyModuleProp("arguments", "arguments_"); + +if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + +legacyModuleProp("thisProgram", "thisProgram"); + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// Assertions on removed incoming Module JS APIs. +assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); + +assert(typeof Module["read"] == "undefined", "Module.read option was removed"); + +assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); + +assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); + +assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"); + +assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); + +legacyModuleProp("asm", "wasmExports"); + +legacyModuleProp("readAsync", "readAsync"); + +legacyModuleProp("readBinary", "readBinary"); + +legacyModuleProp("setWindowTitle", "setWindowTitle"); + +var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js"; + +var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js"; + +var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js"; + +var FETCHFS = "FETCHFS is no longer included by default; build with -lfetchfs.js"; + +var ICASEFS = "ICASEFS is no longer included by default; build with -licasefs.js"; + +var JSFILEFS = "JSFILEFS is no longer included by default; build with -ljsfilefs.js"; + +var OPFS = "OPFS is no longer included by default; build with -lopfs.js"; + +var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js"; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable."); + +// end include: shell.js +// include: preamble.js +// === Preamble library stuff === +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html +var wasmBinary = Module["wasmBinary"]; + +legacyModuleProp("wasmBinary", "wasmBinary"); + +if (typeof WebAssembly != "object") { + err("no native wasm support detected"); +} + +// Wasm globals +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we +// don't define it at all in release modes. This matches the behaviour of +// MINIMAL_RUNTIME. +// TODO(sbc): Make this the default even without STRICT enabled. +/** @type {function(*, string=)} */ function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } +} + +// We used to include malloc/free by default in the past. Show a helpful error in +// builds with assertions. +function _malloc() { + abort("malloc() called but not included in the build - add `_malloc` to EXPORTED_FUNCTIONS"); +} + +function _free() { + // Show a helpful error since we used to include free by default in the past. + abort("free() called but not included in the build - add `_free` to EXPORTED_FUNCTIONS"); +} + +// Memory management +var HEAP, /** @type {!Int8Array} */ HEAP8, /** @type {!Uint8Array} */ HEAPU8, /** @type {!Int16Array} */ HEAP16, /** @type {!Uint16Array} */ HEAPU16, /** @type {!Int32Array} */ HEAP32, /** @type {!Uint32Array} */ HEAPU32, /** @type {!Float32Array} */ HEAPF32, /* BigInt64Array type is not correctly defined in closure +/** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure +/** not-t@type {!BigUint64Array} */ HEAPU64, /** @type {!Float64Array} */ HEAPF64; + +var runtimeInitialized = false; + +var runtimeExited = false; + +/** + * Indicates whether filename is delivered via file protocol (as opposed to http/https) + * @noinline + */ var isFileURI = filename => filename.startsWith("file://"); + +// include: runtime_shared.js +// include: runtime_stack_check.js +// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + // If the stack ends at address zero we write our cookies 4 bytes into the + // stack. This prevents interference with SAFE_HEAP and ASAN which also + // monitor writes to address zero. + if (max == 0) { + max += 4; + } + // The stack grow downwards towards _emscripten_stack_get_end. + // We write cookies to the final two words in the stack and detect if they are + // ever overwritten. + SAFE_HEAP_STORE(((max) / 4) * 4, 34821223, 4); + SAFE_HEAP_STORE((((max) + (4)) / 4) * 4, 2310721022, 4); +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + // See writeStackCookie(). + if (max == 0) { + max += 4; + } + var cookie1 = SAFE_HEAP_LOAD(((max) / 4) * 4, 4, 1); + var cookie2 = SAFE_HEAP_LOAD((((max) + (4)) / 4) * 4, 4, 1); + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`); + } +} + +// end include: runtime_stack_check.js +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +// include: runtime_debug.js +// Endianness check +(() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; +})(); + +if (Module["ENVIRONMENT"]) { + throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"); +} + +function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : ""; + abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra); + } + }); + } +} + +function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`); + } +} + +// forcing the filesystem exports a few things by default +function isExportedByForceFilesystem(name) { + return name === "FS_createPath" || name === "FS_createDataFile" || name === "FS_createPreloadedFile" || name === "FS_unlink" || name === "addRunDependency" || // The old FS has some functionality that WasmFS lacks. + name === "FS_createLazyFile" || name === "FS_createDevice" || name === "removeRunDependency"; +} + +/** + * Intercept access to a global symbol. This enables us to give informative + * warnings/errors when folks attempt to use symbols they did not include in + * their build, or no symbols that no longer exist. + */ function hookGlobalSymbolAccess(sym, func) { + if (typeof globalThis != "undefined" && !Object.getOwnPropertyDescriptor(globalThis, sym)) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + } + }); + } +} + +function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); +} + +missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + +missingGlobal("asm", "Please use wasmExports instead"); + +function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + // Can't `abort()` here because it would break code that does runtime + // checks. e.g. `if (typeof SDL === 'undefined')`. + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in + // library.js, which means $name for a JS name with no prefix, or name + // for a JS name like _name. + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + // Any symbol that is not included from the JS library is also (by definition) + // not exported on the Module object. + unexportedRuntimeSymbol(sym); +} + +function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + } + }); + } +} + +// Used by XXXXX_DEBUG settings to output debug messages. +function dbg(...args) { + // TODO(sbc): Make this configurable somehow. Its not always convenient for + // logging to show up as warnings. + console.warn(...args); +} + +// end include: runtime_debug.js +// include: memoryprofiler.js +// end include: memoryprofiler.js +// include: runtime_safe_heap.js +/** @param {number|boolean=} isFloat */ function getSafeHeapType(bytes, isFloat) { + switch (bytes) { + case 1: + return "i8"; + + case 2: + return "i16"; + + case 4: + return isFloat ? "float" : "i32"; + + case 8: + return isFloat ? "double" : "i64"; + + default: + abort(`getSafeHeapType() invalid bytes=${bytes}`); + } +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { + if (dest <= 0) abort(`segmentation fault storing ${bytes} bytes to address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error storing to address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when storing ${bytes} bytes to address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + setValue_safe(dest, value, getSafeHeapType(bytes, isFloat)); + return value; +} + +function SAFE_HEAP_STORE_D(dest, value, bytes) { + return SAFE_HEAP_STORE(dest, value, bytes, true); +} + +/** @param {number|boolean=} isFloat */ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) { + if (dest <= 0) abort(`segmentation fault loading ${bytes} bytes from address ${dest}`); + if (dest % bytes !== 0) abort(`alignment error loading from address ${dest}, which was expected to be aligned to a multiple of ${bytes}`); + if (runtimeInitialized && !runtimeExited) { + var brk = _sbrk(0); + if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when loading ${bytes} bytes from address ${dest}. DYNAMICTOP=${brk}`); + if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`); + // sbrk-managed memory must be above the stack + if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`); + } + var type = getSafeHeapType(bytes, isFloat); + var ret = getValue_safe(dest, type); + if (unsigned) ret = unSign(ret, parseInt(type.slice(1), 10)); + return ret; +} + +function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) { + return SAFE_HEAP_LOAD(dest, bytes, unsigned, true); +} + +function SAFE_FT_MASK(value, mask) { + var ret = value & mask; + if (ret !== value) { + abort(`Function table mask error: function pointer is ${value} which is masked by ${mask}, the likely cause of this is that the function pointer is being called by the wrong type.`); + } + return ret; +} + +function segfault() { + abort("segmentation fault"); +} + +function alignfault() { + abort("alignment fault"); +} + +// end include: runtime_safe_heap.js +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); +} + +// end include: runtime_shared.js +assert(!Module["STACK_SIZE"], "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"); + +assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); + +// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY +assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"); + +assert(!Module["INITIAL_MEMORY"], "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"); + +function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); +} + +function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; +} + +function preMain() { + checkStackCookie(); +} + +function exitRuntime() { + assert(!runtimeExited); + checkStackCookie(); + ___funcs_on_exit(); + // Native atexit() functions + FS.quit(); + TTY.shutdown(); + runtimeExited = true; +} + +function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); +} + +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; + +var dependenciesFulfilled = null; + +// overridden to take different actions when all run dependencies are fulfilled +var runDependencyTracking = {}; + +var runDependencyWatcher = null; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != "undefined") { + // Check for missing dependencies every few seconds + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } +} + +function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } +} + +/** @param {string|number=} what */ function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + ABORT = true; + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + // Suppress closure compiler warning here. Closure compiler's builtin extern + // definition for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +function createExportWrapper(name, nargs) { + return (...args) => { + assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`); + assert(!runtimeExited, `native function \`${name}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled. + assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`); + return f(...args); + }; +} + +var wasmBinaryFile; + +function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("objdump64.wasm"); + } + // Use bundler-friendly `new URL(..., import.meta.url)` pattern; works in browsers too. + return new URL("objdump64.wasm", import.meta.url).href; +} + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; +} + +async function getWasmBinary(binaryFile) { + // If we don't have the binary yet, load it asynchronously using readAsync. + if (!wasmBinary) { + // Fetch the binary using readAsync + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + // Otherwise, getBinarySync should be able to get it synchronously + return getBinarySync(binaryFile); +} + +async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + // Warn on some common problems. + if (isFileURI(wasmBinaryFile)) { + err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`); + } + abort(reason); + } +} + +async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) { + try { + var response = fetch(binaryFile, { + credentials: "same-origin" + }); + var instantiationResult = await WebAssembly.instantiateStreaming(response, imports); + return instantiationResult; + } catch (reason) { + // We expect the most common failure cause to be a bad MIME type for the binary, + // in which case falling back to ArrayBuffer instantiation should work. + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); +} + +function getWasmImports() { + // prepare imports + return { + "env": wasmImports, + "wasi_snapshot_preview1": wasmImports + }; +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +async function createWasm() { + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + // wait for the pthread pool (if any) + addRunDependency("wasm-instantiate"); + // Prefer streaming instantiation if available. + // Async compilation can be confusing when an error on the page overwrites Module + // (for example, if the order of elements is wrong, and the one defining Module is + // later), so we save Module and check it later. + var trueModule = Module; + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"); + trueModule = null; + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + return Promise.reject(e); + } +} + +// === Body === +// end include: preamble.js +class ExitStatus { + name="ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } +} + +var callRuntimeCallbacks = callbacks => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } +}; + +var onPostRuns = []; + +var addOnPostRun = cb => onPostRuns.unshift(cb); + +var onPreRuns = []; + +var addOnPreRun = cb => onPreRuns.unshift(cb); + +/** + * @param {number} ptr + * @param {string} type + */ function getValue(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i8": + return SAFE_HEAP_LOAD(ptr, 1, 0); + + case "i16": + return SAFE_HEAP_LOAD(((ptr) / 2) * 2, 2, 0); + + case "i32": + return SAFE_HEAP_LOAD(((ptr) / 4) * 4, 4, 0); + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return SAFE_HEAP_LOAD_D(((ptr) / 4) * 4, 4, 0); + + case "double": + return SAFE_HEAP_LOAD_D(((ptr) / 8) * 8, 8, 0); + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +function getValue_safe(ptr, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + return HEAP8[ptr]; + + case "i8": + return HEAP8[ptr]; + + case "i16": + return HEAP16[((ptr) / 2)]; + + case "i32": + return HEAP32[((ptr) / 4)]; + + case "i64": + return HEAP64[((ptr) / 8)]; + + case "float": + return HEAPF32[((ptr) / 4)]; + + case "double": + return HEAPF64[((ptr) / 8)]; + + case "*": + return Number(HEAPU64[((ptr) / 8)]); + + default: + abort(`invalid type for getValue: ${type}`); + } +} + +var noExitRuntime = Module["noExitRuntime"] || false; + +var ptrToString = ptr => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); +}; + +/** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ function setValue(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i8": + SAFE_HEAP_STORE(ptr, value, 1); + break; + + case "i16": + SAFE_HEAP_STORE(((ptr) / 2) * 2, value, 2); + break; + + case "i32": + SAFE_HEAP_STORE(((ptr) / 4) * 4, value, 4); + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + SAFE_HEAP_STORE_D(((ptr) / 4) * 4, value, 4); + break; + + case "double": + SAFE_HEAP_STORE_D(((ptr) / 8) * 8, value, 8); + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +function setValue_safe(ptr, value, type = "i8") { + if (type.endsWith("*")) type = "*"; + switch (type) { + case "i1": + HEAP8[ptr] = value; + break; + + case "i8": + HEAP8[ptr] = value; + break; + + case "i16": + HEAP16[((ptr) / 2)] = value; + break; + + case "i32": + HEAP32[((ptr) / 4)] = value; + break; + + case "i64": + HEAP64[((ptr) / 8)] = BigInt(value); + break; + + case "float": + HEAPF32[((ptr) / 4)] = value; + break; + + case "double": + HEAPF64[((ptr) / 8)] = value; + break; + + case "*": + HEAPU64[((ptr) / 8)] = BigInt(value); + break; + + default: + abort(`invalid type for setValue: ${type}`); + } +} + +var stackRestore = val => __emscripten_stack_restore(val); + +var stackSave = () => _emscripten_stack_get_current(); + +var unSign = (value, bits) => { + if (value >= 0) { + return value; + } + // Need some trickery, since if bits == 32, we are right at the limit of the + // bits JS uses in bitshifts + return bits <= 32 ? 2 * Math.abs(1 << (bits - 1)) + value : Math.pow(2, bits) + value; +}; + +var warnOnce = text => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = "warning: " + text; + err(text); + } +}; + +var INT53_MAX = 9007199254740992; + +var INT53_MIN = -9007199254740992; + +var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num); + +var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined; + +/** + * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given + * array that contains uint8 values, returns a copy of that string as a + * Javascript String object. + * heapOrArray is either a regular array, or a JavaScript typed array view. + * @param {number=} idx + * @param {number=} maxBytesToRead + * @return {string} + */ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + // TextDecoder needs to know the byte length in advance, it doesn't stop on + // null terminator by itself. Also, use the length info to avoid running tiny + // strings through TextDecoder, since .subarray() allocates garbage. + // (As a tiny code save trick, compare endPtr against endIdx using a negation, + // so that undefined/NaN means Infinity) + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + // If building with TextDecoder, we have already computed the string length + // above, so test loop end condition against that + while (idx < endPtr) { + // For UTF8 byte structure, see: + // http://en.wikipedia.org/wiki/UTF-8#Description + // https://www.ietf.org/rfc/rfc2279.txt + // https://tools.ietf.org/html/rfc3629 + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; +}; + +/** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index (i.e. maxBytesToRead will not + * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing + * frequent uses of UTF8ToString() with and without maxBytesToRead may throw + * JS JIT optimizations off, so it is worth to consider consistently using one + * @return {string} + */ var UTF8ToString = (ptr, maxBytesToRead) => { + assert(typeof ptr == "number", `UTF8ToString expects a number (got ${typeof ptr})`); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; +}; + +function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); +} + +var PATH = { + isAbs: path => path.charAt(0) === "/", + splitPath: filename => { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (;up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: path => { + var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/"; + // Normalize the path + path = PATH.normalizeArray(path.split("/").filter(p => !!p), !isAbsolute).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: path => { + var result = PATH.splitPath(path), root = result[0], dir = result[1]; + if (!root && !dir) { + // No dirname whatsoever + return "."; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: path => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r) +}; + +var initRandomFill = () => view => crypto.getRandomValues(view); + +var randomFill = view => { + // Lazily init on the first invocation. + (randomFill = initRandomFill())(view); +}; + +var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? args[i] : FS.cwd(); + // Skip empty and invalid entries + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(p => !!p), !resolvedAbsolute).join("/"); + return ((resolvedAbsolute ? "/" : "") + resolvedPath) || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (;start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (;end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + } +}; + +var FS_stdin_getChar_buffer = []; + +var lengthBytesUTF8 = str => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + var c = str.charCodeAt(i); + // possibly a lead surrogate + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; +}; + +var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert(typeof str === "string", `stringToUTF8Array expects a string (got ${typeof str})`); + // Parameter maxBytesToWrite is not optional. Negative values, 0, null, + // undefined and false each don't write out any bytes. + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + // -1 for string null terminator. + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description + // and https://www.ietf.org/rfc/rfc2279.txt + // and https://tools.ietf.org/html/rfc3629 + var u = str.charCodeAt(i); + // possibly a lead surrogate + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = 65536 + ((u & 1023) << 10) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + // Null-terminate the pointer to the buffer. + heap[outIdx] = 0; + return outIdx - startIdx; +}; + +/** @type {function(string, boolean=, number=)} */ var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; +}; + +var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + // we will read data by chunks of BUFSIZE + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + // For some reason we must suppress a closure warning here, even though + // fd definitely exists on process.stdin, and is even the proper way to + // get the fd of stdin, + // https://github.com/nodejs/help/issues/2136#issuecomment-523649904 + // This started to happen after moving this logic out of library_tty.js, + // so it is related to the surrounding code in some unclear manner. + /** @suppress {missingProperties} */ var fd = process.stdin.fd; + try { + bytesRead = fs.readSync(fd, buf, 0, BUFSIZE); + } catch (e) { + // Cross-platform differences: on Windows, reading EOF throws an + // exception, but on other OSes, reading EOF returns 0. Uniformize + // behavior by treating the EOF exception to return 0. + if (e.toString().includes("EOF")) bytesRead = 0; else throw e; + } + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString("utf-8"); + } + } else if (typeof window != "undefined" && typeof window.prompt == "function") { + // Browser. + result = window.prompt("Input: "); + // returns null on cancel + if (result !== null) { + result += "\n"; + } + } else {} + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); +}; + +var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { + input: [], + output: [], + ops + }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + // typical setting + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + // currently just ignore + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [ 24, 80 ]; + } + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + } + } +}; + +var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); +}; + +var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; +}; + +var mmapAlloc = size => { + abort("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported"); +}; + +var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }, + stream: { + llseek: MEMFS.stream_ops.llseek + } + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync + } + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }, + stream: {} + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }, + stream: FS.chrdev_stream_ops + } + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity. + // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred + // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size + // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme. + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); + // Make sure to not return excess unused bytes. + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + // No need to expand, the storage was already large enough. + // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity. + // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to + // avoid overshooting the allocation cap by a very large margin. + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> 0); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + // At minimum allocate 256b for each file when expanding. + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + // Allocate new storage. + if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + // Fully decommit when requesting a resize to zero. + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + // Allocate new storage. + if (oldContents) { + node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of [ "mode", "atime", "mtime", "ctime" ]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + // if we're overwriting a directory at new_name, make sure it's empty. + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = new_dir.mtime = old_node.parent.ctime = old_node.parent.mtime = Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [ ".", "..", ...Object.keys(node.contents) ]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + } + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + // The data buffer should be a typed array view + assert(!(buffer instanceof ArrayBuffer)); + // If the buffer is located in main memory (HEAP), and if + // memory can grow, we can't hold on to references of the + // memory buffer, as they may get invalidated. That means we + // need to do copy its contents. + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + // This write is from a typed array to a typed array? + if (canOwn) { + assert(position === 0, "canOwn must imply no weird position inside the file"); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + // Writing to an already allocated and used subrange of the file? + node.contents.set(buffer.subarray(offset, offset + length), position); + return length; + } + } + // Appending to an existing file and we need to reallocate, or source data did not come as a typed array. + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + // Use typed array write which is available. + node.contents.set(buffer.subarray(offset, offset + length), position); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + // We can't emulate MAP_SHARED when the file is not backed by the + // buffer we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + HEAP8.set(contents, ptr); + } + } + return { + ptr, + allocated + }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + // should we check if bytesWritten and length are the same? + return 0; + } + } +}; + +var asyncLoad = async url => { + var arrayBuffer = await readAsync(url); + assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`); + return new Uint8Array(arrayBuffer); +}; + +var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); +}; + +var preloadPlugins = Module["preloadPlugins"] || []; + +var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + // Ensure plugins are ready. + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach(plugin => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; +}; + +var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { + // TODO we should allow people to just pass in a complete filename instead + // of parent and name being that we just join them anyways + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + // might have several active requests for the same fullname + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + onload?.(); + removeRunDependency(dep); + } + if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + })) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } +}; + +var FS_modeStringToFlags = str => { + var flagModes = { + "r": 0, + "r+": 2, + "w": 512 | 64 | 1, + "w+": 512 | 64 | 2, + "a": 1024 | 64 | 1, + "a+": 1024 | 64 | 2 + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; +}; + +var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; +}; + +var strError = errno => UTF8ToString(_strerror(errno)); + +var ERRNO_CODES = { + "EPERM": 63, + "ENOENT": 44, + "ESRCH": 71, + "EINTR": 27, + "EIO": 29, + "ENXIO": 60, + "E2BIG": 1, + "ENOEXEC": 45, + "EBADF": 8, + "ECHILD": 12, + "EAGAIN": 6, + "EWOULDBLOCK": 6, + "ENOMEM": 48, + "EACCES": 2, + "EFAULT": 21, + "ENOTBLK": 105, + "EBUSY": 10, + "EEXIST": 20, + "EXDEV": 75, + "ENODEV": 43, + "ENOTDIR": 54, + "EISDIR": 31, + "EINVAL": 28, + "ENFILE": 41, + "EMFILE": 33, + "ENOTTY": 59, + "ETXTBSY": 74, + "EFBIG": 22, + "ENOSPC": 51, + "ESPIPE": 70, + "EROFS": 69, + "EMLINK": 34, + "EPIPE": 64, + "EDOM": 18, + "ERANGE": 68, + "ENOMSG": 49, + "EIDRM": 24, + "ECHRNG": 106, + "EL2NSYNC": 156, + "EL3HLT": 107, + "EL3RST": 108, + "ELNRNG": 109, + "EUNATCH": 110, + "ENOCSI": 111, + "EL2HLT": 112, + "EDEADLK": 16, + "ENOLCK": 46, + "EBADE": 113, + "EBADR": 114, + "EXFULL": 115, + "ENOANO": 104, + "EBADRQC": 103, + "EBADSLT": 102, + "EDEADLOCK": 16, + "EBFONT": 101, + "ENOSTR": 100, + "ENODATA": 116, + "ETIME": 117, + "ENOSR": 118, + "ENONET": 119, + "ENOPKG": 120, + "EREMOTE": 121, + "ENOLINK": 47, + "EADV": 122, + "ESRMNT": 123, + "ECOMM": 124, + "EPROTO": 65, + "EMULTIHOP": 36, + "EDOTDOT": 125, + "EBADMSG": 9, + "ENOTUNIQ": 126, + "EBADFD": 127, + "EREMCHG": 128, + "ELIBACC": 129, + "ELIBBAD": 130, + "ELIBSCN": 131, + "ELIBMAX": 132, + "ELIBEXEC": 133, + "ENOSYS": 52, + "ENOTEMPTY": 55, + "ENAMETOOLONG": 37, + "ELOOP": 32, + "EOPNOTSUPP": 138, + "EPFNOSUPPORT": 139, + "ECONNRESET": 15, + "ENOBUFS": 42, + "EAFNOSUPPORT": 5, + "EPROTOTYPE": 67, + "ENOTSOCK": 57, + "ENOPROTOOPT": 50, + "ESHUTDOWN": 140, + "ECONNREFUSED": 14, + "EADDRINUSE": 3, + "ECONNABORTED": 13, + "ENETUNREACH": 40, + "ENETDOWN": 38, + "ETIMEDOUT": 73, + "EHOSTDOWN": 142, + "EHOSTUNREACH": 23, + "EINPROGRESS": 26, + "EALREADY": 7, + "EDESTADDRREQ": 17, + "EMSGSIZE": 35, + "EPROTONOSUPPORT": 66, + "ESOCKTNOSUPPORT": 137, + "EADDRNOTAVAIL": 4, + "ENETRESET": 39, + "EISCONN": 30, + "ENOTCONN": 53, + "ETOOMANYREFS": 141, + "EUSERS": 136, + "EDQUOT": 19, + "ESTALE": 72, + "ENOTSUP": 138, + "ENOMEDIUM": 148, + "EILSEQ": 25, + "EOVERFLOW": 61, + "ECANCELED": 11, + "ENOTRECOVERABLE": 56, + "EOWNERDEAD": 62, + "ESTRPIPE": 135 +}; + +var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name="ErrnoError"; + // We set the `name` property to be able to identify `FS.ErrnoError` + // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. + // - when using PROXYFS, an error can come from an underlying FS + // as different FS objects have their own FS.ErrnoError each, + // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs. + // we'll use the reliable test `err.name == "ErrnoError"` instead + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared={}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return (this.flags & 1024); + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops={}; + stream_ops={}; + readMode=292 | 73; + writeMode=146; + mounted=null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? this.mode |= this.readMode : this.mode &= ~this.readMode; + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode; + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + // split the absolute path + var parts = path.split("/").filter(p => !!p); + // start at the root + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length - 1); + if (islast && opts.parent) { + // stop resolving + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + // if noent_okay is true, suppress a ENOENT in the last component + // and return an object with an undefined node. This is needed for + // resolving symlinks in the path when creating a file. + if ((e?.errno === 44) && islast && opts.noent_okay) { + return { + path: current_path + }; + } + throw e; + } + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { + path: current_path, + node: current + }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + // if we failed to find it in the cache, call into the VFS + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = [ "r", "w", "rw" ][flag & 3]; + if ((flag & 512)) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + // return 0 if any user, group or owner bits are set. + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || (flags & (512 | 64))) { + // TODO: check for O_SEARCH? (== search for dir only) + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: fd => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + // clone it, so we can return an instance of FSStream + stream = Object.assign(new FS.FSStream, stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + } + }, + major: dev => ((dev) >> 8), + minor: dev => ((dev) & 255), + makedev: (ma, mi) => ((ma) << 8 | (mi)), + registerDevice(dev, ops) { + FS.devices[dev] = { + stream_ops: ops + }; + }, + getDevice: dev => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [ mount ]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + // sync all mounts + mounts.forEach(mount => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + // The filesystem was not included, and instead we have an error + // message stored in the variable. + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + mountpoint = lookup.path; + // use the absolute path + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type, + opts, + mountpoint, + mounts: [] + }; + // create a root node for the fs + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + // set as a mountpoint + node.mounted = mount; + // add the new mount to the current mount's children + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { + follow_mount: false + }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + // destroy the nodes for this mount, and all its child mounts + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach(hash => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + // no longer a mountpoint + node.mounted = null; + // remove this mount from the child mounts + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { + follow: true + }).node); + }, + statfsStream(stream) { + // We keep a separate statfsStream function because noderawfs overrides + // it. In noderawfs, stream.node is sometimes null. Instead, we need to + // look at stream.path. + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + // NOTE: None of the defaults here are true. We're just returning safe and + // sane values. Currently nodefs and rawfs replace these defaults, + // other file systems leave them alone. + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255 + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + // parents must exist + var lookup, old_dir, new_dir; + // let the errors from non existent directories percolate up + lookup = FS.lookupPath(old_path, { + parent: true + }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { + parent: true + }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + // new path should not be an ancestor of the old path + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) { + throw new FS.ErrnoError(10); + } + // if we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + // update old node (we do this here to avoid each backend + // needing to) + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { + parent: true + }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + // According to POSIX, we should map EISDIR to EPERM, but + // we instead do what Linux does (and we must, as we use + // the musl linux libc). + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { + timestamp: Date.now(), + dontFollow + }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: !dontFollow + }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { + size: len, + timestamp: Date.now() + }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { + follow: true + }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { + atime, + mtime + }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if ((flags & 64)) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + // noent_okay makes it so that if the final component of the path + // doesn't exist, lookupPath returns `node: undefined`. `path` will be + // updated to point to the target of all symlinks. + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true + }); + node = lookup.node; + path = lookup.path; + } + // perhaps we need to create the node + var created = false; + if ((flags & 64)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 128)) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + // node doesn't exist, try to create it + // Ignore the permission bits here to ensure we can `open` this new + // file below. We use chmod below the apply the permissions once the + // file is open. + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + // if asked only for a directory, then this must be one + if ((flags & 65536) && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + // check permissions, if this is not a file we just created now (it is ok to + // create and write to a file with read-only permissions; it is read-only + // for later use) + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + // do truncation if necessary + if ((flags & 512) && !created) { + FS.truncate(node, 0); + } + // we've already handled these, don't pass down to the underlying vfs + flags &= ~(128 | 512 | 131072); + // register the stream with the filesystem + var stream = FS.createStream({ + node, + path: FS.getPath(node), + // we want the absolute path to the node + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }); + // call the new stream's open function + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + // free readdir state + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + // User requests writing to file (prot & PROT_WRITE != 0). + // Checking if we have permissions to write to the file unless + // MAP_PRIVATE flag is set. According to POSIX spec it is possible + // to write to file opened in read-only mode with MAP_PRIVATE flag, + // as all modifications will be visible only in the memory of + // the current process. + if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { + follow: true + }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + // create /dev + FS.mkdir("/dev"); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0 + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using err() rather than out() + // so we register a second tty just for it. + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + // setup /dev/[u]random + // use a buffer to avoid overhead of individual crypto calls per byte + var randomBuffer = new Uint8Array(1024), randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the + // name of the stream for fd 6 (see test_unistd_ttyname) + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount({ + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { + llseek: MEMFS.stream_ops.llseek + }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { + mountpoint: "fake" + }, + node_ops: { + readlink: () => stream.path + }, + id: fd + 1 + }; + ret.parent = ret; + // make it look like a simple root node + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()).filter(([k, v]) => v).map(([k, v]) => k.toString()); + } + }; + return node; + } + }, {}, "/proc/self/fd"); + }, + createStandardStreams(input, output, error) { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + // open default streams for the stdin, stdout and stderr devices + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { + "MEMFS": MEMFS + }; + }, + init(input, output, error) { + assert(!FS.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"); + FS.initialized = true; + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + // force-flush all streams, so we get musl std streams printed out + _fflush(0); + // close all of our streams + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + // operate from within the context of the symlink's target + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { + parent: true + }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink + }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + // make sure we can write to the file + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + // Create a fake device that a set of stream ops to emulate + // the old behavior. + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + // flush any pending line data + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else { + // Command-line. + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + // Lazy chunked Uint8Array (implements get and length from Uint8Array). + // Actual getting is abstracted away for eventual reuse. + class LazyUint8Array { + lengthKnown=false; + chunks=[]; + // Loaded chunks. Index is the chunk number + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + // Find length + var xhr = new XMLHttpRequest; + xhr.open("HEAD", url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip"; + var chunkSize = 1024 * 1024; + // Chunk size in bytes + if (!hasByteServing) chunkSize = datalength; + // Function to get a range from the remote URL. + var doXHR = (from, to) => { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!"); + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest; + xhr.open("GET", url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + // Some hints to the browser that we want binary data. + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(/** @type{Array} */ (xhr.response || [])); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter(chunkNum => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + // including this byte + end = Math.min(end, datalength - 1); + // if datalength-1 is selected, this is the last block + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length + chunkSize = datalength = 1; + // this will force getter(0)/doXHR do download the whole file + datalength = this.getter(0).length; + chunkSize = datalength; + out("LazyFiles on gzip forces download of the whole file when length is accessed"); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array; + var properties = { + isDevice: false, + contents: lazyArray + }; + } else { + var properties = { + isDevice: false, + url + }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + // This is a total hack, but I want to get this lazy file code out of the + // core of MEMFS. If we want to keep this lazy file concept I feel it should + // be its own thin LAZYFS proxying calls to MEMFS. + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + // Add a function that defers querying the file size until it is asked the first time. + Object.defineProperties(node, { + usedBytes: { + get: function() { + return this.contents.length; + } + } + }); + // override each stream op with one that tries to force load the lazy file first + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(key => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + // normal array + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + // LazyUint8Array from sync binary XHR + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + // use a custom read function + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + // use a custom mmap function + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { + ptr, + allocated: true + }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc"); + }, + standardizePath() { + abort("FS.standardizePath has been removed; use PATH.normalize instead"); + } +}; + +var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + // relative path + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + SAFE_HEAP_STORE(((buf) / 4) * 4, stat.dev, 4); + SAFE_HEAP_STORE((((buf) + (4)) / 4) * 4, stat.mode, 4); + HEAPU64[(((buf) + (8)) / 8)] = BigInt(stat.nlink); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stat.uid, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stat.gid, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stat.rdev, 4); + HEAP64[(((buf) + (32)) / 8)] = BigInt(stat.size); + SAFE_HEAP_STORE((((buf) + (40)) / 4) * 4, 4096, 4); + SAFE_HEAP_STORE((((buf) + (44)) / 4) * 4, stat.blocks, 4); + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(((buf) + (48)) / 8)] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(((buf) + (56)) / 8)] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (64)) / 8)] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(((buf) + (72)) / 8)] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (80)) / 8)] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(((buf) + (88)) / 8)] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(((buf) + (96)) / 8)] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + SAFE_HEAP_STORE((((buf) + (8)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (56)) / 4) * 4, stats.bsize, 4); + SAFE_HEAP_STORE((((buf) + (16)) / 4) * 4, stats.blocks, 4); + SAFE_HEAP_STORE((((buf) + (20)) / 4) * 4, stats.bfree, 4); + SAFE_HEAP_STORE((((buf) + (24)) / 4) * 4, stats.bavail, 4); + SAFE_HEAP_STORE((((buf) + (28)) / 4) * 4, stats.files, 4); + SAFE_HEAP_STORE((((buf) + (32)) / 4) * 4, stats.ffree, 4); + SAFE_HEAP_STORE((((buf) + (36)) / 4) * 4, stats.fsid, 4); + SAFE_HEAP_STORE((((buf) + (64)) / 4) * 4, stats.flags, 4); + // ST_NOSUID + SAFE_HEAP_STORE((((buf) + (48)) / 4) * 4, stats.namelen, 4); + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + // MAP_PRIVATE calls need not to be synced back to underlying fs + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + } +}; + +function ___syscall_chmod(path, mode) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_faccessat(dirfd, path, amode, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + assert(flags === 0 || flags == 512); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + // need a valid mode + return -28; + } + var lookup = FS.lookupPath(path, { + follow: true + }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[((SYSCALLS.varargs) / 8)]); + SYSCALLS.varargs += 8; + return ret; +}; + +var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + // the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number. + var ret = SAFE_HEAP_LOAD(((+SYSCALLS.varargs) / 4) * 4, 4, 0); + SYSCALLS.varargs += 4; + return ret; +}; + +function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: + { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + + case 1: + case 2: + return 0; + + // FD_CLOEXEC makes no sense for a single process. + case 3: + return stream.flags; + + case 4: + { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + + case 5: + { + var arg = syscallGetVarargP(); + var offset = 0; + // We're always unlocked. + SAFE_HEAP_STORE((((arg) + (offset)) / 2) * 2, 2, 2); + return 0; + } + + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); +}; + +function ___syscall_getcwd(buf, size) { + buf = bigintToI53Checked(buf); + size = bigintToI53Checked(size); + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + { + if (!stream.tty) return -59; + return 0; + } + + case 21505: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, termios.c_iflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (4)) / 4) * 4, termios.c_oflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (8)) / 4) * 4, termios.c_cflag || 0, 4); + SAFE_HEAP_STORE((((argp) + (12)) / 4) * 4, termios.c_lflag || 0, 4); + for (var i = 0; i < 32; i++) { + SAFE_HEAP_STORE((argp + i) + (17), termios.c_cc[i] || 0, 1); + } + return 0; + } + return 0; + } + + case 21510: + case 21511: + case 21512: + { + if (!stream.tty) return -59; + return 0; + } + + case 21506: + case 21507: + case 21508: + { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = SAFE_HEAP_LOAD(((argp) / 4) * 4, 4, 0); + var c_oflag = SAFE_HEAP_LOAD((((argp) + (4)) / 4) * 4, 4, 0); + var c_cflag = SAFE_HEAP_LOAD((((argp) + (8)) / 4) * 4, 4, 0); + var c_lflag = SAFE_HEAP_LOAD((((argp) + (12)) / 4) * 4, 4, 0); + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(SAFE_HEAP_LOAD((argp + i) + (17), 1, 0)); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc + }); + } + return 0; + } + + case 21519: + { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 4) * 4, 0, 4); + return 0; + } + + case 21520: + { + if (!stream.tty) return -59; + return -28; + } + + case 21531: + { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + + case 21523: + { + // TODO: in theory we should write to the winsize struct that gets + // passed in, but for now musl doesn't read anything on it + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + SAFE_HEAP_STORE(((argp) / 2) * 2, winsize[0], 2); + SAFE_HEAP_STORE((((argp) + (2)) / 2) * 2, winsize[1], 2); + } + return 0; + } + + case 21524: + { + // TODO: technically, this ioctl call should change the window size. + // but, since emscripten doesn't have any concept of a terminal window + // yet, we'll just silently throw it away as we do TIOCGWINSZ + if (!stream.tty) return -59; + return 0; + } + + case 21515: + { + if (!stream.tty) return -59; + return 0; + } + + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_lstat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.lstat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_newfstatat(dirfd, path, buf, flags) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & (~6400); + assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`); + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + bufsize = bigintToI53Checked(bufsize); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = SAFE_HEAP_LOAD(buf + len, 1, 0); + stringToUTF8(ret, buf, bufsize + 1); + // readlink is one of the rare functions that write out a C string, but does never append a null to the output buffer(!) + // stringToUTF8() always appends a null byte, so restore the character under the null byte after the write. + SAFE_HEAP_STORE(buf + len, endChar, 1); + return len; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_stat64(path, buf) { + path = bigintToI53Checked(path); + buf = bigintToI53Checked(buf); + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.writeStat(buf, FS.stat(path)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +function ___syscall_unlinkat(dirfd, path, flags) { + path = bigintToI53Checked(path); + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort("Invalid flags passed to unlinkat"); + } + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } +} + +var __abort_js = () => abort("native code called abort()"); + +var runtimeKeepaliveCounter = 0; + +var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; +}; + +var isLeapYear = year => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + +var MONTH_DAYS_LEAP_CUMULATIVE = [ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 ]; + +var MONTH_DAYS_REGULAR_CUMULATIVE = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ]; + +var ydayFromDate = date => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = (leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE); + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + // -1 since it's days since Jan 1 + return yday; +}; + +function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + tmPtr = bigintToI53Checked(tmPtr); + var date = new Date(time * 1e3); + SAFE_HEAP_STORE(((tmPtr) / 4) * 4, date.getSeconds(), 4); + SAFE_HEAP_STORE((((tmPtr) + (4)) / 4) * 4, date.getMinutes(), 4); + SAFE_HEAP_STORE((((tmPtr) + (8)) / 4) * 4, date.getHours(), 4); + SAFE_HEAP_STORE((((tmPtr) + (12)) / 4) * 4, date.getDate(), 4); + SAFE_HEAP_STORE((((tmPtr) + (16)) / 4) * 4, date.getMonth(), 4); + SAFE_HEAP_STORE((((tmPtr) + (20)) / 4) * 4, date.getFullYear() - 1900, 4); + SAFE_HEAP_STORE((((tmPtr) + (24)) / 4) * 4, date.getDay(), 4); + var yday = ydayFromDate(date) | 0; + SAFE_HEAP_STORE((((tmPtr) + (28)) / 4) * 4, yday, 4); + HEAP64[(((tmPtr) + (40)) / 8)] = BigInt(-(date.getTimezoneOffset() * 60)); + // Attention: DST is in December in South, and some regions don't have DST at all. + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + SAFE_HEAP_STORE((((tmPtr) + (32)) / 4) * 4, dst, 4); +} + +var timers = {}; + +var handleException = e => { + // Certain exception types we do not treat as errors since they are used for + // internal control flow. + // 1. ExitStatus, which is thrown by exit() + // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others + // that wish to return to JS event loop. + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"); + } + } + quit_(1, e); +}; + +var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + +var _proc_exit = code => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); +}; + +/** @suppress {duplicate } */ /** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => { + EXITSTATUS = status; + if (!keepRuntimeAlive()) { + exitRuntime(); + } + // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down + if (keepRuntimeAlive() && !implicit) { + var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + islib64 = 0; + _proc_exit(status); +}; + +var _exit = exitJS; + +var maybeExit = () => { + if (runtimeExited) { + return; + } + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } +}; + +var callUserCallback = func => { + if (runtimeExited || ABORT) { + err("user callback triggered after runtime exited or application aborted. Ignoring."); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } +}; + +var _emscripten_get_now = () => performance.now(); + +var __setitimer_js = (which, timeout_ms) => { + // First, clear any existing timer. + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + // A timeout of zero simply cancels the current timeout so we have nothing + // more to do. + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now())); + }, timeout_ms); + timers[which] = { + id, + timeout_ms + }; + return 0; +}; + +var __tzset_js = function(timezone, daylight, std_name, dst_name) { + timezone = bigintToI53Checked(timezone); + daylight = bigintToI53Checked(daylight); + std_name = bigintToI53Checked(std_name); + dst_name = bigintToI53Checked(dst_name); + // TODO: Use (malleable) environment variables instead of system settings. + var currentYear = (new Date).getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + // Local standard timezone offset. Local standard time is not adjusted for + // daylight savings. This code uses the fact that getTimezoneOffset returns + // a greater value during Standard Time versus Daylight Saving Time (DST). + // Thus it determines the expected output during Standard Time, and it + // compares whether the output of the given date the same (Standard) or less + // (DST). + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + // timezone is specified as seconds west of UTC ("The external variable + // `timezone` shall be set to the difference, in seconds, between + // Coordinated Universal Time (UTC) and local standard time."), the same + // as returned by stdTimezoneOffset. + // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html + HEAPU64[((timezone) / 8)] = BigInt(stdTimezoneOffset * 60); + SAFE_HEAP_STORE(((daylight) / 4) * 4, Number(winterOffset != summerOffset), 4); + var extractZone = timezoneOffset => { + // Why inverse sign? + // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset + var sign = timezoneOffset >= 0 ? "-" : "+"; + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, "0"); + var minutes = String(absOffset % 60).padStart(2, "0"); + return `UTC${sign}${hours}${minutes}`; + }; + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + assert(winterName); + assert(summerName); + assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`); + assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`); + if (summerOffset < winterOffset) { + // Northern hemisphere + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } +}; + +var _emscripten_date_now = () => Date.now(); + +var nowIsMonotonic = 1; + +var checkWasiClock = clock_id => clock_id >= 0 && clock_id <= 3; + +function _clock_time_get(clk_id, ignored_precision, ptime) { + ignored_precision = bigintToI53Checked(ignored_precision); + ptime = bigintToI53Checked(ptime); + if (!checkWasiClock(clk_id)) { + return 28; + } + var now; + // all wasi clocks but realtime are monotonic + if (clk_id === 0) { + now = _emscripten_date_now(); + } else if (nowIsMonotonic) { + now = _emscripten_get_now(); + } else { + return 52; + } + // "now" is in ms, and wasi times are in ns. + var nsec = Math.round(now * 1e3 * 1e3); + HEAP64[((ptime) / 8)] = BigInt(nsec); + return 0; +} + +function _emscripten_err(str) { + str = bigintToI53Checked(str); + return err(UTF8ToString(str)); +} + +var getHeapMax = () => 2147483648; + +var growMemory = size => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + // round size grow request up to wasm page size (fixed 64KB per spec) + wasmMemory.grow(BigInt(pages)); + // .grow() takes a delta compared to the previous size + updateMemoryViews(); + return 1; + } catch (e) { + err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`); + } +}; + +function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + // With multithreaded builds, races can happen (another thread might increase the size + // in between), so return a failure, and let the caller retry. + assert(requestedSize > oldSize); + // Memory resize rules: + // 1. Always increase heap size to at least the requested size, rounded up + // to next page multiple. + // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap + // geometrically: increase the heap size according to + // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most + // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB). + // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap + // linearly: increase the heap size by at least + // MEMORY_GROWTH_LINEAR_STEP bytes. + // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by + // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest + // 4. If we were unable to allocate as much memory, it may be due to + // over-eager decision to excessively reserve due to (3) above. + // Hence if an allocation fails, cut down on the amount of excess + // growth, in an attempt to succeed to perform a smaller allocation. + // A limit is set for how much we can grow. We should not exceed that + // (the wasm binary specifies it, so if we tried, we'd fail anyhow). + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`); + return false; + } + // Loop through potential heap size increases. If we attempt a too eager + // reservation that fails, cut down on the attempted size and reserve a + // smaller bump instead. (max 3 times, chosen somewhat arbitrarily) + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + .2 / cutDown); + // ensure geometric growth + // but limit overreserving (default to capping at +96MB overgrowth at most) + overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); + var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`); + return false; +} + +var ENV = {}; + +var getExecutableName = () => thisProgram || "./this.program"; + +var getEnvStrings = () => { + if (!getEnvStrings.strings) { + // Default values. + // Browser language detection #8751 + var lang = ((typeof navigator == "object" && navigator.languages && navigator.languages[0]) || "C").replace("-", "_") + ".UTF-8"; + var env = { + "USER": "web_user", + "LOGNAME": "web_user", + "PATH": "/", + "PWD": "/", + "HOME": "/home/web_user", + "LANG": lang, + "_": getExecutableName() + }; + // Apply the user-provided values, if any. + for (var x in ENV) { + // x is a key in ENV; if ENV[x] is undefined, that means it was + // explicitly set to be so. We allow user code to do that to + // force variables with default values to remain unset. + if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; +}; + +var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + SAFE_HEAP_STORE(buffer++, str.charCodeAt(i), 1); + } + // Null-terminate the string + SAFE_HEAP_STORE(buffer, 0, 1); +}; + +var _environ_get = function(__environ, environ_buf) { + __environ = bigintToI53Checked(__environ); + environ_buf = bigintToI53Checked(environ_buf); + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU64[(((__environ) + (i * 8)) / 8)] = BigInt(ptr); + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; +}; + +var _environ_sizes_get = function(penviron_count, penviron_buf_size) { + penviron_count = bigintToI53Checked(penviron_count); + penviron_buf_size = bigintToI53Checked(penviron_buf_size); + var strings = getEnvStrings(); + HEAPU64[((penviron_count) / 8)] = BigInt(strings.length); + var bufSize = 0; + strings.forEach(string => bufSize += string.length + 1); + HEAPU64[((penviron_buf_size) / 8)] = BigInt(bufSize); + return 0; +}; + +function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_fdstat_get(fd, pbuf) { + pbuf = bigintToI53Checked(pbuf); + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + // All character devices are terminals (other things a Linux system would + // assume is a character device, like the mouse, we have special APIs for). + var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4; + } + SAFE_HEAP_STORE(pbuf, type, 1); + SAFE_HEAP_STORE((((pbuf) + (2)) / 2) * 2, flags, 2); + HEAP64[(((pbuf) + (8)) / 8)] = BigInt(rightsBase); + HEAP64[(((pbuf) + (16)) / 8)] = BigInt(rightsInheriting); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + // nothing more to read + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[((newOffset) / 8)] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; + // reset readdir state + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +/** @param {number=} offset */ var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[((iov) / 8)]); + var len = Number(HEAPU64[(((iov) + (8)) / 8)]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + // No more space to write. + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; +}; + +function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[((pnum) / 8)] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } +} + +var stackAlloc = sz => __emscripten_stack_alloc(sz); + +var stringToUTF8OnStack = str => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; +}; + +FS.createPreloadedFile = FS_createPreloadedFile; + +FS.staticInit(); + +function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); +} + +var wasmImports = { + /** @export */ __assert_fail: ___assert_fail, + /** @export */ __syscall_chmod: ___syscall_chmod, + /** @export */ __syscall_faccessat: ___syscall_faccessat, + /** @export */ __syscall_fcntl64: ___syscall_fcntl64, + /** @export */ __syscall_fstat64: ___syscall_fstat64, + /** @export */ __syscall_getcwd: ___syscall_getcwd, + /** @export */ __syscall_ioctl: ___syscall_ioctl, + /** @export */ __syscall_lstat64: ___syscall_lstat64, + /** @export */ __syscall_newfstatat: ___syscall_newfstatat, + /** @export */ __syscall_openat: ___syscall_openat, + /** @export */ __syscall_readlinkat: ___syscall_readlinkat, + /** @export */ __syscall_stat64: ___syscall_stat64, + /** @export */ __syscall_unlinkat: ___syscall_unlinkat, + /** @export */ _abort_js: __abort_js, + /** @export */ _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + /** @export */ _localtime_js: __localtime_js, + /** @export */ _setitimer_js: __setitimer_js, + /** @export */ _tzset_js: __tzset_js, + /** @export */ alignfault, + /** @export */ clock_time_get: _clock_time_get, + /** @export */ emscripten_date_now: _emscripten_date_now, + /** @export */ emscripten_err: _emscripten_err, + /** @export */ emscripten_resize_heap: _emscripten_resize_heap, + /** @export */ environ_get: _environ_get, + /** @export */ environ_sizes_get: _environ_sizes_get, + /** @export */ exit: _exit, + /** @export */ fd_close: _fd_close, + /** @export */ fd_fdstat_get: _fd_fdstat_get, + /** @export */ fd_read: _fd_read, + /** @export */ fd_seek: _fd_seek, + /** @export */ fd_write: _fd_write, + /** @export */ proc_exit: _proc_exit, + /** @export */ segfault +}; + +var wasmExports = await createWasm(); + +var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + +var _main = Module["_main"] = createExportWrapper("__main_argc_argv", 2); + +var _fflush = createExportWrapper("fflush", 1); + +var _strerror = createExportWrapper("strerror", 1); + +var _sbrk = createExportWrapper("sbrk", 1); + +var ___funcs_on_exit = createExportWrapper("__funcs_on_exit", 0); + +var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + +var _emscripten_get_sbrk_ptr = createExportWrapper("emscripten_get_sbrk_ptr", 0); + +var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + +var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + +var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + +var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + +var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + +var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + +var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"]; + +var ___cxa_increment_exception_refcount = createExportWrapper("__cxa_increment_exception_refcount", 1); + +// Argument name here must shadow the `wasmExports` global so +// that it is recognised by metadce and minify-import-export-names +// passes. +function applySignatureConversions(wasmExports) { + // First, make a copy of the incoming exports object + wasmExports = Object.assign({}, wasmExports); + var makeWrapper___PP = f => (a0, a1, a2) => f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper__p = f => a0 => f(BigInt(a0)); + var makeWrapper_p_ = f => a0 => Number(f(a0)); + var makeWrapper_pP = f => a0 => Number(f(BigInt(a0 ? a0 : 0))); + var makeWrapper_p = f => () => Number(f()); + var makeWrapper_pp = f => a0 => Number(f(BigInt(a0))); + wasmExports["__main_argc_argv"] = makeWrapper___PP(wasmExports["__main_argc_argv"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["sbrk"] = makeWrapper_pP(wasmExports["sbrk"]); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p(wasmExports["emscripten_stack_get_base"]); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p(wasmExports["emscripten_stack_get_end"]); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p(wasmExports["_emscripten_stack_restore"]); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp(wasmExports["_emscripten_stack_alloc"]); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p(wasmExports["emscripten_stack_get_current"]); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p(wasmExports["__cxa_increment_exception_refcount"]); + return wasmExports; +} + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === +Module["run"] = run; + +Module["FS"] = FS; + +var missingLibrarySymbols = [ "writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "emscriptenLog", "readEmAsmArgs", "jstoi_q", "listenOnce", "autoResumeAudioContext", "getDynCaller", "dynCall", "runtimeKeepalivePush", "runtimeKeepalivePop", "asmjsMangle", "HandleAllocator", "getNativeTypeSize", "addOnInit", "addOnPostCtor", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "getCFunc", "ccall", "cwrap", "uleb128Encode", "sigToWasmTypes", "generateFuncType", "convertJsFunctionToWasm", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "removeFunction", "reallyNegative", "strLen", "reSign", "formatString", "intArrayToString", "AsciiToString", "UTF16ToString", "stringToUTF16", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "battery", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "ExceptionInfo", "findMatchingCatch", "Browser_asyncPrepareDataCounter", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "FS_unlink", "FS_mkdirTree", "_setNetworkCallback", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "setErrNo", "demangle", "stackTrace" ]; + +missingLibrarySymbols.forEach(missingLibrarySymbol); + +var unexportedSymbols = [ "addRunDependency", "removeRunDependency", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "zeroMemory", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "strError", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "jstoi_s", "getExecutableName", "handleException", "keepRuntimeAlive", "callUserCallback", "maybeExit", "asyncLoad", "alignMemory", "mmapAlloc", "wasmTable", "noExitRuntime", "addOnPreRun", "addOnPostRun", "freeTableIndexes", "functionsInTableMap", "unSign", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "UTF8ToString", "stringToUTF8Array", "stringToUTF8", "lengthBytesUTF8", "intArrayFromString", "stringToAscii", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "getEnvStrings", "checkWasiClock", "doReadv", "doWritev", "initRandomFill", "randomFill", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "uncaughtExceptionCount", "exceptionLast", "exceptionCaught", "Browser", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "isLeapYear", "ydayFromDate", "SYSCALLS", "preloadPlugins", "FS_createPreloadedFile", "FS_modeStringToFlags", "FS_getMode", "FS_stdin_getChar_buffer", "FS_stdin_getChar", "FS_createPath", "FS_createDevice", "FS_readFile", "FS_createDataFile", "FS_createLazyFile", "MEMFS", "TTY", "PIPEFS", "SOCKFS", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr" ]; + +unexportedSymbols.forEach(unexportedRuntimeSymbol); + +var calledRun; + +function callMain(args = []) { + assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); + assert(typeof onPreRuns === "undefined" || onPreRuns.length == 0, "cannot call main when preRun functions remain to be called"); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach(arg => { + HEAPU64[((argv_ptr) / 8)] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[((argv_ptr) / 8)] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + // if we're not running an evented main loop, it's time to exit + exitJS(ret, /* implicit = */ true); + return ret; + } catch (e) { + return handleException(e); + } +} + +function stackCheckInit() { + // This is normally called automatically during __wasm_call_ctors but need to + // get these values before even running any of the ctors so we call it redundantly + // here. + _emscripten_stack_init(); + // TODO(sbc): Move writeStackCookie to native to to avoid this. + writeStackCookie(); +} + +function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + function doRun() { + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + + if (args[2].includes(".o")) { // Disassemble library + FS.writeFile("./" + args[2], args[0]); + islib64 = 1; + }else { + FS.writeFile("./input.elf", args[0]); + } + // FS.writeFile("./input.elf", args[0]); + args.shift(); + preMain(); + readyPromiseResolve(Module); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"] || true; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); +} + +if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } +} + +// run(); + +// end include: postamble.js +// include: postamble_modularize.js +// In MODULARIZE mode we wrap the generated code in a factory function +// and return either the Module itself, or a promise of the module. +// We assign to the `moduleRtn` global here and configure closure to see +// this as and extern so it won't get minified. +moduleRtn = readyPromise; + +// Assertion for attempting to access module properties on the incoming +// moduleArg. In the past we used this object as the prototype of the module +// and assigned properties to it, but now we return a distinct object. This +// keeps the instance private until it is ready (i.e the promise has been +// resolved). +for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`); + } + }); + } +} + readyPromiseResolve(Module); + + return moduleRtn; +} +); +})(); +(() => { + // Create a small, never-async wrapper around Module which + // checks for callers incorrectly using it with `new`. + var real_Module = Module; + Module = function(arg) { + if (new.target) throw new Error("Module() should not be called with `new Module()`"); + return real_Module(arg); + } +})(); +export default Module; diff --git a/src/core/assembler/sailAssembler/web/wasm/objdump64.wasm b/src/core/assembler/sailAssembler/web/wasm/objdump64.wasm new file mode 100755 index 000000000..7b21fedc1 Binary files /dev/null and b/src/core/assembler/sailAssembler/web/wasm/objdump64.wasm differ diff --git a/src/core/assembler/sjasmplus/deno/sjasmplus.mjs b/src/core/assembler/sjasmplus/deno/sjasmplus.mjs index 430bdd2c4..66ad4d0da 100644 --- a/src/core/assembler/sjasmplus/deno/sjasmplus.mjs +++ b/src/core/assembler/sjasmplus/deno/sjasmplus.mjs @@ -84,7 +84,7 @@ export function sjasmplusAssemble(code) { // Now add hints to memory based on the parsed symbols (its a dictionary) for (const [name, addr] of Object.entries(parsedSymbols)) { - main_memory.addHint(addr, name); + main_memory.addHint(addr, [name]); } // Clean up temp files diff --git a/src/core/capi/arch/mips.mjs b/src/core/capi/arch/mips.mjs index e7a62b532..8a62c5692 100644 --- a/src/core/capi/arch/mips.mjs +++ b/src/core/capi/arch/mips.mjs @@ -39,13 +39,14 @@ export const ARCH = { /** * Reads a double precision floating point value from a register pair. - * @param {string} regName - The base register name (must be even, e.g., "f0") + * @param {string} regName - The base register name (must be even, e.g., "f0" or "FP0") * @returns {number} The JavaScript number representation of the double */ readDouble(regName) { this.validateEvenRegister(regName); - const regNumber = parseInt(regName.substring(1), 10); + const offset = regName.substring(0, 2) === "FP"? 2 : 1; + const regNumber = parseInt(regName.substring(offset), 10); const highReg = regName; const lowRegName = "f" + (regNumber + 1); diff --git a/src/core/capi/arch/riscv.mjs b/src/core/capi/arch/riscv.mjs index 27313cd2d..3b10f1114 100644 --- a/src/core/capi/arch/riscv.mjs +++ b/src/core/capi/arch/riscv.mjs @@ -227,4 +227,13 @@ export const ARCH = { NaNBoxed = BigInt(NaNBoxed); return NaNBoxed; }, + /** + * Writes a float32 to a register, using NaN boxing with float64 + * @param {number} value - The JavaScript number to write + * @param {string} regName - The base register name (must be even, e.g., "f0") + **/ + writeFloat(value, regName) { + const bits = this.toBigInt(value, "NaNBfloat32_64") + CAPI.REG.write(bits, regName) + } }; diff --git a/src/core/capi/arduino.mts b/src/core/capi/arduino.mts new file mode 100644 index 000000000..636934a9c --- /dev/null +++ b/src/core/capi/arduino.mts @@ -0,0 +1,80 @@ +/** + * Copyright 2018-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, + * Diego Camarmas Alonso + * + * This file is part of CREATOR. + * + * CREATOR is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CREATOR 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with CREATOR. If not, see . + * + */ +import * as hooks from "./arduino_functions.mts"; +import { loadedCreatino } from "../core.mjs"; + +/* + * CREATOR instruction description API: + * CREATino executor module + */ + +// -------Create hookmap from custom library file +const hookMap = new Map void>(); +export const ARDUINO = { + check_arduino: (funcName: number, pc_state: number): boolean => { + return check_arduino(funcName, pc_state); + }, +}; + +export function createHookMap() { + const hookOrder = hooks.hookOrder as string[]; // 👈 asegurar tipo + + for (let i = 0, addr = 0x0; i < hookOrder.length; i++, addr += 4) { + const funcName = hookOrder[i]; + + const func = hooks[funcName as keyof typeof hooks] as (() => void) | undefined; + + hookMap.set( + addr, + func ?? (() => console.log(`Function ${funcName} not found`)) + ); + } + + +} +// AUX +function getAddressOfHook(func: () => void): number | undefined { + for (const [addr, f] of hookMap.entries()) { + if (f === func) return addr; + } + return undefined; +} + + +// ------- Identify arduino functions----- +export function check_arduino(funcName: number, pc_state: number): boolean { + const key = Math.abs(Number(pc_state) + Number(funcName)); + if (hookMap.size === 0) { + //await createHookMap(); ERROR + createHookMap(); + } + if (loadedCreatino == false) { + return false; + } + + const func = hookMap.get(key); + if (func) { + func(); + return true; + } + + return false; +} diff --git a/src/core/capi/arduino_functions.mts b/src/core/capi/arduino_functions.mts new file mode 100644 index 000000000..f62388391 --- /dev/null +++ b/src/core/capi/arduino_functions.mts @@ -0,0 +1,1874 @@ +import { crex_findReg } from "../register/registerLookup.mjs"; +import { packExecute } from "../utils/utils.mjs"; +import { + readRegister, + writeRegister, +} from "../register/registerOperations.mjs"; +import { main_memory, status } from "../core.mjs"; +import { + display_print, + keyboard_read_find, + kbd_read_string, + keyboard_parseInt, + keyboard_read, + kbd_read_char, + keyboard_read_until, +} from "../executor/IO.mjs"; +// import { getPinState,setPinState } from "../../web/arduino/pinstates.mts"; +import { Memory } from "../memory/Memory.mts"; +import { coreEvents } from "@/core/events.mts"; + +/* + * CREATOR instruction description API: + * CREATino functions module + */ +//Variables +let serial_begin = 0; // TODO: Which baud rate can we accept? +let initArduino = 0; // Flag to check if initArduino has been called +let _seed = 1; +// let traces = new ArduinoTerminal(); + +//Functions +export function cr_initArduino() { + if (initArduino === 0) { + initArduino = 1; + } + coreEvents.emit("arduino-terminal-write", { text: "initArduino()" }); +} +export function cr_digitalRead() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //Read from simulator + const pinName = `GPIO${pin}`; + let rawValue = 0; + coreEvents.emit("arduino-pin-read", { + pin: pinName, + callback: (val: number) => { + rawValue = val; + } + }); + const value = rawValue !== 0 ? 1 : 0; + writeRegister(BigInt(value), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `digitalRead(${pin}) = ${value}`, + }); +} +export function cr_pinMode() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var mode = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + coreEvents.emit("arduino-terminal-write", { + text: `pinMode(${pin},${mode})`, + }); + coreEvents.emit("arduino-pin-mode", { + pin: Number(pin), + mode: Number(mode), + }); +} +export function cr_digitalWrite() { + // Indicate in terminal + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var rawValue = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + var value = rawValue !== 0n ? 1 : 0; + coreEvents.emit("arduino-terminal-write", { + text: `digitalWrite(${pin}, ${value})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_analogRead() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //Read from simulator + const pinName = `GPIO${pin}`; + // const value = pinStates.value[pinName] ?? 0; + let value = 0; + coreEvents.emit("arduino-pin-read", { + pin: pinName, + callback: (val: number) => { + value = val; + } + }); + console.log(`Reading from pin ${pinName}: ${value}`); + writeRegister(BigInt(value), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `analogRead(${pin}) = ${value}`, + }); +} +export function cr_analogReadResolution() { + // TODO +} +export function cr_analogWrite() { + // Indicate in terminal + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + coreEvents.emit("arduino-terminal-write", { + text: `analogWrite(${pin}, ${value})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_map() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //fromLow the lower bound of the value’s current range. + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var fromLow = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + //fromHigh the upper bound of the value’s current range. + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var fromHigh = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + //toLow the lower bound of the value’s target range. + var ret4 = crex_findReg("a3"); + if (ret4.match === 0) { + throw packExecute( + true, + "capi_arduino: register a3 not found", + "danger", + null, + ); + } + var toLow = BigInt.asIntN(32, readRegister(ret4.indexComp, ret4.indexElem)); + //toHigh the upper bound of the value’s target range. + var ret5 = crex_findReg("a4"); + if (ret5.match === 0) { + throw packExecute( + true, + "capi_arduino: register a4 not found", + "danger", + null, + ); + } + var toHigh = BigInt.asIntN( + 32, + readRegister(ret5.indexComp, ret5.indexElem), + ); + const mappedValue = + ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow; + writeRegister(mappedValue, ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `map(${value}, ${fromLow}, ${fromHigh}, ${toLow}, ${toHigh})`, + }); +} +export function cr_constrain() { + // Value to constrain + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //lower end + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var lower = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + //upper end + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var upper = BigInt.asIntN(32, readRegister(ret3.indexComp, ret3.indexElem)); + + // Always a int cause we use a0 + var constrained = Math.max( + Number(lower), + Math.min(Number(value), Number(upper)), + ); + writeRegister(BigInt(constrained), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `constrain(${value}, ${lower}, ${upper})`, + }); +} +export function cr_abs() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + // Calculate the absolute value + value = value > 0 ? value : -value; + writeRegister(BigInt(value), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `abs(${value})` }); +} +export function cr_max() { + //Var 1: Expected always an int32 + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + // Var2: Expected always an int32 + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // Find the maximum value + const max = value1 > value2 ? value1 : value2; + writeRegister(BigInt(max), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `max(${value1}, ${value2})`, + }); +} +export function cr_min() { + //Var 1: Expected always an int32 + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + //Var 2: Expected always an int32 + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // Find the minimun value + const min = value1 < value2 ? value1 : value2; + writeRegister(BigInt(min), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `min(${value1}, ${value2})`, + }); +} +export function cr_pow() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + //Var 2: Expected always an int32 + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + const pow = Math.pow(Number(value1), Number(value2)); + writeRegister(BigInt(pow), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `pow(${value1}, ${value2})`, + }); +} +export function cr_bit() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + if (value1 < 0n || value1 > 31n) { + res = 0n; // Invalid bit position + } else { + res = 1n << value1; // Calculate the bit value + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `bit(${value1})` }); +} +export function cr_bitClear() { + //Numeric variable whose bit to clear + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + //Bit to clear, starting 0 for least-significant + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asUintN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + if (value2 < 0n || value2 > 31n) { + res = value1; // Invalid bit position, return original value + } else { + res = value1 & ~(1n << value2); // Clear the specified bit + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `bitClear(${value1}, ${value2})`, + }); +} +export function cr_bitRead() { + //Numeric variable whose bit to read + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + //Bit to read, starting 0 for least-significant + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asUintN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + if (value2 < 0n || value2 > 31n) { + res = 0n; // Invalid bit position, return 0 + } else { + res = (value1 & (1n << value2)) !== 0n ? 1n : 0n; // Read the specified bit + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `bitRead(${value1}, ${value2})`, + }); +} +export function cr_bitSet() { + //Numeric variable whose bit to set + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + //Bit to set, starting 0 for least-significant + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asUintN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + if (value2 < 0n || value2 > 31n) { + res = 0n; // Invalid bit position, return 0 + } else { + res = value1 | (1n << value2); // Set the specified bit + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `bitSet(${value1}, ${value2})`, + }); +} +export function cr_bitWrite() { + //Numeric variable whose bit to write + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + //Bit to write, starting 0 for least-significant + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value2 = BigInt.asUintN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // Value to write + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value3 = BigInt.asUintN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + + if (value2 < 0n || value2 > 31n) { + res = value1; // Invalid bit position, return original value + } else { + if (value3 == 0n) { + res = value1 & ~(1n << value2); // Clear the specified bit + } else if (value3 == 1n) { + res = value1 | (1n << value2); // Set the specified bit + } else { + throw packExecute( + true, + "capi_syscall: invalid value for bitWrite", + "danger", + null, + ); + } + } + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `bitWrite(${value1}, ${value2}, ${value3})`, + }); +} +export function cr_highByte() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + var res = 0n; + res = (value1 >> 8n) & 0xffn; // Get the high byte + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `highByte(${value1})` }); +} +export function cr_lowByte() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); //bit functions in arduino work with uint8_t numbers + let res = value1 & 0xffn; // Get the low byte + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `lowByte(${value1})` }); +} +export function cr_attachInterrupt() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var interr_pos = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a1 not found", + "danger", + null, + ); + } + var interr_isr = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // esp32vect.value[Number(interr_pos)]![1] = interr_isr; + //TODO: Modes + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_syscall: register a2 not found", + "danger", + null, + ); + } + var mode = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + // esp32vect.value[Number(interr_pos)]![2] = mode; + //TODO: Graphic retroalimentation + // const gpiopin = "GPIO" + esp32vect.value[Number(interr_pos)]![0]; + let gpiopin = "GPIO?"; // Valor por defecto + + coreEvents.emit("arduino-get-pin-from-slot", { + position: Number(interr_pos), + callback: (pin: string) => { + gpiopin = "GPIO" + pin; // El suscriptor nos devuelve el pin real + } + }); + coreEvents.emit("arduino-terminal-write", { + text: `attachInterrupt(${interr_pos}, 0x${interr_isr.toString(16)}, ${mode}) `, + }); + coreEvents.emit("arduino-pin-interrupt", { pin: gpiopin, mode: mode, isr: interr_isr, position: interr_pos }); +} +export function cr_detachInterrupt() { + //TODO: Revise + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var interr_pos = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + // esp32vect.value[Number(interr_pos)] = [esp32vect.value[Number(interr_pos)]![0], 0n, 0n]; + // const gpiopin = "GPIO" + esp32vect.value[Number(interr_pos)]![0]; + const gpiopin = "GPIO" + "6"; + coreEvents.emit("arduino-terminal-write", { + text: `detachInterrupt(${interr_pos})`, + }); + coreEvents.emit("arduino-pin-detach-interrupt", { pin: gpiopin }); +} +export function cr_digitalPinToInterrupt() { + // Returns the first interrupt place free + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asUintN(32, readRegister(ret1.indexComp, ret1.indexElem)); + //Find clean slot in the interrupt vector table + let pos = -1; + // const pos = esp32vect.value.findIndex( + // (slot: bigint[]) => slot[1] === 0n && slot[2] === 0n, + // ); + coreEvents.emit("arduino-find-vector-slot", { + callback: (index: number) => { + pos = index; + } + }); + + // Si no encuentra ninguna posición libre, findIndex devuelve -1 + if (pos === -1) { + throw packExecute( + true, + "ESP32 Interrupt Table Full: No free slots available", + "warning", + null, + ); + } + // esp32vect.value[pos] = [BigInt(pin), 0n, 0n]; // Mark the slot as used with the position + coreEvents.emit("arduino-pin-interrupt", { + position: BigInt(pos), + pin: pin.toString(), + mode: 0n, + isr: 0n, + }); + writeRegister(BigInt(pos), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `digitalPinToInterrupt(${pin})`, + }); +} +export function cr_interrupts() { + coreEvents.emit("arduino-interrupts-enabled", true); +} +export function cr_nointerrupts() { + coreEvents.emit("arduino-interrupts-enabled", false); +} +export function cr_isDigit() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 48n && value1 <= 57n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isDigit(${value1})` }); +} +export function cr_isAlpha() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + (value1 >= 65n && value1 <= 90n) || (value1 >= 97n && value1 <= 122n) + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isAlpha(${value1})` }); +} +export function cr_isAlphaNumeric() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + (value1 >= 65n && value1 <= 90n) || (value1 >= 97n && value1 <= 122n) + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isAlphaNumeric(${value1})`, + }); +} +export function cr_isAscii() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 0n && value1 <= 127n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isAscii(${value1})` }); +} +export function cr_isControl() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = (value1 >= 0n && value1 <= 31n) || value1 === 127n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isControl(${value1})` }); +} +export function cr_isPunct() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + (value1 >= 33n && value1 <= 47n) || + (value1 >= 58n && value1 <= 64n) || + (value1 >= 91n && value1 <= 96n) || + (value1 >= 123n && value1 <= 126n) + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isPunct(${value1})` }); +} +export function cr_isHexadecimalDigit() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + (value1 >= 48n && value1 <= 57n) || + (value1 >= 65n && value1 <= 70n) || + (value1 >= 97n && value1 <= 102n) + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isHexadecimalDigit(${value1})`, + }); +} +export function cr_isUpperCase() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 65n && value1 <= 90n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isUpperCase(${value1})`, + }); +} +export function cr_isLowerCase() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 97n && value1 <= 122n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isLowerCase(${value1})`, + }); +} +export function cr_isPrintable() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 32n && value1 <= 126n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isPrintable(${value1})`, + }); +} +export function cr_isGraph() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = value1 >= 33n && value1 <= 126n ? 1n : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isGraph(${value1})` }); +} +export function cr_isSpace() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + value1 === 32n || + value1 === 9n || + value1 === 10n || + value1 === 13n || + value1 === 11n || + value1 === 12n + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { text: `isSpace(${value1})` }); +} +export function cr_isWhiteSpace() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + let res = + value1 === 32n || + value1 === 9n || + value1 === 10n || + value1 === 13n || + value1 === 11n || + value1 === 12n + ? 1n + : 0n; + writeRegister(BigInt(res), ret1.indexComp, ret1.indexElem); + coreEvents.emit("arduino-terminal-write", { + text: `isWhiteSpace(${value1})`, + }); +} +export function cr_delay() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { text: `delay(${value1})` }); + // Simulate delay by busy-waiting + const start = Date.now(); + while (Date.now() - start < Number(value1)) { + // Busy wait + } +} +export function cr_delayMicroseconds() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + // Simulate microsecond delay by busy-waiting + coreEvents.emit("arduino-terminal-write", { + text: `delayMicroseconds(${value1})`, + }); + const start = performance.now(); + while (performance.now() - start < Number(value1) / 1000) { + // Busy wait + } +} +export function cr_randomSeed() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asUintN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `randomSeed(${value1})`, + }); + _seed = Number(value1) >>> 0; +} +export function cr_random() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + var value1 = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register a1 not found", + "danger", + null, + ); + } + var value2 = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + // Linear Congruential Generator (LCG) + // Constants from Numerical Recipes + _seed = (_seed * 1664525 + 1013904223) >>> 0; + var rand = _seed / 0xffffffff; + if (value2 === 0n) { + // Return a random number between 0 and value1-1 + var randomValue = Math.floor(rand * Number(value1)); + coreEvents.emit("arduino-terminal-write", { + text: `random(${value1})`, + }); + writeRegister(BigInt(randomValue), ret1.indexComp, ret1.indexElem); + } else { + // Random between value1 and value2 + if (value1 > value2) { + var temp = value1; + value1 = value2; + value2 = temp; + } + var randomValue = + Math.floor(rand * Number(value2 - value1)) + Number(value1); + coreEvents.emit("arduino-terminal-write", { + text: `random(${value1}, ${value2})`, + }); + writeRegister(BigInt(randomValue), ret1.indexComp, ret1.indexElem); + } +} +export function cr_serial_available() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + if (serial_begin != 0 && initArduino != 0) { + // Check how many bytes are available in the keyboard input buffer + var available = BigInt( + typeof status.keyboard === "string" ? status.keyboard.length : 0, + ); + coreEvents.emit("arduino-terminal-write", { + text: `serial_available()`, + }); + writeRegister(available, ret1.indexComp, ret1.indexElem); + } else { + //ERROR + coreEvents.emit("arduino-terminal-write", { + text: `serial_available() = -1`, + }); + writeRegister(BigInt.asIntN(32, -1n), ret1.indexComp, ret1.indexElem); + } +} +export function cr_serial_availableForWrite() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register a0 not found", + "danger", + null, + ); + } + if (serial_begin != 0 && initArduino != 0) { + // Ready but with nothing being sended TODO: simulate complex scenaries + writeRegister(64n, ret1.indexComp, ret1.indexElem); //simulates 64k buffer + coreEvents.emit("arduino-terminal-write", { + text: `serial_availableForWrite()`, + }); + //in real hw it will only show data if its receiving data + } else { + //ERROR + coreEvents.emit("arduino-terminal-write", { + text: `serial_availableForWrite()`, + }); + writeRegister(-1n, ret1.indexComp, ret1.indexElem); + } +} +export function cr_serial_begin() { + if (initArduino != 0) { + if (serial_begin === 0) { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a0" + " not found", + "danger", + null, + ); + } + + /* Print integer */ + var value = readRegister(ret1.indexComp, ret1.indexElem); + //TODO: put frequences accepted values check + var val_int = parseInt(value.toString()) >> 0; + coreEvents.emit("arduino-terminal-write", { + text: `serial_begin(${val_int})`, + }); + serial_begin = val_int; + } + } +} +export function cr_serial_end() { + if (serial_begin != 0 && initArduino != 0) { + coreEvents.emit("arduino-terminal-write", { text: `serial_end()` }); + serial_begin = 0; // Reset serial_begin + } +} +export function cr_serial_find() { + coreEvents.emit("arduino-terminal-write", { + text: `serial_find(a0, a1)`, + }); + if (serial_begin != 0 && initArduino != 0) { + keyboard_read_find(kbd_read_string, "a0", "a1"); + } +} +export function cr_serial_findUntil() { + coreEvents.emit("arduino-terminal-write", { + text: `serial_findUntil(a0, x0,a1)`, + }); + if (serial_begin != 0 && initArduino != 0) { + keyboard_read_find(kbd_read_string, "a0", "x0", "a1"); + } +} +export function cr_serial_flush() { + //Cleans the serial buffer. Not exaclty what the board does, imitates Arduino 1.0 + coreEvents.emit("arduino-terminal-write", { + text: `serial_flush()`, + }); + if (serial_begin != 0 && initArduino != 0) { + status.keyboard = ""; + const root = (document as any).app; + if (root) { + root.keyboard = ""; + root.enter = null; + } + } +} +export function cr_serial_parseInt() { + + coreEvents.emit("arduino-terminal-write", { + text: `serial_parseInt(a0)`, + }); + if (serial_begin != 0 && initArduino != 0) { + keyboard_parseInt(kbd_read_string, "a0"); + } +} +export function cr_serial_read() { + coreEvents.emit("arduino-terminal-write", { + text: `serial_read(a0)`, + }); + if (serial_begin != 0 && initArduino != 0) { + keyboard_read(kbd_read_char, "a0"); + } +} +export function cr_serial_readBytes() { + if (serial_begin != 0 && initArduino != 0) { + var register = crex_findReg("a0"); + if (register.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a0" + " not found", + "danger", + null, + ); + } + // Length + const auxreg = crex_findReg("a1"); + if (auxreg.match === 0) { + throw new Error("capi_syscall: register a1 not found"); + } + const size = readRegister(auxreg.indexComp, auxreg.indexElem); + + const funct_params = { + indexComp: register.indexComp, + indexElem: register.indexElem, + size, + }; + coreEvents.emit("arduino-terminal-write", { + text: `serial_readBytes(a0, a1)`, + }); + status.run_program = 3; + return keyboard_read(kbd_read_string, funct_params); + } +} +export function cr_serial_readBytesUntil() { + if (serial_begin != 0 && initArduino != 0) { + // Value 1 is the searched char + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a0" + " not found", + "danger", + null, + ); + } + // Check if value1 is a number and is a valid ASCII character + var value1 = readRegister(ret1.indexComp, ret1.indexElem); + if (typeof value1 !== "bigint" || value1 < 0 || value1 > 255) { + throw packExecute( + true, + "capi_syscall: invalid value for searched character", + "danger", + null, + ); + } + + // Value 2 is the buffer + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a1" + " not found", + "danger", + null, + ); + } + + // Value 3 is the length or end character + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + "a2" + " not found", + "danger", + null, + ); + } + // Check if value3 is a number and greater than 0 + var value3_check = readRegister(ret3.indexComp, ret3.indexElem); + if (typeof value3_check !== "bigint" || value3_check <= 0) { + throw packExecute( + true, + "capi_syscall: invalid value for length/end char", + "danger", + null, + ); + } + coreEvents.emit("arduino-terminal-write", { + text: `serial_readBytesUntil(a0, a1, a2)`, + }); + status.run_program = 3; + return keyboard_read_until(kbd_read_string, ret2, value1); + } +} +export function cr_serial_write() { + const valReg = crex_findReg("a0"); + if (valReg.match === 0) { + throw packExecute(true, "capi_arduino: register a0 not found", "danger", null); + } + //This version only transforms bytes to char, function overloading contradicts how it works + const fullValue = readRegister(valReg.indexComp, valReg.indexElem); + + // 3. Extraemos solo los 8 bits inferiores (máscara 0xFF) + const byte = Number(BigInt.asUintN(8, fullValue)); + + const char = String.fromCharCode(byte); + + coreEvents.emit("arduino-terminal-write", { + text: "serial_write(" + char + ")", + }); + display_print(char); +} +export function cr_serial_printf() { + // Get the address from register a0 + const valueReg = crex_findReg("a0"); + if (valueReg.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + // Read the address stored in the register (already BigInt) + let stringAddress = readRegister( + valueReg.indexComp, + valueReg.indexElem, + ) as bigint; + + // Normalize address to positive range + stringAddress = BigInt.asUintN(32, stringAddress); + + // Get the memory instance + const memory = main_memory as Memory; + + // Validate address is within memory bounds + if (stringAddress >= BigInt(memory.getSize())) { + throw packExecute( + true, + "capi_arduino: invalid string address", + "danger", + null, + ); + } + + // Read the format string from memory + let formatString = ""; + let memoryAddr = stringAddress; + while (memoryAddr < BigInt(memory.getSize())) { + const byte = memory.read(memoryAddr); + if (byte === 0) break; // Null terminator + formatString += String.fromCharCode(byte); + memoryAddr++; + } + + // Process format specifiers + let result = formatString; + const argRegisters = ["a1", "a2", "a3", "a4", "a5", "a6", "a7"]; + + for (const reg of argRegisters) { + const argReg = crex_findReg(reg); + if (argReg.match === 0) break; + + const argValue = readRegister(argReg.indexComp, argReg.indexElem); + + // Replacements + result = result.replace("%d", String(BigInt.asIntN(32, argValue))); + result = result.replace("%u", String(BigInt.asUintN(32, argValue))); + result = result.replace( + "%x", + BigInt.asUintN(32, argValue).toString(16), + ); + result = result.replace( + "%c", + String.fromCharCode(Number(BigInt.asUintN(8, argValue))), + ); + if (result.includes("%s")) { + let str = ""; + let addr = argValue; + + while (addr < BigInt(memory.getSize())) { + const byte = memory.read(addr); + if (byte === 0) break; // Null terminator + str += String.fromCharCode(byte); + addr++; + } + result = result.replace("%s", str); + } + } + + // Print the formatted string directly + coreEvents.emit("arduino-terminal-write", { + text: `serial_printf(a0, a1)`, + }); + display_print(result); +} +export function cr_tone() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var duration = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `tone(${pin}, ${value}, ${duration})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_noTone() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + coreEvents.emit("arduino-terminal-write", { text: `noTone(${pin})` }); + coreEvents.emit("arduino-pin-write", { pin: Number(pin), value: 0 }); +} +export function cr_pulseIn() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var duration = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `pulseIn(${pin}, ${value}, ${duration})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_pulseInLong() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var pin = BigInt.asIntN(32, readRegister(ret1.indexComp, ret1.indexElem)); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN(32, readRegister(ret2.indexComp, ret2.indexElem)); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var duration = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `pulseInLong(${pin}, ${value}, ${duration})`, + }); + coreEvents.emit("arduino-pin-write", { + pin: Number(pin), + value: Number(value), + }); +} +export function cr_shiftIn() { + let value = 0; + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var dataPin = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var clockPin = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var bitOrder = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `shiftIn(${dataPin}, ${clockPin}, ${bitOrder})`, + }); + let bit = 0; + for (let i = 0; i < 8; i++) { + // let bit = pinStates.value[`GPIO${dataPin}`] !== 0 ? 1 : 0; + coreEvents.emit("arduino-pin-read", { + pin: `GPIO${dataPin}`, + callback: (val: number) => { + bit = val; + } + }); + if (bitOrder === 1n) { + // MSBFIRST + value |= bit << (7 - i); + } else { + // LSBFIRST + value |= bit << i; + } + } + writeRegister(BigInt(value), ret1.indexComp, ret1.indexElem); +} +export function cr_shiftOut() { + var ret1 = crex_findReg("a0"); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_arduino: register a0 not found", + "danger", + null, + ); + } + var dataPin = BigInt.asIntN( + 32, + readRegister(ret1.indexComp, ret1.indexElem), + ); + + var ret2 = crex_findReg("a1"); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_arduino: register a1 not found", + "danger", + null, + ); + } + var clockPin = BigInt.asIntN( + 32, + readRegister(ret2.indexComp, ret2.indexElem), + ); + + var ret3 = crex_findReg("a2"); + if (ret3.match === 0) { + throw packExecute( + true, + "capi_arduino: register a2 not found", + "danger", + null, + ); + } + var bitOrder = BigInt.asIntN( + 32, + readRegister(ret3.indexComp, ret3.indexElem), + ); + var ret4 = crex_findReg("a3"); + if (ret4.match === 0) { + throw packExecute( + true, + "capi_arduino: register a3 not found", + "danger", + null, + ); + } + var value = BigInt.asIntN( + 32, + readRegister(ret4.indexComp, ret4.indexElem), + ); + coreEvents.emit("arduino-terminal-write", { + text: `shiftOut(${dataPin}, ${clockPin}, ${bitOrder}, ${value})`, + }); +for (let i = 0; i < 8; i++) { + let bit; + // Importante: Usamos 1n para operaciones con BigInt + if (bitOrder === 1n) { + // MSBFIRST: del bit 7 al 0 + bit = (value & (1n << BigInt(7 - i))) ? 1n : 0n; + } else { + // LSBFIRST: del bit 0 al 7 + bit = (value & (1n << BigInt(i))) ? 1n : 0n; + } + // pinStates.value[`GPIO${dataPin}`] = Number(bit); + coreEvents.emit("arduino-pin-write", { + pin: Number(dataPin), + value: Number(value), + }); + } + + +} + +//Order +export const hookOrder = [ + "cr_initArduino", + "cr_digitalRead", + "cr_pinMode", + "cr_digitalWrite", + "cr_rgbLedWrite", + "cr_analogRead", + "cr_analogReadResolution", + "cr_analogWrite", + "cr_map", + "cr_constrain", + "cr_abs", + "cr_max", + "cr_min", + "cr_pow", + "cr_bit", + "cr_bitClear", + "cr_bitRead", + "cr_bitSet", + "cr_bitWrite", + "cr_highByte", + "cr_lowByte", + "cr_attachInterrupt", + "cr_detachInterrupt", + "cr_digitalPinToInterrupt", + "cr_pulseIn", + "cr_pulseInLong", + "cr_shiftIn", + "cr_shiftOut", + "cr_tone", + "cr_noTone", + "cr_interrupts", + "cr_nointerrupts", + "cr_isDigit", + "cr_isAlpha", + "cr_isAlphaNumeric", + "cr_isAscii", + "cr_isControl", + "cr_isPunct", + "cr_isHexadecimalDigit", + "cr_isUpperCase", + "cr_isLowerCase", + "cr_isPrintable", + "cr_isGraph", + "cr_isSpace", + "cr_isWhiteSpace", + "cr_delay", + "cr_delayMicroseconds", + "cr_randomSeed", + "cr_random", + "cr_serial_available", + "cr_serial_availableForWrite", + "cr_serial_begin", + "cr_serial_end", + "cr_serial_find", + "cr_serial_findUntil", + "cr_serial_flush", + "cr_serial_parseInt", + "cr_serial_read", + "cr_serial_readBytes", + "cr_serial_readBytesUntil", + "cr_serial_write", + "cr_serial_printf", +]; diff --git a/src/core/capi/initCAPI.mts b/src/core/capi/initCAPI.mts index 7a8731650..85545d5ea 100644 --- a/src/core/capi/initCAPI.mts +++ b/src/core/capi/initCAPI.mts @@ -27,6 +27,7 @@ import { ARCH as Z80 } from "./arch/z80.mjs"; import { ARCH as MIPS } from "./arch/mips.mjs"; import { REG } from "./registers.mts"; import { INTERRUPTS } from "./interrupts.mts"; +import { ARDUINO } from "./arduino.mts"; export interface CAPIType { MEM: typeof MEM; @@ -37,6 +38,7 @@ export interface CAPIType { ARCH: unknown; // The architecture plugin will be loaded here REG: typeof REG; INTERRUPTS: typeof INTERRUPTS; + ARDUINO: typeof ARDUINO; } declare global { @@ -70,6 +72,7 @@ export function initCAPI(pluginName?: string) { ARCH: ARCH_PLUGIN, REG, INTERRUPTS, + ARDUINO, }; globalThis.CAPI = CAPI; diff --git a/src/core/capi/memory.mts b/src/core/capi/memory.mts index ef5ef4b38..4c1978c63 100644 --- a/src/core/capi/memory.mts +++ b/src/core/capi/memory.mts @@ -17,11 +17,11 @@ * along with CREATOR. If not, see . */ -import { main_memory, stackTracker, BYTESIZE } from "../core.mjs"; +import { main_memory, stackTracker, BYTESIZE, REGISTERS } from "../core.mjs"; import { exit } from "../executor/executor.mjs"; import { raise } from "./validation.mts"; import { crex_findReg } from "../register/registerLookup.mjs"; -import { sentinel } from "../sentinel/sentinel.mjs"; +import { sentinel } from "../sentinel/sentinel.mts"; import { checkDeviceAddr, devices } from "../executor/devices.mts"; import type { Memory } from "../memory/Memory.mts"; import { toHex } from "../utils/utils.mjs"; @@ -226,7 +226,7 @@ export const MEM = { if (hint) { try { const sizeInBits = bytes * BYTESIZE; - memory.addHint(BigInt(address), "", hint, sizeInBits); + memory.addHint(BigInt(address), [], hint, sizeInBits); } catch (e) { raise( "Failed to add hint for address '0x" + @@ -245,9 +245,10 @@ export const MEM = { const i = ret.indexComp; const j = ret.indexElem; - // Add stack hint if we're writing to the stack segment and have a register name - if (segment === "stack" && reg_name) { - stackTracker.addHint(address, reg_name); + // Add stack hint if we're writing to the stack segment + if (segment === "stack") { + const reg = REGISTERS[i]!.elements[j]!; + stackTracker.addHint(address, reg.name.join(",")); } sentinel.recordMemoryWrite(i, j, address, byteArray.length); @@ -319,10 +320,14 @@ export const MEM = { return ret; }, - alloc(bytes: number): number { - // TODO - raise("MEM.alloc is not implemented"); - return 0; + /** + * Allocates N bytes of memory + * + * @param bytes - Amount of bytes to allocate + * @returns Starting address of the allocation + */ + alloc(bytes: number): bigint { + return main_memory.alloc(bytes, "data"); }, /** @@ -341,7 +346,7 @@ export const MEM = { : devices.get(deviceID)!.memory; try { - memory.addHint(address, "", hint, sizeInBits); + memory.addHint(address, [], hint, sizeInBits); return true; } catch (e) { raise( diff --git a/src/core/capi/stack.mts b/src/core/capi/stack.mts index 4a98abf41..2ca0b5212 100644 --- a/src/core/capi/stack.mts +++ b/src/core/capi/stack.mts @@ -19,7 +19,7 @@ import { architecture, REGISTERS, getPC, stackTracker } from "../core.mjs"; import { tag_instructions } from "../assembler/assembler.mjs"; -import { sentinel } from "../sentinel/sentinel.mjs"; +import { sentinel } from "../sentinel/sentinel.mts"; import { creator_ga } from "../utils/creator_ga.mjs"; import { coreEvents, CoreEventTypes } from "../events.mts"; @@ -47,8 +47,7 @@ export const STACK = { } }, endFrame() { - // stack tracker: pop both frames - stackTracker.popFrame(); + // stack tracker: pop frame stackTracker.popFrame(); // sentinel @@ -56,9 +55,6 @@ export const STACK = { return; } - // get function name - const currentFunction = sentinel.getCurrentFunction() || "unknown"; - const ret = sentinel.leave(); if (ret.ok) { @@ -66,17 +62,13 @@ export const STACK = { } // emit event for GUI - coreEvents.emit(CoreEventTypes.SENTINEL_ERROR, { - functionName: currentFunction, - message: ret.msg, - ok: false, - }); + coreEvents.emit(CoreEventTypes.SENTINEL_ERROR, ret); // Google Analytics creator_ga( "execute", "execute.exception", - "execute.exception.protection_jrra" + ret.msg, + "execute.exception.protection_jrra", ); }, diff --git a/src/core/capi/syscall.mts b/src/core/capi/syscall.mts index 4c2318813..c5708af84 100644 --- a/src/core/capi/syscall.mts +++ b/src/core/capi/syscall.mts @@ -29,7 +29,7 @@ import { kbd_read_char, kbd_read_string, } from "../executor/IO.mjs"; -import { readRegister } from "../register/registerOperations.mjs"; +import { readRegister, writeRegister } from "../register/registerOperations.mjs"; import { creator_ga } from "../utils/creator_ga.mjs"; import type { Memory } from "../memory/Memory.mts"; import { coreEvents, CoreEventTypes } from "../events.mts"; @@ -68,14 +68,16 @@ export const SYSCALL = { break; } case "string": { - const buffer = []; + const bytes = []; // read byte by byte until a null terminator is found for (let i = 0; i < mainMemory.getSize(); i++) { - const byte = mainMemory.read((value as bigint) + BigInt(i)); + const byte = mainMemory.read(BigInt(value) + BigInt(i)); if (byte === 0) break; // null terminator - buffer.push(String.fromCharCode(byte)); + bytes.push(byte); } - const msg = buffer.join(""); + // Decode the UTF-8 data to a string + const buffer = new Uint8Array(bytes); + const msg = new TextDecoder().decode(buffer); display_print(msg); break; } @@ -158,30 +160,36 @@ export const SYSCALL = { } }, - sbrk(value1: string, value2: string) { - // TODO: this is (probably) broken + /** + * Allocates N bytes of memory + * + * @param size - Name of the register with the size to allocate + * @param ret_addr - Name of the register where the address of the beginning + * of the allocation should be placed + */ + sbrk(size: string, ret_addr: string) { /* Google Analytics */ creator_ga("execute", "execute.syscall", "execute.syscall.sbrk"); /* Get register id */ - const ret1 = crex_findReg(value1); - if (ret1.match === 0) { - throw new Error("capi_syscall: register " + value1 + " not found"); + const size_reg = crex_findReg(size); + if (size_reg.match === 0) { + throw new Error("capi_syscall: register " + size + " not found"); } - const ret2 = crex_findReg(value2); - if (ret2.match === 0) { - throw new Error("capi_syscall: register " + value2 + " not found"); + const ret_addr_reg = crex_findReg(ret_addr); + if (ret_addr_reg.match === 0) { + throw new Error("capi_syscall: register " + ret_addr + " not found"); } /* Request more memory */ - const new_size = readRegister(ret1.indexComp, ret1.indexElem); + const new_size = readRegister(size_reg.indexComp, size_reg.indexElem); if (new_size < 0) { throw new Error("capi_syscall: negative size"); } - // const new_addr = creator_memory_alloc(new_size); - // writeRegister(new_addr, ret2.indexComp, ret2.indexElem); + const new_addr = CAPI.MEM.alloc(Number(new_size)); + writeRegister(new_addr, ret_addr_reg.indexComp, ret_addr_reg.indexElem); }, get_clk_cycles(): number { diff --git a/src/core/capi/validation.mts b/src/core/capi/validation.mts index dd4276e07..4fe2c40c5 100644 --- a/src/core/capi/validation.mts +++ b/src/core/capi/validation.mts @@ -18,6 +18,7 @@ */ import { capi_uint2int } from "./fp.mts"; +import { architecture } from "../core.mjs"; type Document = { app: { exception(msg: string): unknown } }; @@ -44,8 +45,15 @@ export function isOverflow(op1: bigint, op2: bigint, res_u: bigint) { ); } -export function isMisaligned(addr: bigint, type: string) { - return false; +/** + * Checks whether an address is misaligned + * @param addr - Base address to read/write + * @param size - Size of the element being read/written + **/ +export function isMisaligned(addr: bigint, size: bigint|number) { + const config = architecture.config; + const word_size_bytes = BigInt(config.word_size / config.byte_size); + return addr % word_size_bytes !== 0n && addr % BigInt(size) !== 0n; } // Object export for initCAPI spreading diff --git a/src/core/core.mjs b/src/core/core.mjs index ba293341e..4b281b26e 100644 --- a/src/core/core.mjs +++ b/src/core/core.mjs @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with CREATOR. If not, see . */ - +import yaml from "js-yaml"; import { initCAPI } from "./capi/initCAPI.mts"; import { getHexTwosComplement } from "./utils/utils.mjs"; import { logger } from "./utils/creator_logger.mjs"; @@ -35,7 +35,7 @@ import { import { readRegister, writeRegister } from "./register/registerOperations.mjs"; import { StackTracker } from "./memory/StackTracker.mts"; import { creator_ga } from "./utils/creator_ga.mjs"; -import { sentinel } from "./sentinel/sentinel.mjs"; +import { sentinel } from "./sentinel/sentinel.mts"; import { resetStats } from "./executor/stats.mts"; import { resetDecoderCache } from "./executor/decoder.mjs"; import { coreEvents } from "./events.mts"; @@ -48,6 +48,8 @@ import { init, compileArchitectureFunctions } from "./executor/executor.mjs"; import { resetDevices } from "./executor/devices.mts"; import { compileTimerFunctions } from "./executor/timers.mts"; import * as archProcessor from "./utils/architectureProcessor.mjs"; +import { writeDataDumpMemory32, writeDataDumpMemory64 } from "./assembler/sailAssembler/web/CNAssambler.mjs"; +import { disassemble_lib } from "@/web/components/assembly/MultifileEditor.mjs"; /** @type {import("./core.d.ts").Library | import("./core.d.ts").LegacyLibrary} */ export let loadedLibrary = {}; @@ -80,6 +82,13 @@ export const guiVariables = { keep_highlighted: -1n, // Address to keep highlighted (used to highlight interrupted instructions) }; +export var L1_cache_memory = [/*{id:0, addr: "0", binary: "0x00"}*/]; +export var L1_I_cache_memory = []; +export var L1_D_cache_memory = []; +export var L2_cache_memory = []; +export var L2_I_cache_memory = []; +export var L2_D_cache_memory = []; +export var config_cache = []; /** @type {number} */ export let WORDSIZE; /** @type {number} */ @@ -87,7 +96,6 @@ export let BYTESIZE; export let ENDIANNESSARR = []; /** @type {import("./core.d.ts").RegisterBank[]} */ export let REGISTERS; -export let REGISTERS_BACKUP = []; export const register_size_bits = 32; //TODO: load from architecture /** @type {Memory} */ export let main_memory; @@ -103,7 +111,7 @@ export let interruptManager; export function setInterruptManager(value) { interruptManager = value; } -/** @type {Memory} */ +/** @type {MemoryBackup} */ export let main_memory_backup; export function updateMainMemoryBackup(value) { main_memory_backup = value; @@ -119,6 +127,7 @@ export const instructions_packed = 100; export { initCAPI }; // Instead of calling it here, which causes circular dependencies, we re-export it so it can be called by the main application. let creator_debug = false; +let creator_kernel = true; BigInt.prototype.toJSON = function () { return JSON.rawJSON(this.toString()); @@ -133,6 +142,11 @@ export function set_debug(enable_debug) { logger.disable(); } } + +export function set_kernel(enable_kernel) { + creator_kernel = enable_kernel; +} + /** * Load architecture from YAML string and prepare for use * @param {string} architectureYaml - YAML string containing architecture definition @@ -212,10 +226,6 @@ export function loadArchitecture(architectureYaml, isa = []) { stackTracker = new StackTracker(); interruptManager = new InterruptManager(status.interrupt_handler); - // Create deep copy backup of REGISTERS after all initialization is complete - // This ensures the backup contains the correct values for all registers, including SP - REGISTERS_BACKUP = JSON.parse(JSON.stringify(REGISTERS)); - PC_REG_INDEX = crex_findReg_bytag("program_counter"); SP_REG_INDEX = crex_findReg_bytag("stack_pointer"); @@ -241,14 +251,24 @@ export function loadArchitecture(architectureYaml, isa = []) { */ export function load_library(lib_str) { // Parse YAML library format - import("js-yaml") - .then(yaml => { - loadedLibrary = yaml.load(lib_str); - coreEvents.emit("library-loaded"); - }) - .catch(error => { - throw new SyntaxError(`Invalid library format: ${error.message}`); - }); + try { + loadedLibrary = yaml.load(lib_str); + coreEvents.emit("library-loaded"); + } catch (error) { + throw new SyntaxError(`Invalid library format: ${error.message}`); + }; +} +/** + * Loads a library to Sail simulator. + * + * @param {string} lib_str + * + */ + +export async function load_library_sail(lib, lib_name) { + loadedLibrary = {name: lib_name, library_file: lib}; + await disassemble_lib(loadedLibrary); + coreEvents.emit("library-loaded"); } /** @@ -259,9 +279,6 @@ export function remove_library() { loadedCreatino = false; coreEvents.emit("library-removed"); } -/** - * Add CREATino library. - */ export async function load_CREATino() { //show_loading(); try { @@ -284,8 +301,26 @@ export async function load_CREATino() { // compilation -export async function assembly_compile(code, compiler) { - const ret = await assembly_compiler(code, false, compiler); +/** + * Compiles an assembly code with the chosen compiler + * @param {string} code + * @param {import("./assembler/assembler.d.ts").CompilerFn} compiler + * @param {boolean} ansi_color - Whether to format errors with ANSI escape sequences + * (`true`) or HTML tags (`false`) + **/ +export async function assembly_compile(code, compiler, ansi_color = false) { + var ret; + + if (architecture.config.name.includes("SRV")){ + if (Object.keys(loadedLibrary).length === 0) + ret = await assembly_compiler(code, false, compiler, ansi_color); + else + ret = await assembly_compiler(code, true, compiler, ansi_color); + } + else{ + ret = await assembly_compiler(code, false, compiler, ansi_color); + } + switch (ret.status) { case "error": break; @@ -300,7 +335,7 @@ export async function assembly_compile(code, compiler) { break; default: - ret.msg = "Unknow assembly compiler code :-/"; + ret.msg = "Unknown assembly compiler code :-/"; break; } @@ -337,15 +372,10 @@ export function reset() { status.display = ""; // reset registers - // Restore register values from backup, preserving BigInt types - for (let i = 0; i < REGISTERS.length; i++) { - for (let j = 0; j < REGISTERS[i].elements.length; j++) { - // Copy value from backup, ensuring it's a BigInt - const backupValue = REGISTERS_BACKUP[i].elements[j].value; - REGISTERS[i].elements[j].value = - typeof backupValue === "bigint" - ? backupValue - : BigInt(backupValue); + // Restore register default values + for (const file of REGISTERS) { + for (const register of file.elements) { + register.value = register.default_value } } crex_clearRegisterCache(); @@ -363,6 +393,36 @@ export function reset() { main_memory.restore(main_memory_backup); } + if (architecture.config.name.includes("SRV")){ + for (const instruction of instructions ?? []){ + const auxAddr = parseInt(instruction.Address,16); + for (let j = 0; j < instruction.hex.length; j += 32) { + const wordBinary = instruction.hex.slice(j, j+32); + const wordBytes = []; + + // Split word into bytes + for (let k = 0; k < wordBinary.length; k += 8) { + const byte = parseInt(wordBinary.slice(k, k+8), 2); + wordBytes.push(byte); + } + + main_memory.writeWord(BigInt(auxAddr + j / 8), wordBytes); + } + } + instructions.forEach(insn => { + insn.L1 = 0; + insn.L1_I = 0; + insn.L1_D = 0; + insn.L2 = 0; + insn.L2_I = 0; + insn.L2_D = 0; + }); + if (architecture.config.name === "SRV32") + writeDataDumpMemory32(); + else + writeDataDumpMemory64(); + + } // Stack Reset stackTracker.reset(); sentinel.reset(); @@ -618,11 +678,10 @@ export function getRegisterInfo(regName) { } export function getPC() { - const pc_address = readRegister( + return readRegister( PC_REG_INDEX.indexComp, PC_REG_INDEX.indexElem, ); - return BigInt(pc_address); } export function getSP() { @@ -641,3 +700,80 @@ export function setPC(value) { return null; } + +export function updateCacheMem(index, type, addr, value) { + + // Identificamps primero a que cache afecta + // Despues comprobamos si ese bloque de cache ya existe + // Si existe se reemplaza, sino se hace un push de una nueva línea + switch(type) { + case "L1_I": + let L1_I_index = L1_I_cache_memory.findIndex(block => block.id === index); + if (L1_I_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L1_I_num_lines) : -1; + L1_I_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L1_I_cache_memory[L1_I_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L1_I_cache_memory[L1_I_index].addr = addr; + } + document.app.L1_I_cache_memory = L1_I_cache_memory; + break; + case "L1_D": + let L1_D_index = L1_D_cache_memory.findIndex(block => block.id === index); + if (L1_D_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L1_D_num_lines) : -1; + L1_D_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L1_D_cache_memory[L1_D_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L1_D_cache_memory[L1_D_index].addr = addr; + } + break; + case "L1": + let L1_index = L1_cache_memory.findIndex(block => block.id === index); + if (L1_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L1_num_lines) : -1; + L1_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L1_cache_memory[L1_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L1_cache_memory[L1_index].addr = addr; + } + break; + case "L2": + let L2_index = L2_cache_memory.findIndex(block => block.id === index); + if (L2_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L2_num_lines) : -1; + L2_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L2_cache_memory[L2_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L2_cache_memory[L2_index].addr = addr; + } + break; + case "L2_I": + let L2_I_index = L2_I_cache_memory.findIndex(block => block.id === index); + if (L2_I_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L2_I_num_lines) : -1; + L2_I_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L2_I_cache_memory[L2_I_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L2_I_cache_memory[L2_I_index].addr = addr; + } + document.app.L2_I_cache_memory = L2_I_cache_memory; + break; + case "L2_D": + let L2_D_index = L2_D_cache_memory.findIndex(block => block.id === index); + if (L2_D_index === -1) { + let set_id = (document.app.$data.cache_location === "Associative_per_sets") ? Math.floor(index / document.app.$data.L2_D_num_lines) : -1; + L2_D_cache_memory.push({set_id: set_id, id: index, addr: addr, size: /*value.slice(2).length * 4*/ value/*value.slice(2)*/}); + } else { + + L2_D_cache_memory[L2_D_index].size = /*value.slice(2).length * 4*/ value; // Length in bits + L2_D_cache_memory[L2_D_index].addr = addr; + } + break; + } +} diff --git a/src/core/events.mts b/src/core/events.mts index c0c03ef62..53de4d76c 100644 --- a/src/core/events.mts +++ b/src/core/events.mts @@ -18,6 +18,7 @@ */ import mitt, { type Emitter } from "mitt"; +import { ARDUINO } from "./capi/arduino.mts"; /** * Event types for CREATOR core events @@ -31,6 +32,14 @@ export const CoreEventTypes = { LIBRARY_LOADED: "library-loaded", LIBRARY_REMOVED: "library-removed", EXECUTOR_BUTTONS_UPDATE: "executor-buttons-update", + PAUSE_EXEC: "pause-execution", + EXECUTOR_INSTRUCTIONS_UPDATE: "sail-instruction-update", + ASSEMBLY_FILES_UPDATE: "assembly-files-update", + ARDUINO_TERMINAL_WRITE: "arduino-terminal-write", + ARDUINO_PIN_CHANGED: "arduino-pin-write", + ARDUINO_RESET: "arduino-reset", + ARDUINO_PIN_INTERRUPT: "arduino-pin-interrupt", + VALIDATION_UPDATE: "update-validation", } as const; /** @@ -43,14 +52,26 @@ export interface RegisterUpdatedEvent { indexElem: number; } +/** + * Calling convention violation information + */ +export interface SentinelErrorData { + /** ID of the rule broken */ + rule: string, + /** Register in which the rule was broken, if applicable */ + register?: string[], + /** Full error message */ + message: string +} + /** * Emitted when calling convention violations are detected */ export interface SentinelErrorEvent { /** Name of the function that had violations */ functionName: string; - /** Full error message */ - message: string; + /** Violations found on the function */ + errors: SentinelErrorData[]; /** Whether the check passed (always false for error events) */ ok: boolean; } @@ -75,6 +96,20 @@ export interface ExecutorButtonsUpdateEvent { errorMessage?: string; } +export interface AssemblyFile { + filename: string; + code: string; + to_compile: boolean; + editing_now: boolean; + id: number; +} + +export interface AssemblyFilesUpdatedEvent { + files: AssemblyFile[]; + currentTab: number; +} + + /** * Core event types mapping */ @@ -95,7 +130,98 @@ export type CoreEvents = { "library-removed": void; /** Emitted when executor button states should be updated */ "executor-buttons-update": ExecutorButtonsUpdateEvent; + /** Emitted when assembly_files state change on Creat, rename, delete and show */ + "assembly-files-update": AssemblyFilesUpdatedEvent; + /** Emitted when the simulator sends text to the Arduino Terminal */ + "arduino-terminal-write": ArduinoTerminalWriteEvent; + /** Emitted when a Pin changes its values */ + "arduino-pin-write": ArduinoPinChangedEvent; + /** Emitted when a GPIO pin is read */ + "arduino-pin-read": ArduinoPinRead; + /** Emitted when Arduino is reset */ + "arduino-reset": void; + /** Event is emmited when a pin in pinMode has been set to a mode */ + "arduino-pin-mode":ArduinoPinMode; + /** Event is emmited when a pin is set up in an interrupt */ + "arduino-pin-interrupt":ArduinoPinInterruptEvent; + /** Emitted when a pin is detached from an interrupt */ + "arduino-pin-detach-interrupt": ArduinoPinDetachInterruptEvent; + /** Emitted when the simulator requests to find a free slot in the interrupt vector table */ + "arduino-find-vector-slot": ArduinoFindSlotEvent; + /** Emitted when the simulator requests to get the pin assigned to an interrupt vector slot */ + "arduino-get-pin-from-slot": ArduinoGetPinFromSlotEvent; + /** Emitted when interrupts are enabled/disabled */ + "arduino-interrupts-enabled": boolean; }; +/** + * Emitted when the simulator sends text to the Arduino Terminal + */ +export interface ArduinoTerminalWriteEvent { + /** The text to be displayed in the terminal */ + text: string; +} +/** + * Emitted when a Pin changes its value + */ +export interface ArduinoPinChangedEvent { + /** The pin number */ + pin: number; + /** The new value of the pin */ + value: number; +} + +/** + * Emitted when a Pin changes its value + */ +export interface ArduinoPinMode{ + /** The pin number */ + pin: number; + /** The mode of the pin */ + mode: number; +} + +/** + * Event is emmited when a pin is set up in an interrupt + */ +export interface ArduinoPinInterruptEvent { + /** The pin number */ + pin: string; + isr: bigint; + mode: bigint; + position: bigint; +} +/** + * Emitted when a pin is detached from an interrupt + */ +export interface ArduinoPinDetachInterruptEvent { + /** The pin number */ + pin: string; +} + +/** + * Event is emitted when a GPIO pin is read + */ +export interface ArduinoPinRead { + /** The pin number */ + pin: string; + + /** Callback to return the pin value */ + callback: (value: number) => void; +} + +/** + * Event is emitted when searching a interrupt vector slot + */ export interface ArduinoFindSlotEvent { + /** Callback to return the found slot index */ + callback: (index: number) => void; +} + +export interface ArduinoGetPinFromSlotEvent { + position: number; + callback: (pin: string) => void; +} + + /** * Global event emitter for CREATOR core events diff --git a/src/core/executor/IO.mjs b/src/core/executor/IO.mjs index 0b32f06e7..a9857c6aa 100644 --- a/src/core/executor/IO.mjs +++ b/src/core/executor/IO.mjs @@ -17,7 +17,7 @@ * along with CREATOR. If not, see . */ -import { status, main_memory } from "../core.mjs"; +import { status, main_memory, architecture } from "../core.mjs"; import { readRegister, writeRegister, @@ -27,8 +27,19 @@ import { packExecute } from "../utils/utils.mjs"; import os from "node:os"; import { show_notification } from "../utils/notifications.mts"; import { instructions } from "../assembler/assembler.mjs"; +import { sailexec } from "./sailSimRV/sailExecutor.mjs"; import { coreEvents, CoreEventTypes } from "../events.mts"; +import { crex_findReg } from "../register/registerLookup.mjs"; +import { Memory } from "../memory/Memory.mts"; + +/** Keyboard data override. Intended exclusively for running interactive tests */ +export const testKeyboard = { + enable: false, + /** @type {string[]} */ + data: [], +} + export function display_print(info) { if (typeof document !== "undefined" && document.app) { document.app.$data.display += info; @@ -38,7 +49,8 @@ export function display_print(info) { if (typeof info !== "string") { info = info.toString(); } - process.stdout.write(info); + if (!testKeyboard.enable) // Don't print in tests + process.stdout.write(info); } status.display += info; @@ -46,9 +58,15 @@ export function display_print(info) { export function kbd_read_char(keystroke, params) { const value = keystroke.charCodeAt(0); - writeRegister(value, params.indexComp, params.indexElem); + if (architecture.config.name.includes("SRV")) { + sailexec._send_char_to_C(value); - return value; + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } + writeRegister(BigInt(value), params.indexComp, params.indexElem); + + return keystroke[0] || ""; } export function kbd_read_int(keystroke, params) { @@ -70,6 +88,12 @@ export function kbd_read_int(keystroke, params) { return null; } + if (architecture.config.name.includes("SRV")) { + sailexec._send_int_to_C(value); + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } value = BigInt(value); writeRegister(value, params.indexComp, params.indexElem); @@ -88,8 +112,26 @@ export function kbd_read_float(keystroke, params) { ); return null; } + if (architecture.config.name.includes("SRV")) { + sailexec._send_float_to_C(value); - writeRegister(value, params.indexComp, params.indexElem); + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } + + // If the current architecture has a write float specialization, use it. + // Otherwise, fallback to writing the bits directly + if (CAPI.ARCH.writeFloat !== undefined) { + const reg = architecture.components[params.indexComp].elements[params.indexElem] + CAPI.ARCH.writeFloat(value, reg.name[0]) + } else { + const buffer = new ArrayBuffer(4); + const view = new DataView(buffer); + view.setFloat32(0,value, false); + const bits = BigInt(view.getUint32(0, false)); + writeRegister(bits, params.indexComp, params.indexElem); + } return value; } @@ -98,7 +140,7 @@ export function kbd_read_double(keystroke, params) { const value = parseFloat(keystroke, 10); // validate input - if (typeof document.app !== "undefined" && isNaN(value)) { + if (typeof document !== "undefined" && document.app && isNaN(value)) { show_notification( `Invalid input: '${keystroke}' is not a double`, "danger", @@ -106,7 +148,24 @@ export function kbd_read_double(keystroke, params) { return null; } - writeRegister(value, params.indexComp, params.indexElem, "DFP-Reg"); + if (architecture.config.name.includes("SRV")) { + sailexec._send_double_to_C(value); + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } + // If the current architecture has a write float specialization, use it. + // Otherwise, fallback to writing the bits directly + if (CAPI.ARCH.writeDouble !== undefined) { + const reg = architecture.components[params.indexComp].elements[params.indexElem] + CAPI.ARCH.writeDouble(value, reg.name[0]) + } else { + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, value, false); + const bits = view.getBigUint64(0, false); + writeRegister(bits, params.indexComp, params.indexElem); + } return value; } @@ -116,10 +175,29 @@ export function kbd_read_string(keystroke, params) { const bytes = new TextEncoder().encode(keystroke); // Write the string to memory byte by byte - for (let i = 0n; i < keystroke.length && i < params.size; i++) { - main_memory.write(BigInt(addr + BigInt(i)), bytes[i]); + for (let i = 0n; i < bytes.length && i < params.size; i++) { + main_memory.write(addr + i, bytes[i]); } + if (architecture.config.name.includes("SRV")) { + var lengthBytes = sailexec.lengthBytesUTF8(keystroke) + 1; + + var buffer = sailexec._malloc(lengthBytes); + + sailexec.stringToUTF8(keystroke, buffer, lengthBytes); + + if (architecture.config.name === "SRV32"){ + sailexec._send_string_to_C(buffer); + sailexec._free(buffer); + } + else{ + sailexec._send_string_to_C(BigInt(buffer)); + sailexec._free(BigInt(buffer)); + } + + document.app.$data.execution_mode_run = document.app.$data.last_execution_mode_run; + document.app.$data.last_execution_mode_run = -1; + } return keystroke; } @@ -140,6 +218,10 @@ function checkEnter(buf) { * @returns {string} - The user input without extra space or newline */ function rawPrompt() { + if (testKeyboard.enable) { + const data = testKeyboard.data.shift() || "" + return data + } // Build input character by character until we hit Enter const chunks = []; const decoder = new TextDecoder(); @@ -169,6 +251,156 @@ function rawPrompt() { return chunks.join(""); } + + +export function keyboard_parseInt(fn_post_read, fn_post_params) { + const draw = { + space: [], + info: [], + success: [], + warning: [], + danger: [], + flash: [], + }; + + //-------LOOKAHEAD (optional): mode used to look ahead in the stream for an integer + const ret1 = crex_findReg(fn_post_params); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + fn_post_params + " not found", + "danger", + null, + ); + } + + const addr = readRegister(ret1.indexComp, ret1.indexElem); + // Get the memory instance + const memory = main_memory; + + // Validate address is within memory bounds + if (addr >= BigInt(memory.getSize())) { + throw packExecute( + true, + "capi_arduino: invalid string address", + "danger", + null, + ); + } + + // Read the lookahead from memory + let target = ""; + let memoryAddr = addr; + while (memoryAddr < BigInt(memory.getSize())) { + const byte = memory.read(memoryAddr); + if (byte === 0) break; // Null terminator + target += String.fromCharCode(byte); + memoryAddr++; + } + //LOOKAHEAD values + if (target === "" || target =="SKIP_ALL") { + var regex = new RegExp("\\s*(-?\\d+)", "g"); //Search the first number (negative or not) + } + else if (target === "SKIP_NONE") { + var regex = new RegExp("^(-?\\d+)"); + } + else { // SKIP_WHITESPACE + var regex = new RegExp("^\\s*(-?\\d+)"); + + } + + + + // Deno / CLI mode + if (typeof Deno !== "undefined") { + let keystroke = rawPrompt(); + var match = regex.exec(keystroke); + if (match) { + keystroke = match[1]; //Extracted number as string + writeRegister(BigInt(keystroke), ret1.indexComp, ret1.indexElem); + } else { + keystroke = ""; //No number found + writeRegister(0n, ret1.indexComp, ret1.indexElem); + } + + status.run_program = 0; + return packExecute( + false, + "The result has been written to the register", + "info", + null, + ); + } + + // Web/UI mode + document.app.$data.enter = false; // wait for input + + if (status.run_program === 3) { + setTimeout(keyboard_parseInt, 1000, fn_post_read, fn_post_params); + return draw; + } + + let keystroke = document.app.$data.keyboard; + + if (!keystroke || keystroke.length === 0) { + status.run_program = 3; + return keyboard_parseInt(fn_post_read, fn_post_params); + } + var match = regex.exec(keystroke); + if (match) { + keystroke = match[1]; //Extracted number as string + if (keystroke.includes("-")) { + writeRegister(BigInt.asIntN(keystroke), ret1.indexComp, ret1.indexElem); + } + writeRegister(BigInt(keystroke), ret1.indexComp, ret1.indexElem); + } else { + keystroke = ""; //No number found + writeRegister(0n, ret1.indexComp, ret1.indexElem); + } + // if (keystroke.includes(target) && keystroke.length <= (length || keystroke.length) && !keystroke.includes(until)) { + // writeRegister(1n, ret1.indexComp, ret1.indexElem); + // } else { + // writeRegister(0n, ret1.indexComp, ret1.indexElem); + // } + + + document.app.$data.keyboard = ""; + document.app.$data.enter = null; + + draw.info.push("The result has been written to the register"); + + if (status.execution_index >= instructions.length) { + for (let i = 0; i < instructions.length; i++) { + draw.space.push(i); + } + status.execution_index = -2; + return packExecute( + true, + "The execution of the program has finished", + "success", + null, + ); + } + // If program was running before waiting for input, continue execution automatically + if (status.run_program === 1) { + const playButton = document.getElementById("playExecution"); + if (playButton) { + playButton.click(); + } + } + + // Re-enable buttons + if (typeof document !== "undefined" && document.app) { + coreEvents.emit(CoreEventTypes.EXECUTOR_BUTTONS_UPDATE, { + instruction_disable: false, + run_disable: false, + }); + } + + return draw; +} + + export function keyboard_read(fn_post_read, fn_post_params) { const draw = { space: [], @@ -183,7 +415,7 @@ export function keyboard_read(fn_post_read, fn_post_params) { if (typeof Deno !== "undefined") { const keystroke = rawPrompt(); const value = fn_post_read(keystroke, fn_post_params); - status.keyboard = status.keyboard + " " + value; + status.keyboard += " " + value; status.run_program = 0; // Reset run_program status return null; @@ -209,6 +441,124 @@ export function keyboard_read(fn_post_read, fn_post_params) { document.app.$data.enter = null; // reset keyboard + if (status.execution_index >= instructions.length) { + for (let i = 0; i < instructions.length; i++) { + draw.space.push(i); + } + + status.execution_index = -2; + return packExecute( + true, + "The execution of the program has finished", + "success", + null, + ); + } + if (architecture.config.name.includes("SRV")) + return draw; + // If program was running before waiting for input, continue execution automatically + if (status.run_program === 1) { + // Trigger the play button to continue execution + const playButton = document.getElementById("playExecution"); + if (playButton) { + playButton.click(); + } + } + + // Re-enable buttons using event emitter for proper reactivity + if (typeof document !== "undefined" && document.app) { + coreEvents.emit(CoreEventTypes.EXECUTOR_BUTTONS_UPDATE, { + instruction_disable: false, + run_disable: false, + }); + } + + return draw; +} + +export function keyboard_read_until(fn_post_read, fn_post_params, fn_post_until) { + const draw = { + space: [], + info: [], + success: [], + warning: [], + danger: [], + flash: [], + }; + // if (typeof fn_post_until !== "string" || fn_post_until.length === 0) { + // throw packExecute( + // true, + // "capi_syscall: invalid 'until' parameter for keyboard_read_until", + // "danger", + // null, + // ); + // } + const until = String.fromCharCode(Number(fn_post_until)); + console.log( + "keyboard_read_until: waiting until", + `"${until}"`, + "type:", + typeof until, + "length:", + until?.length + ); + + + // Check for Deno environment + if (typeof Deno !== "undefined") { + let keystroke = rawPrompt(); + // Extract input until the 'until' character + if (typeof until === "string" && until.length > 0) { + const idx = keystroke.indexOf(until); + if (idx !== -1) { + keystroke = keystroke.slice(0, idx); + } + + } + // console.log("Extracted keystroke until 'until':", `"${keystroke}"`); + const value = fn_post_read(keystroke, fn_post_params); + status.keyboard = status.keyboard + " " + value; + status.run_program = 0; // Reset run_program status + + return null; + } + + // Web/UI mode + document.app.$data.enter = false; // signal UI to wait for keyboard read + + if (status.run_program === 3) { + setTimeout(keyboard_read_until, 1000, fn_post_read, fn_post_params, fn_post_until); + return draw; + } + + // Extract input until the 'until' character + let keystroke = document.app.$data.keyboard; + if (until.length > 0) { + const idx = keystroke.indexOf(until); + if (idx !== -1) { + keystroke = keystroke.slice(0, idx); + } + } + + const funct_params = { + indexComp: fn_post_params.indexComp, + indexElem: fn_post_params.indexElem, + size: keystroke.length, + }; + + const val = fn_post_read(keystroke, funct_params); + writeRegister(BigInt(val.length), fn_post_params.indexComp, fn_post_params.indexElem); + + document.app.$data.keyboard = ""; // clear input + + if (val === null) { + // error parsing input, retry + status.run_program = 3; + return keyboard_read_until(fn_post_read, fn_post_params,fn_post_until); + } + + document.app.$data.enter = null; // reset keyboard + if (status.execution_index >= instructions.length) { for (let i = 0; i < instructions.length; i++) { draw.space.push(i); @@ -242,3 +592,196 @@ export function keyboard_read(fn_post_read, fn_post_params) { return draw; } + + +export function keyboard_read_find(fn_post_read, fn_post_params,fn_post_length,fn_post_until) { + const draw = { + space: [], + info: [], + success: [], + warning: [], + danger: [], + flash: [], + }; + + // Resolve the target string from register + const ret1 = crex_findReg(fn_post_params); + if (ret1.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + fn_post_params + " not found", + "danger", + null, + ); + } + + const addr = readRegister(ret1.indexComp, ret1.indexElem); + // Get the memory instance + const memory = main_memory; + + // Validate address is within memory bounds + if (addr >= BigInt(memory.getSize())) { + throw packExecute( + true, + "capi_arduino: invalid string address", + "danger", + null, + ); + } + + // Read the target from memory + let target = ""; + let memoryAddr = addr; + while (memoryAddr < BigInt(memory.getSize())) { + const byte = memory.read(memoryAddr); + if (byte === 0) break; // Null terminator + target += String.fromCharCode(byte); + memoryAddr++; + } + //Read length if provided + let length = null; + if (fn_post_length && fn_post_length.length > 0) { + const ret2 = crex_findReg(fn_post_length); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + fn_post_length + " not found", + "danger", + null, + ); + } + length = readRegister(ret2.indexComp, ret2.indexElem); + if (length <= 0) { + length = Infinity; // No length limit + } + } + + + // Resolve the until string from register if provided (serial_findUntil) + let until = ""; + if (fn_post_until && fn_post_until.length > 0) { + const ret2 = crex_findReg(fn_post_until); + if (ret2.match === 0) { + throw packExecute( + true, + "capi_syscall: register " + fn_post_until + " not found", + "danger", + null, + ); + } + const addr_until = readRegister(ret2.indexComp, ret2.indexElem); + // until = readMemory(parseInt(addr_until), "string"); + // Validate address is within memory bounds + if (addr_until >= BigInt(memory.getSize())) { + throw packExecute( + true, + "capi_arduino: invalid string address", + "danger", + null, + ); + } + + // Read the target from memory + memoryAddr = addr_until; + while (memoryAddr < BigInt(memory.getSize())) { + const byte = memory.read(memoryAddr); + if (byte === 0) break; // Null terminator + until += String.fromCharCode(byte); + memoryAddr++; + } + + // console.log("Until string: ", until); + } + + // Deno / CLI mode + if (typeof Deno !== "undefined") { + let keystroke = rawPrompt(); + + if (until && typeof until === "string" && until !== "" ) { + const idx = keystroke.indexOf(until); + if (idx !== -1) { + keystroke = keystroke.substring(0, idx); + } + } + if (keystroke.includes(target) && keystroke.length <= length) { + writeRegister(1n, ret1.indexComp, ret1.indexElem); + } else { + writeRegister(0n, ret1.indexComp, ret1.indexElem); + } + + + + status.run_program = 0; + return packExecute( + false, + "The result has been written to the register", + "info", + null, + ); + } + + // Web/UI mode + document.app.$data.enter = false; // wait for input + + if (status.run_program === 3) { + setTimeout(keyboard_read_find, 1000, fn_post_read, fn_post_params, fn_post_length,fn_post_until); + return draw; + } + + let keystroke = document.app.$data.keyboard; + + if (!keystroke || keystroke.length === 0) { + status.run_program = 3; + return keyboard_read_find(fn_post_read, fn_post_params, fn_post_length,fn_post_until); + } + + // Find logic + // console.log("keystroke:", `"${keystroke}"`, keystroke.length); + // console.log("until:", `"${until}"`, until.length); + if (until && typeof until === "string" && until !== "" ) { + const idx = keystroke.indexOf(until); + if (idx !== -1) { + keystroke = keystroke.substring(0, idx); + } + } + if (keystroke.includes(target) && keystroke.length <= length) { + writeRegister(1n, ret1.indexComp, ret1.indexElem); + } else { + writeRegister(0n, ret1.indexComp, ret1.indexElem); + } + + document.app.$data.keyboard = ""; + document.app.$data.enter = null; + + draw.info.push("The result has been written to the register"); + + if (status.execution_index >= instructions.length) { + for (let i = 0; i < instructions.length; i++) { + draw.space.push(i); + } + status.execution_index = -2; + return packExecute( + true, + "The execution of the program has finished", + "success", + null, + ); + } + // If program was running before waiting for input, continue execution automatically + if (status.run_program === 1) { + const playButton = document.getElementById("playExecution"); + if (playButton) { + playButton.click(); + } + } + + // Re-enable buttons + if (typeof document !== "undefined" && document.app) { + coreEvents.emit(CoreEventTypes.EXECUTOR_BUTTONS_UPDATE, { + instruction_disable: false, + run_disable: false, + }); + } + + return draw; +} diff --git a/src/core/executor/devices.mts b/src/core/executor/devices.mts index b672659d4..4c16fb46f 100644 --- a/src/core/executor/devices.mts +++ b/src/core/executor/devices.mts @@ -94,10 +94,10 @@ export abstract class Device { * @throws Error if value is too big. * */ - protected writeValue(address: number, value: number, words: number = 1) { + protected writeValue(value: number, address: number, words: number = 1) { // transform value in bytes const bytes = this.memory.splitToBytes(BigInt(value)); - bytes.unshift(...new Array(4 * words).fill(0)); // fill the w/ 0 until we reach the word number of bytes + bytes.unshift(...new Array(4 * words - bytes.length).fill(0)); // fill the w/ 0 until we reach the word number of bytes for (let i = 0; i < words; i++) { this.memory.writeWord(BigInt(address), bytes); @@ -203,11 +203,6 @@ class ConsoleDevice extends Device { "execute.syscall.read_" + type, ); // google analytics - // scroll into keyboard input - if (document !== undefined) { - document.getElementById("enter_keyboard")!.scrollIntoView(); - } - // stop program to wait for read status.run_program = 3; @@ -248,14 +243,17 @@ class ConsoleDevice extends Device { // read byte by byte until a null terminator is found const mainMemory = main_memory as Memory; - const buffer = []; + const bytes = []; for (let i = 0; i < mainMemory.getSize(); i++) { const byte = mainMemory.read(BigInt(addr + i)); if (byte === 0) break; // null terminator - buffer.push(String.fromCharCode(byte)); + bytes.push(byte); } - this.#write(buffer.join(""), DataType.String); + // Decode the UTF-8 data to a string + const buffer = new Uint8Array(bytes) + const msg = new TextDecoder().decode(buffer); + this.#write(msg, DataType.String); break; @@ -309,7 +307,7 @@ class ConsoleDevice extends Device { const bytes = new TextEncoder().encode(keystroke); // Write the string to memory byte by byte - for (let i = 0; i < keystroke.length && i < length; i++) { + for (let i = 0; i < bytes.length && i < length; i++) { mainMemory.write(BigInt(addr + i), bytes[i]!); } }); @@ -369,7 +367,7 @@ class OSDriver extends Device { const addr = MEM.alloc(size); // save addr - this.writeValue(this.data.start, addr); + this.writeValue(this.data.start, Number(addr)); break; } @@ -387,35 +385,36 @@ class OSDriver extends Device { } } -// TODO: device handler class? +// TODO: device handler class // TODO: Enable/Disable devices +// TODO: configure devices from arch definition // { : Device, ...} export const devices = new Map([ - // [ - // "console", - // new ConsoleDevice({ - // ctrl_addr: 0xf0000000, - // status_addr: 0xf0000004, - // data: { - // start: 0xf0000008, - // end: 0xf000000f, - // }, - // enabled: true, - // }), - // ], - // [ - // "os", - // new OSDriver({ - // ctrl_addr: 0xf0000010, - // status_addr: 0xf0000014, - // data: { - // start: 0xf0000018, - // end: 0xf000001f, - // }, - // enabled: true, - // }), - // ], + [ + "console", + new ConsoleDevice({ + ctrl_addr: 0xf0000000, + status_addr: 0xf0000004, + data: { + start: 0xf0000008, + end: 0xf000000f, + }, + enabled: true, + }), + ], + [ + "os", + new OSDriver({ + ctrl_addr: 0xf0000010, + status_addr: 0xf0000014, + data: { + start: 0xf0000018, + end: 0xf000001f, + }, + enabled: true, + }), + ], ]); /* Memory */ diff --git a/src/core/executor/executor.mjs b/src/core/executor/executor.mjs index 63fd8b3e7..577ca2f90 100644 --- a/src/core/executor/executor.mjs +++ b/src/core/executor/executor.mjs @@ -48,6 +48,7 @@ import { handleTimer } from "./timers.mts"; import { compileInstruction } from "./instructionCompiler.mts"; import { coreEvents } from "../events.mts"; import { clearAllRegisterGlows } from "../register/registerGlowState.mjs"; +import { architecture } from "../core.mjs"; const instructionCache = new Map(); const compiledFunctions = new Map(); @@ -94,7 +95,7 @@ function performExecutionChecks() { function get_entrypoint() { // search main tag const entrypoint = instructions.find( - i => i.Label === newArchitecture.config.main_function, + i => i.Label.includes(newArchitecture.config.main_function), )?.Address; return entrypoint @@ -366,16 +367,6 @@ function executeInstructionCycle() { logger.debug("Execution Index:" + status.execution_index); logger.debug("PC Register: " + getPC()); - // Special check for stack visualization purposes - if ( - status.execution_index === - instructions.findIndex( - i => parseInt(i.Address, 16) === get_entrypoint(), - ) - ) { - stackTracker.newFrame(tag_instructions[getPC()]?.tag || ""); - } - // Check for conditions that would stop execution const inLoopCheckResult = performExecutionChecks(); if (inLoopCheckResult !== null) { @@ -477,50 +468,29 @@ export function writeStackLimit(stackLimit) { // Get memory segments from the Memory object const segments = main_memory.getMemorySegments(); - // // Check if stack pointer would be placed in data segment - // if ( - // dataSegment && - // stackLimitBigInt <= dataSegment.end && - // stackLimitBigInt >= dataSegment.start - // ) { - // draw.danger.push(status.execution_index); - // throw packExecute( - // true, - // "Stack pointer cannot be placed in the data segment", - // "danger", - // null, - // ); - // } - - // // Check if stack pointer would be placed in text segment - // if ( - // textSegment && - // stackLimitBigInt <= textSegment.end && - // stackLimitBigInt >= textSegment.start - // ) { - // draw.danger.push(status.execution_index); - // throw packExecute( - // true, - // "Stack pointer cannot be placed in the text segment", - // "danger", - // null, - // ); - // } - // Get current stack pointer from memory segments const stackSegment = segments.get("stack"); - - // Check if stack pointer would be placed in stack segment + // Check if stack pointer would be above stack end if (stackSegment && stackLimitBigInt > stackSegment.end) { throw new Error("Stack pointer cannot be outside the stack segment"); } + // Check if stack pointer would be placed in text/data segments + for (const [name, value] of segments) { + if (name === "stack") continue; + if (value.start <= stackLimitBigInt && stackLimitBigInt <= value.end) + throw new Error(`Stack pointer cannot be placed in the ${name} segment`); + } + stackTracker.updateCurrentFrame(stackLimit); // Update the stack segment in the memory layout if it exists if (stackSegment) { // Update the memory segment's start address to reflect the new stack pointer - stackSegment.start = Number(stackLimitBigInt); + if (architecture.config.name.includes("SRV64")) + stackSegment.start = stackLimitBigInt; + else + stackSegment.start = Number(stackLimitBigInt); // And update the size of the stack segment stackSegment.size = stackSegment.end - stackSegment.start; } diff --git a/src/core/executor/sailSimRV/sailExecutor.mjs b/src/core/executor/sailSimRV/sailExecutor.mjs new file mode 100644 index 000000000..2720d63ee --- /dev/null +++ b/src/core/executor/sailSimRV/sailExecutor.mjs @@ -0,0 +1,213 @@ +import { architecture } from "../../core.mjs"; +import sail32sim from "./wasm/riscv_sim_RV32.js" +import sail64sim from "./wasm/riscv_sim_RV64.js" +import sail32vdsim from "./wasm/riscv_sim_RV32vd.js" +import { vectoren, doubleen } from "../../assembler/sailAssembler/web/CNAssambler.mjs"; +import { coreEvents } from "../../events.mts"; + +export var sailexec; +var programs = []; + +async function cargarProgramas32(jsonPath) { + + const response = await fetch(jsonPath); + const lista = await response.json(); + + const programas = await Promise.all( + lista.map(async entry => { + + const binResponse = await fetch(entry.url); + const buffer = await binResponse.arrayBuffer(); + + const programa = { + name: entry.name, + binary: new Uint8Array(buffer) + }; + + if ("doubleen" in entry) programa.doubleen = entry.doubleen; + if ("vectoren" in entry) programa.vectoren = entry.vectoren; + + return programa; + }) + ); + + return programas; +} + +async function cargarProgramas64(jsonPath){ + + const response = await fetch(jsonPath); + const lista = await response.json(); + + const programas = await Promise.all( + lista.map(async entry => { + + const binResponse = await fetch(entry.url); + const buffer = await binResponse.arrayBuffer(); + + const programa = { + name: entry.name, + binary: new Uint8Array(buffer) + }; + + return programa; + }) + ); + + return programas; +} + +export async function SailTest32(){ + // Reset de las variables test + document.app.$data.passed_test = 0; + document.app.$data.failed_test = 0; + document.app.$data.testing = true; + document.app.$data.c_kernel = false; + if (programs.length === 0) + programs = await cargarProgramas32("examples/RISCV-32-Sail-Validation/list.json"); + + for (let index = 0; index < programs.length; index++) { + + document.app.$data.execution_mode_run = -1; + const element = programs[index]; + let depsLeft = Infinity; + if (element.vectoren && element.doubleen) { + sailexec = await sail32vdsim({ + noInitialRun: true, + // print: (t) => console.log('[sim32]', t), + // printErr: (t) => console.warn('[sim32:err]', t), + // onAbort: (t) => console.error("[sim32:abort]", t), + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim32] deps pending:", left); + }, + }); + } else { + sailexec = await sail32sim({ + noInitialRun: true, + // print: (t) => console.log('[sim32]', t), + // printErr: (t) => console.warn('[sim32:err]', t), + // onAbort: (t) => console.error("[sim32:abort]", t), + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim32] deps pending:", left); + }, + }); + } + + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 100); + }; + check(); + }); + document.app.$data.execution_mode_run = 0; + sailexec.run([element.binary, "--entry-address", "0x80000000", "--cache-pol", "1", "-p", "output.elf"]); + coreEvents.emit("update-validation"); + + + } + + document.app.$data.testing = false; + +} +export async function SailTest64(){ + var filed_tests = []; + document.app.$data.passed_test = 0; + document.app.$data.failed_test = 0; + document.app.$data.testing = true; + document.app.$data.c_kernel = false; + if (programs.length === 0) + programs = await cargarProgramas64("examples/RISCV-64-Sail-Validation/list.json"); + + for (let index = 0; index < programs.length; index++) { + + document.app.$data.execution_mode_run = -1; + const element = programs[index]; + let depsLeft = Infinity; + sailexec = await sail64sim({ + noInitialRun: true, + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim64] deps pending:", left); + }, + }); + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 100); + }; + check(); + }); + document.app.$data.execution_mode_run = 0; + sailexec.run([element.binary, "--entry-address", "0x80000000", "--cache-pol", "1", "-p", "output.elf"]); + coreEvents.emit("update-validation"); + } + + document.app.$data.testing = false; +} +export async function SailExecute(binary, flags){ + let depsLeft = Infinity; + if (architecture.config.name === "SRV32") { + if (vectoren && doubleen) { + sailexec = await sail32vdsim({ + noInitialRun: true, + // print: (t) => console.log('[sim32]', t), + // printErr: (t) => console.warn('[sim32:err]', t), + // onAbort: (t) => console.error("[sim32:abort]", t), + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim32] deps pending:", left); + }, + }); + } else { + sailexec = await sail32sim({ + noInitialRun: true, + // print: (t) => console.log('[sim32]', t), + // printErr: (t) => console.warn('[sim32:err]', t), + // onAbort: (t) => console.error("[sim32:abort]", t), + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim32] deps pending:", left); + }, + }); + } + + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); + }; + check(); + }); + } else { + sailexec = await sail64sim({ + noInitialRun: true, + // print: (t) => console.log('[sim32]', t), + // printErr: (t) => console.warn('[sim32:err]', t), + // onAbort: (t) => console.error("[sim32:abort]", t), + monitorRunDependencies(left) { + depsLeft = left; + console.log("[sim64] deps pending:", left); + }, + }); + await new Promise((resolve) => { + const check = () => { + if (depsLeft === 0) resolve(); + else setTimeout(check, 10); + }; + check(); + }); + architecture.memory_layout.stack.start = 140737488355324n ; + architecture.memory_layout.stack.end = 140737488355327n; + } + + + // Once it is initialized, lets run the program + + // document.app.$data.execution_mode_run = 0; + + sailexec.run([binary, ...flags]); + +} \ No newline at end of file diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.js b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.js new file mode 100644 index 000000000..d801f29b1 --- /dev/null +++ b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.js @@ -0,0 +1,7889 @@ +import { setInstructions, clear_instructions, instructions, tag_instructions } from "@/core/assembler/assembler.mjs"; +import { readRegister, writeRegister, notifyRegisterUpdate } from "@/core/register/registerOperations.mjs"; +import { crex_findReg_bytag, crex_findReg } from "@/core/register/registerLookup.mjs" +import { status, set_execution_mode, PC_REG_INDEX, REGISTERS, getPC, main_memory, config_cache, L1_cache_memory, L1_I_cache_memory, L1_D_cache_memory, L2_D_cache_memory, L2_I_cache_memory, L2_cache_memory, updateCacheMem } from "@/core/core.mjs"; +import { display_print } from "../../IO.mjs"; +import { SYSCALL } from "@/core/capi/syscall.mts"; +import { coreEvents } from "@/core/events.mts"; +import { show_notification } from "@/core/utils/notifications.mts"; +import { architecture } from "../../../core.mjs"; +import { clearAllRegisterGlows } from "@/core/register/registerGlowState.mjs"; + +export var userMode32 = false; + +var Module = (() => { + var _scriptDir = import.meta.url; + var insn_number; + + return function (Module) { + document.app.$data.is_breakpoint = (instructions.length !== 0) ? instructions[0].Break : false; + var pc_sail = crex_findReg_bytag("program_counter"); + var pc_min = architecture.memory_layout.text.start; + var pc_max = architecture.memory_layout.text.end; + var hiden_executed, hiden_next_execute; + + var registers_before_function = [ + { name: "t0", can_operate : false}, + { name: "t1", can_operate : false}, + { name: "t2", can_operate : false}, + { name: "t3", can_operate : false}, + { name: "t4", can_operate : false}, + { name: "t5", can_operate : false}, + { name: "t6", can_operate : false}, + { name: "s0", can_operate : false}, + { name: "s1", can_operate : false}, + { name: "s2", can_operate : false}, + { name: "s3", can_operate : false}, + { name: "s4", can_operate : false}, + { name: "s5", can_operate : false}, + { name: "s6", can_operate : false}, + { name: "s7", can_operate : false}, + { name: "s8", can_operate : false}, + { name: "s9", can_operate : false}, + { name: "s10", can_operate : false}, + { name: "s11", can_operate : false} + ] + var callstack_convention = []; + var inside_function = false; + Module = Module || {}; + + var Module = typeof Module != "undefined" ? Module : {}; + var readyPromiseResolve, readyPromiseReject; + Module["ready"] = new Promise(function (resolve, reject) { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + if ( + !Object.getOwnPropertyDescriptor(Module["ready"], "_reanudar_ejecucion") + ) { + Object.defineProperty(Module["ready"], "_reanudar_ejecucion", { + configurable: true, + get: function () { + abort( + "You are getting _reanudar_ejecucion on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_reanudar_ejecucion", { + configurable: true, + set: function () { + abort( + "You are setting _reanudar_ejecucion on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "_main")) { + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + get: function () { + abort( + "You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_main", { + configurable: true, + set: function () { + abort( + "You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "_send_int_to_C")) { + Object.defineProperty(Module["ready"], "_send_int_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_int_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_int_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_int_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "_send_float_to_C")) { + Object.defineProperty(Module["ready"], "_send_float_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_float_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_float_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_float_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if ( + !Object.getOwnPropertyDescriptor(Module["ready"], "_send_double_to_C") + ) { + Object.defineProperty(Module["ready"], "_send_double_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_double_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_double_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_double_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "_send_char_to_C")) { + Object.defineProperty(Module["ready"], "_send_char_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_char_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_char_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_char_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if ( + !Object.getOwnPropertyDescriptor(Module["ready"], "_send_string_to_C") + ) { + Object.defineProperty(Module["ready"], "_send_string_to_C", { + configurable: true, + get: function () { + abort( + "You are getting _send_string_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "_send_string_to_C", { + configurable: true, + set: function () { + abort( + "You are setting _send_string_to_C on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module["ready"], "___stdio_exit")) { + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + get: function () { + abort( + "You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "___stdio_exit", { + configurable: true, + set: function () { + abort( + "You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + if ( + !Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized") + ) { + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + get: function () { + abort( + "You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + Object.defineProperty(Module["ready"], "onRuntimeInitialized", { + configurable: true, + set: function () { + abort( + "You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js", + ); + }, + }); + } + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = "./this.program"; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var ENVIRONMENT_IS_WEB = true; + var ENVIRONMENT_IS_WORKER = false; + var ENVIRONMENT_IS_NODE = false; + var ENVIRONMENT_IS_SHELL = false; + if (Module["ENVIRONMENT"]) { + throw new Error( + "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)", + ); + } + var scriptDirectory = ""; + function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; + } + var read_, readAsync, readBinary, setWindowTitle; + function logExceptionOnExit(e) { + if (e instanceof ExitStatus) return; + let toLog = e; + if (e && typeof e == "object" && e.stack) { + toLog = [e, e.stack]; + } + err("exiting due to exception: " + toLog); + } + if (ENVIRONMENT_IS_SHELL) { + if ( + (typeof process == "object" && typeof require === "function") || + typeof window == "object" || + typeof importScripts == "function" + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + if (typeof read != "undefined") { + read_ = function shell_read(f) { + return read(f); + }; + } + readBinary = function readBinary(f) { + let data; + if (typeof readbuffer == "function") { + return new Uint8Array(readbuffer(f)); + } + data = read(f, "binary"); + assert(typeof data == "object"); + return data; + }; + readAsync = function readAsync(f, onload, onerror) { + setTimeout(() => onload(readBinary(f)), 0); + }; + if (typeof scriptArgs != "undefined") { + arguments_ = scriptArgs; + } else if (typeof arguments != "undefined") { + arguments_ = arguments; + } + if (typeof quit == "function") { + quit_ = (status, toThrow) => { + logExceptionOnExit(toThrow); + quit(status); + }; + } + if (typeof print != "undefined") { + if (typeof console == "undefined") console = {}; + console.log = print; + console.warn = console.error = + typeof printErr != "undefined" ? printErr : print; + } + } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + if (scriptDirectory.indexOf("blob:") !== 0) { + scriptDirectory = scriptDirectory.substr( + 0, + scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, + ); + } else { + scriptDirectory = ""; + } + if (!(typeof window == "object" || typeof importScripts == "function")) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + { + read_ = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(null); + return xhr.responseText; + }; + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.responseType = "arraybuffer"; + xhr.send(null); + return new Uint8Array(xhr.response); + }; + } + readAsync = (url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.responseType = "arraybuffer"; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { + onload(xhr.response); + return; + } + onerror(); + }; + xhr.onerror = onerror; + xhr.send(null); + }; + } + setWindowTitle = (title) => (document.title = title); + } else { + throw new Error("environment detection error"); + } + + + // const instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) (\w+) ([^,]+), ([^,]+)(?:, (.+))?/; + var instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) ([\w.]+)(?: ([^,]+), ([^,]+)(?:, (.+))?)?/; + var registerExp = /([xf]\d+) (<-) 0x([0-9A-Fa-f]+)/; // /(x\d+) (<-|->) 0x([0-9A-Fa-f]+)/; + var vectorExp = /(v\d+) (<-) 0x([0-9A-Fa-f]+)/; + var memoryExp = /mem\[0x([0-9A-Fa-f]+)\]\s*(<-|->)\s*0x([0-9A-Fa-f]+)/; + var CSRTypeExp = /(CSR\S*)\s+(\S+)\s+(\S+)\s+(0x)([\dA-Fa-f]{1,8})/; + var CSRExp = /^(CSR)\s+(\w+)\s+(<-|->)\s+0x([0-9a-fA-F]+)(?:\s+(.*))?$/; + var jumpExp = /Next_PC:\s*(0x[0-9a-fA-F]+)/; + var cacheExp = /^\[(\d+)\]\s+(L1_I|L1_D|L1|L2|L2_I|L2_D):\s*\((0x[0-9A-Fa-f]+)\)\s$/; + var configCacheExp = /^Configuration:\s*([A-Za-z_][A-Za-z0-9_]*)\s*<-\s*(\S+)\s*$/; + + // var displayExp = /^[A-Za-z\s]+:\s*(.*)$/; + // var displayExp = /^([\w\s]+):\s*(.*)$/; + var displayExp = /^ECALL\s+(SIGNED|UNSIGNED|STRING|CHAR|FLOAT|DOUBLE):\s*(.+)$/; + var instoper = ""; + var syscall_print_code = -1; + var prev_add_to_jump; + + function updateCacheStat(index, access, data="") { + switch(access) { + case "Cache L1 hit inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L1_I hit": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1_I miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + break; + case "Cache L1_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L2 hit inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2 miss inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2_I hit": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2_I miss": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + case "Cache L2_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + } + + } + + async function check_call_convention_temp_regs(instMatch) { + if(((instMatch[7] != undefined && (instMatch[7].includes("t") || (instMatch[7].includes("s") && !instMatch[7].includes("sp")) ) ) || (instMatch[8] != undefined && (instMatch[8].includes("t") || (instMatch[8].includes("s") && !instMatch[8].includes("sp")) ))) && instMatch[6] !== undefined && inside_function) { + if((instMatch[5] != "li" && instMatch[5] != "lui" && instMatch[5] != "la") ){ + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + (callstack_convention[callstack_convention.length - 1][i].name === instMatch[7] || callstack_convention[callstack_convention.length - 1][i].name === instMatch[8]) && + (callstack_convention[callstack_convention.length - 1][i].can_operate === false) ? show_notification("Possible failure in the parameter passing convention", "warning") : 0 ; + } + + // callstack_convention[callstack_convention.length - 1].name + + } + } + if (instMatch[6] !== undefined && (instMatch[6].includes("t") || (instMatch[6].includes("s") && !instMatch[6].includes("sp"))) && inside_function) { + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + callstack_convention[callstack_convention.length - 1][i].can_operate = (callstack_convention[callstack_convention.length - 1][i].name === instMatch[6]) ? true : callstack_convention[callstack_convention.length - 1][i].can_operate; + } + } + } + + // var to_measure = ""; + var start_m, start_m; + var cache_inst; + + function writeMemory(value, addr) { + // Primero pasar el valor al formato hexadecimal por pares + if (value.startsWith("0x")) + value = value.slice(2); + if (value.length % 2 !== 0) + value = "0" + value; + + // const bytes = new Uint8Array(value.length / 2); + for (let i = 0; i < value.length / 2; i ++) { + main_memory.write((addr + BigInt(i)), Number("0x" + value.substring(i*2, i * 2 + 2))); + } + + // if (memoMatch[2] === '<-'){ + // switch(op){ + // case 'sh': // Para almacenar un half + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'float'); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // default: + // break; + // } + // } + } + + Module['print'] = function (message) { + if(message === "err call_convenction"){ + show_notification("Possible failure in the parameter passing convention", "warning"); + } + + var next_add_to_jump; + let instMatch = message.match(instructionExp); + let regiMatch = message.match(registerExp); + let memoMatch = message.match(memoryExp); + let printMatch = message.match(displayExp); + let CSRMatch = message.match(CSRTypeExp); + let CSREMatch = message.match(CSRExp); + let vectorMatch = message.match(vectorExp); + let jumpMatch = message.match(jumpExp); + let cacheMatch = message.match(cacheExp); + let configCacheMatch = message.match(configCacheExp); + + if (message.startsWith("Cache") || message.startsWith("Next_PC:")){ + if (message.includes("Cache prefetch")) { + let newpc = message.substring(15,message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address === newpc); + } else if (message.includes("Next_PC:")) { + let newpc = message.substring(9, message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address == newpc); + } + if (cache_inst != -1 && document.app.$data.execution_mode_run === 1) { + let hexmatch = message.match(/0x[0-9A-Fa-f]+$/); + if (hexmatch && !message.startsWith("Cache prefetch")) { + let hexa = hexmatch[0]; + message = message.replace(/on:\s*0x[0-9A-Fa-f]+$/, "").trim(); + updateCacheStat(cache_inst, message, hexa); + }else { + updateCacheStat(cache_inst, message); + } + + } + } + + if (message === "May your execution has an infinity loop."){ + document.app.$data.execution_mode_run = 1; + show_notification(message, "danger"); + instructions[hiden_executed]._rowVariant = "info"; + instructions[hiden_next_execute]._rowVariant = "success"; + } + + if (jumpMatch){ + const current_ins = instructions.findIndex(insn => insn.Address === (jumpMatch[1].toLowerCase())); + + for (var i = 0; i < instructions.length; i++){ + if(instructions[i]._rowVariant === "success" && document.app.$data.execution_mode_run !== 0) // ajustar lo del user mode + instructions[i]._rowVariant = ""; + } + if (current_ins !== -1) instructions[current_ins]._rowVariant = "success"; + } + + if (configCacheMatch) { + // console.log(configCacheMatch); + switch(configCacheMatch[1]) { + case "L1_I_SIZE": + config_cache.push({configuration: "Size L1_I", value: configCacheMatch[2] + " lines"}); + break; + case "L1_D_SIZE": + config_cache.push({configuration: "Size L1_D", value: configCacheMatch[2] + " lines"}); + break; + case "L1_SIZE": + config_cache.push({configuration: "Size L1", value: configCacheMatch[2] + " lines"}); + break; + case "L2_I_SIZE": + config_cache.push({configuration: "Size L2_I", value: configCacheMatch[2] + " lines"}); + break; + case "L2_D_SIZE": + config_cache.push({configuration: "Size L2_D", value: configCacheMatch[2] + " lines"}); + break; + case "L2_SIZE": + config_cache.push({configuration: "Size L2", value: configCacheMatch[2] + " lines"}); + break; + case "Rep_policy": + config_cache.push({configuration: "Replacement policy", value: configCacheMatch[2]}); + break; + case "L1_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1 block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2 block", value: configCacheMatch[2] + " bits"}); + break; + } + } + + if (cacheMatch) { + // console.log(cacheMatch); + switch(cacheMatch[2]) { + case "L1_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_I_size_block); + break; + case "L1_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_D_size_block); + + break; + case "L1": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_size_block); + + break; + case "L2_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_I_size_block); + + break; + case "L2_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_D_size_block); + + break; + case "L2": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_size_block); + + break; + + } + } + + if(CSREMatch){ + console.log(CSREMatch); + if (CSREMatch[2] !== "vtype" && CSREMatch[2] !== "vl"){ + let regtowrite = crex_findReg(CSREMatch[2]); + if(regtowrite.match !== 0) + writeRegister(CSREMatch[4], regtowrite.indexComp, regtowrite.indexElem); + } + } + if (CSRMatch){ + if (CSRMatch[2] === "vtype"){ + var size_elem = parseInt(CSRMatch[5], 16).toString(2).padStart(32, '0'); + size_elem = size_elem.slice(26, 29); + // console.log("Tamaño: ", size_elem); + if(size_elem === "000"){ + document.app.$data.v_length = 8; + // architecture.components[3].total_elements = 64; + } else if (size_elem === "001") { + document.app.$data.v_length = 16; + // architecture.components[3].total_elements = 32; + } else if (size_elem === "010"){ + document.app.$data.v_length = 32; + // architecture.components[3].total_elements = 16; + }else { + document.app.$data.v_length = 64; + // architecture.components[3].total_elements = 8; + } + // architecture.components[3].length_elem = length_vext; + } + else if (CSRMatch[2] === "vl"){ + // architecture.components[3].elems_op = parseInt(CSRMatch[5], 16); + } + } + if (vectorMatch){ + let regtowrite = crex_findReg(vectorMatch[1]); + writeRegister(vectorMatch[3], regtowrite.indexComp, regtowrite.indexElem); + } + + if (instMatch && (parseInt(instMatch[3], 16) >= pc_min && parseInt(instMatch[3], 16) <= pc_max )){ + userMode32 = true; + + clearAllRegisterGlows(); + coreEvents.emit("step-about-to-execute"); + if (inside_function) + check_call_convention_temp_regs(instMatch); + + //Actualizamos el pc + writeRegister(BigInt(parseInt(instMatch[3], 16)), pc_sail.indexComp, pc_sail.indexElem); + for (var i = 0; i < instructions.length; i++) { + if (instructions[i]._rowVariant === "info") + instructions[i]._rowVariant = ""; + } + instoper = ""; + // console.log("PC actual:",pc_sail); + + + console.log("Instruccion: ", instMatch); + const current_ins = instructions.findIndex(insn => insn.Address === ("0x"+instMatch[3].toLowerCase())); + if(prev_add_to_jump !== undefined){ + instructions[prev_add_to_jump]._rowVariant = ""; + prev_add_to_jump = undefined; + } + + if (instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + const match = next_add[1].match(/(-?\d+)\((\w+)\)/); + var aux_reg = crex_findReg(match[2]); + var aux_val = readRegister(aux_reg.indexComp, aux_reg.indexElem); + + next_add_to_jump = (aux_val + BigInt(parseInt(match[1], 10))).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + prev_add_to_jump = current_ins; + + // var stack_entry_func = instructions[next_add_to_jump].label; + // creator_callstack_enter(instructions[next_add_to_jump].Label); + // track_stack_enter(instructions[next_add_to_jump].Label); + // callstack_convention.push(structuredClone(registers_before_function)); + // inside_function = true; + } + if (instructions[current_ins].loaded.includes("jal") && !instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + + } + if (instructions[current_ins].loaded.includes("ret") && !instructions[current_ins].loaded.includes("mret")){ + // Mirar el ra + var aux_reg = crex_findReg("ra"); + next_add_to_jump = readRegister(aux_reg.indexComp, aux_reg.indexElem).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + if (next_add_to_jump !== -1){ + prev_add_to_jump = current_ins; + // track_stack_leave(); + // creator_callstack_leave(); + // callstack_convention.pop(); + // inside_function = (callstack_convention.length > 0); + }else + next_add_to_jump = undefined; + } + + + // Primero caso de paso a paso + if (document.app.$data.execution_mode_run === 1){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined){ + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + } + // Para el caso de run without stop y la siguiente instruccion es un breakpoint + else if (document.app.$data.execution_mode_run === 0){ + // se almacena el estado de la instruccion en caso de que haya una parada por infinity loop + hiden_executed = current_ins; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + hiden_next_execute = (next_add_to_jump !== undefined) ? next_add_to_jump : current_ins + 1; + } else + hiden_next_execute = current_ins + 1; + + + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if(document.app.$data.is_breakpoint){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + } + coreEvents.emit("pause-execution"); + }else { + instructions[current_ins]._rowVariant = ''; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + + } + else + instructions[current_ins]._rowVariant = ''; + + if (instMatch[5] === "ecall"){ + let argument_register = crex_findReg("a7"); // obtenemos el registro para ver que llamada al sistema es + let syscall_code = readRegister(argument_register.indexComp, argument_register.indexElem); // Lectura del registro para obtener el valor + + switch(syscall_code){ + case 5n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para enteros + // capi_read_int('a0'); + SYSCALL.read('a0', "int"); + break; + case 6n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para floats + // capi_read_float('fa0'); + SYSCALL.read("fa0", "float"); + break; + case 7n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para double + // capi_read_double('fa0'); + SYSCALL.read("fa0", "double"); + break; + case 8n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para strings + // capi_read_string('a0','a1'); + SYSCALL.read("a0", "string", "a1"); + break; + + case 12n: + if(document.app.$data.execution_mode_run === 0){ + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para char + // capi_read_char('a0'); + SYSCALL.read("a0", "char"); + break; + default: + // console.log("No hago nada."); + syscall_print_code = syscall_code; + break; + } + + next_add_to_jump = undefined; + } + + + + instoper = instMatch[5]; + coreEvents.emit("sail-instruction-update"); + setInstructions(instructions); + // window.updateUI({ error: false, msg: "" }); + + + + + + + } else if (instMatch && (parseInt(instMatch[3], 16) <= pc_min || parseInt(instMatch[3], 16) >= pc_max )) + userMode32 = false; + + if (regiMatch /*&& userMode === true*/) { + // En caso de ser escritura '<-' pintamos el valor en el registro que corresponde + if (regiMatch[2] === '<-'){ + let regtowrite = crex_findReg(regiMatch[1]); + // console.log("Registro identificado: ", regtowrite); + // if (regiMatch[1] !== 'x2') + if (regtowrite.indexComp === 2){ + if (regiMatch[3].startsWith("0x")) regiMatch[3] = regiMatch[3].slice(2).replace(/^0+/, ''); + else regiMatch[3] = regiMatch[3].replace(/^0+/, ''); + if (regiMatch[3].length <= 8){ + regiMatch[3] = regiMatch[3].padStart(8, "0"); + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem); + } + else{ + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem); + } + + } + else + writeRegister(BigInt(parseInt(regiMatch[3], 16)), regtowrite.indexComp, regtowrite.indexElem); + } + + } + + if (memoMatch /*&& userMode === true*/) { + if (memoMatch[2] === '<-'){ + // switch(instoper){ + // case 'sh': // Para almacenar un half + writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // default: + // break; + // } + + // instoper = ""; + } + + } + + if(printMatch && syscall_print_code !== -1){ + + let value_2_print = printMatch[2].trim(); + // console.log("Estoy dentro de ecall a imprimir"); + // console.log(message); + // console.log("Valor a imprimir: ", value_2_print); + switch(syscall_print_code){ + + case 1n: // Print int + // SYSCALL.print(Number(parseInt(value_2_print)), "int32"); + + display_print(value_2_print); + // display_print(full_print(parseInt(value_2_print), null, false)); + syscall_print_code = -1; + break; + case 2n: // Print float + // SYSCALL.print(Number(parseFloat(value_2_print)), "float"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 3n: // Print double + // SYSCALL.print(Number(parseFloat(value_2_print)), "double"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 4n: // Print String + display_print(value_2_print); + syscall_print_code = -1; + break; + + case 11n: // Print char + // SYSCALL.print(BigInt(value_2_print.charCodeAt(0)), char); + display_print(value_2_print); + syscall_print_code = -1; + break; + + default: // Rest of syscall codes not able to print + syscall_print_code = -1; + break; + + } + + } + + console.log(message); + // clear_instructions(); + + setInstructions(instructions); + } + + Module['printErr'] = function (message) { + // if (message.includes("Execution:") || message.includes("Instructions:") || message.includes("Perf:")) + // show_notification(message, "success"); + // else + console.warn(message); + } + + var out = (document.app.$data.testing === true ) ? console.log.bind(console) : Module["print"]; + var err = Module["printErr"] /*|| console.warn.bind(console)*/; + + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + if (Module["arguments"]) arguments_ = Module["arguments"]; + if (!Object.getOwnPropertyDescriptor(Module, "arguments")) { + Object.defineProperty(Module, "arguments", { + configurable: true, + get: function () { + abort( + "Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) { + Object.defineProperty(Module, "thisProgram", { + configurable: true, + get: function () { + abort( + "Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (Module["quit"]) quit_ = Module["quit"]; + if (!Object.getOwnPropertyDescriptor(Module, "quit")) { + Object.defineProperty(Module, "quit", { + configurable: true, + get: function () { + abort( + "Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + assert( + typeof Module["memoryInitializerPrefixURL"] == "undefined", + "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["pthreadMainPrefixURL"] == "undefined", + "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["cdInitializerPrefixURL"] == "undefined", + "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["filePackagePrefixURL"] == "undefined", + "Module.filePackagePrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["read"] == "undefined", + "Module.read option was removed (modify read_ in JS)", + ); + assert( + typeof Module["readAsync"] == "undefined", + "Module.readAsync option was removed (modify readAsync in JS)", + ); + assert( + typeof Module["readBinary"] == "undefined", + "Module.readBinary option was removed (modify readBinary in JS)", + ); + assert( + typeof Module["setWindowTitle"] == "undefined", + "Module.setWindowTitle option was removed (modify setWindowTitle in JS)", + ); + assert( + typeof Module["TOTAL_MEMORY"] == "undefined", + "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY", + ); + if (!Object.getOwnPropertyDescriptor(Module, "read")) { + Object.defineProperty(Module, "read", { + configurable: true, + get: function () { + abort( + "Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) { + Object.defineProperty(Module, "readAsync", { + configurable: true, + get: function () { + abort( + "Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) { + Object.defineProperty(Module, "readBinary", { + configurable: true, + get: function () { + abort( + "Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) { + Object.defineProperty(Module, "setWindowTitle", { + configurable: true, + get: function () { + abort( + "Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + assert( + !ENVIRONMENT_IS_WORKER, + "worker environment detected but not enabled at build time. Add 'worker' to `-s ENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_NODE, + "node environment detected but not enabled at build time. Add 'node' to `-s ENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_SHELL, + "shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable.", + ); + var POINTER_SIZE = 4; + function warnOnce(text) { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } + } + function convertJsFunctionToWasm(func, sig) { + if (typeof WebAssembly.Function == "function") { + var typeNames = { i: "i32", j: "i64", f: "f32", d: "f64" }; + var type = { + parameters: [], + results: sig[0] == "v" ? [] : [typeNames[sig[0]]], + }; + for (var i = 1; i < sig.length; ++i) { + type.parameters.push(typeNames[sig[i]]); + } + return new WebAssembly.Function(type, func); + } + var typeSection = [1, 0, 1, 96]; + var sigRet = sig.slice(0, 1); + var sigParam = sig.slice(1); + var typeCodes = { i: 127, j: 126, f: 125, d: 124 }; + typeSection.push(sigParam.length); + for (var i = 0; i < sigParam.length; ++i) { + typeSection.push(typeCodes[sigParam[i]]); + } + if (sigRet == "v") { + typeSection.push(0); + } else { + typeSection = typeSection.concat([1, typeCodes[sigRet]]); + } + typeSection[1] = typeSection.length - 2; + var bytes = new Uint8Array( + [0, 97, 115, 109, 1, 0, 0, 0].concat( + typeSection, + [2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0], + ), + ); + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { e: { f: func } }); + var wrappedFunc = instance.exports["f"]; + return wrappedFunc; + } + var freeTableIndexes = []; + var functionsInTableMap; + function getEmptyTableSlot() { + if (freeTableIndexes.length) { + return freeTableIndexes.pop(); + } + try { + wasmTable.grow(1); + } catch (err) { + if (!(err instanceof RangeError)) { + throw err; + } + throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; + } + return wasmTable.length - 1; + } + function updateTableMap(offset, count) { + for (var i = offset; i < offset + count; i++) { + var item = getWasmTableEntry(i); + if (item) { + functionsInTableMap.set(item, i); + } + } + } + var tempRet0 = 0; + var wasmBinary; + if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; + if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) { + Object.defineProperty(Module, "wasmBinary", { + configurable: true, + get: function () { + abort( + "Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + var noExitRuntime = Module["noExitRuntime"] || true; + if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) { + Object.defineProperty(Module, "noExitRuntime", { + configurable: true, + get: function () { + abort( + "Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + if (typeof WebAssembly != "object") { + abort("no native wasm support detected"); + } + var wasmMemory; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } + } + function getCFunc(ident) { + var func = Module["_" + ident]; + assert( + func, + "Cannot call unknown function " + ident + ", make sure it is exported", + ); + return func; + } + function ccall(ident, returnType, argTypes, args, opts) { + var toC = { + string: function (str) { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + var len = (str.length << 2) + 1; + ret = stackAlloc(len); + stringToUTF8(str, ret, len); + } + return ret; + }, + array: function (arr) { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + }, + }; + function convertReturnValue(ret) { + if (returnType === "string") return UTF8ToString(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var ret = func.apply(null, cArgs); + function onDone(ret) { + runtimeKeepalivePop(); + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + runtimeKeepalivePush(); + var asyncMode = opts && opts.async; + if (Asyncify.currData) { + assert( + asyncMode, + "The call to " + + ident + + " is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.", + ); + return Asyncify.whenDone().then(onDone); + } + ret = onDone(ret); + if (asyncMode) return Promise.resolve(ret); + return ret; + } + var ALLOC_STACK = 1; + var UTF8Decoder = + typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; + function UTF8ArrayToString(heap, idx, maxBytesToRead) { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) { + return UTF8Decoder.decode(heap.subarray(idx, endPtr)); + } else { + var str = ""; + while (idx < endPtr) { + var u0 = heap[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heap[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heap[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) + warnOnce( + "Invalid UTF-8 leading byte 0x" + + u0.toString(16) + + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!", + ); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heap[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + } + return str; + } + function UTF8ToString(ptr, maxBytesToRead) { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; + } + function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) + warnOnce( + "Invalid Unicode code point 0x" + + u.toString(16) + + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).", + ); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + heap[outIdx] = 0; + return outIdx - startIdx; + } + function stringToUTF8(str, outPtr, maxBytesToWrite) { + assert( + typeof maxBytesToWrite == "number", + "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!", + ); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + } + function lengthBytesUTF8(str) { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) + u = (65536 + ((u & 1023) << 10)) | (str.charCodeAt(++i) & 1023); + if (u <= 127) ++len; + else if (u <= 2047) len += 2; + else if (u <= 65535) len += 3; + else len += 4; + } + return len; + } + var UTF16Decoder = + typeof TextDecoder != "undefined" + ? new TextDecoder("utf-16le") + : undefined; + function allocateUTF8OnStack(str) { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8Array(str, HEAP8, ret, size); + return ret; + } + function writeArrayToMemory(array, buffer) { + assert( + array.length >= 0, + "writeArrayToMemory array must have a length (should be an array or typed array)", + ); + HEAP8.set(array, buffer); + } + function writeAsciiToMemory(str, buffer, dontAddNull) { + for (var i = 0; i < str.length; ++i) { + assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); + HEAP8[buffer++ >> 0] = str.charCodeAt(i); + } + if (!dontAddNull) HEAP8[buffer >> 0] = 0; + } + function alignUp(x, multiple) { + if (x % multiple > 0) { + x += multiple - (x % multiple); + } + return x; + } + var buffer, + HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + function updateGlobalBufferAndViews(buf) { + buffer = buf; + Module["HEAP8"] = HEAP8 = new Int8Array(buf); + Module["HEAP16"] = HEAP16 = new Int16Array(buf); + Module["HEAP32"] = HEAP32 = new Int32Array(buf); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); + Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); + Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); + Module["HEAP64"] = HEAP64 = new BigInt64Array(buf); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(buf); + } + var TOTAL_STACK = 5242880; + if (Module["TOTAL_STACK"]) + assert( + TOTAL_STACK === Module["TOTAL_STACK"], + "the stack size can no longer be determined at runtime", + ); + var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 67108864; + if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) { + Object.defineProperty(Module, "INITIAL_MEMORY", { + configurable: true, + get: function () { + abort( + "Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)", + ); + }, + }); + } + assert( + INITIAL_MEMORY >= TOTAL_STACK, + "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + + INITIAL_MEMORY + + "! (TOTAL_STACK=" + + TOTAL_STACK + + ")", + ); + assert( + typeof Int32Array != "undefined" && + typeof Float64Array !== "undefined" && + Int32Array.prototype.subarray != undefined && + Int32Array.prototype.set != undefined, + "JS engine does not provide full typed array support", + ); + assert( + !Module["wasmMemory"], + "Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally", + ); + assert( + INITIAL_MEMORY == 67108864, + "Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically", + ); + var wasmTable; + function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + HEAP32[(max + 4) >> 2] = 34821223; + HEAP32[(max + 8) >> 2] = 2310721022; + HEAP32[0] = 1668509029; + } + function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + var cookie1 = HEAPU32[(max + 4) >> 2]; + var cookie2 = HEAPU32[(max + 8) >> 2]; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort( + "Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + + cookie2.toString(16) + + " 0x" + + cookie1.toString(16), + ); + } + if (HEAP32[0] !== 1668509029) + abort( + "Runtime error: The application has corrupted its heap memory area (address zero)!", + ); + } + (function () { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) + throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"; + })(); + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATMAIN__ = []; + var __ATPOSTRUN__ = []; + var runtimeInitialized = false; + var runtimeExited = false; + var runtimeKeepaliveCounter = 0; + function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; + } + function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") + Module["preRun"] = [Module["preRun"]]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); + } + function initRuntime() { + checkStackCookie(); + assert(!runtimeInitialized); + runtimeInitialized = true; + if (!Module["noFSInit"] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + callRuntimeCallbacks(__ATINIT__); + } + function preMain() { + checkStackCookie(); + callRuntimeCallbacks(__ATMAIN__); + } + function exitRuntime() { + Asyncify.state = Asyncify.State.Disabled; + checkStackCookie(); + runtimeExited = true; + } + function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") + Module["postRun"] = [Module["postRun"]]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); + } + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + assert( + Math.imul, + "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill", + ); + assert( + Math.fround, + "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill", + ); + assert( + Math.clz32, + "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill", + ); + assert( + Math.trunc, + "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill", + ); + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + var runDependencyTracking = {}; + function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } + } + function addRunDependency(id) { + runDependencies++; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if ( + runDependencyWatcher === null && + typeof setInterval != "undefined" + ) { + runDependencyWatcher = setInterval(function () { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err("dependency: " + dep); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } + } + function removeRunDependency(id) { + runDependencies--; + if (Module["monitorRunDependencies"]) { + Module["monitorRunDependencies"](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + Module["preloadedImages"] = {}; + Module["preloadedAudios"] = {}; + function abort(what) { + { + if (Module["onAbort"]) { + Module["onAbort"](what); + } + } + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + EXITSTATUS = 1; + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; + } + var dataURIPrefix = "data:application/octet-stream;base64,"; + function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); + } + function isFileURI(filename) { + return filename.startsWith("file://"); + } + function createExportWrapper(name, fixedasm) { + return function () { + var displayName = name; + var asm = fixedasm; + if (!fixedasm) { + asm = Module["asm"]; + } + assert( + runtimeInitialized, + "native function `" + + displayName + + "` called before runtime initialization", + ); + assert( + !runtimeExited, + "native function `" + + displayName + + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)", + ); + if (!asm[name]) { + assert( + asm[name], + "exported native function `" + displayName + "` not found", + ); + } + return asm[name].apply(null, arguments); + }; + } + var wasmBinaryFile; + if (Module["locateFile"]) { + wasmBinaryFile = "riscv_sim_RV32.wasm"; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } + } else { + wasmBinaryFile = new URL( + "riscv_sim_RV32.wasm", + import.meta.url, + ).toString(); + } + function getBinary(file) { + try { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } else { + throw "both async and sync fetching of the wasm failed"; + } + } catch (err) { + abort(err); + } + } + function getBinaryPromise() { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == "function") { + return fetch(wasmBinaryFile, { credentials: "same-origin" }) + .then(function (response) { + if (!response["ok"]) { + throw ( + "failed to load wasm binary file at '" + wasmBinaryFile + "'" + ); + } + return response["arrayBuffer"](); + }) + .catch(function () { + return getBinary(wasmBinaryFile); + }); + } + } + return Promise.resolve().then(function () { + return getBinary(wasmBinaryFile); + }); + } + function createWasm() { + var info = { env: asmLibraryArg, wasi_snapshot_preview1: asmLibraryArg }; + function receiveInstance(instance, module) { + var exports = instance.exports; + exports = Asyncify.instrumentWasmExports(exports); + Module["asm"] = exports; + wasmMemory = Module["asm"]["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateGlobalBufferAndViews(wasmMemory.buffer); + wasmTable = Module["asm"]["__indirect_function_table"]; + assert(wasmTable, "table not found in wasm exports"); + addOnInit(Module["asm"]["__wasm_call_ctors"]); + removeRunDependency("wasm-instantiate"); + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert( + Module === trueModule, + "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?", + ); + trueModule = null; + receiveInstance(result["instance"]); + } + function instantiateArrayBuffer(receiver) { + return getBinaryPromise() + .then(function (binary) { + return WebAssembly.instantiate(binary, info); + }) + .then(function (instance) { + return instance; + }) + .then(receiver, function (reason) { + err("failed to asynchronously prepare wasm: " + reason); + if (isFileURI(wasmBinaryFile)) { + err( + "warning: Loading from a file URI (" + + wasmBinaryFile + + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing", + ); + } + abort(reason); + }); + } + function instantiateAsync() { + if ( + !wasmBinary && + typeof WebAssembly.instantiateStreaming == "function" && + !isDataURI(wasmBinaryFile) && + typeof fetch == "function" + ) { + return fetch(wasmBinaryFile, { credentials: "same-origin" }).then( + function (response) { + var result = WebAssembly.instantiateStreaming(response, info); + return result.then(receiveInstantiationResult, function (reason) { + err("wasm streaming compile failed: " + reason); + err("falling back to ArrayBuffer instantiation"); + return instantiateArrayBuffer(receiveInstantiationResult); + }); + }, + ); + } else { + return instantiateArrayBuffer(receiveInstantiationResult); + } + } + if (Module["instantiateWasm"]) { + try { + var exports = Module["instantiateWasm"](info, receiveInstance); + exports = Asyncify.instrumentWasmExports(exports); + return exports; + } catch (e) { + err("Module.instantiateWasm callback failed with error: " + e); + return false; + } + } + instantiateAsync().catch(readyPromiseReject); + return {}; + } + function callRuntimeCallbacks(callbacks) { + while (callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == "function") { + callback(Module); + continue; + } + var func = callback.func; + if (typeof func == "number") { + if (callback.arg === undefined) { + (function () { + dynCall_v.call(null, func); + })(); + } else { + (function (a1) { + dynCall_vi.apply(null, [func, a1]); + })(callback.arg); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } + } + function demangle(func) { + warnOnce( + "warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling", + ); + return func; + } + function demangleAll(text) { + var regex = /\b_Z[\w\d_]+/g; + return text.replace(regex, function (x) { + var y = demangle(x); + return x === y ? x : y + " [" + x + "]"; + }); + } + var wasmTableMirror = []; + function getWasmTableEntry(funcPtr) { + var func = wasmTableMirror[funcPtr]; + if (!func) { + if (funcPtr >= wasmTableMirror.length) + wasmTableMirror.length = funcPtr + 1; + wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); + } + assert( + wasmTable.get(funcPtr) == func, + "JavaScript-side Wasm function table mirror is out of date!", + ); + return func; + } + function handleException(e) { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + quit_(1, e); + } + function jsStackTrace() { + var error = new Error(); + if (!error.stack) { + try { + throw new Error(); + } catch (e) { + error = e; + } + if (!error.stack) { + return "(no stack trace available)"; + } + } + return error.stack.toString(); + } + function setWasmTableEntry(idx, func) { + wasmTable.set(idx, func); + wasmTableMirror[idx] = func; + } + function ___assert_fail(condition, filename, line, func) { + abort( + "Assertion failed: " + + UTF8ToString(condition) + + ", at: " + + [ + filename ? UTF8ToString(filename) : "unknown filename", + line, + func ? UTF8ToString(func) : "unknown function", + ], + ); + } + function setErrNo(value) { + HEAP32[___errno_location() >> 2] = value; + return value; + } + var PATH = { + splitPath: function (filename) { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: function (parts, allowAboveRoot) { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: function (path) { + var isAbsolute = path.charAt(0) === "/", + trailingSlash = path.substr(-1) === "/"; + path = PATH.normalizeArray( + path.split("/").filter(function (p) { + return !!p; + }), + !isAbsolute, + ).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: function (path) { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: function (path) { + if (path === "/") return "/"; + path = PATH.normalize(path); + path = path.replace(/\/$/, ""); + var lastSlash = path.lastIndexOf("/"); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + extname: function (path) { + return PATH.splitPath(path)[3]; + }, + join: function () { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.join("/")); + }, + join2: function (l, r) { + return PATH.normalize(l + "/" + r); + }, + }; + function getRandomDevice() { + if ( + typeof crypto == "object" && + typeof crypto["getRandomValues"] == "function" + ) { + var randomBuffer = new Uint8Array(1); + return function () { + crypto.getRandomValues(randomBuffer); + return randomBuffer[0]; + }; + } else + return function () { + abort( + "no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };", + ); + }; + } + var PATH_FS = { + resolve: function () { + var resolvedPath = "", + resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split("/").filter(function (p) { + return !!p; + }), + !resolvedAbsolute, + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: function (from, to) { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }, + }; + var TTY = { + ttys: [], + init: function () {}, + shutdown: function () {}, + register: function (dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function (stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function (stream) { + stream.tty.ops.flush(stream.tty); + }, + flush: function (stream) { + stream.tty.ops.flush(stream.tty); + }, + read: function (stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function (stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char: function (tty) { + if (!tty.input.length) { + var result = null; + if ( + typeof window != "undefined" && + typeof window.prompt == "function" + ) { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else if (typeof readline == "function") { + result = readline(); + if (result !== null) { + result += "\n"; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + }, + put_char: function (tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function (tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + }, + default_tty1_ops: { + put_char: function (tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + flush: function (tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + }, + }; + function zeroMemory(address, size) { + HEAPU8.fill(0, address, address + size); + } + function alignMemory(size, alignment) { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; + } + function mmapAlloc(size) { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (!ptr) return 0; + zeroMemory(ptr, size); + return ptr; + } + var MEMFS = { + ops_table: null, + mount: function (mount) { + return MEMFS.createNode(null, "/", 16384 | 511, 0); + }, + createNode: function (parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray: function (node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage: function (node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage: function (node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr: function (node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr: function (node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup: function (parent, name) { + throw FS.genericErrors[44]; + }, + mknod: function (parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename: function (old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink: function (parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir: function (parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir: function (node) { + var entries = [".", ".."]; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink: function (parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink: function (node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read: function (stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write: function (stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert( + position === 0, + "canOwn must imply no weird position inside the file", + ); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek: function (stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate: function (stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap: function (stream, address, length, position, prot, flags) { + if (address !== 0) { + throw new FS.ErrnoError(28); + } + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { ptr: ptr, allocated: allocated }; + }, + msync: function (stream, buffer, offset, length, mmapFlags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (mmapFlags & 2) { + return 0; + } + var bytesWritten = MEMFS.stream_ops.write( + stream, + buffer, + 0, + length, + offset, + false, + ); + return 0; + }, + }, + }; + function asyncLoad(url, onload, onerror, noRunDep) { + var dep = !noRunDep ? getUniqueRunDependency("al " + url) : ""; + readAsync( + url, + function (arrayBuffer) { + assert( + arrayBuffer, + 'Loading data file "' + url + '" failed (no arrayBuffer).', + ); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + function (event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }, + ); + if (dep) addRunDependency(dep); + } + var ERRNO_MESSAGES = { + 0: "Success", + 1: "Arg list too long", + 2: "Permission denied", + 3: "Address already in use", + 4: "Address not available", + 5: "Address family not supported by protocol family", + 6: "No more processes", + 7: "Socket already connected", + 8: "Bad file number", + 9: "Trying to read unreadable message", + 10: "Mount device busy", + 11: "Operation canceled", + 12: "No children", + 13: "Connection aborted", + 14: "Connection refused", + 15: "Connection reset by peer", + 16: "File locking deadlock error", + 17: "Destination address required", + 18: "Math arg out of domain of func", + 19: "Quota exceeded", + 20: "File exists", + 21: "Bad address", + 22: "File too large", + 23: "Host is unreachable", + 24: "Identifier removed", + 25: "Illegal byte sequence", + 26: "Connection already in progress", + 27: "Interrupted system call", + 28: "Invalid argument", + 29: "I/O error", + 30: "Socket is already connected", + 31: "Is a directory", + 32: "Too many symbolic links", + 33: "Too many open files", + 34: "Too many links", + 35: "Message too long", + 36: "Multihop attempted", + 37: "File or path name too long", + 38: "Network interface is not configured", + 39: "Connection reset by network", + 40: "Network is unreachable", + 41: "Too many open files in system", + 42: "No buffer space available", + 43: "No such device", + 44: "No such file or directory", + 45: "Exec format error", + 46: "No record locks available", + 47: "The link has been severed", + 48: "Not enough core", + 49: "No message of desired type", + 50: "Protocol not available", + 51: "No space left on device", + 52: "Function not implemented", + 53: "Socket is not connected", + 54: "Not a directory", + 55: "Directory not empty", + 56: "State not recoverable", + 57: "Socket operation on non-socket", + 59: "Not a typewriter", + 60: "No such device or address", + 61: "Value too large for defined data type", + 62: "Previous owner died", + 63: "Not super-user", + 64: "Broken pipe", + 65: "Protocol error", + 66: "Unknown protocol", + 67: "Protocol wrong type for socket", + 68: "Math result not representable", + 69: "Read only file system", + 70: "Illegal seek", + 71: "No such process", + 72: "Stale file handle", + 73: "Connection timed out", + 74: "Text file busy", + 75: "Cross-device link", + 100: "Device not a stream", + 101: "Bad font file fmt", + 102: "Invalid slot", + 103: "Invalid request code", + 104: "No anode", + 105: "Block device required", + 106: "Channel number out of range", + 107: "Level 3 halted", + 108: "Level 3 reset", + 109: "Link number out of range", + 110: "Protocol driver not attached", + 111: "No CSI structure available", + 112: "Level 2 halted", + 113: "Invalid exchange", + 114: "Invalid request descriptor", + 115: "Exchange full", + 116: "No data (for no delay io)", + 117: "Timer expired", + 118: "Out of streams resources", + 119: "Machine is not on the network", + 120: "Package not installed", + 121: "The object is remote", + 122: "Advertise error", + 123: "Srmount error", + 124: "Communication error on send", + 125: "Cross mount point (not really error)", + 126: "Given log. name not unique", + 127: "f.d. invalid for this operation", + 128: "Remote address changed", + 129: "Can access a needed shared lib", + 130: "Accessing a corrupted shared lib", + 131: ".lib section in a.out corrupted", + 132: "Attempting to link in too many libs", + 133: "Attempting to exec a shared library", + 135: "Streams pipe error", + 136: "Too many users", + 137: "Socket type not supported", + 138: "Not supported", + 139: "Protocol family not supported", + 140: "Can't send after socket shutdown", + 141: "Too many references", + 142: "Host is down", + 148: "No medium (in tape drive)", + 156: "Level 2 not synchronized", + }; + var ERRNO_CODES = {}; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(FS.cwd(), path); + if (!path) return { path: "", node: null }; + var defaults = { follow_mount: true, recurse_count: 0 }; + for (var key in defaults) { + if (opts[key] === undefined) { + opts[key] = defaults[key]; + } + } + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = PATH.normalizeArray( + path.split("/").filter((p) => !!p), + false, + ); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count, + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { path: current_path, node: current }; + }, + getPath: (node) => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" + ? mount + "/" + path + : mount + path; + } + path = path ? node.name + "/" + path : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode: (node) => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: (node) => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: (node) => { + FS.hashRemoveNode(node); + }, + isRoot: (node) => { + return node === node.parent; + }, + isMountpoint: (node) => { + return !!node.mounted; + }, + isFile: (mode) => { + return (mode & 61440) === 32768; + }, + isDir: (mode) => { + return (mode & 61440) === 16384; + }, + isLink: (mode) => { + return (mode & 61440) === 40960; + }, + isChrdev: (mode) => { + return (mode & 61440) === 8192; + }, + isBlkdev: (mode) => { + return (mode & 61440) === 24576; + }, + isFIFO: (mode) => { + return (mode & 61440) === 4096; + }, + isSocket: (mode) => { + return (mode & 49152) === 49152; + }, + flagModes: { r: 0, "r+": 2, w: 577, "w+": 578, a: 1089, "a+": 1090 }, + modeStringToFlags: (str) => { + var flags = FS.flagModes[str]; + if (typeof flags == "undefined") { + throw new Error("Unknown file open mode: " + str); + } + return flags; + }, + flagsToPermissionString: (flag) => { + var perms = ["r", "w", "rw"][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: (dir) => { + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: (fd_start = 0, fd_end = FS.MAX_OPEN_FDS) => { + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStream: (fd) => FS.streams[fd], + createStream: (stream, fd_start, fd_end) => { + if (!FS.FSStream) { + FS.FSStream = function () {}; + FS.FSStream.prototype = { + object: { + get: function () { + return this.node; + }, + set: function (val) { + this.node = val; + }, + }, + isRead: { + get: function () { + return (this.flags & 2097155) !== 1; + }, + }, + isWrite: { + get: function () { + return (this.flags & 2097155) !== 0; + }, + }, + isAppend: { + get: function () { + return this.flags & 1024; + }, + }, + }; + } + stream = Object.assign(new FS.FSStream(), stream); + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: (fd) => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: (stream) => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts: (mount) => { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + "warning: " + + FS.syncFSRequests + + " FS.syncfs operations in flight at once, probably just doing extra work", + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [], + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: (mountpoint) => { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => { + return parent.node_ops.lookup(parent, name); + }, + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === "." || name === "..") { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: (path) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: (path) => { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: (path) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: (path) => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link), + ); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: (path) => { + return FS.stat(path, true); + }, + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { timestamp: Date.now() }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { size: len, timestamp: Date.now() }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { timestamp: Math.max(atime, mtime) }); + }, + open: (path, flags, mode, fd_start, fd_end) => { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode == "undefined" ? 438 : mode; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == "object") { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { follow: !(flags & 131072) }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream( + { + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }, + fd_start, + fd_end, + ); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: (stream) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: (stream) => { + return stream.fd === null; + }, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, address, length, position, prot, flags) => { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap( + stream, + address, + length, + position, + prot, + flags, + ); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream || !stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + munmap: (stream) => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: (path) => { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices: () => { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var random_device = getRandomDevice(); + FS.createDevice("/dev", "random", random_device); + FS.createDevice("/dev", "urandom", random_device); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories: () => { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount( + { + mount: () => { + var node = FS.createNode(proc_self, "fd", 16384 | 511, 73); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + var ret = { + parent: null, + mount: { mountpoint: "fake" }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + "/proc/self/fd", + ); + }, + createStandardStreams: () => { + if (Module["stdin"]) { + FS.createDevice("/dev", "stdin", Module["stdin"]); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (Module["stdout"]) { + FS.createDevice("/dev", "stdout", null, Module["stdout"]); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (Module["stderr"]) { + FS.createDevice("/dev", "stderr", null, Module["stderr"]); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")"); + assert( + stdout.fd === 1, + "invalid handle for stdout (" + stdout.fd + ")", + ); + assert( + stderr.fd === 2, + "invalid handle for stderr (" + stderr.fd + ")", + ); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.node = node; + this.setErrno = function (errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + }; + this.setErrno(errno); + this.message = ERRNO_MESSAGES[errno]; + if (this.stack) { + Object.defineProperty(this, "stack", { + value: new Error().stack, + writable: true, + }); + this.stack = demangleAll(this.stack); + } + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ""; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS: MEMFS }; + }, + init: (input, output, error) => { + assert( + !FS.init.initialized, + "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)", + ); + FS.init.initialized = true; + FS.ensureErrnoError(); + Module["stdin"] = input || Module["stdin"]; + Module["stdout"] = output || Module["stdout"]; + Module["stderr"] = error || Module["stderr"]; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + ___stdio_exit(); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + getMode: (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + return null; + } + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: (stream) => { + stream.seekable = false; + }, + close: (stream) => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: (obj) => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error( + "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.", + ); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error("Cannot load without read() or XMLHttpRequest."); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = + function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = + function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = + (header = xhr.getResponseHeader("Accept-Ranges")) && + header === "bytes"; + var usesGzip = + (header = xhr.getResponseHeader("Content-Encoding")) && + header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + "invalid range (" + + from + + ", " + + to + + ") or no bytes requested!", + ); + if (to > datalength - 1) + throw new Error( + "only " + datalength + " bytes available! programmer error!", + ); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || "", true); + } + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") + throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + "LazyFiles on gzip forces download of the whole file when length is accessed", + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) + throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + }, + }, + chunkSize: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + }, + }, + }); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }; + node.stream_ops = stream_ops; + return node; + }, + createPreloadedFile: ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name + ? PATH_FS.resolve(PATH.join2(parent, name)) + : parent; + var dep = getUniqueRunDependency("cp " + fullname); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + if (onload) onload(); + removeRunDependency(dep); + } + if ( + Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url, (byteArray) => processData(byteArray), onerror); + } else { + processData(url); + } + }, + indexedDB: () => { + return ( + window.indexedDB || + window.mozIndexedDB || + window.webkitIndexedDB || + window.msIndexedDB + ); + }, + DB_NAME: () => { + return "EM_FS_" + window.location.pathname; + }, + DB_VERSION: 20, + DB_STORE_NAME: "FILE_DATA", + saveFilesToDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = () => { + out("creating db"); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }; + openRequest.onsuccess = () => { + var db = openRequest.result; + var transaction = db.transaction([FS.DB_STORE_NAME], "readwrite"); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, + fail = 0, + total = paths.length; + function finish() { + if (fail == 0) onload(); + else onerror(); + } + paths.forEach((path) => { + var putRequest = files.put( + FS.analyzePath(path).object.contents, + path, + ); + putRequest.onsuccess = () => { + ok++; + if (ok + fail == total) finish(); + }; + putRequest.onerror = () => { + fail++; + if (ok + fail == total) finish(); + }; + }); + transaction.onerror = onerror; + }; + openRequest.onerror = onerror; + }, + loadFilesFromDB: (paths, onload, onerror) => { + onload = onload || (() => {}); + onerror = onerror || (() => {}); + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; + openRequest.onsuccess = () => { + var db = openRequest.result; + try { + var transaction = db.transaction([FS.DB_STORE_NAME], "readonly"); + } catch (e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, + fail = 0, + total = paths.length; + function finish() { + if (fail == 0) onload(); + else onerror(); + } + paths.forEach((path) => { + var getRequest = files.get(path); + getRequest.onsuccess = () => { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile( + PATH.dirname(path), + PATH.basename(path), + getRequest.result, + true, + true, + true, + ); + ok++; + if (ok + fail == total) finish(); + }; + getRequest.onerror = () => { + fail++; + if (ok + fail == total) finish(); + }; + }); + transaction.onerror = onerror; + }; + openRequest.onerror = onerror; + }, + absolutePath: () => { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder: () => { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink: () => { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath: () => { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc: () => { + abort( + "FS.mmapAlloc has been replaced by the top level function mmapAlloc", + ); + }, + standardizePath: () => { + abort( + "FS.standardizePath has been removed; use PATH.normalize instead", + ); + }, + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function (dirfd, path, allowEmpty) { + if (path[0] === "/") { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = FS.getStream(dirfd); + if (!dirstream) throw new FS.ErrnoError(8); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function (func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if ( + e && + e.node && + PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node)) + ) { + return -54; + } + throw e; + } + HEAP32[buf >> 2] = stat.dev; + HEAP32[(buf + 4) >> 2] = 0; + HEAP32[(buf + 8) >> 2] = stat.ino; + HEAP32[(buf + 12) >> 2] = stat.mode; + HEAP32[(buf + 16) >> 2] = stat.nlink; + HEAP32[(buf + 20) >> 2] = stat.uid; + HEAP32[(buf + 24) >> 2] = stat.gid; + HEAP32[(buf + 28) >> 2] = stat.rdev; + HEAP32[(buf + 32) >> 2] = 0; + HEAP64[(buf + 40) >> 3] = BigInt(stat.size); + HEAP32[(buf + 48) >> 2] = 4096; + HEAP32[(buf + 52) >> 2] = stat.blocks; + HEAP32[(buf + 56) >> 2] = (stat.atime.getTime() / 1e3) | 0; + HEAP32[(buf + 60) >> 2] = 0; + HEAP32[(buf + 64) >> 2] = (stat.mtime.getTime() / 1e3) | 0; + HEAP32[(buf + 68) >> 2] = 0; + HEAP32[(buf + 72) >> 2] = (stat.ctime.getTime() / 1e3) | 0; + HEAP32[(buf + 76) >> 2] = 0; + HEAP64[(buf + 80) >> 3] = BigInt(stat.ino); + return 0; + }, + doMsync: function (addr, stream, len, flags, offset) { + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + doMkdir: function (path, mode) { + path = PATH.normalize(path); + if (path[path.length - 1] === "/") + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + }, + doMknod: function (path, mode, dev) { + switch (mode & 61440) { + case 32768: + case 8192: + case 24576: + case 4096: + case 49152: + break; + default: + return -28; + } + FS.mknod(path, mode, dev); + return 0; + }, + doReadlink: function (path, buf, bufsize) { + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = HEAP8[buf + len]; + stringToUTF8(ret, buf, bufsize + 1); + HEAP8[buf + len] = endChar; + return len; + }, + doAccess: function (path, amode) { + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ""; + if (amode & 4) perms += "r"; + if (amode & 2) perms += "w"; + if (amode & 1) perms += "x"; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + }, + doDup: function (path, flags, suggestFD) { + var suggest = FS.getStream(suggestFD); + if (suggest) FS.close(suggest); + return FS.open(path, flags, 0, suggestFD, suggestFD).fd; + }, + doReadv: function (stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAP32[(iov + i * 8) >> 2]; + var len = HEAP32[(iov + (i * 8 + 4)) >> 2]; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + } + return ret; + }, + doWritev: function (stream, iov, iovcnt, offset) { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAP32[(iov + i * 8) >> 2]; + var len = HEAP32[(iov + (i * 8 + 4)) >> 2]; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + } + return ret; + }, + varargs: undefined, + get: function () { + assert(SYSCALLS.varargs != undefined); + SYSCALLS.varargs += 4; + var ret = HEAP32[(SYSCALLS.varargs - 4) >> 2]; + return ret; + }, + getStr: function (ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function (fd) { + var stream = FS.getStream(fd); + if (!stream) throw new FS.ErrnoError(8); + return stream; + }, + get64: function (low, high) { + if (low >= 0) assert(high === 0); + else assert(high === -1); + return low; + }, + }; + function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.open(stream.path, stream.flags, 0, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = SYSCALLS.get(); + var offset = 0; + HEAP16[(arg + offset) >> 1] = 2; + return 0; + } + case 6: + case 7: + return 0; + case 16: + case 8: + return -28; + case 9: + setErrNo(28); + return -1; + default: { + return -28; + } + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: + case 21505: { + if (!stream.tty) return -59; + return 0; + } + case 21510: + case 21511: + case 21512: + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + HEAP32[argp >> 2] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + default: + abort("bad ioctl syscall " + op); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function ___syscall_open(path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + var pathname = SYSCALLS.getStr(path); + var mode = varargs ? SYSCALLS.get() : 0; + var stream = FS.open(pathname, flags, mode); + return stream.fd; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function __mmap_js(addr, len, prot, flags, fd, off, allocated, builtin) { + try { + var info = FS.getStream(fd); + if (!info) return -8; + var res = FS.mmap(info, addr, len, off, prot, flags); + var ptr = res.ptr; + HEAP32[allocated >> 2] = res.allocated; + return ptr; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset) { + try { + var stream = FS.getStream(fd); + if (stream) { + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + FS.munmap(stream); + } + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return -e.errno; + } + } + function _abort() { + abort("native code called abort()"); + } + function _emscripten_set_main_loop_timing(mode, value) { + Browser.mainLoop.timingMode = mode; + Browser.mainLoop.timingValue = value; + if (!Browser.mainLoop.func) { + err( + "emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up.", + ); + return 1; + } + if (!Browser.mainLoop.running) { + Browser.mainLoop.running = true; + } + if (mode == 0) { + Browser.mainLoop.scheduler = + function Browser_mainLoop_scheduler_setTimeout() { + var timeUntilNextTick = + Math.max( + 0, + Browser.mainLoop.tickStartTime + value - _emscripten_get_now(), + ) | 0; + setTimeout(Browser.mainLoop.runner, timeUntilNextTick); + }; + Browser.mainLoop.method = "timeout"; + } else if (mode == 1) { + Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler_rAF() { + Browser.requestAnimationFrame(Browser.mainLoop.runner); + }; + Browser.mainLoop.method = "rAF"; + } else if (mode == 2) { + if (typeof setImmediate == "undefined") { + var setImmediates = []; + var emscriptenMainLoopMessageId = "setimmediate"; + var Browser_setImmediate_messageHandler = function (event) { + if ( + event.data === emscriptenMainLoopMessageId || + event.data.target === emscriptenMainLoopMessageId + ) { + event.stopPropagation(); + setImmediates.shift()(); + } + }; + addEventListener( + "message", + Browser_setImmediate_messageHandler, + true, + ); + setImmediate = function Browser_emulated_setImmediate(func) { + setImmediates.push(func); + if (ENVIRONMENT_IS_WORKER) { + if (Module["setImmediates"] === undefined) + Module["setImmediates"] = []; + Module["setImmediates"].push(func); + postMessage({ target: emscriptenMainLoopMessageId }); + } else postMessage(emscriptenMainLoopMessageId, "*"); + }; + } + Browser.mainLoop.scheduler = + function Browser_mainLoop_scheduler_setImmediate() { + setImmediate(Browser.mainLoop.runner); + }; + Browser.mainLoop.method = "immediate"; + } + return 0; + } + var _emscripten_get_now; + _emscripten_get_now = () => performance.now(); + function runtimeKeepalivePush() { + runtimeKeepaliveCounter += 1; + } + function _exit(status) { + exit(status); + } + function maybeExit() { + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + } + function setMainLoop( + browserIterationFunc, + fps, + simulateInfiniteLoop, + arg, + noSetTiming, + ) { + assert( + !Browser.mainLoop.func, + "emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.", + ); + Browser.mainLoop.func = browserIterationFunc; + Browser.mainLoop.arg = arg; + var thisMainLoopId = Browser.mainLoop.currentlyRunningMainloop; + function checkIsRunning() { + if (thisMainLoopId < Browser.mainLoop.currentlyRunningMainloop) { + maybeExit(); + return false; + } + return true; + } + Browser.mainLoop.running = false; + Browser.mainLoop.runner = function Browser_mainLoop_runner() { + if (ABORT) return; + if (Browser.mainLoop.queue.length > 0) { + var start = Date.now(); + var blocker = Browser.mainLoop.queue.shift(); + blocker.func(blocker.arg); + if (Browser.mainLoop.remainingBlockers) { + var remaining = Browser.mainLoop.remainingBlockers; + var next = + remaining % 1 == 0 ? remaining - 1 : Math.floor(remaining); + if (blocker.counted) { + Browser.mainLoop.remainingBlockers = next; + } else { + next = next + 0.5; + Browser.mainLoop.remainingBlockers = (8 * remaining + next) / 9; + } + } + out( + 'main loop blocker "' + + blocker.name + + '" took ' + + (Date.now() - start) + + " ms", + ); + Browser.mainLoop.updateStatus(); + if (!checkIsRunning()) return; + setTimeout(Browser.mainLoop.runner, 0); + return; + } + if (!checkIsRunning()) return; + Browser.mainLoop.currentFrameNumber = + (Browser.mainLoop.currentFrameNumber + 1) | 0; + if ( + Browser.mainLoop.timingMode == 1 && + Browser.mainLoop.timingValue > 1 && + Browser.mainLoop.currentFrameNumber % Browser.mainLoop.timingValue != + 0 + ) { + Browser.mainLoop.scheduler(); + return; + } else if (Browser.mainLoop.timingMode == 0) { + Browser.mainLoop.tickStartTime = _emscripten_get_now(); + } + if (Browser.mainLoop.method === "timeout" && Module.ctx) { + warnOnce( + "Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!", + ); + Browser.mainLoop.method = ""; + } + Browser.mainLoop.runIter(browserIterationFunc); + checkStackCookie(); + if (!checkIsRunning()) return; + if (typeof SDL == "object" && SDL.audio && SDL.audio.queueNewAudioData) + SDL.audio.queueNewAudioData(); + Browser.mainLoop.scheduler(); + }; + if (!noSetTiming) { + if (fps && fps > 0) _emscripten_set_main_loop_timing(0, 1e3 / fps); + else _emscripten_set_main_loop_timing(1, 1); + Browser.mainLoop.scheduler(); + } + if (simulateInfiniteLoop) { + throw "unwind"; + } + } + function callUserCallback(func, synchronous) { + if (runtimeExited || ABORT) { + err( + "user callback triggered after runtime exited or application aborted. Ignoring.", + ); + return; + } + if (synchronous) { + func(); + return; + } + try { + func(); + } catch (e) { + handleException(e); + } + } + function runtimeKeepalivePop() { + assert(runtimeKeepaliveCounter > 0); + runtimeKeepaliveCounter -= 1; + } + function safeSetTimeout(func, timeout) { + return setTimeout(function () { + callUserCallback(func); + }, timeout); + } + var Browser = { + mainLoop: { + running: false, + scheduler: null, + method: "", + currentlyRunningMainloop: 0, + func: null, + arg: 0, + timingMode: 0, + timingValue: 0, + currentFrameNumber: 0, + queue: [], + pause: function () { + Browser.mainLoop.scheduler = null; + Browser.mainLoop.currentlyRunningMainloop++; + }, + resume: function () { + Browser.mainLoop.currentlyRunningMainloop++; + var timingMode = Browser.mainLoop.timingMode; + var timingValue = Browser.mainLoop.timingValue; + var func = Browser.mainLoop.func; + Browser.mainLoop.func = null; + setMainLoop(func, 0, false, Browser.mainLoop.arg, true); + _emscripten_set_main_loop_timing(timingMode, timingValue); + Browser.mainLoop.scheduler(); + }, + updateStatus: function () { + if (Module["setStatus"]) { + var message = Module["statusMessage"] || "Please wait..."; + var remaining = Browser.mainLoop.remainingBlockers; + var expected = Browser.mainLoop.expectedBlockers; + if (remaining) { + if (remaining < expected) { + Module["setStatus"]( + message + + " (" + + (expected - remaining) + + "/" + + expected + + ")", + ); + } else { + Module["setStatus"](message); + } + } else { + Module["setStatus"](""); + } + } + }, + runIter: function (func) { + if (ABORT) return; + if (Module["preMainLoop"]) { + var preRet = Module["preMainLoop"](); + if (preRet === false) { + return; + } + } + callUserCallback(func); + if (Module["postMainLoop"]) Module["postMainLoop"](); + }, + }, + isFullscreen: false, + pointerLock: false, + moduleContextCreatedCallbacks: [], + workers: [], + init: function () { + if (!Module["preloadPlugins"]) Module["preloadPlugins"] = []; + if (Browser.initted) return; + Browser.initted = true; + try { + new Blob(); + Browser.hasBlobConstructor = true; + } catch (e) { + Browser.hasBlobConstructor = false; + out( + "warning: no blob constructor, cannot create blobs with mimetypes", + ); + } + Browser.BlobBuilder = + typeof MozBlobBuilder != "undefined" + ? MozBlobBuilder + : typeof WebKitBlobBuilder != "undefined" + ? WebKitBlobBuilder + : !Browser.hasBlobConstructor + ? out("warning: no BlobBuilder") + : null; + Browser.URLObject = + typeof window != "undefined" + ? window.URL + ? window.URL + : window.webkitURL + : undefined; + if ( + !Module.noImageDecoding && + typeof Browser.URLObject == "undefined" + ) { + out( + "warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available.", + ); + Module.noImageDecoding = true; + } + var imagePlugin = {}; + imagePlugin["canHandle"] = function imagePlugin_canHandle(name) { + return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name); + }; + imagePlugin["handle"] = function imagePlugin_handle( + byteArray, + name, + onload, + onerror, + ) { + var b = null; + if (Browser.hasBlobConstructor) { + try { + b = new Blob([byteArray], { type: Browser.getMimetype(name) }); + if (b.size !== byteArray.length) { + b = new Blob([new Uint8Array(byteArray).buffer], { + type: Browser.getMimetype(name), + }); + } + } catch (e) { + warnOnce( + "Blob constructor present but fails: " + + e + + "; falling back to blob builder", + ); + } + } + if (!b) { + var bb = new Browser.BlobBuilder(); + bb.append(new Uint8Array(byteArray).buffer); + b = bb.getBlob(); + } + var url = Browser.URLObject.createObjectURL(b); + assert( + typeof url == "string", + "createObjectURL must return a url as a string", + ); + var img = new Image(); + img.onload = () => { + assert(img.complete, "Image " + name + " could not be decoded"); + var canvas = document.createElement("canvas"); + canvas.width = img.width; + canvas.height = img.height; + var ctx = canvas.getContext("2d"); + ctx.drawImage(img, 0, 0); + Module["preloadedImages"][name] = canvas; + Browser.URLObject.revokeObjectURL(url); + if (onload) onload(byteArray); + }; + img.onerror = (event) => { + out("Image " + url + " could not be decoded"); + if (onerror) onerror(); + }; + img.src = url; + }; + Module["preloadPlugins"].push(imagePlugin); + var audioPlugin = {}; + audioPlugin["canHandle"] = function audioPlugin_canHandle(name) { + return ( + !Module.noAudioDecoding && + name.substr(-4) in { ".ogg": 1, ".wav": 1, ".mp3": 1 } + ); + }; + audioPlugin["handle"] = function audioPlugin_handle( + byteArray, + name, + onload, + onerror, + ) { + var done = false; + function finish(audio) { + if (done) return; + done = true; + Module["preloadedAudios"][name] = audio; + if (onload) onload(byteArray); + } + function fail() { + if (done) return; + done = true; + Module["preloadedAudios"][name] = new Audio(); + if (onerror) onerror(); + } + if (Browser.hasBlobConstructor) { + try { + var b = new Blob([byteArray], { + type: Browser.getMimetype(name), + }); + } catch (e) { + return fail(); + } + var url = Browser.URLObject.createObjectURL(b); + assert( + typeof url == "string", + "createObjectURL must return a url as a string", + ); + var audio = new Audio(); + audio.addEventListener( + "canplaythrough", + function () { + finish(audio); + }, + false, + ); + audio.onerror = function audio_onerror(event) { + if (done) return; + out( + "warning: browser could not fully decode audio " + + name + + ", trying slower base64 approach", + ); + function encode64(data) { + var BASE = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var PAD = "="; + var ret = ""; + var leftchar = 0; + var leftbits = 0; + for (var i = 0; i < data.length; i++) { + leftchar = (leftchar << 8) | data[i]; + leftbits += 8; + while (leftbits >= 6) { + var curr = (leftchar >> (leftbits - 6)) & 63; + leftbits -= 6; + ret += BASE[curr]; + } + } + if (leftbits == 2) { + ret += BASE[(leftchar & 3) << 4]; + ret += PAD + PAD; + } else if (leftbits == 4) { + ret += BASE[(leftchar & 15) << 2]; + ret += PAD; + } + return ret; + } + audio.src = + "data:audio/x-" + + name.substr(-3) + + ";base64," + + encode64(byteArray); + finish(audio); + }; + audio.src = url; + safeSetTimeout(function () { + finish(audio); + }, 1e4); + } else { + return fail(); + } + }; + Module["preloadPlugins"].push(audioPlugin); + function pointerLockChange() { + Browser.pointerLock = + document["pointerLockElement"] === Module["canvas"] || + document["mozPointerLockElement"] === Module["canvas"] || + document["webkitPointerLockElement"] === Module["canvas"] || + document["msPointerLockElement"] === Module["canvas"]; + } + var canvas = Module["canvas"]; + if (canvas) { + canvas.requestPointerLock = + canvas["requestPointerLock"] || + canvas["mozRequestPointerLock"] || + canvas["webkitRequestPointerLock"] || + canvas["msRequestPointerLock"] || + function () {}; + canvas.exitPointerLock = + document["exitPointerLock"] || + document["mozExitPointerLock"] || + document["webkitExitPointerLock"] || + document["msExitPointerLock"] || + function () {}; + canvas.exitPointerLock = canvas.exitPointerLock.bind(document); + document.addEventListener( + "pointerlockchange", + pointerLockChange, + false, + ); + document.addEventListener( + "mozpointerlockchange", + pointerLockChange, + false, + ); + document.addEventListener( + "webkitpointerlockchange", + pointerLockChange, + false, + ); + document.addEventListener( + "mspointerlockchange", + pointerLockChange, + false, + ); + if (Module["elementPointerLock"]) { + canvas.addEventListener( + "click", + function (ev) { + if ( + !Browser.pointerLock && + Module["canvas"].requestPointerLock + ) { + Module["canvas"].requestPointerLock(); + ev.preventDefault(); + } + }, + false, + ); + } + } + }, + handledByPreloadPlugin: function (byteArray, fullname, finish, onerror) { + Browser.init(); + var handled = false; + Module["preloadPlugins"].forEach(function (plugin) { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }, + createContext: function ( + canvas, + useWebGL, + setInModule, + webGLContextAttributes, + ) { + if (useWebGL && Module.ctx && canvas == Module.canvas) + return Module.ctx; + var ctx; + var contextHandle; + if (useWebGL) { + var contextAttributes = { + antialias: false, + alpha: false, + majorVersion: 1, + }; + if (webGLContextAttributes) { + for (var attribute in webGLContextAttributes) { + contextAttributes[attribute] = webGLContextAttributes[attribute]; + } + } + if (typeof GL != "undefined") { + contextHandle = GL.createContext(canvas, contextAttributes); + if (contextHandle) { + ctx = GL.getContext(contextHandle).GLctx; + } + } + } else { + ctx = canvas.getContext("2d"); + } + if (!ctx) return null; + if (setInModule) { + if (!useWebGL) + assert( + typeof GLctx == "undefined", + "cannot set in module if GLctx is used, but we are a non-GL context that would replace it", + ); + Module.ctx = ctx; + if (useWebGL) GL.makeContextCurrent(contextHandle); + Module.useWebGL = useWebGL; + Browser.moduleContextCreatedCallbacks.forEach(function (callback) { + callback(); + }); + Browser.init(); + } + return ctx; + }, + destroyContext: function (canvas, useWebGL, setInModule) {}, + fullscreenHandlersInstalled: false, + lockPointer: undefined, + resizeCanvas: undefined, + requestFullscreen: function (lockPointer, resizeCanvas) { + Browser.lockPointer = lockPointer; + Browser.resizeCanvas = resizeCanvas; + if (typeof Browser.lockPointer == "undefined") + Browser.lockPointer = true; + if (typeof Browser.resizeCanvas == "undefined") + Browser.resizeCanvas = false; + var canvas = Module["canvas"]; + function fullscreenChange() { + Browser.isFullscreen = false; + var canvasContainer = canvas.parentNode; + if ( + (document["fullscreenElement"] || + document["mozFullScreenElement"] || + document["msFullscreenElement"] || + document["webkitFullscreenElement"] || + document["webkitCurrentFullScreenElement"]) === canvasContainer + ) { + canvas.exitFullscreen = Browser.exitFullscreen; + if (Browser.lockPointer) canvas.requestPointerLock(); + Browser.isFullscreen = true; + if (Browser.resizeCanvas) { + Browser.setFullscreenCanvasSize(); + } else { + Browser.updateCanvasDimensions(canvas); + } + } else { + canvasContainer.parentNode.insertBefore(canvas, canvasContainer); + canvasContainer.parentNode.removeChild(canvasContainer); + if (Browser.resizeCanvas) { + Browser.setWindowedCanvasSize(); + } else { + Browser.updateCanvasDimensions(canvas); + } + } + if (Module["onFullScreen"]) + Module["onFullScreen"](Browser.isFullscreen); + if (Module["onFullscreen"]) + Module["onFullscreen"](Browser.isFullscreen); + } + if (!Browser.fullscreenHandlersInstalled) { + Browser.fullscreenHandlersInstalled = true; + document.addEventListener( + "fullscreenchange", + fullscreenChange, + false, + ); + document.addEventListener( + "mozfullscreenchange", + fullscreenChange, + false, + ); + document.addEventListener( + "webkitfullscreenchange", + fullscreenChange, + false, + ); + document.addEventListener( + "MSFullscreenChange", + fullscreenChange, + false, + ); + } + var canvasContainer = document.createElement("div"); + canvas.parentNode.insertBefore(canvasContainer, canvas); + canvasContainer.appendChild(canvas); + canvasContainer.requestFullscreen = + canvasContainer["requestFullscreen"] || + canvasContainer["mozRequestFullScreen"] || + canvasContainer["msRequestFullscreen"] || + (canvasContainer["webkitRequestFullscreen"] + ? function () { + canvasContainer["webkitRequestFullscreen"]( + Element["ALLOW_KEYBOARD_INPUT"], + ); + } + : null) || + (canvasContainer["webkitRequestFullScreen"] + ? function () { + canvasContainer["webkitRequestFullScreen"]( + Element["ALLOW_KEYBOARD_INPUT"], + ); + } + : null); + canvasContainer.requestFullscreen(); + }, + requestFullScreen: function () { + abort( + "Module.requestFullScreen has been replaced by Module.requestFullscreen (without a capital S)", + ); + }, + exitFullscreen: function () { + if (!Browser.isFullscreen) { + return false; + } + var CFS = + document["exitFullscreen"] || + document["cancelFullScreen"] || + document["mozCancelFullScreen"] || + document["msExitFullscreen"] || + document["webkitCancelFullScreen"] || + function () {}; + CFS.apply(document, []); + return true; + }, + nextRAF: 0, + fakeRequestAnimationFrame: function (func) { + var now = Date.now(); + if (Browser.nextRAF === 0) { + Browser.nextRAF = now + 1e3 / 60; + } else { + while (now + 2 >= Browser.nextRAF) { + Browser.nextRAF += 1e3 / 60; + } + } + var delay = Math.max(Browser.nextRAF - now, 0); + setTimeout(func, delay); + }, + requestAnimationFrame: function (func) { + if (typeof requestAnimationFrame == "function") { + requestAnimationFrame(func); + return; + } + var RAF = Browser.fakeRequestAnimationFrame; + RAF(func); + }, + safeSetTimeout: function (func) { + return safeSetTimeout(func); + }, + safeRequestAnimationFrame: function (func) { + return Browser.requestAnimationFrame(function () { + callUserCallback(func); + }); + }, + getMimetype: function (name) { + return { + jpg: "image/jpeg", + jpeg: "image/jpeg", + png: "image/png", + bmp: "image/bmp", + ogg: "audio/ogg", + wav: "audio/wav", + mp3: "audio/mpeg", + }[name.substr(name.lastIndexOf(".") + 1)]; + }, + getUserMedia: function (func) { + if (!window.getUserMedia) { + window.getUserMedia = + navigator["getUserMedia"] || navigator["mozGetUserMedia"]; + } + window.getUserMedia(func); + }, + getMovementX: function (event) { + return ( + event["movementX"] || + event["mozMovementX"] || + event["webkitMovementX"] || + 0 + ); + }, + getMovementY: function (event) { + return ( + event["movementY"] || + event["mozMovementY"] || + event["webkitMovementY"] || + 0 + ); + }, + getMouseWheelDelta: function (event) { + var delta = 0; + switch (event.type) { + case "DOMMouseScroll": + delta = event.detail / 3; + break; + case "mousewheel": + delta = event.wheelDelta / 120; + break; + case "wheel": + delta = event.deltaY; + switch (event.deltaMode) { + case 0: + delta /= 100; + break; + case 1: + delta /= 3; + break; + case 2: + delta *= 80; + break; + default: + throw "unrecognized mouse wheel delta mode: " + event.deltaMode; + } + break; + default: + throw "unrecognized mouse wheel event: " + event.type; + } + return delta; + }, + mouseX: 0, + mouseY: 0, + mouseMovementX: 0, + mouseMovementY: 0, + touches: {}, + lastTouches: {}, + calculateMouseEvent: function (event) { + if (Browser.pointerLock) { + if (event.type != "mousemove" && "mozMovementX" in event) { + Browser.mouseMovementX = Browser.mouseMovementY = 0; + } else { + Browser.mouseMovementX = Browser.getMovementX(event); + Browser.mouseMovementY = Browser.getMovementY(event); + } + if (typeof SDL != "undefined") { + Browser.mouseX = SDL.mouseX + Browser.mouseMovementX; + Browser.mouseY = SDL.mouseY + Browser.mouseMovementY; + } else { + Browser.mouseX += Browser.mouseMovementX; + Browser.mouseY += Browser.mouseMovementY; + } + } else { + var rect = Module["canvas"].getBoundingClientRect(); + var cw = Module["canvas"].width; + var ch = Module["canvas"].height; + var scrollX = + typeof window.scrollX != "undefined" + ? window.scrollX + : window.pageXOffset; + var scrollY = + typeof window.scrollY != "undefined" + ? window.scrollY + : window.pageYOffset; + assert( + typeof scrollX != "undefined" && typeof scrollY != "undefined", + "Unable to retrieve scroll position, mouse positions likely broken.", + ); + if ( + event.type === "touchstart" || + event.type === "touchend" || + event.type === "touchmove" + ) { + var touch = event.touch; + if (touch === undefined) { + return; + } + var adjustedX = touch.pageX - (scrollX + rect.left); + var adjustedY = touch.pageY - (scrollY + rect.top); + adjustedX = adjustedX * (cw / rect.width); + adjustedY = adjustedY * (ch / rect.height); + var coords = { x: adjustedX, y: adjustedY }; + if (event.type === "touchstart") { + Browser.lastTouches[touch.identifier] = coords; + Browser.touches[touch.identifier] = coords; + } else if ( + event.type === "touchend" || + event.type === "touchmove" + ) { + var last = Browser.touches[touch.identifier]; + if (!last) last = coords; + Browser.lastTouches[touch.identifier] = last; + Browser.touches[touch.identifier] = coords; + } + return; + } + var x = event.pageX - (scrollX + rect.left); + var y = event.pageY - (scrollY + rect.top); + x = x * (cw / rect.width); + y = y * (ch / rect.height); + Browser.mouseMovementX = x - Browser.mouseX; + Browser.mouseMovementY = y - Browser.mouseY; + Browser.mouseX = x; + Browser.mouseY = y; + } + }, + resizeListeners: [], + updateResizeListeners: function () { + var canvas = Module["canvas"]; + Browser.resizeListeners.forEach(function (listener) { + listener(canvas.width, canvas.height); + }); + }, + setCanvasSize: function (width, height, noUpdates) { + var canvas = Module["canvas"]; + Browser.updateCanvasDimensions(canvas, width, height); + if (!noUpdates) Browser.updateResizeListeners(); + }, + windowedWidth: 0, + windowedHeight: 0, + setFullscreenCanvasSize: function () { + if (typeof SDL != "undefined") { + var flags = HEAPU32[SDL.screen >> 2]; + flags = flags | 8388608; + HEAP32[SDL.screen >> 2] = flags; + } + Browser.updateCanvasDimensions(Module["canvas"]); + Browser.updateResizeListeners(); + }, + setWindowedCanvasSize: function () { + if (typeof SDL != "undefined") { + var flags = HEAPU32[SDL.screen >> 2]; + flags = flags & ~8388608; + HEAP32[SDL.screen >> 2] = flags; + } + Browser.updateCanvasDimensions(Module["canvas"]); + Browser.updateResizeListeners(); + }, + updateCanvasDimensions: function (canvas, wNative, hNative) { + if (wNative && hNative) { + canvas.widthNative = wNative; + canvas.heightNative = hNative; + } else { + wNative = canvas.widthNative; + hNative = canvas.heightNative; + } + var w = wNative; + var h = hNative; + if (Module["forcedAspectRatio"] && Module["forcedAspectRatio"] > 0) { + if (w / h < Module["forcedAspectRatio"]) { + w = Math.round(h * Module["forcedAspectRatio"]); + } else { + h = Math.round(w / Module["forcedAspectRatio"]); + } + } + if ( + (document["fullscreenElement"] || + document["mozFullScreenElement"] || + document["msFullscreenElement"] || + document["webkitFullscreenElement"] || + document["webkitCurrentFullScreenElement"]) === canvas.parentNode && + typeof screen != "undefined" + ) { + var factor = Math.min(screen.width / w, screen.height / h); + w = Math.round(w * factor); + h = Math.round(h * factor); + } + if (Browser.resizeCanvas) { + if (canvas.width != w) canvas.width = w; + if (canvas.height != h) canvas.height = h; + if (typeof canvas.style != "undefined") { + canvas.style.removeProperty("width"); + canvas.style.removeProperty("height"); + } + } else { + if (canvas.width != wNative) canvas.width = wNative; + if (canvas.height != hNative) canvas.height = hNative; + if (typeof canvas.style != "undefined") { + if (w != wNative || h != hNative) { + canvas.style.setProperty("width", w + "px", "important"); + canvas.style.setProperty("height", h + "px", "important"); + } else { + canvas.style.removeProperty("width"); + canvas.style.removeProperty("height"); + } + } + } + }, + }; + function _emscripten_memcpy_big(dest, src, num) { + HEAPU8.copyWithin(dest, src, src + num); + } + function _emscripten_get_heap_max() { + return 2147483648; + } + function emscripten_realloc_buffer(size) { + try { + wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16); + updateGlobalBufferAndViews(wasmMemory.buffer); + return 1; + } catch (e) { + err( + "emscripten_realloc_buffer: Attempted to grow heap from " + + buffer.byteLength + + " bytes to " + + size + + " bytes, but got error: " + + e, + ); + } + } + function _emscripten_resize_heap(requestedSize) { + var oldSize = HEAPU8.length; + requestedSize = requestedSize >>> 0; + assert(requestedSize > oldSize); + var maxHeapSize = _emscripten_get_heap_max(); + if (requestedSize > maxHeapSize) { + err( + "Cannot enlarge memory, asked to go up to " + + requestedSize + + " bytes, but the limit is " + + maxHeapSize + + " bytes!", + ); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + var newSize = Math.min( + maxHeapSize, + alignUp(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + var replacement = emscripten_realloc_buffer(newSize); + if (replacement) { + return true; + } + } + err( + "Failed to grow the heap from " + + oldSize + + " bytes to " + + newSize + + " bytes, not enough memory!", + ); + return false; + } + function _emscripten_run_script_int(ptr) { + return eval(UTF8ToString(ptr)) | 0; + } + function _emscripten_sleep(ms) { + Asyncify.handleSleep((wakeUp) => safeSetTimeout(wakeUp, ms)); + } + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } + } + function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doReadv(stream, iov, iovcnt); + HEAP32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset_bigint, whence, newOffset) { + try { + var offset_low = Number(offset_bigint & BigInt(4294967295)) | 0, + offset_high = Number(offset_bigint >> BigInt(32)) | 0; + var stream = SYSCALLS.getStreamFromFD(fd); + var HIGH_OFFSET = 4294967296; + var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0); + var DOUBLE_LIMIT = 9007199254740992; + if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) { + return -61; + } + FS.llseek(stream, offset, whence); + HEAP64[newOffset >> 3] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } + } + function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = SYSCALLS.doWritev(stream, iov, iovcnt); + HEAP32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e; + return e.errno; + } + } + function _gettimeofday(ptr) { + var now = Date.now(); + HEAP32[ptr >> 2] = (now / 1e3) | 0; + HEAP32[(ptr + 4) >> 2] = ((now % 1e3) * 1e3) | 0; + return 0; + } + function _time(ptr) { + var ret = (Date.now() / 1e3) | 0; + if (ptr) { + HEAP32[ptr >> 2] = ret; + } + return ret; + } + function runAndAbortIfError(func) { + try { + return func(); + } catch (e) { + abort(e); + } + } + var Asyncify = { + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId: function (funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + instrumentWasmImports: function (imports) { + var ASYNCIFY_IMPORTS = [ + "env.invoke_*", + "env.emscripten_sleep", + "env.emscripten_wget", + "env.emscripten_wget_data", + "env.emscripten_idb_load", + "env.emscripten_idb_store", + "env.emscripten_idb_delete", + "env.emscripten_idb_exists", + "env.emscripten_idb_load_blob", + "env.emscripten_idb_store_blob", + "env.SDL_Delay", + "env.emscripten_scan_registers", + "env.emscripten_lazy_load_code", + "env.emscripten_fiber_swap", + "wasi_snapshot_preview1.fd_sync", + "env.__wasi_fd_sync", + "env._emval_await", + "env._dlopen_js", + "env.__asyncjs__*", + ].map((x) => x.split(".")[1]); + for (var x in imports) { + (function (x) { + var original = imports[x]; + if (typeof original == "function") { + imports[x] = function () { + var originalAsyncifyState = Asyncify.state; + try { + return original.apply(null, arguments); + } finally { + var isAsyncifyImport = + ASYNCIFY_IMPORTS.indexOf(x) >= 0 || + x.startsWith("__asyncjs__"); + var changedToDisabled = + originalAsyncifyState === Asyncify.State.Normal && + Asyncify.state === Asyncify.State.Disabled; + var ignoredInvoke = x.startsWith("invoke_") && true; + if ( + Asyncify.state !== originalAsyncifyState && + !isAsyncifyImport && + !changedToDisabled && + !ignoredInvoke + ) { + throw new Error( + "import " + + x + + " was not in ASYNCIFY_IMPORTS, but changed the state", + ); + } + } + }; + } + })(x); + } + }, + instrumentWasmExports: function (exports) { + var ret = {}; + for (var x in exports) { + (function (x) { + var original = exports[x]; + if (typeof original == "function") { + ret[x] = function () { + Asyncify.exportCallStack.push(x); + try { + return original.apply(null, arguments); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + })(x); + } + return ret; + }, + maybeStopUnwind: function () { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(Module["_asyncify_stop_unwind"]); + if (typeof Fibers != "undefined") { + Fibers.trampoline(); + } + } + }, + whenDone: function () { + assert( + Asyncify.currData, + "Tried to wait for an async operation when none is in progress.", + ); + assert( + !Asyncify.asyncPromiseHandlers, + "Cannot have multiple async operations in flight at once", + ); + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { resolve: resolve, reject: reject }; + }); + }, + allocateData: function () { + var ptr = _malloc(12 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader: function (ptr, stack, stackSize) { + HEAP32[ptr >> 2] = stack; + HEAP32[(ptr + 4) >> 2] = stack + stackSize; + }, + setDataRewindFunc: function (ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + HEAP32[(ptr + 8) >> 2] = rewindId; + }, + getDataRewindFunc: function (ptr) { + var id = HEAP32[(ptr + 8) >> 2]; + var name = Asyncify.callStackIdToName[id]; + var func = Module["asm"][name]; + return func; + }, + doRewind: function (ptr) { + var start = Asyncify.getDataRewindFunc(ptr); + return start(); + }, + handleSleep: function (startAsync) { + assert( + Asyncify.state !== Asyncify.State.Disabled, + "Asyncify cannot be done during or after the runtime exits", + ); + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue) => { + assert( + !handleSleepReturnValue || + typeof handleSleepReturnValue == "number" || + typeof handleSleepReturnValue == "boolean", + ); + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue || 0; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + assert( + !Asyncify.exportCallStack.length, + "Waking up (starting to rewind) must be done from JS, without compiled code on the stack.", + ); + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => + Module["_asyncify_start_rewind"](Asyncify.currData), + ); + if (typeof Browser != "undefined" && Browser.mainLoop.func) { + Browser.mainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)(asyncWasmReturnValue); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + runAndAbortIfError(() => + Module["_asyncify_start_unwind"](Asyncify.currData), + ); + if (typeof Browser != "undefined" && Browser.mainLoop.func) { + Browser.mainLoop.pause(); + } + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(Module["_asyncify_stop_rewind"]); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach((func) => callUserCallback(func)); + } else { + abort("invalid state: " + Asyncify.state); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync: function (startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + var FSNode = function (parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + }; + var readMode = 292 | 73; + var writeMode = 146; + Object.defineProperties(FSNode.prototype, { + read: { + get: function () { + return (this.mode & readMode) === readMode; + }, + set: function (val) { + val ? (this.mode |= readMode) : (this.mode &= ~readMode); + }, + }, + write: { + get: function () { + return (this.mode & writeMode) === writeMode; + }, + set: function (val) { + val ? (this.mode |= writeMode) : (this.mode &= ~writeMode); + }, + }, + isFolder: { + get: function () { + return FS.isDir(this.mode); + }, + }, + isDevice: { + get: function () { + return FS.isChrdev(this.mode); + }, + }, + }); + FS.FSNode = FSNode; + FS.staticInit(); + ERRNO_CODES = { + EPERM: 63, + ENOENT: 44, + ESRCH: 71, + EINTR: 27, + EIO: 29, + ENXIO: 60, + E2BIG: 1, + ENOEXEC: 45, + EBADF: 8, + ECHILD: 12, + EAGAIN: 6, + EWOULDBLOCK: 6, + ENOMEM: 48, + EACCES: 2, + EFAULT: 21, + ENOTBLK: 105, + EBUSY: 10, + EEXIST: 20, + EXDEV: 75, + ENODEV: 43, + ENOTDIR: 54, + EISDIR: 31, + EINVAL: 28, + ENFILE: 41, + EMFILE: 33, + ENOTTY: 59, + ETXTBSY: 74, + EFBIG: 22, + ENOSPC: 51, + ESPIPE: 70, + EROFS: 69, + EMLINK: 34, + EPIPE: 64, + EDOM: 18, + ERANGE: 68, + ENOMSG: 49, + EIDRM: 24, + ECHRNG: 106, + EL2NSYNC: 156, + EL3HLT: 107, + EL3RST: 108, + ELNRNG: 109, + EUNATCH: 110, + ENOCSI: 111, + EL2HLT: 112, + EDEADLK: 16, + ENOLCK: 46, + EBADE: 113, + EBADR: 114, + EXFULL: 115, + ENOANO: 104, + EBADRQC: 103, + EBADSLT: 102, + EDEADLOCK: 16, + EBFONT: 101, + ENOSTR: 100, + ENODATA: 116, + ETIME: 117, + ENOSR: 118, + ENONET: 119, + ENOPKG: 120, + EREMOTE: 121, + ENOLINK: 47, + EADV: 122, + ESRMNT: 123, + ECOMM: 124, + EPROTO: 65, + EMULTIHOP: 36, + EDOTDOT: 125, + EBADMSG: 9, + ENOTUNIQ: 126, + EBADFD: 127, + EREMCHG: 128, + ELIBACC: 129, + ELIBBAD: 130, + ELIBSCN: 131, + ELIBMAX: 132, + ELIBEXEC: 133, + ENOSYS: 52, + ENOTEMPTY: 55, + ENAMETOOLONG: 37, + ELOOP: 32, + EOPNOTSUPP: 138, + EPFNOSUPPORT: 139, + ECONNRESET: 15, + ENOBUFS: 42, + EAFNOSUPPORT: 5, + EPROTOTYPE: 67, + ENOTSOCK: 57, + ENOPROTOOPT: 50, + ESHUTDOWN: 140, + ECONNREFUSED: 14, + EADDRINUSE: 3, + ECONNABORTED: 13, + ENETUNREACH: 40, + ENETDOWN: 38, + ETIMEDOUT: 73, + EHOSTDOWN: 142, + EHOSTUNREACH: 23, + EINPROGRESS: 26, + EALREADY: 7, + EDESTADDRREQ: 17, + EMSGSIZE: 35, + EPROTONOSUPPORT: 66, + ESOCKTNOSUPPORT: 137, + EADDRNOTAVAIL: 4, + ENETRESET: 39, + EISCONN: 30, + ENOTCONN: 53, + ETOOMANYREFS: 141, + EUSERS: 136, + EDQUOT: 19, + ESTALE: 72, + ENOTSUP: 138, + ENOMEDIUM: 148, + EILSEQ: 25, + EOVERFLOW: 61, + ECANCELED: 11, + ENOTRECOVERABLE: 56, + EOWNERDEAD: 62, + ESTRPIPE: 135, + }; + Module["requestFullscreen"] = function Module_requestFullscreen( + lockPointer, + resizeCanvas, + ) { + Browser.requestFullscreen(lockPointer, resizeCanvas); + }; + Module["requestFullScreen"] = function Module_requestFullScreen() { + Browser.requestFullScreen(); + }; + Module["requestAnimationFrame"] = function Module_requestAnimationFrame( + func, + ) { + Browser.requestAnimationFrame(func); + }; + Module["setCanvasSize"] = function Module_setCanvasSize( + width, + height, + noUpdates, + ) { + Browser.setCanvasSize(width, height, noUpdates); + }; + Module["pauseMainLoop"] = function Module_pauseMainLoop() { + Browser.mainLoop.pause(); + }; + Module["resumeMainLoop"] = function Module_resumeMainLoop() { + Browser.mainLoop.resume(); + }; + Module["getUserMedia"] = function Module_getUserMedia() { + Browser.getUserMedia(); + }; + Module["createContext"] = function Module_createContext( + canvas, + useWebGL, + setInModule, + webGLContextAttributes, + ) { + return Browser.createContext( + canvas, + useWebGL, + setInModule, + webGLContextAttributes, + ); + }; + var ASSERTIONS = true; + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var asmLibraryArg = { + __assert_fail: ___assert_fail, + __syscall_fcntl64: ___syscall_fcntl64, + __syscall_fstat64: ___syscall_fstat64, + __syscall_ioctl: ___syscall_ioctl, + __syscall_open: ___syscall_open, + _mmap_js: __mmap_js, + _munmap_js: __munmap_js, + abort: _abort, + emscripten_memcpy_big: _emscripten_memcpy_big, + emscripten_resize_heap: _emscripten_resize_heap, + emscripten_run_script_int: _emscripten_run_script_int, + emscripten_sleep: _emscripten_sleep, + exit: _exit, + fd_close: _fd_close, + fd_read: _fd_read, + fd_seek: _fd_seek, + fd_write: _fd_write, + gettimeofday: _gettimeofday, + time: _time, + }; + Asyncify.instrumentWasmImports(asmLibraryArg); + var asm = createWasm(); + var ___wasm_call_ctors = (Module["___wasm_call_ctors"] = + createExportWrapper("__wasm_call_ctors")); + var _malloc = (Module["_malloc"] = createExportWrapper("malloc")); + var _free = (Module["_free"] = createExportWrapper("free")); + var _send_int_to_C = (Module["_send_int_to_C"] = + createExportWrapper("send_int_to_C")); + var _send_float_to_C = (Module["_send_float_to_C"] = + createExportWrapper("send_float_to_C")); + var _send_double_to_C = (Module["_send_double_to_C"] = + createExportWrapper("send_double_to_C")); + var _send_char_to_C = (Module["_send_char_to_C"] = + createExportWrapper("send_char_to_C")); + var _send_string_to_C = (Module["_send_string_to_C"] = + createExportWrapper("send_string_to_C")); + var _reanudar_ejecucion = (Module["_reanudar_ejecucion"] = + createExportWrapper("reanudar_ejecucion")); + var ___errno_location = (Module["___errno_location"] = + createExportWrapper("__errno_location")); + var _main = (Module["_main"] = createExportWrapper("main")); + var ___stdio_exit = (Module["___stdio_exit"] = + createExportWrapper("__stdio_exit")); + var _emscripten_builtin_memalign = (Module["_emscripten_builtin_memalign"] = + createExportWrapper("emscripten_builtin_memalign")); + var _emscripten_stack_init = (Module["_emscripten_stack_init"] = + function () { + return (_emscripten_stack_init = Module["_emscripten_stack_init"] = + Module["asm"]["emscripten_stack_init"]).apply(null, arguments); + }); + var _emscripten_stack_set_limits = (Module["_emscripten_stack_set_limits"] = + function () { + return (_emscripten_stack_set_limits = Module[ + "_emscripten_stack_set_limits" + ] = + Module["asm"]["emscripten_stack_set_limits"]).apply(null, arguments); + }); + var _emscripten_stack_get_free = (Module["_emscripten_stack_get_free"] = + function () { + return (_emscripten_stack_get_free = Module[ + "_emscripten_stack_get_free" + ] = + Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments); + }); + var _emscripten_stack_get_base = (Module["_emscripten_stack_get_base"] = + function () { + return (_emscripten_stack_get_base = Module[ + "_emscripten_stack_get_base" + ] = + Module["asm"]["emscripten_stack_get_base"]).apply(null, arguments); + }); + var _emscripten_stack_get_end = (Module["_emscripten_stack_get_end"] = + function () { + return (_emscripten_stack_get_end = Module[ + "_emscripten_stack_get_end" + ] = + Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments); + }); + var stackSave = (Module["stackSave"] = createExportWrapper("stackSave")); + var stackRestore = (Module["stackRestore"] = + createExportWrapper("stackRestore")); + var stackAlloc = (Module["stackAlloc"] = createExportWrapper("stackAlloc")); + var dynCall_ii = (Module["dynCall_ii"] = createExportWrapper("dynCall_ii")); + var dynCall_iiii = (Module["dynCall_iiii"] = + createExportWrapper("dynCall_iiii")); + var dynCall_vii = (Module["dynCall_vii"] = + createExportWrapper("dynCall_vii")); + var dynCall_jiji = (Module["dynCall_jiji"] = + createExportWrapper("dynCall_jiji")); + var dynCall_iidiiii = (Module["dynCall_iidiiii"] = + createExportWrapper("dynCall_iidiiii")); + var _asyncify_start_unwind = (Module["_asyncify_start_unwind"] = + createExportWrapper("asyncify_start_unwind")); + var _asyncify_stop_unwind = (Module["_asyncify_stop_unwind"] = + createExportWrapper("asyncify_stop_unwind")); + var _asyncify_start_rewind = (Module["_asyncify_start_rewind"] = + createExportWrapper("asyncify_start_rewind")); + var _asyncify_stop_rewind = (Module["_asyncify_stop_rewind"] = + createExportWrapper("asyncify_stop_rewind")); + if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) + Module["intArrayFromString"] = () => + abort( + "'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) + Module["intArrayToString"] = () => + abort( + "'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + Module["ccall"] = ccall; + if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) + Module["cwrap"] = () => + abort( + "'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setValue")) + Module["setValue"] = () => + abort( + "'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getValue")) + Module["getValue"] = () => + abort( + "'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "allocate")) + Module["allocate"] = () => + abort( + "'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) + Module["UTF8ArrayToString"] = () => + abort( + "'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) + Module["UTF8ToString"] = () => + abort( + "'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) + Module["stringToUTF8Array"] = () => + abort( + "'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + + Module["stringToUTF8"] = stringToUTF8; + Module["lengthBytesUTF8"] = lengthBytesUTF8; + if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) + Module["stackTrace"] = () => + abort( + "'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) + Module["addOnPreRun"] = () => + abort( + "'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) + Module["addOnInit"] = () => + abort( + "'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) + Module["addOnPreMain"] = () => + abort( + "'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) + Module["addOnExit"] = () => + abort( + "'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) + Module["addOnPostRun"] = () => + abort( + "'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) + Module["writeStringToMemory"] = () => + abort( + "'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) + Module["writeArrayToMemory"] = () => + abort( + "'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) + Module["writeAsciiToMemory"] = () => + abort( + "'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addRunDependency")) + Module["addRunDependency"] = () => + abort( + "'addRunDependency' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "removeRunDependency")) + Module["removeRunDependency"] = () => + abort( + "'removeRunDependency' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) + Module["FS_createFolder"] = () => + abort( + "'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createPath")) + Module["FS_createPath"] = () => + abort( + "'FS_createPath' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createDataFile")) + Module["FS_createDataFile"] = () => + abort( + "'FS_createDataFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createPreloadedFile")) + Module["FS_createPreloadedFile"] = () => + abort( + "'FS_createPreloadedFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createLazyFile")) + Module["FS_createLazyFile"] = () => + abort( + "'FS_createLazyFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) + Module["FS_createLink"] = () => + abort( + "'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_createDevice")) + Module["FS_createDevice"] = () => + abort( + "'FS_createDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS_unlink")) + Module["FS_unlink"] = () => + abort( + "'FS_unlink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) + Module["getLEB"] = () => + abort( + "'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) + Module["getFunctionTables"] = () => + abort( + "'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) + Module["alignFunctionTables"] = () => + abort( + "'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) + Module["registerFunctions"] = () => + abort( + "'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) + Module["addFunction"] = () => + abort( + "'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) + Module["removeFunction"] = () => + abort( + "'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) + Module["getFuncWrapper"] = () => + abort( + "'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) + Module["prettyPrint"] = () => + abort( + "'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) + Module["dynCall"] = () => + abort( + "'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) + Module["getCompilerSetting"] = () => + abort( + "'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "print")) + Module["print"] = () => + abort( + "'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "printErr")) + Module["printErr"] = () => + abort( + "'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) + Module["getTempRet0"] = () => + abort( + "'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) + Module["setTempRet0"] = () => + abort( + "'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + Module["callMain"] = callMain; + if (!Object.getOwnPropertyDescriptor(Module, "abort")) + Module["abort"] = () => + abort( + "'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) + Module["keepRuntimeAlive"] = () => + abort( + "'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "zeroMemory")) + Module["zeroMemory"] = () => + abort( + "'zeroMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) + Module["stringToNewUTF8"] = () => + abort( + "'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) + Module["emscripten_realloc_buffer"] = () => + abort( + "'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "ENV")) + Module["ENV"] = () => + abort( + "'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "withStackSave")) + Module["withStackSave"] = () => + abort( + "'withStackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) + Module["ERRNO_CODES"] = () => + abort( + "'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) + Module["ERRNO_MESSAGES"] = () => + abort( + "'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) + Module["setErrNo"] = () => + abort( + "'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) + Module["inetPton4"] = () => + abort( + "'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) + Module["inetNtop4"] = () => + abort( + "'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) + Module["inetPton6"] = () => + abort( + "'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) + Module["inetNtop6"] = () => + abort( + "'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) + Module["readSockaddr"] = () => + abort( + "'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) + Module["writeSockaddr"] = () => + abort( + "'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "DNS")) + Module["DNS"] = () => + abort( + "'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) + Module["getHostByName"] = () => + abort( + "'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) + Module["Protocols"] = () => + abort( + "'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) + Module["Sockets"] = () => + abort( + "'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) + Module["getRandomDevice"] = () => + abort( + "'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) + Module["traverseStack"] = () => + abort( + "'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "convertFrameToPC")) + Module["convertFrameToPC"] = () => + abort( + "'convertFrameToPC' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) + Module["UNWIND_CACHE"] = () => + abort( + "'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "saveInUnwindCache")) + Module["saveInUnwindCache"] = () => + abort( + "'saveInUnwindCache' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "convertPCtoSourceLocation")) + Module["convertPCtoSourceLocation"] = () => + abort( + "'convertPCtoSourceLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) + Module["readAsmConstArgsArray"] = () => + abort( + "'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) + Module["readAsmConstArgs"] = () => + abort( + "'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) + Module["mainThreadEM_ASM"] = () => + abort( + "'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) + Module["jstoi_q"] = () => + abort( + "'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) + Module["jstoi_s"] = () => + abort( + "'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) + Module["getExecutableName"] = () => + abort( + "'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) + Module["listenOnce"] = () => + abort( + "'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) + Module["autoResumeAudioContext"] = () => + abort( + "'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) + Module["dynCallLegacy"] = () => + abort( + "'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) + Module["getDynCaller"] = () => + abort( + "'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) + Module["dynCall"] = () => + abort( + "'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) + Module["callRuntimeCallbacks"] = () => + abort( + "'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "wasmTableMirror")) + Module["wasmTableMirror"] = () => + abort( + "'wasmTableMirror' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setWasmTableEntry")) + Module["setWasmTableEntry"] = () => + abort( + "'setWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getWasmTableEntry")) + Module["getWasmTableEntry"] = () => + abort( + "'getWasmTableEntry' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "handleException")) + Module["handleException"] = () => + abort( + "'handleException' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) + Module["runtimeKeepalivePush"] = () => + abort( + "'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) + Module["runtimeKeepalivePop"] = () => + abort( + "'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) + Module["callUserCallback"] = () => + abort( + "'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) + Module["maybeExit"] = () => + abort( + "'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "safeSetTimeout")) + Module["safeSetTimeout"] = () => + abort( + "'safeSetTimeout' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) + Module["asmjsMangle"] = () => + abort( + "'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "asyncLoad")) + Module["asyncLoad"] = () => + abort( + "'asyncLoad' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "alignMemory")) + Module["alignMemory"] = () => + abort( + "'alignMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) + Module["mmapAlloc"] = () => + abort( + "'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) + Module["reallyNegative"] = () => + abort( + "'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "unSign")) + Module["unSign"] = () => + abort( + "'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "reSign")) + Module["reSign"] = () => + abort( + "'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "formatString")) + Module["formatString"] = () => + abort( + "'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "PATH")) + Module["PATH"] = () => + abort( + "'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) + Module["PATH_FS"] = () => + abort( + "'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) + Module["SYSCALLS"] = () => + abort( + "'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) + Module["getSocketFromFD"] = () => + abort( + "'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) + Module["getSocketAddress"] = () => + abort( + "'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) + Module["JSEvents"] = () => + abort( + "'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) + Module["registerKeyEventCallback"] = () => + abort( + "'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) + Module["specialHTMLTargets"] = () => + abort( + "'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) + Module["maybeCStringToJsString"] = () => + abort( + "'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) + Module["findEventTarget"] = () => + abort( + "'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) + Module["findCanvasEventTarget"] = () => + abort( + "'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) + Module["getBoundingClientRect"] = () => + abort( + "'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) + Module["fillMouseEventData"] = () => + abort( + "'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) + Module["registerMouseEventCallback"] = () => + abort( + "'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) + Module["registerWheelEventCallback"] = () => + abort( + "'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) + Module["registerUiEventCallback"] = () => + abort( + "'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) + Module["registerFocusEventCallback"] = () => + abort( + "'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData") + ) + Module["fillDeviceOrientationEventData"] = () => + abort( + "'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerDeviceOrientationEventCallback", + ) + ) + Module["registerDeviceOrientationEventCallback"] = () => + abort( + "'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) + Module["fillDeviceMotionEventData"] = () => + abort( + "'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerDeviceMotionEventCallback", + ) + ) + Module["registerDeviceMotionEventCallback"] = () => + abort( + "'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) + Module["screenOrientation"] = () => + abort( + "'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData") + ) + Module["fillOrientationChangeEventData"] = () => + abort( + "'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerOrientationChangeEventCallback", + ) + ) + Module["registerOrientationChangeEventCallback"] = () => + abort( + "'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData") + ) + Module["fillFullscreenChangeEventData"] = () => + abort( + "'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerFullscreenChangeEventCallback", + ) + ) + Module["registerFullscreenChangeEventCallback"] = () => + abort( + "'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) + Module["registerRestoreOldStyle"] = () => + abort( + "'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "hideEverythingExceptGivenElement", + ) + ) + Module["hideEverythingExceptGivenElement"] = () => + abort( + "'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) + Module["restoreHiddenElements"] = () => + abort( + "'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) + Module["setLetterbox"] = () => + abort( + "'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) + Module["currentFullscreenStrategy"] = () => + abort( + "'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) + Module["restoreOldWindowedStyle"] = () => + abort( + "'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "softFullscreenResizeWebGLRenderTarget", + ) + ) + Module["softFullscreenResizeWebGLRenderTarget"] = () => + abort( + "'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) + Module["doRequestFullscreen"] = () => + abort( + "'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData") + ) + Module["fillPointerlockChangeEventData"] = () => + abort( + "'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerPointerlockChangeEventCallback", + ) + ) + Module["registerPointerlockChangeEventCallback"] = () => + abort( + "'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerPointerlockErrorEventCallback", + ) + ) + Module["registerPointerlockErrorEventCallback"] = () => + abort( + "'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) + Module["requestPointerLock"] = () => + abort( + "'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData") + ) + Module["fillVisibilityChangeEventData"] = () => + abort( + "'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerVisibilityChangeEventCallback", + ) + ) + Module["registerVisibilityChangeEventCallback"] = () => + abort( + "'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) + Module["registerTouchEventCallback"] = () => + abort( + "'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) + Module["fillGamepadEventData"] = () => + abort( + "'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback") + ) + Module["registerGamepadEventCallback"] = () => + abort( + "'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "registerBeforeUnloadEventCallback", + ) + ) + Module["registerBeforeUnloadEventCallback"] = () => + abort( + "'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) + Module["fillBatteryEventData"] = () => + abort( + "'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "battery")) + Module["battery"] = () => + abort( + "'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback") + ) + Module["registerBatteryEventCallback"] = () => + abort( + "'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) + Module["setCanvasElementSize"] = () => + abort( + "'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) + Module["getCanvasElementSize"] = () => + abort( + "'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "demangle")) + Module["demangle"] = () => + abort( + "'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) + Module["demangleAll"] = () => + abort( + "'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) + Module["jsStackTrace"] = () => + abort( + "'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) + Module["stackTrace"] = () => + abort( + "'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) + Module["getEnvStrings"] = () => + abort( + "'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) + Module["checkWasiClock"] = () => + abort( + "'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) + Module["writeI53ToI64"] = () => + abort( + "'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) + Module["writeI53ToI64Clamped"] = () => + abort( + "'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) + Module["writeI53ToI64Signaling"] = () => + abort( + "'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) + Module["writeI53ToU64Clamped"] = () => + abort( + "'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) + Module["writeI53ToU64Signaling"] = () => + abort( + "'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) + Module["readI53FromI64"] = () => + abort( + "'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) + Module["readI53FromU64"] = () => + abort( + "'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) + Module["convertI32PairToI53"] = () => + abort( + "'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) + Module["convertU32PairToI53"] = () => + abort( + "'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setImmediateWrapped")) + Module["setImmediateWrapped"] = () => + abort( + "'setImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "clearImmediateWrapped")) + Module["clearImmediateWrapped"] = () => + abort( + "'clearImmediateWrapped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) + Module["polyfillSetImmediate"] = () => + abort( + "'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) + Module["uncaughtExceptionCount"] = () => + abort( + "'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) + Module["exceptionLast"] = () => + abort( + "'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) + Module["exceptionCaught"] = () => + abort( + "'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) + Module["ExceptionInfo"] = () => + abort( + "'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) + Module["CatchInfo"] = () => + abort( + "'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) + Module["exception_addRef"] = () => + abort( + "'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) + Module["exception_decRef"] = () => + abort( + "'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Browser")) + Module["Browser"] = () => + abort( + "'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) + Module["funcWrappers"] = () => + abort( + "'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) + Module["getFuncWrapper"] = () => + abort( + "'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) + Module["setMainLoop"] = () => + abort( + "'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "wget")) + Module["wget"] = () => + abort( + "'wget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "FS")) + Module["FS"] = () => + abort( + "'FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) + Module["MEMFS"] = () => + abort( + "'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "TTY")) + Module["TTY"] = () => + abort( + "'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) + Module["PIPEFS"] = () => + abort( + "'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) + Module["SOCKFS"] = () => + abort( + "'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) + Module["_setNetworkCallback"] = () => + abort( + "'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) + Module["tempFixedLengthArray"] = () => + abort( + "'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) + Module["miniTempWebGLFloatBuffers"] = () => + abort( + "'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) + Module["heapObjectForWebGLType"] = () => + abort( + "'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) + Module["heapAccessShiftForWebGLHeap"] = () => + abort( + "'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GL")) + Module["GL"] = () => + abort( + "'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) + Module["emscriptenWebGLGet"] = () => + abort( + "'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize") + ) + Module["computeUnpackAlignedImageSize"] = () => + abort( + "'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData") + ) + Module["emscriptenWebGLGetTexPixelData"] = () => + abort( + "'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) + Module["emscriptenWebGLGetUniform"] = () => + abort( + "'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) + Module["webglGetUniformLocation"] = () => + abort( + "'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor( + Module, + "webglPrepareUniformLocationsBeforeFirstUse", + ) + ) + Module["webglPrepareUniformLocationsBeforeFirstUse"] = () => + abort( + "'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) + Module["webglGetLeftBracePos"] = () => + abort( + "'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if ( + !Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib") + ) + Module["emscriptenWebGLGetVertexAttrib"] = () => + abort( + "'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) + Module["writeGLArray"] = () => + abort( + "'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "AL")) + Module["AL"] = () => + abort( + "'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) + Module["SDL_unicode"] = () => + abort( + "'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) + Module["SDL_ttfContext"] = () => + abort( + "'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) + Module["SDL_audio"] = () => + abort( + "'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL")) + Module["SDL"] = () => + abort( + "'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) + Module["SDL_gfx"] = () => + abort( + "'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) + Module["GLUT"] = () => + abort( + "'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "EGL")) + Module["EGL"] = () => + abort( + "'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) + Module["GLFW_Window"] = () => + abort( + "'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) + Module["GLFW"] = () => + abort( + "'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) + Module["GLEW"] = () => + abort( + "'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) + Module["IDBStore"] = () => + abort( + "'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) + Module["runAndAbortIfError"] = () => + abort( + "'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Asyncify")) + Module["Asyncify"] = () => + abort( + "'Asyncify' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "Fibers")) + Module["Fibers"] = () => + abort( + "'Fibers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) + Module["warnOnce"] = () => + abort( + "'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) + Module["stackSave"] = () => + abort( + "'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) + Module["stackRestore"] = () => + abort( + "'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) + Module["stackAlloc"] = () => + abort( + "'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) + Module["AsciiToString"] = () => + abort( + "'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) + Module["stringToAscii"] = () => + abort( + "'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) + Module["UTF16ToString"] = () => + abort( + "'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) + Module["stringToUTF16"] = () => + abort( + "'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) + Module["lengthBytesUTF16"] = () => + abort( + "'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) + Module["UTF32ToString"] = () => + abort( + "'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) + Module["stringToUTF32"] = () => + abort( + "'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) + Module["lengthBytesUTF32"] = () => + abort( + "'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) + Module["allocateUTF8"] = () => + abort( + "'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) + Module["allocateUTF8OnStack"] = () => + abort( + "'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + Module["writeStackCookie"] = writeStackCookie; + Module["checkStackCookie"] = checkStackCookie; + if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) + Object.defineProperty(Module, "ALLOC_NORMAL", { + configurable: true, + get: function () { + abort( + "'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + }, + }); + if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) + Object.defineProperty(Module, "ALLOC_STACK", { + configurable: true, + get: function () { + abort( + "'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)", + ); + }, + }); + var calledRun; + function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; + } + var calledMain = false; + // dependenciesFulfilled = function runCaller() { + // if (!calledRun) run(); + // if (!calledRun) dependenciesFulfilled = runCaller; + // }; + function callMain(args) { + assert( + runDependencies == 0, + 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])', + ); + assert( + __ATPRERUN__.length == 0, + "cannot call main when preRun functions remain to be called", + ); + var entryFunction = Module["_main"]; + args = args || []; + var argc = args.length + 1; + var argv = stackAlloc((argc + 1) * 4); + HEAP32[argv >> 2] = allocateUTF8OnStack(thisProgram); + for (var i = 1; i < argc; i++) { + HEAP32[(argv >> 2) + i] = allocateUTF8OnStack(args[i - 1]); + } + HEAP32[(argv >> 2) + argc] = 0; + try { + var ret = entryFunction(argc, argv); + exit(ret, true); + return ret; + } catch (e) { + return handleException(e); + } finally { + calledMain = true; + } + } + function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); + } + function run(args) { + shouldRunNow = true; + args = args || arguments_; + if (runDependencies > 0) { + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("output.elf", args[0]); + args.shift(); + preMain(); + // readyPromiseResolve(Module); + if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); + if (shouldRunNow) callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(function () { + setTimeout(function () { + Module["setStatus"](""); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + } + Module["run"] = run; + function checkUnflushedContent() { + var oldOut = out; + var oldErr = err; + var has = false; + out = err = (x) => { + has = true; + }; + try { + ___stdio_exit(); + ["stdout", "stderr"].forEach(function (name) { + var info = FS.analyzePath("/dev/" + name); + if (!info) return; + var stream = info.object; + var rdev = stream.rdev; + var tty = TTY.ttys[rdev]; + if (tty && tty.output && tty.output.length) { + has = true; + } + }); + } catch (e) {} + out = oldOut; + err = oldErr; + if (has) { + warnOnce( + "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.", + ); + } + } + function exit(statusw, implicit) { + EXITSTATUS = statusw; + if (!runtimeKeepaliveCounter) { + checkUnflushedContent(); + } + if (keepRuntimeAlive()) { + if (!implicit) { + if (!document.app.$data.testing) { + for (let i = 0; i < instructions.length; i++){ + instructions[i]._rowVariant = ''; + } + status.run_program = -1; // program finished + if (statusw !== 0){ + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: true, + run_disable: true, + stop_disable: false, + }); + show_notification("Your program has finished with errors.", "danger"); + } else { + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: false, + run_disable: false, + stop_disable: true, + isFinished: true, + }); + } + } else { + if (statusw === 0) + document.app.$data.passed_test += 1; + else + document.app.$data.failed_test += 1; + } + var msg = + "program exited (with status: " + + statusw + + "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)"; + readyPromiseReject(msg); + err(msg); + } + } else { + exitRuntime(); + } + procExit(statusw); + } + function procExit(code) { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module["onExit"]) Module["onExit"](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + } + if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") + Module["preInit"] = [Module["preInit"]]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } + } + var shouldRunNow = true; + if (Module["noInitialRun"]) shouldRunNow = false; + // run(); + readyPromiseResolve(Module); + + return Module.ready; + }; +})(); +export default Module; diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.wasm b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.wasm new file mode 100755 index 000000000..8be9b78e0 Binary files /dev/null and b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32.wasm differ diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js new file mode 100644 index 000000000..650cf91e2 --- /dev/null +++ b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js @@ -0,0 +1,5697 @@ +import { instructions, setInstructions, clear_instructions, tag_instructions } from "@/core/assembler/assembler.mjs"; +import { readRegister, writeRegister, notifyRegisterUpdate } from "@/core/register/registerOperations.mjs"; +import { crex_findReg_bytag, crex_findReg } from "@/core/register/registerLookup.mjs" +import { status, set_execution_mode, PC_REG_INDEX, REGISTERS, getPC, main_memory, updateCacheMem } from "@/core/core.mjs"; +import { display_print } from "../../IO.mjs"; +import { SYSCALL } from "@/core/capi/syscall.mts"; +import { coreEvents, CoreEventTypes } from "@/core/events.mts"; +import { show_notification } from "@/core/utils/notifications.mts"; +import { architecture } from "../../../core.mjs"; +import { clearAllRegisterGlows } from "@/core/register/registerGlowState.mjs"; + + +export var userMode32vd = false; + +var Module = (() => { + var _scriptName = import.meta.url; + var insn_number; + + return async function (moduleArg = {}) { + document.app.$data.is_breakpoint = (instructions.length !== 0) ? instructions[0].Break : false; + var pc_sail = crex_findReg_bytag("program_counter"); + var pc_min = architecture.memory_layout.text.start; + var pc_max = architecture.memory_layout.text.end; + var hiden_executed, hiden_next_execute; + + var registers_before_function = [ + { name: "t0", can_operate : false}, + { name: "t1", can_operate : false}, + { name: "t2", can_operate : false}, + { name: "t3", can_operate : false}, + { name: "t4", can_operate : false}, + { name: "t5", can_operate : false}, + { name: "t6", can_operate : false}, + { name: "s0", can_operate : false}, + { name: "s1", can_operate : false}, + { name: "s2", can_operate : false}, + { name: "s3", can_operate : false}, + { name: "s4", can_operate : false}, + { name: "s5", can_operate : false}, + { name: "s6", can_operate : false}, + { name: "s7", can_operate : false}, + { name: "s8", can_operate : false}, + { name: "s9", can_operate : false}, + { name: "s10", can_operate : false}, + { name: "s11", can_operate : false} + ] + var callstack_convention = []; + var inside_function = false; + var moduleRtn; + + var Module = moduleArg; + var readyPromiseResolve, readyPromiseReject; + var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + var ENVIRONMENT_IS_WEB = true; + var ENVIRONMENT_IS_WORKER = false; + var ENVIRONMENT_IS_NODE = false; + var ENVIRONMENT_IS_SHELL = false; + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = "./this.program"; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var scriptDirectory = ""; + function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; + } + var readAsync, readBinary; + if (ENVIRONMENT_IS_SHELL) { + if ( + (typeof process == "object" && typeof require === "function") || + typeof window == "object" || + typeof WorkerGlobalScope != "undefined" + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptName) { + scriptDirectory = _scriptName; + } + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice( + 0, + scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, + ); + } + if ( + !(typeof window == "object" || typeof WorkerGlobalScope != "undefined") + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + { + readAsync = async (url) => { + assert(!isFileURI(url), "readAsync does not work with file:// URLs"); + var response = await fetch(url, { credentials: "same-origin" }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } + } else { + throw new Error("environment detection error"); + } + + + + // const instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) (\w+) ([^,]+), ([^,]+)(?:, (.+))?/; + var instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) ([\w.]+)(?: ([^,]+), ([^,]+)(?:, (.+))?)?/; + var registerExp = /([xf]\d+) (<-) 0x([0-9A-Fa-f]+)/; // /(x\d+) (<-|->) 0x([0-9A-Fa-f]+)/; + var vectorExp = /(v\d+) (<-) 0x([0-9A-Fa-f]+)/; + var memoryExp = /mem\[0x([0-9A-Fa-f]+)\]\s*(<-|->)\s*0x([0-9A-Fa-f]+)/; + var CSRTypeExp = /(CSR\S*)\s+(\S+)\s+(\S+)\s+(0x)([\dA-Fa-f]{1,8})/; + var CSRExp = /^(CSR)\s+(\w+)\s+(<-|->)\s+0x([0-9a-fA-F]+)(?:\s+(.*))?$/; + var jumpExp = /Next_PC:\s*(0x[0-9a-fA-F]+)/; + var cacheExp = /^\[(\d+)\]\s+(L1_I|L1_D|L1|L2|L2_I|L2_D):\s*\((0x[0-9A-Fa-f]+)\)\s$/; + var configCacheExp = /^Configuration:\s*([A-Za-z_][A-Za-z0-9_]*)\s*<-\s*(\S+)\s*$/; + + // var displayExp = /^[A-Za-z\s]+:\s*(.*)$/; + // var displayExp = /^([\w\s]+):\s*(.*)$/; + var displayExp = /^ECALL\s+(SIGNED|UNSIGNED|STRING|CHAR|FLOAT|DOUBLE):\s*(.+)$/; + var instoper = ""; + var syscall_print_code = -1; + var prev_add_to_jump; + + function updateCacheStat(index, access, data="") { + switch(access) { + case "Cache L1 hit inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L1_I hit": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1_I miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + break; + case "Cache L1_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L2 hit inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2 miss inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2_I hit": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2_I miss": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + case "Cache L2_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + } + + } + + async function check_call_convention_temp_regs(instMatch) { + if(((instMatch[7] != undefined && (instMatch[7].includes("t") || (instMatch[7].includes("s") && !instMatch[7].includes("sp")) ) ) || (instMatch[8] != undefined && (instMatch[8].includes("t") || (instMatch[8].includes("s") && !instMatch[8].includes("sp")) ))) && instMatch[6] !== undefined && inside_function) { + if((instMatch[5] != "li" && instMatch[5] != "lui" && instMatch[5] != "la") ){ + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + (callstack_convention[callstack_convention.length - 1][i].name === instMatch[7] || callstack_convention[callstack_convention.length - 1][i].name === instMatch[8]) && + (callstack_convention[callstack_convention.length - 1][i].can_operate === false) ? show_notification("Possible failure in the parameter passing convention", "warning") : 0 ; + } + + // callstack_convention[callstack_convention.length - 1].name + + } + } + if (instMatch[6] !== undefined && (instMatch[6].includes("t") || (instMatch[6].includes("s") && !instMatch[6].includes("sp"))) && inside_function) { + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + callstack_convention[callstack_convention.length - 1][i].can_operate = (callstack_convention[callstack_convention.length - 1][i].name === instMatch[6]) ? true : callstack_convention[callstack_convention.length - 1][i].can_operate; + } + } + } + + // var to_measure = ""; + var start_m, start_m; + var cache_inst; + + function writeMemory(value, addr) { + // Primero pasar el valor al formato hexadecimal por pares + if (value.startsWith("0x")) + value = value.slice(2); + if (value.length % 2 !== 0) + value = "0" + value; + + // const bytes = new Uint8Array(value.length / 2); + for (let i = 0; i < value.length / 2; i ++) { + main_memory.write((addr + BigInt(i)), Number("0x" + value.substring(i*2, i * 2 + 2))); + } + + // if (memoMatch[2] === '<-'){ + // switch(op){ + // case 'sh': // Para almacenar un half + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'float'); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // default: + // break; + // } + // } + } + + Module['print'] = function (message) { + if(message === "err call_convenction"){ + show_notification("Possible failure in the parameter passing convention", "warning"); + } + + var next_add_to_jump; + let instMatch = message.match(instructionExp); + let regiMatch = message.match(registerExp); + let memoMatch = message.match(memoryExp); + let printMatch = message.match(displayExp); + let CSRMatch = message.match(CSRTypeExp); + let CSREMatch = message.match(CSRExp); + let vectorMatch = message.match(vectorExp); + let jumpMatch = message.match(jumpExp); + let cacheMatch = message.match(cacheExp); + let configCacheMatch = message.match(configCacheExp); + + if (message.startsWith("Cache") || message.startsWith("Next_PC:")){ + if (message.includes("Cache prefetch")) { + let newpc = message.substring(15,message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address === newpc); + } else if (message.includes("Next_PC:")) { + let newpc = message.substring(9, message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address == newpc); + } + if (cache_inst != -1 && document.app.$data.execution_mode_run === 1) { + let hexmatch = message.match(/0x[0-9A-Fa-f]+$/); + if (hexmatch && !message.startsWith("Cache prefetch")) { + let hexa = hexmatch[0]; + message = message.replace(/on:\s*0x[0-9A-Fa-f]+$/, "").trim(); + updateCacheStat(cache_inst, message, hexa); + }else { + updateCacheStat(cache_inst, message); + } + + } + } + + if (message === "May your execution has an infinity loop."){ + document.app.$data.execution_mode_run = 1; + show_notification(message, "danger"); + instructions[hiden_executed]._rowVariant = "info"; + instructions[hiden_next_execute]._rowVariant = "success"; + } + + if (jumpMatch){ + const current_ins = instructions.findIndex(insn => insn.Address === (jumpMatch[1].toLowerCase())); + + for (var i = 0; i < instructions.length; i++){ + if(instructions[i]._rowVariant === "success" && document.app.$data.execution_mode_run !== 0) // ajustar lo del user mode + instructions[i]._rowVariant = ""; + } + if (current_ins !== -1) instructions[current_ins]._rowVariant = "success"; + } + + if (configCacheMatch) { + switch(configCacheMatch[1]) { + case "L1_I_SIZE": + config_cache.push({configuration: "Size L1_I", value: configCacheMatch[2] + " lines"}); + break; + case "L1_D_SIZE": + config_cache.push({configuration: "Size L1_D", value: configCacheMatch[2] + " lines"}); + break; + case "L1_SIZE": + config_cache.push({configuration: "Size L1", value: configCacheMatch[2] + " lines"}); + break; + case "L2_I_SIZE": + config_cache.push({configuration: "Size L2_I", value: configCacheMatch[2] + " lines"}); + break; + case "L2_D_SIZE": + config_cache.push({configuration: "Size L2_D", value: configCacheMatch[2] + " lines"}); + break; + case "L2_SIZE": + config_cache.push({configuration: "Size L2", value: configCacheMatch[2] + " lines"}); + break; + case "Rep_policy": + config_cache.push({configuration: "Replacement policy", value: configCacheMatch[2]}); + break; + case "L1_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1 block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2 block", value: configCacheMatch[2] + " bits"}); + break; + } + } + + if (cacheMatch) { + console.log(cacheMatch); + switch(cacheMatch[2]) { + case "L1_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_I_size_block); + break; + case "L1_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_D_size_block); + + break; + case "L1": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_size_block); + + break; + case "L2_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_I_size_block); + + break; + case "L2_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_D_size_block); + + break; + case "L2": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_size_block); + + break; + + } + } + + if(CSREMatch){ + console.log(CSREMatch); + if (CSREMatch[2] !== "vtype" && CSREMatch[2] !== "vl"){ + let regtowrite = crex_findReg(CSREMatch[2]); + if(regtowrite.match !== 0) + writeRegister(CSREMatch[4], regtowrite.indexComp, regtowrite.indexElem); + } + } + if (CSRMatch){ + if (CSRMatch[2] === "vtype"){ + var size_elem = parseInt(CSRMatch[5], 16).toString(2).padStart(32, '0'); + size_elem = size_elem.slice(26, 29); + // console.log("Tamaño: ", size_elem); + if(size_elem === "000"){ + document.app.$data.v_length = 8; + // architecture.components[3].total_elements = 64; + } else if (size_elem === "001") { + document.app.$data.v_length = 16; + // length_vext = 16; + // architecture.components[3].total_elements = 32; + } else if (size_elem === "010"){ + document.app.$data.v_length = 32; + // length_vext = 32; + // architecture.components[3].total_elements = 16; + }else { + document.app.$data.v_length = 64; + // length_vext = 64; + // architecture.components[3].total_elements = 8; + } + // architecture.components[3].length_elem = length_vext; + } + else if (CSRMatch[2] === "vl"){ + // architecture.components[3].elems_op = parseInt(CSRMatch[5], 16); + } + } + if (vectorMatch){ + let regtowrite = crex_findReg(vectorMatch[1]); + writeRegister(vectorMatch[3], regtowrite.indexComp, regtowrite.indexElem); + } + + if (instMatch && (parseInt(instMatch[3], 16) >= pc_min && parseInt(instMatch[3], 16) <= pc_max )){ + clearAllRegisterGlows(); + coreEvents.emit("step-about-to-execute"); + userMode32vd = true; + if (inside_function) + check_call_convention_temp_regs(instMatch); + + //Actualizamos el pc + writeRegister(BigInt(parseInt(instMatch[3], 16)), pc_sail.indexComp, pc_sail.indexElem); + for (var i = 0; i < instructions.length; i++) { + if (instructions[i]._rowVariant === "info") + instructions[i]._rowVariant = ""; + } + instoper = ""; + // console.log("PC actual:",pc_sail); + + + console.log("Instruccion: ", instMatch); + const current_ins = instructions.findIndex(insn => insn.Address === ("0x"+instMatch[3].toLowerCase())); + if(prev_add_to_jump !== undefined){ + instructions[prev_add_to_jump]._rowVariant = ""; + prev_add_to_jump = undefined; + } + + if (instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + const match = next_add[1].match(/(-?\d+)\((\w+)\)/); + var aux_reg = crex_findReg(match[2]); + var aux_val = readRegister(aux_reg.indexComp, aux_reg.indexElem); + + next_add_to_jump = (aux_val + BigInt(parseInt(match[1], 10))).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + prev_add_to_jump = current_ins; + + // var stack_entry_func = instructions[next_add_to_jump].label; + // creator_callstack_enter(instructions[next_add_to_jump].Label); + // track_stack_enter(instructions[next_add_to_jump].Label); + // callstack_convention.push(structuredClone(registers_before_function)); + // inside_function = true; + } + if (instructions[current_ins].loaded.includes("jal") && !instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + + } + if (instructions[current_ins].loaded.includes("ret") && !instructions[current_ins].loaded.includes("mret")){ + // Mirar el ra + var aux_reg = crex_findReg("ra"); + next_add_to_jump = readRegister(aux_reg.indexComp, aux_reg.indexElem).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + if (next_add_to_jump !== -1){ + prev_add_to_jump = current_ins; + // track_stack_leave(); + // creator_callstack_leave(); + // callstack_convention.pop(); + // inside_function = (callstack_convention.length > 0); + }else + next_add_to_jump = undefined; + } + + + // Primero caso de paso a paso + if (document.app.$data.execution_mode_run === 1){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined){ + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + } + // Para el caso de run without stop y la siguiente instruccion es un breakpoint + else if (document.app.$data.execution_mode_run === 0){ + // se almacena el estado de la instruccion en caso de que haya una parada por infinity loop + hiden_executed = current_ins; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + hiden_next_execute = (next_add_to_jump !== undefined) ? next_add_to_jump : current_ins + 1; + } else + hiden_next_execute = current_ins + 1; + + + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if(document.app.$data.is_breakpoint){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + } + coreEvents.emit("pause-execution"); + }else { + instructions[current_ins]._rowVariant = ''; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + + } + else + instructions[current_ins]._rowVariant = ''; + + if (instMatch[5] === "ecall"){ + let argument_register = crex_findReg("a7"); // obtenemos el registro para ver que llamada al sistema es + let syscall_code = readRegister(argument_register.indexComp, argument_register.indexElem); // Lectura del registro para obtener el valor + + switch(syscall_code){ + case 5n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para enteros + // capi_read_int('a0'); + SYSCALL.read('a0', "int"); + break; + case 6n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para floats + // capi_read_float('fa0'); + SYSCALL.read("fa0", "float"); + break; + case 7n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para double + // capi_read_double('fa0'); + SYSCALL.read("fa0", "double"); + break; + case 8n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para strings + // capi_read_string('a0','a1'); + SYSCALL.read("a0", "string", "a1"); + break; + + case 12n: + if(document.app.$data.execution_mode_run === 0){ + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para char + // capi_read_char('a0'); + SYSCALL.read("a0", "char"); + break; + default: + // console.log("No hago nada."); + syscall_print_code = syscall_code; + break; + } + + next_add_to_jump = undefined; + } + + + + instoper = instMatch[5]; + setInstructions(instructions); + coreEvents.emit("sail-instruction-update"); + // window.updateUI({ error: false, msg: "" }); + + + + + + + } else if (instMatch && (parseInt(instMatch[3], 16) <= pc_min || parseInt(instMatch[3], 16) >= pc_max )) + userMode32vd = false; + + if (regiMatch /*&& userMode === true*/) { + // En caso de ser escritura '<-' pintamos el valor en el registro que corresponde + if (regiMatch[2] === '<-'){ + let regtowrite = crex_findReg(regiMatch[1]); + // console.log("Registro identificado: ", regtowrite); + // if (regiMatch[1] !== 'x2') + if (regtowrite.indexComp === 2){ + if (regiMatch[3].startsWith("0x")) regiMatch[3] = regiMatch[3].slice(2).replace(/^0+/, ''); + else regiMatch[3] = regiMatch[3].replace(/^0+/, ''); + if (regiMatch[3].length <= 8){ + regiMatch[3] = regiMatch[3].padStart(8, "0"); + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem); + } + else{ + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem); + } + + } + else + writeRegister(BigInt(parseInt(regiMatch[3], 16)), regtowrite.indexComp, regtowrite.indexElem); + } + + } + + if (memoMatch /*&& userMode === true*/) { + if (memoMatch[2] === '<-'){ + // switch(instoper){ + // case 'sh': // Para almacenar un half + writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // break; + // default: + // break; + // } + + // instoper = ""; + } + + } + + if(printMatch && syscall_print_code !== -1){ + + let value_2_print = printMatch[2].trim(); + // console.log("Estoy dentro de ecall a imprimir"); + // console.log(message); + // console.log("Valor a imprimir: ", value_2_print); + switch(syscall_print_code){ + + case 1n: // Print int + // SYSCALL.print(Number(parseInt(value_2_print)), "int32"); + + display_print(value_2_print); + // display_print(full_print(parseInt(value_2_print), null, false)); + syscall_print_code = -1; + break; + case 2n: // Print float + // SYSCALL.print(Number(parseFloat(value_2_print)), "float"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 3n: // Print double + // SYSCALL.print(Number(parseFloat(value_2_print)), "double"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 4n: // Print String + display_print(value_2_print); + syscall_print_code = -1; + break; + + case 11n: // Print char + // SYSCALL.print(BigInt(value_2_print.charCodeAt(0)), char); + display_print(value_2_print); + syscall_print_code = -1; + break; + + default: // Rest of syscall codes not able to print + syscall_print_code = -1; + break; + + } + + } + + console.log(message); + + } + + Module['printErr'] = function (message) { + // if (message.includes("Execution:") || message.includes("Instructions:") || message.includes("Perf:")) + // show_notification(message, "success"); + // else + console.warn(message); + } + + var out = (document.app.$data.testing === true ) ? console.log.bind(console) : Module["print"]; + var err = Module["printErr"] /*|| console.warn.bind(console)*/; + + + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + checkIncomingModuleAPI(); + if (Module["arguments"]) arguments_ = Module["arguments"]; + legacyModuleProp("arguments", "arguments_"); + if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + legacyModuleProp("thisProgram", "thisProgram"); + assert( + typeof Module["memoryInitializerPrefixURL"] == "undefined", + "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["pthreadMainPrefixURL"] == "undefined", + "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["cdInitializerPrefixURL"] == "undefined", + "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["filePackagePrefixURL"] == "undefined", + "Module.filePackagePrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["read"] == "undefined", + "Module.read option was removed", + ); + assert( + typeof Module["readAsync"] == "undefined", + "Module.readAsync option was removed (modify readAsync in JS)", + ); + assert( + typeof Module["readBinary"] == "undefined", + "Module.readBinary option was removed (modify readBinary in JS)", + ); + assert( + typeof Module["setWindowTitle"] == "undefined", + "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)", + ); + assert( + typeof Module["TOTAL_MEMORY"] == "undefined", + "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY", + ); + legacyModuleProp("asm", "wasmExports"); + legacyModuleProp("readAsync", "readAsync"); + legacyModuleProp("readBinary", "readBinary"); + legacyModuleProp("setWindowTitle", "setWindowTitle"); + assert( + !ENVIRONMENT_IS_WORKER, + "worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_NODE, + "node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_SHELL, + "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.", + ); + var wasmBinary = Module["wasmBinary"]; + legacyModuleProp("wasmBinary", "wasmBinary"); + if (typeof WebAssembly != "object") { + err("no native wasm support detected"); + } + var wasmMemory; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } + } + var HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + var runtimeInitialized = false; + var isFileURI = (filename) => filename.startsWith("file://"); + function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + if (max == 0) { + max += 4; + } + HEAPU32[max / 4] = 34821223; + HEAPU32[(max + 4) / 4] = 2310721022; + HEAPU32[0 / 4] = 1668509029; + } + function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + if (max == 0) { + max += 4; + } + var cookie1 = HEAPU32[max / 4]; + var cookie2 = HEAPU32[(max + 4) / 4]; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort( + `Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`, + ); + } + if (HEAPU32[0 / 4] != 1668509029) { + abort( + "Runtime error: The application has corrupted its heap memory area (address zero)!", + ); + } + } + (() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) + throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; + })(); + if (Module["ENVIRONMENT"]) { + throw new Error( + "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)", + ); + } + function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming + ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" + : ""; + abort( + `\`Module.${prop}\` has been replaced by \`${newName}\`` + extra, + ); + }, + }); + } + } + function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort( + `\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`, + ); + } + } + function isExportedByForceFilesystem(name) { + return ( + name === "FS_createPath" || + name === "FS_createDataFile" || + name === "FS_createPreloadedFile" || + name === "FS_unlink" || + name === "addRunDependency" || + name === "FS_createLazyFile" || + name === "FS_createDevice" || + name === "removeRunDependency" + ); + } + function hookGlobalSymbolAccess(sym, func) { + if ( + typeof globalThis != "undefined" && + !Object.getOwnPropertyDescriptor(globalThis, sym) + ) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + }, + }); + } + } + function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); + } + missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + missingGlobal("asm", "Please use wasmExports instead"); + function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += + ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + unexportedRuntimeSymbol(sym); + } + function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += + ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + }, + }); + } + } + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); + } + assert( + !Module["STACK_SIZE"], + "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time", + ); + assert( + typeof Int32Array != "undefined" && + typeof Float64Array !== "undefined" && + Int32Array.prototype.subarray != undefined && + Int32Array.prototype.set != undefined, + "JS engine does not provide full typed array support", + ); + assert( + !Module["wasmMemory"], + "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally", + ); + assert( + !Module["INITIAL_MEMORY"], + "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically", + ); + function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") + Module["preRun"] = [Module["preRun"]]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); + } + function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; + } + function preMain() { + checkStackCookie(); + } + function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") + Module["postRun"] = [Module["postRun"]]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); + } + var runDependencies = 0; + var dependenciesFulfilled = null; + var runDependencyTracking = {}; + var runDependencyWatcher = null; + function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } + } + function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if ( + runDependencyWatcher === null && + typeof setInterval != "undefined" + ) { + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } + } + function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + if (what.indexOf("RuntimeError: unreachable") >= 0) { + what += + '. "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)'; + } + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; + } + function createExportWrapper(name, nargs) { + return (...args) => { + assert( + runtimeInitialized, + `native function \`${name}\` called before runtime initialization`, + ); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + assert( + args.length <= nargs, + `native function \`${name}\` called with ${args.length} args but expects ${nargs}`, + ); + return f(...args); + }; + } + var wasmBinaryFile; + function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("riscv_sim_RV32vd.wasm"); + } + return new URL("riscv_sim_RV32vd.wasm", import.meta.url).href; + } + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; + } + async function getWasmBinary(binaryFile) { + if (!wasmBinary) { + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + return getBinarySync(binaryFile); + } + async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + if (isFileURI(wasmBinaryFile)) { + err( + `warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`, + ); + } + abort(reason); + } + } + async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function") { + try { + var response = fetch(binaryFile, { credentials: "same-origin" }); + var instantiationResult = await WebAssembly.instantiateStreaming( + response, + imports, + ); + return instantiationResult; + } catch (reason) { + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); + } + function getWasmImports() { + Asyncify.instrumentWasmImports(wasmImports); + return { env: wasmImports, wasi_snapshot_preview1: wasmImports }; + } + async function createWasm() { + function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = Asyncify.instrumentWasmExports(wasmExports); + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert( + Module === trueModule, + "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?", + ); + trueModule = null; + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + readyPromiseReject(e); + return Promise.reject(e); + } + } + class ExitStatus { + name = "ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + } + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + callbacks.shift()(Module); + } + }; + var onPostRuns = []; + var addOnPostRun = (cb) => onPostRuns.unshift(cb); + var onPreRuns = []; + var addOnPreRun = (cb) => onPreRuns.unshift(cb); + var noExitRuntime = Module["noExitRuntime"] || true; + var ptrToString = (ptr) => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); + }; + var stackRestore = (val) => __emscripten_stack_restore(val); + var stackSave = () => _emscripten_stack_get_current(); + var warnOnce = (text) => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } + }; + var INT53_MAX = 9007199254740992; + var INT53_MIN = -9007199254740992; + var bigintToI53Checked = (num) => + num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); + var UTF8Decoder = + typeof TextDecoder != "undefined" ? new TextDecoder() : undefined; + var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) + warnOnce( + "Invalid UTF-8 leading byte " + + ptrToString(u0) + + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!", + ); + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; + }; + var UTF8ToString = (ptr, maxBytesToRead) => { + assert( + typeof ptr == "number", + `UTF8ToString expects a number (got ${typeof ptr})`, + ); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; + }; + function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort( + `Assertion failed: ${UTF8ToString(condition)}, at: ` + + [ + filename ? UTF8ToString(filename) : "unknown filename", + line, + func ? UTF8ToString(func) : "unknown function", + ], + ); + } + var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[SYSCALLS.varargs / 8]); + SYSCALLS.varargs += 8; + return ret; + }; + var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + var ret = HEAP32[+SYSCALLS.varargs / 4]; + SYSCALLS.varargs += 4; + return ret; + }; + var PATH = { + isAbs: (path) => path.charAt(0) === "/", + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.slice(-1) === "/"; + path = PATH.normalizeArray( + path.split("/").filter((p) => !!p), + !isAbsolute, + ).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: (path) => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r), + }; + var initRandomFill = () => (view) => crypto.getRandomValues(view); + var randomFill = (view) => { + (randomFill = initRandomFill())(view); + }; + var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? args[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split("/").filter((p) => !!p), + !resolvedAbsolute, + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }, + }; + var FS_stdin_getChar_buffer = []; + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert( + typeof str === "string", + `stringToUTF8Array expects a string (got ${typeof str})`, + ); + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) + warnOnce( + "Invalid Unicode code point " + + ptrToString(u) + + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).", + ); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + heap[outIdx] = 0; + return outIdx - startIdx; + }; + var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + }; + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if ( + typeof window != "undefined" && + typeof window.prompt == "function" + ) { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else { + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + }, + }; + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + }; + var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (ptr) zeroMemory(ptr, size); + return ptr; + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of ["mode", "atime", "mtime", "ctime"]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = + new_dir.mtime = + old_node.parent.ctime = + old_node.parent.mtime = + Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [".", "..", ...Object.keys(node.contents)]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert( + position === 0, + "canOwn must imply no weird position inside the file", + ); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + HEAP8.set(contents, ptr); + } + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + }, + }, + }; + var asyncLoad = async (url) => { + var arrayBuffer = await readAsync(url); + assert( + arrayBuffer, + `Loading data file "${url}" failed (no arrayBuffer).`, + ); + return new Uint8Array(arrayBuffer); + }; + asyncLoad.isAsync = true; + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + var preloadPlugins = Module["preloadPlugins"] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + onload?.(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } + }; + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + "r+": 2, + w: 512 | 64 | 1, + "w+": 512 | 64 | 2, + a: 1024 | 64 | 1, + "a+": 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + var strError = (errno) => UTF8ToString(_strerror(errno)); + var ERRNO_CODES = { + EPERM: 63, + ENOENT: 44, + ESRCH: 71, + EINTR: 27, + EIO: 29, + ENXIO: 60, + E2BIG: 1, + ENOEXEC: 45, + EBADF: 8, + ECHILD: 12, + EAGAIN: 6, + EWOULDBLOCK: 6, + ENOMEM: 48, + EACCES: 2, + EFAULT: 21, + ENOTBLK: 105, + EBUSY: 10, + EEXIST: 20, + EXDEV: 75, + ENODEV: 43, + ENOTDIR: 54, + EISDIR: 31, + EINVAL: 28, + ENFILE: 41, + EMFILE: 33, + ENOTTY: 59, + ETXTBSY: 74, + EFBIG: 22, + ENOSPC: 51, + ESPIPE: 70, + EROFS: 69, + EMLINK: 34, + EPIPE: 64, + EDOM: 18, + ERANGE: 68, + ENOMSG: 49, + EIDRM: 24, + ECHRNG: 106, + EL2NSYNC: 156, + EL3HLT: 107, + EL3RST: 108, + ELNRNG: 109, + EUNATCH: 110, + ENOCSI: 111, + EL2HLT: 112, + EDEADLK: 16, + ENOLCK: 46, + EBADE: 113, + EBADR: 114, + EXFULL: 115, + ENOANO: 104, + EBADRQC: 103, + EBADSLT: 102, + EDEADLOCK: 16, + EBFONT: 101, + ENOSTR: 100, + ENODATA: 116, + ETIME: 117, + ENOSR: 118, + ENONET: 119, + ENOPKG: 120, + EREMOTE: 121, + ENOLINK: 47, + EADV: 122, + ESRMNT: 123, + ECOMM: 124, + EPROTO: 65, + EMULTIHOP: 36, + EDOTDOT: 125, + EBADMSG: 9, + ENOTUNIQ: 126, + EBADFD: 127, + EREMCHG: 128, + ELIBACC: 129, + ELIBBAD: 130, + ELIBSCN: 131, + ELIBMAX: 132, + ELIBEXEC: 133, + ENOSYS: 52, + ENOTEMPTY: 55, + ENAMETOOLONG: 37, + ELOOP: 32, + EOPNOTSUPP: 138, + EPFNOSUPPORT: 139, + ECONNRESET: 15, + ENOBUFS: 42, + EAFNOSUPPORT: 5, + EPROTOTYPE: 67, + ENOTSOCK: 57, + ENOPROTOOPT: 50, + ESHUTDOWN: 140, + ECONNREFUSED: 14, + EADDRINUSE: 3, + ECONNABORTED: 13, + ENETUNREACH: 40, + ENETDOWN: 38, + ETIMEDOUT: 73, + EHOSTDOWN: 142, + EHOSTUNREACH: 23, + EINPROGRESS: 26, + EALREADY: 7, + EDESTADDRREQ: 17, + EMSGSIZE: 35, + EPROTONOSUPPORT: 66, + ESOCKTNOSUPPORT: 137, + EADDRNOTAVAIL: 4, + ENETRESET: 39, + EISCONN: 30, + ENOTCONN: 53, + ETOOMANYREFS: 141, + EUSERS: 136, + EDQUOT: 19, + ESTALE: 72, + ENOTSUP: 138, + ENOMEDIUM: 148, + EILSEQ: 25, + EOVERFLOW: 61, + ECANCELED: 11, + ENOTRECOVERABLE: 56, + EOWNERDEAD: 62, + ESTRPIPE: 135, + }; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name = "ErrnoError"; + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared = {}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return this.flags & 1024; + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops = {}; + stream_ops = {}; + readMode = 292 | 73; + writeMode = 146; + mounted = null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? (this.mode |= this.readMode) : (this.mode &= ~this.readMode); + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? (this.mode |= this.writeMode) : (this.mode &= ~this.writeMode); + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + var parts = path.split("/").filter((p) => !!p); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + if (e?.errno === 44 && islast && opts.noent_okay) { + return { path: current_path }; + } + throw e; + } + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { path: current_path, node: current }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ["r", "w", "rw"][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & (512 | 64)) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { type, opts, mountpoint, mounts: [] }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { follow: true }).node); + }, + statfsStream(stream) { + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255, + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow, + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { timestamp: Date.now(), dontFollow }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { size: len, timestamp: Date.now() }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { atime, mtime }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true, + }); + node = lookup.node; + path = lookup.path; + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node, + path: FS.getPath(node), + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0, + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { llseek: MEMFS.stream_ops.llseek }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: "fake" }, + node_ops: { readlink: () => stream.path }, + id: fd + 1, + }; + ret.parent = ret; + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()) + .filter(([k, v]) => v) + .map(([k, v]) => k.toString()); + }, + }; + return node; + }, + }, + {}, + "/proc/self/fd", + ); + }, + createStandardStreams(input, output, error) { + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS }; + }, + init(input, output, error) { + assert( + !FS.initialized, + "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)", + ); + FS.initialized = true; + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + _fflush(0); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error( + "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.", + ); + } else { + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + class LazyUint8Array { + lengthKnown = false; + chunks = []; + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = + (header = xhr.getResponseHeader("Accept-Ranges")) && + header === "bytes"; + var usesGzip = + (header = xhr.getResponseHeader("Content-Encoding")) && + header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + "invalid range (" + + from + + ", " + + to + + ") or no bytes requested!", + ); + if (to > datalength - 1) + throw new Error( + "only " + datalength + " bytes available! programmer error!", + ); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") + throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + "LazyFiles on gzip forces download of the whole file when length is accessed", + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) + throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort( + "FS.mmapAlloc has been replaced by the top level function mmapAlloc", + ); + }, + standardizePath() { + abort( + "FS.standardizePath has been removed; use PATH.normalize instead", + ); + }, + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + HEAP32[buf / 4] = stat.dev; + HEAP32[(buf + 4) / 4] = stat.mode; + HEAPU64[(buf + 8) / 8] = BigInt(stat.nlink); + HEAP32[(buf + 16) / 4] = stat.uid; + HEAP32[(buf + 20) / 4] = stat.gid; + HEAP32[(buf + 24) / 4] = stat.rdev; + HEAP64[(buf + 32) / 8] = BigInt(stat.size); + HEAP32[(buf + 40) / 4] = 4096; + HEAP32[(buf + 44) / 4] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(buf + 48) / 8] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(buf + 56) / 8] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 64) / 8] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(buf + 72) / 8] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 80) / 8] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(buf + 88) / 8] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 96) / 8] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + HEAP32[(buf + 8) / 4] = stats.bsize; + HEAP32[(buf + 56) / 4] = stats.bsize; + HEAP32[(buf + 16) / 4] = stats.blocks; + HEAP32[(buf + 20) / 4] = stats.bfree; + HEAP32[(buf + 24) / 4] = stats.bavail; + HEAP32[(buf + 28) / 4] = stats.files; + HEAP32[(buf + 32) / 4] = stats.ffree; + HEAP32[(buf + 36) / 4] = stats.fsid; + HEAP32[(buf + 64) / 4] = stats.flags; + HEAP32[(buf + 48) / 4] = stats.namelen; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = syscallGetVarargP(); + var offset = 0; + HEAP16[(arg + offset) / 2] = 2; + return 0; + } + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + HEAP32[argp / 4] = termios.c_iflag || 0; + HEAP32[(argp + 4) / 4] = termios.c_oflag || 0; + HEAP32[(argp + 8) / 4] = termios.c_cflag || 0; + HEAP32[(argp + 12) / 4] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[argp + i + 17] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = HEAP32[argp / 4]; + var c_oflag = HEAP32[(argp + 4) / 4]; + var c_cflag = HEAP32[(argp + 8) / 4]; + var c_lflag = HEAP32[(argp + 12) / 4]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[argp + i + 17]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + HEAP32[argp / 4] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + HEAP16[argp / 2] = winsize[0]; + HEAP16[(argp + 2) / 2] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var __abort_js = () => abort("native code called abort()"); + var runtimeKeepaliveCounter = 0; + var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; + }; + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + len = bigintToI53Checked(len); + offset = bigintToI53Checked(offset); + allocated = bigintToI53Checked(allocated); + addr = bigintToI53Checked(addr); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated / 4] = res.allocated; + HEAPU64[addr / 8] = BigInt(ptr); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset) { + addr = bigintToI53Checked(addr); + len = bigintToI53Checked(len); + offset = bigintToI53Checked(offset); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var timers = {}; + var handleException = (e) => { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err( + "Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)", + ); + } + } + quit_(1, e); + }; + var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + var _proc_exit = (code) => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + }; + var exitJS = (statusw, implicit) => { + EXITSTATUS = statusw; + checkUnflushedContent(); + if (keepRuntimeAlive() && !implicit) { + if (!document.app.$data.testing){ + for (let i = 0; i < instructions.length; i++){ + instructions[i]._rowVariant = ''; + } + status.run_program = -1; // program finished + if (statusw !== 0){ + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: true, + run_disable: true, + stop_disable: false, + }); + show_notification("Your program has finished with errors.", "danger"); + } else { + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: false, + run_disable: false, + stop_disable: true, + isFinished: true, + }); + } + } else { + if (statusw === 0) + document.app.$data.passed_test += 1; + else + document.app.$data.failed_test += 1; + } + var msg = `program exited (with status: ${statusw}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + _proc_exit(status); + }; + var _exit = exitJS; + var maybeExit = () => { + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + }; + var callUserCallback = (func) => { + if (ABORT) { + err( + "user callback triggered after runtime exited or application aborted. Ignoring.", + ); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } + }; + var _emscripten_get_now = () => performance.now(); + var __setitimer_js = (which, timeout_ms) => { + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => + __emscripten_timeout(which, _emscripten_get_now()), + ); + }, timeout_ms); + timers[which] = { id, timeout_ms }; + return 0; + }; + var _emscripten_set_main_loop_timing = (mode, value) => { + MainLoop.timingMode = mode; + MainLoop.timingValue = value; + if (!MainLoop.func) { + err( + "emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up.", + ); + return 1; + } + if (!MainLoop.running) { + MainLoop.running = true; + } + if (mode == 0) { + MainLoop.scheduler = function MainLoop_scheduler_setTimeout() { + var timeUntilNextTick = + Math.max( + 0, + MainLoop.tickStartTime + value - _emscripten_get_now(), + ) | 0; + setTimeout(MainLoop.runner, timeUntilNextTick); + }; + MainLoop.method = "timeout"; + } else if (mode == 1) { + MainLoop.scheduler = function MainLoop_scheduler_rAF() { + MainLoop.requestAnimationFrame(MainLoop.runner); + }; + MainLoop.method = "rAF"; + } else if (mode == 2) { + if (typeof MainLoop.setImmediate == "undefined") { + if (typeof setImmediate == "undefined") { + var setImmediates = []; + var emscriptenMainLoopMessageId = "setimmediate"; + var MainLoop_setImmediate_messageHandler = (event) => { + if ( + event.data === emscriptenMainLoopMessageId || + event.data.target === emscriptenMainLoopMessageId + ) { + event.stopPropagation(); + setImmediates.shift()(); + } + }; + addEventListener( + "message", + MainLoop_setImmediate_messageHandler, + true, + ); + MainLoop.setImmediate = (func) => { + setImmediates.push(func); + if (ENVIRONMENT_IS_WORKER) { + Module["setImmediates"] ??= []; + Module["setImmediates"].push(func); + postMessage({ target: emscriptenMainLoopMessageId }); + } else postMessage(emscriptenMainLoopMessageId, "*"); + }; + } else { + MainLoop.setImmediate = setImmediate; + } + } + MainLoop.scheduler = function MainLoop_scheduler_setImmediate() { + MainLoop.setImmediate(MainLoop.runner); + }; + MainLoop.method = "immediate"; + } + return 0; + }; + var setMainLoop = ( + iterFunc, + fps, + simulateInfiniteLoop, + arg, + noSetTiming, + ) => { + assert( + !MainLoop.func, + "emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.", + ); + MainLoop.func = iterFunc; + MainLoop.arg = arg; + var thisMainLoopId = MainLoop.currentlyRunningMainloop; + function checkIsRunning() { + if (thisMainLoopId < MainLoop.currentlyRunningMainloop) { + maybeExit(); + return false; + } + return true; + } + MainLoop.running = false; + MainLoop.runner = function MainLoop_runner() { + if (ABORT) return; + if (MainLoop.queue.length > 0) { + var start = Date.now(); + var blocker = MainLoop.queue.shift(); + blocker.func(blocker.arg); + if (MainLoop.remainingBlockers) { + var remaining = MainLoop.remainingBlockers; + var next = + remaining % 1 == 0 ? remaining - 1 : Math.floor(remaining); + if (blocker.counted) { + MainLoop.remainingBlockers = next; + } else { + next = next + 0.5; + MainLoop.remainingBlockers = (8 * remaining + next) / 9; + } + } + MainLoop.updateStatus(); + if (!checkIsRunning()) return; + setTimeout(MainLoop.runner, 0); + return; + } + if (!checkIsRunning()) return; + MainLoop.currentFrameNumber = (MainLoop.currentFrameNumber + 1) | 0; + if ( + MainLoop.timingMode == 1 && + MainLoop.timingValue > 1 && + MainLoop.currentFrameNumber % MainLoop.timingValue != 0 + ) { + MainLoop.scheduler(); + return; + } else if (MainLoop.timingMode == 0) { + MainLoop.tickStartTime = _emscripten_get_now(); + } + if (MainLoop.method === "timeout" && Module["ctx"]) { + warnOnce( + "Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!", + ); + MainLoop.method = ""; + } + MainLoop.runIter(iterFunc); + if (!checkIsRunning()) return; + MainLoop.scheduler(); + }; + if (!noSetTiming) { + if (fps > 0) { + _emscripten_set_main_loop_timing(0, 1e3 / fps); + } else { + _emscripten_set_main_loop_timing(1, 1); + } + MainLoop.scheduler(); + } + if (simulateInfiniteLoop) { + throw "unwind"; + } + }; + var MainLoop = { + running: false, + scheduler: null, + method: "", + currentlyRunningMainloop: 0, + func: null, + arg: 0, + timingMode: 0, + timingValue: 0, + currentFrameNumber: 0, + queue: [], + preMainLoop: [], + postMainLoop: [], + pause() { + MainLoop.scheduler = null; + MainLoop.currentlyRunningMainloop++; + }, + resume() { + MainLoop.currentlyRunningMainloop++; + var timingMode = MainLoop.timingMode; + var timingValue = MainLoop.timingValue; + var func = MainLoop.func; + MainLoop.func = null; + setMainLoop(func, 0, false, MainLoop.arg, true); + _emscripten_set_main_loop_timing(timingMode, timingValue); + MainLoop.scheduler(); + }, + updateStatus() { + if (Module["setStatus"]) { + var message = Module["statusMessage"] || "Please wait..."; + var remaining = MainLoop.remainingBlockers ?? 0; + var expected = MainLoop.expectedBlockers ?? 0; + if (remaining) { + if (remaining < expected) { + Module["setStatus"]( + `{message} ({expected - remaining}/{expected})`, + ); + } else { + Module["setStatus"](message); + } + } else { + Module["setStatus"](""); + } + } + }, + init() { + Module["preMainLoop"] && + MainLoop.preMainLoop.push(Module["preMainLoop"]); + Module["postMainLoop"] && + MainLoop.postMainLoop.push(Module["postMainLoop"]); + }, + runIter(func) { + if (ABORT) return; + for (var pre of MainLoop.preMainLoop) { + if (pre() === false) { + return; + } + } + callUserCallback(func); + for (var post of MainLoop.postMainLoop) { + post(); + } + checkStackCookie(); + }, + nextRAF: 0, + fakeRequestAnimationFrame(func) { + var now = Date.now(); + if (MainLoop.nextRAF === 0) { + MainLoop.nextRAF = now + 1e3 / 60; + } else { + while (now + 2 >= MainLoop.nextRAF) { + MainLoop.nextRAF += 1e3 / 60; + } + } + var delay = Math.max(MainLoop.nextRAF - now, 0); + setTimeout(func, delay); + }, + requestAnimationFrame(func) { + if (typeof requestAnimationFrame == "function") { + requestAnimationFrame(func); + return; + } + var RAF = MainLoop.fakeRequestAnimationFrame; + RAF(func); + }, + }; + var _emscripten_date_now = () => Date.now(); + var getHeapMax = () => 2147483648; + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + wasmMemory.grow(BigInt(pages)); + updateMemoryViews(); + return 1; + } catch (e) { + err( + `growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`, + ); + } + }; + function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + assert(requestedSize > oldSize); + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err( + `Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`, + ); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + var newSize = Math.min( + maxHeapSize, + alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err( + `Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`, + ); + return false; + } + function _emscripten_run_script_int(ptr) { + ptr = bigintToI53Checked(ptr); + return eval(UTF8ToString(ptr)) | 0; + } + var safeSetTimeout = (func, timeout) => + setTimeout(() => { + callUserCallback(func); + }, timeout); + var _emscripten_sleep = (ms) => + Asyncify.handleSleep((wakeUp) => safeSetTimeout(wakeUp, ms)); + _emscripten_sleep.isAsync = true; + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[iov / 8]); + var len = Number(HEAPU64[(iov + 8) / 8]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[pnum / 8] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[newOffset / 8] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[iov / 8]); + var len = Number(HEAPU64[(iov + 8) / 8]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[pnum / 8] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert( + typeof maxBytesToWrite == "number", + "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!", + ); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + var stackAlloc = (sz) => __emscripten_stack_alloc(sz); + var stringToUTF8OnStack = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; + }; + var runAndAbortIfError = (func) => { + try { + return func(); + } catch (e) { + abort(e); + } + }; + var runtimeKeepalivePush = () => { + runtimeKeepaliveCounter += 1; + }; + var runtimeKeepalivePop = () => { + assert(runtimeKeepaliveCounter > 0); + runtimeKeepaliveCounter -= 1; + }; + var Asyncify = { + rewindArguments: {}, + instrumentWasmImports(imports) { + var importPattern = /^(invoke_.*|__asyncjs__.*)$/; + for (let [x, original] of Object.entries(imports)) { + if (typeof original == "function") { + let isAsyncifyImport = original.isAsync || importPattern.test(x); + imports[x] = (...args) => { + var originalAsyncifyState = Asyncify.state; + try { + return original(...args); + } finally { + var changedToDisabled = + originalAsyncifyState === Asyncify.State.Normal && + Asyncify.state === Asyncify.State.Disabled; + var ignoredInvoke = x.startsWith("invoke_") && true; + if ( + Asyncify.state !== originalAsyncifyState && + !isAsyncifyImport && + !changedToDisabled && + !ignoredInvoke + ) { + throw new Error( + `import ${x} was not in ASYNCIFY_IMPORTS, but changed the state`, + ); + } + } + }; + } + } + }, + saveRewindArguments(funcName, passedArguments) { + return (Asyncify.rewindArguments[funcName] = + Array.from(passedArguments)); + }, + restoreRewindArguments(funcName) { + return Asyncify.rewindArguments[funcName] || []; + }, + instrumentWasmExports(exports) { + var ret = {}; + for (let [x, original] of Object.entries(exports)) { + if (typeof original == "function") { + ret[x] = (...args) => { + Asyncify.exportCallStack.push(x); + try { + Asyncify.saveRewindArguments(x, args); + return original(...args); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + } + return ret; + }, + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId(funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + maybeStopUnwind() { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_unwind); + if (typeof Fibers != "undefined") { + Fibers.trampoline(); + } + } + }, + whenDone() { + assert( + Asyncify.currData, + "Tried to wait for an async operation when none is in progress.", + ); + assert( + !Asyncify.asyncPromiseHandlers, + "Cannot have multiple async operations in flight at once", + ); + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { resolve, reject }; + }); + }, + allocateData() { + var ptr = _malloc(24 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 24, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader(ptr, stack, stackSize) { + HEAPU64[ptr / 8] = BigInt(stack); + HEAPU64[(ptr + 8) / 8] = BigInt(stack + stackSize); + }, + setDataRewindFunc(ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + HEAP32[(ptr + 16) / 4] = rewindId; + }, + getDataRewindFuncName(ptr) { + var id = HEAP32[(ptr + 16) / 4]; + var name = Asyncify.callStackIdToName[id]; + return name; + }, + getDataRewindFunc(name) { + var func = wasmExports[name]; + return func; + }, + doRewind(ptr) { + var name = Asyncify.getDataRewindFuncName(ptr); + var func = Asyncify.getDataRewindFunc(name); + return func(...Asyncify.restoreRewindArguments(name)); + }, + handleSleep(startAsync) { + assert( + Asyncify.state !== Asyncify.State.Disabled, + "Asyncify cannot be done during or after the runtime exits", + ); + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue = 0) => { + assert( + !handleSleepReturnValue || + typeof handleSleepReturnValue == "number" || + typeof handleSleepReturnValue == "boolean", + ); + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + assert( + !Asyncify.exportCallStack.length, + "Waking up (starting to rewind) must be done from JS, without compiled code on the stack.", + ); + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData)); + if (typeof MainLoop != "undefined" && MainLoop.func) { + MainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)(asyncWasmReturnValue); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + if (typeof MainLoop != "undefined" && MainLoop.func) { + MainLoop.pause(); + } + runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData)); + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_rewind); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach(callUserCallback); + } else { + abort(`invalid state: ${Asyncify.state}`); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync(startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + var getCFunc = (ident) => { + var func = Module["_" + ident]; + assert( + func, + "Cannot call unknown function " + ident + ", make sure it is exported", + ); + return func; + }; + var writeArrayToMemory = (array, buffer) => { + assert( + array.length >= 0, + "writeArrayToMemory array must have a length (should be an array or typed array)", + ); + HEAP8.set(array, buffer); + }; + var ccall = (ident, returnType, argTypes, args, opts) => { + var toC = { + pointer: (p) => BigInt(p), + string: (str) => { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + ret = stringToUTF8OnStack(str); + } + return BigInt(ret); + }, + array: (arr) => { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return BigInt(ret); + }, + }; + function convertReturnValue(ret) { + if (returnType === "string") { + return UTF8ToString(Number(ret)); + } + if (returnType === "pointer") return Number(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var previousAsync = Asyncify.currData; + var ret = func(...cArgs); + function onDone(ret) { + runtimeKeepalivePop(); + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + var asyncMode = opts?.async; + runtimeKeepalivePush(); + if (Asyncify.currData != previousAsync) { + assert( + !(previousAsync && Asyncify.currData), + "We cannot start an async operation when one is already flight", + ); + assert( + !(previousAsync && !Asyncify.currData), + "We cannot stop an async operation in flight", + ); + assert( + asyncMode, + "The call to " + + ident + + " is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.", + ); + return Asyncify.whenDone().then(onDone); + } + ret = onDone(ret); + if (asyncMode) return Promise.resolve(ret); + return ret; + }; + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + Module["requestAnimationFrame"] = MainLoop.requestAnimationFrame; + Module["pauseMainLoop"] = MainLoop.pause; + Module["resumeMainLoop"] = MainLoop.resume; + MainLoop.init(); + function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); + } + var wasmImports = { + __assert_fail: ___assert_fail, + __syscall_fcntl64: ___syscall_fcntl64, + __syscall_fstat64: ___syscall_fstat64, + __syscall_ioctl: ___syscall_ioctl, + __syscall_openat: ___syscall_openat, + _abort_js: __abort_js, + _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + _mmap_js: __mmap_js, + _munmap_js: __munmap_js, + _setitimer_js: __setitimer_js, + emscripten_date_now: _emscripten_date_now, + emscripten_resize_heap: _emscripten_resize_heap, + emscripten_run_script_int: _emscripten_run_script_int, + emscripten_sleep: _emscripten_sleep, + exit: _exit, + fd_close: _fd_close, + fd_read: _fd_read, + fd_seek: _fd_seek, + fd_write: _fd_write, + proc_exit: _proc_exit, + }; + var wasmExports = await createWasm(); + var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + var _malloc = (Module["_malloc"] = createExportWrapper("malloc", 1)); + var _free = (Module["_free"] = createExportWrapper("free", 1)); + var _send_int_to_C = (Module["_send_int_to_C"] = createExportWrapper( + "send_int_to_C", + 1, + )); + var _send_float_to_C = (Module["_send_float_to_C"] = createExportWrapper( + "send_float_to_C", + 1, + )); + var _send_double_to_C = (Module["_send_double_to_C"] = createExportWrapper( + "send_double_to_C", + 1, + )); + var _send_char_to_C = (Module["_send_char_to_C"] = createExportWrapper( + "send_char_to_C", + 1, + )); + var _send_string_to_C = (Module["_send_string_to_C"] = createExportWrapper( + "send_string_to_C", + 1, + )); + var _reanudar_ejecucion = (Module["_reanudar_ejecucion"] = + createExportWrapper("reanudar_ejecucion", 1)); + var _strerror = createExportWrapper("strerror", 1); + var _fflush = createExportWrapper("fflush", 1); + var _main = (Module["_main"] = createExportWrapper("__main_argc_argv", 2)); + var _emscripten_builtin_memalign = createExportWrapper( + "emscripten_builtin_memalign", + 2, + ); + var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + var _emscripten_stack_get_current = + wasmExports["emscripten_stack_get_current"]; + var ___cxa_increment_exception_refcount = createExportWrapper( + "__cxa_increment_exception_refcount", + 1, + ); + var dynCall_jj = (Module["dynCall_jj"] = createExportWrapper( + "dynCall_jj", + 2, + )); + var dynCall_jjjj = (Module["dynCall_jjjj"] = createExportWrapper( + "dynCall_jjjj", + 4, + )); + var dynCall_vjj = (Module["dynCall_vjj"] = createExportWrapper( + "dynCall_vjj", + 3, + )); + var dynCall_ijjj = (Module["dynCall_ijjj"] = createExportWrapper( + "dynCall_ijjj", + 4, + )); + var dynCall_ijii = (Module["dynCall_ijii"] = createExportWrapper( + "dynCall_ijii", + 4, + )); + var dynCall_ij = (Module["dynCall_ij"] = createExportWrapper( + "dynCall_ij", + 2, + )); + var dynCall_jjii = (Module["dynCall_jjii"] = createExportWrapper( + "dynCall_jjii", + 4, + )); + var dynCall_jjji = (Module["dynCall_jjji"] = createExportWrapper( + "dynCall_jjji", + 4, + )); + var dynCall_ijdiiii = (Module["dynCall_ijdiiii"] = createExportWrapper( + "dynCall_ijdiiii", + 7, + )); + var dynCall_v = (Module["dynCall_v"] = createExportWrapper("dynCall_v", 1)); + var dynCall_vi = (Module["dynCall_vi"] = createExportWrapper( + "dynCall_vi", + 2, + )); + var _asyncify_start_unwind = createExportWrapper( + "asyncify_start_unwind", + 1, + ); + var _asyncify_stop_unwind = createExportWrapper("asyncify_stop_unwind", 0); + var _asyncify_start_rewind = createExportWrapper( + "asyncify_start_rewind", + 1, + ); + var _asyncify_stop_rewind = createExportWrapper("asyncify_stop_rewind", 0); + function applySignatureConversions(wasmExports) { + wasmExports = Object.assign({}, wasmExports); + var makeWrapper_pp = (f) => (a0) => Number(f(BigInt(a0))); + var makeWrapper__p = (f) => (a0) => f(BigInt(a0)); + var makeWrapper_p_ = (f) => (a0) => Number(f(a0)); + var makeWrapper___PP = (f) => (a0, a1, a2) => + f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper_ppp = (f) => (a0, a1) => + Number(f(BigInt(a0), BigInt(a1))); + var makeWrapper_p = (f) => () => Number(f()); + var makeWrapper__p_ = (f) => (a0, a1) => f(BigInt(a0), a1); + var makeWrapper__p___ = (f) => (a0, a1, a2, a3) => + f(BigInt(a0), a1, a2, a3); + var makeWrapper__p__ = (f) => (a0, a1, a2) => f(BigInt(a0), a1, a2); + var makeWrapper__p______ = (f) => (a0, a1, a2, a3, a4, a5, a6) => + f(BigInt(a0), a1, a2, a3, a4, a5, a6); + wasmExports["malloc"] = makeWrapper_pp(wasmExports["malloc"]); + wasmExports["free"] = makeWrapper__p(wasmExports["free"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["__main_argc_argv"] = makeWrapper___PP( + wasmExports["__main_argc_argv"], + ); + wasmExports["emscripten_builtin_memalign"] = makeWrapper_ppp( + wasmExports["emscripten_builtin_memalign"], + ); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p( + wasmExports["emscripten_stack_get_base"], + ); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p( + wasmExports["emscripten_stack_get_end"], + ); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p( + wasmExports["_emscripten_stack_restore"], + ); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp( + wasmExports["_emscripten_stack_alloc"], + ); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p( + wasmExports["emscripten_stack_get_current"], + ); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p( + wasmExports["__cxa_increment_exception_refcount"], + ); + wasmExports["dynCall_jj"] = makeWrapper__p_(wasmExports["dynCall_jj"]); + wasmExports["dynCall_jjjj"] = makeWrapper__p___( + wasmExports["dynCall_jjjj"], + ); + wasmExports["dynCall_vjj"] = makeWrapper__p__(wasmExports["dynCall_vjj"]); + wasmExports["dynCall_ijjj"] = makeWrapper__p___( + wasmExports["dynCall_ijjj"], + ); + wasmExports["dynCall_ijii"] = makeWrapper__p___( + wasmExports["dynCall_ijii"], + ); + wasmExports["dynCall_ij"] = makeWrapper__p_(wasmExports["dynCall_ij"]); + wasmExports["dynCall_jjii"] = makeWrapper__p___( + wasmExports["dynCall_jjii"], + ); + wasmExports["dynCall_jjji"] = makeWrapper__p___( + wasmExports["dynCall_jjji"], + ); + wasmExports["dynCall_ijdiiii"] = makeWrapper__p______( + wasmExports["dynCall_ijdiiii"], + ); + wasmExports["dynCall_v"] = makeWrapper__p(wasmExports["dynCall_v"]); + wasmExports["dynCall_vi"] = makeWrapper__p_(wasmExports["dynCall_vi"]); + wasmExports["asyncify_start_unwind"] = makeWrapper__p( + wasmExports["asyncify_start_unwind"], + ); + wasmExports["asyncify_start_rewind"] = makeWrapper__p( + wasmExports["asyncify_start_rewind"], + ); + return wasmExports; + } + Module["run"] = run; + Module["callMain"] = callMain; + Module["ccall"] = ccall; + Module["stringToUTF8"] = stringToUTF8; + Module["lengthBytesUTF8"] = lengthBytesUTF8; + Module["FS"] = FS; + var missingLibrarySymbols = [ + "writeI53ToI64", + "writeI53ToI64Clamped", + "writeI53ToI64Signaling", + "writeI53ToU64Clamped", + "writeI53ToU64Signaling", + "readI53FromI64", + "readI53FromU64", + "convertI32PairToI53", + "convertI32PairToI53Checked", + "convertU32PairToI53", + "getTempRet0", + "setTempRet0", + "inetPton4", + "inetNtop4", + "inetPton6", + "inetNtop6", + "readSockaddr", + "writeSockaddr", + "emscriptenLog", + "readEmAsmArgs", + "jstoi_q", + "getExecutableName", + "listenOnce", + "autoResumeAudioContext", + "dynCallLegacy", + "getDynCaller", + "dynCall", + "asmjsMangle", + "HandleAllocator", + "getNativeTypeSize", + "addOnInit", + "addOnPostCtor", + "addOnPreMain", + "addOnExit", + "STACK_SIZE", + "STACK_ALIGN", + "POINTER_SIZE", + "ASSERTIONS", + "cwrap", + "uleb128Encode", + "generateFuncType", + "convertJsFunctionToWasm", + "getEmptyTableSlot", + "updateTableMap", + "getFunctionAddress", + "addFunction", + "removeFunction", + "reallyNegative", + "unSign", + "strLen", + "reSign", + "formatString", + "intArrayToString", + "AsciiToString", + "stringToAscii", + "UTF16ToString", + "stringToUTF16", + "lengthBytesUTF16", + "UTF32ToString", + "stringToUTF32", + "lengthBytesUTF32", + "stringToNewUTF8", + "registerKeyEventCallback", + "maybeCStringToJsString", + "findEventTarget", + "getBoundingClientRect", + "fillMouseEventData", + "registerMouseEventCallback", + "registerWheelEventCallback", + "registerUiEventCallback", + "registerFocusEventCallback", + "fillDeviceOrientationEventData", + "registerDeviceOrientationEventCallback", + "fillDeviceMotionEventData", + "registerDeviceMotionEventCallback", + "screenOrientation", + "fillOrientationChangeEventData", + "registerOrientationChangeEventCallback", + "fillFullscreenChangeEventData", + "registerFullscreenChangeEventCallback", + "JSEvents_requestFullscreen", + "JSEvents_resizeCanvasForFullscreen", + "registerRestoreOldStyle", + "hideEverythingExceptGivenElement", + "restoreHiddenElements", + "setLetterbox", + "softFullscreenResizeWebGLRenderTarget", + "doRequestFullscreen", + "fillPointerlockChangeEventData", + "registerPointerlockChangeEventCallback", + "registerPointerlockErrorEventCallback", + "requestPointerLock", + "fillVisibilityChangeEventData", + "registerVisibilityChangeEventCallback", + "registerTouchEventCallback", + "fillGamepadEventData", + "registerGamepadEventCallback", + "registerBeforeUnloadEventCallback", + "fillBatteryEventData", + "battery", + "registerBatteryEventCallback", + "setCanvasElementSize", + "getCanvasElementSize", + "jsStackTrace", + "getCallstack", + "convertPCtoSourceLocation", + "getEnvStrings", + "checkWasiClock", + "wasiRightsToMuslOFlags", + "wasiOFlagsToMuslOFlags", + "setImmediateWrapped", + "safeRequestAnimationFrame", + "clearImmediateWrapped", + "registerPostMainLoop", + "registerPreMainLoop", + "getPromise", + "makePromise", + "idsToPromises", + "makePromiseCallback", + "ExceptionInfo", + "findMatchingCatch", + "Browser_asyncPrepareDataCounter", + "isLeapYear", + "ydayFromDate", + "arraySum", + "addDays", + "getSocketFromFD", + "getSocketAddress", + "FS_unlink", + "FS_mkdirTree", + "_setNetworkCallback", + "heapObjectForWebGLType", + "toTypedArrayIndex", + "webgl_enable_ANGLE_instanced_arrays", + "webgl_enable_OES_vertex_array_object", + "webgl_enable_WEBGL_draw_buffers", + "webgl_enable_WEBGL_multi_draw", + "webgl_enable_EXT_polygon_offset_clamp", + "webgl_enable_EXT_clip_control", + "webgl_enable_WEBGL_polygon_mode", + "emscriptenWebGLGet", + "computeUnpackAlignedImageSize", + "colorChannelsInGlTextureFormat", + "emscriptenWebGLGetTexPixelData", + "emscriptenWebGLGetUniform", + "webglGetUniformLocation", + "webglPrepareUniformLocationsBeforeFirstUse", + "webglGetLeftBracePos", + "emscriptenWebGLGetVertexAttrib", + "__glGetActiveAttribOrUniform", + "writeGLArray", + "registerWebGlEventCallback", + "ALLOC_NORMAL", + "ALLOC_STACK", + "allocate", + "writeStringToMemory", + "writeAsciiToMemory", + "setErrNo", + "demangle", + "stackTrace", + ]; + missingLibrarySymbols.forEach(missingLibrarySymbol); + var unexportedSymbols = [ + "addRunDependency", + "removeRunDependency", + "out", + "err", + "abort", + "wasmMemory", + "wasmExports", + "writeStackCookie", + "checkStackCookie", + "INT53_MAX", + "INT53_MIN", + "bigintToI53Checked", + "stackSave", + "stackRestore", + "stackAlloc", + "ptrToString", + "zeroMemory", + "exitJS", + "getHeapMax", + "growMemory", + "ENV", + "ERRNO_CODES", + "strError", + "DNS", + "Protocols", + "Sockets", + "timers", + "warnOnce", + "readEmAsmArgsArray", + "jstoi_s", + "handleException", + "keepRuntimeAlive", + "runtimeKeepalivePush", + "runtimeKeepalivePop", + "callUserCallback", + "maybeExit", + "asyncLoad", + "alignMemory", + "mmapAlloc", + "wasmTable", + "noExitRuntime", + "addOnPreRun", + "addOnPostRun", + "getCFunc", + "sigToWasmTypes", + "freeTableIndexes", + "functionsInTableMap", + "setValue", + "getValue", + "PATH", + "PATH_FS", + "UTF8Decoder", + "UTF8ArrayToString", + "UTF8ToString", + "stringToUTF8Array", + "intArrayFromString", + "UTF16Decoder", + "stringToUTF8OnStack", + "writeArrayToMemory", + "JSEvents", + "specialHTMLTargets", + "findCanvasEventTarget", + "currentFullscreenStrategy", + "restoreOldWindowedStyle", + "UNWIND_CACHE", + "ExitStatus", + "doReadv", + "doWritev", + "initRandomFill", + "randomFill", + "safeSetTimeout", + "emSetImmediate", + "emClearImmediate_deps", + "emClearImmediate", + "promiseMap", + "uncaughtExceptionCount", + "exceptionLast", + "exceptionCaught", + "Browser", + "getPreloadedImageData__data", + "wget", + "MONTH_DAYS_REGULAR", + "MONTH_DAYS_LEAP", + "MONTH_DAYS_REGULAR_CUMULATIVE", + "MONTH_DAYS_LEAP_CUMULATIVE", + "SYSCALLS", + "preloadPlugins", + "FS_createPreloadedFile", + "FS_modeStringToFlags", + "FS_getMode", + "FS_stdin_getChar_buffer", + "FS_stdin_getChar", + "FS_createPath", + "FS_createDevice", + "FS_readFile", + "FS_createDataFile", + "FS_createLazyFile", + "MEMFS", + "TTY", + "PIPEFS", + "SOCKFS", + "tempFixedLengthArray", + "miniTempWebGLFloatBuffers", + "miniTempWebGLIntBuffers", + "GL", + "AL", + "GLUT", + "EGL", + "GLEW", + "IDBStore", + "runAndAbortIfError", + "Asyncify", + "Fibers", + "SDL", + "SDL_gfx", + "allocateUTF8", + "allocateUTF8OnStack", + "print", + "printErr", + ]; + unexportedSymbols.forEach(unexportedRuntimeSymbol); + var calledRun; + function callMain(args = []) { + assert( + runDependencies == 0, + 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])', + ); + assert( + typeof onPreRuns === "undefined" || onPreRuns.length == 0, + "cannot call main when preRun functions remain to be called", + ); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach((arg) => { + HEAPU64[argv_ptr / 8] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[argv_ptr / 8] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + exitJS(ret, true); + return ret; + } catch (e) { + return handleException(e); + } + } + function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); + } + function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + function doRun() { + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("./output.elf", args[0]); + args.shift(); + preMain(); + readyPromiseResolve(Module); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"]; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + } + function checkUnflushedContent() { + var oldOut = out; + var oldErr = err; + var has = false; + out = err = (x) => { + has = true; + }; + try { + _fflush(0); + ["stdout", "stderr"].forEach((name) => { + var info = FS.analyzePath("/dev/" + name); + if (!info) return; + var stream = info.object; + var rdev = stream.rdev; + var tty = TTY.ttys[rdev]; + if (tty?.output?.length) { + has = true; + } + }); + } catch (e) {} + out = oldOut; + err = oldErr; + if (has) { + warnOnce( + "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.", + ); + } + } + if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") + Module["preInit"] = [Module["preInit"]]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } + } + // run(); + moduleRtn = readyPromise; + for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort( + `Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`, + ); + }, + }); + } + } + + readyPromiseResolve(Module); + return moduleRtn; + }; +})(); +(() => { + // Create a small, never-async wrapper around Module which + // checks for callers incorrectly using it with `new`. + var real_Module = Module; + Module = function (arg) { + if (new.target) + throw new Error("Module() should not be called with `new Module()`"); + return real_Module(arg); + }; +})(); +export default Module; diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.wasm b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.wasm new file mode 100755 index 000000000..ae74c3de3 Binary files /dev/null and b/src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.wasm differ diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.js b/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.js new file mode 100644 index 000000000..1ba5bacf6 --- /dev/null +++ b/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.js @@ -0,0 +1,5747 @@ +import { setInstructions, clear_instructions, instructions } from "@/core/assembler/assembler.mjs"; +import { readRegister, writeRegister, notifyRegisterUpdate } from "@/core/register/registerOperations.mjs"; +import { crex_findReg_bytag, crex_findReg } from "@/core/register/registerLookup.mjs" +import { status, PC_REG_INDEX, REGISTERS, getPC, main_memory, config_cache, L1_cache_memory, L1_I_cache_memory, L1_D_cache_memory, L2_D_cache_memory, L2_I_cache_memory, L2_cache_memory, updateCacheMem } from "@/core/core.mjs"; +import { display_print } from "../../IO.mjs"; +import { SYSCALL } from "@/core/capi/syscall.mts"; +import { coreEvents } from "@/core/events.mts"; +import { show_notification } from "@/core/utils/notifications.mts"; +import { architecture } from "../../../core.mjs"; +import { clearAllRegisterGlows } from "@/core/register/registerGlowState.mjs"; + +export var userMode64 = false; + +var Module = (() => { + var _scriptName = import.meta.url; + var insn_number; + + return async function (moduleArg = {}) { + document.app.$data.is_breakpoint = (instructions.length !== 0) ? instructions[0].Break : false; + var pc_sail = crex_findReg_bytag("program_counter"); + var pc_min = architecture.memory_layout.text.start; + var pc_max = architecture.memory_layout.text.end; + var hiden_executed, hiden_next_execute; + + var registers_before_function = [ + { name: "t0", can_operate : false}, + { name: "t1", can_operate : false}, + { name: "t2", can_operate : false}, + { name: "t3", can_operate : false}, + { name: "t4", can_operate : false}, + { name: "t5", can_operate : false}, + { name: "t6", can_operate : false}, + { name: "s0", can_operate : false}, + { name: "s1", can_operate : false}, + { name: "s2", can_operate : false}, + { name: "s3", can_operate : false}, + { name: "s4", can_operate : false}, + { name: "s5", can_operate : false}, + { name: "s6", can_operate : false}, + { name: "s7", can_operate : false}, + { name: "s8", can_operate : false}, + { name: "s9", can_operate : false}, + { name: "s10", can_operate : false}, + { name: "s11", can_operate : false} + ] + var callstack_convention = []; + var inside_function = false; + Module = Module || {}; + var moduleRtn; + + var Module = moduleArg; + var readyPromiseResolve, readyPromiseReject; + var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + var ENVIRONMENT_IS_WEB = true; + var ENVIRONMENT_IS_WORKER = false; + var ENVIRONMENT_IS_NODE = false; + var ENVIRONMENT_IS_SHELL = false; + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = "./this.program"; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var scriptDirectory = ""; + function locateFile(path) { + if (Module["locateFile"]) { + return Module["locateFile"](path, scriptDirectory); + } + return scriptDirectory + path; + } + var readAsync, readBinary; + if (ENVIRONMENT_IS_SHELL) { + if ( + (typeof process == "object" && typeof require === "function") || + typeof window == "object" || + typeof WorkerGlobalScope != "undefined" + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != "undefined" && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (_scriptName) { + scriptDirectory = _scriptName; + } + if (scriptDirectory.startsWith("blob:")) { + scriptDirectory = ""; + } else { + scriptDirectory = scriptDirectory.slice( + 0, + scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, + ); + } + if ( + !(typeof window == "object" || typeof WorkerGlobalScope != "undefined") + ) + throw new Error( + "not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)", + ); + { + readAsync = async (url) => { + assert(!isFileURI(url), "readAsync does not work with file:// URLs"); + var response = await fetch(url, { credentials: "same-origin" }); + if (response.ok) { + return response.arrayBuffer(); + } + throw new Error(response.status + " : " + response.url); + }; + } + } else { + throw new Error("environment detection error"); + } + + + // const instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) (\w+) ([^,]+), ([^,]+)(?:, (.+))?/; + var instructionExp = /\[(\d+)\] \[(\w+)\]: 0x([0-9A-Fa-f]+) \(0x([0-9A-Fa-f]+)\) ([\w.]+)(?: ([^,]+), ([^,]+)(?:, (.+))?)?/; + var registerExp = /([xf]\d+) (<-) 0x([0-9A-Fa-f]+)/; // /(x\d+) (<-|->) 0x([0-9A-Fa-f]+)/; + var vectorExp = /(v\d+) (<-) 0x([0-9A-Fa-f]+)/; + var memoryExp = /mem\[0x([0-9A-Fa-f]+)\]\s*(<-|->)\s*0x([0-9A-Fa-f]+)/; + var CSRTypeExp = /(CSR\S*)\s+(\S+)\s+(\S+)\s+(0x)([\dA-Fa-f]{1,16})/; + var CSRExp = /^(CSR)\s+(\w+)\s+(<-|->)\s+0x([0-9a-fA-F]+)(?:\s+(.*))?$/; + var jumpExp = /Next_PC:\s*0x([0-9a-fA-F]+)/; + // var cacheExp = /^\[(\d+)\]\s+(L1_I|L1_D|L1|L2|L2_I|L2_D):\s*\((0x[0-9A-Fa-f]+)\)\s$/; + var cacheExp = /^\[(\d+)\]\s+(L1_I|L1_D|L1|L2|L2_I|L2_D):\s*\((0x[0-9A-Fa-f]+)\)\s*$/; + var configCacheExp = /^Configuration:\s*([A-Za-z_][A-Za-z0-9_]*)\s*<-\s*(\S+)\s*$/; + // var displayExp = /^[A-Za-z\s]+:\s*(.*)$/; + // var displayExp = /^([\w\s]+):\s*(.*)$/; + var displayExp = /^ECALL\s+(SIGNED|UNSIGNED|STRING|CHAR|FLOAT|DOUBLE):\s*(.+)$/; + var instoper = ""; + var syscall_print_code = -1; + var prev_add_to_jump; + // var type_to_write; + + + + function updateCacheStat(index, access, data="") { + switch(access) { + case "Cache L1 hit inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss inst": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + break; + case "Cache L1 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L1_I hit": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 3; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 1; + break; + case "Cache L1_I miss": + if (instructions[index].L1_I == 0) + instructions[index].L1_I = 4; + else if (instructions[index].L1_I == 3) + instructions[index].L1_I = 1; + else if (instructions[index].L1_I == 4) + instructions[index].L1_I = 4; + break; + case "Cache L1_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 3; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 3; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 1; + break; + case "Cache L1_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L1_D == 0) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 4) + main_memory[parseInt(data, 16)].L1_D = 4; + else if (main_memory[memindex].L1_D == 3) + main_memory[parseInt(data, 16)].L1_D = 1; + } + if (instructions[index].L1_D == 0) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 4) + instructions[index].L1_D = 4; + else if (instructions[index].L1_D == 3) + instructions[index].L1_D = 1; + break; + case "Cache L2 hit inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2 miss inst": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2_I hit": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 3; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 1; + break; + case "Cache L2_I miss": + if (instructions[index].L2_I == 0) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 4) + instructions[index].L2_I = 4; + else if (instructions[index].L2_I == 3) + instructions[index].L2_I = 1; + break; + case "Cache L2 hit data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2 miss data": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + case "Cache L2_D hit": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 3; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 3; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 1; + break; + case "Cache L2_D miss": + if(data !== "") { + let lastv = parseInt(data[data.length - 1], 16); + if (lastv < 4) data = data.slice(0, -1) + "0"; + else if (lastv < 8) data = data.slice(0, -1) + "4"; + else if (lastv < 12) data = data.slice(0, -1) + "8"; + else data = data.slice(0, -1) + "C"; + let memindex = parseInt(data, 16); + if (main_memory[memindex].L2_D == 0) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 4) + main_memory[parseInt(data, 16)].L2_D = 4; + else if (main_memory[memindex].L2_D == 3) + main_memory[parseInt(data, 16)].L2_D = 1; + } + if (instructions[index].L2_D == 0) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 4) + instructions[index].L2_D = 4; + else if (instructions[index].L2_D == 3) + instructions[index].L2_D = 1; + break; + } + + } + + + async function check_call_convention_temp_regs(instMatch) { + if(((instMatch[7] != undefined && (instMatch[7].includes("t") || (instMatch[7].includes("s") && !instMatch[7].includes("sp")) ) ) || (instMatch[8] != undefined && (instMatch[8].includes("t") || (instMatch[8].includes("s") && !instMatch[8].includes("sp")) ))) && instMatch[6] !== undefined && inside_function) { + if((instMatch[5] != "li" && instMatch[5] != "lui" && instMatch[5] != "la") ){ + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + (callstack_convention[callstack_convention.length - 1][i].name === instMatch[7] || callstack_convention[callstack_convention.length - 1][i].name === instMatch[8]) && + (callstack_convention[callstack_convention.length - 1][i].can_operate === false) ? show_notification("Possible failure in the parameter passing convention", "danger") : 0 ; + } + + // callstack_convention[callstack_convention.length - 1].name + + } + } + if (instMatch[6] !== undefined && (instMatch[6].includes("t") || (instMatch[6].includes("s") && !instMatch[6].includes("sp"))) && inside_function) { + for (var i = 0; i < callstack_convention[callstack_convention.length - 1].length; i++ ){ + callstack_convention[callstack_convention.length - 1][i].can_operate = (callstack_convention[callstack_convention.length - 1][i].name === instMatch[6]) ? true : callstack_convention[callstack_convention.length - 1][i].can_operate; + } + } + } + + + + // var to_measure = ""; + var start_m, start_m; + var cache_inst; + + function writeMemory(value, addr) { + // Primero pasar el valor al formato hexadecimal por pares + if (value.startsWith("0x")) + value = value.slice(2); + if (value.length % 2 !== 0) + value = "0" + value; + + // const bytes = new Uint8Array(value.length / 2); + for (let i = 0; i < value.length / 2; i ++) { + main_memory.write((addr + BigInt(i)), Number("0x" + value.substring(i*2, i * 2 + 2))); + } + + // if (memoMatch[2] === '<-'){ + // switch(op){ + // case 'sh': // Para almacenar un half + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'float'); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // default: + // break; + // } + // } + } + + // var no_print_more = false; + Module['print'] = function (message) { + // console.log(message); + if (message === "Divergence execution detected: Aborted.") + show_notification(message, "danger"); + if (message === "err call_convenction") + show_notification("Possible failure in the parameter passing convention", "warning"); + + if (message === "May your execution has an infinity loop."){ + document.app.$data.execution_mode_run = 1; + show_notification("May your execution has an infinity loop", "danger"); + instructions[hiden_executed]._rowVariant = "info"; + instructions[hiden_next_execute]._rowVariant = "success"; + } + + var next_add_to_jump; + let instMatch = message.match(instructionExp); + let regiMatch = message.match(registerExp); + let memoMatch = message.match(memoryExp); + let printMatch = message.match(displayExp); + let CSRMatch = message.match(CSRTypeExp); + let CSREMatch = message.match(CSRExp); + let vectorMatch = message.match(vectorExp); + let jumpMatch = message.match(jumpExp); + let cacheMatch = message.match(cacheExp); + let configCacheMatch = message.match(configCacheExp); + + if (message.startsWith("Cache") || message.startsWith("Next_PC:")){ + if (message.includes("Cache prefetch")) { + let newpc = message.substring(15,message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address === ("0x" + BigInt(newpc).toString(16))); + } else if (message.includes("Next_PC:")) { + let newpc = message.substring(9, message.length).toLowerCase(); + cache_inst = instructions.findIndex(insn => insn.Address == ("0x" + BigInt(newpc).toString(16))); + } + if (cache_inst != -1 && document.app.$data.execution_mode_run === 1) { + let hexmatch = message.match(/0x[0-9A-Fa-f]+$/); + if (hexmatch && !message.startsWith("Cache prefetch")) { + let hexa = hexmatch[0]; + message = message.replace(/on:\s*0x[0-9A-Fa-f]+$/, "").trim(); + updateCacheStat(cache_inst, message, hexa); + }else { + updateCacheStat(cache_inst, message); + } + + } + } + + + if (jumpMatch){ + jumpMatch[1] = "0x" + jumpMatch[1].replace(/^0+/, ''); + if (jumpMatch[1] === "0x") jumpMatch[1] = "0x0"; + // console.log(jumpMatch); + const current_ins = instructions.findIndex(insn => insn.Address === (jumpMatch[1].toLowerCase())); + + for (var i = 0; i < instructions.length; i++){ + if(instructions[i]._rowVariant === "success" && document.app.$data.execution_mode_run !== 0) // ajustar lo del user mode + instructions[i]._rowVariant = ""; + } + if (current_ins !== -1) instructions[current_ins]._rowVariant = "success"; + } + + if (configCacheMatch) { + // console.log(configCacheMatch); + switch(configCacheMatch[1]) { + case "L1_I_SIZE": + config_cache.push({configuration: "Size L1_I", value: configCacheMatch[2] + " lines"}); + break; + case "L1_D_SIZE": + config_cache.push({configuration: "Size L1_D", value: configCacheMatch[2] + " lines"}); + break; + case "L1_SIZE": + config_cache.push({configuration: "Size L1", value: configCacheMatch[2] + " lines"}); + break; + case "L2_I_SIZE": + config_cache.push({configuration: "Size L2_I", value: configCacheMatch[2] + " lines"}); + break; + case "L2_D_SIZE": + config_cache.push({configuration: "Size L2_D", value: configCacheMatch[2] + " lines"}); + break; + case "L2_SIZE": + config_cache.push({configuration: "Size L2", value: configCacheMatch[2] + " lines"}); + break; + case "Rep_policy": + config_cache.push({configuration: "Replacement policy", value: configCacheMatch[2]}); + break; + case "L1_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L1_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L1 block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_I_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_I block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_D_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2_D block", value: configCacheMatch[2] + " bits"}); + break; + case "L2_BLOCK_SIZE": + config_cache.push({configuration: "Size Cache L2 block", value: configCacheMatch[2] + " bits"}); + break; + } + } + + if (cacheMatch) { + console.log(cacheMatch); + // updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], parseInt(cacheMatch[4], 10)); + switch(cacheMatch[2]) { + case "L1_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_I_size_block); + break; + case "L1_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_D_size_block); + + break; + case "L1": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L1_size_block); + + break; + case "L2_I": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_I_size_block); + + break; + case "L2_D": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_D_size_block); + + break; + case "L2": + updateCacheMem(parseInt(cacheMatch[1],10), cacheMatch[2], cacheMatch[3], document.app.$data.L2_size_block); + + break; + + } + } + + if(CSREMatch){ + console.log(CSREMatch); + if (CSREMatch[2] !== "vtype" && CSREMatch[2] !== "vl"){ + let regtowrite = crex_findReg(CSREMatch[2]); + if(regtowrite.match !== 0) + writeRegister(CSREMatch[4], regtowrite.indexComp, regtowrite.indexElem); + } + } + if (CSRMatch){ + if (CSRMatch[2] === "vtype"){ + var size_elem = parseInt(CSRMatch[5], 16).toString(2).padStart(32, '0'); + size_elem = size_elem.slice(26, 29); + console.log("Tamaño: ", size_elem); + if(size_elem === "000"){ + document.app.$data.v_length = 8; + // length_vext = 8; + // architecture.components[3].total_elements = 64; + } else if (size_elem === "001") { + document.app.$data.v_length = 16; + // length_vext = 16; + // architecture.components[3].total_elements = 32; + } else if (size_elem === "010"){ + document.app.$data.v_length = 32; + // length_vext = 32; + // architecture.components[3].total_elements = 16; + }else { + document.app.$data.v_length = 64; + // length_vext = 64; + // architecture.components[3].total_elements = 8; + } + // architecture.components[3].length_elem = length_vext; + } + else if (CSRMatch[2] === "vl"){ + // architecture.components[3].elems_op = parseInt(CSRMatch[5], 16); + } + } + if (vectorMatch){ + let regtowrite = crex_findReg(vectorMatch[1]); + writeRegister(vectorMatch[3], regtowrite.indexComp, regtowrite.indexElem); + } + if (instMatch && /*(instMatch[2] === 'U' ||*/ ((parseInt(instMatch[3], 16) >= pc_min) && parseInt(instMatch[3], 16) < parseInt("0x20000", 16) )){ + clearAllRegisterGlows(); + coreEvents.emit("step-about-to-execute"); + userMode64 = true; + if (inside_function) + check_call_convention_temp_regs(instMatch); + + + //Actualizamos el pc + writeRegister(BigInt(parseInt(instMatch[3], 16)), pc_sail.indexComp, pc_sail.indexElem); + for (var i = 0; i < instructions.length; i++) { + if (instructions[i]._rowVariant === "info") + instructions[i]._rowVariant = ""; + } + instoper = ""; + // console.log("PC actual:",pc_sail); + // if ((instMatch[5].includes("w") || instMatch[5].includes(".s") || instMatch[5].includes(".w")) && !instMatch.includes(".d")) + // type_toWrite = 32; + // else if (instMatch[5].includes("d")) + // type_toWrite = 64; + // else + // type_toWrite = 0; + console.log("Instruccion: ", instMatch); + const current_ins = instructions.findIndex(insn => ( '0x' + (insn.Address.slice(2)).padStart(16, '0')) === ("0x"+instMatch[3].toLowerCase())); + if (current_ins !== -1) { + if(prev_add_to_jump !== undefined){ + instructions[prev_add_to_jump]._rowVariant = ""; + prev_add_to_jump = undefined; + } + + if (instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + var match = next_add[1].match(/(-?\d+)\((\w+)\)/); + + if (match === undefined || match === null) { + match = "zero"; + var aux_reg = crex_findReg(match); + var aux_val = readRegister(aux_reg.indexComp, aux_reg.indexElem); + + next_add_to_jump = aux_val.toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + prev_add_to_jump = current_ins; + }else { + var aux_reg = crex_findReg(match[2]); + var aux_val = readRegister(aux_reg.indexComp, aux_reg.indexElem); + + next_add_to_jump = (aux_val + BigInt(parseInt(match[1], 10))).toString(16); + next_add_to_jump = instructions.findIndex(insn => insn.Address === ("0x"+next_add_to_jump.toLowerCase())); + prev_add_to_jump = current_ins; + } + + // creator_callstack_enter(instructions[next_add_to_jump].Label); + // track_stack_enter(instructions[next_add_to_jump].Label); + // callstack_convention.push(structuredClone(registers_before_function)); + // inside_function = true; + + console.log("Siguiente direccion del jalr: ", next_add); + } + if (instructions[current_ins].loaded.includes("jal") && !instructions[current_ins].loaded.includes("jalr")){ + var next_add = instructions[current_ins].loaded.split("\t"); + console.log("Siguiente direccion del jal: ", next_add); + + } + if (instructions[current_ins].loaded.includes("ret") && !instructions[current_ins].loaded.includes("mret")){ + // Mirar el ra + var aux_reg = crex_findReg("ra"); + next_add_to_jump = readRegister(aux_reg.indexComp, aux_reg.indexElem).toString(16); + next_add_to_jump = instructions.findIndex(insn => ( '0x' + (insn.Address.slice(2))) === ("0x"+next_add_to_jump.toLowerCase())); + if (next_add_to_jump !== -1) { + prev_add_to_jump = current_ins; + // track_stack_leave(); + // creator_callstack_leave(); + // callstack_convention.pop(); + // inside_function = (callstack_convention.length > 0); + } else { + next_add_to_jump = undefined; + } + } + // Primero caso de paso a paso + if (document.app.$data.execution_mode_run === 1){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined){ + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + } + // Para el caso de run without stop y la siguiente instruccion es un breakpoint + else if (document.app.$data.execution_mode_run === 0){ + // se almacena el estado de la instruccion en caso de que haya una parada por infinity loop + hiden_executed = current_ins; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + hiden_next_execute = (next_add_to_jump !== undefined) ? next_add_to_jump : current_ins + 1; + } else + hiden_next_execute = current_ins + 1; + + + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + document.app.$data.is_breakpoint = instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)].Break; + } + if(document.app.$data.is_breakpoint){ + instructions[current_ins]._rowVariant = 'info'; + if (current_ins < instructions.length - 1 || next_add_to_jump !== undefined) { + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + } + coreEvents.emit("pause-execution"); + }else { + instructions[current_ins]._rowVariant = ''; + } + if (current_ins > 0 || prev_add_to_jump !== undefined) + instructions[(prev_add_to_jump !== undefined && prev_add_to_jump !== current_ins) ? prev_add_to_jump : ((current_ins > 0) ? current_ins -1 : 0)]._rowVariant = ''; + + } + else + instructions[current_ins]._rowVariant = ''; + + if (instMatch[5] === "ecall"){ + let argument_register = crex_findReg("a7"); // obtenemos el registro para ver que llamada al sistema es + let syscall_code = readRegister(argument_register.indexComp, argument_register.indexElem); // Lectura del registro para obtener el valor + + switch(syscall_code){ + case 5n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para enteros + // capi_read_int('a0'); + SYSCALL.read('a0', "int"); + break; + case 6n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para floats + // capi_read_float('fa0'); + SYSCALL.read("fa0", "float"); + break; + case 7n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para double + // capi_read_double('fa0'); + SYSCALL.read("fa0", "double"); + break; + case 8n: + if(document.app.$data.execution_mode_run === 0){ + insn_number = current_ins; + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // Manejo para strings + // capi_read_string('a0','a1'); + SYSCALL.read("a0", "string", "a1"); + break; + + case 12n: + if(document.app.$data.execution_mode_run === 0){ + instructions[current_ins]._rowVariant = "info"; + if (current_ins < instructions.length -1 || next_add_to_jump !== undefined) + instructions[(next_add_to_jump !== undefined) ? next_add_to_jump : (current_ins + 1)]._rowVariant = 'success'; + // instructions[current_ins +1]._rowVariant = "success"; + } + document.app.$data.last_execution_mode_run = document.app.$data.execution_mode_run; + document.app.$data.execution_mode_run = 2; + // last_execution_mode_run = document.app.$data.execution_mode_run; + // document.app.$data.execution_mode_run = 2; + // Manejo para char + // capi_read_char('a0'); + SYSCALL.read("a0", "char"); + break; + default: + // console.log("No hago nada."); + syscall_print_code = syscall_code; + break; + } + + next_add_to_jump = undefined; + } + + + + instoper = instMatch[5]; + coreEvents.emit("sail-instruction-update"); + + } + + } else if (instMatch && (parseInt(instMatch[3], 16) <= pc_min || parseInt(instMatch[3], 16) >= pc_max )) + userMode64 = false; + + + if (regiMatch /*&& userMode === true*/) { + // En caso de ser escritura '<-' pintamos el valor en el registro que corresponde + if (regiMatch[2] === '<-'){ + let regtowrite = crex_findReg(regiMatch[1]); + if (regtowrite.indexComp === 2){ + if (regiMatch[3].startsWith("0x")) regiMatch[3] = regiMatch[3].slice(2).replace(/^0+/, ''); + else regiMatch[3] = regiMatch[3].replace(/^0+/, ''); + if (regiMatch[3].length <= 8){ + regiMatch[3] = regiMatch[3].padStart(8, "0"); + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem, "SFP-Reg"); + } + else{ + // if (type_toWrite === 32){ + // regiMatch[3] = regiMatch[3].slice(8,16); + // writeRegister(hex2float(regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem, "SFP-Reg"); + // } + // else if (type_toWrite === 64) + // writeRegister(hex2double(regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem, "DFP-Reg"); + // else + writeRegister(BigInt("0x" + regiMatch[3]), regtowrite.indexComp, regtowrite.indexElem, "DFP-Reg"); + // type_to_write = 0; + } + } + else + writeRegister(BigInt(parseInt(regiMatch[3], 16)), regtowrite.indexComp, regtowrite.indexElem); + } + + } + + if (memoMatch /*&& userMode === true*/) { + // En caso de ser escritura '<-' pintamos el valor en la posicion de memoria + if (memoMatch[2] === '<-'){ + + writeMemory(memoMatch[3], BigInt(parseInt(memoMatch[1], 16))); + // console.log("Operador: ", instoper); + // switch(instoper){ + // case 'sh': // Para almacenar un half + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + + // break; + // case 'sb': // Para almacenar un byte + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'sd': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'dword'); + // break; + // case 'sw': // Para almacenar un int/word + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'fsw': // Para almacenar un float + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'float'); + // break; + // case 'fsd': // Para almacenar un double + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // case 'vse8.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'byte'); + // break; + // case 'vse16.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'half'); + // break; + // case 'vse32.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'word'); + // break; + // case 'vse64.v': + // writeMemory(memoMatch[3], parseInt(memoMatch[1], 16), 'double'); + // break; + // default: + // break; + // } + + // instoper = ""; + } + + } + + + + if(printMatch && syscall_print_code !== -1){ + + let value_2_print = printMatch[2].trim(); + console.log("Estoy dentro de ecall a imprimir"); + // console.log(message); + console.log("Valor a imprimir: ", value_2_print); + switch(syscall_print_code){ + + case 1n: // Print int + // SYSCALL.print(Number(parseInt(value_2_print)), "int32"); + + display_print(value_2_print); + // display_print(full_print(parseInt(value_2_print), null, false)); + syscall_print_code = -1; + break; + case 2n: // Print float + // SYSCALL.print(Number(parseFloat(value_2_print)), "float"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 3n: // Print double + // SYSCALL.print(Number(parseFloat(value_2_print)), "double"); + display_print(value_2_print); + // display_print(full_print(parseFloat(value_2_print), 0, true)); + syscall_print_code = -1; + break; + + case 4n: // Print String + display_print(value_2_print); + syscall_print_code = -1; + break; + + case 11n: // Print char + // SYSCALL.print(BigInt(value_2_print.charCodeAt(0)), char); + display_print(value_2_print); + syscall_print_code = -1; + break; + + default: // Rest of syscall codes not able to print + syscall_print_code = -1; + break; + + } + + } + + + + // if (!no_print_more) + console.log(message); + + + // clear_instructions(); + // setInstructions(instructions); + + } + + Module['printErr'] = function (message) { + // if (message.includes("Execution:") || message.includes("Instructions:") || message.includes("Perf:")) + // show_notification(message, "success"); + // else + console.warn(message); + } + + + var out = (document.app.$data.testing === true ) ? console.log.bind(console) : Module["print"]; + var err = Module["printErr"] /*|| console.error.bind(console)*/; + + + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + checkIncomingModuleAPI(); + if (Module["arguments"]) arguments_ = Module["arguments"]; + legacyModuleProp("arguments", "arguments_"); + if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; + legacyModuleProp("thisProgram", "thisProgram"); + assert( + typeof Module["memoryInitializerPrefixURL"] == "undefined", + "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["pthreadMainPrefixURL"] == "undefined", + "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["cdInitializerPrefixURL"] == "undefined", + "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["filePackagePrefixURL"] == "undefined", + "Module.filePackagePrefixURL option was removed, use Module.locateFile instead", + ); + assert( + typeof Module["read"] == "undefined", + "Module.read option was removed", + ); + assert( + typeof Module["readAsync"] == "undefined", + "Module.readAsync option was removed (modify readAsync in JS)", + ); + assert( + typeof Module["readBinary"] == "undefined", + "Module.readBinary option was removed (modify readBinary in JS)", + ); + assert( + typeof Module["setWindowTitle"] == "undefined", + "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)", + ); + assert( + typeof Module["TOTAL_MEMORY"] == "undefined", + "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY", + ); + legacyModuleProp("asm", "wasmExports"); + legacyModuleProp("readAsync", "readAsync"); + legacyModuleProp("readBinary", "readBinary"); + legacyModuleProp("setWindowTitle", "setWindowTitle"); + assert( + !ENVIRONMENT_IS_WORKER, + "worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_NODE, + "node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.", + ); + assert( + !ENVIRONMENT_IS_SHELL, + "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.", + ); + var wasmBinary = Module["wasmBinary"]; + legacyModuleProp("wasmBinary", "wasmBinary"); + if (typeof WebAssembly != "object") { + err("no native wasm support detected"); + } + var wasmMemory; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort("Assertion failed" + (text ? ": " + text : "")); + } + } + var HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + var runtimeInitialized = false; + var isFileURI = (filename) => filename.startsWith("file://"); + function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + if (max == 0) { + max += 4; + } + HEAPU32[max / 4] = 34821223; + HEAPU32[(max + 4) / 4] = 2310721022; + HEAPU32[0 / 4] = 1668509029; + } + function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + if (max == 0) { + max += 4; + } + var cookie1 = HEAPU32[max / 4]; + var cookie2 = HEAPU32[(max + 4) / 4]; + if (cookie1 != 34821223 || cookie2 != 2310721022) { + abort( + `Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`, + ); + } + if (HEAPU32[0 / 4] != 1668509029) { + abort( + "Runtime error: The application has corrupted its heap memory area (address zero)!", + ); + } + } + (() => { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 25459; + if (h8[0] !== 115 || h8[1] !== 99) + throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; + })(); + if (Module["ENVIRONMENT"]) { + throw new Error( + "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)", + ); + } + function legacyModuleProp(prop, newName, incoming = true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incoming + ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" + : ""; + abort( + `\`Module.${prop}\` has been replaced by \`${newName}\`` + extra, + ); + }, + }); + } + } + function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort( + `\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`, + ); + } + } + function isExportedByForceFilesystem(name) { + return ( + name === "FS_createPath" || + name === "FS_createDataFile" || + name === "FS_createPreloadedFile" || + name === "FS_unlink" || + name === "addRunDependency" || + name === "FS_createLazyFile" || + name === "FS_createDevice" || + name === "removeRunDependency" + ); + } + function hookGlobalSymbolAccess(sym, func) { + if ( + typeof globalThis != "undefined" && + !Object.getOwnPropertyDescriptor(globalThis, sym) + ) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + func(); + return undefined; + }, + }); + } + } + function missingGlobal(sym, msg) { + hookGlobalSymbolAccess(sym, () => { + warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`); + }); + } + missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"); + missingGlobal("asm", "Please use wasmExports instead"); + function missingLibrarySymbol(sym) { + hookGlobalSymbolAccess(sym, () => { + var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`; + var librarySymbol = sym; + if (!librarySymbol.startsWith("_")) { + librarySymbol = "$" + sym; + } + msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`; + if (isExportedByForceFilesystem(sym)) { + msg += + ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + warnOnce(msg); + }); + unexportedRuntimeSymbol(sym); + } + function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; + if (isExportedByForceFilesystem(sym)) { + msg += + ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; + } + abort(msg); + }, + }); + } + } + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module["HEAP8"] = HEAP8 = new Int8Array(b); + Module["HEAP16"] = HEAP16 = new Int16Array(b); + Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); + Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); + Module["HEAP32"] = HEAP32 = new Int32Array(b); + Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); + Module["HEAPF32"] = HEAPF32 = new Float32Array(b); + Module["HEAPF64"] = HEAPF64 = new Float64Array(b); + Module["HEAP64"] = HEAP64 = new BigInt64Array(b); + Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b); + } + assert( + !Module["STACK_SIZE"], + "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time", + ); + assert( + typeof Int32Array != "undefined" && + typeof Float64Array !== "undefined" && + Int32Array.prototype.subarray != undefined && + Int32Array.prototype.set != undefined, + "JS engine does not provide full typed array support", + ); + assert( + !Module["wasmMemory"], + "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally", + ); + assert( + !Module["INITIAL_MEMORY"], + "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically", + ); + function preRun() { + if (Module["preRun"]) { + if (typeof Module["preRun"] == "function") + Module["preRun"] = [Module["preRun"]]; + while (Module["preRun"].length) { + addOnPreRun(Module["preRun"].shift()); + } + } + callRuntimeCallbacks(onPreRuns); + } + function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + checkStackCookie(); + if (!Module["noFSInit"] && !FS.initialized) FS.init(); + TTY.init(); + wasmExports["__wasm_call_ctors"](); + FS.ignorePermissions = false; + } + function preMain() { + checkStackCookie(); + } + function postRun() { + checkStackCookie(); + if (Module["postRun"]) { + if (typeof Module["postRun"] == "function") + Module["postRun"] = [Module["postRun"]]; + while (Module["postRun"].length) { + addOnPostRun(Module["postRun"].shift()); + } + } + callRuntimeCallbacks(onPostRuns); + } + var runDependencies = 0; + var dependenciesFulfilled = null; + var runDependencyTracking = {}; + var runDependencyWatcher = null; + function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } + } + function addRunDependency(id) { + runDependencies++; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if ( + runDependencyWatcher === null && + typeof setInterval != "undefined" + ) { + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err("still waiting on run dependencies:"); + } + err(`dependency: ${dep}`); + } + if (shown) { + err("(end of list)"); + } + }, 1e4); + } + } else { + err("warning: run dependency added without ID"); + } + } + function removeRunDependency(id) { + runDependencies--; + Module["monitorRunDependencies"]?.(runDependencies); + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err("warning: run dependency removed without ID"); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + function abort(what) { + Module["onAbort"]?.(what); + what = "Aborted(" + what + ")"; + err(what); + ABORT = true; + if (what.indexOf("RuntimeError: unreachable") >= 0) { + what += + '. "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)'; + } + var e = new WebAssembly.RuntimeError(what); + readyPromiseReject(e); + throw e; + } + function createExportWrapper(name, nargs) { + return (...args) => { + assert( + runtimeInitialized, + `native function \`${name}\` called before runtime initialization`, + ); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + assert( + args.length <= nargs, + `native function \`${name}\` called with ${args.length} args but expects ${nargs}`, + ); + return f(...args); + }; + } + var wasmBinaryFile; + function findWasmBinary() { + if (Module["locateFile"]) { + return locateFile("riscv_sim_RV64.wasm"); + } + return new URL("riscv_sim_RV64.wasm", import.meta.url).href; + } + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; + } + async function getWasmBinary(binaryFile) { + if (!wasmBinary) { + try { + var response = await readAsync(binaryFile); + return new Uint8Array(response); + } catch {} + } + return getBinarySync(binaryFile); + } + async function instantiateArrayBuffer(binaryFile, imports) { + try { + var binary = await getWasmBinary(binaryFile); + var instance = await WebAssembly.instantiate(binary, imports); + return instance; + } catch (reason) { + err(`failed to asynchronously prepare wasm: ${reason}`); + if (isFileURI(wasmBinaryFile)) { + err( + `warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`, + ); + } + abort(reason); + } + } + async function instantiateAsync(binary, binaryFile, imports) { + if (!binary && typeof WebAssembly.instantiateStreaming == "function") { + try { + var response = fetch(binaryFile, { credentials: "same-origin" }); + var instantiationResult = await WebAssembly.instantiateStreaming( + response, + imports, + ); + return instantiationResult; + } catch (reason) { + err(`wasm streaming compile failed: ${reason}`); + err("falling back to ArrayBuffer instantiation"); + } + } + return instantiateArrayBuffer(binaryFile, imports); + } + function getWasmImports() { + Asyncify.instrumentWasmImports(wasmImports); + return { env: wasmImports, wasi_snapshot_preview1: wasmImports }; + } + async function createWasm() { + function receiveInstance(instance, module) { + wasmExports = instance.exports; + wasmExports = Asyncify.instrumentWasmExports(wasmExports); + wasmExports = applySignatureConversions(wasmExports); + wasmMemory = wasmExports["memory"]; + assert(wasmMemory, "memory not found in wasm exports"); + updateMemoryViews(); + removeRunDependency("wasm-instantiate"); + return wasmExports; + } + addRunDependency("wasm-instantiate"); + var trueModule = Module; + function receiveInstantiationResult(result) { + assert( + Module === trueModule, + "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?", + ); + trueModule = null; + return receiveInstance(result["instance"]); + } + var info = getWasmImports(); + if (Module["instantiateWasm"]) { + return new Promise((resolve, reject) => { + try { + Module["instantiateWasm"](info, (mod, inst) => { + receiveInstance(mod, inst); + resolve(mod.exports); + }); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + reject(e); + } + }); + } + wasmBinaryFile ??= findWasmBinary(); + try { + var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info); + var exports = receiveInstantiationResult(result); + return exports; + } catch (e) { + readyPromiseReject(e); + return Promise.reject(e); + } + } + class ExitStatus { + name = "ExitStatus"; + constructor(status) { + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + } + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + callbacks.shift()(Module); + } + }; + var onPostRuns = []; + var addOnPostRun = (cb) => onPostRuns.unshift(cb); + var onPreRuns = []; + var addOnPreRun = (cb) => onPreRuns.unshift(cb); + var noExitRuntime = Module["noExitRuntime"] || true; + var ptrToString = (ptr) => { + assert(typeof ptr === "number"); + return "0x" + ptr.toString(16).padStart(8, "0"); + }; + var stackRestore = (val) => __emscripten_stack_restore(val); + var stackSave = () => _emscripten_stack_get_current(); + var warnOnce = (text) => { + warnOnce.shown ||= {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + err(text); + } + }; + var INT53_MAX = 9007199254740992; + var INT53_MIN = -9007199254740992; + var bigintToI53Checked = (num) => + num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); + var UTF8Decoder = + typeof TextDecoder != "undefined" ? new TextDecoder() : undefined; + var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ""; + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 248) != 240) + warnOnce( + "Invalid UTF-8 leading byte " + + ptrToString(u0) + + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!", + ); + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); + } + } + return str; + }; + var UTF8ToString = (ptr, maxBytesToRead) => { + assert( + typeof ptr == "number", + `UTF8ToString expects a number (got ${typeof ptr})`, + ); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; + }; + function ___assert_fail(condition, filename, line, func) { + condition = bigintToI53Checked(condition); + filename = bigintToI53Checked(filename); + func = bigintToI53Checked(func); + return abort( + `Assertion failed: ${UTF8ToString(condition)}, at: ` + + [ + filename ? UTF8ToString(filename) : "unknown filename", + line, + func ? UTF8ToString(func) : "unknown function", + ], + ); + } + var syscallGetVarargP = () => { + assert(SYSCALLS.varargs != undefined); + var ret = Number(HEAPU64[SYSCALLS.varargs / 8]); + SYSCALLS.varargs += 8; + return ret; + }; + var syscallGetVarargI = () => { + assert(SYSCALLS.varargs != undefined); + var ret = HEAP32[+SYSCALLS.varargs / 4]; + SYSCALLS.varargs += 4; + return ret; + }; + var PATH = { + isAbs: (path) => path.charAt(0) === "/", + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === ".") { + parts.splice(i, 1); + } else if (last === "..") { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift(".."); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.slice(-1) === "/"; + path = PATH.normalizeArray( + path.split("/").filter((p) => !!p), + !isAbsolute, + ).join("/"); + if (!path && !isAbsolute) { + path = "."; + } + if (path && trailingSlash) { + path += "/"; + } + return (isAbsolute ? "/" : "") + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return "."; + } + if (dir) { + dir = dir.slice(0, -1); + } + return root + dir; + }, + basename: (path) => path && path.match(/([^\/]+|\/)\/*$/)[1], + join: (...paths) => PATH.normalize(paths.join("/")), + join2: (l, r) => PATH.normalize(l + "/" + r), + }; + var initRandomFill = () => (view) => crypto.getRandomValues(view); + var randomFill = (view) => { + (randomFill = initRandomFill())(view); + }; + var PATH_FS = { + resolve: (...args) => { + var resolvedPath = "", + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? args[i] : FS.cwd(); + if (typeof path != "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path) { + return ""; + } + resolvedPath = path + "/" + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split("/").filter((p) => !!p), + !resolvedAbsolute, + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).slice(1); + to = PATH_FS.resolve(to).slice(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== "") break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split("/")); + var toParts = trim(to.split("/")); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }, + }; + var FS_stdin_getChar_buffer = []; + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert( + typeof str === "string", + `stringToUTF8Array expects a string (got ${typeof str})`, + ); + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 1114111) + warnOnce( + "Invalid Unicode code point " + + ptrToString(u) + + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).", + ); + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + heap[outIdx] = 0; + return outIdx - startIdx; + }; + var intArrayFromString = (stringy, dontAddNull, length) => { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + }; + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if ( + typeof window != "undefined" && + typeof window.prompt == "function" + ) { + result = window.prompt("Input: "); + if (result !== null) { + result += "\n"; + } + } else { + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output?.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + }, + }; + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + }; + var alignMemory = (size, alignment) => { + assert(alignment, "alignment argument is required"); + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (ptr) zeroMemory(ptr, size); + return ptr; + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, "/", 16895, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.atime = node.mtime = node.ctime = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.atime = parent.mtime = parent.ctime = node.atime; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.atime); + attr.mtime = new Date(node.mtime); + attr.ctime = new Date(node.ctime); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + for (const key of ["mode", "atime", "mtime", "ctime"]) { + if (attr[key] != null) { + node[key] = attr[key]; + } + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw new FS.ErrnoError(44); + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + if (FS.isDir(old_node.mode)) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + FS.hashRemoveNode(new_node); + } + delete old_node.parent.contents[old_node.name]; + new_dir.contents[new_name] = old_node; + old_node.name = new_name; + new_dir.ctime = + new_dir.mtime = + old_node.parent.ctime = + old_node.parent.mtime = + Date.now(); + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.ctime = parent.mtime = Date.now(); + }, + readdir(node) { + return [".", "..", ...Object.keys(node.contents)]; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + assert(size >= 0); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(!(buffer instanceof ArrayBuffer)); + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.mtime = node.ctime = Date.now(); + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + assert( + position === 0, + "canOwn must imply no weird position inside the file", + ); + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + HEAP8.set(contents, ptr); + } + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + return 0; + }, + }, + }; + var asyncLoad = async (url) => { + var arrayBuffer = await readAsync(url); + assert( + arrayBuffer, + `Loading data file "${url}" failed (no arrayBuffer).`, + ); + return new Uint8Array(arrayBuffer); + }; + asyncLoad.isAsync = true; + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + var preloadPlugins = Module["preloadPlugins"] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != "undefined") Browser.init(); + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin["canHandle"](fullname)) { + plugin["handle"](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + onload?.(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == "string") { + asyncLoad(url).then(processData, onerror); + } else { + processData(url); + } + }; + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + "r+": 2, + w: 512 | 64 | 1, + "w+": 512 | 64 | 2, + a: 1024 | 64 | 1, + "a+": 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == "undefined") { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + var strError = (errno) => UTF8ToString(_strerror(errno)); + var ERRNO_CODES = { + EPERM: 63, + ENOENT: 44, + ESRCH: 71, + EINTR: 27, + EIO: 29, + ENXIO: 60, + E2BIG: 1, + ENOEXEC: 45, + EBADF: 8, + ECHILD: 12, + EAGAIN: 6, + EWOULDBLOCK: 6, + ENOMEM: 48, + EACCES: 2, + EFAULT: 21, + ENOTBLK: 105, + EBUSY: 10, + EEXIST: 20, + EXDEV: 75, + ENODEV: 43, + ENOTDIR: 54, + EISDIR: 31, + EINVAL: 28, + ENFILE: 41, + EMFILE: 33, + ENOTTY: 59, + ETXTBSY: 74, + EFBIG: 22, + ENOSPC: 51, + ESPIPE: 70, + EROFS: 69, + EMLINK: 34, + EPIPE: 64, + EDOM: 18, + ERANGE: 68, + ENOMSG: 49, + EIDRM: 24, + ECHRNG: 106, + EL2NSYNC: 156, + EL3HLT: 107, + EL3RST: 108, + ELNRNG: 109, + EUNATCH: 110, + ENOCSI: 111, + EL2HLT: 112, + EDEADLK: 16, + ENOLCK: 46, + EBADE: 113, + EBADR: 114, + EXFULL: 115, + ENOANO: 104, + EBADRQC: 103, + EBADSLT: 102, + EDEADLOCK: 16, + EBFONT: 101, + ENOSTR: 100, + ENODATA: 116, + ETIME: 117, + ENOSR: 118, + ENONET: 119, + ENOPKG: 120, + EREMOTE: 121, + ENOLINK: 47, + EADV: 122, + ESRMNT: 123, + ECOMM: 124, + EPROTO: 65, + EMULTIHOP: 36, + EDOTDOT: 125, + EBADMSG: 9, + ENOTUNIQ: 126, + EBADFD: 127, + EREMCHG: 128, + ELIBACC: 129, + ELIBBAD: 130, + ELIBSCN: 131, + ELIBMAX: 132, + ELIBEXEC: 133, + ENOSYS: 52, + ENOTEMPTY: 55, + ENAMETOOLONG: 37, + ELOOP: 32, + EOPNOTSUPP: 138, + EPFNOSUPPORT: 139, + ECONNRESET: 15, + ENOBUFS: 42, + EAFNOSUPPORT: 5, + EPROTOTYPE: 67, + ENOTSOCK: 57, + ENOPROTOOPT: 50, + ESHUTDOWN: 140, + ECONNREFUSED: 14, + EADDRINUSE: 3, + ECONNABORTED: 13, + ENETUNREACH: 40, + ENETDOWN: 38, + ETIMEDOUT: 73, + EHOSTDOWN: 142, + EHOSTUNREACH: 23, + EINPROGRESS: 26, + EALREADY: 7, + EDESTADDRREQ: 17, + EMSGSIZE: 35, + EPROTONOSUPPORT: 66, + ESOCKTNOSUPPORT: 137, + EADDRNOTAVAIL: 4, + ENETRESET: 39, + EISCONN: 30, + ENOTCONN: 53, + ETOOMANYREFS: 141, + EUSERS: 136, + EDQUOT: 19, + ESTALE: 72, + ENOTSUP: 138, + ENOMEDIUM: 148, + EILSEQ: 25, + EOVERFLOW: 61, + ECANCELED: 11, + ENOTRECOVERABLE: 56, + EOWNERDEAD: 62, + ESTRPIPE: 135, + }; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: "/", + initialized: false, + ignorePermissions: true, + ErrnoError: class extends Error { + name = "ErrnoError"; + constructor(errno) { + super(runtimeInitialized ? strError(errno) : ""); + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + } + }, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + shared = {}; + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + get isRead() { + return (this.flags & 2097155) !== 1; + } + get isWrite() { + return (this.flags & 2097155) !== 0; + } + get isAppend() { + return this.flags & 1024; + } + get flags() { + return this.shared.flags; + } + set flags(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + node_ops = {}; + stream_ops = {}; + readMode = 292 | 73; + writeMode = 146; + mounted = null; + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.rdev = rdev; + this.atime = this.mtime = this.ctime = Date.now(); + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? (this.mode |= this.readMode) : (this.mode &= ~this.readMode); + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? (this.mode |= this.writeMode) : (this.mode &= ~this.writeMode); + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + if (!path) { + throw new FS.ErrnoError(44); + } + opts.follow_mount ??= true; + if (!PATH.isAbs(path)) { + path = FS.cwd() + "/" + path; + } + linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) { + var parts = path.split("/").filter((p) => !!p); + var current = FS.root; + var current_path = "/"; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + if (parts[i] === ".") { + continue; + } + if (parts[i] === "..") { + current_path = PATH.dirname(current_path); + current = current.parent; + continue; + } + current_path = PATH.join2(current_path, parts[i]); + try { + current = FS.lookupNode(current, parts[i]); + } catch (e) { + if (e?.errno === 44 && islast && opts.noent_okay) { + return { path: current_path }; + } + throw e; + } + if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) { + current = current.mounted.root; + } + if (FS.isLink(current.mode) && (!islast || opts.follow)) { + if (!current.node_ops.readlink) { + throw new FS.ErrnoError(52); + } + var link = current.node_ops.readlink(current); + if (!PATH.isAbs(link)) { + link = PATH.dirname(current_path) + "/" + link; + } + path = link + "/" + parts.slice(i + 1).join("/"); + continue linkloop; + } + } + return { path: current_path, node: current }; + } + throw new FS.ErrnoError(32); + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== "/" + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + assert(typeof parent == "object"); + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ["r", "w", "rw"][flag & 3]; + if (flag & 512) { + perms += "w"; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes("r") && !(node.mode & 292)) { + return 2; + } else if (perms.includes("w") && !(node.mode & 146)) { + return 2; + } else if (perms.includes("x") && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, "x"); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + if (!FS.isDir(dir.mode)) { + return 54; + } + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, "wx"); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, "wx"); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== "r" || flags & (512 | 64)) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + checkOpExists(op, err) { + if (!op) { + throw new FS.ErrnoError(err); + } + return op; + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + assert(fd >= -1); + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + doSetAttr(stream, node, attr) { + var setattr = stream?.stream_ops.setattr; + var arg = setattr ? stream : node; + setattr ??= node.node_ops.setattr; + FS.checkOpExists(setattr, 63); + setattr(arg, attr); + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push(...m.mounts); + } + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == "function") { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + assert(FS.syncFSRequests > 0); + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + if (typeof type == "string") { + throw type; + } + var root = mountpoint === "/"; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { type, opts, mountpoint, mounts: [] }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + assert(idx !== -1); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name) { + throw new FS.ErrnoError(28); + } + if (name === "." || name === "..") { + throw new FS.ErrnoError(20); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + statfs(path) { + return FS.statfsNode(FS.lookupPath(path, { follow: true }).node); + }, + statfsStream(stream) { + return FS.statfsNode(stream.node); + }, + statfsNode(node) { + var rtn = { + bsize: 4096, + frsize: 4096, + blocks: 1e6, + bfree: 5e5, + bavail: 5e5, + files: FS.nextInode, + ffree: FS.nextInode - 1, + fsid: 42, + flags: 2, + namelen: 255, + }; + if (node.node_ops.statfs) { + Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root)); + } + return rtn; + }, + create(path, mode = 438) { + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode = 511) { + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split("/"); + var d = ""; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += "/" + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == "undefined") { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== ".") { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + var readdir = FS.checkOpExists(node.node_ops.readdir, 54); + return readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return link.node_ops.readlink(link); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + var getattr = FS.checkOpExists(node.node_ops.getattr, 63); + return getattr(node); + }, + fstat(fd) { + var stream = FS.getStreamChecked(fd); + var node = stream.node; + var getattr = stream.stream_ops.getattr; + var arg = getattr ? stream : node; + getattr ??= node.node_ops.getattr; + FS.checkOpExists(getattr, 63); + return getattr(arg); + }, + lstat(path) { + return FS.stat(path, true); + }, + doChmod(stream, node, mode, dontFollow) { + FS.doSetAttr(stream, node, { + mode: (mode & 4095) | (node.mode & ~4095), + ctime: Date.now(), + dontFollow, + }); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + FS.doChmod(null, node, mode, dontFollow); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.doChmod(stream, stream.node, mode, false); + }, + doChown(stream, node, dontFollow) { + FS.doSetAttr(stream, node, { timestamp: Date.now(), dontFollow }); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + FS.doChown(null, node, dontFollow); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.doChown(stream, stream.node, false); + }, + doTruncate(stream, node, len) { + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, "w"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.doSetAttr(stream, node, { size: len, timestamp: Date.now() }); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == "string") { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + FS.doTruncate(null, node, len); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if (len < 0 || (stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.doTruncate(stream, stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + var setattr = FS.checkOpExists(node.node_ops.setattr, 63); + setattr(node, { atime, mtime }); + }, + open(path, flags, mode = 438) { + if (path === "") { + throw new FS.ErrnoError(44); + } + flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + var isDirPath; + if (typeof path == "object") { + node = path; + } else { + isDirPath = path.endsWith("/"); + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + noent_okay: true, + }); + node = lookup.node; + path = lookup.path; + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else if (isDirPath) { + throw new FS.ErrnoError(31); + } else { + node = FS.mknod(path, mode | 511, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node, + path: FS.getPath(node), + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (created) { + FS.chmod(node, mode & 511); + } + if (Module["logReadFiles"] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + assert(offset >= 0); + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != "undefined"; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + assert(offset >= 0); + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || "binary"; + if (opts.encoding !== "utf8" && opts.encoding !== "binary") { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === "utf8") { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === "binary") { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == "string") { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error("Unsupported data type"); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, "x"); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir("/tmp"); + FS.mkdir("/home"); + FS.mkdir("/home/web_user"); + }, + createDefaultDevices() { + FS.mkdir("/dev"); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + llseek: () => 0, + }); + FS.mkdev("/dev/null", FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev("/dev/tty", FS.makedev(5, 0)); + FS.mkdev("/dev/tty1", FS.makedev(6, 0)); + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomFill(randomBuffer); + randomLeft = randomBuffer.byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice("/dev", "random", randomByte); + FS.createDevice("/dev", "urandom", randomByte); + FS.mkdir("/dev/shm"); + FS.mkdir("/dev/shm/tmp"); + }, + createSpecialDirectories() { + FS.mkdir("/proc"); + var proc_self = FS.mkdir("/proc/self"); + FS.mkdir("/proc/self/fd"); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, "fd", 16895, 73); + node.stream_ops = { llseek: MEMFS.stream_ops.llseek }; + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: "fake" }, + node_ops: { readlink: () => stream.path }, + id: fd + 1, + }; + ret.parent = ret; + return ret; + }, + readdir() { + return Array.from(FS.streams.entries()) + .filter(([k, v]) => v) + .map(([k, v]) => k.toString()); + }, + }; + return node; + }, + }, + {}, + "/proc/self/fd", + ); + }, + createStandardStreams(input, output, error) { + if (input) { + FS.createDevice("/dev", "stdin", input); + } else { + FS.symlink("/dev/tty", "/dev/stdin"); + } + if (output) { + FS.createDevice("/dev", "stdout", null, output); + } else { + FS.symlink("/dev/tty", "/dev/stdout"); + } + if (error) { + FS.createDevice("/dev", "stderr", null, error); + } else { + FS.symlink("/dev/tty1", "/dev/stderr"); + } + var stdin = FS.open("/dev/stdin", 0); + var stdout = FS.open("/dev/stdout", 1); + var stderr = FS.open("/dev/stderr", 1); + assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`); + assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`); + assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`); + }, + staticInit() { + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, "/"); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS }; + }, + init(input, output, error) { + assert( + !FS.initialized, + "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)", + ); + FS.initialized = true; + input ??= Module["stdin"]; + output ??= Module["stdout"]; + error ??= Module["stderr"]; + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + _fflush(0); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === "/"; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + var parts = path.split("/").reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == "string" ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == "string") { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == "string" ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.atime = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.mtime = stream.node.ctime = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != "undefined") { + throw new Error( + "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.", + ); + } else { + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + class LazyUint8Array { + lengthKnown = false; + chunks = []; + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open("HEAD", url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = + (header = xhr.getResponseHeader("Accept-Ranges")) && + header === "bytes"; + var usesGzip = + (header = xhr.getResponseHeader("Content-Encoding")) && + header === "gzip"; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + "invalid range (" + + from + + ", " + + to + + ") or no bytes requested!", + ); + if (to > datalength - 1) + throw new Error( + "only " + datalength + " bytes available! programmer error!", + ); + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + xhr.responseType = "arraybuffer"; + if (xhr.overrideMimeType) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + ". Status: " + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || "", true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == "undefined") + throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + "LazyFiles on gzip forces download of the whole file when length is accessed", + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + if (typeof XMLHttpRequest != "undefined") { + if (!ENVIRONMENT_IS_WORKER) + throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + assert(size >= 0); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + absolutePath() { + abort("FS.absolutePath has been removed; use PATH_FS.resolve instead"); + }, + createFolder() { + abort("FS.createFolder has been removed; use FS.mkdir instead"); + }, + createLink() { + abort("FS.createLink has been removed; use FS.symlink instead"); + }, + joinPath() { + abort("FS.joinPath has been removed; use PATH.join instead"); + }, + mmapAlloc() { + abort( + "FS.mmapAlloc has been replaced by the top level function mmapAlloc", + ); + }, + standardizePath() { + abort( + "FS.standardizePath has been removed; use PATH.normalize instead", + ); + }, + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return dir + "/" + path; + }, + writeStat(buf, stat) { + HEAP32[buf / 4] = stat.dev; + HEAP32[(buf + 4) / 4] = stat.mode; + HEAPU64[(buf + 8) / 8] = BigInt(stat.nlink); + HEAP32[(buf + 16) / 4] = stat.uid; + HEAP32[(buf + 20) / 4] = stat.gid; + HEAP32[(buf + 24) / 4] = stat.rdev; + HEAP64[(buf + 32) / 8] = BigInt(stat.size); + HEAP32[(buf + 40) / 4] = 4096; + HEAP32[(buf + 44) / 4] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(buf + 48) / 8] = BigInt(Math.floor(atime / 1e3)); + HEAPU64[(buf + 56) / 8] = BigInt((atime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 64) / 8] = BigInt(Math.floor(mtime / 1e3)); + HEAPU64[(buf + 72) / 8] = BigInt((mtime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 80) / 8] = BigInt(Math.floor(ctime / 1e3)); + HEAPU64[(buf + 88) / 8] = BigInt((ctime % 1e3) * 1e3 * 1e3); + HEAP64[(buf + 96) / 8] = BigInt(stat.ino); + return 0; + }, + writeStatFs(buf, stats) { + HEAP32[(buf + 8) / 4] = stats.bsize; + HEAP32[(buf + 56) / 4] = stats.bsize; + HEAP32[(buf + 16) / 4] = stats.blocks; + HEAP32[(buf + 20) / 4] = stats.bfree; + HEAP32[(buf + 24) / 4] = stats.bavail; + HEAP32[(buf + 28) / 4] = stats.files; + HEAP32[(buf + 32) / 4] = stats.ffree; + HEAP32[(buf + 36) / 4] = stats.fsid; + HEAP32[(buf + 64) / 4] = stats.flags; + HEAP32[(buf + 48) / 4] = stats.namelen; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + function ___syscall_fcntl64(fd, cmd, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = syscallGetVarargP(); + var offset = 0; + HEAP16[(arg + offset) / 2] = 2; + return 0; + } + case 6: + case 7: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + buf = bigintToI53Checked(buf); + try { + return SYSCALLS.writeStat(buf, FS.fstat(fd)); + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + HEAP32[argp / 4] = termios.c_iflag || 0; + HEAP32[(argp + 4) / 4] = termios.c_oflag || 0; + HEAP32[(argp + 8) / 4] = termios.c_cflag || 0; + HEAP32[(argp + 12) / 4] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[argp + i + 17] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = HEAP32[argp / 4]; + var c_oflag = HEAP32[(argp + 4) / 4]; + var c_cflag = HEAP32[(argp + 8) / 4]; + var c_lflag = HEAP32[(argp + 12) / 4]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[argp + i + 17]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + HEAP32[argp / 4] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + HEAP16[argp / 2] = winsize[0]; + HEAP16[(argp + 2) / 2] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function ___syscall_openat(dirfd, path, flags, varargs) { + path = bigintToI53Checked(path); + varargs = bigintToI53Checked(varargs); + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var __abort_js = () => abort("native code called abort()"); + var runtimeKeepaliveCounter = 0; + var __emscripten_runtime_keepalive_clear = () => { + noExitRuntime = false; + runtimeKeepaliveCounter = 0; + }; + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + len = bigintToI53Checked(len); + offset = bigintToI53Checked(offset); + allocated = bigintToI53Checked(allocated); + addr = bigintToI53Checked(addr); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated / 4] = res.allocated; + HEAPU64[addr / 8] = BigInt(ptr); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset) { + addr = bigintToI53Checked(addr); + len = bigintToI53Checked(len); + offset = bigintToI53Checked(offset); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return -e.errno; + } + } + var timers = {}; + var handleException = (e) => { + if (e instanceof ExitStatus || e == "unwind") { + return EXITSTATUS; + } + checkStackCookie(); + if (e instanceof WebAssembly.RuntimeError) { + if (_emscripten_stack_get_current() <= 0) { + err( + "Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)", + ); + } + } + quit_(1, e); + }; + var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; + var _proc_exit = (code) => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + Module["onExit"]?.(code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + }; + var exitJS = (statusw, implicit) => { + EXITSTATUS = statusw; + checkUnflushedContent(); + if (keepRuntimeAlive() && !implicit) { + if (!document.app.$data.testing) { + for (let i = 0; i < instructions.length; i++){ + instructions[i]._rowVariant = ''; + } + status.run_program = -1; // program finished + if (statusw !== 0){ + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: true, + run_disable: true, + stop_disable: false, + }); + show_notification("Your program has finished with errors.", "danger"); + } else { + coreEvents.emit("executor-buttons-update", { + reset_disable: false, + instruction_disable: false, + run_disable: false, + stop_disable: true, + isFinished: true, + }); + } + } else { + if (statusw === 0) + document.app.$data.passed_test += 1; + else + document.app.$data.failed_test += 1; + } + var msg = `program exited (with status: ${statusw}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + _proc_exit(statusw); + }; + var _exit = exitJS; + var maybeExit = () => { + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + }; + var callUserCallback = (func) => { + if (ABORT) { + err( + "user callback triggered after runtime exited or application aborted. Ignoring.", + ); + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } + }; + var _emscripten_get_now = () => performance.now(); + var __setitimer_js = (which, timeout_ms) => { + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + if (!timeout_ms) return 0; + var id = setTimeout(() => { + assert(which in timers); + delete timers[which]; + callUserCallback(() => + __emscripten_timeout(which, _emscripten_get_now()), + ); + }, timeout_ms); + timers[which] = { id, timeout_ms }; + return 0; + }; + var _emscripten_set_main_loop_timing = (mode, value) => { + MainLoop.timingMode = mode; + MainLoop.timingValue = value; + if (!MainLoop.func) { + err( + "emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up.", + ); + return 1; + } + if (!MainLoop.running) { + MainLoop.running = true; + } + if (mode == 0) { + MainLoop.scheduler = function MainLoop_scheduler_setTimeout() { + var timeUntilNextTick = + Math.max( + 0, + MainLoop.tickStartTime + value - _emscripten_get_now(), + ) | 0; + setTimeout(MainLoop.runner, timeUntilNextTick); + }; + MainLoop.method = "timeout"; + } else if (mode == 1) { + MainLoop.scheduler = function MainLoop_scheduler_rAF() { + MainLoop.requestAnimationFrame(MainLoop.runner); + }; + MainLoop.method = "rAF"; + } else if (mode == 2) { + if (typeof MainLoop.setImmediate == "undefined") { + if (typeof setImmediate == "undefined") { + var setImmediates = []; + var emscriptenMainLoopMessageId = "setimmediate"; + var MainLoop_setImmediate_messageHandler = (event) => { + if ( + event.data === emscriptenMainLoopMessageId || + event.data.target === emscriptenMainLoopMessageId + ) { + event.stopPropagation(); + setImmediates.shift()(); + } + }; + addEventListener( + "message", + MainLoop_setImmediate_messageHandler, + true, + ); + MainLoop.setImmediate = (func) => { + setImmediates.push(func); + if (ENVIRONMENT_IS_WORKER) { + Module["setImmediates"] ??= []; + Module["setImmediates"].push(func); + postMessage({ target: emscriptenMainLoopMessageId }); + } else postMessage(emscriptenMainLoopMessageId, "*"); + }; + } else { + MainLoop.setImmediate = setImmediate; + } + } + MainLoop.scheduler = function MainLoop_scheduler_setImmediate() { + MainLoop.setImmediate(MainLoop.runner); + }; + MainLoop.method = "immediate"; + } + return 0; + }; + var setMainLoop = ( + iterFunc, + fps, + simulateInfiniteLoop, + arg, + noSetTiming, + ) => { + assert( + !MainLoop.func, + "emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.", + ); + MainLoop.func = iterFunc; + MainLoop.arg = arg; + var thisMainLoopId = MainLoop.currentlyRunningMainloop; + function checkIsRunning() { + if (thisMainLoopId < MainLoop.currentlyRunningMainloop) { + maybeExit(); + return false; + } + return true; + } + MainLoop.running = false; + MainLoop.runner = function MainLoop_runner() { + if (ABORT) return; + if (MainLoop.queue.length > 0) { + var start = Date.now(); + var blocker = MainLoop.queue.shift(); + blocker.func(blocker.arg); + if (MainLoop.remainingBlockers) { + var remaining = MainLoop.remainingBlockers; + var next = + remaining % 1 == 0 ? remaining - 1 : Math.floor(remaining); + if (blocker.counted) { + MainLoop.remainingBlockers = next; + } else { + next = next + 0.5; + MainLoop.remainingBlockers = (8 * remaining + next) / 9; + } + } + MainLoop.updateStatus(); + if (!checkIsRunning()) return; + setTimeout(MainLoop.runner, 0); + return; + } + if (!checkIsRunning()) return; + MainLoop.currentFrameNumber = (MainLoop.currentFrameNumber + 1) | 0; + if ( + MainLoop.timingMode == 1 && + MainLoop.timingValue > 1 && + MainLoop.currentFrameNumber % MainLoop.timingValue != 0 + ) { + MainLoop.scheduler(); + return; + } else if (MainLoop.timingMode == 0) { + MainLoop.tickStartTime = _emscripten_get_now(); + } + if (MainLoop.method === "timeout" && Module["ctx"]) { + warnOnce( + "Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!", + ); + MainLoop.method = ""; + } + MainLoop.runIter(iterFunc); + if (!checkIsRunning()) return; + MainLoop.scheduler(); + }; + if (!noSetTiming) { + if (fps > 0) { + _emscripten_set_main_loop_timing(0, 1e3 / fps); + } else { + _emscripten_set_main_loop_timing(1, 1); + } + MainLoop.scheduler(); + } + if (simulateInfiniteLoop) { + throw "unwind"; + } + }; + var MainLoop = { + running: false, + scheduler: null, + method: "", + currentlyRunningMainloop: 0, + func: null, + arg: 0, + timingMode: 0, + timingValue: 0, + currentFrameNumber: 0, + queue: [], + preMainLoop: [], + postMainLoop: [], + pause() { + MainLoop.scheduler = null; + MainLoop.currentlyRunningMainloop++; + }, + resume() { + MainLoop.currentlyRunningMainloop++; + var timingMode = MainLoop.timingMode; + var timingValue = MainLoop.timingValue; + var func = MainLoop.func; + MainLoop.func = null; + setMainLoop(func, 0, false, MainLoop.arg, true); + _emscripten_set_main_loop_timing(timingMode, timingValue); + MainLoop.scheduler(); + }, + updateStatus() { + if (Module["setStatus"]) { + var message = Module["statusMessage"] || "Please wait..."; + var remaining = MainLoop.remainingBlockers ?? 0; + var expected = MainLoop.expectedBlockers ?? 0; + if (remaining) { + if (remaining < expected) { + Module["setStatus"]( + `{message} ({expected - remaining}/{expected})`, + ); + } else { + Module["setStatus"](message); + } + } else { + Module["setStatus"](""); + } + } + }, + init() { + Module["preMainLoop"] && + MainLoop.preMainLoop.push(Module["preMainLoop"]); + Module["postMainLoop"] && + MainLoop.postMainLoop.push(Module["postMainLoop"]); + }, + runIter(func) { + if (ABORT) return; + for (var pre of MainLoop.preMainLoop) { + if (pre() === false) { + return; + } + } + callUserCallback(func); + for (var post of MainLoop.postMainLoop) { + post(); + } + checkStackCookie(); + }, + nextRAF: 0, + fakeRequestAnimationFrame(func) { + var now = Date.now(); + if (MainLoop.nextRAF === 0) { + MainLoop.nextRAF = now + 1e3 / 60; + } else { + while (now + 2 >= MainLoop.nextRAF) { + MainLoop.nextRAF += 1e3 / 60; + } + } + var delay = Math.max(MainLoop.nextRAF - now, 0); + setTimeout(func, delay); + }, + requestAnimationFrame(func) { + if (typeof requestAnimationFrame == "function") { + requestAnimationFrame(func); + return; + } + var RAF = MainLoop.fakeRequestAnimationFrame; + RAF(func); + }, + }; + var _emscripten_date_now = () => Date.now(); + var getHeapMax = () => 2147483648; + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + wasmMemory.grow(BigInt(pages)); + updateMemoryViews(); + return 1; + } catch (e) { + err( + `growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`, + ); + } + }; + function _emscripten_resize_heap(requestedSize) { + requestedSize = bigintToI53Checked(requestedSize); + var oldSize = HEAPU8.length; + assert(requestedSize > oldSize); + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + err( + `Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`, + ); + return false; + } + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + var newSize = Math.min( + maxHeapSize, + alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + err( + `Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`, + ); + return false; + } + function _emscripten_run_script_int(ptr) { + ptr = bigintToI53Checked(ptr); + return eval(UTF8ToString(ptr)) | 0; + } + var safeSetTimeout = (func, timeout) => + setTimeout(() => { + callUserCallback(func); + }, timeout); + var _emscripten_sleep = (ms) => + Asyncify.handleSleep((wakeUp) => safeSetTimeout(wakeUp, ms)); + _emscripten_sleep.isAsync = true; + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[iov / 8]); + var len = Number(HEAPU64[(iov + 8) / 8]); + iov += 16; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_read(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU64[pnum / 8] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + newOffset = bigintToI53Checked(newOffset); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[newOffset / 8] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = Number(HEAPU64[iov / 8]); + var len = Number(HEAPU64[(iov + 8) / 8]); + iov += 16; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + break; + } + if (typeof offset != "undefined") { + offset += curr; + } + } + return ret; + }; + function _fd_write(fd, iov, iovcnt, pnum) { + iov = bigintToI53Checked(iov); + iovcnt = bigintToI53Checked(iovcnt); + pnum = bigintToI53Checked(pnum); + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU64[pnum / 8] = BigInt(num); + return 0; + } catch (e) { + if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e; + return e.errno; + } + } + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert( + typeof maxBytesToWrite == "number", + "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!", + ); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + var stackAlloc = (sz) => __emscripten_stack_alloc(sz); + var stringToUTF8OnStack = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; + }; + var runAndAbortIfError = (func) => { + try { + return func(); + } catch (e) { + abort(e); + } + }; + var runtimeKeepalivePush = () => { + runtimeKeepaliveCounter += 1; + }; + var runtimeKeepalivePop = () => { + assert(runtimeKeepaliveCounter > 0); + runtimeKeepaliveCounter -= 1; + }; + var Asyncify = { + rewindArguments: {}, + instrumentWasmImports(imports) { + var importPattern = /^(invoke_.*|__asyncjs__.*)$/; + for (let [x, original] of Object.entries(imports)) { + if (typeof original == "function") { + let isAsyncifyImport = original.isAsync || importPattern.test(x); + imports[x] = (...args) => { + var originalAsyncifyState = Asyncify.state; + try { + return original(...args); + } finally { + var changedToDisabled = + originalAsyncifyState === Asyncify.State.Normal && + Asyncify.state === Asyncify.State.Disabled; + var ignoredInvoke = x.startsWith("invoke_") && true; + if ( + Asyncify.state !== originalAsyncifyState && + !isAsyncifyImport && + !changedToDisabled && + !ignoredInvoke + ) { + throw new Error( + `import ${x} was not in ASYNCIFY_IMPORTS, but changed the state`, + ); + } + } + }; + } + } + }, + saveRewindArguments(funcName, passedArguments) { + return (Asyncify.rewindArguments[funcName] = + Array.from(passedArguments)); + }, + restoreRewindArguments(funcName) { + return Asyncify.rewindArguments[funcName] || []; + }, + instrumentWasmExports(exports) { + var ret = {}; + for (let [x, original] of Object.entries(exports)) { + if (typeof original == "function") { + ret[x] = (...args) => { + Asyncify.exportCallStack.push(x); + try { + Asyncify.saveRewindArguments(x, args); + return original(...args); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + } + return ret; + }, + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId(funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + maybeStopUnwind() { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_unwind); + if (typeof Fibers != "undefined") { + Fibers.trampoline(); + } + } + }, + whenDone() { + assert( + Asyncify.currData, + "Tried to wait for an async operation when none is in progress.", + ); + assert( + !Asyncify.asyncPromiseHandlers, + "Cannot have multiple async operations in flight at once", + ); + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { resolve, reject }; + }); + }, + allocateData() { + var ptr = _malloc(24 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 24, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader(ptr, stack, stackSize) { + HEAPU64[ptr / 8] = BigInt(stack); + HEAPU64[(ptr + 8) / 8] = BigInt(stack + stackSize); + }, + setDataRewindFunc(ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + HEAP32[(ptr + 16) / 4] = rewindId; + }, + getDataRewindFuncName(ptr) { + var id = HEAP32[(ptr + 16) / 4]; + var name = Asyncify.callStackIdToName[id]; + return name; + }, + getDataRewindFunc(name) { + var func = wasmExports[name]; + return func; + }, + doRewind(ptr) { + var name = Asyncify.getDataRewindFuncName(ptr); + var func = Asyncify.getDataRewindFunc(name); + return func(...Asyncify.restoreRewindArguments(name)); + }, + handleSleep(startAsync) { + assert( + Asyncify.state !== Asyncify.State.Disabled, + "Asyncify cannot be done during or after the runtime exits", + ); + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue = 0) => { + assert( + !handleSleepReturnValue || + typeof handleSleepReturnValue == "number" || + typeof handleSleepReturnValue == "boolean", + ); + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + assert( + !Asyncify.exportCallStack.length, + "Waking up (starting to rewind) must be done from JS, without compiled code on the stack.", + ); + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData)); + if (typeof MainLoop != "undefined" && MainLoop.func) { + MainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)(asyncWasmReturnValue); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + if (typeof MainLoop != "undefined" && MainLoop.func) { + MainLoop.pause(); + } + runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData)); + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_rewind); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach(callUserCallback); + } else { + abort(`invalid state: ${Asyncify.state}`); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync(startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + var getCFunc = (ident) => { + var func = Module["_" + ident]; + assert( + func, + "Cannot call unknown function " + ident + ", make sure it is exported", + ); + return func; + }; + var writeArrayToMemory = (array, buffer) => { + assert( + array.length >= 0, + "writeArrayToMemory array must have a length (should be an array or typed array)", + ); + HEAP8.set(array, buffer); + }; + var ccall = (ident, returnType, argTypes, args, opts) => { + var toC = { + pointer: (p) => BigInt(p), + string: (str) => { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + ret = stringToUTF8OnStack(str); + } + return BigInt(ret); + }, + array: (arr) => { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return BigInt(ret); + }, + }; + function convertReturnValue(ret) { + if (returnType === "string") { + return UTF8ToString(Number(ret)); + } + if (returnType === "pointer") return Number(ret); + if (returnType === "boolean") return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + assert(returnType !== "array", 'Return type should not be "array".'); + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var previousAsync = Asyncify.currData; + var ret = func(...cArgs); + function onDone(ret) { + runtimeKeepalivePop(); + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + var asyncMode = opts?.async; + runtimeKeepalivePush(); + if (Asyncify.currData != previousAsync) { + assert( + !(previousAsync && Asyncify.currData), + "We cannot start an async operation when one is already flight", + ); + assert( + !(previousAsync && !Asyncify.currData), + "We cannot stop an async operation in flight", + ); + assert( + asyncMode, + "The call to " + + ident + + " is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.", + ); + return Asyncify.whenDone().then(onDone); + } + ret = onDone(ret); + if (asyncMode) return Promise.resolve(ret); + return ret; + }; + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + Module["requestAnimationFrame"] = MainLoop.requestAnimationFrame; + Module["pauseMainLoop"] = MainLoop.pause; + Module["resumeMainLoop"] = MainLoop.resume; + MainLoop.init(); + function checkIncomingModuleAPI() { + ignoredModuleProp("fetchSettings"); + } + var wasmImports = { + __assert_fail: ___assert_fail, + __syscall_fcntl64: ___syscall_fcntl64, + __syscall_fstat64: ___syscall_fstat64, + __syscall_ioctl: ___syscall_ioctl, + __syscall_openat: ___syscall_openat, + _abort_js: __abort_js, + _emscripten_runtime_keepalive_clear: __emscripten_runtime_keepalive_clear, + _mmap_js: __mmap_js, + _munmap_js: __munmap_js, + _setitimer_js: __setitimer_js, + emscripten_date_now: _emscripten_date_now, + emscripten_resize_heap: _emscripten_resize_heap, + emscripten_run_script_int: _emscripten_run_script_int, + emscripten_sleep: _emscripten_sleep, + exit: _exit, + fd_close: _fd_close, + fd_read: _fd_read, + fd_seek: _fd_seek, + fd_write: _fd_write, + proc_exit: _proc_exit, + }; + var wasmExports = await createWasm(); + var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0); + var _malloc = (Module["_malloc"] = createExportWrapper("malloc", 1)); + var _free = (Module["_free"] = createExportWrapper("free", 1)); + var _send_int_to_C = (Module["_send_int_to_C"] = createExportWrapper( + "send_int_to_C", + 1, + )); + var _send_float_to_C = (Module["_send_float_to_C"] = createExportWrapper( + "send_float_to_C", + 1, + )); + var _send_double_to_C = (Module["_send_double_to_C"] = createExportWrapper( + "send_double_to_C", + 1, + )); + var _send_char_to_C = (Module["_send_char_to_C"] = createExportWrapper( + "send_char_to_C", + 1, + )); + var _send_string_to_C = (Module["_send_string_to_C"] = createExportWrapper( + "send_string_to_C", + 1, + )); + var _reanudar_ejecucion = (Module["_reanudar_ejecucion"] = + createExportWrapper("reanudar_ejecucion", 1)); + var _strerror = createExportWrapper("strerror", 1); + var _fflush = createExportWrapper("fflush", 1); + var _main = (Module["_main"] = createExportWrapper("__main_argc_argv", 2)); + var _emscripten_builtin_memalign = createExportWrapper( + "emscripten_builtin_memalign", + 2, + ); + var __emscripten_timeout = createExportWrapper("_emscripten_timeout", 2); + var _emscripten_stack_init = wasmExports["emscripten_stack_init"]; + var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"]; + var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"]; + var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"]; + var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]; + var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]; + var _emscripten_stack_get_current = + wasmExports["emscripten_stack_get_current"]; + var ___cxa_increment_exception_refcount = createExportWrapper( + "__cxa_increment_exception_refcount", + 1, + ); + var dynCall_jj = (Module["dynCall_jj"] = createExportWrapper( + "dynCall_jj", + 2, + )); + var dynCall_jjjj = (Module["dynCall_jjjj"] = createExportWrapper( + "dynCall_jjjj", + 4, + )); + var dynCall_vjj = (Module["dynCall_vjj"] = createExportWrapper( + "dynCall_vjj", + 3, + )); + var dynCall_ijjj = (Module["dynCall_ijjj"] = createExportWrapper( + "dynCall_ijjj", + 4, + )); + var dynCall_ijii = (Module["dynCall_ijii"] = createExportWrapper( + "dynCall_ijii", + 4, + )); + var dynCall_ij = (Module["dynCall_ij"] = createExportWrapper( + "dynCall_ij", + 2, + )); + var dynCall_jjii = (Module["dynCall_jjii"] = createExportWrapper( + "dynCall_jjii", + 4, + )); + var dynCall_jjji = (Module["dynCall_jjji"] = createExportWrapper( + "dynCall_jjji", + 4, + )); + var dynCall_ijdiiii = (Module["dynCall_ijdiiii"] = createExportWrapper( + "dynCall_ijdiiii", + 7, + )); + var dynCall_v = (Module["dynCall_v"] = createExportWrapper("dynCall_v", 1)); + var dynCall_vi = (Module["dynCall_vi"] = createExportWrapper( + "dynCall_vi", + 2, + )); + var _asyncify_start_unwind = createExportWrapper( + "asyncify_start_unwind", + 1, + ); + var _asyncify_stop_unwind = createExportWrapper("asyncify_stop_unwind", 0); + var _asyncify_start_rewind = createExportWrapper( + "asyncify_start_rewind", + 1, + ); + var _asyncify_stop_rewind = createExportWrapper("asyncify_stop_rewind", 0); + function applySignatureConversions(wasmExports) { + wasmExports = Object.assign({}, wasmExports); + var makeWrapper_pp = (f) => (a0) => Number(f(BigInt(a0))); + var makeWrapper__p = (f) => (a0) => f(BigInt(a0)); + var makeWrapper_p_ = (f) => (a0) => Number(f(a0)); + var makeWrapper___PP = (f) => (a0, a1, a2) => + f(a0, BigInt(a1 ? a1 : 0), BigInt(a2 ? a2 : 0)); + var makeWrapper_ppp = (f) => (a0, a1) => + Number(f(BigInt(a0), BigInt(a1))); + var makeWrapper_p = (f) => () => Number(f()); + var makeWrapper__p_ = (f) => (a0, a1) => f(BigInt(a0), a1); + var makeWrapper__p___ = (f) => (a0, a1, a2, a3) => + f(BigInt(a0), a1, a2, a3); + var makeWrapper__p__ = (f) => (a0, a1, a2) => f(BigInt(a0), a1, a2); + var makeWrapper__p______ = (f) => (a0, a1, a2, a3, a4, a5, a6) => + f(BigInt(a0), a1, a2, a3, a4, a5, a6); + wasmExports["malloc"] = makeWrapper_pp(wasmExports["malloc"]); + wasmExports["free"] = makeWrapper__p(wasmExports["free"]); + wasmExports["strerror"] = makeWrapper_p_(wasmExports["strerror"]); + wasmExports["fflush"] = makeWrapper__p(wasmExports["fflush"]); + wasmExports["__main_argc_argv"] = makeWrapper___PP( + wasmExports["__main_argc_argv"], + ); + wasmExports["emscripten_builtin_memalign"] = makeWrapper_ppp( + wasmExports["emscripten_builtin_memalign"], + ); + wasmExports["emscripten_stack_get_base"] = makeWrapper_p( + wasmExports["emscripten_stack_get_base"], + ); + wasmExports["emscripten_stack_get_end"] = makeWrapper_p( + wasmExports["emscripten_stack_get_end"], + ); + wasmExports["_emscripten_stack_restore"] = makeWrapper__p( + wasmExports["_emscripten_stack_restore"], + ); + wasmExports["_emscripten_stack_alloc"] = makeWrapper_pp( + wasmExports["_emscripten_stack_alloc"], + ); + wasmExports["emscripten_stack_get_current"] = makeWrapper_p( + wasmExports["emscripten_stack_get_current"], + ); + wasmExports["__cxa_increment_exception_refcount"] = makeWrapper__p( + wasmExports["__cxa_increment_exception_refcount"], + ); + wasmExports["dynCall_jj"] = makeWrapper__p_(wasmExports["dynCall_jj"]); + wasmExports["dynCall_jjjj"] = makeWrapper__p___( + wasmExports["dynCall_jjjj"], + ); + wasmExports["dynCall_vjj"] = makeWrapper__p__(wasmExports["dynCall_vjj"]); + wasmExports["dynCall_ijjj"] = makeWrapper__p___( + wasmExports["dynCall_ijjj"], + ); + wasmExports["dynCall_ijii"] = makeWrapper__p___( + wasmExports["dynCall_ijii"], + ); + wasmExports["dynCall_ij"] = makeWrapper__p_(wasmExports["dynCall_ij"]); + wasmExports["dynCall_jjii"] = makeWrapper__p___( + wasmExports["dynCall_jjii"], + ); + wasmExports["dynCall_jjji"] = makeWrapper__p___( + wasmExports["dynCall_jjji"], + ); + wasmExports["dynCall_ijdiiii"] = makeWrapper__p______( + wasmExports["dynCall_ijdiiii"], + ); + wasmExports["dynCall_v"] = makeWrapper__p(wasmExports["dynCall_v"]); + wasmExports["dynCall_vi"] = makeWrapper__p_(wasmExports["dynCall_vi"]); + wasmExports["asyncify_start_unwind"] = makeWrapper__p( + wasmExports["asyncify_start_unwind"], + ); + wasmExports["asyncify_start_rewind"] = makeWrapper__p( + wasmExports["asyncify_start_rewind"], + ); + return wasmExports; + } + Module["run"] = run; + Module["callMain"] = callMain; + Module["ccall"] = ccall; + Module["stringToUTF8"] = stringToUTF8; + Module["lengthBytesUTF8"] = lengthBytesUTF8; + var missingLibrarySymbols = [ + "writeI53ToI64", + "writeI53ToI64Clamped", + "writeI53ToI64Signaling", + "writeI53ToU64Clamped", + "writeI53ToU64Signaling", + "readI53FromI64", + "readI53FromU64", + "convertI32PairToI53", + "convertI32PairToI53Checked", + "convertU32PairToI53", + "getTempRet0", + "setTempRet0", + "inetPton4", + "inetNtop4", + "inetPton6", + "inetNtop6", + "readSockaddr", + "writeSockaddr", + "emscriptenLog", + "readEmAsmArgs", + "jstoi_q", + "getExecutableName", + "listenOnce", + "autoResumeAudioContext", + "dynCallLegacy", + "getDynCaller", + "dynCall", + "asmjsMangle", + "HandleAllocator", + "getNativeTypeSize", + "addOnInit", + "addOnPostCtor", + "addOnPreMain", + "addOnExit", + "STACK_SIZE", + "STACK_ALIGN", + "POINTER_SIZE", + "ASSERTIONS", + "cwrap", + "uleb128Encode", + "generateFuncType", + "convertJsFunctionToWasm", + "getEmptyTableSlot", + "updateTableMap", + "getFunctionAddress", + "addFunction", + "removeFunction", + "reallyNegative", + "unSign", + "strLen", + "reSign", + "formatString", + "intArrayToString", + "AsciiToString", + "stringToAscii", + "UTF16ToString", + "stringToUTF16", + "lengthBytesUTF16", + "UTF32ToString", + "stringToUTF32", + "lengthBytesUTF32", + "stringToNewUTF8", + "registerKeyEventCallback", + "maybeCStringToJsString", + "findEventTarget", + "getBoundingClientRect", + "fillMouseEventData", + "registerMouseEventCallback", + "registerWheelEventCallback", + "registerUiEventCallback", + "registerFocusEventCallback", + "fillDeviceOrientationEventData", + "registerDeviceOrientationEventCallback", + "fillDeviceMotionEventData", + "registerDeviceMotionEventCallback", + "screenOrientation", + "fillOrientationChangeEventData", + "registerOrientationChangeEventCallback", + "fillFullscreenChangeEventData", + "registerFullscreenChangeEventCallback", + "JSEvents_requestFullscreen", + "JSEvents_resizeCanvasForFullscreen", + "registerRestoreOldStyle", + "hideEverythingExceptGivenElement", + "restoreHiddenElements", + "setLetterbox", + "softFullscreenResizeWebGLRenderTarget", + "doRequestFullscreen", + "fillPointerlockChangeEventData", + "registerPointerlockChangeEventCallback", + "registerPointerlockErrorEventCallback", + "requestPointerLock", + "fillVisibilityChangeEventData", + "registerVisibilityChangeEventCallback", + "registerTouchEventCallback", + "fillGamepadEventData", + "registerGamepadEventCallback", + "registerBeforeUnloadEventCallback", + "fillBatteryEventData", + "battery", + "registerBatteryEventCallback", + "setCanvasElementSize", + "getCanvasElementSize", + "jsStackTrace", + "getCallstack", + "convertPCtoSourceLocation", + "getEnvStrings", + "checkWasiClock", + "wasiRightsToMuslOFlags", + "wasiOFlagsToMuslOFlags", + "setImmediateWrapped", + "safeRequestAnimationFrame", + "clearImmediateWrapped", + "registerPostMainLoop", + "registerPreMainLoop", + "getPromise", + "makePromise", + "idsToPromises", + "makePromiseCallback", + "ExceptionInfo", + "findMatchingCatch", + "Browser_asyncPrepareDataCounter", + "isLeapYear", + "ydayFromDate", + "arraySum", + "addDays", + "getSocketFromFD", + "getSocketAddress", + "FS_unlink", + "FS_mkdirTree", + "_setNetworkCallback", + "heapObjectForWebGLType", + "toTypedArrayIndex", + "webgl_enable_ANGLE_instanced_arrays", + "webgl_enable_OES_vertex_array_object", + "webgl_enable_WEBGL_draw_buffers", + "webgl_enable_WEBGL_multi_draw", + "webgl_enable_EXT_polygon_offset_clamp", + "webgl_enable_EXT_clip_control", + "webgl_enable_WEBGL_polygon_mode", + "emscriptenWebGLGet", + "computeUnpackAlignedImageSize", + "colorChannelsInGlTextureFormat", + "emscriptenWebGLGetTexPixelData", + "emscriptenWebGLGetUniform", + "webglGetUniformLocation", + "webglPrepareUniformLocationsBeforeFirstUse", + "webglGetLeftBracePos", + "emscriptenWebGLGetVertexAttrib", + "__glGetActiveAttribOrUniform", + "writeGLArray", + "registerWebGlEventCallback", + "ALLOC_NORMAL", + "ALLOC_STACK", + "allocate", + "writeStringToMemory", + "writeAsciiToMemory", + "setErrNo", + "demangle", + "stackTrace", + ]; + missingLibrarySymbols.forEach(missingLibrarySymbol); + var unexportedSymbols = [ + "addRunDependency", + "removeRunDependency", + "out", + "err", + "abort", + "wasmMemory", + "wasmExports", + "writeStackCookie", + "checkStackCookie", + "INT53_MAX", + "INT53_MIN", + "bigintToI53Checked", + "stackSave", + "stackRestore", + "stackAlloc", + "ptrToString", + "zeroMemory", + "exitJS", + "getHeapMax", + "growMemory", + "ENV", + "ERRNO_CODES", + "strError", + "DNS", + "Protocols", + "Sockets", + "timers", + "warnOnce", + "readEmAsmArgsArray", + "jstoi_s", + "handleException", + "keepRuntimeAlive", + "runtimeKeepalivePush", + "runtimeKeepalivePop", + "callUserCallback", + "maybeExit", + "asyncLoad", + "alignMemory", + "mmapAlloc", + "wasmTable", + "noExitRuntime", + "addOnPreRun", + "addOnPostRun", + "getCFunc", + "sigToWasmTypes", + "freeTableIndexes", + "functionsInTableMap", + "setValue", + "getValue", + "PATH", + "PATH_FS", + "UTF8Decoder", + "UTF8ArrayToString", + "UTF8ToString", + "stringToUTF8Array", + "intArrayFromString", + "UTF16Decoder", + "stringToUTF8OnStack", + "writeArrayToMemory", + "JSEvents", + "specialHTMLTargets", + "findCanvasEventTarget", + "currentFullscreenStrategy", + "restoreOldWindowedStyle", + "UNWIND_CACHE", + "ExitStatus", + "doReadv", + "doWritev", + "initRandomFill", + "randomFill", + "safeSetTimeout", + "emSetImmediate", + "emClearImmediate_deps", + "emClearImmediate", + "promiseMap", + "uncaughtExceptionCount", + "exceptionLast", + "exceptionCaught", + "Browser", + "getPreloadedImageData__data", + "wget", + "MONTH_DAYS_REGULAR", + "MONTH_DAYS_LEAP", + "MONTH_DAYS_REGULAR_CUMULATIVE", + "MONTH_DAYS_LEAP_CUMULATIVE", + "SYSCALLS", + "preloadPlugins", + "FS_createPreloadedFile", + "FS_modeStringToFlags", + "FS_getMode", + "FS_stdin_getChar_buffer", + "FS_stdin_getChar", + "FS_createPath", + "FS_createDevice", + "FS_readFile", + "FS", + "FS_createDataFile", + "FS_createLazyFile", + "MEMFS", + "TTY", + "PIPEFS", + "SOCKFS", + "tempFixedLengthArray", + "miniTempWebGLFloatBuffers", + "miniTempWebGLIntBuffers", + "GL", + "AL", + "GLUT", + "EGL", + "GLEW", + "IDBStore", + "runAndAbortIfError", + "Asyncify", + "Fibers", + "SDL", + "SDL_gfx", + "allocateUTF8", + "allocateUTF8OnStack", + "print", + "printErr", + ]; + unexportedSymbols.forEach(unexportedRuntimeSymbol); + var calledRun; + function callMain(args = []) { + assert( + runDependencies == 0, + 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])', + ); + assert( + typeof onPreRuns === "undefined" || onPreRuns.length == 0, + "cannot call main when preRun functions remain to be called", + ); + var entryFunction = _main; + args.unshift(thisProgram); + var argc = args.length; + var argv = stackAlloc((argc + 1) * 8); + var argv_ptr = argv; + args.forEach((arg) => { + HEAPU64[argv_ptr / 8] = BigInt(stringToUTF8OnStack(arg)); + argv_ptr += 8; + }); + HEAPU64[argv_ptr / 8] = BigInt(0); + try { + var ret = entryFunction(argc, BigInt(argv)); + exitJS(ret, true); + return ret; + } catch (e) { + return handleException(e); + } + } + function stackCheckInit() { + _emscripten_stack_init(); + writeStackCookie(); + } + function run(args = arguments_) { + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + stackCheckInit(); + preRun(); + if (runDependencies > 0) { + // dependenciesFulfilled = run; + return; + } + function doRun() { + assert(!calledRun); + calledRun = true; + Module["calledRun"] = true; + if (ABORT) return; + initRuntime(); + FS.writeFile("output.elf", args[0]); + args.shift(); + preMain(); + readyPromiseResolve(Module); + Module["onRuntimeInitialized"]?.(); + var noInitialRun = Module["noInitialRun"]; + legacyModuleProp("noInitialRun", "noInitialRun"); + callMain(args); + postRun(); + } + if (Module["setStatus"]) { + Module["setStatus"]("Running..."); + setTimeout(() => { + setTimeout(() => Module["setStatus"](""), 1); + doRun(); + }, 1); + } else { + doRun(); + } + checkStackCookie(); + } + function checkUnflushedContent() { + var oldOut = out; + var oldErr = err; + var has = false; + out = err = (x) => { + has = true; + }; + try { + _fflush(0); + ["stdout", "stderr"].forEach((name) => { + var info = FS.analyzePath("/dev/" + name); + if (!info) return; + var stream = info.object; + var rdev = stream.rdev; + var tty = TTY.ttys[rdev]; + if (tty?.output?.length) { + has = true; + } + }); + } catch (e) {} + out = oldOut; + err = oldErr; + if (has) { + warnOnce( + "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.", + ); + } + } + if (Module["preInit"]) { + if (typeof Module["preInit"] == "function") + Module["preInit"] = [Module["preInit"]]; + while (Module["preInit"].length > 0) { + Module["preInit"].pop()(); + } + } + // run(); + moduleRtn = readyPromise; + for (const prop of Object.keys(Module)) { + if (!(prop in moduleArg)) { + Object.defineProperty(moduleArg, prop, { + configurable: true, + get() { + abort( + `Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`, + ); + }, + }); + } + } + readyPromiseResolve(Module); + return moduleRtn; + }; +})(); +(() => { + // Create a small, never-async wrapper around Module which + // checks for callers incorrectly using it with `new`. + var real_Module = Module; + Module = function (arg) { + if (new.target) + throw new Error("Module() should not be called with `new Module()`"); + return real_Module(arg); + }; +})(); +export default Module; diff --git a/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.wasm b/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.wasm new file mode 100755 index 000000000..4b9eb37bc Binary files /dev/null and b/src/core/executor/sailSimRV/wasm/riscv_sim_RV64.wasm differ diff --git a/src/core/memory/Memory.mts b/src/core/memory/Memory.mts index 4d1967d7c..45c68e151 100644 --- a/src/core/memory/Memory.mts +++ b/src/core/memory/Memory.mts @@ -136,8 +136,8 @@ * Interface for processed memory segment information */ interface MemorySegment { - start: bigint; // Parsed start address - end: bigint; // Parsed end address + start: number; // Parsed start address + end: number; // Parsed end address size: bigint; } @@ -146,7 +146,7 @@ interface MemorySegment { */ interface MemoryHint { address: bigint; - tag: string; + tag: string[]; type: string; sizeInBits?: number; // Optional size of the type in bits } @@ -168,11 +168,10 @@ export interface MemoryBackup { values: number[]; bitsPerByte: number; size: number; - hints?: { + hints: { address: string; - tag?: string; - type?: string; - hint?: string; + tag: string[]; + type: string; sizeInBits?: number; }[]; } @@ -262,12 +261,11 @@ export class Memory { * * @example Memory with layout segments * ```typescript - * const layout = [ - * { name: "text start", value: "0x0000" }, - * { name: "text end", value: "0x1000" }, - * { name: "data start", value: "0x1010" }, - * { name: "data end", value: "0x2000" } - * ]; + * const layout = new Map([ + * [ "text", { start: 0x0000, end: 0x1000 } ], + * [ "data", { start: 0x1010, end: 0x2000 } ], + * [ "stack", { start: 0xFFFF, end: 0xFFFF } ], + * ]); * const memory = new Memory({ * sizeInBytes: 0x10000, * memoryLayout: layout, @@ -341,7 +339,7 @@ export class Memory { } // Initialize memory layout and segments - this.memoryLayout = memoryLayout; + this.memoryLayout = new Map(memoryLayout); this.segmentCache = new Map(); // Initialize hints system @@ -369,6 +367,30 @@ export class Memory { this.uint8View.fill(0); } + /** + * Gets the index of the address within the memory + * + * @param address - Memory address to use + * @returns Index of the address within the memory + * @throws Error if the address is outside of the range of the memory + */ + getIndex(address: bigint): number { + if (address < this.baseAddress) { + throw new Error( + `Address ${address} is below base address ${this.baseAddress}`, + ); + } + + const addrIndex = Number(address - this.baseAddress); + if (addrIndex >= this.size) { + throw new Error( + `Address ${addrIndex} exceeds memory size ${this.size} (+${this.baseAddress})`, + ); + } + + return addrIndex; + } + /** * Reads a single byte from memory at the specified address. * @@ -396,19 +418,7 @@ export class Memory { * ``` */ read(address: bigint): number { - // check address - if (address < this.baseAddress) { - throw new Error( - `Address ${address} is below base address ${this.baseAddress}`, - ); - } - - const addrIndex = Number(address - this.baseAddress); - if (addrIndex >= this.size) { - throw new Error( - `Address ${addrIndex} exceeds memory size ${this.size} (+${this.baseAddress})`, - ); - } + const addrIndex = this.getIndex(address); if (this.bitsPerByte === 8) { return this.uint8View[addrIndex]!; @@ -481,19 +491,8 @@ export class Memory { * ``` */ write(address: bigint, value: number): void { - // check address - if (address < this.baseAddress) { - throw new Error( - `Address ${address} is below base address ${this.baseAddress}`, - ); - } + const addrIndex = this.getIndex(address); - const addrIndex = Number(address - this.baseAddress); - if (addrIndex >= this.size) { - throw new Error( - `Address ${address} exceeds memory size ${this.size} (+${this.baseAddress})`, - ); - } if (value > this.maxByteValue || value < 0) { throw new Error( `Value ${value} exceeds byte size (max: ${this.maxByteValue})`, @@ -549,6 +548,34 @@ export class Memory { } } + + /** + * Extends a memory segment by N bytes from the end + * + * @param bytes - Amount of bytes to extend the segment by + * @param segmentName - Name of the segment to extend + * @returns Starting address of the allocation + * + * @throws Error if the segment name doesn't exist on the layout + */ + alloc(bytes: number, segmentName: string): bigint { + const segment = this.memoryLayout.get(segmentName); + if (!segment) + throw new Error(`Segment "${segmentName}" doesn't exist`); + const addr = BigInt(segment.end) + 1n; + const end = BigInt(segment.end) + BigInt(bytes); + const idx = Number(end - this.baseAddress); + if (idx >= this.size) { + // Address is outside of the memory, we need to grow the buffer + this.size = idx + 1; + this.buffer = this.buffer.transfer(this.size); + this.uint8View = new Uint8Array(this.buffer); + } + // Update the segment data + segment.end = Number(end); + return addr; + } + /** * Loads ROM data into memory starting at the specified offset. * This method only works with 8-bit byte memories for direct compatibility @@ -622,33 +649,36 @@ export class Memory { readBytes(address: bigint, count: number): number[] { const result: number[] = []; for (let i = 0; i < count; i++) { - result.push(this.read(BigInt(address) + BigInt(i))); + result.push(this.read(address + BigInt(i))); } return result; } /** - * Returns the addreses that have been written + * Returns an array of all addresses that have been written to. + * + * @returns Array of written addresses (number), sorted in ascending order. + * + * @example + * ```typescript + * const memory = new Memory({ sizeInBytes: 100 }); + * memory.write(5n, 123); + * memory.write(10n, 255); + * const written = memory.getWrittenAddresses(); // [5, 10] + * ``` */ - getWritten(): Array<{ addr: number; value: number }> { - return ( - Array.from(this.writtenAddresses) - // Sort addresses to ensure consistent output - .sort((a, b) => a - b) - .map((addr, _i, _arr) => ({ - addr, - value: this.read(BigInt(addr)), - })) - ); + getWrittenAddresses(): number[] { + // Sort addresses to ensure consistent output + return Array.from(this.writtenAddresses).sort((a, b) => a - b); } /** - * Returns all memory addreses and values. + * Returns the addresses that have been written to, along with their value */ - getAll(): Array<{ addr: number; value: number }> { - return Array.from(this.uint8View).map((value, i) => ({ - addr: Number(this.baseAddress) + i, - value, + getWritten(): Array<{ addr: number; value: number }> { + return this.getWrittenAddresses().map(addr => ({ + addr, + value: this.read(BigInt(addr)), })); } @@ -664,7 +694,7 @@ export class Memory { * const memory = new Memory({ sizeInBytes: 1000000 }); * memory.write(100n, 123); * memory.write(50000n, 456); - * memory.addHint(100n, "int32", 32); + * memory.addHint(100n, [], "int32", 32); * * const snapshot = memory.dump(); // Only contains 2 entries, not 1M, plus hints * memory.restore(snapshot); @@ -675,9 +705,7 @@ export class Memory { const values: number[] = []; // Sort addresses to ensure consistent output - const sortedAddresses = Array.from(this.writtenAddresses).sort( - (a, b) => a - b, - ); + const sortedAddresses = this.getWrittenAddresses(); for (const addr of sortedAddresses) { addresses.push(addr); @@ -687,7 +715,7 @@ export class Memory { // Include hints in the dump const hints: { address: string; - tag: string; + tag: string[]; type: string; sizeInBits?: number; }[] = []; @@ -721,14 +749,14 @@ export class Memory { * @example Restoring memory state * ```typescript * const memory = new Memory({ sizeInBytes: 100000, bitsPerByte: 8 }); - * memory.addHint(0x100n, "int32", 32); + * memory.addHint(0x100n, [], "int32", 32); * const snapshot = memory.dump(); * // ... modify memory ... * memory.restore(snapshot); // Back to original state with hints * ``` */ restore(dump: MemoryBackup): void { - if (dump.bitsPerByte !== this.bitsPerByte || dump.size !== this.size) { + if (dump.bitsPerByte !== this.bitsPerByte || dump.size > this.size) { throw new Error( "Dump metadata does not match current memory configuration", ); @@ -753,31 +781,15 @@ export class Memory { } } - // Restore hints if they exist in the dump + // Restore hints this.hints.clear(); - if (dump.hints) { - for (const hint of dump.hints) { - // Backward compatibility: if only "hint" exists, split it - let tag = hint.tag; - let type = hint.type; - if (!tag && !type && typeof hint.hint === "string") { - // Try to split "type:tag" or "type" or "tag" - const m = /^<([^>]+)>(?::(.*))?$/.exec(hint.hint); - if (m) { - type = m[1]; - tag = m[2] || ""; - } else { - tag = hint.hint; - type = ""; - } - } - this.hints.set(BigInt(hint.address), { - address: BigInt(hint.address), - tag: tag || "", - type: type || "", - sizeInBits: hint.sizeInBits, - }); - } + for (const hint of dump.hints) { + this.hints.set(BigInt(hint.address), { + address: BigInt(hint.address), + tag: hint.tag, + type: hint.type, + sizeInBits: hint.sizeInBits, + }); } } @@ -925,12 +937,7 @@ export class Memory { } // Sort addresses from highest to lowest - usedAddresses.sort((a, b) => { - if (a > b) return -1; - if (a < b) return 1; - return 0; - }); - + usedAddresses.sort((a, b) => Number(b - a)); return usedAddresses; } @@ -968,20 +975,6 @@ export class Memory { throw new Error(`Value must be a bigint, got ${typeof value}`); } - // Special case for 8-bit bytes - use standard approach - if (this.bitsPerByte === 8) { - const bytes: number[] = []; - let remainingValue = value; - - while (remainingValue > 0n) { - bytes.unshift(Number(remainingValue & 0xffn)); - remainingValue >>= 8n; - } - - return bytes.length === 0 ? [0] : bytes; - } - - // For custom byte sizes const bytes: number[] = []; let remainingValue = value; const maxByteValueBigInt = BigInt(this.maxByteValue); @@ -1027,18 +1020,7 @@ export class Memory { */ readWord(address: bigint): number[] { // check address - if (address < this.baseAddress) { - throw new Error( - `Address ${address} is below base address ${this.baseAddress}`, - ); - } - - const addrIndex = Number(address - this.baseAddress); - if (addrIndex >= this.size) { - throw new Error( - `Address ${addrIndex} exceeds memory size ${this.size} (+${this.baseAddress})`, - ); - } + this.getIndex(address); const bytes: number[] = []; for (let i = 0n; i < this.wordSize; i++) { @@ -1098,18 +1080,7 @@ export class Memory { */ writeWord(address: bigint, word: number[]): void { // check address - if (address < this.baseAddress) { - throw new Error( - `Address ${address} is below base address ${this.baseAddress}`, - ); - } - - const addrIndex = Number(address - this.baseAddress); - if (addrIndex >= this.size) { - throw new Error( - `Address ${addrIndex} exceeds memory size ${this.size} (+${this.baseAddress})`, - ); - } + this.getIndex(address); if (word.length !== this.wordSize) { throw new Error( @@ -1347,21 +1318,24 @@ export class Memory { * @example Adding hints * ```typescript * const memory = new Memory({ sizeInBytes: 1024 }); - * memory.addHint(0x100n, "", "double", 64); // No tag, just type - * memory.addHint(0x200n, "myVar", "int32", 32); - * memory.addHint(0x300n, "myString", "string"); // No size specified + * memory.addHint(0x100n, [], "double", 64); // No tag, just type + * memory.addHint(0x200n, ["myVar"], "int32", 32); + * memory.addHint(0x300n, ["myString"], "string"); // No size specified + * memory.addHint(0x400n, ["foo", "bar"], "int32", 32); // Multiple tags * ``` */ addHint( address: bigint, - tag: string, + tag: string | string[], type: string, sizeInBits?: number, ): void { // If no tag is provided and a hint exists, preserve the existing tag - let finalTag = tag; + let finalTag; + if (typeof tag === "string") finalTag = tag === "" ? [] : [tag]; + else finalTag = tag; const existing = this.hints.get(address); - if ((!tag || tag === "") && existing) { + if (tag.length === 0 && existing) { finalTag = existing.tag; } this.hints.set(address, { @@ -1381,7 +1355,7 @@ export class Memory { * @example Removing hints * ```typescript * const memory = new Memory({ sizeInBytes: 1024 }); - * memory.addHint(0x100n, "double", 64); + * memory.addHint(0x100n, [], "double", 64); * const removed = memory.removeHint(0x100n); // true * const notFound = memory.removeHint(0x200n); // false * ``` @@ -1399,7 +1373,7 @@ export class Memory { * @example Getting hints * ```typescript * const memory = new Memory({ sizeInBytes: 1024 }); - * memory.addHint(0x100n, "double", 64); + * memory.addHint(0x100n, [], "double", 64); * * const hint = memory.getHint(0x100n); * if (hint) { @@ -1422,8 +1396,8 @@ export class Memory { * @example Getting all hints * ```typescript * const memory = new Memory({ sizeInBytes: 1024 }); - * memory.addHint(0x200n, "int32", 32); - * memory.addHint(0x100n, "double", 64); + * memory.addHint(0x200n, [], "int32", 32); + * memory.addHint(0x100n, [], "double", 64); * * const hints = memory.getAllHints(); * for (const hint of hints) { @@ -1436,11 +1410,7 @@ export class Memory { */ getAllHints(): MemoryHint[] { const hints = Array.from(this.hints.values()); - hints.sort((a, b) => { - if (a.address < b.address) return -1; - if (a.address > b.address) return 1; - return 0; - }); + hints.sort((a, b) => Number(a.address - b.address)); return hints; } @@ -1450,8 +1420,8 @@ export class Memory { * @example Clearing hints * ```typescript * const memory = new Memory({ sizeInBytes: 1024 }); - * memory.addHint(0x100n, "double", 64); - * memory.addHint(0x200n, "int32", 32); + * memory.addHint(0x100n, [], "double", 64); + * memory.addHint(0x200n, [], "int32", 32); * * console.log(memory.getAllHints().length); // 2 * memory.clearHints(); @@ -1462,23 +1432,6 @@ export class Memory { this.hints.clear(); } - /** - * Returns an array of all addresses that have been written to. - * - * @returns Array of written addresses (number), sorted in ascending order. - * - * @example - * ```typescript - * const memory = new Memory({ sizeInBytes: 100 }); - * memory.write(5n, 123); - * memory.write(10n, 255); - * const written = memory.getWrittenAddresses(); // [5, 10] - * ``` - */ - getWrittenAddresses(): number[] { - return Array.from(this.writtenAddresses).sort((a, b) => a - b); - } - /** * Gets hints within a specified address range. * @@ -1489,9 +1442,9 @@ export class Memory { * @example Getting hints in range * ```typescript * const memory = new Memory({ sizeInBytes: 1024 }); - * memory.addHint(0x100n, "double", 64); - * memory.addHint(0x200n, "int32", 32); - * memory.addHint(0x300n, "string"); + * memory.addHint(0x100n, [], "double", 64); + * memory.addHint(0x200n, [], "int32", 32); + * memory.addHint(0x300n, [], "string"); * * const hintsInRange = memory.getHintsInRange(0x150n, 0x250n); * console.log(hintsInRange.length); // 1 (only the int32 at 0x200) @@ -1504,11 +1457,7 @@ export class Memory { hintsInRange.push(hint); } } - hintsInRange.sort((a, b) => { - if (a.address < b.address) return -1; - if (a.address > b.address) return 1; - return 0; - }); + hintsInRange.sort((a, b) => Number(a.address - b.address)); return hintsInRange; } } diff --git a/src/core/memory/StackTracker.mts b/src/core/memory/StackTracker.mts index cc462fa56..1843f23c3 100644 --- a/src/core/memory/StackTracker.mts +++ b/src/core/memory/StackTracker.mts @@ -17,7 +17,7 @@ * along with CREATOR. If not, see . */ -import { REGISTERS } from "../core.mjs"; +import { architecture, REGISTERS } from "../core.mjs"; /** * Represents a stack frame, with a begin and end address @@ -71,6 +71,7 @@ export class StackTracker { public reset() { this.frames.length = 0; this.hints.clear(); + this.newFrame(architecture.config.main_function); } /** diff --git a/src/core/register/registerOperations.mjs b/src/core/register/registerOperations.mjs index 58ff9dc4a..be6d578b9 100644 --- a/src/core/register/registerOperations.mjs +++ b/src/core/register/registerOperations.mjs @@ -20,10 +20,13 @@ import { architecture, status, REGISTERS } from "../core.mjs"; import { writeStackLimit } from "../executor/executor.mjs"; import { instructions } from "../assembler/assembler.mjs"; -import { sentinel } from "../sentinel/sentinel.mjs"; +import { sentinel } from "../sentinel/sentinel.mts"; import { packExecute } from "../utils/utils.mjs"; import { coreEvents } from "../events.mts"; import { setRegisterGlow } from "./registerGlowState.mjs"; +import { userMode32 } from "@/core/executor/sailSimRV/wasm/riscv_sim_RV32.js"; +import { userMode32vd } from "@/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js"; +import { userMode64 } from "@/core/executor/sailSimRV/wasm/riscv_sim_RV64.js"; /** * Notifies UI layers about a register update via event emission @@ -116,12 +119,7 @@ export function writeRegister(value, indexComp, indexElem) { } draw.danger.push(status.execution_index); - throw packExecute( - true, - "The register " + elementName + " cannot be written", - "danger", - null, - ); + throw new Error(`The register ${elementName} is not writeable`); } element.value = value; @@ -132,6 +130,12 @@ export function writeRegister(value, indexComp, indexElem) { } if (typeof document !== "undefined" && document?.app) { // Notify UI layers about the update (CLI ignores, web UI listens) - notifyRegisterUpdate(indexComp, indexElem); + // check if in RISC-V Sail has to be glowed the register by instruction execution + if (architecture.config.name.includes("SRV")){ + if (userMode32 || userMode64 || userMode32vd) + notifyRegisterUpdate(indexComp, indexElem); + }else + notifyRegisterUpdate(indexComp, indexElem); + } } diff --git a/src/core/sentinel/sentinel.mjs b/src/core/sentinel/sentinel.mjs deleted file mode 100644 index 52eadac62..000000000 --- a/src/core/sentinel/sentinel.mjs +++ /dev/null @@ -1,499 +0,0 @@ -/** - * Copyright 2018-2026 CREATOR Team. - * - * This file is part of CREATOR. - * - * CREATOR is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * CREATOR 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with CREATOR. If not, see . - */ - -import { architecture, REGISTERS } from "../core.mjs"; -import { console_log } from "../utils/creator_logger.mjs"; - -/** - * Event types that can occur during function execution - */ -const EventType = { - WRITE_MEMORY: "write_memory", - READ_MEMORY: "read_memory", - WRITE_REGISTER: "write_register", - READ_REGISTER: "read_register", -}; - -// Helpers for safe BigInt conversions and comparisons -function toBigIntSafe(v) { - if (v === null || typeof v === "undefined") return null; - if (typeof v === "bigint") return v; - if (typeof v === "number") { - if (!Number.isInteger(v)) return null; - return BigInt(v); - } - // strings and other types that BigInt accepts - try { - return BigInt(v); - } catch (_e) { - return null; - } -} - -function bigintsEqual(a, b) { - const A = toBigIntSafe(a); - const B = toBigIntSafe(b); - if (A === null || B === null) return false; - return A === B; -} - -function valuesEqual(a, b) { - // Handle null/undefined - if (a === null || a === undefined || b === null || b === undefined) { - return a === b; - } - - // Try BigInt comparison first - const A = toBigIntSafe(a); - const B = toBigIntSafe(b); - if (A !== null && B !== null) { - return A === B; - } - - // Fallback to strict equality - return a === b; -} - -/** - * Represents a single event in the register lifecycle - */ -class RegisterEvent { - constructor(type, regIndex, elemIndex, address = null, size = null) { - this.type = type; - this.regIndex = regIndex; - this.elemIndex = elemIndex; - // Normalize address/size to BigInt when possible to avoid mixed-type comparisons - this.address = toBigIntSafe(address); - this.size = toBigIntSafe(size); - this.timestamp = Date.now(); - } - - get registerName() { - return ( - REGISTERS[this.regIndex]?.elements[this.elemIndex]?.name || - "unknown" - ); - } - - toString() { - const addr = - this.address !== null ? ` @0x${this.address.toString(16)}` : ""; - const size = this.size !== null ? ` (${this.size} bytes)` : ""; - return `${this.type}: ${this.registerName}${addr}${size}`; - } -} - -/** - * Represents a function call frame with register state tracking - */ -class CallFrame { - constructor(functionName, stackPointer) { - this.functionName = functionName; - this.enterStackPointer = stackPointer; - this.events = []; - this.initialRegisterValues = CallFrame._captureRegisterValues(); - } - - static _captureRegisterValues() { - const values = []; - for (let i = 0; i < REGISTERS.length; i++) { - values.push([]); - for (let j = 0; j < REGISTERS[i].elements.length; j++) { - values[i].push(REGISTERS[i].elements[j].value); - } - } - return values; - } - - addEvent(event) { - this.events.push(event); - console_log( - `[EVENT] ${this.functionName}: ${event.toString()}`, - "INFO", - ); - } - - /** - * Get all events for a specific register - */ - getRegisterEvents(regIndex, elemIndex) { - return this.events.filter( - e => e.regIndex === regIndex && e.elemIndex === elemIndex, - ); - } - - /** - * Find the first save event for a register - */ - getFirstSave(regIndex, elemIndex) { - return this.events.find( - e => - e.regIndex === regIndex && - e.elemIndex === elemIndex && - e.type === EventType.WRITE_MEMORY, - ); - } - - /** - * Find the last restore event for a register - */ - getLastRestore(regIndex, elemIndex) { - const restores = this.events.filter( - e => - e.regIndex === regIndex && - e.elemIndex === elemIndex && - e.type === EventType.READ_MEMORY, - ); - return restores[restores.length - 1]; - } -} - -/** - * Validation rules for calling convention - */ -class ConventionRules { - /** - * Check if a saved register follows proper save/restore pattern - */ - static validateSavedRegister(frame, regIndex, elemIndex) { - const violations = []; - const register = REGISTERS[regIndex].elements[elemIndex]; - const events = frame.getRegisterEvents(regIndex, elemIndex); - - // Rule 1: Saved registers must be saved before modification - const firstSave = frame.getFirstSave(regIndex, elemIndex); - const modifications = events.filter( - e => - e.type === EventType.WRITE_REGISTER || - e.type === EventType.READ_REGISTER, - ); - - if (modifications.length > 0 && !firstSave) { - violations.push({ - rule: "SAVE_BEFORE_USE", - register: register.name, - message: `Register ${register.name} was used but never saved to memory`, - }); - } - - if (firstSave && modifications.length > 0) { - const firstMod = modifications[0]; - if (firstMod.timestamp < firstSave.timestamp) { - violations.push({ - rule: "SAVE_BEFORE_USE", - register: register.name, - message: `Register ${register.name} was modified before being saved`, - }); - } - } - - // Rule 2: Saved registers must be restored from the same address - const lastRestore = frame.getLastRestore(regIndex, elemIndex); - if (firstSave && !lastRestore) { - violations.push({ - rule: "RESTORE_REQUIRED", - register: register.name, - message: `Register ${register.name} was saved but never restored`, - }); - } - - if (firstSave && lastRestore) { - if (!bigintsEqual(firstSave.address, lastRestore.address)) { - const saveAddr = toBigIntSafe(firstSave.address); - const restoreAddr = toBigIntSafe(lastRestore.address); - const saveStr = - saveAddr !== null - ? `0x${saveAddr.toString(16)}` - : String(firstSave.address); - const restoreStr = - restoreAddr !== null - ? `0x${restoreAddr.toString(16)}` - : String(lastRestore.address); - violations.push({ - rule: "RESTORE_ADDRESS_MISMATCH", - register: register.name, - message: `Register ${register.name} saved at ${saveStr} but restored from ${restoreStr}`, - }); - } - } - - // Rule 3: Save and restore sizes must match - if (firstSave && lastRestore) { - const s1 = toBigIntSafe(firstSave.size); - const s2 = toBigIntSafe(lastRestore.size); - if (s1 === null || s2 === null || s1 !== s2) { - const s1Str = - s1 !== null ? s1.toString() : String(firstSave.size); - const s2Str = - s2 !== null ? s2.toString() : String(lastRestore.size); - violations.push({ - rule: "SIZE_MISMATCH", - register: register.name, - message: `Register ${register.name} saved with ${s1Str} bytes but restored with ${s2Str} bytes`, - }); - } - } - - // Rule 4: Value must be restored (if the register was modified) - const currentValue = REGISTERS[regIndex].elements[elemIndex].value; - const initialValue = frame.initialRegisterValues[regIndex]?.[elemIndex]; - - const valueChanged = !valuesEqual(currentValue, initialValue); - - if (valueChanged && modifications.length > 0) { - violations.push({ - rule: "VALUE_NOT_RESTORED", - register: register.name, - message: `Register ${register.name} value changed but not properly restored`, - }); - } - - return violations; - } - - /** - * Check stack pointer restoration - */ - static validateStackPointer(frame, currentStackPointer) { - const spEnter = toBigIntSafe(frame.enterStackPointer); - const spNow = toBigIntSafe(currentStackPointer); - if (spEnter === null || spNow === null || spEnter !== spNow) { - const enterStr = - spEnter !== null - ? `0x${spEnter.toString(16)}` - : String(frame.enterStackPointer); - const nowStr = - spNow !== null - ? `0x${spNow.toString(16)}` - : String(currentStackPointer); - return [ - { - rule: "STACK_NOT_RESTORED", - message: `Stack pointer not restored: entered at ${enterStr}, exited at ${nowStr}`, - }, - ]; - } - return []; - } -} - -/** - * Main validator class for calling conventions - */ -class CallingConventionValidator { - constructor() { - this.callStack = []; - } - - /** - * Enter a new function - */ - enter(functionName) { - const stackPointer = architecture.memory_layout.stack.start; - const frame = new CallFrame(functionName, stackPointer); - this.callStack.push(frame); - console_log(`[SENTINEL] Entering function: ${functionName}`, "INFO"); - return { ok: true, msg: "" }; - } - - /** - * Leave current function and validate - */ - leave() { - if (this.callStack.length === 0) { - return { - ok: false, - msg: "Cannot leave function: call stack is empty", - }; - } - - const frame = this.callStack[this.callStack.length - 1]; - console_log( - `[SENTINEL] Leaving function: ${frame.functionName}`, - "INFO", - ); - - const violations = []; - - // Validate stack pointer - const spViolations = ConventionRules.validateStackPointer( - frame, - architecture.memory_layout.stack.start, - ); - violations.push(...spViolations); - - // Validate each saved register - for (let i = 0; i < REGISTERS.length; i++) { - for (let j = 0; j < REGISTERS[i].elements.length; j++) { - const register = REGISTERS[i].elements[j]; - - // Only check registers that should be saved - if (register.properties.includes("saved")) { - const regViolations = ConventionRules.validateSavedRegister( - frame, - i, - j, - ); - violations.push(...regViolations); - } - } - } - - // Pop the frame - this.callStack.pop(); - - // Return result - if (violations.length > 0) { - const messages = violations.map(v => ` - ${v.message}`).join("\n"); - return { - ok: false, - msg: `Calling convention violations in ${frame.functionName}:\n${messages}`, - }; - } - - return { ok: true, msg: "" }; - } - - /** - * Record a memory write event - */ - recordMemoryWrite(regIndex, elemIndex, address, size) { - if (this.callStack.length === 0) { - console_log( - "[SENTINEL] Warning: Memory write outside function context", - "WARN", - ); - return; - } - - const frame = this.callStack[this.callStack.length - 1]; - const event = new RegisterEvent( - EventType.WRITE_MEMORY, - regIndex, - elemIndex, - address, - size, - ); - frame.addEvent(event); - } - - /** - * Record a memory read event - */ - recordMemoryRead(regIndex, elemIndex, address, size) { - if (this.callStack.length === 0) { - console_log( - "[SENTINEL] Warning: Memory read outside function context", - "WARN", - ); - return; - } - - const frame = this.callStack[this.callStack.length - 1]; - const event = new RegisterEvent( - EventType.READ_MEMORY, - regIndex, - elemIndex, - address, - size, - ); - frame.addEvent(event); - } - - /** - * Record a register write event - */ - recordRegisterWrite(regIndex, elemIndex) { - if (this.callStack.length === 0) { - return; - } - - const frame = this.callStack[this.callStack.length - 1]; - const event = new RegisterEvent( - EventType.WRITE_REGISTER, - regIndex, - elemIndex, - ); - frame.addEvent(event); - } - - /** - * Record a register read event - */ - recordRegisterRead(regIndex, elemIndex) { - if (this.callStack.length === 0) { - return; - } - - const frame = this.callStack[this.callStack.length - 1]; - const event = new RegisterEvent( - EventType.READ_REGISTER, - regIndex, - elemIndex, - ); - frame.addEvent(event); - } - - /** - * Reset the validator - */ - reset() { - this.callStack = []; - this.enter("main"); - return { ok: true, msg: "" }; - } - - /** - * Get current call depth - */ - getCallDepth() { - return this.callStack.length; - } - - /** - * Get current function name - */ - getCurrentFunction() { - if (this.callStack.length === 0) { - return null; - } - return this.callStack[this.callStack.length - 1].functionName; - } -} - -// Global instance -const validator = new CallingConventionValidator(); - -// Public API - Direct validator interface -// yes, it HAS to be with arrow functions -export const sentinel = { - enter: functionName => validator.enter(functionName), - leave: () => validator.leave(), - recordMemoryWrite: (regIndex, elemIndex, address, size) => - validator.recordMemoryWrite(regIndex, elemIndex, address, size), - recordMemoryRead: (regIndex, elemIndex, address, size) => - validator.recordMemoryRead(regIndex, elemIndex, address, size), - recordRegisterWrite: (regIndex, elemIndex) => - validator.recordRegisterWrite(regIndex, elemIndex), - recordRegisterRead: (regIndex, elemIndex) => - validator.recordRegisterRead(regIndex, elemIndex), - reset: () => validator.reset(), - getCallDepth: () => validator.getCallDepth(), - getCurrentFunction: () => validator.getCurrentFunction(), -}; diff --git a/src/core/sentinel/sentinel.mts b/src/core/sentinel/sentinel.mts new file mode 100644 index 000000000..ef0a0ab0a --- /dev/null +++ b/src/core/sentinel/sentinel.mts @@ -0,0 +1,473 @@ +/** + * Copyright 2018-2026 CREATOR Team. + * + * This file is part of CREATOR. + * + * CREATOR is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CREATOR 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with CREATOR. If not, see . + */ + +import { architecture, REGISTERS } from "../core.mjs"; +import { console_log } from "../utils/creator_logger.mjs"; +import type { SentinelErrorEvent, SentinelErrorData } from "../events.mts"; + +/** + * Event types that can occur during function execution + */ +const EventType = { + WRITE_MEMORY: "write_memory", + READ_MEMORY: "read_memory", + WRITE_REGISTER: "write_register", + READ_REGISTER: "read_register", +}; + +/** + * Represents a single event in the register lifecycle + */ +class RegisterEvent { + type: string; + regIndex: number; + elemIndex: number; + address: bigint | null; + size: number | null; + timestamp: number; + + constructor( + type: string, + regIndex: number, + elemIndex: number, + address: bigint|null = null, + size: number|null = null + ) { + this.type = type; + this.regIndex = regIndex; + this.elemIndex = elemIndex; + this.address = address; + this.size = size; + this.timestamp = Date.now(); + } + + get registerName() { + return ( + REGISTERS[this.regIndex]!.elements[this.elemIndex]!.name + ); + } + + toString() { + const addr = + this.address !== null ? ` @0x${this.address.toString(16)}` : ""; + const size = this.size !== null ? ` (${this.size} bytes)` : ""; + return `${this.type}: ${this.registerName}${addr}${size}`; + } +} + +/** + * Represents a function call frame with register state tracking + */ +class CallFrame { + functionName: string; + enterStackPointer: number; + events: RegisterEvent[]; + initialRegisterValues: bigint[][]; + + constructor(functionName: string, stackPointer: number) { + this.functionName = functionName; + this.enterStackPointer = stackPointer; + this.events = []; + this.initialRegisterValues = CallFrame._captureRegisterValues(); + } + + static _captureRegisterValues() { + const values: bigint[][] = []; + for (const file of REGISTERS) { + const curr = []; + for (const reg of file.elements) { + curr.push(reg.value); + } + values.push(curr); + } + return values; + } + + addEvent(event: RegisterEvent) { + this.events.push(event); + console_log( + `[EVENT] ${this.functionName}: ${event.toString()}`, + "INFO", + ); + } + + /** + * Get all events for a specific register + */ + getRegisterEvents(regIndex: number, elemIndex: number) { + return this.events.filter( + e => e.regIndex === regIndex && e.elemIndex === elemIndex, + ); + } + + /** + * Find the first save event for a register + */ + getFirstSave(regIndex: number, elemIndex: number) { + return this.events.find( + e => + e.regIndex === regIndex && + e.elemIndex === elemIndex && + e.type === EventType.WRITE_MEMORY, + ); + } + + /** + * Find the last restore event for a register + */ + getLastRestore(regIndex: number, elemIndex: number) { + const restores = this.events.filter( + e => + e.regIndex === regIndex && + e.elemIndex === elemIndex && + e.type === EventType.READ_MEMORY, + ); + return restores[restores.length - 1]; + } +} + +/** + * Validation rules for calling convention + */ +class ConventionRules { + /** + * Check if a saved register follows proper save/restore pattern + */ + static validateSavedRegister( + frame: CallFrame, + regIndex: number, + elemIndex: number + ): SentinelErrorData[] { + const violations = []; + const register = REGISTERS[regIndex]!.elements[elemIndex]!; + const events = frame.getRegisterEvents(regIndex, elemIndex); + + // Rule 1: Saved registers must be saved before modification + const firstSave = frame.getFirstSave(regIndex, elemIndex); + const modifications = events.filter( + e => + e.type === EventType.WRITE_REGISTER || + e.type === EventType.READ_REGISTER, + ); + + if (modifications.length > 0 && !firstSave) { + violations.push({ + rule: "SAVE_BEFORE_USE", + register: register.name, + message: `Register ${register.name} was used but never saved to memory`, + }); + } + + const firstMod = modifications[0]; + if (firstSave && firstMod) { + if (firstMod.timestamp < firstSave.timestamp) { + violations.push({ + rule: "SAVE_BEFORE_USE", + register: register.name, + message: `Register ${register.name} was modified before being saved`, + }); + } + } + + // Rule 2: Saved registers must be restored from the same address + const lastRestore = frame.getLastRestore(regIndex, elemIndex); + if (firstSave && !lastRestore) { + violations.push({ + rule: "RESTORE_REQUIRED", + register: register.name, + message: `Register ${register.name} was saved but never restored`, + }); + } + + if (firstSave && lastRestore) { + if (firstSave.address !== lastRestore.address) { + const saveAddr = firstSave.address; + const restoreAddr = lastRestore.address; + const saveStr = + saveAddr !== null + ? `0x${saveAddr.toString(16)}` + : String(firstSave.address); + const restoreStr = + restoreAddr !== null + ? `0x${restoreAddr.toString(16)}` + : String(lastRestore.address); + violations.push({ + rule: "RESTORE_ADDRESS_MISMATCH", + register: register.name, + message: `Register ${register.name} saved at ${saveStr} but restored from ${restoreStr}`, + }); + } + } + + // Rule 3: Save and restore sizes must match + if (firstSave && lastRestore) { + const s1 = firstSave.size; + const s2 = lastRestore.size; + if (s1 !== s2) { + violations.push({ + rule: "SIZE_MISMATCH", + register: register.name, + message: `Register ${register.name} saved with ${s1} bytes but restored with ${s2} bytes`, + }); + } + } + + // Rule 4: Value must be restored (if the register was modified) + const currentValue = register.value; + const initialValue = frame.initialRegisterValues[regIndex]![elemIndex]!; + + if (currentValue !== initialValue && modifications.length > 0) { + violations.push({ + rule: "VALUE_NOT_RESTORED", + register: register.name, + message: `Register ${register.name} value changed but not properly restored`, + }); + } + + return violations; + } + + /** + * Check stack pointer restoration + */ + static validateStackPointer( + frame: CallFrame, + currentStackPointer: number + ): SentinelErrorData[] { + const spEnter = frame.enterStackPointer; + const spNow = currentStackPointer; + if (spEnter !== spNow) { + const enterStr = `0x${spEnter.toString(16)}`; + const nowStr = `0x${spNow.toString(16)}`; + return [ + { + rule: "STACK_NOT_RESTORED", + message: `Stack pointer not restored: entered at ${enterStr}, exited at ${nowStr}`, + }, + ]; + } + return []; + } +} + +/** + * Main validator class for calling conventions + */ +class CallingConventionValidator { + private callStack: CallFrame[]; + + constructor() { + this.callStack = []; + } + + /** + * Enter a new function + */ + enter(functionName: string) { + const stackPointer = architecture.memory_layout.stack.start; + const frame = new CallFrame(functionName, stackPointer); + this.callStack.push(frame); + console_log(`[SENTINEL] Entering function: ${functionName}`, "INFO"); + } + + /** + * Leave current function and validate + */ + leave(): SentinelErrorEvent { + // Pop the frame + const frame = this.callStack.pop(); + + if (frame === undefined) { + return { + ok: false, + functionName: "unknown", + errors: [ + { + rule: "EMPTY_CALLSTACK", + message: "Cannot leave function: call stack is empty", + }, + ], + }; + } + + console_log( + `[SENTINEL] Leaving function: ${frame.functionName}`, + "INFO", + ); + + const errors: SentinelErrorData[] = []; + + // Validate stack pointer + const spViolations = ConventionRules.validateStackPointer( + frame, + architecture.memory_layout.stack.start, + ); + errors.push(...spViolations); + + // Validate each saved register + for (const [i, file] of REGISTERS.entries()) { + for (const [j, register] of file.elements.entries()) { + // Only check registers that should be saved + if (register.properties.includes("saved")) { + const regViolations = ConventionRules.validateSavedRegister( + frame, + i, + j, + ); + errors.push(...regViolations); + } + } + } + + return { + ok: errors.length === 0, + functionName: frame.functionName, + errors, + }; + } + + /** + * Record a memory write event + */ + recordMemoryWrite(regIndex: number, elemIndex: number, address: bigint, size: number) { + const frame = this.callStack[this.callStack.length - 1]; + if (frame === undefined) { + console_log( + "[SENTINEL] Warning: Memory write outside function context", + "WARN", + ); + return; + } + + const event = new RegisterEvent( + EventType.WRITE_MEMORY, + regIndex, + elemIndex, + address, + size, + ); + frame.addEvent(event); + } + + /** + * Record a memory read event + */ + recordMemoryRead(regIndex: number, elemIndex: number, address: bigint, size: number) { + const frame = this.callStack[this.callStack.length - 1]; + if (frame === undefined) { + console_log( + "[SENTINEL] Warning: Memory read outside function context", + "WARN", + ); + return; + } + + const event = new RegisterEvent( + EventType.READ_MEMORY, + regIndex, + elemIndex, + address, + size, + ); + frame.addEvent(event); + } + + /** + * Record a register write event + */ + recordRegisterWrite(regIndex: number, elemIndex: number) { + const frame = this.callStack[this.callStack.length - 1]; + if (frame === undefined) { + return; + } + + const event = new RegisterEvent( + EventType.WRITE_REGISTER, + regIndex, + elemIndex, + ); + frame.addEvent(event); + } + + /** + * Record a register read event + */ + recordRegisterRead(regIndex: number, elemIndex: number) { + const frame = this.callStack[this.callStack.length - 1]; + if (frame === undefined) { + return; + } + + const event = new RegisterEvent( + EventType.READ_REGISTER, + regIndex, + elemIndex, + ); + frame.addEvent(event); + } + + /** + * Reset the validator + */ + reset() { + this.callStack = []; + this.enter(architecture.config.main_function); + } + + /** + * Get current call depth + */ + getCallDepth() { + return this.callStack.length; + } + + /** + * Get current function name + */ + getCurrentFunction() { + return this.callStack[this.callStack.length - 1]?.functionName; + } +} + +// Global instance +const validator = new CallingConventionValidator(); + +// Public API - Direct validator interface +// yes, it HAS to be with arrow functions +export const sentinel = { + enter: (functionName: string) => validator.enter(functionName), + leave: () => validator.leave(), + recordMemoryWrite: (regIndex: number, elemIndex: number, address: bigint, size: number) => + validator.recordMemoryWrite(regIndex, elemIndex, address, size), + recordMemoryRead: (regIndex: number, elemIndex: number, address: bigint, size: number) => + validator.recordMemoryRead(regIndex, elemIndex, address, size), + recordRegisterWrite: (regIndex: number, elemIndex: number) => + validator.recordRegisterWrite(regIndex, elemIndex), + recordRegisterRead: (regIndex: number, elemIndex: number) => + validator.recordRegisterRead(regIndex, elemIndex), + reset: () => validator.reset(), + getCallDepth: () => validator.getCallDepth(), + getCurrentFunction: () => validator.getCurrentFunction(), + formatErrors: (frameResult: SentinelErrorEvent) => { + const messages = frameResult.errors + .map(v => ` - ${v.message}`) + .join("\n"); + return `Calling convention violations in ${frameResult.functionName}:\n${messages}`; + }, +}; diff --git a/src/core/utils/architectureProcessor.mjs b/src/core/utils/architectureProcessor.mjs index a8d992a9a..053942d07 100644 --- a/src/core/utils/architectureProcessor.mjs +++ b/src/core/utils/architectureProcessor.mjs @@ -423,20 +423,16 @@ function convertElementValuesToBigInt(architectureObj) { } for (const element of component.elements) { + // Convert function using two's complement + const convert = (x) => BigInt.asUintN(element.nbits, BigInt(x)); // Convert value to BigInt if it exists and is not already a BigInt - if ( - element.value !== undefined && - typeof element.value !== "bigint" - ) { - element.value = BigInt(element.value); + if (typeof element.value !== "bigint") { + element.value = convert(element.value); } // Convert default_value to BigInt if it exists and is not already a BigInt - if ( - element.default_value !== undefined && - typeof element.default_value !== "bigint" - ) { - element.default_value = BigInt(element.default_value); + if (typeof element.default_value !== "bigint") { + element.default_value = convert(element.default_value); } } } @@ -514,7 +510,7 @@ function calculateRequiredISAs( ); if (nonExistentISAs.length > 0) { - const message = `There are nonexistant dependencies in the architecture: ${nonExistentISAs.join( + const message = `There are nonexistent dependencies in the architecture: ${nonExistentISAs.join( ", ", )}`; logger.error(message); diff --git a/src/core/utils/float_bigint.mjs b/src/core/utils/float_bigint.mjs index a4b022ead..08f523a04 100644 --- a/src/core/utils/float_bigint.mjs +++ b/src/core/utils/float_bigint.mjs @@ -47,11 +47,6 @@ export function bi_BigIntTofloat(big_int_value) { */ export function bi_BigIntTodouble(big_int_value) { const hex = big_int_value.toString(16).padStart(16, "0"); - // if the first 8 characters are 0, it's a 32-bit float, not a double - if (hex.substring(0, 8) === "00000000") { - return hex2float("0x" + hex.substring(8, 16)); - } - return hex2double("0x" + hex); } diff --git a/src/rpc/server.mts b/src/rpc/server.mts index 1e373bc8d..848a619c2 100644 --- a/src/rpc/server.mts +++ b/src/rpc/server.mts @@ -36,6 +36,7 @@ import { instructions } from "../core/assembler/assembler.mjs"; import { sjasmplusAssemble } from "../core/assembler/sjasmplus/deno/sjasmplus.mjs"; import { assembleCreator } from "../core/assembler/creatorAssembler/deno/creatorAssembler.mjs"; import { rasmAssemble } from "../core/assembler/rasm/deno/rasm.mjs"; +import { SailCompile } from "../core/assembler/sailAssembler/web/CNAssambler.mjs"; import fs from "node:fs"; import type { StackTracker } from "@/core/memory/StackTracker.mjs"; @@ -44,6 +45,7 @@ const assembler_map = { default: assembleCreator, sjasmplus: sjasmplusAssemble, rasm: rasmAssemble, + Sail: SailCompile, } as const; type CompilerType = keyof typeof assembler_map; @@ -82,7 +84,7 @@ interface EmulatorState { }; instructions: Array<{ address: string; - label?: string; + label: string[]; asm: string; machineCode: string; }>; @@ -595,13 +597,13 @@ class CreatorRpcServer { baseAddress: bigint, wordSize: number, ): Array<{ - tag: string; + tag: string[]; type: string; offset: number; sizeInBits?: number; }> { const hints: Array<{ - tag: string; + tag: string[]; type: string; offset: number; sizeInBits?: number; @@ -728,7 +730,7 @@ class CreatorRpcServer { // Get instruction list with better debugging info const instructionList = instructions.map((instr, index) => ({ address: instr.Address, - label: instr.Label || "", + label: instr.Label, asm: instr.loaded || instr.user || "", machineCode: instr.binary || instr.loaded || "", instructionIndex: index, @@ -765,7 +767,7 @@ class CreatorRpcServer { currentInstruction?: { index: number; address: string; - label?: string; + label: string[]; asm: string; machineCode: string; isBreakpoint?: boolean; @@ -773,7 +775,7 @@ class CreatorRpcServer { nextInstruction?: { index: number; address: string; - label?: string; + label: string[]; asm: string; machineCode: string; }; @@ -822,7 +824,7 @@ class CreatorRpcServer { currentInstruction = { index: i, address: instr.Address, - label: instr.Label || undefined, + label: instr.Label, asm: instr.loaded || instr.user || "", machineCode: instr.binary || instr.loaded || "", isBreakpoint: instr.Break === true, @@ -834,7 +836,7 @@ class CreatorRpcServer { nextInstruction = { index: i + 1, address: nextInstr.Address, - label: nextInstr.Label || undefined, + label: nextInstr.Label, asm: nextInstr.loaded || nextInstr.user || "", machineCode: nextInstr.binary || nextInstr.loaded || "", @@ -875,7 +877,7 @@ class CreatorRpcServer { }): Promise<{ index: number; address: string; - label?: string; + label: string[]; asm: string; machineCode: string; visible: boolean; @@ -916,7 +918,7 @@ class CreatorRpcServer { return { index, address: instruction.Address, - label: instruction.Label || undefined, + label: instruction.Label, asm: instruction.loaded || instruction.user || "", machineCode: instruction.binary || instruction.loaded || "", visible: instruction.visible !== false, @@ -978,7 +980,7 @@ class CreatorRpcServer { instruction: { index, address: instruction.Address, - label: instruction.Label || undefined, + label: instruction.Label, asm: instruction.loaded || instruction.user || "", machineCode: instruction.binary || instruction.loaded || "", isBreakpoint: instruction.Break === true, @@ -999,7 +1001,7 @@ class CreatorRpcServer { Array<{ index: number; address: string; - label?: string; + label?: string[]; asm: string; machineCode: string; visible: boolean; @@ -1022,7 +1024,7 @@ class CreatorRpcServer { return instructions.map((instr, index) => ({ index, address: instr.Address, - label: instr.Label || undefined, + label: instr.Label, asm: instr.loaded || instr.user || "", user: instr.user || "", loaded: instr.loaded || "", diff --git a/src/web/App.vue b/src/web/App.vue index 0b60ec00b..60ec9a6bc 100644 --- a/src/web/App.vue +++ b/src/web/App.vue @@ -67,7 +67,6 @@ const creatorASCII = ` ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██║ ██║██╔══██╗ ╚██████╗██║ ██║███████╗██║ ██║ ██║ ╚██████╔╝██║ ██║ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ - didaCtic and geneRic assEmbly progrAmming simulaTOR ${("v." + package_json.version).padStart(58)} `; @@ -209,6 +208,47 @@ export default { // Debug c_debug: false, + // Vector size elem + v_length: 64, + + L1_I_num_lines : 32, + L1_D_num_lines : 32, + L1_num_lines : 32, + L2_num_lines : 32, + L2_I_num_lines : 32, + L2_D_num_lines : 32, + L1_size : 32, + L1_I_size : 32, + L1_D_size : 32, + L1_size_block : 32, + L1_I_size_block : 32, + L1_D_size_block : 32, + L2_size : 32, + L2_I_size : 32, + L2_D_size : 32, + L2_size_block : 32, + L2_I_size_block : 32, + L2_D_size_block : 32, + + // Cache architecture + cache_type : 0, + isDirect : 0, + + // Cache Location + cache_location : "Associative", + + // Cache policy + cache_policy : "FIFO", + + // Execution run + execution_mode_run : -1, + + // Is a breakpoint instruction + is_breakpoint : 0, + + // Integrated Kernel (exclusive to Sail Version) + c_kernel: true, + // Dark Mode dark: false, // the actual dark mode state dark_mode_setting: @@ -314,6 +354,14 @@ export default { target_port: "", target_location: "~/creator", flash_url: "http://localhost:8080", + + /* Validation test */ + // Stats + passed_test: 0, + failed_test: 0, + + // Check testing execution + testing: false, }; }, @@ -387,9 +435,9 @@ export default { window.removeEventListener("resize", this.resizeHandler); }, - /*************** + /**************** * Vue watchers * - ***************/ + ****************/ watch: { dark_mode_setting(newSetting: string) { @@ -678,6 +726,7 @@ export default { v-model:notification_time="notification_time" v-model:dark_mode_setting="dark_mode_setting" v-model:c_debug="c_debug" + v-model:c_kernel="c_kernel" v-model:vim_custom_keybinds="vim_custom_keybinds" v-model:vim_mode="vim_mode" v-model:reg_name_representation="reg_name_representation" diff --git a/src/web/arduino/pinstates.mts b/src/web/arduino/pinstates.mts new file mode 100644 index 000000000..0b2c23158 --- /dev/null +++ b/src/web/arduino/pinstates.mts @@ -0,0 +1,160 @@ +import { ref, type Ref } from "vue"; +import { coreEvents, type ArduinoPinRead } from "@/core/events.mts"; +// --- Tipado --- +export interface PinStateMap { + [key: string]: number; +} + +export interface BoardConfig { + name: string; + svg: string; + pinLabels: string[][]; // Estructura de columnas [izquierda, derecha] + initialStates: PinStateMap; +} +const env = (import.meta as any).env || {}; +const baseUrl = env.BASE_URL || '/'; +// Board definition +const BOARDS: Record = { + esp32c3devkit2: { + name: "ESP32-C3 DevKitC-02", + svg: baseUrl + "maker/boards/esp32c3devkit2.svg", + pinLabels: [ + ["GPIO4", "GPIO5", "GPIO6", "GPIO7", "GPIO8", "GPIO9", "GPIO30"], + [ + "GPIO0", + "GPIO1", + "GPIO2", + "GPIO3", + "GPIO20", + "GPIO21", + "GPIO18", + "GPIO19", + ], + ], + initialStates: { + GPIO0: 0, + GPIO1: 0, + GPIO2: 0, + GPIO3: 0, + GPIO4: 0, + GPIO5: 0, + GPIO6: 0, + GPIO7: 0, + GPIO8: 0, + GPIO9: 0, + GPIO10: 0, + GPIO18: 0, + GPIO19: 0, + GPIO20: 0, + GPIO21: 0, + GPIO30: 0, + }, + }, + esp32c6devkit1: { + name: "ESP32-C6 DevKit", + svg: baseUrl + "maker/boards/esp32c6devkit1.svg", + pinLabels: [ + [ + "GPIO4", + "GPIO5", + "GPIO6", + "GPIO7", + "GPIO0", + "GPIO1", + "GPIO8", + "GPIO10", + "GPIO11", + "GPIO2", + "GPIO3", + ], + [ + "GPIO15", + "GPIO23", + "GPIO22", + "GPIO21", + "GPIO20", + "GPIO19", + "GPIO18", + "GPIO9", + "GPIO17", + "GPIO9", + "GPIO13", + "GPIO12", + ], + ], + initialStates: { + GPIO0: 0, + GPIO1: 0, + GPIO2: 0, + GPIO3: 0, + GPIO4: 0, + GPIO5: 0, + GPIO6: 0, + GPIO7: 0, + GPIO8: 0, + GPIO9: 0, + GPIO10: 0, + GPIO11: 0, + GPIO12: 0, + GPIO13: 0, + GPIO15: 0, + GPIO17: 0, + GPIO18: 0, + GPIO19: 0, + GPIO20: 0, + GPIO21: 0, + GPIO22: 0, + GPIO23: 0, + }, + }, +}; + +// interrupt +// Vector table for ESP32 (for demonstration, not fully implemented): [pin,ISR,MODE] +let esp32vectRef = ref<[bigint, bigint, bigint][]>( + Array.from({ length: 32 }, () => [0n, 0n, 0n]), +); +const entry = esp32vectRef.value[0]; +if (entry) { + entry[0] = 0xffffn; // pin + entry[1] = 0xffffn; // isr + entry[2] = 0n; // mode +} + +// States + +// Por defecto empezamos con la ESP32 +const currentBoardKey = "esp32c3devkit2"; + +export const activeBoard = ref(BOARDS[currentBoardKey]); +export const pinStates: Ref = ref({ + ...BOARDS[currentBoardKey]?.initialStates, +}); +export const pinLabels = ref(BOARDS[currentBoardKey]?.pinLabels); +export const esp32vect = esp32vectRef; // Exportamos el vector de interrupciones + +// Change boards +export function switchBoard(boardKey: string) { + if (BOARDS[boardKey]) { + activeBoard.value = BOARDS[boardKey]; + pinStates.value = { ...BOARDS[boardKey].initialStates }; + pinLabels.value = BOARDS[boardKey].pinLabels; + } +} + +// Functions +coreEvents.on("arduino-pin-read", (event: ArduinoPinRead) => { + const value = pinStates.value[event.pin] ?? 0; + event.callback(value); +}); +coreEvents.on("arduino-find-vector-slot", (event) => { + const indexEncontrado = esp32vect.value.findIndex( + (slot: bigint[]) => slot[1] === 0n && slot[2] === 0n + ); + event.callback(indexEncontrado); +}); + +coreEvents.on("arduino-get-pin-from-slot", (event) => { + const pinGuardado = esp32vect.value[event.position]?.[0]; + event.callback(pinGuardado?.toString() ?? "unknown"); +}); \ No newline at end of file diff --git a/src/web/assemblers.ts b/src/web/assemblers.ts index 0c5ad2eab..1de689b48 100644 --- a/src/web/assemblers.ts +++ b/src/web/assemblers.ts @@ -24,6 +24,7 @@ import { rasmAssemble } from "@/core/assembler/rasm/web/rasm.mjs"; import { assembleCreator } from "@/core/assembler/creatorAssembler/web/creatorAssembler.mjs"; +import { SailCompile } from "@/core/assembler/sailAssembler/web/CNAssambler.mjs"; /** * Assembler function type - flexible to accommodate different assembler signatures @@ -36,6 +37,7 @@ type AssemblerFunction = (...args: any[]) => Promise; */ export const assemblerMap: Record = { // eslint-disable-next-line @typescript-eslint/no-explicit-any + Sail: SailCompile as any, CreatorAssembler: assembleCreator as any, // eslint-disable-next-line @typescript-eslint/no-explicit-any RASM: rasmAssemble as any, diff --git a/src/web/components/ArchitectureView.vue b/src/web/components/ArchitectureView.vue index 37d106560..2eb25c016 100644 --- a/src/web/components/ArchitectureView.vue +++ b/src/web/components/ArchitectureView.vue @@ -29,7 +29,9 @@ import RegisterFileArch from "./architecture/register_file/RegisterFileArch.vue" import Instructions from "./architecture/instructions/Instructions.vue"; import Directives from "./architecture/directives/Directives.vue"; import Pseudoinstructions from "./architecture/pseudoinstructions/Pseudoinstructions.vue"; - +import CacheMemory from "./architecture/cache_memory/CacheMemory.vue"; +import { SailTest32, SailTest64 } from "@/core/executor/sailSimRV/sailExecutor.mjs"; +import { coreEvents } from "@/core/events.mts"; export default defineComponent({ props: { browser: { type: String, required: true }, @@ -48,12 +50,19 @@ export default defineComponent({ Instructions, Directives, Pseudoinstructions, + CacheMemory, }, data() { return { architecture, activeTab: "instructions", + validate: false, + showValidationModal: false, + running: false, + runned: 0, + result_test: 0, + result_log: "" }; }, computed: { @@ -70,6 +79,42 @@ export default defineComponent({ return `# yaml-language-server: $schema=${document.URL.replace(/\/#$/, "/")}schema/architecture.json\n${this.arch_code}`; }, }, + methods:{ + runValidationTest(arch_type: Number){ + this.runned = 0; + this.result_test = 0; + this.running = true; + this.result_log = ""; + if (arch_type === 32){ + SailTest32(); + } else { + SailTest64(); + } + }, + updateState(){ + this.result_test = document.app.$data.passed_test; + if (this.result_test + document.app.$data.failed_test === ((architecture.config.name === 'SRV32' ? 89 : 122)) ){ + this.result_log = "Validation completed.\n Your architecture passed the " + (this.result_test / (architecture.config.name === 'SRV32' ? 89 : 122)) * 100 + "%\n of the validation tests."; + } + + }, + resetValidationState(){ + this.runned = 0; + this.result_test = 0; + this.running = true; + this.result_log = ""; + document.app.$data.passed_test = 0; + document.app.$data.failed_test = 0; + document.app.$data.testing = false; + }, + }, + mounted(){ + coreEvents.on("update-validation", this.updateState); + }, + beforeUnmount() { + coreEvents.off("update-validation", this.updateState); + + }, }); @@ -159,6 +204,33 @@ export default defineComponent({ Registers + + + + + + + @@ -181,6 +253,62 @@ export default defineComponent({
+ +
+ +
+ + This validation test runs {{(architecture.config.name === 'SRV32' ? 89 : 122)}} RISC-V programs.
+ These programs are taken from the official RISC-V test repository (riscv-tests), where the correct operation
+ of the full instruction set of the RISC-V specification is verified. +

+ + + + Run tests + + + +
+
{{ result_log }}
+
+
+ +
+ +
+ diff --git a/src/web/components/AssemblyView.vue b/src/web/components/AssemblyView.vue index 2a5ec5b86..3b3e12243 100644 --- a/src/web/components/AssemblyView.vue +++ b/src/web/components/AssemblyView.vue @@ -28,6 +28,7 @@ import MakeURI from "./assembly/MakeURI.vue"; import LoadLibrary from "./assembly/LoadLibrary.vue"; import SaveLibrary from "./assembly/SaveLibrary.vue"; import LibraryTags from "./assembly/LibraryTags.vue"; +import Calculator from "./simulator/Calculator.vue"; export default defineComponent({ props: { @@ -58,6 +59,7 @@ export default defineComponent({ LoadLibrary, SaveLibrary, LibraryTags, + Calculator, }, }); @@ -81,7 +83,7 @@ export default defineComponent({ @@ -102,6 +104,9 @@ export default defineComponent({ + + + . import { defineComponent, type PropType } from "vue"; import type { StackFrame } from "@/core/memory/StackTracker.mjs"; -import { architecture } from "@/core/core.mjs"; +import { architecture, loadedCreatino } from "@/core/core.mjs"; import { main_memory } from "@/core/core"; import { type Device, devices } from "@/core/executor/devices.mts"; @@ -33,6 +33,7 @@ import Calculator from "./simulator/Calculator.vue"; import Terminal from "./simulator/Terminal.vue"; import Stats from "./simulator/Stats.vue"; import Flash from "./simulator/Flash.vue"; +import ArduinoTerminal from "./simulator/ArduinoTerminal.vue"; export default defineComponent({ props: { @@ -75,6 +76,8 @@ export default defineComponent({ Stats, Flash, Terminal, + ArduinoTerminal + // App }, data() { @@ -109,13 +112,14 @@ export default defineComponent({ - + + @@ -152,7 +157,7 @@ export default defineComponent({ + diff --git a/src/web/components/architecture/cache_memory/CacheInfo.vue b/src/web/components/architecture/cache_memory/CacheInfo.vue new file mode 100644 index 000000000..d18c18fc6 --- /dev/null +++ b/src/web/components/architecture/cache_memory/CacheInfo.vue @@ -0,0 +1,58 @@ + + + \ No newline at end of file diff --git a/src/web/components/architecture/cache_memory/CacheMemory.vue b/src/web/components/architecture/cache_memory/CacheMemory.vue new file mode 100644 index 000000000..bbd58ba72 --- /dev/null +++ b/src/web/components/architecture/cache_memory/CacheMemory.vue @@ -0,0 +1,797 @@ + + + \ No newline at end of file diff --git a/src/web/components/architecture/memory_layout/MemoryLayoutDiagram.vue b/src/web/components/architecture/memory_layout/MemoryLayoutDiagram.vue index 039513735..690bade0a 100644 --- a/src/web/components/architecture/memory_layout/MemoryLayoutDiagram.vue +++ b/src/web/components/architecture/memory_layout/MemoryLayoutDiagram.vue @@ -100,9 +100,9 @@ export default defineComponent({ formatGapSize(bytes: number): string { if (bytes >= 1024 * 1024) { - return `${(bytes / (1024 * 1024)).toFixed(1)} MB gap`; + return `${(bytes / (1024 * 1024)).toFixed(1)} MiB gap`; } else if (bytes >= 1024) { - return `${(bytes / 1024).toFixed(1)} KB gap`; + return `${(bytes / 1024).toFixed(1)} KiB gap`; } else { return `${bytes} B gap`; } diff --git a/src/web/components/assembly/AssemblyActions.vue b/src/web/components/assembly/AssemblyActions.vue index 5b10d4aae..bc4da5b98 100644 --- a/src/web/components/assembly/AssemblyActions.vue +++ b/src/web/components/assembly/AssemblyActions.vue @@ -28,6 +28,8 @@ import { useAssembly, type AssemblyResult, } from "@/web/composables/useAssembly"; +import { libtags32 } from "@/core/assembler/sailAssembler/web/wasm/objdump"; +import { libtags64 } from "@/core/assembler/sailAssembler/web/wasm/objdump64"; // State for dropdown visibility const dropdownOpen = ref(false); @@ -103,6 +105,10 @@ const libraryTagsCount = computed(() => { // Access libraryVersion to make this reactive if (libraryVersion.value < 0 || !libraryLoaded.value) return 0; + // Counter to Sail Version of libs + if (libtags32.length !== 0 || libtags64.length !== 0) + return (libtags32.length + libtags64.length); + // YAML format: symbols is an object with symbol names as keys if ((loadedLibrary as any)?.symbols) { return Object.keys((loadedLibrary as any).symbols).length; @@ -119,12 +125,12 @@ const usesCreatorAssembler = computed(() => { } // Check if CreatorAssembler is in the list return assemblers.some( - (asm: { name: string }) => asm.name === "CreatorAssembler", + (asm: { name: string }) => (asm.name === "CreatorAssembler" || asm.name === "Sail"), ); }); const showLibraryButton = computed(() => { - return usesCreatorAssembler.value && libraryLoaded.value; + return ((usesCreatorAssembler.value && libraryLoaded.value) || architecture.config.name.includes("SRV")); }); // Watch for architecture changes @@ -294,7 +300,7 @@ function handleBlur() { @click="toggleVim" > Vim: {{ root.vim_mode ? "on" : "off" }} diff --git a/src/web/components/assembly/AssemblyError.vue b/src/web/components/assembly/AssemblyError.vue index 3f73db068..09b431979 100644 --- a/src/web/components/assembly/AssemblyError.vue +++ b/src/web/components/assembly/AssemblyError.vue @@ -45,5 +45,9 @@ export default defineComponent({ overflow-x: auto; line-height: 112%; border-radius: 3px; + // creator-assembler's color codes + --err-red: #ff0000; + --err-bright-blue: #00BCFE; + --err-yellow: #ffff00; } diff --git a/src/web/components/assembly/Examples.vue b/src/web/components/assembly/Examples.vue index 0c0ff7f20..6f27304a1 100644 --- a/src/web/components/assembly/Examples.vue +++ b/src/web/components/assembly/Examples.vue @@ -31,6 +31,8 @@ import { import example_set from "../../../../examples/example_set.json"; import MakeURI from "./MakeURI.vue"; +import { architecture } from "@/core/core.mjs"; +import { assembly_files, createFile } from "./MultifileEditor.mjs"; interface Props { id: string; @@ -159,6 +161,16 @@ async function load_example(url: string, shouldAssemble: boolean) { const code = await response.text(); const root = (document as any).app; + + if(architecture.config.name.includes("SRV")){ + var ex_name = url.split("/"); + for (let i= 0; i < assembly_files.length; i++){ + assembly_files[i].to_compile = false; + + } + createFile(root.assembly_code, ex_name[ex_name.length - 1], code); + } + root.assembly_code = code; if (shouldAssemble) { diff --git a/src/web/components/assembly/LibraryTags.vue b/src/web/components/assembly/LibraryTags.vue index fefe9ccc2..f13086e7e 100644 --- a/src/web/components/assembly/LibraryTags.vue +++ b/src/web/components/assembly/LibraryTags.vue @@ -17,8 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with CREATOR. If not, see . --> - diff --git a/src/web/components/simulator/Flash.vue b/src/web/components/simulator/Flash.vue index a20705f2d..89d891bca 100644 --- a/src/web/components/simulator/Flash.vue +++ b/src/web/components/simulator/Flash.vue @@ -25,6 +25,7 @@ import { REMOTELAB } from "@/web/src/remoteLab.js"; import { console_log, show_notification } from "@/web/utils.mjs"; import { creator_ga } from "@/core/utils/creator_ga.mjs"; import { instructions } from "@/core/assembler/assembler.mjs"; +import { loadedCreatino } from "@/core/core.mjs"; export default defineComponent({ props: { @@ -277,6 +278,21 @@ export default defineComponent({ creator_ga("simulator", "simulator.arduinoMode", "simulator.arduinoMode") }, + handleCheckboxChange(value: boolean) { + this.creatinoMode(value) + }, + creatinoMode(isChecked: boolean) { + LOCALLAB.gateway_monitor(this.flashURL + "/arduinoMode", { + state: isChecked, + }).then(data => { + this.eraseflash = false + console_log(JSON.stringify(data, null, 2), "DEBUG") + }) + + // Google Analytics + creator_ga("simulator", "simulator.arduinoMode", "simulator.arduinoMode") + }, + handleCheckboxChange(value: boolean) { this.creatinoMode(value) }, @@ -294,6 +310,8 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, + }).then(data => { this.flashing = false; console_log(JSON.stringify(data, null, 2), "DEBUG"); @@ -350,6 +368,7 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, }).then(data => { this.stoprunning = false; const dataStr = JSON.stringify(data, null, 2); @@ -391,6 +410,7 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, }).then(data => { this.running = false; const dataStr = JSON.stringify(data, null, 2); @@ -431,6 +451,7 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, }).then(data => { this.debugging = false; const dataStr = JSON.stringify(data, null, 2); @@ -482,6 +503,7 @@ export default defineComponent({ target_port: this.targetPort, target_location: this.targetLocation, assembly: this.assembly_code, + arduino: loadedCreatino, }).then(data => { this.fullclean = false; const dataStr = JSON.stringify(data, null, 2); @@ -565,7 +587,7 @@ export default defineComponent({ + diff --git a/src/web/components/simulator/HexViewer.vue b/src/web/components/simulator/HexViewer.vue index 3ec1dad8c..ec280ce99 100644 --- a/src/web/components/simulator/HexViewer.vue +++ b/src/web/components/simulator/HexViewer.vue @@ -30,23 +30,12 @@ import { SP_REG_INDEX, } from "@/core/core.mjs"; import type { StackFrame } from "@/core/memory/StackTracker.mjs"; +import type { MemoryBackup } from "@/core/memory/Memory.mts"; import MemoryLayoutDiagram from "../architecture/memory_layout/MemoryLayoutDiagram.vue"; import { decode } from "@/core/executor/decoder.mjs"; import { MAXNWORDS } from "@/core/utils/architectureProcessor.mjs"; import { instructions } from "@/core/assembler/assembler.mjs"; -interface MemoryDump { - addresses: number[]; - values: number[]; - highestAddress: number; - hints: Array<{ - address: string; - tag: string; - type: string; - sizeInBits?: number; - }>; -} - export default defineComponent({ props: { main_memory: { type: Object as PropType, required: true }, @@ -60,7 +49,7 @@ export default defineComponent({ data() { return { - memoryDump: null as MemoryDump | null, + memoryDump: null as MemoryBackup | null, pc: -1, sp: -1, bytesPerRow: 8, @@ -496,7 +485,7 @@ export default defineComponent({ this.setMemoryDump(dump); }, - generateMemoryDump(): MemoryDump { + generateMemoryDump(): MemoryBackup { // Get all written memory const written = this.main_memory.getWritten(); @@ -547,7 +536,7 @@ export default defineComponent({ // Add hint for this instruction hints.push({ address: addr.toString(), - tag: instruction.loaded || instruction.user, + tag: [instruction.loaded || instruction.user], type: "instruction", sizeInBits: instructionSizeInBits, }); @@ -574,7 +563,7 @@ export default defineComponent({ return { addresses, values, highestAddress, hints }; }, - setMemoryDump(dump: MemoryDump) { + setMemoryDump(dump: MemoryBackup) { this.renderState = {}; // Save current scroll position before updating @@ -614,7 +603,7 @@ export default defineComponent({ for (let i = 0; i < sizeInBytes; i++) { this.hintMap.set(address + i, { - tag: hint.tag, + tag: hint.tag.join(", "), type: hint.type, sizeInBits: hint.sizeInBits, colorIndex: hintColorIndex, @@ -792,21 +781,7 @@ export default defineComponent({ handleByteClick(index: number, event: MouseEvent) { this.selectByte(index); - - const hintInfo = this.hintMap.get(index); - if (index === this.pc) { - this.showHintTooltip(event.target as HTMLElement, { - tag: "Program Counter", - type: "Register", - }); - } else if (index === this.sp) { - this.showHintTooltip(event.target as HTMLElement, { - tag: "Stack Pointer", - type: "Register", - }); - } else if (hintInfo) { - this.showHintTooltip(event.target as HTMLElement, hintInfo); - } + this.handleByteMouseOver(index, event); }, handleByteDoubleClick(index: number) { diff --git a/src/web/components/simulator/Register.vue b/src/web/components/simulator/Register.vue index 39bb0e4d3..d5357c403 100644 --- a/src/web/components/simulator/Register.vue +++ b/src/web/components/simulator/Register.vue @@ -97,7 +97,12 @@ export default defineComponent({ // Access render to create a reactive dependency // eslint-disable-next-line @typescript-eslint/no-unused-expressions this.render; - return this.show_value(this.value_representation).toString(); + if (this.type === "v_registers"){ + // Only show the first elem of the vector + let elem_size = document.app.$data.v_length / 4; // hex format + return this.show_value(this.value_representation).toString().slice(-elem_size); + } else + return this.show_value(this.value_representation).toString(); }, }, diff --git a/src/web/components/simulator/RegisterSpaceView.vue b/src/web/components/simulator/RegisterSpaceView.vue index 2be4bc255..9beadbb77 100644 --- a/src/web/components/simulator/RegisterSpaceView.vue +++ b/src/web/components/simulator/RegisterSpaceView.vue @@ -23,8 +23,9 @@ import { writeRegister } from "@/core/register/registerOperations.mjs"; import { crex_findReg } from "@/core/register/registerLookup.mjs"; import { creator_ga } from "@/core/utils/creator_ga.mjs"; import { show_notification } from "@/web/utils.mjs"; -import { float2bin, double2bin } from "@/core/utils/utils.mjs"; +import { float2bin, double2bin, hex2float, hex2double } from "@/core/utils/utils.mjs"; import { defineComponent, type PropType } from "vue"; +import { architecture } from "@/core/core.mjs"; export default defineComponent({ props: { @@ -41,6 +42,8 @@ export default defineComponent({ return { newValue: "", precision: "single", + Sail_arch: (architecture.config.name.includes("SRV")) ? true : false, + is_vtype: this.$props.item?.type === "v_registers", }; }, @@ -49,16 +52,12 @@ export default defineComponent({ // TODO return false; }, - - // sync w/ parent - // showValue: { - // get() { - // return this.show - // }, - // set(value) { - // this.$emit("update:show", value) - // }, - // }, + modalSize() { + return (this.item?.type === "v_registers") ? 'modal-xl' : '' + }, + vectorMaxLength(){ + return (512 / document.app.$data.v_length) - 1; + } }, methods: { @@ -113,6 +112,81 @@ export default defineComponent({ creator_ga("data", "data.change", "data.change.register_value"); creator_ga("data", "data.change", "data.change.register_value_" + name); }, + + // function to split in vector register file + showValues(reg_type, data) { + + let size_elem = document.app.$data.v_length; + var elems = []; + switch (reg_type) { + case "Hex": + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + if (data.startsWith("0x")) { + elems.push("0x" + data.slice((i + 2), (i + 2) + (size_elem / 4))); + } else + elems.push("0x" + data.slice(i, i + (size_elem / 4))); + } + break; + case "Signed": + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + const singBit = 1n << BigInt(size_elem - 1); + const mask = 1n << BigInt(size_elem); + if (data.startsWith("0x")) { + const value = BigInt("0x" + data.slice((i + 2), (i + 2) + (size_elem / 4))); + elems.push((value & singBit) ? value - mask : value); + } else { + const value = BigInt("0x" + data.slice(i, i + (size_elem / 4))); + elems.push((value & singBit) ? value - mask : value); + } + + } + break; + case "Unsigned": + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + // if (size_elem <= 32) { + if (data.startsWith("0x")) { + elems.push(BigInt("0x" + data.slice((i + 2), (i + 2) + (size_elem / 4)))); + } else + elems.push(BigInt("0x" + data.slice(i, i + (size_elem / 4)))); + } + break; + case "Binary": + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + if (data.startsWith("0x")) { + elems.push(data.slice((i + 2), (i + 2) + (size_elem / 4)).split('').map(h => parseInt(h, 16).toString(2).padStart(4, '0')).join('')); + } else { + elems.push(data.slice(i, i + (size_elem / 4)).split('').map(h => parseInt(h, 16).toString(2).padStart(4, '0')).join('')); + } + } + break; + case "Char": + if (data.startsWith("0x")) + data = data.slice(2, data.length); + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + var elem = data.slice((i + 2), (i + 2) + (size_elem / 4)); + elems.push(String.fromCharCode(parseInt(elem.slice(-2), 16))); + } + + break; + case "IEEE 754 32": + if (data.startsWith("0x")) + data = data.slice(2); + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + var elem = data.slice(i, i + (size_elem / 4)); + elems.push(hex2float(elem)); + } + break; + case "IEEE 754 64": + if (data.startsWith("0x")) + data = data.slice(2, data.length); + for (let i = 0; i < data.length; i+= (size_elem / 4)) { + var elem = data.slice(i, i + (size_elem / 4)); + elems.push(hex2double(elem)); + } + break; + } + return elems; + } }, }); @@ -123,49 +197,89 @@ export default defineComponent({ responsive no-footer centered + :class="modalSize" :title="`Space view for ${item?.name.join(' | ')}`" > - Hexadecimal - + Hexadecimal
(v[{{ vectorMaxLength }}] - v[0])
+ Hexadecimal + + {{ value }} + + {{ item.hex }}
- Binary - + Binary
(v[{{ vectorMaxLength }}] - v[0])
+ Binary + + + {{ value }} + + {{ item.bin }}
- Signed - + Signed
(v[{{ vectorMaxLength }}] - v[0])
+ Signed + + + + {{ value }} + + {{ item.signed }}
- Unsigned - + Unsigned
(v[{{ vectorMaxLength }}] - v[0])
+ Unsigned + + + + {{ value }} + + {{ item.unsigned }}
- Char - + + Char
(v[{{ vectorMaxLength }}] - v[0])
+ Char + + + {{ value }} + + {{ item.char }}
- IEEE 754 (32 bits) - + + IEEE 754 (32 bits)
(v[{{ vectorMaxLength }}] - v[0])
+ IEEE 754 (32 bits) + + + {{ value }} + + {{ item.ieee32 }}
- IEEE 754 (64 bits) - + + IEEE 754 (64 bits)
(v[{{ vectorMaxLength }}] - v[0])
+ IEEE 754 (64 bits) + + + {{ value }} + + {{ item.ieee64 }}
diff --git a/src/web/components/simulator/SentinelErrorsDropdown.vue b/src/web/components/simulator/SentinelErrorsDropdown.vue index b980eff3a..1052b340d 100644 --- a/src/web/components/simulator/SentinelErrorsDropdown.vue +++ b/src/web/components/simulator/SentinelErrorsDropdown.vue @@ -20,16 +20,16 @@ along with CREATOR. If not, see . + + + + + diff --git a/src/web/components/simulator/Terminal.vue b/src/web/components/simulator/Terminal.vue index 23b73cfb0..6f47ecf51 100644 --- a/src/web/components/simulator/Terminal.vue +++ b/src/web/components/simulator/Terminal.vue @@ -92,6 +92,9 @@ export default { fontWeightBold: "700", letterSpacing: 0, lineHeight: 1.2, + // Interprets \n as \r\n (move to the beginning of the next line) + // instead of just moving the cursor down + convertEol: true, theme: { background: "#0d1117", foreground: "#c9d1d9", @@ -150,16 +153,17 @@ export default { // Handle special keys if (data === "\r") { // Enter key - this.terminal.write("\r\n"); + this.terminal.write("\n"); + this.inputBuffer += "\n"; this.submitInput(); return; } if (data === "\u007F") { - // Backspace + // Delete if (this.inputBuffer.length > 0) { this.inputBuffer = this.inputBuffer.slice(0, -1); - this.terminal.write("\b \b"); + this.terminal.write("\b"); } return; } diff --git a/src/web/composables/useAssembly.ts b/src/web/composables/useAssembly.ts index 5ae019790..0daf6ef6c 100644 --- a/src/web/composables/useAssembly.ts +++ b/src/web/composables/useAssembly.ts @@ -23,7 +23,7 @@ import { resetStats } from "@/core/executor/stats.mts"; import { instructions } from "@/core/assembler/assembler.mjs"; import { show_notification, storeBackup } from "@/web/utils.mjs"; import { assemblerMap, getDefaultCompiler } from "@/web/assemblers"; -import { coreEvents, CoreEventTypes } from "@/core/events.mjs"; +import { coreEvents, CoreEventTypes } from "@/core/events.mts"; export interface AssemblyResult { type: "success" | "error" | "warning"; diff --git a/src/web/main.ts b/src/web/main.ts index 4944b1049..57b684f51 100644 --- a/src/web/main.ts +++ b/src/web/main.ts @@ -45,7 +45,7 @@ window.onbeforeunload = function (e) { const app = createApp(App) .component("font-awesome-icon", FontAwesomeIcon) .use(createBootstrap()); - +app.component('fa-icon', FontAwesomeIcon) //Error handler app.config.errorHandler = function (err, _vm, _info) { // Log the error for debugging diff --git a/src/web/monaco/validation.ts b/src/web/monaco/validation.ts index f0ade06ae..dc3fb3463 100644 --- a/src/web/monaco/validation.ts +++ b/src/web/monaco/validation.ts @@ -122,6 +122,9 @@ export async function validateAssemblyCode( const compilerFunction = getCompilerFunction(architecture); try { + + if (architecture.config?.name?.includes("SRV")) + return; // Compile the code to check for errors const result = await compilerFunction(code, false); diff --git a/src/web/utils.mjs b/src/web/utils.mjs index 6fe9a1c5b..824d7e5ba 100644 --- a/src/web/utils.mjs +++ b/src/web/utils.mjs @@ -20,10 +20,13 @@ import humanizeDuration from "humanize-duration"; import { creator_ga } from "@/core/utils/creator_ga.mjs"; -import { architecture, loadArchitecture } from "@/core/core.mjs"; +import { architecture, loadArchitecture, loadedLibrary } from "@/core/core.mjs"; import { initCAPI } from "@/core/capi/initCAPI.mts"; import { console_log as clog } from "@/core/utils/creator_logger.mjs"; import example_set from "../../examples/example_set.json" with { type: "json" }; +import { assembly_files } from "./components/assembly/MultifileEditor.mjs"; +import { show_notification } from "@/core/utils/notifications.mts"; + // Re-export from core for backward compatibility export { @@ -244,7 +247,13 @@ export function storeBackup(root = document.app) { // disabled in config return; } - + if (architecture.config.name.includes("SRV")){ + // We must to store as a JSON the list of files and the list of libraries + localStorage.setItem("backup_files", JSON.stringify(assembly_files)); + if (Object.keys(loadedLibrary).length !== 0) + loadedLibrary.library_file = Array.from(loadedLibrary.library_file); + localStorage.setItem("backup_libs", JSON.stringify(loadedLibrary)); + } localStorage.setItem("backup_asm", root.assembly_code); localStorage.setItem("backup_arch", root.arch_code); localStorage.setItem("backup_arch_name", root.architecture_name); diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_001.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_001.s.snap new file mode 100644 index 000000000..ef55d71b2 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_001.s.snap @@ -0,0 +1,106 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_001.s 1`] = ` +{ + display: "1234", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 32, + "11": 32, + "12": 128, + "13": 132, + "16": 32, + "17": 2, + "19": 1, + "2097152": 12, + "2097155": 34, + "2097156": 255, + "2097157": 255, + "2097158": 233, + "2097159": 210, + "2097160": 67, + "2097161": 228, + "2097162": 41, + "2097163": 55, + "2097164": 64, + "2097165": 195, + "2097166": 6, + "2097167": 171, + "2097168": 133, + "2097169": 30, + "2097170": 184, + "2097171": 82, + "2097172": 84, + "2097173": 104, + "2097174": 105, + "2097175": 115, + "2097176": 32, + "2097177": 105, + "2097178": 115, + "2097179": 32, + "2097180": 97, + "2097181": 32, + "2097182": 115, + "2097183": 116, + "2097184": 114, + "2097185": 105, + "2097186": 110, + "2097187": 103, + "2097189": 84, + "2097190": 104, + "2097191": 105, + "2097192": 115, + "2097193": 32, + "2097194": 105, + "2097195": 115, + "2097196": 32, + "2097197": 97, + "2097198": 110, + "2097199": 111, + "2097200": 116, + "2097201": 104, + "2097202": 101, + "2097203": 114, + "2097204": 32, + "2097205": 115, + "2097206": 116, + "2097207": 114, + "2097208": 105, + "2097209": 110, + "2097210": 103, + "23": 12, + "24": 60, + "25": 1, + "27": 32, + "28": 52, + "29": 33, + "3": 32, + "31": 2, + "33": 32, + "34": 32, + "35": 32, + "36": 132, + "37": 132, + "4": 52, + "40": 32, + "41": 2, + "43": 1, + "47": 12, + "48": 3, + "49": 224, + "5": 33, + "51": 8, + "9": 32, + }, + registers: { + "1,at": "0x200002", + "2,v0": "0x1", + "4,a0": "0x22", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_002.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_002.s.snap new file mode 100644 index 000000000..ba6eca87e --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_002.s.snap @@ -0,0 +1,54 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_002.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 45, + "12": 32, + "13": 11, + "15": 33, + "16": 1, + "17": 40, + "18": 96, + "19": 32, + "20": 1, + "21": 170, + "22": 88, + "23": 34, + "24": 113, + "25": 203, + "26": 88, + "27": 2, + "28": 1, + "29": 201, + "3": 10, + "30": 120, + "31": 154, + "32": 3, + "33": 224, + "35": 8, + "4": 32, + "5": 9, + "7": 13, + "8": 32, + "9": 10, + }, + registers: { + "10,t2": "0x2d", + "11,t3": "0x21", + "12,t4": "0x17", + "13,t5": "0xc", + "14,t6": "0x441", + "15,t7": "0x53", + "8,t0": "0xa", + "9,t1": "0xd", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_003.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_003.s.snap new file mode 100644 index 000000000..0a85e28b9 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_003.s.snap @@ -0,0 +1,113 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_003.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "100": 52, + "101": 33, + "103": 12, + "104": 160, + "105": 45, + "108": 60, + "109": 1, + "11": 32, + "111": 32, + "112": 52, + "113": 33, + "115": 14, + "116": 164, + "117": 47, + "12": 60, + "120": 3, + "121": 224, + "123": 8, + "13": 1, + "15": 32, + "16": 52, + "17": 33, + "19": 4, + "2097155": 14, + "2097156": 120, + "2097159": 22, + "2097163": 14, + "2097164": 120, + "2097167": 22, + "21": 32, + "22": 72, + "23": 32, + "24": 60, + "25": 1, + "27": 32, + "28": 52, + "29": 33, + "3": 32, + "31": 6, + "33": 32, + "34": 80, + "35": 32, + "36": 141, + "37": 11, + "4": 52, + "40": 60, + "41": 1, + "43": 32, + "44": 52, + "45": 33, + "48": 140, + "49": 44, + "5": 33, + "52": 129, + "53": 45, + "56": 60, + "57": 1, + "59": 32, + "60": 52, + "61": 33, + "63": 4, + "64": 128, + "65": 46, + "68": 133, + "69": 79, + "72": 60, + "73": 1, + "75": 32, + "76": 52, + "77": 33, + "79": 6, + "80": 132, + "81": 56, + "84": 60, + "85": 1, + "87": 32, + "88": 52, + "89": 33, + "9": 32, + "91": 8, + "92": 172, + "93": 43, + "96": 60, + "97": 1, + "99": 32, + }, + registers: { + "1,at": "0x20000e", + "10,t2": "0x200006", + "11,t3": "0xe", + "12,t4": "0xe", + "13,t5": "0x78", + "14,t6": "0x78", + "15,t7": "0x16", + "24,t8": "0x16", + "8,t0": "0x200000", + "9,t1": "0x200004", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_004.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_004.s.snap new file mode 100644 index 000000000..ee838237c --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_004.s.snap @@ -0,0 +1,145 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_004.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 60, + "13": 1, + "15": 32, + "16": 52, + "17": 33, + "19": 8, + "2097152": 64, + "2097153": 65, + "2097154": 69, + "2097155": 161, + "2097156": 202, + "2097157": 192, + "2097158": 131, + "2097159": 18, + "2097160": 64, + "2097161": 38, + "2097162": 226, + "2097163": 208, + "2097164": 229, + "2097165": 96, + "2097166": 65, + "2097167": 137, + "2097168": 64, + "2097169": 132, + "2097170": 203, + "2097171": 51, + "2097172": 51, + "2097173": 51, + "2097174": 51, + "2097175": 51, + "2097176": 64, + "2097177": 81, + "2097178": 69, + "2097179": 161, + "2097180": 202, + "2097181": 192, + "2097182": 131, + "2097183": 18, + "2097184": 64, + "2097185": 130, + "2097186": 162, + "2097187": 126, + "2097188": 249, + "2097189": 219, + "2097190": 34, + "2097191": 209, + "2097192": 64, + "2097193": 77, + "2097194": 19, + "2097195": 21, + "2097196": 70, + "2097197": 137, + "2097198": 195, + "2097199": 233, + "21": 32, + "22": 72, + "23": 32, + "24": 60, + "25": 1, + "27": 32, + "28": 52, + "29": 33, + "3": 32, + "31": 16, + "33": 32, + "34": 80, + "35": 32, + "36": 60, + "37": 1, + "39": 32, + "4": 52, + "40": 52, + "41": 33, + "43": 24, + "45": 32, + "46": 88, + "47": 32, + "48": 213, + "5": 33, + "52": 213, + "53": 34, + "56": 213, + "57": 74, + "60": 68, + "61": 32, + "64": 68, + "65": 32, + "66": 81, + "67": 1, + "68": 68, + "69": 34, + "70": 83, + "71": 3, + "72": 245, + "73": 96, + "76": 33, + "77": 107, + "79": 8, + "80": 245, + "81": 100, + "84": 33, + "85": 107, + "87": 8, + "88": 245, + "89": 108, + "9": 32, + "92": 32, + "93": 2, + "95": 10, + "99": 12, + }, + registers: { + "1,at": "0x200018", + "10,t2": "0x200010", + "11,t3": "0x200028", + "2,v0": "0xa", + "8,t0": "0x200000", + "9,t1": "0x200008", + "f0,FP0": "0x405145a1", + "f10,FP10": "0x4084cb33", + "f12,FP12": "0x404d1315", + "f2,FP2": "0x4026e2d0", + "f4,FP4": "0x4082a27e", + PC: "0x64", + f11: "0x33333333", + f13: "0x4689c3e9", + f1: "0xcac08312", + f3: "0xe5604189", + f5: "0xf9db22d1", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_005.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_005.s.snap new file mode 100644 index 000000000..4f41b6af9 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_005.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_005.s 1`] = ` +{ + display: "45", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "12": 32, + "13": 9, + "16": 32, + "17": 4, + "20": 1, + "2097152": 10, + "21": 40, + "22": 8, + "23": 42, + "24": 16, + "25": 1, + "27": 16, + "28": 1, + "29": 36, + "3": 32, + "30": 32, + "31": 32, + "32": 33, + "33": 41, + "35": 1, + "36": 4, + "37": 1, + "38": 255, + "39": 240, + "4": 52, + "40": 32, + "41": 2, + "43": 1, + "47": 12, + "48": 3, + "49": 224, + "5": 33, + "51": 8, + "8": 128, + "9": 40, + }, + registers: { + "2,v0": "0x1", + "4,a0": "0x2d", + "8,t0": "0xa", + "9,t1": "0xa", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_006.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_006.s.snap new file mode 100644 index 000000000..e5b07a381 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_006.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_006.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 5, + "12": 32, + "13": 33, + "15": 1, + "16": 41, + "17": 1, + "19": 5, + "20": 20, + "21": 1, + "23": 16, + "24": 32, + "25": 11, + "27": 34, + "28": 32, + "29": 2, + "3": 4, + "31": 10, + "35": 12, + "36": 32, + "37": 25, + "39": 11, + "4": 32, + "40": 32, + "41": 24, + "42": 2, + "43": 43, + "44": 4, + "45": 1, + "46": 255, + "47": 236, + "5": 9, + "7": 2, + "8": 32, + "9": 1, + }, + registers: { + "1,at": "0x1", + "11,t3": "0x22", + "2,v0": "0xa", + "24,t8": "0x22b", + "25,t9": "0xb", + "8,t0": "0x4", + "9,t1": "0x2", + PC: "0x24", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_007.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_007.s.snap new file mode 100644 index 000000000..7a394b823 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_007.s.snap @@ -0,0 +1,78 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_007.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 11, + "11": 32, + "12": 52, + "13": 33, + "17": 32, + "18": 104, + "19": 32, + "20": 32, + "2097155": 1, + "2097159": 2, + "2097163": 3, + "2097167": 4, + "2097171": 5, + "21": 15, + "24": 32, + "25": 9, + "28": 32, + "29": 10, + "3": 1, + "31": 5, + "32": 17, + "33": 73, + "35": 28, + "36": 113, + "37": 201, + "38": 96, + "39": 2, + "4": 32, + "40": 141, + "41": 174, + "44": 1, + "45": 207, + "46": 120, + "47": 32, + "48": 1, + "49": 105, + "5": 12, + "50": 72, + "51": 32, + "52": 33, + "53": 173, + "55": 4, + "56": 4, + "57": 1, + "58": 255, + "59": 232, + "60": 32, + "61": 2, + "63": 10, + "67": 12, + "7": 4, + "8": 60, + "9": 1, + }, + registers: { + "1,at": "0x200000", + "10,t2": "0x5", + "11,t3": "0x1", + "12,t4": "0x4", + "13,t5": "0x200014", + "14,t6": "0x5", + "15,t7": "0xf", + "2,v0": "0xa", + "9,t1": "0x5", + PC: "0x44", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_008.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_008.s.snap new file mode 100644 index 000000000..f161c277d --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_008.s.snap @@ -0,0 +1,171 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_008.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 60, + "13": 1, + "15": 32, + "16": 52, + "17": 33, + "19": 64, + "2097152": 52, + "2097156": 52, + "2097160": 52, + "2097164": 52, + "2097168": 35, + "2097169": 69, + "2097173": 67, + "2097174": 34, + "2097175": 16, + "2097176": 119, + "2097177": 81, + "2097178": 33, + "2097179": 32, + "2097180": 20, + "2097181": 20, + "2097182": 20, + "2097183": 20, + "2097186": 2, + "2097187": 20, + "2097188": 68, + "2097189": 85, + "2097190": 17, + "2097191": 34, + "2097192": 170, + "2097193": 191, + "2097194": 240, + "2097195": 18, + "2097196": 119, + "2097197": 208, + "2097202": 255, + "2097203": 35, + "2097204": 18, + "2097205": 52, + "2097206": 86, + "2097207": 120, + "2097208": 135, + "2097209": 101, + "2097210": 67, + "2097211": 33, + "2097212": 51, + "2097213": 68, + "2097214": 17, + "2097215": 36, + "2097216": 52, + "2097220": 52, + "2097224": 52, + "2097228": 52, + "2097232": 35, + "2097233": 69, + "2097237": 67, + "2097238": 34, + "2097239": 16, + "2097240": 119, + "2097241": 81, + "2097242": 33, + "2097243": 32, + "2097244": 20, + "2097245": 20, + "2097246": 20, + "2097247": 20, + "2097250": 2, + "2097251": 20, + "2097252": 68, + "2097253": 85, + "2097254": 17, + "2097255": 34, + "2097256": 170, + "2097257": 191, + "2097258": 240, + "2097259": 18, + "2097260": 119, + "2097261": 208, + "2097266": 255, + "2097267": 35, + "2097268": 18, + "2097269": 52, + "2097270": 86, + "2097271": 120, + "2097272": 135, + "2097273": 101, + "2097274": 67, + "2097275": 33, + "2097276": 51, + "2097277": 68, + "2097278": 17, + "2097279": 36, + "21": 32, + "22": 72, + "23": 32, + "24": 32, + "25": 10, + "27": 4, + "28": 32, + "29": 11, + "3": 32, + "31": 4, + "34": 96, + "35": 32, + "38": 104, + "39": 32, + "4": 52, + "40": 17, + "41": 138, + "43": 44, + "44": 17, + "45": 171, + "47": 28, + "48": 197, + "5": 33, + "52": 229, + "53": 32, + "56": 33, + "57": 8, + "59": 4, + "60": 33, + "61": 41, + "63": 4, + "64": 33, + "65": 173, + "67": 1, + "68": 4, + "69": 1, + "70": 255, + "71": 232, + "72": 33, + "73": 140, + "75": 1, + "78": 104, + "79": 32, + "80": 4, + "81": 1, + "82": 255, + "83": 216, + "84": 32, + "85": 2, + "87": 10, + "9": 32, + "91": 12, + }, + registers: { + "1,at": "0x200040", + "10,t2": "0x4", + "11,t3": "0x4", + "12,t4": "0x4", + "2,v0": "0xa", + "8,t0": "0x200040", + "9,t1": "0x200080", + "f0,FP0": "0x33441124", + PC: "0x5c", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_009.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_009.s.snap new file mode 100644 index 000000000..6460ae63b --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_009.s.snap @@ -0,0 +1,169 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_009.s 1`] = ` +{ + display: "Please, insert the first number.Please, insert the second number.The result is: 579", + error: false, + keyboard: " 123 456", + memory: { + "0": 60, + "1": 1, + "10": 32, + "100": 32, + "101": 2, + "103": 10, + "107": 12, + "11": 32, + "12": 32, + "13": 2, + "15": 4, + "19": 12, + "20": 32, + "2097152": 80, + "2097153": 108, + "2097154": 101, + "2097155": 97, + "2097156": 115, + "2097157": 101, + "2097158": 44, + "2097159": 32, + "2097160": 105, + "2097161": 110, + "2097162": 115, + "2097163": 101, + "2097164": 114, + "2097165": 116, + "2097166": 32, + "2097167": 116, + "2097168": 104, + "2097169": 101, + "2097170": 32, + "2097171": 102, + "2097172": 105, + "2097173": 114, + "2097174": 115, + "2097175": 116, + "2097176": 32, + "2097177": 110, + "2097178": 117, + "2097179": 109, + "2097180": 98, + "2097181": 101, + "2097182": 114, + "2097183": 46, + "2097185": 80, + "2097186": 108, + "2097187": 101, + "2097188": 97, + "2097189": 115, + "2097190": 101, + "2097191": 44, + "2097192": 32, + "2097193": 105, + "2097194": 110, + "2097195": 115, + "2097196": 101, + "2097197": 114, + "2097198": 116, + "2097199": 32, + "2097200": 116, + "2097201": 104, + "2097202": 101, + "2097203": 32, + "2097204": 115, + "2097205": 101, + "2097206": 99, + "2097207": 111, + "2097208": 110, + "2097209": 100, + "2097210": 32, + "2097211": 110, + "2097212": 117, + "2097213": 109, + "2097214": 98, + "2097215": 101, + "2097216": 114, + "2097217": 46, + "2097219": 84, + "2097220": 104, + "2097221": 101, + "2097222": 32, + "2097223": 114, + "2097224": 101, + "2097225": 115, + "2097226": 117, + "2097227": 108, + "2097228": 116, + "2097229": 32, + "2097230": 105, + "2097231": 115, + "2097232": 58, + "2097233": 32, + "21": 2, + "23": 5, + "27": 12, + "29": 64, + "3": 32, + "30": 64, + "31": 32, + "32": 60, + "33": 1, + "35": 32, + "36": 52, + "37": 33, + "39": 33, + "4": 52, + "41": 32, + "42": 32, + "43": 32, + "44": 32, + "45": 2, + "47": 4, + "5": 33, + "51": 12, + "52": 32, + "53": 2, + "55": 5, + "59": 12, + "61": 64, + "62": 72, + "63": 32, + "64": 1, + "65": 40, + "66": 80, + "67": 32, + "68": 60, + "69": 1, + "71": 32, + "72": 52, + "73": 33, + "75": 67, + "77": 32, + "78": 32, + "79": 32, + "80": 32, + "81": 2, + "83": 4, + "87": 12, + "88": 1, + "89": 64, + "9": 32, + "90": 32, + "91": 32, + "92": 32, + "93": 2, + "95": 1, + "99": 12, + }, + registers: { + "1,at": "0x200043", + "10,t2": "0x243", + "2,v0": "0xa", + "4,a0": "0x243", + "8,t0": "0x7b", + "9,t1": "0x1c8", + PC: "0x6c", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_010.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_010.s.snap new file mode 100644 index 000000000..9a0694c38 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_010.s.snap @@ -0,0 +1,224 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_010.s 1`] = ` +{ + display: "Insert the string length (no more than 100 characters) Insert the string This is a very long string with many characters and a lot of data. :) 123 +", + error: false, + keyboard: " 74 This is a very long string with many characters and a lot of data. :) 123 +", + memory: { + "0": 60, + "1": 1, + "10": 32, + "11": 32, + "12": 32, + "13": 2, + "15": 4, + "19": 12, + "20": 32, + "2097152": 73, + "2097153": 110, + "2097154": 115, + "2097155": 101, + "2097156": 114, + "2097157": 116, + "2097158": 32, + "2097159": 116, + "2097160": 104, + "2097161": 101, + "2097162": 32, + "2097163": 115, + "2097164": 116, + "2097165": 114, + "2097166": 105, + "2097167": 110, + "2097168": 103, + "2097169": 32, + "2097170": 108, + "2097171": 101, + "2097172": 110, + "2097173": 103, + "2097174": 116, + "2097175": 104, + "2097176": 32, + "2097177": 40, + "2097178": 110, + "2097179": 111, + "2097180": 32, + "2097181": 109, + "2097182": 111, + "2097183": 114, + "2097184": 101, + "2097185": 32, + "2097186": 116, + "2097187": 104, + "2097188": 97, + "2097189": 110, + "2097190": 32, + "2097191": 49, + "2097192": 48, + "2097193": 48, + "2097194": 32, + "2097195": 99, + "2097196": 104, + "2097197": 97, + "2097198": 114, + "2097199": 97, + "2097200": 99, + "2097201": 116, + "2097202": 101, + "2097203": 114, + "2097204": 115, + "2097205": 41, + "2097206": 32, + "2097208": 73, + "2097209": 110, + "2097210": 115, + "2097211": 101, + "2097212": 114, + "2097213": 116, + "2097214": 32, + "2097215": 116, + "2097216": 104, + "2097217": 101, + "2097218": 32, + "2097219": 115, + "2097220": 116, + "2097221": 114, + "2097222": 105, + "2097223": 110, + "2097224": 103, + "2097225": 32, + "2097227": 84, + "2097228": 104, + "2097229": 105, + "2097230": 115, + "2097231": 32, + "2097232": 105, + "2097233": 115, + "2097234": 32, + "2097235": 97, + "2097236": 32, + "2097237": 118, + "2097238": 101, + "2097239": 114, + "2097240": 121, + "2097241": 32, + "2097242": 108, + "2097243": 111, + "2097244": 110, + "2097245": 103, + "2097246": 32, + "2097247": 115, + "2097248": 116, + "2097249": 114, + "2097250": 105, + "2097251": 110, + "2097252": 103, + "2097253": 32, + "2097254": 119, + "2097255": 105, + "2097256": 116, + "2097257": 104, + "2097258": 32, + "2097259": 109, + "2097260": 97, + "2097261": 110, + "2097262": 121, + "2097263": 32, + "2097264": 99, + "2097265": 104, + "2097266": 97, + "2097267": 114, + "2097268": 97, + "2097269": 99, + "2097270": 116, + "2097271": 101, + "2097272": 114, + "2097273": 115, + "2097274": 32, + "2097275": 97, + "2097276": 110, + "2097277": 100, + "2097278": 32, + "2097279": 97, + "2097280": 32, + "2097281": 108, + "2097282": 111, + "2097283": 116, + "2097284": 32, + "2097285": 111, + "2097286": 102, + "2097287": 32, + "2097288": 100, + "2097289": 97, + "2097290": 116, + "2097291": 97, + "2097292": 46, + "2097293": 32, + "2097294": 58, + "2097295": 41, + "2097296": 32, + "2097297": 49, + "2097298": 50, + "2097299": 51, + "2097300": 10, + "21": 2, + "23": 5, + "27": 12, + "29": 64, + "3": 32, + "30": 64, + "31": 32, + "32": 60, + "33": 1, + "35": 32, + "36": 52, + "37": 33, + "39": 56, + "4": 52, + "41": 32, + "42": 32, + "43": 32, + "44": 32, + "45": 2, + "47": 4, + "5": 33, + "51": 12, + "52": 60, + "53": 1, + "55": 32, + "56": 52, + "57": 33, + "59": 75, + "61": 32, + "62": 32, + "63": 32, + "64": 1, + "66": 40, + "67": 32, + "68": 32, + "69": 2, + "71": 8, + "75": 12, + "76": 32, + "77": 2, + "79": 4, + "83": 12, + "84": 3, + "85": 224, + "87": 8, + "9": 32, + }, + registers: { + "1,at": "0x20004b", + "2,v0": "0x4", + "4,a0": "0x20004b", + "5,a1": "0x4a", + "8,t0": "0x4a", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_011.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_011.s.snap new file mode 100644 index 000000000..aa1fe0e7b --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_011.s.snap @@ -0,0 +1,85 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_011.s 1`] = ` +{ + display: "-144", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 4, + "10": 255, + "11": 179, + "13": 32, + "14": 40, + "15": 32, + "16": 32, + "17": 6, + "19": 45, + "20": 12, + "23": 56, + "25": 64, + "26": 32, + "27": 32, + "29": 96, + "3": 23, + "30": 40, + "31": 32, + "32": 12, + "35": 76, + "37": 64, + "38": 32, + "39": 32, + "4": 60, + "40": 32, + "41": 2, + "43": 1, + "47": 12, + "48": 32, + "49": 2, + "5": 1, + "51": 10, + "55": 12, + "57": 164, + "58": 72, + "59": 32, + "6": 255, + "61": 198, + "62": 80, + "63": 32, + "64": 1, + "65": 32, + "66": 16, + "67": 32, + "68": 1, + "69": 64, + "7": 255, + "70": 24, + "71": 32, + "72": 3, + "73": 224, + "75": 8, + "77": 68, + "78": 40, + "79": 34, + "8": 52, + "80": 3, + "81": 224, + "83": 8, + "9": 33, + }, + registers: { + "1,at": "0xffffffb3", + "10,t2": "0x5a", + "2,v0": "0xa", + "3,v1": "0x5a", + "31,ra": "0x24", + "4,a0": "0xffffff70", + "5,a1": "0x5a", + "6,a2": "0x2d", + "9,t1": "0xffffffca", + PC: "0x38", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_012.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_012.s.snap new file mode 100644 index 000000000..d75d13a91 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_012.s.snap @@ -0,0 +1,119 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_012.s 1`] = ` +{ + display: "120", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 4, + "10": 32, + "11": 32, + "12": 32, + "13": 2, + "15": 1, + "19": 12, + "20": 32, + "21": 2, + "23": 10, + "268435396": 15, + "268435397": 255, + "268435398": 255, + "268435399": 208, + "268435403": 76, + "268435407": 2, + "268435408": 15, + "268435409": 255, + "268435410": 255, + "268435411": 220, + "268435415": 76, + "268435419": 3, + "268435420": 15, + "268435421": 255, + "268435422": 255, + "268435423": 232, + "268435427": 76, + "268435431": 4, + "268435432": 15, + "268435433": 255, + "268435434": 255, + "268435435": 244, + "268435439": 76, + "268435443": 5, + "268435451": 8, + "27": 12, + "28": 32, + "29": 1, + "3": 5, + "31": 12, + "32": 3, + "33": 161, + "34": 232, + "35": 35, + "36": 175, + "37": 191, + "39": 8, + "4": 12, + "40": 175, + "41": 190, + "43": 4, + "44": 39, + "45": 190, + "47": 4, + "48": 40, + "49": 129, + "51": 2, + "52": 16, + "53": 1, + "55": 12, + "56": 32, + "57": 2, + "59": 1, + "60": 4, + "61": 1, + "63": 24, + "64": 175, + "65": 196, + "66": 255, + "67": 252, + "68": 32, + "69": 132, + "7": 28, + "70": 255, + "71": 255, + "72": 12, + "75": 28, + "76": 143, + "77": 201, + "78": 255, + "79": 252, + "80": 112, + "81": 66, + "82": 72, + "83": 2, + "84": 143, + "85": 191, + "87": 8, + "88": 143, + "89": 190, + "9": 64, + "91": 4, + "92": 39, + "93": 189, + "95": 12, + "96": 3, + "97": 224, + "99": 8, + }, + registers: { + "1,at": "0x1", + "2,v0": "0xa", + "31,ra": "0x8", + "4,a0": "0x78", + "9,t1": "0x5", + PC: "0x1c", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_013.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_013.s.snap new file mode 100644 index 000000000..54a59dbe0 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_013.s.snap @@ -0,0 +1,79 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_013.s 1`] = ` +{ + display: "83116114105110103321051103285847045565832226136128322261361713222613613532226136136322401591601720", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 2, + "13": 32, + "14": 64, + "15": 32, + "16": 145, + "17": 4, + "2097152": 83, + "2097153": 116, + "2097154": 114, + "2097155": 105, + "2097156": 110, + "2097157": 103, + "2097158": 32, + "2097159": 105, + "2097160": 110, + "2097161": 32, + "2097162": 85, + "2097163": 84, + "2097164": 70, + "2097165": 45, + "2097166": 56, + "2097167": 58, + "2097168": 32, + "2097169": 226, + "2097170": 136, + "2097171": 128, + "2097172": 32, + "2097173": 226, + "2097174": 136, + "2097175": 171, + "2097176": 32, + "2097177": 226, + "2097178": 136, + "2097179": 135, + "2097180": 32, + "2097181": 226, + "2097182": 136, + "2097183": 136, + "2097184": 32, + "2097185": 240, + "2097186": 159, + "2097187": 160, + "2097188": 172, + "23": 12, + "24": 33, + "25": 8, + "27": 1, + "28": 20, + "29": 4, + "3": 1, + "30": 255, + "31": 244, + "32": 3, + "33": 224, + "35": 8, + "4": 60, + "5": 1, + "7": 32, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0x200000", + "2,v0": "0x1", + "8,t0": "0x200026", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_017.s.snap b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_017.s.snap new file mode 100644 index 000000000..278dc5ad8 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/examples/test_mips_example_017.s.snap @@ -0,0 +1,130 @@ +export const snapshot = {}; + +snapshot[`mips/correct/examples/test_mips_example_017.s 1`] = ` +{ + display: "Insert the string: +String in UTF-8: ∀ ∫ ∇ ∈ 🠬 +", + error: false, + keyboard: " String in UTF-8: ∀ ∫ ∇ ∈ 🠬 +", + memory: { + "0": 60, + "1": 1, + "10": 32, + "11": 32, + "12": 32, + "13": 2, + "15": 4, + "19": 12, + "20": 60, + "2097152": 73, + "2097153": 110, + "2097154": 115, + "2097155": 101, + "2097156": 114, + "2097157": 116, + "2097158": 32, + "2097159": 116, + "2097160": 104, + "2097161": 101, + "2097162": 32, + "2097163": 115, + "2097164": 116, + "2097165": 114, + "2097166": 105, + "2097167": 110, + "2097168": 103, + "2097169": 58, + "2097170": 32, + "2097172": 83, + "2097173": 116, + "2097174": 114, + "2097175": 105, + "2097176": 110, + "2097177": 103, + "2097178": 32, + "2097179": 105, + "2097180": 110, + "2097181": 32, + "2097182": 85, + "2097183": 84, + "2097184": 70, + "2097185": 45, + "2097186": 56, + "2097187": 58, + "2097188": 32, + "2097189": 226, + "2097190": 136, + "2097191": 128, + "2097192": 32, + "2097193": 226, + "2097194": 136, + "2097195": 171, + "2097196": 32, + "2097197": 226, + "2097198": 136, + "2097199": 135, + "2097200": 32, + "2097201": 226, + "2097202": 136, + "2097203": 136, + "2097204": 32, + "2097205": 240, + "2097206": 159, + "2097207": 160, + "2097208": 172, + "2097209": 10, + "21": 1, + "23": 32, + "24": 52, + "25": 33, + "27": 20, + "29": 32, + "3": 32, + "30": 32, + "31": 32, + "32": 32, + "33": 5, + "35": 100, + "36": 32, + "37": 2, + "39": 8, + "4": 52, + "43": 12, + "44": 32, + "45": 4, + "47": 10, + "48": 32, + "49": 2, + "5": 33, + "51": 11, + "55": 12, + "56": 60, + "57": 1, + "59": 32, + "60": 52, + "61": 33, + "63": 20, + "65": 32, + "66": 32, + "67": 32, + "68": 32, + "69": 2, + "71": 4, + "75": 12, + "76": 3, + "77": 224, + "79": 8, + "9": 32, + }, + registers: { + "1,at": "0x200014", + "2,v0": "0x4", + "4,a0": "0x200014", + "5,a1": "0x64", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/libraries/test_mips_libraries_001.s.snap b/tests/arch/__snapshots__/mips/correct/libraries/test_mips_libraries_001.s.snap new file mode 100644 index 000000000..0f612071d --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/libraries/test_mips_libraries_001.s.snap @@ -0,0 +1,89 @@ +export const snapshot = {}; + +snapshot[`mips/correct/libraries/test_mips_libraries_001.s 1`] = ` +{ + display: "10 +5 +", + error: false, + keyboard: "", + memory: { + "1": 133, + "10": 32, + "100": 34, + "101": 31, + "104": 3, + "105": 224, + "107": 8, + "11": 32, + "12": 3, + "13": 224, + "15": 8, + "17": 164, + "18": 8, + "19": 42, + "2": 8, + "20": 16, + "21": 32, + "23": 8, + "25": 160, + "26": 32, + "27": 32, + "28": 3, + "29": 224, + "3": 42, + "31": 8, + "32": 35, + "33": 240, + "36": 32, + "37": 4, + "39": 5, + "4": 16, + "40": 32, + "41": 5, + "43": 10, + "44": 12, + "48": 32, + "49": 2, + "5": 32, + "51": 1, + "55": 12, + "56": 32, + "57": 4, + "59": 10, + "60": 32, + "61": 2, + "63": 11, + "67": 12, + "68": 32, + "69": 4, + "7": 8, + "71": 5, + "72": 32, + "73": 5, + "75": 10, + "76": 12, + "79": 16, + "80": 32, + "81": 2, + "83": 1, + "87": 12, + "88": 32, + "89": 4, + "9": 160, + "91": 10, + "92": 32, + "93": 2, + "95": 11, + "99": 12, + }, + registers: { + "16,s0": "0xffffffff", + "2,v0": "0xb", + "4,a0": "0xa", + "5,a1": "0xa", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_001.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_001.s.snap new file mode 100644 index 000000000..9d4d8ed5a --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_001.s.snap @@ -0,0 +1,114 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_001.s 1`] = ` +{ + display: "6673120134-567811416128883", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 2, + "100": 140, + "101": 36, + "107": 12, + "108": 3, + "109": 224, + "11": 12, + "111": 8, + "12": 60, + "13": 1, + "15": 32, + "16": 52, + "17": 33, + "20": 128, + "2097152": 120, + "2097153": 1, + "2097155": 34, + "2097156": 255, + "2097157": 255, + "2097158": 233, + "2097159": 210, + "2097160": 84, + "2097161": 104, + "2097162": 105, + "2097163": 115, + "2097164": 32, + "2097165": 105, + "2097166": 115, + "2097167": 32, + "2097168": 97, + "2097169": 110, + "2097170": 111, + "2097171": 116, + "2097172": 104, + "2097173": 101, + "2097174": 114, + "2097175": 32, + "2097176": 115, + "2097177": 116, + "2097178": 114, + "2097179": 105, + "2097180": 110, + "2097181": 103, + "21": 36, + "27": 12, + "28": 32, + "29": 8, + "3": 1, + "31": 4, + "32": 60, + "33": 1, + "35": 32, + "36": 52, + "37": 33, + "4": 32, + "41": 32, + "42": 72, + "43": 32, + "44": 129, + "45": 36, + "47": 1, + "5": 4, + "51": 12, + "52": 60, + "53": 1, + "55": 32, + "56": 52, + "57": 33, + "59": 2, + "6": 26, + "60": 132, + "61": 36, + "67": 12, + "68": 60, + "69": 1, + "7": 17, + "71": 32, + "72": 52, + "73": 33, + "75": 4, + "76": 140, + "77": 36, + "83": 12, + "84": 32, + "85": 4, + "87": 1, + "91": 12, + "92": 60, + "93": 1, + "95": 32, + "96": 52, + "97": 33, + "99": 8, + }, + registers: { + "1,at": "0x200008", + "2,v0": "0x1", + "4,a0": "0x54686973", + "8,t0": "0x4", + "9,t1": "0x200000", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_002.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_002.s.snap new file mode 100644 index 000000000..132e5d0ec --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_002.s.snap @@ -0,0 +1,59 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_002.s 1`] = ` +{ + display: "6673-86.97399902343751.100000023841858", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 2, + "10": 136, + "12": 68, + "13": 129, + "14": 96, + "19": 12, + "20": 60, + "21": 1, + "22": 194, + "23": 173, + "24": 52, + "25": 33, + "26": 242, + "27": 176, + "28": 68, + "29": 129, + "3": 2, + "30": 96, + "35": 12, + "36": 60, + "37": 1, + "38": 63, + "39": 140, + "4": 60, + "40": 52, + "41": 33, + "42": 204, + "43": 205, + "44": 68, + "45": 129, + "46": 96, + "5": 1, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "6": 69, + "7": 208, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0x3f8ccccd", + "2,v0": "0x2", + "f12,FP12": "0x3f8ccccd", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_003.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_003.s.snap new file mode 100644 index 000000000..d58147cdc --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_003.s.snap @@ -0,0 +1,89 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_003.s 1`] = ` +{ + display: "6673-86.9741.1", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 2, + "12": 68, + "13": 129, + "14": 104, + "16": 60, + "17": 1, + "18": 64, + "19": 186, + "20": 52, + "21": 33, + "22": 17, + "24": 68, + "25": 129, + "26": 96, + "3": 3, + "31": 12, + "32": 60, + "33": 1, + "34": 4, + "35": 24, + "36": 52, + "37": 33, + "38": 147, + "39": 117, + "4": 60, + "40": 68, + "41": 129, + "42": 104, + "44": 60, + "45": 1, + "46": 192, + "47": 85, + "48": 52, + "49": 33, + "5": 1, + "50": 190, + "51": 86, + "52": 68, + "53": 129, + "54": 96, + "59": 12, + "60": 60, + "61": 1, + "62": 153, + "63": 153, + "64": 52, + "65": 33, + "66": 153, + "67": 154, + "68": 68, + "69": 129, + "70": 104, + "72": 60, + "73": 1, + "74": 63, + "75": 241, + "76": 52, + "77": 33, + "78": 153, + "79": 153, + "8": 52, + "80": 68, + "81": 129, + "82": 96, + "87": 12, + "88": 3, + "89": 224, + "9": 33, + "91": 8, + }, + registers: { + "1,at": "0x3ff19999", + "2,v0": "0x3", + "f12,FP12": "0x3ff19999", + PC: "0xffffffff", + f13: "0x9999999a", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_004.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_004.s.snap new file mode 100644 index 000000000..4264ac178 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_004.s.snap @@ -0,0 +1,87 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_004.s 1`] = ` +{ + display: "First StringSecond Stringaa +", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 2, + "13": 32, + "14": 32, + "15": 32, + "19": 12, + "20": 60, + "2097152": 70, + "2097153": 105, + "2097154": 114, + "2097155": 115, + "2097156": 116, + "2097157": 32, + "2097158": 83, + "2097159": 116, + "2097160": 114, + "2097161": 105, + "2097162": 110, + "2097163": 103, + "2097165": 83, + "2097166": 101, + "2097167": 99, + "2097168": 111, + "2097169": 110, + "2097170": 100, + "2097171": 32, + "2097172": 83, + "2097173": 116, + "2097174": 114, + "2097175": 105, + "2097176": 110, + "2097177": 103, + "2097178": 97, + "21": 1, + "23": 32, + "24": 52, + "25": 33, + "27": 13, + "29": 32, + "3": 4, + "30": 32, + "31": 32, + "35": 12, + "36": 60, + "37": 1, + "39": 32, + "4": 60, + "40": 52, + "41": 33, + "43": 26, + "45": 32, + "46": 32, + "47": 32, + "5": 1, + "51": 12, + "52": 32, + "53": 4, + "55": 10, + "56": 32, + "57": 2, + "59": 11, + "63": 12, + "64": 3, + "65": 224, + "67": 8, + "7": 32, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0x20001a", + "2,v0": "0xb", + "4,a0": "0xa", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_005.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_005.s.snap new file mode 100644 index 000000000..41ba70e46 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_005.s.snap @@ -0,0 +1,23 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_005.s 1`] = ` +{ + display: "", + error: false, + keyboard: " 1234567", + memory: { + "0": 32, + "1": 2, + "11": 8, + "3": 5, + "7": 12, + "8": 3, + "9": 224, + }, + registers: { + "2,v0": "0x12d687", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_006.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_006.s.snap new file mode 100644 index 000000000..4ace707da --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_006.s.snap @@ -0,0 +1,24 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_006.s 1`] = ` +{ + display: "", + error: false, + keyboard: " 1.234567", + memory: { + "0": 32, + "1": 2, + "11": 8, + "3": 6, + "7": 12, + "8": 3, + "9": 224, + }, + registers: { + "2,v0": "0x6", + "f0,FP0": "0x3f9e064b", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_007.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_007.s.snap new file mode 100644 index 000000000..c1887bdcb --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_007.s.snap @@ -0,0 +1,25 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_007.s 1`] = ` +{ + display: "", + error: false, + keyboard: " 1.234567890123456", + memory: { + "0": 32, + "1": 2, + "11": 8, + "3": 7, + "7": 12, + "8": 3, + "9": 224, + }, + registers: { + "2,v0": "0x7", + "f0,FP0": "0x3ff3c0ca", + PC: "0xffffffff", + f1: "0x428c59f8", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_008.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_008.s.snap new file mode 100644 index 000000000..a181eae7b --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_008.s.snap @@ -0,0 +1,43 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_008.s 1`] = ` +{ + display: "", + error: false, + keyboard: " This is a long string +", + memory: { + "0": 32, + "1": 2, + "13": 32, + "14": 32, + "15": 32, + "16": 32, + "17": 5, + "19": 5, + "2097152": 84, + "2097153": 104, + "2097154": 105, + "2097155": 115, + "2097156": 32, + "23": 12, + "24": 3, + "25": 224, + "27": 8, + "3": 8, + "4": 60, + "5": 1, + "7": 32, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0x200000", + "2,v0": "0x8", + "4,a0": "0x200000", + "5,a1": "0x5", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_009.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_009.s.snap new file mode 100644 index 000000000..00a97b3b7 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_009.s.snap @@ -0,0 +1,53 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_009.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 9, + "12": 32, + "13": 4, + "15": 8, + "19": 12, + "20": 172, + "21": 72, + "24": 172, + "25": 73, + "27": 4, + "28": 32, + "29": 2, + "3": 10, + "31": 9, + "35": 12, + "36": 172, + "37": 72, + "4": 32, + "40": 172, + "41": 73, + "43": 4, + "44": 3, + "45": 224, + "47": 8, + "5": 9, + "7": 20, + "8": 32, + "9": 2, + "96206019": 10, + "96206023": 20, + "96206027": 10, + "96206031": 20, + }, + registers: { + "2,v0": "0x5bbfcc8", + "4,a0": "0x8", + "8,t0": "0xa", + "9,t1": "0x14", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_010.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_010.s.snap new file mode 100644 index 000000000..6837374a0 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_010.s.snap @@ -0,0 +1,27 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_010.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 2, + "10": 1, + "11": 197, + "12": 3, + "13": 224, + "15": 8, + "3": 10, + "7": 12, + "8": 32, + "9": 8, + }, + registers: { + "2,v0": "0xa", + PC: "0x8", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_011.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_011.s.snap new file mode 100644 index 000000000..ba6c0b63a --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_011.s.snap @@ -0,0 +1,27 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_011.s 1`] = ` +{ + display: "c", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 2, + "11": 12, + "12": 3, + "13": 224, + "15": 8, + "3": 11, + "4": 32, + "5": 4, + "7": 99, + }, + registers: { + "2,v0": "0xb", + "4,a0": "0x63", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_012.s.snap b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_012.s.snap new file mode 100644 index 000000000..4c6defe87 --- /dev/null +++ b/tests/arch/__snapshots__/mips/correct/syscalls/test_mips_syscall_012.s.snap @@ -0,0 +1,23 @@ +export const snapshot = {}; + +snapshot[`mips/correct/syscalls/test_mips_syscall_012.s 1`] = ` +{ + display: "", + error: false, + keyboard: " a", + memory: { + "0": 32, + "1": 2, + "11": 8, + "3": 12, + "7": 12, + "8": 3, + "9": 224, + }, + registers: { + "2,v0": "0x61", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_001.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_001.s.snap new file mode 100644 index 000000000..c5f09d8e6 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_001.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_001.s 1`] = ` +{ + column: 4, + errorText: "[E12] Error: Label A is already defined", + line: 9, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_001.s 2`] = ` +"[E12] Error: Label A is already defined + ╭─[ assembly:9:4 ] + │ + 7 │ A: .word -1 + │ ─┬ + │ ╰── Note: Label also defined here + │ + 9 │ A: .half 23 + │ ─┬ + │ ╰── Duplicate label + │ + │ Help: Consider renaming either of the labels +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_001.s 3`] = ` +"[E12] Error: Label A is already defined + ╭─[ assembly:9:4 ] + + 7 │ A: .word -1 + ─┬ + ╰── Note: Label also defined here + + 9 │ A: .half 23 + ─┬ + ╰── Duplicate label + + Help: Consider renaming either of the labels +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_001.s 4`] = ` +"[E12] Error: Label A is already defined + ╭─[ assembly:9:4 ] + │ + 7 │    A:    .word -1 +  │ ─┬ +  │ ╰── Note: Label also defined here +  │ + 9 │    A:    .half 23 +  │ ─┬ +  │ ╰── Duplicate label +  │ +  │ Help: Consider renaming either of the labels +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_002.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_002.s.snap new file mode 100644 index 000000000..c367c3661 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_002.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_002.s 1`] = ` +{ + column: 4, + errorText: "[E02] Error: Instruction suma isn't defined", + line: 12, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_002.s 2`] = ` +"[E02] Error: Instruction suma isn't defined + ╭─[ assembly:12:4 ] + │ + 12 │ suma \$t0, \$t1, \$t2 + │ ──┬─ + │ ╰─── Unknown instruction +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_002.s 3`] = ` +"[E02] Error: Instruction suma isn't defined + ╭─[ assembly:12:4 ] + + 12 │ suma \$t0, \$t1, \$t2 + ──┬─ + ╰─── Unknown instruction +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_002.s 4`] = ` +"[E02] Error: Instruction suma isn't defined + ╭─[ assembly:12:4 ] + │ + 12 │    suma \$t0, \$t1, \$t2 +  │ ──┬─ +  │ ╰─── Unknown instruction +────╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_003.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_003.s.snap new file mode 100644 index 000000000..56a5ac36a --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_003.s.snap @@ -0,0 +1,108 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_003.s 1`] = ` +{ + column: 8, + errorText: "[E09] Error: Incorrect instruction syntax", + line: 12, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_003.s 2`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:12:8 ] + │ + 12 │ add 25, \$t1, 12 + │ ─────┬───── + │ ╰─────── Incorrect syntax + │ + │ Note: Allowed formats: + │ opcode \$rd, \$rt, \$rs + │ opcode \$rs, \$rt, inm +────╯ + +The syntax opcode \$rd, \$rt, \$rs failed with the following reason: +Error: found integer (25) but expected \$ + ╭─[ assembly:12:8 ] + │ + 12 │ add 25, \$t1, 12 + │ ─┬ + │ ╰── Unexpected input +────╯ + +The syntax opcode \$rs, \$rt, inm failed with the following reason: +Error: found integer (25) but expected \$ + ╭─[ assembly:12:8 ] + │ + 12 │ add 25, \$t1, 12 + │ ─┬ + │ ╰── Unexpected input +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_003.s 3`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:12:8 ] + + 12 │ add 25, \$t1, 12 + ─────┬───── + ╰─────── Incorrect syntax + + Note: Allowed formats: + opcode \$rd, \$rt, \$rs + opcode \$rs, \$rt, inm +────╯ + +The syntax opcode \$rd, \$rt, \$rs failed with the following reason: +Error: found integer (25) but expected \$ + ╭─[ assembly:12:8 ] + + 12 │ add 25, \$t1, 12 + ─┬ + ╰── Unexpected input +────╯ + +The syntax opcode \$rs, \$rt, inm failed with the following reason: +Error: found integer (25) but expected \$ + ╭─[ assembly:12:8 ] + + 12 │ add 25, \$t1, 12 + ─┬ + ╰── Unexpected input +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_003.s 4`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:12:8 ] + │ + 12 │    add 25, \$t1, 12 +  │ ─────┬───── +  │ ╰─────── Incorrect syntax +  │ +  │ Note: Allowed formats: +  │ opcode \$rd, \$rt, \$rs +  │ opcode \$rs, \$rt, inm +────╯ + +The syntax opcode \$rd, \$rt, \$rs failed with the following reason: +Error: found integer (25) but expected \$ + ╭─[ assembly:12:8 ] + │ + 12 │    add 25, \$t1, 12 +  │ ─┬ +  │ ╰── Unexpected input +────╯ + +The syntax opcode \$rs, \$rt, inm failed with the following reason: +Error: found integer (25) but expected \$ + ╭─[ assembly:12:8 ] + │ + 12 │    add 25, \$t1, 12 +  │ ─┬ +  │ ╰── Unexpected input +────╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_004.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_004.s.snap new file mode 100644 index 000000000..f9b2e9478 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_004.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_004.s 1`] = ` +{ + column: 19, + errorText: "[E05] Error: Register s50 isn't defined in file type Integer", + line: 12, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_004.s 2`] = ` +"[E05] Error: Register s50 isn't defined in file type Integer + ╭─[ assembly:12:19 ] + │ + 12 │ add \$t0, \$t1, \$s50 + │ ─┬─ + │ ╰─── Unknown register + │ + │ Help: Did you mean s0 or s5? +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_004.s 3`] = ` +"[E05] Error: Register s50 isn't defined in file type Integer + ╭─[ assembly:12:19 ] + + 12 │ add \$t0, \$t1, \$s50 + ─┬─ + ╰─── Unknown register + + Help: Did you mean s0 or s5? +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_004.s 4`] = ` +"[E05] Error: Register s50 isn't defined in file type Integer + ╭─[ assembly:12:19 ] + │ + 12 │    add \$t0, \$t1, \$s50 +  │ ─┬─ +  │ ╰─── Unknown register +  │ +  │ Help: Did you mean s0 or s5? +────╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_005.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_005.s.snap new file mode 100644 index 000000000..aa4f3f98f --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_005.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_005.s 1`] = ` +{ + column: 19, + errorText: "[E23] Error: Value 291 is outside of the valid range of the field", + line: 7, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_005.s 2`] = ` +"[E23] Error: Value 291 is outside of the valid range of the field + ╭─[ assembly:7:19 ] + │ + 7 │ a: .byte 0x123 + │ ──┬── + │ ╰──── This expression has value 291 + │ + │ Note: Allowed range is [-128, 255] +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_005.s 3`] = ` +"[E23] Error: Value 291 is outside of the valid range of the field + ╭─[ assembly:7:19 ] + + 7 │ a: .byte 0x123 + ──┬── + ╰──── This expression has value 291 + + Note: Allowed range is [-128, 255] +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_005.s 4`] = ` +"[E23] Error: Value 291 is outside of the valid range of the field + ╭─[ assembly:7:19 ] + │ + 7 │     a:      .byte 0x123 +  │ ──┬── +  │ ╰──── This expression has value 291 +  │ +  │ Note: Allowed range is [-128, 255] +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_006.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_006.s.snap new file mode 100644 index 000000000..3dd5704d3 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_006.s.snap @@ -0,0 +1,84 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_006.s 1`] = ` +{ + column: 7, + errorText: "[E09] Error: Incorrect instruction syntax", + line: 11, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_006.s 2`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:11:7 ] + │ + 11 │ li \$t0, 0xhello + │ ──────┬───── + │ ╰─────── Incorrect syntax + │ + │ Note: Allowed formats: + │ opcode \$rd, val +────╯ + +The syntax opcode \$rd, val failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:11:13 ] + │ + 11 │ li \$t0, 0xhello + │ ┬───┬── + │ ╰──────── While parsing this expression + │ │ + │ ╰──── Unexpected input +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_006.s 3`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:11:7 ] + + 11 │ li \$t0, 0xhello + ──────┬───── + ╰─────── Incorrect syntax + + Note: Allowed formats: + opcode \$rd, val +────╯ + +The syntax opcode \$rd, val failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:11:13 ] + + 11 │ li \$t0, 0xhello + ───┬── + ╰──────── While parsing this expression + + ╰──── Unexpected input +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_006.s 4`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:11:7 ] + │ + 11 │    li \$t0, 0xhello +  │ ──────┬───── +  │ ╰─────── Incorrect syntax +  │ +  │ Note: Allowed formats: +  │ opcode \$rd, val +────╯ + +The syntax opcode \$rd, val failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:11:13 ] + │ + 11 │    li \$t0, 0xhello +  │ ┬───┬── +  │ ╰──────── While parsing this expression +  │ │ +  │ ╰──── Unexpected input +────╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_007.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_007.s.snap new file mode 100644 index 000000000..b1d9d4502 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_007.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_007.s 1`] = ` +{ + column: 7, + errorText: "[E03] Error: Label mains isn't defined", + line: 11, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_007.s 2`] = ` +"[E03] Error: Label mains isn't defined + ╭─[ assembly:11:7 ] + │ + 11 │ j mains + │ ──┬── + │ ╰──── Unknown label + │ + │ Help: Did you mean main? +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_007.s 3`] = ` +"[E03] Error: Label mains isn't defined + ╭─[ assembly:11:7 ] + + 11 │ j mains + ──┬── + ╰──── Unknown label + + Help: Did you mean main? +────╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_007.s 4`] = ` +"[E03] Error: Label mains isn't defined + ╭─[ assembly:11:7 ] + │ + 11 │     j mains +  │ ──┬── +  │ ╰──── Unknown label +  │ +  │ Help: Did you mean main? +────╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_008.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_008.s.snap new file mode 100644 index 000000000..f5c44bc87 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_008.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_008.s 1`] = ` +{ + column: 6, + errorText: "[E23] Error: Value 305419896 is outside of the valid range of the field", + line: 8, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_008.s 2`] = ` +"[E23] Error: Value 305419896 is outside of the valid range of the field + ╭─[ assembly:8:6 ] + │ + 8 │ j 0x12345678 + │ ─────┬──── + │ ╰────── This expression has value 305419896 + │ + │ Note: Allowed range is [-33554432, 33554431] +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_008.s 3`] = ` +"[E23] Error: Value 305419896 is outside of the valid range of the field + ╭─[ assembly:8:6 ] + + 8 │ j 0x12345678 + ─────┬──── + ╰────── This expression has value 305419896 + + Note: Allowed range is [-33554432, 33554431] +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_008.s 4`] = ` +"[E23] Error: Value 305419896 is outside of the valid range of the field + ╭─[ assembly:8:6 ] + │ + 8 │    j 0x12345678 +  │ ─────┬──── +  │ ╰────── This expression has value 305419896 +  │ +  │ Note: Allowed range is [-33554432, 33554431] +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_009.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_009.s.snap new file mode 100644 index 000000000..323daf058 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_009.s.snap @@ -0,0 +1,84 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_009.s 1`] = ` +{ + column: 6, + errorText: "[E09] Error: Incorrect instruction syntax", + line: 8, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_009.s 2`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:8:6 ] + │ + 8 │ j 0xhello + │ ───┬─── + │ ╰───── Incorrect syntax + │ + │ Note: Allowed formats: + │ opcode addr +───╯ + +The syntax opcode addr failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:8:7 ] + │ + 8 │ j 0xhello + │ ┬───┬── + │ ╰──────── While parsing this expression + │ │ + │ ╰──── Unexpected input +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_009.s 3`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:8:6 ] + + 8 │ j 0xhello + ───┬─── + ╰───── Incorrect syntax + + Note: Allowed formats: + opcode addr +───╯ + +The syntax opcode addr failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:8:7 ] + + 8 │ j 0xhello + ───┬── + ╰──────── While parsing this expression + + ╰──── Unexpected input +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_009.s 4`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:8:6 ] + │ + 8 │    j 0xhello +  │ ───┬─── +  │ ╰───── Incorrect syntax +  │ +  │ Note: Allowed formats: +  │ opcode addr +───╯ + +The syntax opcode addr failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:8:7 ] + │ + 8 │    j 0xhello +  │ ┬───┬── +  │ ╰──────── While parsing this expression +  │ │ +  │ ╰──── Unexpected input +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_010.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_010.s.snap new file mode 100644 index 000000000..7487173b4 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_010.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_010.s 1`] = ` +{ + column: 17, + errorText: "[E16] Error: Data memory segment is full", + line: 8, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_010.s 2`] = ` +"[E16] Error: Data memory segment is full + ╭─[ assembly:8:17 ] + │ + 8 │ spa: .space 16 * 1024 * 1024 * 1024 + │ ───────────┬─────────── + │ ╰───────────── This element doesn't fit in the available space +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_010.s 3`] = ` +"[E16] Error: Data memory segment is full + ╭─[ assembly:8:17 ] + + 8 │ spa: .space 16 * 1024 * 1024 * 1024 + ───────────┬─────────── + ╰───────────── This element doesn't fit in the available space +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_010.s 4`] = ` +"[E16] Error: Data memory segment is full + ╭─[ assembly:8:17 ] + │ + 8 │     spa:    .space 16 * 1024 * 1024 * 1024 +  │ ───────────┬─────────── +  │ ╰───────────── This element doesn't fit in the available space +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_014.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_014.s.snap new file mode 100644 index 000000000..55c049f65 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_014.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_014.s 1`] = ` +{ + column: 14, + errorText: "[E01] Error: Directive .directive isn't defined", + line: 8, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_014.s 2`] = ` +"[E01] Error: Directive .directive isn't defined + ╭─[ assembly:8:14 ] + │ + 8 │ example: .directive 221 + │ ─────┬──── + │ ╰────── Unknown directive +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_014.s 3`] = ` +"[E01] Error: Directive .directive isn't defined + ╭─[ assembly:8:14 ] + + 8 │ example: .directive 221 + ─────┬──── + ╰────── Unknown directive +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_014.s 4`] = ` +"[E01] Error: Directive .directive isn't defined + ╭─[ assembly:8:14 ] + │ + 8 │     example:    .directive 221 +  │ ─────┬──── +  │ ╰────── Unknown directive +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_015.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_015.s.snap new file mode 100644 index 000000000..3607075e8 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_015.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_015.s 1`] = ` +{ + column: 22, + errorText: "[E03] Error: Label hello isn't defined", + line: 8, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_015.s 2`] = ` +"[E03] Error: Label hello isn't defined + ╭─[ assembly:8:22 ] + │ + 8 │ example: .word hello + │ ──┬── + │ ╰──── Unknown label +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_015.s 3`] = ` +"[E03] Error: Label hello isn't defined + ╭─[ assembly:8:22 ] + + 8 │ example: .word hello + ──┬── + ╰──── Unknown label +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_015.s 4`] = ` +"[E03] Error: Label hello isn't defined + ╭─[ assembly:8:22 ] + │ + 8 │     example:   .word hello +  │ ──┬── +  │ ╰──── Unknown label +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_016.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_016.s.snap new file mode 100644 index 000000000..9f9d44ae0 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_016.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_016.s 1`] = ` +{ + column: 32, + errorText: "Compilation error", + line: 8, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_016.s 2`] = ` +'Error: Unterminated string literal + ╭─[ assembly:8:32 ] + │ + 8 │ example: .ascii hello world" + │ ───┬─┬ + │ ╰──── While parsing this identifier + │ │ + │ ╰── Caused by this +───╯ +' +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_016.s 3`] = ` +"Error: Unterminated string literal + ╭─[ assembly:8:32 ] + + 8 │ example: .ascii hello world" + ───┬─ + ╰──── While parsing this identifier + + ╰── Caused by this +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_016.s 4`] = ` +'Error: Unterminated string literal + ╭─[ assembly:8:32 ] + │ + 8 │     example:    .ascii hello world" +  │ ───┬─┬ +  │ ╰──── While parsing this identifier +  │ │ +  │ ╰── Caused by this +───╯ +' +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_017.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_017.s.snap new file mode 100644 index 000000000..649ff19cd --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_017.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_017.s 1`] = ` +{ + column: 33, + errorText: "Compilation error", + line: 8, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_017.s 2`] = ` +'Error: Unterminated string literal + ╭─[ assembly:8:33 ] + │ + 8 │ example: .ascii "hello world + │ ──────┬─────┬ + │ ╰──────── While parsing this string + │ │ + │ ╰── Caused by this +───╯ +' +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_017.s 3`] = ` +"Error: Unterminated string literal + ╭─[ assembly:8:33 ] + + 8 │ example: .ascii "hello world + ──────┬───── + ╰──────── While parsing this string + + ╰── Caused by this +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_017.s 4`] = ` +'Error: Unterminated string literal + ╭─[ assembly:8:33 ] + │ + 8 │     example:    .ascii "hello world +  │ ──────┬─────┬ +  │ ╰──────── While parsing this string +  │ │ +  │ ╰── Caused by this +───╯ +' +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_018.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_018.s.snap new file mode 100644 index 000000000..139d3c109 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_018.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_018.s 1`] = ` +{ + column: 20, + errorText: "[E23] Error: Value 74565 is outside of the valid range of the field", + line: 7, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_018.s 2`] = ` +"[E23] Error: Value 74565 is outside of the valid range of the field + ╭─[ assembly:7:20 ] + │ + 7 │ example: .half 0x12345 + │ ───┬─── + │ ╰───── This expression has value 74565 + │ + │ Note: Allowed range is [-32768, 65535] +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_018.s 3`] = ` +"[E23] Error: Value 74565 is outside of the valid range of the field + ╭─[ assembly:7:20 ] + + 7 │ example: .half 0x12345 + ───┬─── + ╰───── This expression has value 74565 + + Note: Allowed range is [-32768, 65535] +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_018.s 4`] = ` +"[E23] Error: Value 74565 is outside of the valid range of the field + ╭─[ assembly:7:20 ] + │ + 7 │   example:   .half 0x12345 +  │ ───┬─── +  │ ╰───── This expression has value 74565 +  │ +  │ Note: Allowed range is [-32768, 65535] +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_019.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_019.s.snap new file mode 100644 index 000000000..136f4cce4 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_019.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_019.s 1`] = ` +{ + column: 12, + errorText: "Compilation error", + line: 7, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_019.s 2`] = ` +"Error: found identifier (x) but expected ,, \\\\n, binary operator, or end of input + ╭─[ assembly:7:12 ] + │ + 7 │ .byte 0x + │ ┬┬ + │ ╰─── While parsing this expression + │ │ + │ ╰── Unexpected input +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_019.s 3`] = ` +"Error: found identifier (x) but expected ,, \\\\n, binary operator, or end of input + ╭─[ assembly:7:12 ] + + 7 │ .byte 0x + + ╰─── While parsing this expression + + ╰── Unexpected input +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_019.s 4`] = ` +"Error: found identifier (x) but expected ,, \\\\n, binary operator, or end of input + ╭─[ assembly:7:12 ] + │ + 7 │     .byte 0x +  │ ┬┬ +  │ ╰─── While parsing this expression +  │ │ +  │ ╰── Unexpected input +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_021.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_021.s.snap new file mode 100644 index 000000000..a96c36841 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_021.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_021.s 1`] = ` +{ + column: 21, + errorText: "[E17] Error: Data at address 0x200001 isn't aligned to size 2 nor word size 4", + line: 9, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_021.s 2`] = ` +"[E17] Error: Data at address 0x200001 isn't aligned to size 2 nor word size 4 + ╭─[ assembly:9:21 ] + │ + 9 │ example2: .half 2 + │ ┬ + │ ╰── This value isn't aligned +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_021.s 3`] = ` +"[E17] Error: Data at address 0x200001 isn't aligned to size 2 nor word size 4 + ╭─[ assembly:9:21 ] + + 9 │ example2: .half 2 + + ╰── This value isn't aligned +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_021.s 4`] = ` +"[E17] Error: Data at address 0x200001 isn't aligned to size 2 nor word size 4 + ╭─[ assembly:9:21 ] + │ + 9 │     example2:   .half 2 +  │ ┬ +  │ ╰── This value isn't aligned +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_022.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_022.s.snap new file mode 100644 index 000000000..6b9f731eb --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_022.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_022.s 1`] = ` +{ + column: 12, + errorText: "[E22] Error: Negative values aren't allowed here", + line: 7, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_022.s 2`] = ` +"[E22] Error: Negative values aren't allowed here + ╭─[ assembly:7:12 ] + │ + 7 │ .space -10 + │ ─┬─ + │ ╰─── This expression has value -10 +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_022.s 3`] = ` +"[E22] Error: Negative values aren't allowed here + ╭─[ assembly:7:12 ] + + 7 │ .space -10 + ─┬─ + ╰─── This expression has value -10 +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_022.s 4`] = ` +"[E22] Error: Negative values aren't allowed here + ╭─[ assembly:7:12 ] + │ + 7 │     .space -10 +  │ ─┬─ +  │ ╰─── This expression has value -10 +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_023.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_023.s.snap new file mode 100644 index 000000000..06a04eb48 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_023.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_023.s 1`] = ` +{ + column: 20, + errorText: "[E10] Error: Incorrect amount of arguments, expected at least 1 but found 0", + line: 9, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_023.s 2`] = ` +"[E10] Error: Incorrect amount of arguments, expected at least 1 but found 0 + ╭─[ assembly:9:20 ] + │ + 9 │ example2: .half + │ │ + │ ╰─ This directive has 0 arguments + │ + │ Help: Consider adding the missing 1 argument +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_023.s 3`] = ` +"[E10] Error: Incorrect amount of arguments, expected at least 1 but found 0 + ╭─[ assembly:9:20 ] + + 9 │ example2: .half + + ╰─ This directive has 0 arguments + + Help: Consider adding the missing 1 argument +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_023.s 4`] = ` +"[E10] Error: Incorrect amount of arguments, expected at least 1 but found 0 + ╭─[ assembly:9:20 ] + │ + 9 │    example2:    .half +  │ │ +  │ ╰─ This directive has 0 arguments +  │ +  │ Help: Consider adding the missing 1 argument +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_030.s.snap b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_030.s.snap new file mode 100644 index 000000000..9a27e8733 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/compiler/test_mips_error_compiler_030.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`mips/error/compiler/test_mips_error_compiler_030.s 1`] = ` +{ + column: 15, + errorText: "[E13] Error: Main label main not found", + line: 8, +} +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_030.s 2`] = ` +"[E13] Error: Main label main not found + ╭─[ assembly:8:15 ] + │ + 8 │ li \$t0, 10 + │ │ + │ ╰─ Consider adding a label called main to an instruction +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_030.s 3`] = ` +"[E13] Error: Main label main not found + ╭─[ assembly:8:15 ] + + 8 │ li \$t0, 10 + + ╰─ Consider adding a label called main to an instruction +───╯ +" +`; + +snapshot[`mips/error/compiler/test_mips_error_compiler_030.s 4`] = ` +"[E13] Error: Main label main not found + ╭─[ assembly:8:15 ] + │ + 8 │     li \$t0, 10 +  │ │ +  │ ╰─ Consider adding a label called main to an instruction +───╯ +" +`; diff --git a/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_002.s.snap b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_002.s.snap new file mode 100644 index 000000000..4b9a9294e --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_002.s.snap @@ -0,0 +1,37 @@ +export const snapshot = {}; + +snapshot[`mips/error/executor/test_mips_error_executor_002.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Stack pointer cannot be outside the stack segment", + i: 2, + }, + ], + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 232, + "11": 32, + "12": 3, + "13": 224, + "15": 8, + "2": 255, + "3": 255, + "4": 52, + "5": 33, + "6": 255, + "7": 255, + "9": 32, + }, + registers: { + "1,at": "0xffffffff", + "29,sp": "0xffffffff", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_003.s.snap b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_003.s.snap new file mode 100644 index 000000000..ce7c73b21 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_003.s.snap @@ -0,0 +1,27 @@ +export const snapshot = {}; + +snapshot[`mips/error/executor/test_mips_error_executor_003.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Stack pointer cannot be placed in the text segment", + i: 0, + }, + ], + keyboard: "", + memory: { + "0": 32, + "1": 29, + "4": 3, + "5": 224, + "7": 8, + }, + registers: { + "29,sp": "0x0", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_004.s.snap b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_004.s.snap new file mode 100644 index 000000000..488b0efca --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_004.s.snap @@ -0,0 +1,34 @@ +export const snapshot = {}; + +snapshot[`mips/error/executor/test_mips_error_executor_004.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Stack pointer cannot be placed in the data segment", + i: 2, + }, + ], + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 232, + "11": 32, + "12": 3, + "13": 224, + "15": 8, + "3": 32, + "4": 52, + "5": 33, + "9": 32, + }, + registers: { + "1,at": "0x200000", + "29,sp": "0x200000", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_005.s.snap b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_005.s.snap new file mode 100644 index 000000000..898273a85 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_005.s.snap @@ -0,0 +1,30 @@ +export const snapshot = {}; + +snapshot[`mips/error/executor/test_mips_error_executor_005.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Segmentation fault. You tried to write in the text segment", + i: 1, + }, + ], + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 8, + "3": 10, + "4": 172, + "5": 8, + "8": 3, + "9": 224, + }, + registers: { + "8,t0": "0xa", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_006.s.snap b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_006.s.snap new file mode 100644 index 000000000..7839c58b4 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_006.s.snap @@ -0,0 +1,30 @@ +export const snapshot = {}; + +snapshot[`mips/error/executor/test_mips_error_executor_006.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Segmentation fault. You tried to read in the text segment (00000000)", + i: 1, + }, + ], + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 8, + "3": 10, + "4": 140, + "5": 8, + "8": 3, + "9": 224, + }, + registers: { + "8,t0": "0xa", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_007.s.snap b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_007.s.snap new file mode 100644 index 000000000..30db9fc1a --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_007.s.snap @@ -0,0 +1,41 @@ +export const snapshot = {}; + +snapshot[`mips/error/executor/test_mips_error_executor_007.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "The memory must be aligned", + i: 4, + }, + ], + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "15": 10, + "16": 173, + "17": 9, + "19": 1, + "20": 3, + "21": 224, + "23": 8, + "3": 32, + "4": 52, + "5": 33, + "9": 32, + }, + registers: { + "1,at": "0x200000", + "8,t0": "0x200000", + "9,t1": "0xa", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_008.s.snap b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_008.s.snap new file mode 100644 index 000000000..516516598 --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_008.s.snap @@ -0,0 +1,41 @@ +export const snapshot = {}; + +snapshot[`mips/error/executor/test_mips_error_executor_008.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "The memory must be aligned", + i: 4, + }, + ], + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "15": 10, + "16": 141, + "17": 9, + "19": 1, + "20": 3, + "21": 224, + "23": 8, + "3": 32, + "4": 52, + "5": 33, + "9": 32, + }, + registers: { + "1,at": "0x200000", + "8,t0": "0x200000", + "9,t1": "0xa", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_009.s.snap b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_009.s.snap new file mode 100644 index 000000000..a13c076be --- /dev/null +++ b/tests/arch/__snapshots__/mips/error/executor/test_mips_error_executor_009.s.snap @@ -0,0 +1,26 @@ +export const snapshot = {}; + +snapshot[`mips/error/executor/test_mips_error_executor_009.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "The register 0 | zero is not writeable", + i: 0, + }, + ], + keyboard: "", + memory: { + "0": 32, + "3": 10, + "4": 3, + "5": 224, + "7": 8, + }, + registers: { + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_001.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_001.s.snap new file mode 100644 index 000000000..ce753f488 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_001.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_001.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 255, + "11": 226, + "13": 32, + "14": 72, + "15": 32, + "16": 32, + "17": 10, + "20": 32, + "21": 11, + "23": 18, + "24": 1, + "25": 40, + "26": 96, + "27": 32, + "28": 1, + "29": 73, + "3": 10, + "30": 104, + "31": 32, + "32": 1, + "33": 106, + "34": 112, + "35": 32, + "36": 3, + "37": 224, + "39": 8, + "4": 60, + "5": 1, + "6": 255, + "7": 255, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0xffffffe2", + "11,t3": "0x12", + "12,t4": "0xffffffec", + "13,t5": "0xffffffe2", + "14,t6": "0x12", + "8,t0": "0xa", + "9,t1": "0xffffffe2", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_002.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_002.s.snap new file mode 100644 index 000000000..dba5cd9b9 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_002.s.snap @@ -0,0 +1,36 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_002.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 1, + "11": 155, + "12": 33, + "13": 75, + "15": 12, + "16": 3, + "17": 224, + "19": 8, + "3": 10, + "4": 33, + "5": 9, + "6": 255, + "7": 226, + "8": 33, + "9": 42, + }, + registers: { + "10,t2": "0x187", + "11,t3": "0x193", + "8,t0": "0xa", + "9,t1": "0xffffffec", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_003.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_003.s.snap new file mode 100644 index 000000000..8ddb7c836 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_003.s.snap @@ -0,0 +1,66 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_003.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 252, + "11": 87, + "13": 32, + "14": 72, + "15": 32, + "16": 32, + "17": 10, + "19": 12, + "2": 2, + "20": 60, + "21": 1, + "23": 18, + "24": 52, + "25": 33, + "26": 53, + "27": 21, + "29": 32, + "3": 35, + "30": 88, + "31": 32, + "32": 1, + "33": 136, + "34": 72, + "35": 34, + "36": 1, + "37": 170, + "38": 96, + "39": 34, + "4": 60, + "40": 1, + "41": 203, + "42": 104, + "43": 34, + "44": 3, + "45": 224, + "47": 8, + "5": 1, + "6": 255, + "7": 255, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0x123515", + "10,t2": "0xc", + "11,t3": "0x123515", + "12,t4": "0x5cc", + "13,t5": "0xfffffa40", + "14,t6": "0x123ad5", + "8,t0": "0x223", + "9,t1": "0xfffffc57", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_004.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_004.s.snap new file mode 100644 index 000000000..27cc3fc15 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_004.s.snap @@ -0,0 +1,40 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_004.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 8, + "11": 52, + "12": 60, + "13": 24, + "14": 15, + "15": 240, + "16": 60, + "17": 25, + "19": 2, + "20": 3, + "21": 224, + "23": 8, + "3": 35, + "4": 60, + "5": 14, + "6": 86, + "7": 219, + "8": 60, + "9": 15, + }, + registers: { + "14,t6": "0x56db0000", + "15,t7": "0x340000", + "24,t8": "0xff00000", + "25,t9": "0x20000", + "8,t0": "0x230000", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_005.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_005.s.snap new file mode 100644 index 000000000..906e28f0d --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_005.s.snap @@ -0,0 +1,68 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_005.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 13, + "10": 252, + "11": 87, + "13": 32, + "14": 112, + "15": 32, + "16": 32, + "17": 15, + "19": 12, + "2": 2, + "20": 60, + "21": 1, + "23": 18, + "24": 52, + "25": 33, + "26": 53, + "27": 21, + "29": 32, + "3": 35, + "30": 192, + "31": 32, + "32": 12, + "35": 48, + "36": 3, + "37": 45, + "38": 112, + "39": 34, + "4": 60, + "40": 2, + "41": 47, + "42": 200, + "43": 34, + "44": 2, + "45": 88, + "46": 136, + "47": 34, + "48": 32, + "49": 2, + "5": 1, + "51": 10, + "55": 12, + "6": 255, + "7": 255, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0x123515", + "13,t5": "0x223", + "14,t6": "0xfffffc57", + "15,t7": "0xc", + "2,v0": "0xa", + "24,t8": "0x123515", + "31,ra": "0x24", + PC: "0x38", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_006.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_006.s.snap new file mode 100644 index 000000000..5eb7c08ff --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_006.s.snap @@ -0,0 +1,73 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_006.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 252, + "11": 87, + "13": 32, + "14": 72, + "15": 32, + "16": 32, + "17": 10, + "19": 12, + "2": 2, + "20": 60, + "21": 1, + "23": 18, + "24": 52, + "25": 33, + "26": 53, + "27": 21, + "29": 32, + "3": 35, + "30": 88, + "31": 32, + "32": 32, + "33": 24, + "35": 52, + "36": 3, + "38": 96, + "39": 9, + "4": 60, + "40": 1, + "41": 169, + "42": 80, + "43": 34, + "44": 1, + "45": 202, + "46": 88, + "47": 34, + "48": 1, + "49": 235, + "5": 1, + "50": 96, + "51": 34, + "52": 32, + "53": 2, + "55": 10, + "59": 12, + "6": 255, + "7": 255, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0x123515", + "10,t2": "0xc", + "11,t3": "0x123515", + "12,t4": "0x28", + "2,v0": "0xa", + "24,t8": "0x34", + "8,t0": "0x223", + "9,t1": "0xfffffc57", + PC: "0x3c", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_007.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_007.s.snap new file mode 100644 index 000000000..0c27e1dfc --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_007.s.snap @@ -0,0 +1,119 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_007.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 24, + "103": 1, + "104": 18, + "105": 51, + "107": 8, + "108": 32, + "109": 25, + "11": 32, + "111": 1, + "112": 3, + "113": 224, + "115": 8, + "12": 60, + "13": 1, + "14": 255, + "15": 255, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 18, + "33": 16, + "35": 8, + "36": 32, + "37": 8, + "39": 1, + "4": 52, + "40": 18, + "41": 48, + "43": 8, + "44": 32, + "45": 9, + "47": 1, + "48": 18, + "49": 17, + "5": 33, + "51": 8, + "52": 32, + "53": 10, + "55": 1, + "56": 18, + "57": 82, + "59": 8, + "6": 255, + "60": 32, + "61": 11, + "63": 1, + "64": 18, + "65": 114, + "67": 8, + "68": 32, + "69": 12, + "7": 216, + "71": 1, + "72": 18, + "73": 83, + "75": 8, + "76": 32, + "77": 13, + "79": 1, + "80": 18, + "81": 80, + "83": 8, + "84": 32, + "85": 14, + "87": 1, + "88": 18, + "89": 18, + "9": 32, + "91": 8, + "92": 32, + "93": 15, + "95": 1, + "96": 18, + "97": 113, + "99": 8, + }, + registers: { + "1,at": "0xfffffff6", + "10,t2": "0x1", + "12,t4": "0x1", + "13,t5": "0x1", + "14,t6": "0x1", + "15,t7": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "24,t8": "0x1", + "25,t9": "0x1", + "9,t1": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_008.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_008.s.snap new file mode 100644 index 000000000..786f74a51 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_008.s.snap @@ -0,0 +1,113 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_008.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 24, + "103": 1, + "104": 22, + "105": 51, + "107": 8, + "108": 32, + "109": 25, + "11": 32, + "111": 1, + "112": 3, + "113": 224, + "115": 8, + "12": 60, + "13": 1, + "14": 255, + "15": 255, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 22, + "33": 16, + "35": 8, + "36": 32, + "37": 8, + "39": 1, + "4": 52, + "40": 22, + "41": 48, + "43": 8, + "44": 32, + "45": 9, + "47": 1, + "48": 22, + "49": 17, + "5": 33, + "51": 8, + "52": 32, + "53": 10, + "55": 1, + "56": 22, + "57": 82, + "59": 8, + "6": 255, + "60": 32, + "61": 11, + "63": 1, + "64": 22, + "65": 114, + "67": 8, + "68": 32, + "69": 12, + "7": 216, + "71": 1, + "72": 22, + "73": 83, + "75": 8, + "76": 32, + "77": 13, + "79": 1, + "80": 22, + "81": 80, + "83": 8, + "84": 32, + "85": 14, + "87": 1, + "88": 22, + "89": 18, + "9": 32, + "91": 8, + "92": 32, + "93": 15, + "95": 1, + "96": 22, + "97": 113, + "99": 8, + }, + registers: { + "1,at": "0xfffffff6", + "11,t3": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "8,t0": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_009.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_009.s.snap new file mode 100644 index 000000000..62e719e21 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_009.s.snap @@ -0,0 +1,156 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_009.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 13, + "103": 1, + "104": 2, + "105": 18, + "106": 8, + "107": 42, + "108": 20, + "109": 1, + "11": 32, + "111": 8, + "112": 32, + "113": 14, + "115": 1, + "116": 2, + "117": 80, + "118": 8, + "119": 42, + "12": 60, + "120": 20, + "121": 1, + "123": 8, + "124": 32, + "125": 15, + "127": 1, + "128": 2, + "129": 51, + "13": 1, + "130": 8, + "131": 42, + "132": 20, + "133": 1, + "135": 8, + "136": 32, + "137": 24, + "139": 1, + "14": 255, + "140": 2, + "141": 113, + "142": 8, + "143": 42, + "144": 20, + "145": 1, + "147": 8, + "148": 32, + "149": 25, + "15": 255, + "151": 1, + "152": 3, + "153": 224, + "155": 8, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 2, + "33": 16, + "34": 8, + "35": 42, + "36": 20, + "37": 1, + "39": 8, + "4": 52, + "40": 32, + "41": 8, + "43": 1, + "44": 2, + "45": 17, + "46": 8, + "47": 42, + "48": 20, + "49": 1, + "5": 33, + "51": 8, + "52": 32, + "53": 9, + "55": 1, + "56": 2, + "57": 48, + "58": 8, + "59": 42, + "6": 255, + "60": 20, + "61": 1, + "63": 8, + "64": 32, + "65": 10, + "67": 1, + "68": 2, + "69": 82, + "7": 216, + "70": 8, + "71": 42, + "72": 20, + "73": 1, + "75": 8, + "76": 32, + "77": 11, + "79": 1, + "80": 2, + "81": 83, + "82": 8, + "83": 42, + "84": 20, + "85": 1, + "87": 8, + "88": 32, + "89": 12, + "9": 32, + "91": 1, + "92": 2, + "93": 114, + "94": 8, + "95": 42, + "96": 20, + "97": 1, + "99": 8, + }, + registers: { + "10,t2": "0x1", + "11,t3": "0x1", + "13,t5": "0x1", + "15,t7": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "25,t9": "0x1", + "8,t0": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_010.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_010.s.snap new file mode 100644 index 000000000..ad98b092a --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_010.s.snap @@ -0,0 +1,154 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_010.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 13, + "103": 1, + "104": 2, + "105": 18, + "106": 8, + "107": 42, + "108": 16, + "109": 1, + "11": 32, + "111": 8, + "112": 32, + "113": 14, + "115": 1, + "116": 2, + "117": 80, + "118": 8, + "119": 42, + "12": 60, + "120": 16, + "121": 1, + "123": 8, + "124": 32, + "125": 15, + "127": 1, + "128": 2, + "129": 51, + "13": 1, + "130": 8, + "131": 42, + "132": 16, + "133": 1, + "135": 8, + "136": 32, + "137": 24, + "139": 1, + "14": 255, + "140": 2, + "141": 113, + "142": 8, + "143": 42, + "144": 16, + "145": 1, + "147": 8, + "148": 32, + "149": 25, + "15": 255, + "151": 1, + "152": 3, + "153": 224, + "155": 8, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 2, + "33": 16, + "34": 8, + "35": 42, + "36": 16, + "37": 1, + "39": 8, + "4": 52, + "40": 32, + "41": 8, + "43": 1, + "44": 2, + "45": 17, + "46": 8, + "47": 42, + "48": 16, + "49": 1, + "5": 33, + "51": 8, + "52": 32, + "53": 9, + "55": 1, + "56": 2, + "57": 48, + "58": 8, + "59": 42, + "6": 255, + "60": 16, + "61": 1, + "63": 8, + "64": 32, + "65": 10, + "67": 1, + "68": 2, + "69": 82, + "7": 216, + "70": 8, + "71": 42, + "72": 16, + "73": 1, + "75": 8, + "76": 32, + "77": 11, + "79": 1, + "80": 2, + "81": 83, + "82": 8, + "83": 42, + "84": 16, + "85": 1, + "87": 8, + "88": 32, + "89": 12, + "9": 32, + "91": 1, + "92": 2, + "93": 114, + "94": 8, + "95": 42, + "96": 16, + "97": 1, + "99": 8, + }, + registers: { + "12,t4": "0x1", + "14,t6": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "24,t8": "0x1", + "9,t1": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_011.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_011.s.snap new file mode 100644 index 000000000..febfa25e6 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_011.s.snap @@ -0,0 +1,157 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_011.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 13, + "103": 1, + "104": 2, + "105": 18, + "106": 8, + "107": 43, + "108": 20, + "109": 1, + "11": 32, + "111": 8, + "112": 32, + "113": 14, + "115": 1, + "116": 2, + "117": 80, + "118": 8, + "119": 43, + "12": 60, + "120": 20, + "121": 1, + "123": 8, + "124": 32, + "125": 15, + "127": 1, + "128": 2, + "129": 51, + "13": 1, + "130": 8, + "131": 43, + "132": 20, + "133": 1, + "135": 8, + "136": 32, + "137": 24, + "139": 1, + "14": 255, + "140": 2, + "141": 113, + "142": 8, + "143": 43, + "144": 20, + "145": 1, + "147": 8, + "148": 32, + "149": 25, + "15": 255, + "151": 1, + "152": 3, + "153": 224, + "155": 8, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 2, + "33": 16, + "34": 8, + "35": 43, + "36": 20, + "37": 1, + "39": 8, + "4": 52, + "40": 32, + "41": 8, + "43": 1, + "44": 2, + "45": 17, + "46": 8, + "47": 43, + "48": 20, + "49": 1, + "5": 33, + "51": 8, + "52": 32, + "53": 9, + "55": 1, + "56": 2, + "57": 48, + "58": 8, + "59": 43, + "6": 255, + "60": 20, + "61": 1, + "63": 8, + "64": 32, + "65": 10, + "67": 1, + "68": 2, + "69": 82, + "7": 216, + "70": 8, + "71": 43, + "72": 20, + "73": 1, + "75": 8, + "76": 32, + "77": 11, + "79": 1, + "80": 2, + "81": 83, + "82": 8, + "83": 43, + "84": 20, + "85": 1, + "87": 8, + "88": 32, + "89": 12, + "9": 32, + "91": 1, + "92": 2, + "93": 114, + "94": 8, + "95": 43, + "96": 20, + "97": 1, + "99": 8, + }, + registers: { + "1,at": "0x1", + "10,t2": "0x1", + "11,t3": "0x1", + "13,t5": "0x1", + "14,t6": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "24,t8": "0x1", + "8,t0": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_012.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_012.s.snap new file mode 100644 index 000000000..83fb2eda3 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_012.s.snap @@ -0,0 +1,155 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_012.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 13, + "103": 1, + "104": 2, + "105": 18, + "106": 8, + "107": 43, + "108": 16, + "109": 1, + "11": 32, + "111": 8, + "112": 32, + "113": 14, + "115": 1, + "116": 2, + "117": 80, + "118": 8, + "119": 43, + "12": 60, + "120": 16, + "121": 1, + "123": 8, + "124": 32, + "125": 15, + "127": 1, + "128": 2, + "129": 51, + "13": 1, + "130": 8, + "131": 43, + "132": 16, + "133": 1, + "135": 8, + "136": 32, + "137": 24, + "139": 1, + "14": 255, + "140": 2, + "141": 113, + "142": 8, + "143": 43, + "144": 16, + "145": 1, + "147": 8, + "148": 32, + "149": 25, + "15": 255, + "151": 1, + "152": 3, + "153": 224, + "155": 8, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 2, + "33": 16, + "34": 8, + "35": 43, + "36": 16, + "37": 1, + "39": 8, + "4": 52, + "40": 32, + "41": 8, + "43": 1, + "44": 2, + "45": 17, + "46": 8, + "47": 43, + "48": 16, + "49": 1, + "5": 33, + "51": 8, + "52": 32, + "53": 9, + "55": 1, + "56": 2, + "57": 48, + "58": 8, + "59": 43, + "6": 255, + "60": 16, + "61": 1, + "63": 8, + "64": 32, + "65": 10, + "67": 1, + "68": 2, + "69": 82, + "7": 216, + "70": 8, + "71": 43, + "72": 16, + "73": 1, + "75": 8, + "76": 32, + "77": 11, + "79": 1, + "80": 2, + "81": 83, + "82": 8, + "83": 43, + "84": 16, + "85": 1, + "87": 8, + "88": 32, + "89": 12, + "9": 32, + "91": 1, + "92": 2, + "93": 114, + "94": 8, + "95": 43, + "96": 16, + "97": 1, + "99": 8, + }, + registers: { + "1,at": "0x1", + "12,t4": "0x1", + "15,t7": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "25,t9": "0x1", + "9,t1": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_013.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_013.s.snap new file mode 100644 index 000000000..e5ced23d7 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_013.s.snap @@ -0,0 +1,163 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_013.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "100": 133, + "101": 82, + "103": 2, + "104": 60, + "105": 1, + "107": 32, + "108": 52, + "109": 33, + "11": 32, + "111": 8, + "112": 148, + "113": 51, + "116": 60, + "117": 1, + "119": 32, + "12": 60, + "120": 52, + "121": 33, + "123": 12, + "125": 32, + "126": 200, + "127": 32, + "128": 175, + "129": 43, + "13": 1, + "132": 60, + "133": 1, + "135": 32, + "136": 52, + "137": 33, + "139": 16, + "141": 32, + "142": 200, + "143": 32, + "144": 163, + "145": 45, + "148": 163, + "149": 48, + "15": 32, + "151": 1, + "152": 60, + "153": 1, + "155": 32, + "156": 52, + "157": 33, + "159": 18, + "16": 52, + "161": 32, + "162": 200, + "163": 32, + "164": 167, + "165": 47, + "168": 167, + "169": 50, + "17": 33, + "171": 2, + "172": 3, + "173": 224, + "175": 8, + "19": 4, + "2097155": 14, + "2097156": 127, + "2097157": 214, + "2097158": 127, + "2097159": 255, + "2097160": 207, + "2097161": 199, + "2097167": 14, + "2097168": 127, + "2097169": 214, + "2097170": 127, + "2097171": 255, + "2097172": 207, + "2097173": 199, + "21": 32, + "22": 72, + "23": 32, + "24": 60, + "25": 1, + "27": 32, + "28": 52, + "29": 33, + "3": 32, + "31": 6, + "33": 32, + "34": 80, + "35": 32, + "36": 141, + "37": 11, + "4": 52, + "40": 60, + "41": 1, + "43": 32, + "44": 52, + "45": 33, + "48": 140, + "49": 44, + "5": 33, + "52": 129, + "53": 45, + "56": 60, + "57": 1, + "59": 32, + "60": 52, + "61": 33, + "63": 4, + "64": 144, + "65": 46, + "68": 129, + "69": 48, + "71": 1, + "72": 60, + "73": 1, + "75": 32, + "76": 52, + "77": 33, + "79": 5, + "80": 144, + "81": 49, + "84": 133, + "85": 79, + "88": 60, + "89": 1, + "9": 32, + "91": 32, + "92": 52, + "93": 33, + "95": 6, + "96": 148, + "97": 56, + }, + registers: { + "1,at": "0x200012", + "10,t2": "0x200006", + "11,t3": "0xe", + "12,t4": "0xe", + "13,t5": "0x7f", + "14,t6": "0x7f", + "15,t7": "0x7fff", + "16,s0": "0xffffffd6", + "17,s1": "0xd6", + "18,s2": "0xffffcfc7", + "19,s3": "0xcfc7", + "24,t8": "0x7fff", + "25,t9": "0x200012", + "8,t0": "0x200000", + "9,t1": "0x200004", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_014.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_014.s.snap new file mode 100644 index 000000000..67841c660 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_014.s.snap @@ -0,0 +1,94 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_014.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 60, + "13": 1, + "15": 32, + "16": 52, + "17": 33, + "19": 2, + "2097152": 127, + "2097153": 214, + "2097154": 127, + "2097155": 255, + "2097156": 207, + "2097157": 199, + "2097160": 127, + "2097161": 214, + "2097162": 127, + "2097163": 255, + "2097164": 207, + "2097165": 199, + "21": 32, + "22": 72, + "23": 32, + "24": 145, + "25": 10, + "28": 145, + "29": 16, + "3": 32, + "31": 1, + "32": 149, + "33": 43, + "36": 149, + "37": 49, + "39": 2, + "4": 52, + "40": 60, + "41": 1, + "43": 32, + "44": 52, + "45": 33, + "47": 8, + "49": 32, + "5": 33, + "50": 96, + "51": 32, + "52": 161, + "53": 138, + "56": 161, + "57": 144, + "59": 1, + "60": 60, + "61": 1, + "63": 32, + "64": 52, + "65": 33, + "67": 10, + "69": 32, + "70": 112, + "71": 32, + "72": 165, + "73": 203, + "76": 165, + "77": 209, + "79": 2, + "80": 3, + "81": 224, + "83": 8, + "9": 32, + }, + registers: { + "1,at": "0x20000a", + "10,t2": "0x7f", + "11,t3": "0x7fff", + "12,t4": "0x200008", + "14,t6": "0x20000a", + "16,s0": "0xd6", + "17,s1": "0xcfc7", + "8,t0": "0x200000", + "9,t1": "0x200002", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_015.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_015.s.snap new file mode 100644 index 000000000..850ca19f5 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_015.s.snap @@ -0,0 +1,70 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_015.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 252, + "13": 32, + "14": 104, + "15": 32, + "16": 41, + "17": 9, + "18": 2, + "19": 239, + "2": 2, + "20": 41, + "21": 10, + "22": 2, + "23": 240, + "24": 41, + "25": 11, + "26": 2, + "27": 241, + "28": 41, + "29": 12, + "3": 240, + "30": 2, + "31": 242, + "32": 41, + "33": 174, + "34": 251, + "35": 255, + "36": 41, + "37": 175, + "38": 252, + "4": 60, + "40": 41, + "41": 184, + "42": 252, + "43": 1, + "44": 41, + "45": 185, + "46": 252, + "47": 2, + "48": 3, + "49": 224, + "5": 1, + "51": 8, + "6": 255, + "7": 255, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0xfffffc00", + "11,t3": "0x1", + "12,t4": "0x1", + "13,t5": "0xfffffc00", + "24,t8": "0x1", + "25,t9": "0x1", + "8,t0": "0x2f0", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_016.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_016.s.snap new file mode 100644 index 000000000..925eca3aa --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_016.s.snap @@ -0,0 +1,70 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_016.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 252, + "13": 32, + "14": 104, + "15": 32, + "16": 45, + "17": 9, + "18": 2, + "19": 239, + "2": 2, + "20": 45, + "21": 10, + "22": 2, + "23": 240, + "24": 45, + "25": 11, + "26": 2, + "27": 241, + "28": 45, + "29": 12, + "3": 240, + "30": 2, + "31": 242, + "32": 45, + "33": 174, + "34": 251, + "35": 255, + "36": 45, + "37": 175, + "38": 252, + "4": 60, + "40": 45, + "41": 184, + "42": 252, + "43": 1, + "44": 45, + "45": 185, + "46": 252, + "47": 2, + "48": 3, + "49": 224, + "5": 1, + "51": 8, + "6": 255, + "7": 255, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0xfffffc00", + "11,t3": "0x1", + "12,t4": "0x1", + "13,t5": "0xfffffc00", + "24,t8": "0x1", + "25,t9": "0x1", + "8,t0": "0x2f0", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_017.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_017.s.snap new file mode 100644 index 000000000..bde27f869 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_017.s.snap @@ -0,0 +1,62 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_017.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "28": 57, + "29": 104, + "3": 2, + "30": 4, + "31": 85, + "32": 57, + "33": 137, + "34": 2, + "35": 34, + "36": 57, + "37": 170, + "38": 15, + "39": 255, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 35, + "7": 70, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x22713", + "12,t4": "0x13f5", + "13,t5": "0xffffd50d", + "8,t0": "0x22346", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_018.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_018.s.snap new file mode 100644 index 000000000..de1b4a071 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_018.s.snap @@ -0,0 +1,62 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_018.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "28": 53, + "29": 104, + "3": 2, + "30": 4, + "31": 85, + "32": 53, + "33": 137, + "34": 2, + "35": 34, + "36": 53, + "37": 170, + "38": 15, + "39": 255, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 35, + "7": 70, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x22757", + "12,t4": "0x13f7", + "13,t5": "0xffffdfff", + "8,t0": "0x22346", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_019.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_019.s.snap new file mode 100644 index 000000000..3a78f89f0 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_019.s.snap @@ -0,0 +1,62 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_019.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "28": 49, + "29": 11, + "3": 2, + "30": 4, + "31": 85, + "32": 49, + "33": 44, + "34": 2, + "35": 34, + "36": 49, + "37": 77, + "38": 15, + "39": 255, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 35, + "7": 70, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x44", + "12,t4": "0x2", + "13,t5": "0xaf2", + "8,t0": "0x22346", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_020.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_020.s.snap new file mode 100644 index 000000000..4d61306ab --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_020.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_020.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 255, + "11": 255, + "12": 52, + "13": 33, + "14": 224, + "17": 32, + "18": 80, + "19": 32, + "20": 32, + "21": 11, + "23": 24, + "24": 1, + "25": 72, + "27": 26, + "3": 16, + "30": 128, + "31": 16, + "34": 136, + "35": 18, + "36": 1, + "37": 40, + "39": 26, + "4": 32, + "42": 144, + "43": 16, + "46": 152, + "47": 18, + "48": 1, + "49": 75, + "5": 9, + "51": 26, + "54": 160, + "55": 16, + "58": 168, + "59": 18, + "6": 1, + "60": 1, + "61": 106, + "63": 26, + "64": 3, + "65": 224, + "67": 8, + "8": 60, + "9": 1, + }, + registers: { + "1,at": "0xffffe000", + "10,t2": "0xffffe000", + "11,t3": "0x18", + "17,s1": "0xfffffe00", + "19,s3": "0x10", + "20,s4": "0xfffffff8", + "21,s5": "0xfffffeab", + "8,t0": "0x10", + "9,t1": "0x100", + HI: "0x18", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_021.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_021.s.snap new file mode 100644 index 000000000..cfc12b0fb --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_021.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_021.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 255, + "11": 255, + "12": 52, + "13": 33, + "14": 224, + "17": 32, + "18": 80, + "19": 32, + "20": 32, + "21": 11, + "23": 24, + "24": 1, + "25": 72, + "27": 27, + "3": 16, + "30": 128, + "31": 16, + "34": 136, + "35": 18, + "36": 1, + "37": 40, + "39": 27, + "4": 32, + "42": 144, + "43": 16, + "46": 152, + "47": 18, + "48": 1, + "49": 75, + "5": 9, + "51": 27, + "54": 160, + "55": 16, + "58": 168, + "59": 18, + "6": 1, + "60": 1, + "61": 106, + "63": 27, + "64": 3, + "65": 224, + "67": 8, + "8": 60, + "9": 1, + }, + registers: { + "1,at": "0xffffe000", + "10,t2": "0xffffe000", + "11,t3": "0x18", + "17,s1": "0xffffe00", + "19,s3": "0x10", + "20,s4": "0x8", + "21,s5": "0xaaaa955", + "8,t0": "0x10", + "9,t1": "0x100", + HI: "0x18", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_022.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_022.s.snap new file mode 100644 index 000000000..c8c481e4e --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_022.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_022.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "29": 40, + "30": 88, + "31": 130, + "33": 41, + "34": 97, + "35": 2, + "37": 42, + "38": 107, + "39": 194, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 170, + "7": 212, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x2ab5", + "12,t4": "0x7000011d", + "13,t5": "0xb5e5ffff", + "8,t0": "0xaad4", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_023.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_023.s.snap new file mode 100644 index 000000000..85876f8bf --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_023.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_023.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "29": 8, + "30": 88, + "31": 191, + "33": 9, + "34": 97, + "35": 63, + "37": 10, + "38": 107, + "39": 255, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 170, + "7": 212, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x2ab50", + "12,t4": "0x11d70", + "13,t5": "0xed790000", + "8,t0": "0xaad4", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_024.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_024.s.snap new file mode 100644 index 000000000..ca1acc358 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_024.s.snap @@ -0,0 +1,55 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_024.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 32, + "11": 1, + "12": 32, + "13": 11, + "14": 32, + "15": 2, + "16": 1, + "17": 40, + "18": 96, + "19": 42, + "2": 31, + "20": 1, + "21": 41, + "22": 104, + "23": 42, + "24": 1, + "25": 42, + "26": 112, + "27": 42, + "28": 1, + "29": 43, + "3": 255, + "30": 120, + "31": 42, + "32": 3, + "33": 224, + "35": 8, + "4": 32, + "5": 9, + "6": 32, + "8": 32, + "9": 10, + }, + registers: { + "10,t2": "0x2001", + "11,t3": "0x2002", + "14,t6": "0x1", + "15,t7": "0x1", + "8,t0": "0x1fff", + "9,t1": "0x2000", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_025.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_025.s.snap new file mode 100644 index 000000000..15ffb81c0 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_025.s.snap @@ -0,0 +1,55 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_025.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 32, + "11": 1, + "12": 32, + "13": 11, + "14": 32, + "15": 2, + "16": 1, + "17": 40, + "18": 96, + "19": 43, + "2": 31, + "20": 1, + "21": 41, + "22": 104, + "23": 43, + "24": 1, + "25": 42, + "26": 112, + "27": 43, + "28": 1, + "29": 43, + "3": 255, + "30": 120, + "31": 43, + "32": 3, + "33": 224, + "35": 8, + "4": 32, + "5": 9, + "6": 32, + "8": 32, + "9": 10, + }, + registers: { + "10,t2": "0x2001", + "11,t3": "0x2002", + "14,t6": "0x1", + "15,t7": "0x1", + "8,t0": "0x1fff", + "9,t1": "0x2000", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_026.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_026.s.snap new file mode 100644 index 000000000..1a616168a --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_026.s.snap @@ -0,0 +1,77 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_026.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "28": 32, + "29": 11, + "3": 2, + "30": 4, + "31": 85, + "32": 32, + "33": 12, + "34": 2, + "35": 34, + "36": 32, + "37": 13, + "38": 15, + "39": 255, + "4": 52, + "40": 1, + "41": 200, + "42": 88, + "43": 38, + "44": 1, + "45": 233, + "46": 96, + "47": 38, + "48": 3, + "49": 10, + "5": 33, + "50": 104, + "51": 38, + "52": 3, + "53": 224, + "55": 8, + "6": 35, + "7": 70, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x455", + "12,t4": "0x222", + "13,t5": "0xfff", + "14,t6": "0x22713", + "15,t7": "0x13f5", + "24,t8": "0xffffd50d", + "8,t0": "0x22346", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_027.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_027.s.snap new file mode 100644 index 000000000..82f6dfb1e --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_027.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_027.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "29": 8, + "30": 88, + "31": 130, + "33": 9, + "34": 97, + "35": 2, + "37": 10, + "38": 107, + "39": 194, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 170, + "7": 212, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x2ab5", + "12,t4": "0x11d", + "13,t5": "0x1ffff", + "8,t0": "0xaad4", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_028.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_028.s.snap new file mode 100644 index 000000000..5089860e6 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_028.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_028.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "29": 8, + "30": 88, + "31": 131, + "33": 9, + "34": 97, + "35": 3, + "37": 10, + "38": 107, + "39": 195, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 170, + "7": 212, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x2ab5", + "12,t4": "0x11d", + "13,t5": "0xffffffff", + "8,t0": "0xaad4", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_029.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_029.s.snap new file mode 100644 index 000000000..cc0bc1ae8 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_029.s.snap @@ -0,0 +1,77 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_029.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "28": 32, + "29": 11, + "3": 2, + "30": 4, + "31": 85, + "32": 32, + "33": 12, + "34": 2, + "35": 34, + "36": 32, + "37": 13, + "38": 15, + "39": 255, + "4": 52, + "40": 1, + "41": 200, + "42": 88, + "43": 37, + "44": 1, + "45": 233, + "46": 96, + "47": 37, + "48": 3, + "49": 10, + "5": 33, + "50": 104, + "51": 37, + "52": 3, + "53": 224, + "55": 8, + "6": 35, + "7": 70, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x455", + "12,t4": "0x222", + "13,t5": "0xfff", + "14,t6": "0x22757", + "15,t7": "0x13f7", + "24,t8": "0xffffdfff", + "8,t0": "0x22346", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_030.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_030.s.snap new file mode 100644 index 000000000..154fbfc68 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_030.s.snap @@ -0,0 +1,77 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_030.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "28": 32, + "29": 11, + "3": 2, + "30": 4, + "31": 85, + "32": 32, + "33": 12, + "34": 2, + "35": 34, + "36": 32, + "37": 13, + "38": 15, + "39": 255, + "4": 52, + "40": 1, + "41": 104, + "42": 112, + "43": 36, + "44": 1, + "45": 137, + "46": 120, + "47": 36, + "48": 1, + "49": 170, + "5": 33, + "50": 192, + "51": 36, + "52": 3, + "53": 224, + "55": 8, + "6": 35, + "7": 70, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0x455", + "12,t4": "0x222", + "13,t5": "0xfff", + "14,t6": "0x44", + "15,t7": "0x2", + "24,t8": "0xaf2", + "8,t0": "0x22346", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_031.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_031.s.snap new file mode 100644 index 000000000..a4b82bd9d --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_031.s.snap @@ -0,0 +1,122 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_031.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 60, + "13": 1, + "15": 32, + "16": 52, + "17": 33, + "19": 8, + "2097152": 64, + "2097153": 65, + "2097154": 69, + "2097155": 161, + "2097156": 202, + "2097157": 192, + "2097158": 131, + "2097159": 18, + "2097160": 64, + "2097161": 38, + "2097162": 226, + "2097163": 208, + "2097164": 229, + "2097165": 96, + "2097166": 65, + "2097167": 137, + "2097172": 7, + "2097173": 84, + "2097174": 79, + "2097175": 251, + "2097176": 64, + "2097177": 65, + "2097178": 69, + "2097179": 161, + "2097180": 202, + "2097181": 192, + "2097182": 131, + "2097183": 18, + "2097184": 64, + "2097185": 38, + "2097186": 226, + "2097187": 208, + "2097188": 229, + "2097189": 96, + "2097190": 65, + "2097191": 137, + "2097196": 7, + "2097197": 84, + "2097198": 79, + "2097199": 251, + "21": 32, + "22": 72, + "23": 32, + "24": 60, + "25": 1, + "27": 32, + "28": 52, + "29": 33, + "3": 32, + "31": 16, + "33": 32, + "34": 80, + "35": 32, + "36": 60, + "37": 1, + "39": 32, + "4": 52, + "40": 52, + "41": 33, + "43": 24, + "45": 32, + "46": 88, + "47": 32, + "48": 213, + "5": 33, + "52": 213, + "53": 34, + "56": 213, + "57": 68, + "60": 245, + "61": 96, + "64": 33, + "65": 107, + "67": 8, + "68": 245, + "69": 98, + "72": 33, + "73": 107, + "75": 8, + "76": 245, + "77": 100, + "80": 32, + "81": 2, + "83": 10, + "87": 12, + "9": 32, + }, + registers: { + "1,at": "0x200018", + "10,t2": "0x200010", + "11,t3": "0x200028", + "2,v0": "0xa", + "8,t0": "0x200000", + "9,t1": "0x200008", + "f0,FP0": "0x404145a1", + "f2,FP2": "0x4026e2d0", + PC: "0x58", + f1: "0xcac08312", + f3: "0xe5604189", + f5: "0x7544ffb", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_032.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_032.s.snap new file mode 100644 index 000000000..1a48cccd9 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_032.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_032.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 45, + "12": 60, + "13": 1, + "14": 255, + "15": 255, + "16": 52, + "17": 33, + "18": 255, + "19": 254, + "21": 32, + "22": 88, + "23": 32, + "24": 1, + "25": 40, + "27": 24, + "3": 10, + "30": 128, + "31": 16, + "34": 136, + "35": 18, + "36": 1, + "37": 73, + "39": 24, + "4": 32, + "42": 144, + "43": 16, + "46": 152, + "47": 18, + "48": 1, + "49": 106, + "5": 9, + "51": 24, + "54": 160, + "55": 16, + "58": 168, + "59": 18, + "60": 1, + "61": 139, + "63": 24, + "64": 3, + "65": 224, + "67": 8, + "7": 13, + "8": 32, + "9": 10, + }, + registers: { + "1,at": "0xfffffffe", + "10,t2": "0x2d", + "11,t3": "0xfffffffe", + "17,s1": "0x82", + "19,s3": "0x249", + "20,s4": "0xffffffff", + "21,s5": "0xffffffa6", + "8,t0": "0xa", + "9,t1": "0xd", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_034.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_034.s.snap new file mode 100644 index 000000000..c6580c8f9 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_034.s.snap @@ -0,0 +1,63 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_034.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 45, + "12": 60, + "13": 1, + "14": 255, + "15": 255, + "16": 52, + "17": 33, + "18": 255, + "19": 254, + "21": 32, + "22": 88, + "23": 32, + "24": 113, + "25": 136, + "26": 72, + "27": 2, + "28": 113, + "29": 169, + "3": 10, + "30": 80, + "31": 2, + "32": 113, + "33": 202, + "34": 88, + "35": 2, + "36": 113, + "37": 235, + "38": 96, + "39": 2, + "4": 32, + "40": 3, + "41": 224, + "43": 8, + "5": 9, + "7": 13, + "8": 32, + "9": 10, + }, + registers: { + "1,at": "0xfffffffe", + "10,t2": "0x2d", + "11,t3": "0xfffffffe", + "12,t4": "0x82", + "13,t5": "0x249", + "14,t6": "0xffffffa6", + "15,t7": "0xfffffefc", + "8,t0": "0xa", + "9,t1": "0xd", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_035.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_035.s.snap new file mode 100644 index 000000000..5c3617f1d --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_035.s.snap @@ -0,0 +1,78 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_035.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "15": 222, + "16": 60, + "17": 1, + "19": 250, + "2": 1, + "20": 52, + "21": 33, + "22": 187, + "23": 83, + "25": 32, + "26": 80, + "27": 32, + "28": 60, + "29": 1, + "3": 101, + "30": 254, + "31": 154, + "32": 52, + "33": 33, + "34": 17, + "35": 61, + "37": 32, + "38": 88, + "39": 32, + "4": 52, + "40": 1, + "41": 40, + "42": 96, + "43": 33, + "44": 1, + "45": 73, + "46": 104, + "47": 33, + "48": 1, + "49": 106, + "5": 33, + "50": 112, + "51": 33, + "52": 1, + "53": 11, + "54": 120, + "55": 33, + "56": 3, + "57": 224, + "59": 8, + "6": 238, + "7": 184, + "9": 32, + }, + registers: { + "1,at": "0xfe9a113d", + "10,t2": "0xfabb53", + "11,t3": "0xfe9a113d", + "12,t4": "0x165ef96", + "13,t5": "0xfabc31", + "14,t6": "0xff94cc90", + "15,t7": "0xfffffff5", + "8,t0": "0x165eeb8", + "9,t1": "0xde", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_036.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_036.s.snap new file mode 100644 index 000000000..e84c30f5b --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_036.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_036.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 1, + "11": 35, + "12": 60, + "13": 1, + "14": 255, + "15": 255, + "16": 52, + "17": 33, + "18": 169, + "19": 18, + "2": 37, + "21": 32, + "22": 88, + "23": 32, + "24": 37, + "25": 12, + "26": 179, + "27": 56, + "28": 37, + "29": 45, + "3": 184, + "30": 21, + "31": 235, + "32": 37, + "33": 78, + "34": 1, + "35": 36, + "36": 60, + "37": 1, + "39": 3, + "4": 32, + "40": 52, + "41": 33, + "42": 113, + "43": 131, + "45": 43, + "46": 120, + "47": 33, + "48": 3, + "49": 224, + "5": 9, + "51": 8, + "7": 222, + "8": 32, + "9": 10, + }, + registers: { + "1,at": "0x37183", + "10,t2": "0x123", + "11,t3": "0xffffa912", + "12,t4": "0xffffd8f0", + "13,t5": "0x16c9", + "14,t6": "0x247", + "15,t7": "0x31a95", + "8,t0": "0x25b8", + "9,t1": "0xde", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_037.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_037.s.snap new file mode 100644 index 000000000..18128e117 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_037.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_037.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 45, + "12": 60, + "13": 1, + "14": 255, + "15": 255, + "16": 52, + "17": 33, + "18": 255, + "19": 254, + "21": 32, + "22": 88, + "23": 32, + "24": 1, + "25": 40, + "27": 25, + "3": 10, + "30": 128, + "31": 16, + "34": 136, + "35": 18, + "36": 1, + "37": 73, + "39": 25, + "4": 32, + "42": 144, + "43": 16, + "46": 152, + "47": 18, + "48": 1, + "49": 106, + "5": 9, + "51": 25, + "54": 160, + "55": 16, + "58": 168, + "59": 18, + "60": 1, + "61": 139, + "63": 25, + "64": 3, + "65": 224, + "67": 8, + "7": 13, + "8": 32, + "9": 10, + }, + registers: { + "1,at": "0xfffffffe", + "10,t2": "0x2d", + "11,t3": "0xfffffffe", + "17,s1": "0x82", + "19,s3": "0x249", + "20,s4": "0x2c", + "21,s5": "0xffffffa6", + "8,t0": "0xa", + "9,t1": "0xd", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_038.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_038.s.snap new file mode 100644 index 000000000..a8a07d867 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_038.s.snap @@ -0,0 +1,61 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_038.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 255, + "11": 255, + "12": 52, + "13": 33, + "14": 224, + "17": 32, + "18": 80, + "19": 32, + "20": 32, + "21": 11, + "23": 24, + "24": 1, + "25": 72, + "26": 96, + "27": 154, + "28": 1, + "29": 40, + "3": 16, + "30": 104, + "31": 154, + "32": 1, + "33": 75, + "34": 112, + "35": 154, + "36": 1, + "37": 106, + "38": 120, + "39": 154, + "4": 32, + "40": 3, + "41": 224, + "43": 8, + "5": 9, + "6": 1, + "8": 60, + "9": 1, + }, + registers: { + "1,at": "0xffffe000", + "10,t2": "0xffffe000", + "11,t3": "0x18", + "12,t4": "0xfffffe00", + "13,t5": "0x10", + "14,t6": "0xfffffeab", + "8,t0": "0x10", + "9,t1": "0x100", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_039.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_039.s.snap new file mode 100644 index 000000000..07bdc3394 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_039.s.snap @@ -0,0 +1,61 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_039.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 255, + "11": 255, + "12": 52, + "13": 33, + "14": 224, + "17": 32, + "18": 80, + "19": 32, + "20": 32, + "21": 11, + "23": 24, + "24": 1, + "25": 72, + "26": 96, + "27": 155, + "28": 1, + "29": 40, + "3": 16, + "30": 104, + "31": 155, + "32": 1, + "33": 75, + "34": 112, + "35": 155, + "36": 1, + "37": 106, + "38": 120, + "39": 155, + "4": 32, + "40": 3, + "41": 224, + "43": 8, + "5": 9, + "6": 1, + "8": 60, + "9": 1, + }, + registers: { + "1,at": "0xffffe000", + "10,t2": "0xffffe000", + "11,t3": "0x18", + "12,t4": "0xffffe00", + "13,t5": "0x10", + "14,t6": "0xaaaa955", + "8,t0": "0x10", + "9,t1": "0x100", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_040.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_040.s.snap new file mode 100644 index 000000000..037fbaad8 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_040.s.snap @@ -0,0 +1,65 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_040.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 255, + "11": 255, + "12": 52, + "13": 33, + "14": 224, + "17": 32, + "18": 80, + "19": 32, + "20": 32, + "21": 11, + "23": 24, + "24": 1, + "25": 72, + "27": 26, + "3": 16, + "30": 96, + "31": 16, + "32": 1, + "33": 40, + "35": 26, + "38": 104, + "39": 16, + "4": 32, + "40": 1, + "41": 75, + "43": 26, + "46": 112, + "47": 16, + "48": 1, + "49": 106, + "5": 9, + "51": 26, + "54": 120, + "55": 16, + "56": 3, + "57": 224, + "59": 8, + "6": 1, + "8": 60, + "9": 1, + }, + registers: { + "1,at": "0xffffe000", + "10,t2": "0xffffe000", + "11,t3": "0x18", + "14,t6": "0xfffffff8", + "15,t7": "0x18", + "8,t0": "0x10", + "9,t1": "0x100", + HI: "0x18", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_041.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_041.s.snap new file mode 100644 index 000000000..5003b1dd2 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_041.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_041.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 255, + "11": 255, + "12": 52, + "13": 33, + "14": 224, + "17": 32, + "18": 80, + "19": 32, + "20": 32, + "21": 11, + "23": 24, + "24": 1, + "25": 72, + "26": 96, + "27": 219, + "28": 1, + "29": 40, + "3": 16, + "30": 104, + "31": 219, + "32": 1, + "33": 75, + "34": 112, + "35": 219, + "36": 1, + "37": 106, + "38": 120, + "39": 219, + "4": 32, + "40": 3, + "41": 224, + "43": 8, + "5": 9, + "6": 1, + "8": 60, + "9": 1, + }, + registers: { + "1,at": "0xffffe000", + "10,t2": "0xffffe000", + "11,t3": "0x18", + "14,t6": "0x8", + "15,t7": "0x18", + "8,t0": "0x10", + "9,t1": "0x100", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_042.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_042.s.snap new file mode 100644 index 000000000..8e7d77879 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_042.s.snap @@ -0,0 +1,157 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_042.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 13, + "103": 1, + "104": 2, + "105": 80, + "106": 8, + "107": 42, + "108": 20, + "109": 1, + "11": 32, + "111": 8, + "112": 32, + "113": 14, + "115": 1, + "116": 2, + "117": 18, + "118": 8, + "119": 42, + "12": 60, + "120": 20, + "121": 1, + "123": 8, + "124": 32, + "125": 15, + "127": 1, + "128": 2, + "129": 113, + "13": 1, + "130": 8, + "131": 42, + "132": 20, + "133": 1, + "135": 8, + "136": 32, + "137": 24, + "139": 1, + "14": 255, + "140": 2, + "141": 51, + "142": 8, + "143": 42, + "144": 20, + "145": 1, + "147": 8, + "148": 32, + "149": 25, + "15": 255, + "151": 1, + "152": 3, + "153": 224, + "155": 8, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 2, + "33": 16, + "34": 8, + "35": 42, + "36": 20, + "37": 1, + "39": 8, + "4": 52, + "40": 32, + "41": 8, + "43": 1, + "44": 2, + "45": 48, + "46": 8, + "47": 42, + "48": 20, + "49": 1, + "5": 33, + "51": 8, + "52": 32, + "53": 9, + "55": 1, + "56": 2, + "57": 17, + "58": 8, + "59": 42, + "6": 255, + "60": 20, + "61": 1, + "63": 8, + "64": 32, + "65": 10, + "67": 1, + "68": 2, + "69": 82, + "7": 216, + "70": 8, + "71": 42, + "72": 20, + "73": 1, + "75": 8, + "76": 32, + "77": 11, + "79": 1, + "80": 2, + "81": 114, + "82": 8, + "83": 42, + "84": 20, + "85": 1, + "87": 8, + "88": 32, + "89": 12, + "9": 32, + "91": 1, + "92": 2, + "93": 83, + "94": 8, + "95": 42, + "96": 20, + "97": 1, + "99": 8, + }, + registers: { + "1,at": "0x1", + "11,t3": "0x1", + "12,t4": "0x1", + "14,t6": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "24,t8": "0x1", + "8,t0": "0x1", + "9,t1": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_043.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_043.s.snap new file mode 100644 index 000000000..80e65b40d --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_043.s.snap @@ -0,0 +1,156 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_043.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 13, + "103": 1, + "104": 2, + "105": 80, + "106": 8, + "107": 43, + "108": 20, + "109": 1, + "11": 32, + "111": 8, + "112": 32, + "113": 14, + "115": 1, + "116": 2, + "117": 18, + "118": 8, + "119": 43, + "12": 60, + "120": 20, + "121": 1, + "123": 8, + "124": 32, + "125": 15, + "127": 1, + "128": 2, + "129": 113, + "13": 1, + "130": 8, + "131": 43, + "132": 20, + "133": 1, + "135": 8, + "136": 32, + "137": 24, + "139": 1, + "14": 255, + "140": 2, + "141": 51, + "142": 8, + "143": 43, + "144": 20, + "145": 1, + "147": 8, + "148": 32, + "149": 25, + "15": 255, + "151": 1, + "152": 3, + "153": 224, + "155": 8, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 2, + "33": 16, + "34": 8, + "35": 43, + "36": 20, + "37": 1, + "39": 8, + "4": 52, + "40": 32, + "41": 8, + "43": 1, + "44": 2, + "45": 48, + "46": 8, + "47": 43, + "48": 20, + "49": 1, + "5": 33, + "51": 8, + "52": 32, + "53": 9, + "55": 1, + "56": 2, + "57": 17, + "58": 8, + "59": 43, + "6": 255, + "60": 20, + "61": 1, + "63": 8, + "64": 32, + "65": 10, + "67": 1, + "68": 2, + "69": 82, + "7": 216, + "70": 8, + "71": 43, + "72": 20, + "73": 1, + "75": 8, + "76": 32, + "77": 11, + "79": 1, + "80": 2, + "81": 114, + "82": 8, + "83": 43, + "84": 20, + "85": 1, + "87": 8, + "88": 32, + "89": 12, + "9": 32, + "91": 1, + "92": 2, + "93": 83, + "94": 8, + "95": 43, + "96": 20, + "97": 1, + "99": 8, + }, + registers: { + "11,t3": "0x1", + "12,t4": "0x1", + "15,t7": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "25,t9": "0x1", + "8,t0": "0x1", + "9,t1": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_044.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_044.s.snap new file mode 100644 index 000000000..b51139178 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_044.s.snap @@ -0,0 +1,155 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_044.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 13, + "103": 1, + "104": 2, + "105": 80, + "106": 8, + "107": 42, + "108": 16, + "109": 1, + "11": 32, + "111": 8, + "112": 32, + "113": 14, + "115": 1, + "116": 2, + "117": 18, + "118": 8, + "119": 42, + "12": 60, + "120": 16, + "121": 1, + "123": 8, + "124": 32, + "125": 15, + "127": 1, + "128": 2, + "129": 113, + "13": 1, + "130": 8, + "131": 42, + "132": 16, + "133": 1, + "135": 8, + "136": 32, + "137": 24, + "139": 1, + "14": 255, + "140": 2, + "141": 51, + "142": 8, + "143": 42, + "144": 16, + "145": 1, + "147": 8, + "148": 32, + "149": 25, + "15": 255, + "151": 1, + "152": 3, + "153": 224, + "155": 8, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 2, + "33": 16, + "34": 8, + "35": 42, + "36": 16, + "37": 1, + "39": 8, + "4": 52, + "40": 32, + "41": 8, + "43": 1, + "44": 2, + "45": 48, + "46": 8, + "47": 42, + "48": 16, + "49": 1, + "5": 33, + "51": 8, + "52": 32, + "53": 9, + "55": 1, + "56": 2, + "57": 17, + "58": 8, + "59": 42, + "6": 255, + "60": 16, + "61": 1, + "63": 8, + "64": 32, + "65": 10, + "67": 1, + "68": 2, + "69": 82, + "7": 216, + "70": 8, + "71": 42, + "72": 16, + "73": 1, + "75": 8, + "76": 32, + "77": 11, + "79": 1, + "80": 2, + "81": 114, + "82": 8, + "83": 42, + "84": 16, + "85": 1, + "87": 8, + "88": 32, + "89": 12, + "9": 32, + "91": 1, + "92": 2, + "93": 83, + "94": 8, + "95": 42, + "96": 16, + "97": 1, + "99": 8, + }, + registers: { + "1,at": "0x1", + "10,t2": "0x1", + "13,t5": "0x1", + "15,t7": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "25,t9": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_045.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_045.s.snap new file mode 100644 index 000000000..0a13b7fa6 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_045.s.snap @@ -0,0 +1,154 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_045.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "100": 32, + "101": 13, + "103": 1, + "104": 2, + "105": 80, + "106": 8, + "107": 43, + "108": 16, + "109": 1, + "11": 32, + "111": 8, + "112": 32, + "113": 14, + "115": 1, + "116": 2, + "117": 18, + "118": 8, + "119": 43, + "12": 60, + "120": 16, + "121": 1, + "123": 8, + "124": 32, + "125": 15, + "127": 1, + "128": 2, + "129": 113, + "13": 1, + "130": 8, + "131": 43, + "132": 16, + "133": 1, + "135": 8, + "136": 32, + "137": 24, + "139": 1, + "14": 255, + "140": 2, + "141": 51, + "142": 8, + "143": 43, + "144": 16, + "145": 1, + "147": 8, + "148": 32, + "149": 25, + "15": 255, + "151": 1, + "152": 3, + "153": 224, + "155": 8, + "16": 52, + "17": 33, + "18": 255, + "19": 246, + "2": 255, + "21": 32, + "22": 136, + "23": 32, + "24": 32, + "25": 18, + "27": 15, + "28": 32, + "29": 19, + "3": 255, + "31": 32, + "32": 2, + "33": 16, + "34": 8, + "35": 43, + "36": 16, + "37": 1, + "39": 8, + "4": 52, + "40": 32, + "41": 8, + "43": 1, + "44": 2, + "45": 48, + "46": 8, + "47": 43, + "48": 16, + "49": 1, + "5": 33, + "51": 8, + "52": 32, + "53": 9, + "55": 1, + "56": 2, + "57": 17, + "58": 8, + "59": 43, + "6": 255, + "60": 16, + "61": 1, + "63": 8, + "64": 32, + "65": 10, + "67": 1, + "68": 2, + "69": 82, + "7": 216, + "70": 8, + "71": 43, + "72": 16, + "73": 1, + "75": 8, + "76": 32, + "77": 11, + "79": 1, + "80": 2, + "81": 114, + "82": 8, + "83": 43, + "84": 16, + "85": 1, + "87": 8, + "88": 32, + "89": 12, + "9": 32, + "91": 1, + "92": 2, + "93": 83, + "94": 8, + "95": 43, + "96": 16, + "97": 1, + "99": 8, + }, + registers: { + "10,t2": "0x1", + "13,t5": "0x1", + "14,t6": "0x1", + "16,s0": "0xffffffd8", + "17,s1": "0xfffffff6", + "18,s2": "0xf", + "19,s3": "0x20", + "24,t8": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_046.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_046.s.snap new file mode 100644 index 000000000..fae6e06ed --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_046.s.snap @@ -0,0 +1,62 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_046.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 218, + "23": 242, + "25": 32, + "26": 80, + "27": 32, + "28": 1, + "29": 9, + "3": 2, + "30": 88, + "31": 47, + "32": 1, + "33": 42, + "34": 96, + "35": 47, + "36": 1, + "37": 72, + "38": 104, + "39": 47, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 35, + "7": 70, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "11,t3": "0xfffdcc28", + "12,t4": "0x2408", + "13,t5": "0x409", + "8,t0": "0x22346", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_047.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_047.s.snap new file mode 100644 index 000000000..e1c21c7ff --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_047.s.snap @@ -0,0 +1,47 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_047.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 32, + "13": 9, + "14": 17, + "15": 215, + "20": 60, + "21": 1, + "22": 255, + "23": 255, + "24": 52, + "25": 33, + "26": 218, + "27": 242, + "29": 32, + "3": 2, + "30": 80, + "31": 32, + "32": 3, + "33": 224, + "35": 8, + "4": 52, + "5": 33, + "6": 35, + "7": 70, + "9": 32, + }, + registers: { + "1,at": "0xffffdaf2", + "10,t2": "0xffffdaf2", + "8,t0": "0x22346", + "9,t1": "0x11d7", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_048.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_048.s.snap new file mode 100644 index 000000000..824d6a417 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_048.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_048.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 66, + "11": 53, + "13": 32, + "14": 72, + "15": 32, + "16": 60, + "17": 1, + "18": 255, + "19": 255, + "20": 52, + "21": 33, + "22": 255, + "23": 255, + "25": 32, + "26": 80, + "27": 32, + "28": 1, + "3": 1, + "30": 88, + "31": 32, + "32": 1, + "33": 32, + "34": 96, + "35": 32, + "36": 1, + "37": 64, + "38": 104, + "39": 32, + "4": 60, + "40": 3, + "41": 224, + "43": 8, + "5": 1, + "7": 35, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0xffffffff", + "10,t2": "0xffffffff", + "11,t3": "0x1", + "12,t4": "0x234235", + "13,t5": "0xffffffff", + "8,t0": "0x1", + "9,t1": "0x234235", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_049.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_049.s.snap new file mode 100644 index 000000000..ba3d394c1 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_049.s.snap @@ -0,0 +1,55 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_049.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 60, + "13": 1, + "14": 255, + "15": 248, + "16": 52, + "17": 33, + "18": 224, + "19": 202, + "21": 32, + "22": 72, + "23": 32, + "24": 1, + "27": 17, + "28": 1, + "29": 32, + "3": 35, + "31": 19, + "34": 88, + "35": 16, + "38": 96, + "39": 18, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 69, + "7": 102, + "9": 32, + }, + registers: { + "1,at": "0xfff8e0ca", + "11,t3": "0x234566", + "12,t4": "0xfff8e0ca", + "8,t0": "0x234566", + "9,t1": "0xfff8e0ca", + HI: "0x234566", + LO: "0xfff8e0ca", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_050.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_050.s.snap new file mode 100644 index 000000000..cefbdbc6a --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_050.s.snap @@ -0,0 +1,66 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_050.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "10": 252, + "11": 87, + "13": 32, + "14": 72, + "15": 32, + "16": 32, + "17": 10, + "19": 12, + "2": 2, + "20": 60, + "21": 1, + "23": 18, + "24": 52, + "25": 33, + "26": 53, + "27": 21, + "29": 32, + "3": 35, + "30": 88, + "31": 32, + "32": 1, + "33": 9, + "34": 96, + "35": 35, + "36": 1, + "37": 76, + "38": 104, + "39": 35, + "4": 60, + "40": 1, + "41": 109, + "42": 112, + "43": 35, + "44": 3, + "45": 224, + "47": 8, + "5": 1, + "6": 255, + "7": 255, + "8": 52, + "9": 33, + }, + registers: { + "1,at": "0x123515", + "10,t2": "0xc", + "11,t3": "0x123515", + "12,t4": "0x5cc", + "13,t5": "0xfffffa40", + "14,t6": "0x123ad5", + "8,t0": "0x223", + "9,t1": "0xfffffc57", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_051.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_051.s.snap new file mode 100644 index 000000000..1f2aa07a3 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_051.s.snap @@ -0,0 +1,54 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_051.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "11": 32, + "12": 32, + "13": 17, + "15": 15, + "16": 16, + "17": 16, + "19": 8, + "2": 255, + "20": 32, + "21": 8, + "23": 1, + "24": 16, + "25": 17, + "27": 8, + "28": 32, + "29": 9, + "3": 255, + "31": 1, + "32": 16, + "35": 8, + "36": 32, + "37": 10, + "39": 1, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 255, + "7": 246, + "9": 32, + }, + registers: { + "1,at": "0xfffffff6", + "16,s0": "0xfffffff6", + "17,s1": "0xf", + "8,t0": "0x1", + "9,t1": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_052.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_052.s.snap new file mode 100644 index 000000000..d51c1d707 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_052.s.snap @@ -0,0 +1,54 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_052.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "11": 32, + "12": 32, + "13": 17, + "15": 15, + "16": 6, + "17": 1, + "19": 8, + "2": 255, + "20": 32, + "21": 8, + "23": 1, + "24": 6, + "25": 33, + "27": 8, + "28": 32, + "29": 9, + "3": 255, + "31": 1, + "32": 4, + "33": 1, + "35": 8, + "36": 32, + "37": 10, + "39": 1, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 255, + "7": 246, + "9": 32, + }, + registers: { + "1,at": "0xfffffff6", + "16,s0": "0xfffffff6", + "17,s1": "0xf", + "8,t0": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_053.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_053.s.snap new file mode 100644 index 000000000..bac734e38 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_053.s.snap @@ -0,0 +1,78 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_053.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "11": 32, + "12": 32, + "13": 17, + "15": 15, + "16": 3, + "17": 224, + "18": 96, + "19": 32, + "2": 255, + "20": 6, + "21": 17, + "23": 8, + "24": 32, + "25": 8, + "27": 1, + "28": 3, + "29": 224, + "3": 255, + "30": 104, + "31": 32, + "32": 6, + "33": 49, + "35": 8, + "36": 32, + "37": 9, + "39": 1, + "4": 52, + "40": 3, + "41": 224, + "42": 112, + "43": 32, + "44": 4, + "45": 17, + "47": 8, + "48": 32, + "49": 10, + "5": 33, + "51": 1, + "52": 3, + "53": 224, + "54": 120, + "55": 32, + "56": 1, + "57": 128, + "58": 248, + "59": 32, + "6": 255, + "60": 3, + "61": 224, + "63": 8, + "7": 246, + "9": 32, + }, + registers: { + "1,at": "0xfffffff6", + "12,t4": "0xffffffff", + "13,t5": "0xffffffff", + "14,t6": "0x24", + "15,t7": "0x30", + "16,s0": "0xfffffff6", + "17,s1": "0xf", + "8,t0": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_054.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_054.s.snap new file mode 100644 index 000000000..f9d4a0491 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_054.s.snap @@ -0,0 +1,53 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_054.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "11": 32, + "12": 32, + "13": 17, + "15": 15, + "16": 30, + "19": 8, + "2": 255, + "20": 32, + "21": 8, + "23": 1, + "24": 30, + "25": 32, + "27": 8, + "28": 32, + "29": 9, + "3": 255, + "31": 1, + "32": 28, + "35": 8, + "36": 32, + "37": 10, + "39": 1, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 255, + "7": 246, + "9": 32, + }, + registers: { + "1,at": "0xfffffff6", + "10,t2": "0x1", + "16,s0": "0xfffffff6", + "17,s1": "0xf", + "8,t0": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_055.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_055.s.snap new file mode 100644 index 000000000..7699164be --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_055.s.snap @@ -0,0 +1,52 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_055.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "11": 32, + "12": 32, + "13": 17, + "15": 15, + "16": 26, + "19": 8, + "2": 255, + "20": 32, + "21": 8, + "23": 1, + "24": 26, + "25": 32, + "27": 8, + "28": 32, + "29": 9, + "3": 255, + "31": 1, + "32": 24, + "35": 8, + "36": 32, + "37": 10, + "39": 1, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 255, + "7": 246, + "9": 32, + }, + registers: { + "1,at": "0xfffffff6", + "16,s0": "0xfffffff6", + "17,s1": "0xf", + "9,t1": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_056.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_056.s.snap new file mode 100644 index 000000000..0bdaab423 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_056.s.snap @@ -0,0 +1,53 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_056.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "11": 32, + "12": 32, + "13": 17, + "15": 15, + "16": 6, + "19": 8, + "2": 255, + "20": 32, + "21": 8, + "23": 1, + "24": 6, + "25": 32, + "27": 8, + "28": 32, + "29": 9, + "3": 255, + "31": 1, + "32": 4, + "35": 8, + "36": 32, + "37": 10, + "39": 1, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 255, + "7": 246, + "9": 32, + }, + registers: { + "1,at": "0xfffffff6", + "10,t2": "0x1", + "16,s0": "0xfffffff6", + "17,s1": "0xf", + "9,t1": "0x1", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_057.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_057.s.snap new file mode 100644 index 000000000..898dd3b3e --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_057.s.snap @@ -0,0 +1,53 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_057.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 128, + "11": 32, + "12": 32, + "13": 17, + "15": 15, + "16": 20, + "17": 16, + "19": 8, + "2": 255, + "20": 32, + "21": 8, + "23": 1, + "24": 20, + "25": 17, + "27": 8, + "28": 32, + "29": 9, + "3": 255, + "31": 1, + "32": 20, + "35": 8, + "36": 32, + "37": 10, + "39": 1, + "4": 52, + "40": 3, + "41": 224, + "43": 8, + "5": 33, + "6": 255, + "7": 246, + "9": 32, + }, + registers: { + "1,at": "0xfffffff6", + "10,t2": "0x1", + "16,s0": "0xfffffff6", + "17,s1": "0xf", + PC: "0xffffffff", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_058.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_058.s.snap new file mode 100644 index 000000000..94a60725e --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_058.s.snap @@ -0,0 +1,140 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_058.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Square root of a negative number is not allowed.", + i: 28, + }, + { + error: "Square root of a negative number is not allowed.", + i: 31, + }, + ], + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "100": 52, + "101": 33, + "104": 68, + "105": 129, + "106": 64, + "108": 68, + "109": 32, + "110": 2, + "111": 132, + "112": 68, + "113": 32, + "114": 19, + "115": 4, + "116": 68, + "117": 32, + "118": 35, + "119": 132, + "12": 60, + "120": 68, + "122": 52, + "123": 4, + "124": 68, + "126": 60, + "127": 68, + "128": 68, + "13": 1, + "130": 68, + "131": 132, + "132": 32, + "133": 2, + "135": 10, + "139": 12, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 192, + "39": 171, + "4": 52, + "40": 52, + "41": 33, + "42": 50, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "52": 52, + "53": 33, + "56": 68, + "57": 129, + "58": 40, + "60": 60, + "61": 1, + "62": 64, + "63": 181, + "64": 52, + "65": 33, + "66": 100, + "68": 68, + "69": 129, + "70": 32, + "72": 60, + "73": 1, + "74": 70, + "75": 25, + "76": 52, + "77": 33, + "78": 36, + "8": 68, + "80": 68, + "81": 129, + "82": 48, + "84": 60, + "85": 1, + "86": 198, + "87": 1, + "88": 52, + "89": 33, + "9": 129, + "90": 100, + "92": 68, + "93": 129, + "94": 56, + "96": 60, + "97": 1, + "98": 70, + "99": 16, + }, + registers: { + "1,at": "0x46100000", + "2,v0": "0xa", + "f0,FP0": "0x40700000", + "f10,FP10": "0x40300000", + "f14,FP14": "0x40528000", + "f16,FP16": "0x42c60000", + "f18,FP18": "0x42c00000", + "f2,FP2": "0xc0ab3200", + "f4,FP4": "0x40b56400", + "f6,FP6": "0x46192400", + "f8,FP8": "0x46100000", + PC: "0x8c", + f7: "0xc6016400", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_059.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_059.s.snap new file mode 100644 index 000000000..4e98bab36 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_059.s.snap @@ -0,0 +1,133 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_059.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "100": 52, + "101": 33, + "104": 68, + "105": 129, + "106": 64, + "108": 68, + "109": 32, + "110": 2, + "111": 128, + "112": 68, + "113": 34, + "114": 19, + "116": 68, + "117": 36, + "118": 35, + "119": 128, + "12": 60, + "120": 68, + "121": 6, + "122": 52, + "124": 68, + "125": 7, + "126": 60, + "127": 64, + "128": 68, + "129": 8, + "13": 1, + "130": 68, + "131": 128, + "132": 32, + "133": 2, + "135": 10, + "139": 12, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 64, + "39": 171, + "4": 52, + "40": 52, + "41": 33, + "42": 50, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "52": 52, + "53": 33, + "56": 68, + "57": 129, + "58": 40, + "60": 60, + "61": 1, + "62": 64, + "63": 181, + "64": 52, + "65": 33, + "66": 100, + "68": 68, + "69": 129, + "70": 32, + "72": 60, + "73": 1, + "74": 70, + "75": 25, + "76": 52, + "77": 33, + "78": 36, + "8": 68, + "80": 68, + "81": 129, + "82": 48, + "84": 60, + "85": 1, + "86": 70, + "87": 1, + "88": 52, + "89": 33, + "9": 129, + "90": 100, + "92": 68, + "93": 129, + "94": 56, + "96": 60, + "97": 1, + "98": 70, + "99": 16, + }, + registers: { + "1,at": "0x46100000", + "2,v0": "0xa", + "f0,FP0": "0x40700000", + "f10,FP10": "0x40800000", + "f12,FP12": "0x40bb3200", + "f14,FP14": "0x40c56400", + "f16,FP16": "0x46992400", + "f18,FP18": "0x46900000", + "f2,FP2": "0x40ab3200", + "f4,FP4": "0x40b56400", + "f6,FP6": "0x46192400", + "f8,FP8": "0x46100000", + PC: "0x8c", + f17: "0x46816400", + f7: "0x46016400", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_060.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_060.s.snap new file mode 100644 index 000000000..c4dcee483 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_060.s.snap @@ -0,0 +1,135 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_060.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "100": 52, + "101": 33, + "104": 68, + "105": 129, + "106": 64, + "108": 68, + "109": 34, + "110": 2, + "111": 129, + "112": 68, + "113": 36, + "114": 19, + "115": 1, + "116": 68, + "117": 32, + "118": 35, + "119": 129, + "12": 60, + "120": 68, + "121": 7, + "122": 52, + "123": 1, + "124": 68, + "125": 8, + "126": 60, + "127": 65, + "128": 68, + "129": 6, + "13": 1, + "130": 68, + "131": 129, + "132": 32, + "133": 2, + "135": 10, + "139": 12, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 64, + "39": 171, + "4": 52, + "40": 52, + "41": 33, + "42": 50, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "52": 52, + "53": 33, + "56": 68, + "57": 129, + "58": 40, + "60": 60, + "61": 1, + "62": 64, + "63": 181, + "64": 52, + "65": 33, + "66": 100, + "68": 68, + "69": 129, + "70": 32, + "72": 60, + "73": 1, + "74": 70, + "75": 25, + "76": 52, + "77": 33, + "78": 36, + "8": 68, + "80": 68, + "81": 129, + "82": 48, + "84": 60, + "85": 1, + "86": 70, + "87": 1, + "88": 52, + "89": 33, + "9": 129, + "90": 100, + "92": 68, + "93": 129, + "94": 56, + "96": 60, + "97": 1, + "98": 70, + "99": 16, + }, + registers: { + "1,at": "0x46100000", + "2,v0": "0xa", + "f0,FP0": "0x40700000", + "f10,FP10": "0xc0a93200", + "f12,FP12": "0xc09f2c00", + "f14,FP14": "0x40b46400", + "f16,FP16": "0x44be0000", + "f18,FP18": "0xc4124000", + "f2,FP2": "0x40ab3200", + "f4,FP4": "0x40b56400", + "f6,FP6": "0x46192400", + "f8,FP8": "0x46100000", + PC: "0x8c", + f17: "0xc469c000", + f7: "0x46016400", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_061.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_061.s.snap new file mode 100644 index 000000000..6bd73b644 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_061.s.snap @@ -0,0 +1,132 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_061.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "100": 52, + "101": 33, + "104": 68, + "105": 129, + "106": 64, + "108": 68, + "109": 32, + "110": 2, + "111": 133, + "112": 68, + "113": 32, + "114": 19, + "115": 5, + "116": 68, + "117": 32, + "118": 35, + "119": 133, + "12": 60, + "120": 68, + "122": 52, + "123": 5, + "124": 68, + "126": 60, + "127": 69, + "128": 68, + "13": 1, + "130": 68, + "131": 133, + "132": 32, + "133": 2, + "135": 10, + "139": 12, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 192, + "39": 171, + "4": 52, + "40": 52, + "41": 33, + "42": 50, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "52": 52, + "53": 33, + "56": 68, + "57": 129, + "58": 40, + "60": 60, + "61": 1, + "62": 64, + "63": 181, + "64": 52, + "65": 33, + "66": 100, + "68": 68, + "69": 129, + "70": 32, + "72": 60, + "73": 1, + "74": 198, + "75": 25, + "76": 52, + "77": 33, + "78": 36, + "8": 68, + "80": 68, + "81": 129, + "82": 48, + "84": 60, + "85": 1, + "86": 70, + "87": 1, + "88": 52, + "89": 33, + "9": 129, + "90": 100, + "92": 68, + "93": 129, + "94": 56, + "96": 60, + "97": 1, + "98": 198, + "99": 16, + }, + registers: { + "1,at": "0xc6100000", + "2,v0": "0xa", + "f0,FP0": "0x40700000", + "f10,FP10": "0x40700000", + "f12,FP12": "0x40ab3200", + "f14,FP14": "0x40b56400", + "f16,FP16": "0x46192400", + "f18,FP18": "0x46100000", + "f2,FP2": "0xc0ab3200", + "f4,FP4": "0x40b56400", + "f6,FP6": "0xc6192400", + "f8,FP8": "0xc6100000", + PC: "0x8c", + f17: "0x46016400", + f7: "0x46016400", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_062.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_062.s.snap new file mode 100644 index 000000000..ddd888b59 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_062.s.snap @@ -0,0 +1,130 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_062.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "100": 52, + "101": 33, + "104": 68, + "105": 129, + "106": 64, + "108": 68, + "109": 34, + "110": 2, + "111": 130, + "112": 68, + "113": 36, + "114": 19, + "115": 2, + "116": 68, + "117": 32, + "118": 35, + "119": 130, + "12": 60, + "120": 68, + "121": 7, + "122": 52, + "123": 2, + "124": 68, + "125": 8, + "126": 60, + "127": 66, + "128": 68, + "129": 6, + "13": 1, + "130": 68, + "131": 130, + "132": 32, + "133": 2, + "135": 10, + "139": 12, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 192, + "39": 176, + "4": 52, + "40": 52, + "41": 33, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "52": 52, + "53": 33, + "56": 68, + "57": 129, + "58": 40, + "60": 60, + "61": 1, + "62": 64, + "63": 8, + "64": 52, + "65": 33, + "68": 68, + "69": 129, + "70": 32, + "72": 60, + "73": 1, + "74": 195, + "75": 150, + "76": 52, + "77": 33, + "8": 68, + "80": 68, + "81": 129, + "82": 48, + "84": 60, + "85": 1, + "86": 64, + "87": 160, + "88": 52, + "89": 33, + "9": 129, + "92": 68, + "93": 129, + "94": 56, + "96": 60, + "97": 1, + "98": 196, + }, + registers: { + "1,at": "0xc4000000", + "2,v0": "0xa", + "f0,FP0": "0x40700000", + "f10,FP10": "0xc1300000", + "f12,FP12": "0xc0c80000", + "f14,FP14": "0x40880000", + "f16,FP16": "0xc4bb8000", + "f18,FP18": "0x48160000", + "f2,FP2": "0xc0b00000", + "f4,FP4": "0x40080000", + "f6,FP6": "0xc3960000", + "f8,FP8": "0xc4000000", + PC: "0x8c", + f17: "0xc5200000", + f7: "0x40a00000", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_063.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_063.s.snap new file mode 100644 index 000000000..490c1be1c --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_063.s.snap @@ -0,0 +1,132 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_063.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "100": 52, + "101": 33, + "104": 68, + "105": 129, + "106": 64, + "108": 68, + "109": 34, + "110": 2, + "111": 131, + "112": 68, + "113": 36, + "114": 19, + "115": 3, + "116": 68, + "117": 36, + "118": 3, + "119": 131, + "12": 60, + "120": 68, + "121": 7, + "122": 52, + "123": 3, + "124": 68, + "125": 8, + "126": 60, + "127": 67, + "128": 68, + "129": 6, + "13": 1, + "130": 68, + "131": 131, + "132": 32, + "133": 2, + "135": 10, + "139": 12, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 192, + "39": 176, + "4": 52, + "40": 52, + "41": 33, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "52": 52, + "53": 33, + "56": 68, + "57": 129, + "58": 40, + "60": 60, + "61": 1, + "62": 64, + "63": 8, + "64": 52, + "65": 33, + "68": 68, + "69": 129, + "70": 32, + "72": 60, + "73": 1, + "74": 195, + "75": 150, + "76": 52, + "77": 33, + "8": 68, + "80": 68, + "81": 129, + "82": 48, + "84": 60, + "85": 1, + "86": 64, + "87": 160, + "88": 52, + "89": 33, + "9": 129, + "92": 68, + "93": 129, + "94": 56, + "96": 60, + "97": 1, + "98": 196, + }, + registers: { + "1,at": "0xc4000000", + "2,v0": "0xa", + "f0,FP0": "0x40700000", + "f10,FP10": "0xbfb00000", + "f12,FP12": "0xc0955555", + "f14,FP14": "0x40555555", + "f16,FP16": "0xc2700000", + "f18,FP18": "0x3fda740e", + "f2,FP2": "0xc0b00000", + "f4,FP4": "0x40080000", + "f6,FP6": "0xc3960000", + "f8,FP8": "0xc4000000", + PC: "0x8c", + f13: "0x55555555", + f15: "0x55555555", + f17: "0xbc200000", + f7: "0x40a00000", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_064.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_064.s.snap new file mode 100644 index 000000000..4598a17c2 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_064.s.snap @@ -0,0 +1,141 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_064.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Square root of a negative number is not allowed.", + i: 28, + }, + { + error: "Square root of a negative number is not allowed.", + i: 31, + }, + ], + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "100": 52, + "101": 33, + "104": 68, + "105": 129, + "106": 64, + "108": 68, + "109": 32, + "110": 2, + "111": 150, + "112": 68, + "113": 32, + "114": 19, + "115": 22, + "116": 68, + "117": 32, + "118": 35, + "119": 150, + "12": 60, + "120": 68, + "122": 52, + "123": 22, + "124": 68, + "126": 60, + "127": 86, + "128": 68, + "13": 1, + "130": 68, + "131": 150, + "132": 32, + "133": 2, + "135": 10, + "139": 12, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 192, + "39": 171, + "4": 52, + "40": 52, + "41": 33, + "42": 50, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "52": 52, + "53": 33, + "56": 68, + "57": 129, + "58": 40, + "60": 60, + "61": 1, + "62": 64, + "63": 181, + "64": 52, + "65": 33, + "66": 100, + "68": 68, + "69": 129, + "70": 32, + "72": 60, + "73": 1, + "74": 70, + "75": 25, + "76": 52, + "77": 33, + "78": 36, + "8": 68, + "80": 68, + "81": 129, + "82": 48, + "84": 60, + "85": 1, + "86": 198, + "87": 1, + "88": 52, + "89": 33, + "9": 129, + "90": 100, + "92": 68, + "93": 129, + "94": 56, + "96": 60, + "97": 1, + "98": 70, + "99": 16, + }, + registers: { + "1,at": "0x46100000", + "2,v0": "0xa", + "f0,FP0": "0x40700000", + "f10,FP10": "0x3fb00000", + "f14,FP14": "0x3f8bacf9", + "f16,FP16": "0x3c257eb5", + "f18,FP18": "0x3c2aaaab", + "f2,FP2": "0xc0ab3200", + "f4,FP4": "0x40b56400", + "f6,FP6": "0x46192400", + "f8,FP8": "0x46100000", + PC: "0x8c", + f15: "0x14c1bad0", + f7: "0xc6016400", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_065.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_065.s.snap new file mode 100644 index 000000000..ff2f42b32 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_065.s.snap @@ -0,0 +1,112 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_065.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "100": 52, + "101": 33, + "104": 68, + "105": 129, + "106": 64, + "108": 68, + "110": 50, + "111": 161, + "112": 68, + "113": 32, + "114": 96, + "115": 160, + "116": 32, + "117": 2, + "119": 10, + "12": 60, + "123": 12, + "13": 1, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 192, + "39": 171, + "4": 52, + "40": 52, + "41": 33, + "42": 50, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "52": 52, + "53": 33, + "56": 68, + "57": 129, + "58": 40, + "60": 60, + "61": 1, + "62": 64, + "63": 181, + "64": 52, + "65": 33, + "66": 100, + "68": 68, + "69": 129, + "70": 32, + "72": 60, + "73": 1, + "74": 70, + "75": 25, + "76": 52, + "77": 33, + "78": 36, + "8": 68, + "80": 68, + "81": 129, + "82": 48, + "84": 60, + "85": 1, + "86": 198, + "87": 1, + "88": 52, + "89": 33, + "9": 129, + "90": 100, + "92": 68, + "93": 129, + "94": 56, + "96": 60, + "97": 1, + "98": 70, + "99": 16, + }, + registers: { + "1,at": "0x46100000", + "2,v0": "0xa", + "f0,FP0": "0x40700000", + "f10,FP10": "0x40c32480", + "f4,FP4": "0x40b56400", + "f6,FP6": "0x46192400", + "f8,FP8": "0x46100000", + PC: "0x7c", + f7: "0xc6016400", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_066.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_066.s.snap new file mode 100644 index 000000000..bf9b48bcd --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_066.s.snap @@ -0,0 +1,95 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_066.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 8, + "12": 60, + "13": 1, + "14": 64, + "15": 112, + "16": 52, + "17": 33, + "20": 68, + "21": 129, + "24": 60, + "25": 1, + "28": 52, + "29": 33, + "32": 68, + "33": 129, + "34": 24, + "36": 60, + "37": 1, + "38": 192, + "39": 171, + "4": 52, + "40": 52, + "41": 33, + "42": 50, + "44": 68, + "45": 129, + "46": 16, + "48": 60, + "49": 1, + "5": 33, + "50": 70, + "51": 25, + "52": 52, + "53": 33, + "54": 36, + "56": 68, + "57": 129, + "58": 48, + "60": 60, + "61": 1, + "62": 198, + "63": 1, + "64": 52, + "65": 33, + "66": 100, + "68": 68, + "69": 129, + "70": 56, + "72": 68, + "73": 32, + "74": 2, + "75": 36, + "76": 68, + "77": 32, + "78": 18, + "79": 100, + "8": 68, + "80": 68, + "82": 50, + "83": 164, + "84": 68, + "86": 58, + "87": 228, + "88": 32, + "89": 2, + "9": 129, + "91": 10, + "95": 12, + }, + registers: { + "1,at": "0xc6016400", + "10,t2": "0x2649", + "11,t3": "0xffffdfa7", + "2,v0": "0xa", + "8,t0": "0x100", + "9,t1": "0xfffff267", + "f0,FP0": "0x40700000", + "f2,FP2": "0xc0ab3200", + "f6,FP6": "0x46192400", + PC: "0x60", + f7: "0xc6016400", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_067.s.snap b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_067.s.snap new file mode 100644 index 000000000..c2558cb60 --- /dev/null +++ b/tests/arch/__snapshots__/mips/instructions/test_mips_instruction_067.s.snap @@ -0,0 +1,109 @@ +export const snapshot = {}; + +snapshot[`mips/instructions/test_mips_instruction_067.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 60, + "1": 1, + "10": 64, + "11": 32, + "12": 60, + "13": 1, + "14": 255, + "15": 220, + "16": 52, + "17": 33, + "18": 53, + "19": 154, + "21": 32, + "22": 72, + "23": 32, + "24": 60, + "25": 1, + "26": 2, + "27": 52, + "28": 52, + "29": 33, + "3": 1, + "30": 103, + "31": 255, + "33": 32, + "34": 80, + "35": 32, + "36": 60, + "37": 1, + "38": 255, + "39": 169, + "4": 52, + "40": 52, + "41": 33, + "42": 175, + "43": 159, + "45": 32, + "46": 88, + "47": 32, + "48": 32, + "49": 12, + "5": 33, + "50": 30, + "51": 219, + "52": 32, + "53": 13, + "54": 22, + "55": 46, + "56": 68, + "57": 32, + "58": 64, + "59": 33, + "6": 226, + "60": 68, + "61": 32, + "62": 72, + "63": 161, + "64": 68, + "65": 32, + "66": 81, + "67": 33, + "68": 68, + "69": 64, + "7": 174, + "70": 89, + "71": 160, + "72": 68, + "73": 64, + "74": 97, + "75": 224, + "76": 68, + "77": 64, + "78": 106, + "79": 32, + "80": 32, + "81": 2, + "83": 10, + "87": 12, + "9": 32, + }, + registers: { + "1,at": "0xffa9af9f", + "10,t2": "0x23467ff", + "11,t3": "0xffa9af9f", + "12,t4": "0x1edb", + "13,t5": "0x162e", + "2,v0": "0xa", + "8,t0": "0x1e2ae", + "9,t1": "0xffdc359a", + "f0,FP0": "0x40fe2ae0", + "f2,FP2": "0xc141e533", + "f4,FP4": "0x4181a33f", + "f6,FP6": "0xcaaca0c2", + "f8,FP8": "0x45b17000", + PC: "0x58", + f5: "0xf8000000", + f7: "0x45f6d800", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_001.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_001.s.snap new file mode 100644 index 000000000..61e91bc93 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_001.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_001.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 4, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 4, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "31,ra": "0x8", + "4,a0": "0x2", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_002.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_002.s.snap new file mode 100644 index 000000000..9e9ca32aa --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_002.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_002.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 5, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 5, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "31,ra": "0x8", + "5,a1": "0x2", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_003.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_003.s.snap new file mode 100644 index 000000000..b87ce2183 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_003.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_003.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 6, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 6, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "31,ra": "0x8", + "6,a2": "0x2", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_004.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_004.s.snap new file mode 100644 index 000000000..105920296 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_004.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_004.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 7, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 7, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "31,ra": "0x8", + "7,a3": "0x2", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_005.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_005.s.snap new file mode 100644 index 000000000..fbd1ca9a2 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_005.s.snap @@ -0,0 +1,33 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_005.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 30, + "11": 10, + "15": 12, + "16": 32, + "17": 30, + "19": 5, + "20": 3, + "21": 224, + "23": 8, + "3": 5, + "4": 12, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "2,v0": "0xa", + "30,fp": "0x5", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_006.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_006.s.snap new file mode 100644 index 000000000..be7427858 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_006.s.snap @@ -0,0 +1,33 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_006.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 28, + "11": 10, + "15": 12, + "16": 32, + "17": 28, + "19": 5, + "20": 3, + "21": 224, + "23": 8, + "3": 5, + "4": 12, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "2,v0": "0xa", + "28,gp": "0x5", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_007.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_007.s.snap new file mode 100644 index 000000000..3020f8f0b --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_007.s.snap @@ -0,0 +1,33 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_007.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 26, + "11": 10, + "15": 12, + "16": 32, + "17": 26, + "19": 5, + "20": 3, + "21": 224, + "23": 8, + "3": 5, + "4": 12, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "2,v0": "0xa", + "26,k0": "0x5", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_008.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_008.s.snap new file mode 100644 index 000000000..82d869b69 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_008.s.snap @@ -0,0 +1,33 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_008.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 27, + "11": 10, + "15": 12, + "16": 32, + "17": 27, + "19": 5, + "20": 3, + "21": 224, + "23": 8, + "3": 5, + "4": 12, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "2,v0": "0xa", + "27,k1": "0x5", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_009.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_009.s.snap new file mode 100644 index 000000000..48acc183a --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_009.s.snap @@ -0,0 +1,32 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_009.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 31, + "11": 10, + "15": 12, + "16": 32, + "17": 31, + "18": 16, + "19": 138, + "20": 3, + "21": 224, + "23": 8, + "3": 5, + "4": 12, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "31,ra": "0x108a", + PC: "0x201a", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_010.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_010.s.snap new file mode 100644 index 000000000..905be8797 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_010.s.snap @@ -0,0 +1,76 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_010.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 16, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 16, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "16,s0": "0x2", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 16,s0 was used but never saved to memory", + register: "16,s0", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register 16,s0 value changed but not properly restored", + register: "16,s0", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_011.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_011.s.snap new file mode 100644 index 000000000..692fd901b --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_011.s.snap @@ -0,0 +1,76 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_011.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 17, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 17, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "17,s1": "0x2", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 17,s1 was used but never saved to memory", + register: "17,s1", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register 17,s1 value changed but not properly restored", + register: "17,s1", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_012.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_012.s.snap new file mode 100644 index 000000000..bb638cc0b --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_012.s.snap @@ -0,0 +1,76 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_012.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 18, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 18, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "18,s2": "0x2", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 18,s2 was used but never saved to memory", + register: "18,s2", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register 18,s2 value changed but not properly restored", + register: "18,s2", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_013.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_013.s.snap new file mode 100644 index 000000000..493c018aa --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_013.s.snap @@ -0,0 +1,76 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_013.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 19, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 19, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "19,s3": "0x2", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 19,s3 was used but never saved to memory", + register: "19,s3", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register 19,s3 value changed but not properly restored", + register: "19,s3", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_014.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_014.s.snap new file mode 100644 index 000000000..65910fc9c --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_014.s.snap @@ -0,0 +1,76 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_014.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 20, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 20, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "20,s4": "0x2", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 20,s4 was used but never saved to memory", + register: "20,s4", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register 20,s4 value changed but not properly restored", + register: "20,s4", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_015.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_015.s.snap new file mode 100644 index 000000000..e5db8f66c --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_015.s.snap @@ -0,0 +1,76 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_015.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 21, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 21, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "21,s5": "0x2", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 21,s5 was used but never saved to memory", + register: "21,s5", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register 21,s5 value changed but not properly restored", + register: "21,s5", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_016.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_016.s.snap new file mode 100644 index 000000000..1109d6360 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_016.s.snap @@ -0,0 +1,76 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_016.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 22, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 22, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "22,s6": "0x2", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 22,s6 was used but never saved to memory", + register: "22,s6", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register 22,s6 value changed but not properly restored", + register: "22,s6", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_017.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_017.s.snap new file mode 100644 index 000000000..73d2a2a04 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_017.s.snap @@ -0,0 +1,76 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_017.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 23, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 23, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "23,s7": "0x2", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 23,s7 was used but never saved to memory", + register: "23,s7", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register 23,s7 value changed but not properly restored", + register: "23,s7", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_018.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_018.s.snap new file mode 100644 index 000000000..3308dac8a --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_018.s.snap @@ -0,0 +1,46 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_018.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 18, + "11": 10, + "15": 12, + "16": 35, + "17": 189, + "18": 255, + "19": 252, + "20": 3, + "21": 224, + "23": 8, + "3": 5, + "4": 12, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "18,s2": "0x5", + "2,v0": "0xa", + "29,sp": "0xffffff8", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Stack pointer not restored: entered at 0xffffffc, exited at 0xffffff8", + register: undefined, + rule: "STACK_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_019.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_019.s.snap new file mode 100644 index 000000000..5cc2a97be --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_019.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_019.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 8, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 8, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "31,ra": "0xc", + "4,a0": "0x5", + "8,t0": "0x2", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_020.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_020.s.snap new file mode 100644 index 000000000..37c630c32 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_020.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_020.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 9, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 9, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "31,ra": "0xc", + "4,a0": "0x5", + "9,t1": "0x2", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_021.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_021.s.snap new file mode 100644 index 000000000..09f8476b4 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_021.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_021.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 10, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 10, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "10,t2": "0x2", + "2,v0": "0xa", + "31,ra": "0xc", + "4,a0": "0x5", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_022.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_022.s.snap new file mode 100644 index 000000000..45b69ce9e --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_022.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_022.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 11, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 11, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "11,t3": "0x2", + "2,v0": "0xa", + "31,ra": "0xc", + "4,a0": "0x5", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_023.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_023.s.snap new file mode 100644 index 000000000..090bcda82 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_023.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_023.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 12, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 12, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "12,t4": "0x2", + "2,v0": "0xa", + "31,ra": "0xc", + "4,a0": "0x5", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_024.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_024.s.snap new file mode 100644 index 000000000..2f9d42493 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_024.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_024.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 13, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 13, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "13,t5": "0x2", + "2,v0": "0xa", + "31,ra": "0xc", + "4,a0": "0x5", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_025.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_025.s.snap new file mode 100644 index 000000000..6aea5b61f --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_025.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_025.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 14, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 14, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "14,t6": "0x2", + "2,v0": "0xa", + "31,ra": "0xc", + "4,a0": "0x5", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_026.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_026.s.snap new file mode 100644 index 000000000..bd81fa898 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_026.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_026.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 15, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 15, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "15,t7": "0x2", + "2,v0": "0xa", + "31,ra": "0xc", + "4,a0": "0x5", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_027.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_027.s.snap new file mode 100644 index 000000000..77e2679b1 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_027.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_027.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 24, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 24, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "24,t8": "0x2", + "31,ra": "0xc", + "4,a0": "0x5", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_028.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_028.s.snap new file mode 100644 index 000000000..01c45e942 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_028.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_028.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 25, + "11": 20, + "12": 32, + "13": 2, + "15": 10, + "19": 12, + "20": 32, + "21": 1, + "23": 12, + "24": 3, + "25": 161, + "26": 232, + "268435451": 12, + "27": 35, + "28": 175, + "29": 191, + "3": 1, + "31": 8, + "32": 175, + "33": 190, + "35": 4, + "36": 39, + "37": 190, + "39": 4, + "4": 32, + "40": 32, + "41": 25, + "43": 2, + "44": 143, + "45": 191, + "47": 8, + "48": 143, + "49": 190, + "5": 4, + "51": 4, + "52": 39, + "53": 189, + "55": 12, + "56": 3, + "57": 224, + "59": 8, + "7": 5, + "8": 12, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "25,t9": "0x2", + "31,ra": "0xc", + "4,a0": "0x5", + PC: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_029.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_029.s.snap new file mode 100644 index 000000000..56f652ae1 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_029.s.snap @@ -0,0 +1,59 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_029.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 2, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 2, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_030.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_030.s.snap new file mode 100644 index 000000000..4bf706229 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_030.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_030.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 3, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 12, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 191, + "268435451": 8, + "27": 8, + "28": 175, + "29": 190, + "3": 5, + "31": 4, + "32": 39, + "33": 190, + "35": 4, + "36": 32, + "37": 3, + "39": 2, + "4": 12, + "40": 143, + "41": 191, + "43": 8, + "44": 143, + "45": 190, + "47": 4, + "48": 39, + "49": 189, + "51": 12, + "52": 3, + "53": 224, + "55": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0xc", + "2,v0": "0xa", + "3,v1": "0x2", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_031.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_031.s.snap new file mode 100644 index 000000000..79eb6925b --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_031.s.snap @@ -0,0 +1,49 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_031.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 16, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 8, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 176, + "268435447": 2, + "28": 32, + "29": 16, + "3": 2, + "31": 2, + "32": 143, + "33": 176, + "36": 39, + "37": 189, + "39": 8, + "4": 12, + "40": 3, + "41": 224, + "43": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0x8", + "16,s0": "0x2", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_032.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_032.s.snap new file mode 100644 index 000000000..98e4c4fdd --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_032.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_032.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 16, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 4, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 176, + "268435451": 5, + "28": 32, + "29": 16, + "3": 5, + "31": 5, + "32": 39, + "33": 189, + "35": 4, + "36": 3, + "37": 224, + "39": 8, + "4": 12, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0x4", + "16,s0": "0x5", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 16,s0 was saved but never restored", + register: "16,s0", + rule: "RESTORE_REQUIRED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_033.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_033.s.snap new file mode 100644 index 000000000..36e6fd647 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_033.s.snap @@ -0,0 +1,65 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_033.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 16, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 8, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 176, + "268435447": 2, + "28": 32, + "29": 16, + "3": 2, + "31": 2, + "32": 143, + "33": 176, + "35": 4, + "36": 39, + "37": 189, + "39": 8, + "4": 12, + "40": 3, + "41": 224, + "43": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0x8", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 16,s0 saved at 0xffffff4 but restored from 0xffffff8", + register: "16,s0", + rule: "RESTORE_ADDRESS_MISMATCH", + }, + { + message: "Register 16,s0 value changed but not properly restored", + register: "16,s0", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_034.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_034.s.snap new file mode 100644 index 000000000..2e68521fb --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_034.s.snap @@ -0,0 +1,64 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_034.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 16, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 8, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 176, + "268435447": 2, + "28": 32, + "29": 16, + "3": 2, + "31": 2, + "32": 135, + "33": 176, + "36": 39, + "37": 189, + "39": 8, + "4": 12, + "40": 3, + "41": 224, + "43": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0x8", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 16,s0 saved with 4 bytes but restored with 2 bytes", + register: "16,s0", + rule: "SIZE_MISMATCH", + }, + { + message: "Register 16,s0 value changed but not properly restored", + register: "16,s0", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_035.s.snap b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_035.s.snap new file mode 100644 index 000000000..b71d52706 --- /dev/null +++ b/tests/arch/__snapshots__/mips/sentinel/test_mips_sentinels_035.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`mips/sentinel/test_mips_sentinels_035.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 32, + "1": 16, + "11": 10, + "15": 12, + "16": 32, + "17": 1, + "19": 8, + "20": 3, + "21": 161, + "22": 232, + "23": 35, + "24": 175, + "25": 176, + "28": 175, + "29": 168, + "3": 2, + "32": 32, + "33": 16, + "35": 2, + "36": 143, + "37": 176, + "4": 12, + "40": 39, + "41": 189, + "43": 8, + "44": 3, + "45": 224, + "47": 8, + "7": 16, + "8": 32, + "9": 2, + }, + registers: { + "1,at": "0x8", + "2,v0": "0xa", + "31,ra": "0x8", + PC: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register 16,s0 value changed but not properly restored", + register: "16,s0", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_001.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_001.s.snap new file mode 100644 index 000000000..bbbd78127 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_001.s.snap @@ -0,0 +1,124 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_001.s 1`] = ` +{ + display: "1234", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 5, + "11": 3, + "13": 16, + "14": 8, + "15": 147, + "19": 115, + "2": 5, + "2097152": 12, + "2097155": 34, + "2097156": 255, + "2097157": 255, + "2097158": 233, + "2097159": 210, + "2097160": 67, + "2097161": 228, + "2097162": 41, + "2097163": 55, + "2097164": 64, + "2097165": 195, + "2097166": 6, + "2097167": 171, + "2097168": 133, + "2097169": 30, + "2097170": 184, + "2097171": 82, + "2097172": 84, + "2097173": 104, + "2097174": 105, + "2097175": 115, + "2097176": 32, + "2097177": 105, + "2097178": 115, + "2097179": 32, + "2097180": 97, + "2097181": 32, + "2097182": 115, + "2097183": 116, + "2097184": 114, + "2097185": 105, + "2097186": 110, + "2097187": 103, + "2097189": 84, + "2097190": 104, + "2097191": 105, + "2097192": 115, + "2097193": 32, + "2097194": 105, + "2097195": 115, + "2097196": 32, + "2097197": 97, + "2097198": 110, + "2097199": 111, + "2097200": 116, + "2097201": 104, + "2097202": 101, + "2097203": 114, + "2097204": 32, + "2097205": 115, + "2097206": 116, + "2097207": 114, + "2097208": 105, + "2097209": 110, + "2097210": 103, + "21": 32, + "22": 5, + "23": 23, + "24": 254, + "25": 229, + "26": 5, + "27": 19, + "29": 5, + "3": 23, + "30": 21, + "31": 3, + "33": 16, + "34": 8, + "35": 147, + "39": 115, + "41": 32, + "42": 5, + "43": 23, + "44": 254, + "45": 69, + "46": 5, + "47": 19, + "49": 5, + "5": 5, + "50": 48, + "51": 7, + "53": 32, + "54": 5, + "55": 23, + "56": 253, + "57": 133, + "58": 5, + "59": 19, + "6": 5, + "61": 5, + "62": 48, + "63": 39, + "66": 128, + "67": 103, + "7": 19, + "9": 5, + }, + registers: { + "f0,ft0": "0x40c306ab851eb852", + "x10,a0": "0x20000c", + "x17,a7": "0x1", + mtime: "0x11", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_002.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_002.s.snap new file mode 100644 index 000000000..5fd239c1c --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_002.s.snap @@ -0,0 +1,61 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_002.s 1`] = ` +{ + display: "4", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 3, + "11": 147, + "12": 2, + "13": 16, + "14": 14, + "15": 19, + "17": 98, + "18": 142, + "19": 179, + "2": 2, + "20": 65, + "21": 195, + "22": 142, + "23": 179, + "24": 3, + "25": 206, + "26": 14, + "27": 179, + "28": 2, + "29": 83, + "3": 147, + "30": 206, + "31": 179, + "33": 14, + "34": 133, + "35": 19, + "37": 16, + "38": 8, + "39": 147, + "43": 115, + "46": 128, + "47": 103, + "5": 208, + "6": 3, + "7": 19, + "8": 2, + "9": 208, + }, + registers: { + "x10,a0": "0x4", + "x17,a7": "0x1", + "x28,t3": "0x21", + "x29,t4": "0x4", + "x5,t0": "0xa", + "x6,t1": "0xd", + "x7,t2": "0x2d", + mtime: "0xc", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_003.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_003.s.snap new file mode 100644 index 000000000..424e76c87 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_003.s.snap @@ -0,0 +1,92 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_003.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 174, + "11": 3, + "13": 32, + "14": 3, + "15": 23, + "16": 255, + "17": 131, + "18": 3, + "19": 19, + "2": 2, + "2097155": 14, + "2097156": 120, + "2097159": 22, + "2097163": 14, + "2097164": 120, + "2097167": 22, + "21": 3, + "22": 14, + "23": 131, + "25": 32, + "26": 3, + "27": 151, + "28": 254, + "29": 227, + "3": 151, + "30": 131, + "31": 147, + "33": 3, + "34": 159, + "35": 3, + "37": 32, + "38": 2, + "39": 151, + "40": 254, + "41": 66, + "42": 130, + "43": 147, + "44": 1, + "45": 194, + "46": 160, + "47": 35, + "49": 32, + "5": 2, + "50": 2, + "51": 151, + "52": 253, + "53": 194, + "54": 130, + "55": 147, + "56": 1, + "57": 210, + "58": 128, + "59": 35, + "6": 130, + "61": 32, + "62": 2, + "63": 151, + "64": 253, + "65": 34, + "66": 130, + "67": 147, + "68": 1, + "69": 226, + "7": 147, + "70": 144, + "71": 35, + "74": 128, + "75": 103, + "9": 2, + }, + registers: { + "x28,t3": "0xe", + "x29,t4": "0x78", + "x30,t5": "0x16", + "x5,t0": "0x20000e", + "x6,t1": "0x200004", + "x7,t2": "0x200006", + mtime: "0x13", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_004.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_004.s.snap new file mode 100644 index 000000000..c6b7e9d3d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_004.s.snap @@ -0,0 +1,133 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_004.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 65, + "2097154": 69, + "2097155": 161, + "2097156": 202, + "2097157": 192, + "2097158": 131, + "2097159": 18, + "2097160": 64, + "2097161": 38, + "2097162": 226, + "2097163": 208, + "2097164": 229, + "2097165": 96, + "2097166": 65, + "2097167": 137, + "2097168": 64, + "2097169": 132, + "2097170": 203, + "2097171": 51, + "2097172": 51, + "2097173": 51, + "2097174": 51, + "2097175": 51, + "2097176": 64, + "2097177": 81, + "2097178": 69, + "2097179": 161, + "2097180": 202, + "2097181": 192, + "2097182": 131, + "2097183": 18, + "2097184": 64, + "2097185": 130, + "2097186": 162, + "2097187": 126, + "2097188": 249, + "2097189": 219, + "2097190": 34, + "2097191": 209, + "2097192": 64, + "2097193": 77, + "2097194": 19, + "2097195": 21, + "2097196": 70, + "2097197": 137, + "2097198": 195, + "2097199": 233, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 2, + "34": 176, + "35": 7, + "37": 3, + "38": 49, + "39": 7, + "41": 3, + "42": 181, + "43": 7, + "44": 2, + "47": 83, + "48": 10, + "49": 5, + "5": 2, + "50": 2, + "51": 83, + "52": 26, + "53": 37, + "54": 6, + "55": 83, + "57": 4, + "58": 48, + "59": 39, + "6": 130, + "61": 132, + "62": 4, + "63": 19, + "65": 68, + "66": 48, + "67": 39, + "69": 132, + "7": 147, + "70": 4, + "71": 19, + "73": 196, + "74": 48, + "75": 39, + "78": 128, + "79": 103, + "9": 32, + }, + registers: { + "f0,ft0": "0x405145a1cac08312", + "f10,fa0": "0x4084cb3333333333", + "f12,fa2": "0x404d13154689c3e9", + "f2,ft2": "0x4026e2d0e5604189", + "f4,ft4": "0x4082a27ef9db22d1", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200028", + mtime: "0x14", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_005.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_005.s.snap new file mode 100644 index 000000000..9087fc2cf --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_005.s.snap @@ -0,0 +1,52 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_005.s 1`] = ` +{ + display: "45", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 130, + "11": 131, + "14": 3, + "15": 19, + "18": 5, + "19": 19, + "2": 2, + "2097152": 10, + "21": 83, + "22": 88, + "23": 99, + "25": 101, + "26": 5, + "27": 51, + "29": 19, + "3": 151, + "30": 3, + "31": 19, + "32": 254, + "34": 10, + "35": 227, + "37": 16, + "38": 8, + "39": 147, + "43": 115, + "46": 128, + "47": 103, + "5": 2, + "6": 130, + "7": 147, + "9": 2, + }, + registers: { + "x10,a0": "0x2d", + "x17,a7": "0x1", + "x5,t0": "0xa", + "x6,t1": "0xa", + mtime: "0x31", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_006.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_006.s.snap new file mode 100644 index 000000000..b2b9594e4 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_006.s.snap @@ -0,0 +1,54 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_006.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 64, + "10": 14, + "11": 19, + "13": 94, + "14": 88, + "15": 99, + "16": 2, + "17": 32, + "18": 14, + "19": 19, + "2": 2, + "21": 160, + "22": 8, + "23": 147, + "27": 115, + "29": 176, + "3": 147, + "30": 14, + "31": 147, + "32": 34, + "33": 176, + "34": 15, + "35": 19, + "36": 254, + "38": 6, + "39": 227, + "42": 128, + "43": 103, + "5": 32, + "6": 3, + "7": 19, + "9": 80, + }, + registers: { + "x17,a7": "0xa", + "x28,t3": "0x22", + "x29,t4": "0xb", + "x30,t5": "0x22b", + "x5,t0": "0x4", + "x6,t1": "0x2", + mtime: "0xa", + pc: "0x1c", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_007.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_007.s.snap new file mode 100644 index 000000000..019a7bd29 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_007.s.snap @@ -0,0 +1,74 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_007.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "10": 15, + "11": 23, + "12": 255, + "13": 143, + "14": 15, + "15": 19, + "18": 2, + "19": 147, + "2": 14, + "2097155": 1, + "2097159": 2, + "2097163": 3, + "2097167": 4, + "2097171": 5, + "22": 3, + "23": 19, + "25": 80, + "26": 3, + "27": 147, + "29": 115, + "3": 19, + "30": 14, + "31": 99, + "32": 3, + "33": 211, + "34": 15, + "35": 179, + "37": 15, + "38": 47, + "39": 131, + "40": 1, + "41": 242, + "42": 130, + "43": 179, + "44": 1, + "45": 195, + "46": 3, + "47": 51, + "49": 79, + "5": 64, + "50": 15, + "51": 19, + "52": 254, + "54": 4, + "55": 227, + "58": 128, + "59": 103, + "6": 14, + "7": 147, + "9": 32, + }, + registers: { + "x28,t3": "0x1", + "x29,t4": "0x4", + "x30,t5": "0x200014", + "x31,t6": "0x5", + "x5,t0": "0xf", + "x6,t1": "0x5", + "x7,t2": "0x5", + mtime: "0x2c", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_008.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_008.s.snap new file mode 100644 index 000000000..41e88affb --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_008.s.snap @@ -0,0 +1,167 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_008.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "11": 55, + "12": 4, + "13": 3, + "14": 3, + "15": 19, + "17": 64, + "18": 3, + "19": 147, + "2": 2, + "2097152": 52, + "2097156": 52, + "2097160": 52, + "2097164": 52, + "2097168": 35, + "2097169": 69, + "2097173": 67, + "2097174": 34, + "2097175": 16, + "2097176": 119, + "2097177": 81, + "2097178": 33, + "2097179": 32, + "2097180": 20, + "2097181": 20, + "2097182": 20, + "2097183": 20, + "2097186": 2, + "2097187": 20, + "2097188": 68, + "2097189": 85, + "2097190": 17, + "2097191": 34, + "2097192": 170, + "2097193": 191, + "2097194": 240, + "2097195": 18, + "2097196": 119, + "2097197": 208, + "2097202": 255, + "2097203": 35, + "2097204": 18, + "2097205": 52, + "2097206": 86, + "2097207": 120, + "2097208": 135, + "2097209": 101, + "2097210": 67, + "2097211": 33, + "2097212": 51, + "2097213": 68, + "2097214": 17, + "2097215": 36, + "2097216": 52, + "2097220": 52, + "2097224": 52, + "2097228": 52, + "2097232": 35, + "2097233": 69, + "2097237": 67, + "2097238": 34, + "2097239": 16, + "2097240": 119, + "2097241": 81, + "2097242": 33, + "2097243": 32, + "2097244": 20, + "2097245": 20, + "2097246": 20, + "2097247": 20, + "2097250": 2, + "2097251": 20, + "2097252": 68, + "2097253": 85, + "2097254": 17, + "2097255": 34, + "2097256": 170, + "2097257": 191, + "2097258": 240, + "2097259": 18, + "2097260": 119, + "2097261": 208, + "2097266": 255, + "2097267": 35, + "2097268": 18, + "2097269": 52, + "2097270": 86, + "2097271": 120, + "2097272": 135, + "2097273": 101, + "2097274": 67, + "2097275": 33, + "2097276": 51, + "2097277": 68, + "2097278": 17, + "2097279": 36, + "21": 64, + "22": 14, + "23": 19, + "26": 14, + "27": 179, + "3": 151, + "30": 15, + "31": 51, + "32": 3, + "33": 211, + "34": 134, + "35": 99, + "36": 1, + "37": 238, + "38": 14, + "39": 99, + "41": 2, + "42": 160, + "43": 7, + "45": 3, + "46": 32, + "47": 39, + "49": 66, + "5": 2, + "50": 130, + "51": 147, + "53": 67, + "54": 3, + "55": 19, + "57": 31, + "58": 15, + "59": 19, + "6": 130, + "60": 254, + "62": 4, + "63": 227, + "65": 30, + "66": 142, + "67": 147, + "7": 147, + "70": 15, + "71": 51, + "72": 252, + "74": 12, + "75": 227, + "78": 128, + "79": 103, + "9": 32, + }, + registers: { + "f0,ft0": "0xffffffff33441124", + "x28,t3": "0x4", + "x29,t4": "0x4", + "x5,t0": "0x200040", + "x6,t1": "0x200080", + "x7,t2": "0x4", + mtime: "0x8e", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_009.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_009.s.snap new file mode 100644 index 000000000..948839d47 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_009.s.snap @@ -0,0 +1,177 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_009.s 1`] = ` +{ + display: " +Please, insert the first number: +Please, insert the second number: +The result is: 579 +", + error: false, + keyboard: " 123 456", + memory: { + "1": 32, + "10": 8, + "103": 115, + "106": 128, + "107": 103, + "11": 147, + "15": 115, + "17": 80, + "18": 8, + "19": 147, + "2": 5, + "2097152": 10, + "2097153": 80, + "2097154": 108, + "2097155": 101, + "2097156": 97, + "2097157": 115, + "2097158": 101, + "2097159": 44, + "2097160": 32, + "2097161": 105, + "2097162": 110, + "2097163": 115, + "2097164": 101, + "2097165": 114, + "2097166": 116, + "2097167": 32, + "2097168": 116, + "2097169": 104, + "2097170": 101, + "2097171": 32, + "2097172": 102, + "2097173": 105, + "2097174": 114, + "2097175": 115, + "2097176": 116, + "2097177": 32, + "2097178": 110, + "2097179": 117, + "2097180": 109, + "2097181": 98, + "2097182": 101, + "2097183": 114, + "2097184": 58, + "2097185": 32, + "2097187": 10, + "2097188": 80, + "2097189": 108, + "2097190": 101, + "2097191": 97, + "2097192": 115, + "2097193": 101, + "2097194": 44, + "2097195": 32, + "2097196": 105, + "2097197": 110, + "2097198": 115, + "2097199": 101, + "2097200": 114, + "2097201": 116, + "2097202": 32, + "2097203": 116, + "2097204": 104, + "2097205": 101, + "2097206": 32, + "2097207": 115, + "2097208": 101, + "2097209": 99, + "2097210": 111, + "2097211": 110, + "2097212": 100, + "2097213": 32, + "2097214": 110, + "2097215": 117, + "2097216": 109, + "2097217": 98, + "2097218": 101, + "2097219": 114, + "2097220": 58, + "2097221": 32, + "2097223": 10, + "2097224": 84, + "2097225": 104, + "2097226": 101, + "2097227": 32, + "2097228": 114, + "2097229": 101, + "2097230": 115, + "2097231": 117, + "2097232": 108, + "2097233": 116, + "2097234": 32, + "2097235": 105, + "2097236": 115, + "2097237": 58, + "2097238": 32, + "2097240": 10, + "23": 115, + "25": 5, + "26": 2, + "27": 179, + "29": 32, + "3": 23, + "30": 5, + "31": 23, + "33": 117, + "34": 5, + "35": 19, + "37": 64, + "38": 8, + "39": 147, + "43": 115, + "45": 80, + "46": 8, + "47": 147, + "5": 5, + "51": 115, + "53": 5, + "54": 3, + "55": 51, + "57": 98, + "58": 131, + "59": 179, + "6": 5, + "61": 32, + "62": 5, + "63": 23, + "65": 181, + "66": 5, + "67": 19, + "69": 64, + "7": 19, + "70": 8, + "71": 147, + "75": 115, + "77": 3, + "78": 133, + "79": 51, + "81": 16, + "82": 8, + "83": 147, + "87": 115, + "89": 32, + "9": 64, + "90": 5, + "91": 23, + "93": 5, + "94": 5, + "95": 19, + "97": 64, + "98": 8, + "99": 147, + }, + registers: { + "x10,a0": "0x200058", + "x17,a7": "0x4", + "x5,t0": "0x7b", + "x6,t1": "0x1c8", + "x7,t2": "0x243", + mtime: "0x1b", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_010.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_010.s.snap new file mode 100644 index 000000000..7734d0aa9 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_010.s.snap @@ -0,0 +1,223 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_010.s 1`] = ` +{ + display: "Insert the string length (no more than 100 characters) Insert the string This is a very long string with many characters and a lot of data. :) 123 +", + error: false, + keyboard: " 74 This is a very long string with many characters and a lot of data. :) 123 +", + memory: { + "1": 32, + "10": 8, + "11": 147, + "15": 115, + "17": 80, + "18": 8, + "19": 147, + "2": 5, + "2097152": 73, + "2097153": 110, + "2097154": 115, + "2097155": 101, + "2097156": 114, + "2097157": 116, + "2097158": 32, + "2097159": 116, + "2097160": 104, + "2097161": 101, + "2097162": 32, + "2097163": 115, + "2097164": 116, + "2097165": 114, + "2097166": 105, + "2097167": 110, + "2097168": 103, + "2097169": 32, + "2097170": 108, + "2097171": 101, + "2097172": 110, + "2097173": 103, + "2097174": 116, + "2097175": 104, + "2097176": 32, + "2097177": 40, + "2097178": 110, + "2097179": 111, + "2097180": 32, + "2097181": 109, + "2097182": 111, + "2097183": 114, + "2097184": 101, + "2097185": 32, + "2097186": 116, + "2097187": 104, + "2097188": 97, + "2097189": 110, + "2097190": 32, + "2097191": 49, + "2097192": 48, + "2097193": 48, + "2097194": 32, + "2097195": 99, + "2097196": 104, + "2097197": 97, + "2097198": 114, + "2097199": 97, + "2097200": 99, + "2097201": 116, + "2097202": 101, + "2097203": 114, + "2097204": 115, + "2097205": 41, + "2097206": 32, + "2097208": 73, + "2097209": 110, + "2097210": 115, + "2097211": 101, + "2097212": 114, + "2097213": 116, + "2097214": 32, + "2097215": 116, + "2097216": 104, + "2097217": 101, + "2097218": 32, + "2097219": 115, + "2097220": 116, + "2097221": 114, + "2097222": 105, + "2097223": 110, + "2097224": 103, + "2097225": 32, + "2097227": 84, + "2097228": 104, + "2097229": 105, + "2097230": 115, + "2097231": 32, + "2097232": 105, + "2097233": 115, + "2097234": 32, + "2097235": 97, + "2097236": 32, + "2097237": 118, + "2097238": 101, + "2097239": 114, + "2097240": 121, + "2097241": 32, + "2097242": 108, + "2097243": 111, + "2097244": 110, + "2097245": 103, + "2097246": 32, + "2097247": 115, + "2097248": 116, + "2097249": 114, + "2097250": 105, + "2097251": 110, + "2097252": 103, + "2097253": 32, + "2097254": 119, + "2097255": 105, + "2097256": 116, + "2097257": 104, + "2097258": 32, + "2097259": 109, + "2097260": 97, + "2097261": 110, + "2097262": 121, + "2097263": 32, + "2097264": 99, + "2097265": 104, + "2097266": 97, + "2097267": 114, + "2097268": 97, + "2097269": 99, + "2097270": 116, + "2097271": 101, + "2097272": 114, + "2097273": 115, + "2097274": 32, + "2097275": 97, + "2097276": 110, + "2097277": 100, + "2097278": 32, + "2097279": 97, + "2097280": 32, + "2097281": 108, + "2097282": 111, + "2097283": 116, + "2097284": 32, + "2097285": 111, + "2097286": 102, + "2097287": 32, + "2097288": 100, + "2097289": 97, + "2097290": 116, + "2097291": 97, + "2097292": 46, + "2097293": 32, + "2097294": 58, + "2097295": 41, + "2097296": 32, + "2097297": 49, + "2097298": 50, + "2097299": 51, + "2097300": 10, + "23": 115, + "25": 5, + "26": 2, + "27": 179, + "29": 32, + "3": 23, + "30": 5, + "31": 23, + "32": 1, + "33": 197, + "34": 5, + "35": 19, + "37": 64, + "38": 8, + "39": 147, + "43": 115, + "45": 32, + "46": 5, + "47": 23, + "48": 1, + "49": 245, + "5": 5, + "50": 5, + "51": 19, + "53": 2, + "54": 133, + "55": 179, + "57": 128, + "58": 8, + "59": 147, + "6": 5, + "63": 115, + "65": 32, + "66": 5, + "67": 23, + "69": 181, + "7": 19, + "70": 5, + "71": 19, + "73": 64, + "74": 8, + "75": 147, + "79": 115, + "82": 128, + "83": 103, + "9": 64, + }, + registers: { + "x10,a0": "0x20004b", + "x11,a1": "0x4a", + "x17,a7": "0x4", + "x5,t0": "0x4a", + mtime: "0x15", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_011.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_011.s.snap new file mode 100644 index 000000000..58a4eaf89 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_011.s.snap @@ -0,0 +1,83 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_011.s 1`] = ` +{ + display: "-144", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 193, + "10": 5, + "11": 19, + "12": 251, + "13": 48, + "14": 5, + "15": 147, + "16": 2, + "17": 208, + "18": 6, + "19": 19, + "2": 1, + "20": 1, + "21": 192, + "23": 239, + "24": 2, + "25": 192, + "268435448": 255, + "268435449": 255, + "268435450": 255, + "268435451": 255, + "27": 239, + "29": 16, + "3": 19, + "30": 8, + "31": 147, + "35": 115, + "37": 1, + "38": 32, + "39": 131, + "41": 65, + "42": 1, + "43": 19, + "46": 128, + "47": 103, + "49": 181, + "5": 17, + "50": 3, + "51": 51, + "53": 198, + "54": 3, + "55": 179, + "57": 3, + "58": 5, + "59": 51, + "6": 32, + "61": 3, + "62": 133, + "63": 179, + "66": 128, + "67": 103, + "68": 64, + "69": 181, + "7": 35, + "70": 5, + "71": 51, + "74": 128, + "75": 103, + "8": 1, + "9": 112, + }, + registers: { + "x10,a0": "0xffffff70", + "x11,a1": "0x5a", + "x12,a2": "0x2d", + "x17,a7": "0x1", + "x6,t1": "0xffffffca", + "x7,t2": "0x5a", + mtime: "0x13", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_012.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_012.s.snap new file mode 100644 index 000000000..08411b28d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_012.s.snap @@ -0,0 +1,129 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_012.s 1`] = ` +{ + display: "120", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 193, + "10": 5, + "102": 128, + "103": 103, + "11": 19, + "12": 1, + "13": 128, + "15": 239, + "17": 16, + "18": 8, + "19": 147, + "2": 1, + "23": 115, + "25": 1, + "26": 32, + "268435392": 15, + "268435393": 255, + "268435394": 255, + "268435395": 204, + "268435399": 80, + "268435403": 2, + "268435404": 15, + "268435405": 255, + "268435406": 255, + "268435407": 216, + "268435411": 80, + "268435415": 3, + "268435416": 15, + "268435417": 255, + "268435418": 255, + "268435419": 228, + "268435423": 80, + "268435427": 4, + "268435428": 15, + "268435429": 255, + "268435430": 255, + "268435431": 240, + "268435435": 80, + "268435439": 5, + "268435447": 16, + "268435448": 255, + "268435449": 255, + "268435450": 255, + "268435451": 255, + "27": 131, + "29": 65, + "3": 19, + "30": 1, + "31": 19, + "34": 128, + "35": 103, + "36": 255, + "37": 65, + "38": 1, + "39": 19, + "41": 17, + "42": 36, + "43": 35, + "45": 129, + "46": 34, + "47": 35, + "49": 65, + "5": 17, + "50": 4, + "51": 19, + "53": 32, + "54": 2, + "55": 147, + "57": 85, + "58": 86, + "59": 99, + "6": 32, + "61": 16, + "62": 5, + "63": 19, + "66": 12, + "67": 99, + "68": 254, + "69": 164, + "7": 35, + "70": 46, + "71": 35, + "72": 255, + "73": 245, + "74": 5, + "75": 19, + "76": 253, + "77": 159, + "78": 240, + "79": 239, + "80": 255, + "81": 196, + "82": 35, + "83": 3, + "84": 2, + "85": 101, + "86": 5, + "87": 51, + "89": 129, + "9": 80, + "90": 32, + "91": 131, + "93": 65, + "94": 36, + "95": 3, + "97": 193, + "98": 1, + "99": 19, + }, + registers: { + "x10,a0": "0x78", + "x17,a7": "0x1", + "x5,t0": "0x2", + "x6,t1": "0x5", + mtime: "0x51", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_013.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_013.s.snap new file mode 100644 index 000000000..2945b12bf --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_013.s.snap @@ -0,0 +1,78 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_013.s 1`] = ` +{ + display: "83116114105110103321051103285847045565832226136128322261361713222613613532226136136322401591601720", + error: false, + keyboard: "", + memory: { + "1": 16, + "10": 130, + "11": 147, + "13": 2, + "14": 197, + "15": 3, + "19": 115, + "2": 8, + "2097152": 83, + "2097153": 116, + "2097154": 114, + "2097155": 105, + "2097156": 110, + "2097157": 103, + "2097158": 32, + "2097159": 105, + "2097160": 110, + "2097161": 32, + "2097162": 85, + "2097163": 84, + "2097164": 70, + "2097165": 45, + "2097166": 56, + "2097167": 58, + "2097168": 32, + "2097169": 226, + "2097170": 136, + "2097171": 128, + "2097172": 32, + "2097173": 226, + "2097174": 136, + "2097175": 171, + "2097176": 32, + "2097177": 226, + "2097178": 136, + "2097179": 135, + "2097180": 32, + "2097181": 226, + "2097182": 136, + "2097183": 136, + "2097184": 32, + "2097185": 240, + "2097186": 159, + "2097187": 160, + "2097188": 172, + "21": 18, + "22": 130, + "23": 147, + "24": 254, + "25": 5, + "26": 26, + "27": 227, + "3": 147, + "30": 128, + "31": 103, + "5": 32, + "6": 2, + "7": 151, + "8": 255, + "9": 194, + }, + registers: { + "x17,a7": "0x1", + "x5,t0": "0x200026", + mtime: "0x9c", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_014.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_014.s.snap new file mode 100644 index 000000000..6c18595ad --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_014.s.snap @@ -0,0 +1,221 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_014.s 1`] = ` +{ + display: "91", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 1, + "10": 36, + "101": 133, + "102": 5, + "103": 51, + "105": 1, + "106": 37, + "107": 131, + "109": 129, + "11": 35, + "110": 36, + "111": 3, + "113": 193, + "114": 32, + "115": 131, + "116": 1, + "117": 1, + "118": 1, + "119": 19, + "122": 128, + "123": 103, + "124": 255, + "125": 65, + "126": 1, + "127": 19, + "129": 17, + "13": 145, + "130": 36, + "131": 35, + "133": 177, + "134": 34, + "135": 35, + "137": 193, + "138": 32, + "139": 35, + "14": 34, + "140": 1, + "141": 192, + "143": 239, + "145": 1, + "146": 34, + "147": 131, + "149": 85, + "15": 35, + "150": 5, + "151": 51, + "153": 65, + "154": 37, + "155": 131, + "157": 129, + "158": 32, + "159": 131, + "16": 1, + "161": 193, + "162": 1, + "163": 19, + "166": 128, + "167": 103, + "168": 255, + "169": 129, + "17": 33, + "170": 1, + "171": 19, + "173": 17, + "174": 34, + "175": 35, + "177": 177, + "178": 32, + "179": 35, + "18": 32, + "180": 1, + "181": 128, + "183": 239, + "185": 1, + "186": 37, + "187": 131, + "188": 2, + "189": 64, + "19": 35, + "191": 239, + "193": 65, + "194": 32, + "195": 131, + "197": 129, + "198": 1, + "199": 19, + "2": 1, + "20": 1, + "202": 128, + "203": 103, + "205": 181, + "206": 3, + "207": 51, + "209": 198, + "21": 112, + "210": 3, + "211": 179, + "213": 3, + "214": 5, + "215": 51, + "217": 3, + "218": 133, + "219": 179, + "22": 5, + "222": 128, + "223": 103, + "224": 64, + "225": 181, + "226": 5, + "227": 51, + "23": 19, + "230": 128, + "231": 103, + "24": 251, + "25": 48, + "26": 5, + "268435400": 255, + "268435401": 255, + "268435402": 255, + "268435403": 179, + "268435407": 144, + "268435411": 45, + "268435412": 255, + "268435413": 255, + "268435414": 255, + "268435415": 179, + "268435419": 100, + "268435420": 255, + "268435421": 255, + "268435422": 255, + "268435423": 179, + "268435427": 23, + "268435435": 36, + "268435448": 255, + "268435449": 255, + "268435450": 255, + "268435451": 255, + "27": 147, + "28": 2, + "29": 208, + "3": 19, + "30": 6, + "31": 19, + "32": 2, + "33": 128, + "35": 239, + "37": 5, + "38": 4, + "39": 19, + "41": 16, + "42": 8, + "43": 147, + "47": 115, + "49": 1, + "5": 17, + "50": 41, + "51": 3, + "53": 65, + "54": 36, + "55": 131, + "57": 129, + "58": 36, + "59": 3, + "6": 38, + "61": 193, + "62": 32, + "63": 131, + "64": 1, + "65": 1, + "66": 1, + "67": 19, + "7": 35, + "70": 128, + "71": 103, + "72": 255, + "73": 1, + "74": 1, + "75": 19, + "77": 17, + "78": 38, + "79": 35, + "81": 129, + "82": 36, + "83": 35, + "85": 161, + "86": 34, + "87": 35, + "89": 177, + "9": 129, + "90": 32, + "91": 35, + "93": 5, + "94": 4, + "95": 19, + "96": 1, + "97": 192, + "99": 239, + }, + registers: { + "x10,a0": "0x5b", + "x11,a1": "0xffffffb3", + "x12,a2": "0x2d", + "x17,a7": "0x1", + "x5,t0": "0x2d", + "x6,t1": "0xffffffca", + "x7,t2": "0x5a", + mtime: "0x3a", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_015.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_015.s.snap new file mode 100644 index 000000000..8ffc81532 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_015.s.snap @@ -0,0 +1,126 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_015.s 1`] = ` +{ + display: "hello world", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 2, + "101": 83, + "102": 5, + "103": 163, + "105": 3, + "106": 5, + "107": 19, + "109": 64, + "11": 147, + "110": 8, + "111": 147, + "115": 115, + "117": 160, + "118": 8, + "119": 147, + "123": 115, + "13": 83, + "15": 35, + "16": 6, + "17": 80, + "18": 2, + "19": 147, + "2": 3, + "2097152": 104, + "2097153": 101, + "2097154": 108, + "2097155": 108, + "2097156": 111, + "2097157": 32, + "2097158": 119, + "2097159": 111, + "2097160": 114, + "2097161": 108, + "2097162": 100, + "21": 83, + "23": 163, + "24": 6, + "25": 192, + "26": 2, + "27": 147, + "29": 83, + "3": 55, + "30": 1, + "31": 35, + "32": 6, + "33": 192, + "34": 2, + "35": 147, + "37": 83, + "38": 1, + "39": 163, + "40": 6, + "41": 240, + "42": 2, + "43": 147, + "45": 83, + "46": 2, + "47": 35, + "48": 2, + "5": 3, + "50": 2, + "51": 147, + "53": 83, + "54": 2, + "55": 163, + "56": 7, + "57": 112, + "58": 2, + "59": 147, + "6": 3, + "61": 83, + "62": 3, + "63": 35, + "64": 6, + "65": 240, + "66": 2, + "67": 147, + "69": 83, + "7": 19, + "70": 3, + "71": 163, + "72": 7, + "73": 32, + "74": 2, + "75": 147, + "77": 83, + "78": 4, + "79": 35, + "8": 6, + "80": 6, + "81": 192, + "82": 2, + "83": 147, + "85": 83, + "86": 4, + "87": 163, + "88": 6, + "89": 64, + "9": 128, + "90": 2, + "91": 147, + "93": 83, + "94": 5, + "95": 35, + "98": 2, + "99": 147, + }, + registers: { + "x10,a0": "0x200000", + "x17,a7": "0xa", + "x6,t1": "0x200000", + mtime: "0x1f", + pc: "0x7c", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_016.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_016.s.snap new file mode 100644 index 000000000..81a060b61 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_016.s.snap @@ -0,0 +1,87 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_016.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 1, + "1": 2, + "10": 243, + "11": 55, + "12": 240, + "13": 19, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 183, + "2": 2, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 14, + "27": 55, + "29": 30, + "3": 183, + "30": 14, + "31": 19, + "33": 32, + "34": 14, + "35": 183, + "36": 4, + "37": 14, + "38": 142, + "39": 147, + "4": 48, + "42": 15, + "43": 55, + "45": 31, + "46": 15, + "47": 19, + "5": 66, + "50": 15, + "51": 183, + "52": 255, + "53": 255, + "54": 143, + "55": 147, + "58": 4, + "59": 55, + "6": 130, + "60": 255, + "61": 244, + "62": 4, + "63": 19, + "64": 255, + "65": 1, + "66": 4, + "67": 183, + "68": 255, + "69": 244, + "7": 147, + "70": 132, + "71": 147, + "74": 128, + "75": 103, + "8": 171, + "9": 205, + }, + registers: { + "x28,t3": "0x200001", + "x29,t4": "0x200040", + "x30,t5": "0x1", + "x31,t6": "0xffffffff", + "x5,t0": "0x1020304", + "x6,t1": "0xabcdef01", + "x7,t2": "0x200000", + "x8,fp,s0": "0xffffffff", + "x9,s1": "0xff00ffff", + mtime: "0x13", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_017.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_017.s.snap new file mode 100644 index 000000000..a6befab79 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_example_017.s.snap @@ -0,0 +1,126 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_example_017.s 1`] = ` +{ + display: "Insert the string: +String in UTF-8: ∀ ∫ ∇ ∈ 🠬 +", + error: false, + keyboard: " String in UTF-8: ∀ ∫ ∇ ∈ 🠬 +", + memory: { + "1": 32, + "10": 8, + "11": 147, + "15": 115, + "17": 32, + "18": 5, + "19": 23, + "2": 5, + "2097152": 73, + "2097153": 110, + "2097154": 115, + "2097155": 101, + "2097156": 114, + "2097157": 116, + "2097158": 32, + "2097159": 116, + "2097160": 104, + "2097161": 101, + "2097162": 32, + "2097163": 115, + "2097164": 116, + "2097165": 114, + "2097166": 105, + "2097167": 110, + "2097168": 103, + "2097169": 58, + "2097170": 32, + "2097172": 83, + "2097173": 116, + "2097174": 114, + "2097175": 105, + "2097176": 110, + "2097177": 103, + "2097178": 32, + "2097179": 105, + "2097180": 110, + "2097181": 32, + "2097182": 85, + "2097183": 84, + "2097184": 70, + "2097185": 45, + "2097186": 56, + "2097187": 58, + "2097188": 32, + "2097189": 226, + "2097190": 136, + "2097191": 128, + "2097192": 32, + "2097193": 226, + "2097194": 136, + "2097195": 171, + "2097196": 32, + "2097197": 226, + "2097198": 136, + "2097199": 135, + "2097200": 32, + "2097201": 226, + "2097202": 136, + "2097203": 136, + "2097204": 32, + "2097205": 240, + "2097206": 159, + "2097207": 160, + "2097208": 172, + "2097209": 10, + "21": 69, + "22": 5, + "23": 19, + "24": 6, + "25": 64, + "26": 5, + "27": 147, + "29": 128, + "3": 23, + "30": 8, + "31": 147, + "35": 115, + "38": 5, + "39": 23, + "40": 254, + "41": 101, + "42": 5, + "43": 19, + "45": 176, + "46": 8, + "47": 147, + "5": 5, + "51": 115, + "53": 32, + "54": 5, + "55": 23, + "56": 254, + "57": 5, + "58": 5, + "59": 19, + "6": 5, + "61": 64, + "62": 8, + "63": 147, + "67": 115, + "7": 19, + "70": 128, + "71": 103, + "9": 64, + }, + registers: { + "x10,a0": "0x200014", + "x11,a1": "0x64", + "x17,a7": "0x4", + mtime: "0x12", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_tutorial_001.s.snap b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_tutorial_001.s.snap new file mode 100644 index 000000000..1cbc7b4e0 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/examples/test_riscv_tutorial_001.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/examples/test_riscv_tutorial_001.s 1`] = ` +{ + display: "2097152This is a string", + error: false, + keyboard: "", + memory: { + "0": 18, + "1": 48, + "10": 5, + "11": 19, + "13": 5, + "14": 37, + "15": 131, + "17": 16, + "18": 8, + "19": 147, + "2": 3, + "2097152": 18, + "2097153": 52, + "2097154": 86, + "2097155": 120, + "2097156": 84, + "2097157": 104, + "2097158": 105, + "2097159": 115, + "2097160": 32, + "2097161": 105, + "2097162": 115, + "2097163": 32, + "2097164": 97, + "2097165": 32, + "2097166": 115, + "2097167": 116, + "2097168": 114, + "2097169": 105, + "2097170": 110, + "2097171": 103, + "23": 115, + "25": 32, + "26": 5, + "27": 23, + "28": 254, + "29": 197, + "3": 19, + "30": 5, + "31": 19, + "33": 64, + "34": 8, + "35": 147, + "39": 115, + "42": 128, + "43": 103, + "5": 32, + "6": 5, + "7": 23, + "8": 255, + "9": 197, + }, + registers: { + "x10,a0": "0x200004", + "x11,a1": "0x12345678", + "x17,a7": "0x4", + "x6,t1": "0x123", + mtime: "0xb", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/libraries/test_riscv_libraries_001.s.snap b/tests/arch/__snapshots__/riscv/correct/libraries/test_riscv_libraries_001.s.snap new file mode 100644 index 000000000..916051d17 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/libraries/test_riscv_libraries_001.s.snap @@ -0,0 +1,86 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/libraries/test_riscv_libraries_001.s 1`] = ` +{ + display: "10 +5 +", + error: false, + keyboard: "", + memory: { + "1": 181, + "10": 128, + "11": 103, + "13": 165, + "14": 212, + "15": 99, + "17": 5, + "18": 133, + "19": 19, + "2": 84, + "22": 128, + "23": 103, + "26": 132, + "27": 19, + "29": 80, + "3": 99, + "30": 5, + "31": 19, + "33": 160, + "34": 5, + "35": 147, + "36": 253, + "37": 223, + "38": 240, + "39": 239, + "41": 16, + "42": 8, + "43": 147, + "47": 115, + "49": 160, + "5": 5, + "50": 5, + "51": 19, + "53": 176, + "54": 8, + "55": 147, + "59": 115, + "6": 133, + "61": 80, + "62": 5, + "63": 19, + "65": 160, + "66": 5, + "67": 147, + "68": 252, + "69": 159, + "7": 19, + "70": 240, + "71": 239, + "73": 16, + "74": 8, + "75": 147, + "79": 115, + "81": 160, + "82": 5, + "83": 19, + "85": 176, + "86": 8, + "87": 147, + "91": 115, + "93": 4, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x10,a0": "0xa", + "x11,a1": "0xa", + "x17,a7": "0xb", + "x8,fp,s0": "0xffffffff", + mtime: "0x18", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_001.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_001.s.snap new file mode 100644 index 000000000..7b15a7f13 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_001.s.snap @@ -0,0 +1,117 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_001.s 1`] = ` +{ + display: "667312034-56781316893491This is a string", + error: false, + keyboard: "", + memory: { + "1": 16, + "10": 5, + "102": 128, + "103": 103, + "11": 19, + "15": 115, + "17": 32, + "18": 3, + "19": 23, + "2": 8, + "20": 255, + "2097152": 120, + "2097153": 255, + "2097155": 34, + "2097156": 255, + "2097157": 255, + "2097158": 233, + "2097159": 210, + "2097160": 84, + "2097161": 104, + "2097162": 105, + "2097163": 115, + "2097164": 32, + "2097165": 105, + "2097166": 115, + "2097167": 32, + "2097168": 97, + "2097169": 32, + "2097170": 115, + "2097171": 116, + "2097172": 114, + "2097173": 105, + "2097174": 110, + "2097175": 103, + "2097180": 63, + "2097181": 140, + "2097182": 204, + "2097183": 205, + "21": 3, + "22": 3, + "23": 19, + "25": 3, + "26": 5, + "27": 3, + "3": 147, + "31": 115, + "33": 32, + "34": 3, + "35": 23, + "36": 254, + "37": 35, + "38": 3, + "39": 19, + "41": 3, + "42": 21, + "43": 3, + "47": 115, + "49": 32, + "50": 3, + "51": 23, + "52": 253, + "53": 67, + "54": 3, + "55": 19, + "57": 3, + "58": 37, + "59": 3, + "6": 37, + "63": 115, + "65": 32, + "66": 3, + "67": 23, + "68": 253, + "69": 195, + "7": 55, + "70": 3, + "71": 19, + "73": 3, + "74": 32, + "75": 7, + "76": 224, + "78": 5, + "79": 83, + "8": 161, + "83": 115, + "85": 64, + "86": 8, + "87": 147, + "89": 32, + "9": 21, + "90": 5, + "91": 23, + "92": 251, + "93": 5, + "94": 5, + "95": 19, + "99": 115, + }, + registers: { + "f0,ft0": "0xffffffff3f8ccccd", + "x10,a0": "0x200008", + "x17,a7": "0x4", + "x6,t1": "0x20001c", + mtime: "0x1a", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_002.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_002.s.snap new file mode 100644 index 000000000..69ba4738c --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_002.s.snap @@ -0,0 +1,52 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_002.s 1`] = ` +{ + display: "6673-861", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 130, + "11": 147, + "12": 208, + "13": 2, + "14": 133, + "15": 83, + "19": 115, + "2": 8, + "20": 250, + "21": 160, + "22": 2, + "23": 147, + "24": 208, + "25": 2, + "26": 133, + "27": 83, + "3": 147, + "31": 115, + "33": 16, + "34": 2, + "35": 147, + "36": 208, + "37": 2, + "38": 133, + "39": 83, + "43": 115, + "46": 128, + "47": 103, + "6": 34, + "7": 183, + "8": 161, + "9": 18, + }, + registers: { + "f10,fa0": "0xffffffff3f800000", + "x17,a7": "0x2", + "x5,t0": "0x1", + mtime: "0xc", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_003.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_003.s.snap new file mode 100644 index 000000000..d3220d1c7 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_003.s.snap @@ -0,0 +1,52 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_003.s 1`] = ` +{ + display: "6673-861", + error: false, + keyboard: "", + memory: { + "1": 48, + "10": 130, + "11": 147, + "12": 210, + "13": 2, + "14": 133, + "15": 83, + "19": 115, + "2": 8, + "20": 250, + "21": 160, + "22": 2, + "23": 147, + "24": 210, + "25": 2, + "26": 133, + "27": 83, + "3": 147, + "31": 115, + "33": 16, + "34": 2, + "35": 147, + "36": 210, + "37": 2, + "38": 133, + "39": 83, + "43": 115, + "46": 128, + "47": 103, + "6": 34, + "7": 183, + "8": 161, + "9": 18, + }, + registers: { + "f10,fa0": "0x3ff0000000000000", + "x17,a7": "0x3", + "x5,t0": "0x1", + mtime: "0xc", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_004.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_004.s.snap new file mode 100644 index 000000000..2803b1ca4 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_004.s.snap @@ -0,0 +1,81 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_004.s 1`] = ` +{ + display: "First StringSecond Stringa +", + error: false, + keyboard: "", + memory: { + "1": 64, + "10": 5, + "11": 19, + "15": 115, + "17": 32, + "18": 5, + "19": 23, + "2": 8, + "20": 255, + "2097152": 70, + "2097153": 105, + "2097154": 114, + "2097155": 115, + "2097156": 116, + "2097157": 32, + "2097158": 83, + "2097159": 116, + "2097160": 114, + "2097161": 105, + "2097162": 110, + "2097163": 103, + "2097165": 83, + "2097166": 101, + "2097167": 99, + "2097168": 111, + "2097169": 110, + "2097170": 100, + "2097171": 32, + "2097172": 83, + "2097173": 116, + "2097174": 114, + "2097175": 105, + "2097176": 110, + "2097177": 103, + "2097179": 97, + "21": 213, + "22": 5, + "23": 19, + "27": 115, + "29": 32, + "3": 147, + "30": 5, + "31": 23, + "32": 255, + "33": 245, + "34": 5, + "35": 19, + "39": 115, + "41": 160, + "42": 5, + "43": 19, + "45": 176, + "46": 8, + "47": 147, + "5": 32, + "51": 115, + "54": 128, + "55": 103, + "6": 5, + "7": 23, + "8": 255, + "9": 197, + }, + registers: { + "x10,a0": "0xa", + "x17,a7": "0xb", + mtime: "0xe", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_005.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_005.s.snap new file mode 100644 index 000000000..f0eecc9ea --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_005.s.snap @@ -0,0 +1,24 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_005.s 1`] = ` +{ + display: "", + error: false, + keyboard: " 1234567", + memory: { + "1": 80, + "10": 128, + "11": 103, + "2": 8, + "3": 147, + "7": 115, + }, + registers: { + "x10,a0": "0x12d687", + "x17,a7": "0x5", + mtime: "0x3", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_006.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_006.s.snap new file mode 100644 index 000000000..c2b1fe9c1 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_006.s.snap @@ -0,0 +1,24 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_006.s 1`] = ` +{ + display: "", + error: false, + keyboard: " 1.234567", + memory: { + "1": 96, + "10": 128, + "11": 103, + "2": 8, + "3": 147, + "7": 115, + }, + registers: { + "f10,fa0": "0xffffffff3f9e064b", + "x17,a7": "0x6", + mtime: "0x3", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_007.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_007.s.snap new file mode 100644 index 000000000..8b10963ab --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_007.s.snap @@ -0,0 +1,24 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_007.s 1`] = ` +{ + display: "", + error: false, + keyboard: " 1.234567890123456", + memory: { + "1": 112, + "10": 128, + "11": 103, + "2": 8, + "3": 147, + "7": 115, + }, + registers: { + "f10,fa0": "0x3ff3c0ca428c59f8", + "x17,a7": "0x7", + mtime: "0x3", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_008.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_008.s.snap new file mode 100644 index 000000000..c3bb3aaba --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_008.s.snap @@ -0,0 +1,41 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_008.s 1`] = ` +{ + display: "", + error: false, + keyboard: " This is a long string +", + memory: { + "1": 128, + "10": 5, + "11": 19, + "13": 80, + "14": 5, + "15": 147, + "19": 115, + "2": 8, + "2097152": 84, + "2097153": 104, + "2097154": 105, + "2097155": 115, + "2097156": 32, + "22": 128, + "23": 103, + "3": 147, + "5": 32, + "6": 5, + "7": 23, + "8": 255, + "9": 197, + }, + registers: { + "x10,a0": "0x200000", + "x11,a1": "0x5", + "x17,a7": "0x8", + mtime: "0x6", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_009.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_009.s.snap new file mode 100644 index 000000000..ce19de182 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_009.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_009.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 8, + "11": 147, + "13": 128, + "14": 5, + "15": 19, + "19": 115, + "2": 2, + "21": 85, + "22": 32, + "23": 35, + "25": 101, + "26": 34, + "27": 35, + "29": 128, + "3": 147, + "30": 5, + "31": 19, + "35": 115, + "37": 85, + "38": 32, + "39": 35, + "4": 1, + "41": 101, + "42": 34, + "43": 35, + "46": 128, + "47": 103, + "5": 64, + "6": 3, + "7": 19, + "9": 144, + "96206019": 10, + "96206023": 20, + "96206027": 10, + "96206031": 20, + }, + registers: { + "x10,a0": "0x5bbfcc8", + "x17,a7": "0x9", + "x5,t0": "0xa", + "x6,t1": "0x14", + mtime: "0xc", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_010.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_010.s.snap new file mode 100644 index 000000000..a0a109688 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_010.s.snap @@ -0,0 +1,27 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_010.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 2, + "11": 147, + "14": 128, + "15": 103, + "2": 8, + "3": 147, + "7": 115, + "8": 28, + "9": 80, + }, + registers: { + "x17,a7": "0xa", + mtime: "0x2", + pc: "0x8", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_011.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_011.s.snap new file mode 100644 index 000000000..6b8f0e75c --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_011.s.snap @@ -0,0 +1,28 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_011.s 1`] = ` +{ + display: "c", + error: false, + keyboard: "", + memory: { + "1": 176, + "11": 115, + "14": 128, + "15": 103, + "2": 8, + "3": 147, + "4": 6, + "5": 48, + "6": 5, + "7": 19, + }, + registers: { + "x10,a0": "0x63", + "x17,a7": "0xb", + mtime: "0x4", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_012.s.snap b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_012.s.snap new file mode 100644 index 000000000..80a8b24f4 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/correct/syscalls/test_riscv_syscall_012.s.snap @@ -0,0 +1,24 @@ +export const snapshot = {}; + +snapshot[`riscv/correct/syscalls/test_riscv_syscall_012.s 1`] = ` +{ + display: "", + error: false, + keyboard: " a", + memory: { + "1": 192, + "10": 128, + "11": 103, + "2": 8, + "3": 147, + "7": 115, + }, + registers: { + "x10,a0": "0x61", + "x17,a7": "0xc", + mtime: "0x3", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_001.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_001.s.snap new file mode 100644 index 000000000..9aa54d348 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_001.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_001.s 1`] = ` +{ + column: 2, + errorText: "[E12] Error: Label A is already defined", + line: 9, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_001.s 2`] = ` +"[E12] Error: Label A is already defined + ╭─[ assembly:9:2 ] + │ + 7 │ A: .word -1 + │ ─┬ + │ ╰─────── Note: Label also defined here + │ + 9 │ A: .half 23 + │ ─┬ + │ ╰───── Duplicate label + │ + │ Help: Consider renaming either of the labels +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_001.s 3`] = ` +"[E12] Error: Label A is already defined + ╭─[ assembly:9:2 ] + + 7 │ A: .word -1 + ─┬ + ╰─────── Note: Label also defined here + + 9 │ A: .half 23 + ─┬ + ╰───── Duplicate label + + Help: Consider renaming either of the labels +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_001.s 4`] = ` +"[E12] Error: Label A is already defined + ╭─[ assembly:9:2 ] + │ + 7 │     A:       .word -1 +  │ ─┬ +  │ ╰─────── Note: Label also defined here +  │ + 9 │     A:     .half 23 +  │ ─┬ +  │ ╰───── Duplicate label +  │ +  │ Help: Consider renaming either of the labels +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_002.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_002.s.snap new file mode 100644 index 000000000..8e0d31393 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_002.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_002.s 1`] = ` +{ + column: 2, + errorText: "[E02] Error: Instruction suma isn't defined", + line: 12, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_002.s 2`] = ` +"[E02] Error: Instruction suma isn't defined + ╭─[ assembly:12:2 ] + │ + 12 │ suma t0, t1, t2 + │ ──┬─ + │ ╰─── Unknown instruction +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_002.s 3`] = ` +"[E02] Error: Instruction suma isn't defined + ╭─[ assembly:12:2 ] + + 12 │ suma t0, t1, t2 + ──┬─ + ╰─── Unknown instruction +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_002.s 4`] = ` +"[E02] Error: Instruction suma isn't defined + ╭─[ assembly:12:2 ] + │ + 12 │     suma t0, t1, t2 +  │ ──┬─ +  │ ╰─── Unknown instruction +────╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_003.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_003.s.snap new file mode 100644 index 000000000..96174480e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_003.s.snap @@ -0,0 +1,84 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_003.s 1`] = ` +{ + column: 8, + errorText: "[E09] Error: Incorrect instruction syntax", + line: 12, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_003.s 2`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:12:8 ] + │ + 12 │ add t0, t1 + │ ───┬── + │ ╰──── Incorrect syntax + │ + │ Note: Allowed formats: + │ opcode rd, rs1, rs2 +────╯ + +The syntax opcode rd, rs1, rs2 failed with the following reason: +Error: found end of input but expected , or binary operator + ╭─[ assembly:12:14 ] + │ + 12 │ add t0, t1 + │ ─┬│ + │ ╰── While parsing this expression + │ │ + │ ╰─ Unexpected input +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_003.s 3`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:12:8 ] + + 12 │ add t0, t1 + ───┬── + ╰──── Incorrect syntax + + Note: Allowed formats: + opcode rd, rs1, rs2 +────╯ + +The syntax opcode rd, rs1, rs2 failed with the following reason: +Error: found end of input but expected , or binary operator + ╭─[ assembly:12:14 ] + + 12 │ add t0, t1 + ─┬ + ╰── While parsing this expression + + ╰─ Unexpected input +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_003.s 4`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:12:8 ] + │ + 12 │    add t0, t1 +  │ ───┬── +  │ ╰──── Incorrect syntax +  │ +  │ Note: Allowed formats: +  │ opcode rd, rs1, rs2 +────╯ + +The syntax opcode rd, rs1, rs2 failed with the following reason: +Error: found end of input but expected , or binary operator + ╭─[ assembly:12:14 ] + │ + 12 │    add t0, t1 +  │ ─┬│ +  │ ╰── While parsing this expression +  │ │ +  │ ╰─ Unexpected input +────╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_004.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_004.s.snap new file mode 100644 index 000000000..156e4eb2a --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_004.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_004.s 1`] = ` +{ + column: 14, + errorText: "[E05] Error: Register s50 isn't defined in file type Integer", + line: 12, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_004.s 2`] = ` +"[E05] Error: Register s50 isn't defined in file type Integer + ╭─[ assembly:12:14 ] + │ + 12 │ add t0, t1, s50 + │ ─┬─ + │ ╰─── Unknown register + │ + │ Help: Did you mean s0, s10, or s5? +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_004.s 3`] = ` +"[E05] Error: Register s50 isn't defined in file type Integer + ╭─[ assembly:12:14 ] + + 12 │ add t0, t1, s50 + ─┬─ + ╰─── Unknown register + + Help: Did you mean s0, s10, or s5? +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_004.s 4`] = ` +"[E05] Error: Register s50 isn't defined in file type Integer + ╭─[ assembly:12:14 ] + │ + 12 │     add t0, t1, s50 +  │ ─┬─ +  │ ╰─── Unknown register +  │ +  │ Help: Did you mean s0, s10, or s5? +────╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_005.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_005.s.snap new file mode 100644 index 000000000..7a023e6f5 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_005.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_005.s 1`] = ` +{ + column: 19, + errorText: "[E23] Error: Value 291 is outside of the valid range of the field", + line: 7, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_005.s 2`] = ` +"[E23] Error: Value 291 is outside of the valid range of the field + ╭─[ assembly:7:19 ] + │ + 7 │ a: .byte 0x123 + │ ──┬── + │ ╰──── This expression has value 291 + │ + │ Note: Allowed range is [-128, 255] +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_005.s 3`] = ` +"[E23] Error: Value 291 is outside of the valid range of the field + ╭─[ assembly:7:19 ] + + 7 │ a: .byte 0x123 + ──┬── + ╰──── This expression has value 291 + + Note: Allowed range is [-128, 255] +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_005.s 4`] = ` +"[E23] Error: Value 291 is outside of the valid range of the field + ╭─[ assembly:7:19 ] + │ + 7 │     a:      .byte 0x123 +  │ ──┬── +  │ ╰──── This expression has value 291 +  │ +  │ Note: Allowed range is [-128, 255] +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_006.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_006.s.snap new file mode 100644 index 000000000..93dce8464 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_006.s.snap @@ -0,0 +1,84 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_006.s 1`] = ` +{ + column: 7, + errorText: "[E09] Error: Incorrect instruction syntax", + line: 11, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_006.s 2`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:11:7 ] + │ + 11 │ li t0, 0xhello + │ ─────┬───── + │ ╰─────── Incorrect syntax + │ + │ Note: Allowed formats: + │ opcode rd, val +────╯ + +The syntax opcode rd, val failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:11:12 ] + │ + 11 │ li t0, 0xhello + │ ┬───┬── + │ ╰──────── While parsing this expression + │ │ + │ ╰──── Unexpected input +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_006.s 3`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:11:7 ] + + 11 │ li t0, 0xhello + ─────┬───── + ╰─────── Incorrect syntax + + Note: Allowed formats: + opcode rd, val +────╯ + +The syntax opcode rd, val failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:11:12 ] + + 11 │ li t0, 0xhello + ───┬── + ╰──────── While parsing this expression + + ╰──── Unexpected input +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_006.s 4`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:11:7 ] + │ + 11 │    li t0, 0xhello +  │ ─────┬───── +  │ ╰─────── Incorrect syntax +  │ +  │ Note: Allowed formats: +  │ opcode rd, val +────╯ + +The syntax opcode rd, val failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:11:12 ] + │ + 11 │    li t0, 0xhello +  │ ┬───┬── +  │ ╰──────── While parsing this expression +  │ │ +  │ ╰──── Unexpected input +────╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_007.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_007.s.snap new file mode 100644 index 000000000..4e7d94e16 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_007.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_007.s 1`] = ` +{ + column: 7, + errorText: "[E03] Error: Label mains isn't defined", + line: 11, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_007.s 2`] = ` +"[E03] Error: Label mains isn't defined + ╭─[ assembly:11:7 ] + │ + 11 │ j mains + │ ──┬── + │ ╰──── Unknown label + │ + │ Help: Did you mean main? +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_007.s 3`] = ` +"[E03] Error: Label mains isn't defined + ╭─[ assembly:11:7 ] + + 11 │ j mains + ──┬── + ╰──── Unknown label + + Help: Did you mean main? +────╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_007.s 4`] = ` +"[E03] Error: Label mains isn't defined + ╭─[ assembly:11:7 ] + │ + 11 │     j mains +  │ ──┬── +  │ ╰──── Unknown label +  │ +  │ Help: Did you mean main? +────╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_008.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_008.s.snap new file mode 100644 index 000000000..e64a0476b --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_008.s.snap @@ -0,0 +1,66 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_008.s 1`] = ` +{ + column: 4, + errorText: "[E23] Error: Value 305419896 is outside of the valid range of the field", + line: 8, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_008.s 2`] = ` +"[E23] Error: Value 305419896 is outside of the valid range of the field + ╭─[ :1:17 ] + │ + 1 │ beq zero, zero, off; + │ ─┬─ + │ ╰─── This expression has value 305419896 + │ + ├─[ assembly:8:4 ] + │ + 8 │ j 0x12345678 + │ ──────┬───── + │ ╰─────── Generated by this pseudoinstruction + │ + │ Note: Allowed range is [-4096, 4095] +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_008.s 3`] = ` +"[E23] Error: Value 305419896 is outside of the valid range of the field + ╭─[ <expansion 1>:1:17 ] + + 1 │ beq zero, zero, off; + ─┬─ + ╰─── This expression has value 305419896 + + ├─[ assembly:8:4 ] + + 8 │ j 0x12345678 + ──────┬───── + ╰─────── Generated by this pseudoinstruction + + Note: Allowed range is [-4096, 4095] +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_008.s 4`] = ` +"[E23] Error: Value 305419896 is outside of the valid range of the field + ╭─[ :1:17 ] + │ + 1 │ beq zero, zero, off; +  │ ─┬─ +  │ ╰─── This expression has value 305419896 + │ + ├─[ assembly:8:4 ] + │ + 8 │    j 0x12345678 +  │ ──────┬───── +  │ ╰─────── Generated by this pseudoinstruction +  │ +  │ Note: Allowed range is [-4096, 4095] +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_009.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_009.s.snap new file mode 100644 index 000000000..91590d5d8 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_009.s.snap @@ -0,0 +1,84 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_009.s 1`] = ` +{ + column: 6, + errorText: "[E09] Error: Incorrect instruction syntax", + line: 8, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_009.s 2`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:8:6 ] + │ + 8 │ j 0xhello + │ ───┬─── + │ ╰───── Incorrect syntax + │ + │ Note: Allowed formats: + │ opcode off +───╯ + +The syntax opcode off failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:8:7 ] + │ + 8 │ j 0xhello + │ ┬───┬── + │ ╰──────── While parsing this expression + │ │ + │ ╰──── Unexpected input +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_009.s 3`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:8:6 ] + + 8 │ j 0xhello + ───┬─── + ╰───── Incorrect syntax + + Note: Allowed formats: + opcode off +───╯ + +The syntax opcode off failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:8:7 ] + + 8 │ j 0xhello + ───┬── + ╰──────── While parsing this expression + + ╰──── Unexpected input +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_009.s 4`] = ` +"[E09] Error: Incorrect instruction syntax + ╭─[ assembly:8:6 ] + │ + 8 │    j 0xhello +  │ ───┬─── +  │ ╰───── Incorrect syntax +  │ +  │ Note: Allowed formats: +  │ opcode off +───╯ + +The syntax opcode off failed with the following reason: +Error: found identifier (xhello) but expected binary operator or end of input + ╭─[ assembly:8:7 ] + │ + 8 │    j 0xhello +  │ ┬───┬── +  │ ╰──────── While parsing this expression +  │ │ +  │ ╰──── Unexpected input +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_010.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_010.s.snap new file mode 100644 index 000000000..4b2e947f0 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_010.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_010.s 1`] = ` +{ + column: 16, + errorText: "[E16] Error: Data memory segment is full", + line: 8, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_010.s 2`] = ` +"[E16] Error: Data memory segment is full + ╭─[ assembly:8:16 ] + │ + 8 │ spa: .zero 16 * 1024 * 1024 * 1024 + │ ───────────┬─────────── + │ ╰───────────── This element doesn't fit in the available space +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_010.s 3`] = ` +"[E16] Error: Data memory segment is full + ╭─[ assembly:8:16 ] + + 8 │ spa: .zero 16 * 1024 * 1024 * 1024 + ───────────┬─────────── + ╰───────────── This element doesn't fit in the available space +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_010.s 4`] = ` +"[E16] Error: Data memory segment is full + ╭─[ assembly:8:16 ] + │ + 8 │     spa:    .zero  16 * 1024 * 1024 * 1024 +  │ ───────────┬─────────── +  │ ╰───────────── This element doesn't fit in the available space +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_014.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_014.s.snap new file mode 100644 index 000000000..b9eb29ed3 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_014.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_014.s 1`] = ` +{ + column: 14, + errorText: "[E01] Error: Directive .directive isn't defined", + line: 8, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_014.s 2`] = ` +"[E01] Error: Directive .directive isn't defined + ╭─[ assembly:8:14 ] + │ + 8 │ example: .directive 221 + │ ─────┬──── + │ ╰────── Unknown directive +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_014.s 3`] = ` +"[E01] Error: Directive .directive isn't defined + ╭─[ assembly:8:14 ] + + 8 │ example: .directive 221 + ─────┬──── + ╰────── Unknown directive +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_014.s 4`] = ` +"[E01] Error: Directive .directive isn't defined + ╭─[ assembly:8:14 ] + │ + 8 │     example:    .directive 221 +  │ ─────┬──── +  │ ╰────── Unknown directive +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_015.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_015.s.snap new file mode 100644 index 000000000..aa77ace0e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_015.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_015.s 1`] = ` +{ + column: 22, + errorText: "[E03] Error: Label hello isn't defined", + line: 8, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_015.s 2`] = ` +"[E03] Error: Label hello isn't defined + ╭─[ assembly:8:22 ] + │ + 8 │ example: .word hello + │ ──┬── + │ ╰──── Unknown label +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_015.s 3`] = ` +"[E03] Error: Label hello isn't defined + ╭─[ assembly:8:22 ] + + 8 │ example: .word hello + ──┬── + ╰──── Unknown label +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_015.s 4`] = ` +"[E03] Error: Label hello isn't defined + ╭─[ assembly:8:22 ] + │ + 8 │     example:   .word hello +  │ ──┬── +  │ ╰──── Unknown label +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_016.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_016.s.snap new file mode 100644 index 000000000..cffc1ed27 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_016.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_016.s 1`] = ` +{ + column: 33, + errorText: "Compilation error", + line: 8, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_016.s 2`] = ` +'Error: Unterminated string literal + ╭─[ assembly:8:33 ] + │ + 8 │ example: .string hello world" + │ ───┬─┬ + │ ╰──── While parsing this identifier + │ │ + │ ╰── Caused by this +───╯ +' +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_016.s 3`] = ` +"Error: Unterminated string literal + ╭─[ assembly:8:33 ] + + 8 │ example: .string hello world" + ───┬─ + ╰──── While parsing this identifier + + ╰── Caused by this +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_016.s 4`] = ` +'Error: Unterminated string literal + ╭─[ assembly:8:33 ] + │ + 8 │     example:    .string hello world" +  │ ───┬─┬ +  │ ╰──── While parsing this identifier +  │ │ +  │ ╰── Caused by this +───╯ +' +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_017.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_017.s.snap new file mode 100644 index 000000000..c2fa2e1af --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_017.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_017.s 1`] = ` +{ + column: 34, + errorText: "Compilation error", + line: 8, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_017.s 2`] = ` +'Error: Unterminated string literal + ╭─[ assembly:8:34 ] + │ + 8 │ example: .string "hello world + │ ──────┬─────┬ + │ ╰──────── While parsing this string + │ │ + │ ╰── Caused by this +───╯ +' +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_017.s 3`] = ` +"Error: Unterminated string literal + ╭─[ assembly:8:34 ] + + 8 │ example: .string "hello world + ──────┬───── + ╰──────── While parsing this string + + ╰── Caused by this +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_017.s 4`] = ` +'Error: Unterminated string literal + ╭─[ assembly:8:34 ] + │ + 8 │     example:    .string "hello world +  │ ──────┬─────┬ +  │ ╰──────── While parsing this string +  │ │ +  │ ╰── Caused by this +───╯ +' +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_018.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_018.s.snap new file mode 100644 index 000000000..3476a5bd0 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_018.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_018.s 1`] = ` +{ + column: 20, + errorText: "[E23] Error: Value 74565 is outside of the valid range of the field", + line: 7, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_018.s 2`] = ` +"[E23] Error: Value 74565 is outside of the valid range of the field + ╭─[ assembly:7:20 ] + │ + 7 │ example: .half 0x12345 + │ ───┬─── + │ ╰───── This expression has value 74565 + │ + │ Note: Allowed range is [-32768, 65535] +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_018.s 3`] = ` +"[E23] Error: Value 74565 is outside of the valid range of the field + ╭─[ assembly:7:20 ] + + 7 │ example: .half 0x12345 + ───┬─── + ╰───── This expression has value 74565 + + Note: Allowed range is [-32768, 65535] +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_018.s 4`] = ` +"[E23] Error: Value 74565 is outside of the valid range of the field + ╭─[ assembly:7:20 ] + │ + 7 │   example:   .half 0x12345 +  │ ───┬─── +  │ ╰───── This expression has value 74565 +  │ +  │ Note: Allowed range is [-32768, 65535] +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_019.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_019.s.snap new file mode 100644 index 000000000..ef6f4bcea --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_019.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_019.s 1`] = ` +{ + column: 12, + errorText: "Compilation error", + line: 7, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_019.s 2`] = ` +"Error: found identifier (x) but expected ,, \\\\n, binary operator, or end of input + ╭─[ assembly:7:12 ] + │ + 7 │ .byte 0x + │ ┬┬ + │ ╰─── While parsing this expression + │ │ + │ ╰── Unexpected input +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_019.s 3`] = ` +"Error: found identifier (x) but expected ,, \\\\n, binary operator, or end of input + ╭─[ assembly:7:12 ] + + 7 │ .byte 0x + + ╰─── While parsing this expression + + ╰── Unexpected input +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_019.s 4`] = ` +"Error: found identifier (x) but expected ,, \\\\n, binary operator, or end of input + ╭─[ assembly:7:12 ] + │ + 7 │     .byte 0x +  │ ┬┬ +  │ ╰─── While parsing this expression +  │ │ +  │ ╰── Unexpected input +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_021.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_021.s.snap new file mode 100644 index 000000000..cfa77126f --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_021.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_021.s 1`] = ` +{ + column: 21, + errorText: "[E17] Error: Data at address 0x200001 isn't aligned to size 2 nor word size 4", + line: 9, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_021.s 2`] = ` +"[E17] Error: Data at address 0x200001 isn't aligned to size 2 nor word size 4 + ╭─[ assembly:9:21 ] + │ + 9 │ example2: .half 2 + │ ┬ + │ ╰── This value isn't aligned +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_021.s 3`] = ` +"[E17] Error: Data at address 0x200001 isn't aligned to size 2 nor word size 4 + ╭─[ assembly:9:21 ] + + 9 │ example2: .half 2 + + ╰── This value isn't aligned +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_021.s 4`] = ` +"[E17] Error: Data at address 0x200001 isn't aligned to size 2 nor word size 4 + ╭─[ assembly:9:21 ] + │ + 9 │     example2:   .half 2 +  │ ┬ +  │ ╰── This value isn't aligned +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_022.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_022.s.snap new file mode 100644 index 000000000..a8fa01035 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_022.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_022.s 1`] = ` +{ + column: 11, + errorText: "[E22] Error: Negative values aren't allowed here", + line: 7, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_022.s 2`] = ` +"[E22] Error: Negative values aren't allowed here + ╭─[ assembly:7:11 ] + │ + 7 │ .zero -10 + │ ─┬─ + │ ╰─── This expression has value -10 +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_022.s 3`] = ` +"[E22] Error: Negative values aren't allowed here + ╭─[ assembly:7:11 ] + + 7 │ .zero -10 + ─┬─ + ╰─── This expression has value -10 +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_022.s 4`] = ` +"[E22] Error: Negative values aren't allowed here + ╭─[ assembly:7:11 ] + │ + 7 │     .zero -10 +  │ ─┬─ +  │ ╰─── This expression has value -10 +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_023.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_023.s.snap new file mode 100644 index 000000000..5433e5684 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_023.s.snap @@ -0,0 +1,48 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_023.s 1`] = ` +{ + column: 20, + errorText: "[E10] Error: Incorrect amount of arguments, expected at least 1 but found 0", + line: 9, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_023.s 2`] = ` +"[E10] Error: Incorrect amount of arguments, expected at least 1 but found 0 + ╭─[ assembly:9:20 ] + │ + 9 │ example2: .half + │ │ + │ ╰─ This directive has 0 arguments + │ + │ Help: Consider adding the missing 1 argument +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_023.s 3`] = ` +"[E10] Error: Incorrect amount of arguments, expected at least 1 but found 0 + ╭─[ assembly:9:20 ] + + 9 │ example2: .half + + ╰─ This directive has 0 arguments + + Help: Consider adding the missing 1 argument +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_023.s 4`] = ` +"[E10] Error: Incorrect amount of arguments, expected at least 1 but found 0 + ╭─[ assembly:9:20 ] + │ + 9 │    example2:    .half +  │ │ +  │ ╰─ This directive has 0 arguments +  │ +  │ Help: Consider adding the missing 1 argument +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_030.s.snap b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_030.s.snap new file mode 100644 index 000000000..ca1b94a2a --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/compiler/test_riscv_error_compiler_030.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_030.s 1`] = ` +{ + column: 14, + errorText: "[E13] Error: Main label main not found", + line: 8, +} +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_030.s 2`] = ` +"[E13] Error: Main label main not found + ╭─[ assembly:8:14 ] + │ + 8 │ li t0, 10 + │ │ + │ ╰─ Consider adding a label called main to an instruction +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_030.s 3`] = ` +"[E13] Error: Main label main not found + ╭─[ assembly:8:14 ] + + 8 │ li t0, 10 + + ╰─ Consider adding a label called main to an instruction +───╯ +" +`; + +snapshot[`riscv/error/compiler/test_riscv_error_compiler_030.s 4`] = ` +"[E13] Error: Main label main not found + ╭─[ assembly:8:14 ] + │ + 8 │     li t0, 10 +  │ │ +  │ ╰─ Consider adding a label called main to an instruction +───╯ +" +`; diff --git a/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_002.s.snap b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_002.s.snap new file mode 100644 index 000000000..859bee583 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_002.s.snap @@ -0,0 +1,29 @@ +export const snapshot = {}; + +snapshot[`riscv/error/executor/test_riscv_error_executor_002.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Stack pointer cannot be outside the stack segment", + i: 0, + }, + ], + keyboard: "", + memory: { + "0": 255, + "1": 240, + "2": 1, + "3": 19, + "6": 128, + "7": 103, + }, + registers: { + "x2,sp": "0xffffffff", + mtime: "0x1", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_003.s.snap b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_003.s.snap new file mode 100644 index 000000000..dc6f2613a --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_003.s.snap @@ -0,0 +1,27 @@ +export const snapshot = {}; + +snapshot[`riscv/error/executor/test_riscv_error_executor_003.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Stack pointer cannot be placed in the text segment", + i: 0, + }, + ], + keyboard: "", + memory: { + "2": 1, + "3": 19, + "6": 128, + "7": 103, + }, + registers: { + "x2,sp": "0x0", + mtime: "0x1", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_004.s.snap b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_004.s.snap new file mode 100644 index 000000000..efbd927e5 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_004.s.snap @@ -0,0 +1,35 @@ +export const snapshot = {}; + +snapshot[`riscv/error/executor/test_riscv_error_executor_004.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Stack pointer cannot be placed in the data segment", + i: 2, + }, + ], + keyboard: "", + memory: { + "1": 32, + "10": 129, + "11": 19, + "14": 128, + "15": 103, + "2": 2, + "3": 183, + "5": 2, + "6": 130, + "7": 147, + "9": 2, + }, + registers: { + "x2,sp": "0x200000", + "x5,t0": "0x200000", + mtime: "0x3", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_005.s.snap b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_005.s.snap new file mode 100644 index 000000000..c9c825533 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_005.s.snap @@ -0,0 +1,31 @@ +export const snapshot = {}; + +snapshot[`riscv/error/executor/test_riscv_error_executor_005.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Segmentation fault. You tried to write in the text segment", + i: 1, + }, + ], + keyboard: "", + memory: { + "1": 160, + "10": 128, + "11": 103, + "2": 2, + "3": 147, + "5": 80, + "6": 32, + "7": 35, + }, + registers: { + "x5,t0": "0xa", + mtime: "0x2", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_006.s.snap b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_006.s.snap new file mode 100644 index 000000000..586ceb0c5 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_006.s.snap @@ -0,0 +1,30 @@ +export const snapshot = {}; + +snapshot[`riscv/error/executor/test_riscv_error_executor_006.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "Segmentation fault. You tried to read in the text segment (00000000)", + i: 1, + }, + ], + keyboard: "", + memory: { + "1": 160, + "10": 128, + "11": 103, + "2": 2, + "3": 147, + "6": 34, + "7": 131, + }, + registers: { + "x5,t0": "0xa", + mtime: "0x2", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_007.s.snap b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_007.s.snap new file mode 100644 index 000000000..9ebb39bea --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_007.s.snap @@ -0,0 +1,38 @@ +export const snapshot = {}; + +snapshot[`riscv/error/executor/test_riscv_error_executor_007.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "The memory must be aligned", + i: 3, + }, + ], + keyboard: "", + memory: { + "1": 32, + "10": 3, + "11": 19, + "13": 98, + "14": 160, + "15": 163, + "18": 128, + "19": 103, + "2": 2, + "3": 151, + "5": 2, + "6": 130, + "7": 147, + "9": 160, + }, + registers: { + "x5,t0": "0x200000", + "x6,t1": "0xa", + mtime: "0x4", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_008.s.snap b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_008.s.snap new file mode 100644 index 000000000..d5905944b --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_008.s.snap @@ -0,0 +1,38 @@ +export const snapshot = {}; + +snapshot[`riscv/error/executor/test_riscv_error_executor_008.s 1`] = ` +{ + display: "", + error: false, + instruction_errors: [ + { + error: "The memory must be aligned", + i: 3, + }, + ], + keyboard: "", + memory: { + "1": 32, + "10": 3, + "11": 19, + "13": 18, + "14": 163, + "15": 3, + "18": 128, + "19": 103, + "2": 2, + "3": 151, + "5": 2, + "6": 130, + "7": 147, + "9": 160, + }, + registers: { + "x5,t0": "0x200000", + "x6,t1": "0xa", + mtime: "0x4", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_009.s.snap b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_009.s.snap new file mode 100644 index 000000000..65c9cf25a --- /dev/null +++ b/tests/arch/__snapshots__/riscv/error/executor/test_riscv_error_executor_009.s.snap @@ -0,0 +1,20 @@ +export const snapshot = {}; + +snapshot[`riscv/error/executor/test_riscv_error_executor_009.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "3": 19, + "6": 128, + "7": 103, + }, + registers: { + mtime: "0x2", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_001.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_001.s.snap new file mode 100644 index 000000000..39793573c --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_001.s.snap @@ -0,0 +1,49 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_001.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 3, + "11": 147, + "12": 1, + "14": 4, + "15": 55, + "16": 255, + "17": 244, + "18": 4, + "19": 19, + "2": 2, + "21": 98, + "22": 132, + "23": 179, + "25": 147, + "26": 133, + "27": 51, + "29": 164, + "3": 147, + "30": 5, + "31": 179, + "34": 128, + "35": 103, + "4": 254, + "5": 32, + "6": 3, + "7": 19, + }, + registers: { + "x10,a0": "0xffffffec", + "x11,a1": "0xffffeb", + "x5,t0": "0xa", + "x6,t1": "0xffffffe2", + "x8,fp,s0": "0xffffff", + "x9,s1": "0xffffffec", + mtime: "0x9", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_002.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_002.s.snap new file mode 100644 index 000000000..20a7e772f --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_002.s.snap @@ -0,0 +1,36 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_002.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 133, + "11": 19, + "13": 197, + "14": 5, + "15": 147, + "18": 128, + "19": 103, + "2": 2, + "3": 147, + "4": 254, + "5": 34, + "6": 132, + "7": 147, + "8": 25, + "9": 180, + }, + registers: { + "x10,a0": "0x187", + "x11,a1": "0x193", + "x5,t0": "0xa", + "x9,s1": "0xffffffec", + mtime: "0x5", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_003.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_003.s.snap new file mode 100644 index 000000000..aeecc28e9 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_003.s.snap @@ -0,0 +1,55 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_003.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 34, + "1": 48, + "10": 3, + "11": 147, + "13": 18, + "14": 52, + "15": 55, + "16": 81, + "17": 84, + "18": 4, + "19": 19, + "2": 2, + "20": 64, + "21": 98, + "22": 132, + "23": 179, + "24": 64, + "25": 147, + "26": 133, + "27": 51, + "28": 64, + "29": 164, + "3": 147, + "30": 5, + "31": 179, + "34": 128, + "35": 103, + "4": 197, + "5": 112, + "6": 3, + "7": 19, + "9": 192, + }, + registers: { + "x10,a0": "0xfffffa40", + "x11,a1": "0x123ad5", + "x5,t0": "0x223", + "x6,t1": "0xfffffc57", + "x7,t2": "0xc", + "x8,fp,s0": "0x123515", + "x9,s1": "0x5cc", + mtime: "0x9", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_004.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_004.s.snap new file mode 100644 index 000000000..8ba0a97d5 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_004.s.snap @@ -0,0 +1,38 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_004.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 67, + "11": 183, + "12": 255, + "14": 36, + "15": 55, + "18": 36, + "19": 183, + "2": 50, + "22": 128, + "23": 103, + "3": 183, + "4": 5, + "5": 109, + "6": 179, + "7": 55, + "9": 3, + }, + registers: { + "x5,t0": "0x23000", + "x6,t1": "0x56db000", + "x7,t2": "0x34000", + "x8,fp,s0": "0xff002000", + "x9,s1": "0x2000", + mtime: "0x6", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_005.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_005.s.snap new file mode 100644 index 000000000..24bd3e43d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_005.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_005.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 34, + "1": 48, + "10": 3, + "11": 147, + "13": 18, + "14": 52, + "15": 55, + "16": 81, + "17": 84, + "18": 4, + "19": 19, + "2": 2, + "20": 1, + "23": 239, + "24": 64, + "25": 98, + "26": 132, + "27": 179, + "28": 64, + "29": 147, + "3": 147, + "30": 133, + "31": 51, + "32": 64, + "33": 164, + "34": 5, + "35": 179, + "37": 160, + "38": 8, + "39": 147, + "4": 197, + "43": 115, + "5": 112, + "6": 3, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0x18", + "x17,a7": "0xa", + "x5,t0": "0x223", + "x6,t1": "0xfffffc57", + "x7,t2": "0xc", + "x8,fp,s0": "0x123515", + mtime: "0x8", + pc: "0x2c", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_006.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_006.s.snap new file mode 100644 index 000000000..2aab05046 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_006.s.snap @@ -0,0 +1,61 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_006.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 34, + "1": 48, + "10": 3, + "11": 147, + "13": 18, + "14": 52, + "15": 55, + "16": 81, + "17": 84, + "18": 4, + "19": 19, + "2": 2, + "21": 64, + "23": 111, + "24": 2, + "25": 128, + "27": 231, + "28": 64, + "29": 98, + "3": 147, + "30": 132, + "31": 179, + "32": 64, + "33": 147, + "34": 133, + "35": 51, + "36": 64, + "37": 164, + "38": 5, + "39": 179, + "4": 197, + "41": 160, + "42": 8, + "43": 147, + "47": 115, + "5": 112, + "6": 3, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0x1c", + "x17,a7": "0xa", + "x5,t0": "0x223", + "x6,t1": "0xfffffc57", + "x7,t2": "0xc", + "x8,fp,s0": "0x123515", + mtime: "0x9", + pc: "0x30", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_007.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_007.s.snap new file mode 100644 index 000000000..cae413741 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_007.s.snap @@ -0,0 +1,106 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_007.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 132, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 98, + "26": 132, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 83, + "34": 4, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 132, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "48": 1, + "49": 195, + "5": 96, + "50": 132, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "57": 126, + "58": 4, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 114, + "66": 132, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 83, + "74": 132, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "80": 1, + "81": 195, + "82": 4, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "89": 110, + "9": 240, + "90": 4, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x18,s2": "0x1", + "x20,s4": "0x1", + "x21,s5": "0x1", + "x22,s6": "0x1", + "x23,s7": "0x1", + "x24,s8": "0x1", + "x25,s9": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + "x9,s1": "0x1", + mtime: "0x17", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_008.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_008.s.snap new file mode 100644 index 000000000..573efd478 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_008.s.snap @@ -0,0 +1,100 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_008.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 148, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 98, + "26": 148, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 83, + "34": 20, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 148, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "48": 1, + "49": 195, + "5": 96, + "50": 148, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "57": 126, + "58": 20, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 114, + "66": 148, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 83, + "74": 148, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "80": 1, + "81": 195, + "82": 20, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "89": 110, + "9": 240, + "90": 20, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x19,s3": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + "x8,fp,s0": "0x1", + mtime: "0x11", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_009.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_009.s.snap new file mode 100644 index 000000000..dab57a18e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_009.s.snap @@ -0,0 +1,104 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_009.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 196, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 98, + "26": 196, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 83, + "34": 68, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 196, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "48": 1, + "49": 195, + "5": 96, + "50": 196, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "57": 126, + "58": 68, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 114, + "66": 196, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 83, + "74": 196, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "80": 1, + "81": 195, + "82": 68, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "89": 110, + "9": 240, + "90": 68, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x18,s2": "0x1", + "x19,s3": "0x1", + "x21,s5": "0x1", + "x23,s7": "0x1", + "x25,s9": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + "x8,fp,s0": "0x1", + mtime: "0x15", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_010.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_010.s.snap new file mode 100644 index 000000000..e787a2eb9 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_010.s.snap @@ -0,0 +1,102 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_010.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 212, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 98, + "26": 212, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 83, + "34": 84, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 212, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "48": 1, + "49": 195, + "5": 96, + "50": 212, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "57": 126, + "58": 84, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 114, + "66": 212, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 83, + "74": 212, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "80": 1, + "81": 195, + "82": 84, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "89": 110, + "9": 240, + "90": 84, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x20,s4": "0x1", + "x22,s6": "0x1", + "x24,s8": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + "x9,s1": "0x1", + mtime: "0x13", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_011.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_011.s.snap new file mode 100644 index 000000000..1b80d8fd7 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_011.s.snap @@ -0,0 +1,104 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_011.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 228, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 98, + "26": 228, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 83, + "34": 100, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 228, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "48": 1, + "49": 195, + "5": 96, + "50": 228, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "57": 126, + "58": 100, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 114, + "66": 228, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 83, + "74": 228, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "80": 1, + "81": 195, + "82": 100, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "89": 110, + "9": 240, + "90": 100, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x18,s2": "0x1", + "x19,s3": "0x1", + "x21,s5": "0x1", + "x22,s6": "0x1", + "x24,s8": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + "x8,fp,s0": "0x1", + mtime: "0x15", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_012.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_012.s.snap new file mode 100644 index 000000000..1aa342334 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_012.s.snap @@ -0,0 +1,102 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_012.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 244, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 98, + "26": 244, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 83, + "34": 116, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 244, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "48": 1, + "49": 195, + "5": 96, + "50": 244, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "57": 126, + "58": 116, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 114, + "66": 244, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 83, + "74": 244, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "80": 1, + "81": 195, + "82": 116, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "89": 110, + "9": 240, + "90": 116, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x20,s4": "0x1", + "x23,s7": "0x1", + "x25,s9": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + "x9,s1": "0x1", + mtime: "0x13", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_013.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_013.s.snap new file mode 100644 index 000000000..ef5222d81 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_013.s.snap @@ -0,0 +1,110 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_013.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "11": 23, + "12": 255, + "13": 195, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "20": 255, + "2097155": 14, + "2097156": 127, + "2097157": 214, + "2097158": 127, + "2097159": 255, + "2097160": 207, + "2097161": 199, + "2097167": 14, + "2097168": 127, + "2097169": 214, + "2097170": 127, + "2097171": 255, + "2097172": 207, + "2097173": 199, + "21": 99, + "22": 131, + "23": 147, + "25": 2, + "26": 164, + "27": 3, + "29": 3, + "3": 151, + "30": 5, + "31": 3, + "33": 19, + "34": 5, + "35": 131, + "37": 3, + "38": 150, + "39": 3, + "41": 35, + "42": 150, + "43": 131, + "45": 32, + "46": 7, + "47": 23, + "48": 254, + "49": 7, + "5": 2, + "50": 7, + "51": 19, + "53": 135, + "54": 32, + "55": 35, + "57": 32, + "58": 7, + "59": 23, + "6": 130, + "60": 253, + "61": 135, + "62": 7, + "63": 19, + "65": 167, + "67": 35, + "69": 183, + "7": 147, + "71": 163, + "73": 32, + "74": 7, + "75": 23, + "76": 252, + "77": 167, + "78": 7, + "79": 19, + "81": 199, + "82": 16, + "83": 35, + "85": 215, + "86": 17, + "87": 35, + "9": 32, + "90": 128, + "91": 103, + }, + registers: { + "x10,a0": "0x7f", + "x11,a1": "0xffffffd6", + "x12,a2": "0x7fff", + "x13,a3": "0xffffcfc7", + "x14,a4": "0x200012", + "x5,t0": "0x200000", + "x6,t1": "0x200004", + "x7,t2": "0x200006", + "x8,fp,s0": "0xe", + mtime: "0x17", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_014.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_014.s.snap new file mode 100644 index 000000000..f2cb72804 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_014.s.snap @@ -0,0 +1,86 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_014.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "11": 151, + "12": 255, + "13": 163, + "14": 131, + "15": 147, + "17": 3, + "18": 69, + "19": 3, + "2": 3, + "2097152": 127, + "2097153": 214, + "2097154": 127, + "2097155": 255, + "2097156": 207, + "2097157": 199, + "2097158": 127, + "2097159": 214, + "2097160": 127, + "2097161": 255, + "2097162": 207, + "2097163": 199, + "21": 19, + "22": 69, + "23": 131, + "25": 3, + "26": 214, + "27": 3, + "29": 35, + "3": 23, + "30": 214, + "31": 131, + "33": 32, + "34": 7, + "35": 23, + "36": 254, + "37": 103, + "38": 7, + "39": 19, + "41": 167, + "43": 35, + "45": 183, + "47": 163, + "49": 32, + "5": 3, + "50": 7, + "51": 23, + "52": 253, + "53": 135, + "54": 7, + "55": 19, + "57": 199, + "58": 16, + "59": 35, + "6": 3, + "61": 215, + "62": 17, + "63": 35, + "66": 128, + "67": 103, + "7": 19, + "9": 32, + }, + registers: { + "x10,a0": "0x7f", + "x11,a1": "0xd6", + "x12,a2": "0x7fff", + "x13,a3": "0xcfc7", + "x14,a4": "0x200008", + "x6,t1": "0x200000", + "x7,t2": "0x200002", + mtime: "0x11", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_015.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_015.s.snap new file mode 100644 index 000000000..add3f7ae4 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_015.s.snap @@ -0,0 +1,62 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_015.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 47, + "10": 163, + "11": 19, + "12": 47, + "13": 2, + "14": 163, + "15": 147, + "16": 47, + "17": 18, + "18": 164, + "19": 19, + "2": 2, + "20": 47, + "21": 34, + "22": 164, + "23": 147, + "24": 191, + "25": 245, + "26": 37, + "27": 147, + "28": 192, + "29": 5, + "3": 147, + "30": 38, + "31": 19, + "32": 192, + "33": 21, + "34": 38, + "35": 147, + "36": 192, + "37": 37, + "38": 39, + "39": 19, + "4": 192, + "42": 128, + "43": 103, + "6": 5, + "7": 19, + "8": 46, + "9": 242, + }, + registers: { + "x10,a0": "0xfffffc00", + "x13,a3": "0x1", + "x14,a4": "0x1", + "x5,t0": "0x2f0", + "x8,fp,s0": "0x1", + "x9,s1": "0x1", + mtime: "0xb", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_016.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_016.s.snap new file mode 100644 index 000000000..cf00a3cfa --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_016.s.snap @@ -0,0 +1,62 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_016.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 47, + "10": 179, + "11": 19, + "12": 47, + "13": 2, + "14": 179, + "15": 147, + "16": 47, + "17": 18, + "18": 180, + "19": 19, + "2": 2, + "20": 47, + "21": 34, + "22": 180, + "23": 147, + "24": 191, + "25": 245, + "26": 53, + "27": 147, + "28": 192, + "29": 5, + "3": 147, + "30": 54, + "31": 19, + "32": 192, + "33": 21, + "34": 54, + "35": 147, + "36": 192, + "37": 37, + "38": 55, + "39": 19, + "4": 192, + "42": 128, + "43": 103, + "6": 5, + "7": 19, + "8": 46, + "9": 242, + }, + registers: { + "x10,a0": "0xfffffc00", + "x13,a3": "0x1", + "x14,a4": "0x1", + "x5,t0": "0x2f0", + "x8,fp,s0": "0x1", + "x9,s1": "0x1", + mtime: "0xb", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_017.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_017.s.snap new file mode 100644 index 000000000..65e9a59a2 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_017.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_017.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 34, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 69, + "25": 82, + "26": 196, + "27": 19, + "28": 34, + "29": 35, + "3": 183, + "30": 68, + "31": 147, + "32": 127, + "33": 243, + "34": 197, + "35": 19, + "38": 128, + "39": 103, + "4": 52, + "5": 98, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0xffffdd0d", + "x5,t0": "0x22346", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x22713", + "x9,s1": "0x13f5", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_018.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_018.s.snap new file mode 100644 index 000000000..e23ae4b36 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_018.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_018.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 34, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 69, + "25": 82, + "26": 228, + "27": 19, + "28": 34, + "29": 35, + "3": 183, + "30": 100, + "31": 147, + "32": 127, + "33": 243, + "34": 229, + "35": 19, + "38": 128, + "39": 103, + "4": 52, + "5": 98, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0xffffdfff", + "x5,t0": "0x22346", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x22757", + "x9,s1": "0x13f7", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_019.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_019.s.snap new file mode 100644 index 000000000..4fa06300f --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_019.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_019.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 34, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 69, + "25": 82, + "26": 244, + "27": 19, + "28": 34, + "29": 35, + "3": 183, + "30": 116, + "31": 147, + "32": 127, + "33": 243, + "34": 245, + "35": 19, + "38": 128, + "39": 103, + "4": 52, + "5": 98, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0x2f2", + "x5,t0": "0x22346", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x44", + "x9,s1": "0x2", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_020.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_020.s.snap new file mode 100644 index 000000000..6095567a2 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_020.s.snap @@ -0,0 +1,53 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_020.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 178, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "25": 34, + "26": 148, + "27": 19, + "29": 67, + "3": 183, + "30": 20, + "31": 147, + "33": 243, + "34": 149, + "35": 19, + "38": 128, + "39": 103, + "4": 173, + "5": 66, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0xed790000", + "x5,t0": "0xaad4", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x2ab50", + "x9,s1": "0x11d70", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_021.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_021.s.snap new file mode 100644 index 000000000..adfb55eca --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_021.s.snap @@ -0,0 +1,53 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_021.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 178, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "25": 34, + "26": 212, + "27": 19, + "29": 67, + "3": 183, + "30": 84, + "31": 147, + "33": 243, + "34": 213, + "35": 19, + "38": 128, + "39": 103, + "4": 173, + "5": 66, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0x1ffff", + "x5,t0": "0xaad4", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x2ab5", + "x9,s1": "0x11d", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_022.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_022.s.snap new file mode 100644 index 000000000..0a90d95ec --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_022.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_022.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 178, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 64, + "25": 34, + "26": 212, + "27": 19, + "28": 64, + "29": 67, + "3": 183, + "30": 84, + "31": 147, + "32": 64, + "33": 243, + "34": 213, + "35": 19, + "38": 128, + "39": 103, + "4": 173, + "5": 66, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0xffffffff", + "x5,t0": "0xaad4", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x2ab5", + "x9,s1": "0x11d", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_023.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_023.s.snap new file mode 100644 index 000000000..ccafadb81 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_023.s.snap @@ -0,0 +1,66 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_023.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 178, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 19, + "29": 16, + "3": 183, + "30": 4, + "31": 147, + "32": 85, + "33": 64, + "34": 5, + "35": 19, + "37": 130, + "38": 149, + "39": 179, + "4": 173, + "41": 147, + "42": 22, + "43": 51, + "45": 163, + "46": 150, + "47": 179, + "5": 66, + "50": 128, + "51": 103, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0x554", + "x11,a1": "0x2ab50", + "x12,a2": "0x23ae", + "x13,a3": "0xaf200000", + "x5,t0": "0xaad4", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x2", + "x9,s1": "0x1", + mtime: "0xd", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_024.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_024.s.snap new file mode 100644 index 000000000..e2bd2e2ff --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_024.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_024.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 34, + "11": 183, + "13": 2, + "14": 130, + "15": 147, + "18": 35, + "19": 55, + "2": 34, + "21": 19, + "22": 3, + "23": 19, + "26": 35, + "27": 183, + "29": 35, + "3": 55, + "30": 131, + "31": 147, + "33": 66, + "34": 164, + "35": 51, + "37": 82, + "38": 164, + "39": 179, + "4": 255, + "41": 98, + "42": 165, + "43": 51, + "45": 114, + "46": 165, + "47": 179, + "5": 242, + "50": 128, + "51": 103, + "6": 2, + "7": 19, + }, + registers: { + "x10,a0": "0x1", + "x11,a1": "0x1", + "x4,tp": "0x1fff", + "x5,t0": "0x2000", + "x6,t1": "0x2001", + "x7,t2": "0x2002", + mtime: "0xd", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_025.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_025.s.snap new file mode 100644 index 000000000..bd116296e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_025.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_025.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 34, + "11": 183, + "13": 2, + "14": 130, + "15": 147, + "18": 35, + "19": 55, + "2": 34, + "21": 19, + "22": 3, + "23": 19, + "26": 35, + "27": 183, + "29": 35, + "3": 55, + "30": 131, + "31": 147, + "33": 66, + "34": 180, + "35": 51, + "37": 82, + "38": 180, + "39": 179, + "4": 255, + "41": 98, + "42": 181, + "43": 51, + "45": 114, + "46": 181, + "47": 179, + "5": 242, + "50": 128, + "51": 103, + "6": 2, + "7": 19, + }, + registers: { + "x10,a0": "0x1", + "x11,a1": "0x1", + "x4,tp": "0x1fff", + "x5,t0": "0x2000", + "x6,t1": "0x2001", + "x7,t2": "0x2002", + mtime: "0xd", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_026.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_026.s.snap new file mode 100644 index 000000000..4a1bef7ef --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_026.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_026.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 34, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 69, + "25": 80, + "26": 4, + "27": 19, + "28": 34, + "29": 32, + "3": 183, + "30": 4, + "31": 147, + "34": 21, + "35": 55, + "36": 255, + "37": 245, + "38": 5, + "39": 19, + "4": 52, + "41": 130, + "42": 197, + "43": 179, + "45": 147, + "46": 70, + "47": 51, + "49": 163, + "5": 98, + "50": 198, + "51": 179, + "54": 128, + "55": 103, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0xfff", + "x11,a1": "0x22713", + "x12,a2": "0x13f5", + "x13,a3": "0xffffd50d", + "x5,t0": "0x22346", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x455", + "x9,s1": "0x222", + mtime: "0xe", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_027.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_027.s.snap new file mode 100644 index 000000000..ec27725ac --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_027.s.snap @@ -0,0 +1,66 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_027.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 178, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 19, + "29": 16, + "3": 183, + "30": 4, + "31": 147, + "32": 85, + "33": 64, + "34": 5, + "35": 19, + "37": 130, + "38": 213, + "39": 179, + "4": 173, + "41": 147, + "42": 86, + "43": 51, + "45": 163, + "46": 214, + "47": 179, + "5": 66, + "50": 128, + "51": 103, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0x554", + "x11,a1": "0x2ab5", + "x12,a2": "0x8eb", + "x13,a3": "0xfff", + "x5,t0": "0xaad4", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x2", + "x9,s1": "0x1", + mtime: "0xd", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_028.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_028.s.snap new file mode 100644 index 000000000..45d2129bf --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_028.s.snap @@ -0,0 +1,68 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_028.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 178, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 19, + "29": 16, + "3": 183, + "30": 4, + "31": 147, + "33": 48, + "34": 5, + "35": 19, + "36": 64, + "37": 130, + "38": 213, + "39": 179, + "4": 173, + "40": 64, + "41": 147, + "42": 86, + "43": 51, + "44": 64, + "45": 163, + "46": 214, + "47": 179, + "5": 66, + "50": 128, + "51": 103, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0x3", + "x11,a1": "0x2ab5", + "x12,a2": "0x8eb", + "x13,a3": "0xfffffb5e", + "x5,t0": "0xaad4", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x2", + "x9,s1": "0x1", + mtime: "0xd", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_029.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_029.s.snap new file mode 100644 index 000000000..d7d993491 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_029.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_029.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 34, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 69, + "25": 80, + "26": 4, + "27": 19, + "28": 34, + "29": 32, + "3": 183, + "30": 4, + "31": 147, + "34": 21, + "35": 55, + "36": 255, + "37": 245, + "38": 5, + "39": 19, + "4": 52, + "41": 130, + "42": 229, + "43": 179, + "45": 147, + "46": 102, + "47": 51, + "49": 163, + "5": 98, + "50": 230, + "51": 179, + "54": 128, + "55": 103, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0xfff", + "x11,a1": "0x22757", + "x12,a2": "0x13f7", + "x13,a3": "0xffffdfff", + "x5,t0": "0x22346", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x455", + "x9,s1": "0x222", + mtime: "0xe", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_030.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_030.s.snap new file mode 100644 index 000000000..55fad3bec --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_030.s.snap @@ -0,0 +1,71 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_030.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 34, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 69, + "25": 80, + "26": 4, + "27": 19, + "28": 34, + "29": 32, + "3": 183, + "30": 4, + "31": 147, + "34": 21, + "35": 55, + "36": 255, + "37": 245, + "38": 5, + "39": 19, + "4": 52, + "41": 130, + "42": 245, + "43": 179, + "45": 147, + "46": 118, + "47": 51, + "49": 163, + "5": 98, + "50": 246, + "51": 179, + "54": 128, + "55": 103, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0xfff", + "x11,a1": "0x44", + "x12,a2": "0x2", + "x13,a3": "0xaf2", + "x5,t0": "0x22346", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x455", + "x9,s1": "0x222", + mtime: "0xe", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_031.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_031.s.snap new file mode 100644 index 000000000..dba766795 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_031.s.snap @@ -0,0 +1,116 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_031.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 65, + "2097154": 69, + "2097155": 161, + "2097156": 202, + "2097157": 192, + "2097158": 131, + "2097159": 18, + "2097160": 64, + "2097161": 38, + "2097162": 226, + "2097163": 208, + "2097164": 229, + "2097165": 96, + "2097166": 65, + "2097167": 137, + "2097172": 7, + "2097173": 84, + "2097174": 79, + "2097175": 251, + "2097176": 64, + "2097177": 65, + "2097178": 69, + "2097179": 161, + "2097180": 202, + "2097181": 192, + "2097182": 131, + "2097183": 18, + "2097184": 64, + "2097185": 38, + "2097186": 226, + "2097187": 208, + "2097188": 229, + "2097189": 96, + "2097190": 65, + "2097191": 137, + "2097196": 7, + "2097197": 84, + "2097198": 79, + "2097199": 251, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 2, + "34": 176, + "35": 7, + "37": 3, + "38": 49, + "39": 7, + "41": 3, + "42": 181, + "43": 7, + "45": 4, + "46": 48, + "47": 39, + "49": 132, + "5": 2, + "50": 4, + "51": 19, + "53": 36, + "54": 48, + "55": 39, + "57": 132, + "58": 4, + "59": 19, + "6": 130, + "61": 164, + "62": 48, + "63": 39, + "65": 160, + "66": 8, + "67": 147, + "7": 147, + "71": 115, + "9": 32, + }, + registers: { + "f0,ft0": "0x404145a1cac08312", + "f10,fa0": "0x7544ffb", + "f2,ft2": "0x4026e2d0e5604189", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200028", + mtime: "0x12", + pc: "0x48", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_032.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_032.s.snap new file mode 100644 index 000000000..23aba0e5b --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_032.s.snap @@ -0,0 +1,53 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_032.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 178, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "25": 34, + "26": 149, + "27": 147, + "29": 19, + "3": 183, + "30": 22, + "31": 19, + "33": 243, + "34": 150, + "35": 147, + "38": 128, + "39": 103, + "4": 173, + "5": 66, + "6": 130, + "7": 147, + }, + registers: { + "x11,a1": "0x2ab50", + "x12,a2": "0x23ae", + "x13,a3": "0xed790000", + "x5,t0": "0xaad4", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_033.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_033.s.snap new file mode 100644 index 000000000..688d06ca0 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_033.s.snap @@ -0,0 +1,53 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_033.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 178, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "25": 34, + "26": 212, + "27": 19, + "29": 19, + "3": 183, + "30": 84, + "31": 147, + "33": 243, + "34": 213, + "35": 19, + "38": 128, + "39": 103, + "4": 173, + "5": 66, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0x1ffff", + "x5,t0": "0xaad4", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0x2ab5", + "x9,s1": "0x8eb", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_034.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_034.s.snap new file mode 100644 index 000000000..83baa6417 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_034.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_034.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 3, + "11": 147, + "12": 255, + "13": 224, + "14": 4, + "15": 19, + "16": 2, + "17": 98, + "18": 132, + "19": 179, + "2": 2, + "20": 2, + "21": 115, + "22": 5, + "23": 51, + "24": 2, + "25": 131, + "26": 133, + "27": 179, + "28": 2, + "29": 84, + "3": 147, + "30": 6, + "31": 51, + "34": 128, + "35": 103, + "5": 208, + "6": 3, + "7": 19, + "8": 2, + "9": 208, + }, + registers: { + "x10,a0": "0x249", + "x11,a1": "0xffffffa6", + "x12,a2": "0xffffffec", + "x5,t0": "0xa", + "x6,t1": "0xd", + "x7,t2": "0x2d", + "x8,fp,s0": "0xfffffffe", + "x9,s1": "0x82", + mtime: "0x9", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_035.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_035.s.snap new file mode 100644 index 000000000..4faf8225b --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_035.s.snap @@ -0,0 +1,54 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_035.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 3, + "11": 147, + "12": 255, + "13": 224, + "14": 4, + "15": 19, + "16": 2, + "17": 98, + "18": 148, + "19": 179, + "2": 2, + "20": 2, + "21": 115, + "22": 21, + "23": 51, + "24": 2, + "25": 131, + "26": 149, + "27": 179, + "28": 2, + "29": 84, + "3": 147, + "30": 22, + "31": 51, + "34": 128, + "35": 103, + "5": 208, + "6": 3, + "7": 19, + "8": 2, + "9": 208, + }, + registers: { + "x11,a1": "0xffffffff", + "x12,a2": "0xffffffff", + "x5,t0": "0xa", + "x6,t1": "0xd", + "x7,t2": "0x2d", + "x8,fp,s0": "0xfffffffe", + mtime: "0x9", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_036.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_036.s.snap new file mode 100644 index 000000000..ac1e3d4ce --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_036.s.snap @@ -0,0 +1,54 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_036.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 3, + "11": 147, + "12": 255, + "13": 224, + "14": 4, + "15": 19, + "16": 2, + "17": 98, + "18": 164, + "19": 179, + "2": 2, + "20": 2, + "21": 115, + "22": 37, + "23": 51, + "24": 2, + "25": 131, + "26": 165, + "27": 179, + "28": 2, + "29": 84, + "3": 147, + "30": 38, + "31": 51, + "34": 128, + "35": 103, + "5": 208, + "6": 3, + "7": 19, + "8": 2, + "9": 208, + }, + registers: { + "x11,a1": "0x2c", + "x12,a2": "0xffffffff", + "x5,t0": "0xa", + "x6,t1": "0xd", + "x7,t2": "0x2d", + "x8,fp,s0": "0xfffffffe", + mtime: "0x9", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_037.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_037.s.snap new file mode 100644 index 000000000..79e284d2e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_037.s.snap @@ -0,0 +1,54 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_037.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 160, + "10": 3, + "11": 147, + "12": 255, + "13": 224, + "14": 4, + "15": 19, + "16": 2, + "17": 98, + "18": 180, + "19": 179, + "2": 2, + "20": 2, + "21": 115, + "22": 53, + "23": 51, + "24": 2, + "25": 131, + "26": 181, + "27": 179, + "28": 2, + "29": 84, + "3": 147, + "30": 54, + "31": 51, + "34": 128, + "35": 103, + "5": 208, + "6": 3, + "7": 19, + "8": 2, + "9": 208, + }, + registers: { + "x11,a1": "0x2c", + "x12,a2": "0x9", + "x5,t0": "0xa", + "x6,t1": "0xd", + "x7,t2": "0x2d", + "x8,fp,s0": "0xfffffffe", + mtime: "0x9", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_038.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_038.s.snap new file mode 100644 index 000000000..3fcbef7b8 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_038.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_038.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 1, + "10": 227, + "11": 183, + "13": 3, + "14": 131, + "15": 147, + "16": 1, + "17": 128, + "18": 4, + "19": 19, + "2": 2, + "20": 2, + "21": 83, + "22": 196, + "23": 179, + "24": 2, + "25": 83, + "26": 69, + "27": 51, + "28": 2, + "29": 131, + "3": 147, + "30": 197, + "31": 179, + "32": 2, + "33": 116, + "34": 70, + "35": 51, + "38": 128, + "39": 103, + "4": 16, + "6": 3, + "7": 19, + "8": 255, + "9": 255, + }, + registers: { + "x10,a0": "0x10", + "x11,a1": "0xfffffeab", + "x5,t0": "0x10", + "x6,t1": "0x100", + "x7,t2": "0xffffe000", + "x8,fp,s0": "0x18", + "x9,s1": "0xfffffe00", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_039.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_039.s.snap new file mode 100644 index 000000000..5147f4ac6 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_039.s.snap @@ -0,0 +1,58 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_039.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 1, + "10": 227, + "11": 183, + "13": 3, + "14": 131, + "15": 147, + "16": 1, + "17": 128, + "18": 4, + "19": 19, + "2": 2, + "20": 2, + "21": 83, + "22": 212, + "23": 179, + "24": 2, + "25": 83, + "26": 85, + "27": 51, + "28": 2, + "29": 131, + "3": 147, + "30": 213, + "31": 179, + "32": 2, + "33": 116, + "34": 86, + "35": 51, + "38": 128, + "39": 103, + "4": 16, + "6": 3, + "7": 19, + "8": 255, + "9": 255, + }, + registers: { + "x10,a0": "0x10", + "x11,a1": "0xaaaa955", + "x5,t0": "0x10", + "x6,t1": "0x100", + "x7,t2": "0xffffe000", + "x8,fp,s0": "0x18", + "x9,s1": "0xffffe00", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_040.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_040.s.snap new file mode 100644 index 000000000..919fb9151 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_040.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_040.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 1, + "10": 227, + "11": 183, + "13": 3, + "14": 131, + "15": 147, + "16": 1, + "17": 128, + "18": 4, + "19": 19, + "2": 2, + "20": 2, + "21": 83, + "22": 228, + "23": 179, + "24": 2, + "25": 83, + "26": 101, + "27": 51, + "28": 2, + "29": 131, + "3": 147, + "30": 229, + "31": 179, + "32": 2, + "33": 116, + "34": 102, + "35": 51, + "38": 128, + "39": 103, + "4": 16, + "6": 3, + "7": 19, + "8": 255, + "9": 255, + }, + registers: { + "x11,a1": "0x8", + "x12,a2": "0x18", + "x5,t0": "0x10", + "x6,t1": "0x100", + "x7,t2": "0xffffe000", + "x8,fp,s0": "0x18", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_041.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_041.s.snap new file mode 100644 index 000000000..e740b32b2 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_041.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_041.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 1, + "10": 227, + "11": 183, + "13": 3, + "14": 131, + "15": 147, + "16": 1, + "17": 128, + "18": 4, + "19": 19, + "2": 2, + "20": 2, + "21": 83, + "22": 244, + "23": 179, + "24": 2, + "25": 83, + "26": 117, + "27": 51, + "28": 2, + "29": 131, + "3": 147, + "30": 245, + "31": 179, + "32": 2, + "33": 116, + "34": 118, + "35": 51, + "38": 128, + "39": 103, + "4": 16, + "6": 3, + "7": 19, + "8": 255, + "9": 255, + }, + registers: { + "x11,a1": "0x8", + "x12,a2": "0x18", + "x5,t0": "0x10", + "x6,t1": "0x100", + "x7,t2": "0xffffe000", + "x8,fp,s0": "0x18", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_042.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_042.s.snap new file mode 100644 index 000000000..7961a6ee0 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_042.s.snap @@ -0,0 +1,104 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_042.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 196, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 83, + "26": 68, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 98, + "34": 196, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 196, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "49": 126, + "5": 96, + "50": 68, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "56": 1, + "57": 195, + "58": 196, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 83, + "66": 196, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 114, + "74": 196, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "81": 110, + "82": 68, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "88": 1, + "89": 195, + "9": 240, + "90": 68, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x19,s3": "0x1", + "x20,s4": "0x1", + "x22,s6": "0x1", + "x24,s8": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + "x8,fp,s0": "0x1", + "x9,s1": "0x1", + mtime: "0x15", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_043.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_043.s.snap new file mode 100644 index 000000000..757333ebb --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_043.s.snap @@ -0,0 +1,104 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_043.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 228, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 83, + "26": 100, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 98, + "34": 228, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 228, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "49": 126, + "5": 96, + "50": 100, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "56": 1, + "57": 195, + "58": 228, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 83, + "66": 228, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 114, + "74": 228, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "81": 110, + "82": 100, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "88": 1, + "89": 195, + "9": 240, + "90": 100, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x19,s3": "0x1", + "x20,s4": "0x1", + "x23,s7": "0x1", + "x25,s9": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + "x8,fp,s0": "0x1", + "x9,s1": "0x1", + mtime: "0x15", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_044.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_044.s.snap new file mode 100644 index 000000000..1b6f31f38 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_044.s.snap @@ -0,0 +1,102 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_044.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 212, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 83, + "26": 84, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 98, + "34": 212, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 212, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "49": 126, + "5": 96, + "50": 84, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "56": 1, + "57": 195, + "58": 212, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 83, + "66": 212, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 114, + "74": 212, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "81": 110, + "82": 84, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "88": 1, + "89": 195, + "9": 240, + "90": 84, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x18,s2": "0x1", + "x21,s5": "0x1", + "x23,s7": "0x1", + "x25,s9": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + mtime: "0x13", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_045.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_045.s.snap new file mode 100644 index 000000000..22cd08d99 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_045.s.snap @@ -0,0 +1,102 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_045.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 128, + "10": 3, + "11": 147, + "12": 2, + "14": 14, + "15": 19, + "17": 82, + "18": 244, + "19": 99, + "2": 2, + "21": 16, + "22": 4, + "23": 19, + "25": 83, + "26": 116, + "27": 99, + "29": 16, + "3": 147, + "30": 4, + "31": 147, + "33": 98, + "34": 244, + "35": 99, + "37": 16, + "38": 9, + "39": 19, + "4": 255, + "41": 115, + "42": 244, + "43": 99, + "45": 16, + "46": 9, + "47": 147, + "49": 126, + "5": 96, + "50": 116, + "51": 99, + "53": 16, + "54": 10, + "55": 19, + "56": 1, + "57": 195, + "58": 244, + "59": 99, + "6": 3, + "61": 16, + "62": 10, + "63": 147, + "65": 83, + "66": 244, + "67": 99, + "69": 16, + "7": 19, + "70": 11, + "71": 19, + "73": 114, + "74": 244, + "75": 99, + "77": 16, + "78": 11, + "79": 147, + "81": 110, + "82": 116, + "83": 99, + "85": 16, + "86": 12, + "87": 19, + "88": 1, + "89": 195, + "9": 240, + "90": 116, + "91": 99, + "93": 16, + "94": 12, + "95": 147, + "98": 128, + "99": 103, + }, + registers: { + "x18,s2": "0x1", + "x21,s5": "0x1", + "x22,s6": "0x1", + "x24,s8": "0x1", + "x28,t3": "0x20", + "x5,t0": "0xffffffd8", + "x6,t1": "0xfffffff6", + "x7,t2": "0xf", + mtime: "0x13", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_046.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_046.s.snap new file mode 100644 index 000000000..4c33f942b --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_046.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_046.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 34, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 255, + "25": 242, + "26": 196, + "27": 19, + "28": 255, + "29": 243, + "3": 183, + "30": 68, + "31": 147, + "32": 255, + "33": 243, + "34": 197, + "35": 19, + "38": 128, + "39": 103, + "4": 52, + "5": 98, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0x250d", + "x5,t0": "0x22346", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0xfffddcb9", + "x9,s1": "0xffffee28", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_047.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_047.s.snap new file mode 100644 index 000000000..c89e60c59 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_047.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_047.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 2, + "10": 19, + "11": 55, + "12": 29, + "13": 115, + "14": 3, + "15": 19, + "16": 255, + "17": 255, + "18": 227, + "19": 183, + "2": 34, + "20": 175, + "21": 35, + "22": 131, + "23": 147, + "24": 64, + "25": 80, + "26": 4, + "27": 51, + "28": 64, + "29": 96, + "3": 183, + "30": 4, + "31": 179, + "32": 64, + "33": 112, + "34": 5, + "35": 51, + "38": 128, + "39": 103, + "4": 52, + "5": 98, + "6": 130, + "7": 147, + }, + registers: { + "x10,a0": "0x250e", + "x5,t0": "0x22346", + "x6,t1": "0x11d7", + "x7,t2": "0xffffdaf2", + "x8,fp,s0": "0xfffddcba", + "x9,s1": "0xffffee29", + mtime: "0xa", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_048.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_048.s.snap new file mode 100644 index 000000000..ea0c52a58 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_048.s.snap @@ -0,0 +1,39 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_048.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "10": 3, + "11": 19, + "13": 18, + "14": 52, + "15": 19, + "17": 18, + "18": 180, + "19": 147, + "2": 2, + "21": 19, + "22": 53, + "23": 19, + "26": 128, + "27": 103, + "3": 19, + "6": 2, + "7": 147, + "8": 255, + "9": 240, + }, + registers: { + "x4,tp": "0x1", + "x6,t1": "0xffffffff", + "x9,s1": "0x1", + mtime: "0x7", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_049.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_049.s.snap new file mode 100644 index 000000000..9df3e6760 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_049.s.snap @@ -0,0 +1,40 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_049.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "10": 3, + "11": 19, + "13": 64, + "14": 52, + "15": 51, + "17": 80, + "18": 52, + "19": 179, + "2": 2, + "21": 96, + "22": 53, + "23": 51, + "26": 128, + "27": 103, + "3": 19, + "6": 2, + "7": 147, + "8": 255, + "9": 240, + }, + registers: { + "x10,a0": "0x1", + "x4,tp": "0x1", + "x6,t1": "0xffffffff", + "x8,fp,s0": "0x1", + mtime: "0x7", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_050.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_050.s.snap new file mode 100644 index 000000000..70bc8cb53 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_050.s.snap @@ -0,0 +1,39 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_050.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "10": 3, + "11": 19, + "13": 64, + "14": 36, + "15": 51, + "17": 80, + "18": 36, + "19": 179, + "2": 2, + "21": 96, + "22": 37, + "23": 51, + "26": 128, + "27": 103, + "3": 19, + "6": 2, + "7": 147, + "8": 255, + "9": 240, + }, + registers: { + "x4,tp": "0x1", + "x6,t1": "0xffffffff", + "x8,fp,s0": "0x1", + mtime: "0x7", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_051.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_051.s.snap new file mode 100644 index 000000000..a18d804e1 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_051.s.snap @@ -0,0 +1,39 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_051.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "10": 3, + "11": 19, + "13": 2, + "14": 36, + "15": 51, + "17": 2, + "18": 164, + "19": 179, + "2": 2, + "21": 3, + "22": 37, + "23": 51, + "26": 128, + "27": 103, + "3": 19, + "6": 2, + "7": 147, + "8": 255, + "9": 240, + }, + registers: { + "x10,a0": "0x1", + "x4,tp": "0x1", + "x6,t1": "0xffffffff", + mtime: "0x7", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_052.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_052.s.snap new file mode 100644 index 000000000..473f0ded1 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_052.s.snap @@ -0,0 +1,152 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_052.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 131, + "2097154": 84, + "2097155": 250, + "2097156": 109, + "2097157": 239, + "2097158": 199, + "2097159": 164, + "2097160": 64, + "2097161": 140, + "2097162": 18, + "2097163": 192, + "2097164": 131, + "2097165": 18, + "2097166": 110, + "2097167": 152, + "2097168": 64, + "2097169": 195, + "2097170": 92, + "2097171": 198, + "2097172": 102, + "2097173": 102, + "2097174": 102, + "2097175": 102, + "2097176": 66, + "2097177": 247, + "2097178": 62, + "2097179": 155, + "2097180": 67, + "2097181": 228, + "2097182": 44, + "2097183": 8, + "2097184": 197, + "2097185": 236, + "2097186": 20, + "2097187": 102, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 2, + "62": 3, + "63": 83, + "64": 2, + "65": 33, + "66": 4, + "67": 83, + "68": 2, + "69": 66, + "7": 147, + "70": 5, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "85": 230, + "86": 9, + "87": 83, + "88": 1, + "89": 7, + "9": 32, + "90": 10, + "91": 83, + "93": 200, + "94": 11, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x408354fa6defc7a4", + "f10,fa0": "0x40d35cc666666666", + "f12,fa2": "0xffffffff42f73e9b", + "f14,fa4": "0xffffffff43e42c08", + "f16,fa6": "0xffffffffc5ec1466", + "f18,fs2": "0xffffffff4410fdd7", + "f2,ft2": "0x408c12c083126e98", + "f20,fs4": "0xffffffffc5ddd1a6", + "f22,fs6": "0xffffffffc5e8376c", + "f4,ft4": "0x40c35cc666666666", + "f6,ft6": "0x409354fa6defc7a4", + "f8,fs0": "0x409c12c083126e98", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_053.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_053.s.snap new file mode 100644 index 000000000..8273c7b7a --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_053.s.snap @@ -0,0 +1,155 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_053.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 131, + "2097154": 84, + "2097155": 250, + "2097156": 109, + "2097157": 239, + "2097158": 199, + "2097159": 164, + "2097160": 64, + "2097161": 140, + "2097162": 18, + "2097163": 192, + "2097164": 131, + "2097165": 18, + "2097166": 110, + "2097167": 152, + "2097168": 64, + "2097169": 195, + "2097170": 92, + "2097171": 198, + "2097172": 102, + "2097173": 102, + "2097174": 102, + "2097175": 102, + "2097176": 66, + "2097177": 247, + "2097178": 62, + "2097179": 155, + "2097180": 67, + "2097181": 228, + "2097182": 44, + "2097183": 8, + "2097184": 197, + "2097185": 236, + "2097186": 20, + "2097187": 102, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 10, + "61": 32, + "62": 3, + "63": 83, + "64": 10, + "65": 65, + "66": 4, + "67": 83, + "68": 10, + "69": 2, + "7": 147, + "70": 5, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 8, + "85": 230, + "86": 9, + "87": 83, + "88": 9, + "89": 7, + "9": 32, + "90": 10, + "91": 83, + "92": 8, + "93": 200, + "94": 11, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x408354fa6defc7a4", + "f10,fa0": "0x40c22776bf8769ec", + "f12,fa2": "0xffffffff42f73e9b", + "f14,fa4": "0xffffffff43e42c08", + "f16,fa6": "0xffffffffc5ec1466", + "f18,fs2": "0xffffffffc3a65c61", + "f2,ft2": "0x408c12c083126e98", + "f20,fs4": "0xffffffff45fa5726", + "f22,fs6": "0xffffffffc5eff160", + "f4,ft4": "0x40c35cc666666666", + "f6,ft6": "0xc0717b8c2a454de8", + "f8,fs0": "0xc0c19b9a5e353f7c", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_054.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_054.s.snap new file mode 100644 index 000000000..87c4d0346 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_054.s.snap @@ -0,0 +1,154 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_054.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 131, + "2097154": 84, + "2097155": 250, + "2097156": 109, + "2097157": 239, + "2097158": 199, + "2097159": 164, + "2097160": 64, + "2097161": 140, + "2097162": 18, + "2097163": 192, + "2097164": 131, + "2097165": 18, + "2097166": 110, + "2097167": 152, + "2097168": 64, + "2097169": 195, + "2097170": 92, + "2097171": 198, + "2097172": 102, + "2097173": 102, + "2097174": 102, + "2097175": 102, + "2097176": 66, + "2097177": 247, + "2097178": 62, + "2097179": 155, + "2097180": 67, + "2097181": 228, + "2097182": 44, + "2097183": 8, + "2097184": 197, + "2097185": 236, + "2097186": 20, + "2097187": 102, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 18, + "62": 3, + "63": 83, + "64": 18, + "65": 33, + "66": 4, + "67": 83, + "68": 18, + "69": 66, + "7": 147, + "70": 5, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 16, + "85": 230, + "86": 9, + "87": 83, + "88": 17, + "89": 7, + "9": 32, + "90": 10, + "91": 83, + "92": 16, + "93": 200, + "94": 11, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x408354fa6defc7a4", + "f10,fa0": "0x41976e712668f5c2", + "f12,fa2": "0xffffffff42f73e9b", + "f14,fa4": "0xffffffff43e42c08", + "f16,fa6": "0xffffffffc5ec1466", + "f18,fs2": "0xffffffff475c5e49", + "f2,ft2": "0x408c12c083126e98", + "f20,fs4": "0xffffffffca526ac6", + "f22,fs6": "0xffffffffc964016a", + "f4,ft4": "0x40c35cc666666666", + "f6,ft6": "0x41175b9619eb7e4e", + "f8,fs0": "0x4128a0dbe279dd3c", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_055.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_055.s.snap new file mode 100644 index 000000000..ab316c6e0 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_055.s.snap @@ -0,0 +1,154 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_055.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 131, + "2097154": 84, + "2097155": 250, + "2097156": 109, + "2097157": 239, + "2097158": 199, + "2097159": 164, + "2097160": 64, + "2097161": 140, + "2097162": 18, + "2097163": 192, + "2097164": 131, + "2097165": 18, + "2097166": 110, + "2097167": 152, + "2097168": 64, + "2097169": 195, + "2097170": 92, + "2097171": 198, + "2097172": 102, + "2097173": 102, + "2097174": 102, + "2097175": 102, + "2097176": 66, + "2097177": 247, + "2097178": 62, + "2097179": 155, + "2097180": 67, + "2097181": 228, + "2097182": 44, + "2097183": 8, + "2097184": 197, + "2097185": 236, + "2097186": 20, + "2097187": 102, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 26, + "62": 3, + "63": 83, + "64": 26, + "65": 33, + "66": 4, + "67": 83, + "68": 26, + "69": 66, + "7": 147, + "70": 5, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 24, + "85": 230, + "86": 9, + "87": 83, + "88": 25, + "89": 7, + "9": 32, + "90": 10, + "91": 83, + "92": 24, + "93": 200, + "94": 11, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x408354fa6defc7a4", + "f10,fa0": "0x3ff0000000000000", + "f12,fa2": "0xffffffff42f73e9b", + "f14,fa4": "0xffffffff43e42c08", + "f16,fa6": "0xffffffffc5ec1466", + "f18,fs2": "0xffffffff3e8ab307", + "f2,ft2": "0x408c12c083126e98", + "f20,fs4": "0xffffffffbd776cd1", + "f22,fs6": "0xffffffffc2747094", + "f4,ft4": "0x40c35cc666666666", + "f6,ft6": "0x3ff0000000000000", + "f8,fs0": "0x3ff0000000000000", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_056.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_056.s.snap new file mode 100644 index 000000000..6cf69cd3b --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_056.s.snap @@ -0,0 +1,155 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_056.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 131, + "2097154": 84, + "2097155": 250, + "2097156": 109, + "2097157": 239, + "2097158": 199, + "2097159": 164, + "2097160": 64, + "2097161": 140, + "2097162": 18, + "2097163": 192, + "2097164": 131, + "2097165": 18, + "2097166": 110, + "2097167": 152, + "2097168": 64, + "2097169": 195, + "2097170": 92, + "2097171": 198, + "2097172": 102, + "2097173": 102, + "2097174": 102, + "2097175": 102, + "2097176": 66, + "2097177": 247, + "2097178": 62, + "2097179": 155, + "2097180": 67, + "2097181": 228, + "2097182": 44, + "2097183": 8, + "2097184": 197, + "2097185": 236, + "2097186": 20, + "2097187": 102, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 42, + "61": 32, + "62": 3, + "63": 83, + "64": 42, + "65": 65, + "66": 4, + "67": 83, + "68": 42, + "69": 2, + "7": 147, + "70": 5, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 40, + "85": 230, + "86": 9, + "87": 83, + "88": 41, + "89": 7, + "9": 32, + "90": 10, + "91": 83, + "92": 40, + "93": 200, + "94": 11, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x408354fa6defc7a4", + "f10,fa0": "0x408354fa6defc7a4", + "f12,fa2": "0xffffffff42f73e9b", + "f14,fa4": "0xffffffff43e42c08", + "f16,fa6": "0xffffffffc5ec1466", + "f18,fs2": "0xffffffff42f73e9b", + "f2,ft2": "0x408c12c083126e98", + "f20,fs4": "0xffffffffc5ec1466", + "f22,fs6": "0xffffffffc5ec1466", + "f4,ft4": "0x40c35cc666666666", + "f6,ft6": "0x408354fa6defc7a4", + "f8,fs0": "0x408c12c083126e98", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_057.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_057.s.snap new file mode 100644 index 000000000..0c98667bd --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_057.s.snap @@ -0,0 +1,155 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_057.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 131, + "2097154": 84, + "2097155": 250, + "2097156": 109, + "2097157": 239, + "2097158": 199, + "2097159": 164, + "2097160": 64, + "2097161": 140, + "2097162": 18, + "2097163": 192, + "2097164": 131, + "2097165": 18, + "2097166": 110, + "2097167": 152, + "2097168": 64, + "2097169": 195, + "2097170": 92, + "2097171": 198, + "2097172": 102, + "2097173": 102, + "2097174": 102, + "2097175": 102, + "2097176": 66, + "2097177": 247, + "2097178": 62, + "2097179": 155, + "2097180": 67, + "2097181": 228, + "2097182": 44, + "2097183": 8, + "2097184": 197, + "2097185": 236, + "2097186": 20, + "2097187": 102, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 42, + "61": 32, + "62": 19, + "63": 83, + "64": 42, + "65": 65, + "66": 20, + "67": 83, + "68": 42, + "69": 2, + "7": 147, + "70": 21, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 40, + "85": 230, + "86": 25, + "87": 83, + "88": 41, + "89": 7, + "9": 32, + "90": 26, + "91": 83, + "92": 40, + "93": 200, + "94": 27, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x408354fa6defc7a4", + "f10,fa0": "0x40c35cc666666666", + "f12,fa2": "0xffffffff42f73e9b", + "f14,fa4": "0xffffffff43e42c08", + "f16,fa6": "0xffffffffc5ec1466", + "f18,fs2": "0xffffffff43e42c08", + "f2,ft2": "0x408c12c083126e98", + "f20,fs4": "0xffffffff43e42c08", + "f22,fs6": "0xffffffff42f73e9b", + "f4,ft4": "0x40c35cc666666666", + "f6,ft6": "0x408c12c083126e98", + "f8,fs0": "0x40c35cc666666666", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_058.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_058.s.snap new file mode 100644 index 000000000..cb99e278d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_058.s.snap @@ -0,0 +1,131 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_058.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 112, + "2097160": 64, + "2097161": 171, + "2097162": 50, + "2097168": 64, + "2097169": 181, + "2097170": 100, + "2097176": 70, + "2097177": 25, + "2097178": 36, + "2097180": 70, + "2097181": 1, + "2097182": 100, + "2097184": 70, + "2097185": 16, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 90, + "62": 3, + "63": 83, + "64": 90, + "65": 1, + "66": 4, + "67": 83, + "68": 90, + "69": 2, + "7": 147, + "70": 5, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 88, + "85": 6, + "86": 3, + "87": 83, + "88": 88, + "89": 7, + "9": 32, + "90": 4, + "91": 83, + "92": 88, + "93": 8, + "94": 5, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x4070000000000000", + "f10,fa0": "0xffffffff42c00000", + "f12,fa2": "0xffffffff46192400", + "f14,fa4": "0xffffffff46016400", + "f16,fa6": "0xffffffff46100000", + "f2,ft2": "0x40ab320000000000", + "f4,ft4": "0x40b5640000000000", + "f6,ft6": "0xffffffff42c60000", + "f8,fs0": "0xffffffff42b60000", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_059.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_059.s.snap new file mode 100644 index 000000000..96406e977 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_059.s.snap @@ -0,0 +1,131 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_059.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 112, + "2097160": 64, + "2097161": 171, + "2097162": 50, + "2097168": 64, + "2097169": 181, + "2097170": 100, + "2097176": 70, + "2097177": 25, + "2097178": 36, + "2097180": 70, + "2097181": 1, + "2097182": 100, + "2097184": 70, + "2097185": 16, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 2, + "62": 3, + "63": 67, + "64": 18, + "65": 33, + "66": 4, + "67": 67, + "68": 34, + "69": 66, + "7": 147, + "70": 5, + "71": 67, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 96, + "85": 198, + "86": 3, + "87": 67, + "88": 112, + "89": 231, + "9": 32, + "90": 4, + "91": 67, + "92": 129, + "93": 8, + "94": 5, + "95": 67, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x4070000000000000", + "f10,fa0": "0xffffffff4ca20480", + "f12,fa2": "0xffffffff46192400", + "f14,fa4": "0xffffffff46016400", + "f16,fa6": "0xffffffff46100000", + "f2,ft2": "0x40ab320000000000", + "f4,ft4": "0x40b5640000000000", + "f6,ft6": "0xffffffff4cb73ce3", + "f8,fs0": "0xffffffff4c82cfe9", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_060.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_060.s.snap new file mode 100644 index 000000000..ac1b19a83 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_060.s.snap @@ -0,0 +1,131 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_060.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 112, + "2097160": 64, + "2097161": 171, + "2097162": 50, + "2097168": 64, + "2097169": 181, + "2097170": 100, + "2097176": 70, + "2097177": 25, + "2097178": 36, + "2097180": 70, + "2097181": 1, + "2097182": 100, + "2097184": 70, + "2097185": 16, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 2, + "62": 3, + "63": 71, + "64": 18, + "65": 33, + "66": 4, + "67": 71, + "68": 34, + "69": 66, + "7": 147, + "70": 5, + "71": 71, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 96, + "85": 198, + "86": 3, + "87": 71, + "88": 112, + "89": 231, + "9": 32, + "90": 4, + "91": 71, + "92": 129, + "93": 8, + "94": 5, + "95": 71, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x4070000000000000", + "f10,fa0": "0xffffffff4ca1fb80", + "f12,fa2": "0xffffffff46192400", + "f14,fa4": "0xffffffff46016400", + "f16,fa6": "0xffffffff46100000", + "f2,ft2": "0x40ab320000000000", + "f4,ft4": "0x40b5640000000000", + "f6,ft6": "0xffffffff4cb73351", + "f8,fs0": "0xffffffff4c82c7d3", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_061.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_061.s.snap new file mode 100644 index 000000000..82fff505f --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_061.s.snap @@ -0,0 +1,134 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_061.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 112, + "2097160": 192, + "2097161": 171, + "2097162": 50, + "2097168": 64, + "2097169": 181, + "2097170": 100, + "2097176": 198, + "2097177": 25, + "2097178": 36, + "2097180": 70, + "2097181": 1, + "2097182": 100, + "2097184": 198, + "2097185": 16, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 34, + "62": 35, + "63": 83, + "64": 34, + "65": 33, + "66": 36, + "67": 83, + "68": 34, + "69": 66, + "7": 147, + "70": 37, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 32, + "85": 198, + "86": 41, + "87": 83, + "88": 32, + "89": 231, + "9": 32, + "90": 42, + "91": 83, + "92": 33, + "93": 8, + "94": 43, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x4070000000000000", + "f10,fa0": "0x40b5640000000000", + "f12,fa2": "0xffffffffc6192400", + "f14,fa4": "0xffffffff46016400", + "f16,fa6": "0xffffffffc6100000", + "f18,fs2": "0xffffffff46192400", + "f2,ft2": "0xc0ab320000000000", + "f20,fs4": "0xffffffff46016400", + "f22,fs6": "0xffffffff46100000", + "f4,ft4": "0x40b5640000000000", + "f6,ft6": "0x4070000000000000", + "f8,fs0": "0x40ab320000000000", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_062.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_062.s.snap new file mode 100644 index 000000000..6b01239b0 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_062.s.snap @@ -0,0 +1,134 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_062.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "103": 115, + "11": 23, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 112, + "2097160": 192, + "2097161": 171, + "2097162": 50, + "2097168": 64, + "2097169": 181, + "2097170": 100, + "2097176": 198, + "2097177": 25, + "2097178": 36, + "2097180": 70, + "2097181": 1, + "2097182": 100, + "2097184": 198, + "2097185": 16, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 34, + "62": 19, + "63": 83, + "64": 34, + "65": 33, + "66": 20, + "67": 83, + "68": 34, + "69": 66, + "7": 147, + "70": 21, + "71": 83, + "73": 4, + "74": 38, + "75": 7, + "77": 4, + "78": 167, + "79": 7, + "81": 5, + "82": 40, + "83": 7, + "84": 32, + "85": 198, + "86": 25, + "87": 83, + "88": 32, + "89": 231, + "9": 32, + "90": 26, + "91": 83, + "92": 33, + "93": 8, + "94": 27, + "95": 83, + "97": 160, + "98": 8, + "99": 147, + }, + registers: { + "f0,ft0": "0x4070000000000000", + "f10,fa0": "0xc0b5640000000000", + "f12,fa2": "0xffffffffc6192400", + "f14,fa4": "0xffffffff46016400", + "f16,fa6": "0xffffffffc6100000", + "f18,fs2": "0xffffffff46192400", + "f2,ft2": "0xc0ab320000000000", + "f20,fs4": "0xffffffffc6016400", + "f22,fs6": "0xffffffff46100000", + "f4,ft4": "0x40b5640000000000", + "f6,ft6": "0xc070000000000000", + "f8,fs0": "0x40ab320000000000", + "x10,a0": "0x200020", + "x17,a7": "0xa", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x1a", + pc: "0x68", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_063.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_063.s.snap new file mode 100644 index 000000000..269980e0d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_063.s.snap @@ -0,0 +1,154 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_063.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "100": 160, + "101": 231, + "102": 41, + "103": 83, + "104": 160, + "105": 230, + "106": 41, + "107": 211, + "108": 160, + "109": 199, + "11": 23, + "110": 42, + "111": 83, + "112": 161, + "113": 6, + "114": 42, + "115": 211, + "116": 161, + "117": 8, + "118": 43, + "119": 83, + "121": 160, + "122": 8, + "123": 147, + "127": 115, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 112, + "2097160": 64, + "2097161": 171, + "2097162": 50, + "2097168": 127, + "2097169": 248, + "2097176": 70, + "2097177": 25, + "2097178": 36, + "2097180": 70, + "2097181": 36, + "2097182": 26, + "2097184": 127, + "2097185": 248, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 162, + "62": 37, + "63": 211, + "64": 162, + "65": 33, + "66": 38, + "67": 83, + "68": 162, + "69": 32, + "7": 147, + "70": 38, + "71": 211, + "72": 162, + "73": 1, + "74": 39, + "75": 83, + "76": 162, + "77": 64, + "78": 39, + "79": 211, + "80": 162, + "81": 66, + "82": 40, + "83": 83, + "85": 4, + "86": 38, + "87": 7, + "89": 4, + "9": 32, + "90": 167, + "91": 7, + "93": 5, + "94": 40, + "95": 7, + "96": 160, + "97": 198, + "98": 40, + "99": 211, + }, + registers: { + "f0,ft0": "0x4070000000000000", + "f12,fa2": "0xffffffff46192400", + "f14,fa4": "0xffffffff46241a00", + "f16,fa6": "0xffffffff7ff80000", + "f2,ft2": "0x40ab320000000000", + "f4,ft4": "0x7ff8000000000000", + "x10,a0": "0x200020", + "x11,a1": "0x1", + "x12,a2": "0x1", + "x17,a7": "0xa", + "x18,s2": "0x1", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x20", + pc: "0x80", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_064.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_064.s.snap new file mode 100644 index 000000000..f8458d62e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_064.s.snap @@ -0,0 +1,156 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_064.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "100": 160, + "101": 231, + "102": 9, + "103": 83, + "104": 160, + "105": 230, + "106": 9, + "107": 211, + "108": 160, + "109": 199, + "11": 23, + "110": 10, + "111": 83, + "112": 161, + "113": 6, + "114": 10, + "115": 211, + "116": 161, + "117": 8, + "118": 11, + "119": 83, + "121": 160, + "122": 8, + "123": 147, + "127": 115, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 112, + "2097160": 64, + "2097161": 171, + "2097162": 50, + "2097168": 127, + "2097169": 248, + "2097176": 70, + "2097177": 25, + "2097178": 36, + "2097180": 70, + "2097181": 36, + "2097182": 26, + "2097184": 127, + "2097185": 248, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 162, + "62": 5, + "63": 211, + "64": 162, + "65": 33, + "66": 6, + "67": 83, + "68": 162, + "69": 32, + "7": 147, + "70": 6, + "71": 211, + "72": 162, + "73": 1, + "74": 7, + "75": 83, + "76": 162, + "77": 64, + "78": 7, + "79": 211, + "80": 162, + "81": 66, + "82": 8, + "83": 83, + "85": 4, + "86": 38, + "87": 7, + "89": 4, + "9": 32, + "90": 167, + "91": 7, + "93": 5, + "94": 40, + "95": 7, + "96": 160, + "97": 198, + "98": 8, + "99": 211, + }, + registers: { + "f0,ft0": "0x4070000000000000", + "f12,fa2": "0xffffffff46192400", + "f14,fa4": "0xffffffff46241a00", + "f16,fa6": "0xffffffff7ff80000", + "f2,ft2": "0x40ab320000000000", + "f4,ft4": "0x7ff8000000000000", + "x10,a0": "0x200020", + "x11,a1": "0x1", + "x12,a2": "0x1", + "x13,a3": "0x1", + "x17,a7": "0xa", + "x18,s2": "0x1", + "x19,s3": "0x1", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x20", + pc: "0x80", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_065.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_065.s.snap new file mode 100644 index 000000000..35580d2e7 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_065.s.snap @@ -0,0 +1,153 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_065.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "100": 160, + "101": 231, + "102": 25, + "103": 83, + "104": 160, + "105": 230, + "106": 25, + "107": 211, + "108": 160, + "109": 199, + "11": 23, + "110": 26, + "111": 83, + "112": 161, + "113": 6, + "114": 26, + "115": 211, + "116": 161, + "117": 8, + "118": 27, + "119": 83, + "121": 160, + "122": 8, + "123": 147, + "127": 115, + "13": 3, + "14": 3, + "15": 19, + "17": 32, + "18": 3, + "19": 151, + "2": 2, + "2097152": 64, + "2097153": 112, + "2097160": 64, + "2097161": 171, + "2097162": 50, + "2097168": 127, + "2097169": 248, + "2097176": 70, + "2097177": 25, + "2097178": 36, + "2097180": 70, + "2097181": 36, + "2097182": 26, + "2097184": 127, + "2097185": 248, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 4, + "27": 23, + "29": 4, + "3": 151, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 151, + "36": 255, + "37": 196, + "38": 132, + "39": 147, + "41": 32, + "42": 5, + "43": 23, + "44": 255, + "45": 133, + "46": 5, + "47": 19, + "49": 2, + "5": 2, + "50": 176, + "51": 7, + "53": 3, + "54": 49, + "55": 7, + "57": 3, + "58": 178, + "59": 7, + "6": 130, + "60": 162, + "62": 21, + "63": 211, + "64": 162, + "65": 33, + "66": 22, + "67": 83, + "68": 162, + "69": 32, + "7": 147, + "70": 22, + "71": 211, + "72": 162, + "73": 1, + "74": 23, + "75": 83, + "76": 162, + "77": 64, + "78": 23, + "79": 211, + "80": 162, + "81": 66, + "82": 24, + "83": 83, + "85": 4, + "86": 38, + "87": 7, + "89": 4, + "9": 32, + "90": 167, + "91": 7, + "93": 5, + "94": 40, + "95": 7, + "96": 160, + "97": 198, + "98": 24, + "99": 211, + }, + registers: { + "f0,ft0": "0x4070000000000000", + "f12,fa2": "0xffffffff46192400", + "f14,fa4": "0xffffffff46241a00", + "f16,fa6": "0xffffffff7ff80000", + "f2,ft2": "0x40ab320000000000", + "f4,ft4": "0x7ff8000000000000", + "x10,a0": "0x200020", + "x13,a3": "0x1", + "x17,a7": "0xa", + "x19,s3": "0x1", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200010", + "x8,fp,s0": "0x200018", + "x9,s1": "0x20001c", + mtime: "0x20", + pc: "0x80", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_066.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_066.s.snap new file mode 100644 index 000000000..79925257c --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_066.s.snap @@ -0,0 +1,46 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_066.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 96, + "10": 4, + "11": 99, + "13": 16, + "14": 2, + "15": 147, + "17": 4, + "18": 132, + "19": 99, + "2": 4, + "21": 16, + "22": 3, + "23": 19, + "26": 4, + "27": 99, + "29": 16, + "3": 19, + "30": 3, + "31": 147, + "34": 128, + "35": 103, + "5": 240, + "6": 4, + "7": 147, + "9": 4, + }, + registers: { + "x5,t0": "0x1", + "x6,t1": "0x1", + "x8,fp,s0": "0xfffffff6", + "x9,s1": "0xf", + mtime: "0x8", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_067.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_067.s.snap new file mode 100644 index 000000000..4f66d5b21 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_067.s.snap @@ -0,0 +1,45 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_067.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 96, + "10": 84, + "11": 99, + "13": 16, + "14": 2, + "15": 147, + "17": 4, + "18": 212, + "19": 99, + "2": 4, + "21": 16, + "22": 3, + "23": 19, + "26": 84, + "27": 99, + "29": 16, + "3": 19, + "30": 3, + "31": 147, + "34": 128, + "35": 103, + "5": 240, + "6": 4, + "7": 147, + "9": 4, + }, + registers: { + "x5,t0": "0x1", + "x8,fp,s0": "0xfffffff6", + "x9,s1": "0xf", + mtime: "0x7", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_068.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_068.s.snap new file mode 100644 index 000000000..eb123788e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_068.s.snap @@ -0,0 +1,46 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_068.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 96, + "10": 68, + "11": 99, + "13": 16, + "14": 2, + "15": 147, + "17": 144, + "18": 68, + "19": 99, + "2": 4, + "21": 16, + "22": 3, + "23": 19, + "26": 68, + "27": 99, + "29": 16, + "3": 19, + "30": 3, + "31": 147, + "34": 128, + "35": 103, + "5": 240, + "6": 4, + "7": 147, + "9": 128, + }, + registers: { + "x5,t0": "0x1", + "x7,t2": "0x1", + "x8,fp,s0": "0xfffffff6", + "x9,s1": "0xf", + mtime: "0x8", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_069.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_069.s.snap new file mode 100644 index 000000000..8d818f7d5 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_069.s.snap @@ -0,0 +1,45 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_069.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 96, + "10": 84, + "11": 99, + "13": 16, + "14": 2, + "15": 147, + "17": 144, + "18": 84, + "19": 99, + "2": 4, + "21": 16, + "22": 3, + "23": 19, + "26": 84, + "27": 99, + "29": 16, + "3": 19, + "30": 3, + "31": 147, + "34": 128, + "35": 103, + "5": 240, + "6": 4, + "7": 147, + "9": 128, + }, + registers: { + "x6,t1": "0x1", + "x8,fp,s0": "0xfffffff6", + "x9,s1": "0xf", + mtime: "0x7", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_070.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_070.s.snap new file mode 100644 index 000000000..4c9749394 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_070.s.snap @@ -0,0 +1,46 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_070.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 96, + "10": 68, + "11": 99, + "13": 16, + "14": 2, + "15": 147, + "17": 4, + "18": 196, + "19": 99, + "2": 4, + "21": 16, + "22": 3, + "23": 19, + "26": 68, + "27": 99, + "29": 16, + "3": 19, + "30": 3, + "31": 147, + "34": 128, + "35": 103, + "5": 240, + "6": 4, + "7": 147, + "9": 4, + }, + registers: { + "x6,t1": "0x1", + "x7,t2": "0x1", + "x8,fp,s0": "0xfffffff6", + "x9,s1": "0xf", + mtime: "0x8", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_071.s.snap b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_071.s.snap new file mode 100644 index 000000000..d6b3e9bc8 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/instructions/test_riscv_instruction_071.s.snap @@ -0,0 +1,45 @@ +export const snapshot = {}; + +snapshot[`riscv/instructions/test_riscv_instruction_071.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 96, + "10": 20, + "11": 99, + "13": 16, + "14": 2, + "15": 147, + "17": 4, + "18": 148, + "19": 99, + "2": 4, + "21": 16, + "22": 3, + "23": 19, + "26": 20, + "27": 99, + "29": 16, + "3": 19, + "30": 3, + "31": 147, + "34": 128, + "35": 103, + "5": 240, + "6": 4, + "7": 147, + "9": 4, + }, + registers: { + "x7,t2": "0x1", + "x8,fp,s0": "0xfffffff6", + "x9,s1": "0xf", + mtime: "0x7", + pc: "0xfffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_001.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_001.s.snap new file mode 100644 index 000000000..a51178411 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_001.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_001.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 5, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 5, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x10,a0": "0x2", + "x17,a7": "0xa", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_002.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_002.s.snap new file mode 100644 index 000000000..de8915b87 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_002.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_002.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 5, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 5, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x11,a1": "0x2", + "x17,a7": "0xa", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_003.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_003.s.snap new file mode 100644 index 000000000..a5abb1645 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_003.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_003.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 6, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 6, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x12,a2": "0x2", + "x17,a7": "0xa", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_004.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_004.s.snap new file mode 100644 index 000000000..61979074d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_004.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_004.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 6, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 6, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x13,a3": "0x2", + "x17,a7": "0xa", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_005.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_005.s.snap new file mode 100644 index 000000000..1e2e93131 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_005.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_005.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 7, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 7, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x14,a4": "0x2", + "x17,a7": "0xa", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_006.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_006.s.snap new file mode 100644 index 000000000..ce30724f6 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_006.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_006.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 7, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 7, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x15,a5": "0x2", + "x17,a7": "0xa", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_007.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_007.s.snap new file mode 100644 index 000000000..83c508aae --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_007.s.snap @@ -0,0 +1,56 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_007.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 8, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 8, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x16,a6": "0x2", + "x17,a7": "0xa", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_008.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_008.s.snap new file mode 100644 index 000000000..223e7e346 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_008.s.snap @@ -0,0 +1,55 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_008.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 8, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 8, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_009.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_009.s.snap new file mode 100644 index 000000000..502cbdb59 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_009.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_009.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "11": 239, + "13": 160, + "14": 8, + "15": 147, + "19": 115, + "2": 2, + "20": 255, + "21": 65, + "22": 1, + "23": 19, + "25": 17, + "26": 36, + "268435451": 12, + "27": 35, + "29": 129, + "3": 147, + "30": 34, + "31": 35, + "33": 65, + "34": 4, + "35": 19, + "37": 32, + "38": 2, + "39": 147, + "41": 129, + "42": 32, + "43": 131, + "45": 65, + "46": 36, + "47": 3, + "49": 193, + "5": 80, + "50": 1, + "51": 19, + "54": 128, + "55": 103, + "6": 5, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0xc", + "x10,a0": "0x5", + "x17,a7": "0xa", + "x5,t0": "0x2", + mtime: "0xe", + pc: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_010.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_010.s.snap new file mode 100644 index 000000000..2806b4ce4 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_010.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_010.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "11": 239, + "13": 160, + "14": 8, + "15": 147, + "19": 115, + "2": 3, + "20": 255, + "21": 65, + "22": 1, + "23": 19, + "25": 17, + "26": 36, + "268435451": 12, + "27": 35, + "29": 129, + "3": 19, + "30": 34, + "31": 35, + "33": 65, + "34": 4, + "35": 19, + "37": 32, + "38": 3, + "39": 19, + "41": 129, + "42": 32, + "43": 131, + "45": 65, + "46": 36, + "47": 3, + "49": 193, + "5": 80, + "50": 1, + "51": 19, + "54": 128, + "55": 103, + "6": 5, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0xc", + "x10,a0": "0x5", + "x17,a7": "0xa", + "x6,t1": "0x2", + mtime: "0xe", + pc: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_011.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_011.s.snap new file mode 100644 index 000000000..3ac9b2736 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_011.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_011.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "11": 239, + "13": 160, + "14": 8, + "15": 147, + "19": 115, + "2": 3, + "20": 255, + "21": 65, + "22": 1, + "23": 19, + "25": 17, + "26": 36, + "268435451": 12, + "27": 35, + "29": 129, + "3": 147, + "30": 34, + "31": 35, + "33": 65, + "34": 4, + "35": 19, + "37": 32, + "38": 3, + "39": 147, + "41": 129, + "42": 32, + "43": 131, + "45": 65, + "46": 36, + "47": 3, + "49": 193, + "5": 80, + "50": 1, + "51": 19, + "54": 128, + "55": 103, + "6": 5, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0xc", + "x10,a0": "0x5", + "x17,a7": "0xa", + "x7,t2": "0x2", + mtime: "0xe", + pc: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_012.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_012.s.snap new file mode 100644 index 000000000..88cbfc8bc --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_012.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_012.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "11": 239, + "13": 160, + "14": 8, + "15": 147, + "19": 115, + "2": 14, + "20": 255, + "21": 65, + "22": 1, + "23": 19, + "25": 17, + "26": 36, + "268435451": 12, + "27": 35, + "29": 129, + "3": 19, + "30": 34, + "31": 35, + "33": 65, + "34": 4, + "35": 19, + "37": 32, + "38": 14, + "39": 19, + "41": 129, + "42": 32, + "43": 131, + "45": 65, + "46": 36, + "47": 3, + "49": 193, + "5": 80, + "50": 1, + "51": 19, + "54": 128, + "55": 103, + "6": 5, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0xc", + "x10,a0": "0x5", + "x17,a7": "0xa", + "x28,t3": "0x2", + mtime: "0xe", + pc: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_013.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_013.s.snap new file mode 100644 index 000000000..25c25a0b6 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_013.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_013.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "11": 239, + "13": 160, + "14": 8, + "15": 147, + "19": 115, + "2": 14, + "20": 255, + "21": 65, + "22": 1, + "23": 19, + "25": 17, + "26": 36, + "268435451": 12, + "27": 35, + "29": 129, + "3": 147, + "30": 34, + "31": 35, + "33": 65, + "34": 4, + "35": 19, + "37": 32, + "38": 14, + "39": 147, + "41": 129, + "42": 32, + "43": 131, + "45": 65, + "46": 36, + "47": 3, + "49": 193, + "5": 80, + "50": 1, + "51": 19, + "54": 128, + "55": 103, + "6": 5, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0xc", + "x10,a0": "0x5", + "x17,a7": "0xa", + "x29,t4": "0x2", + mtime: "0xe", + pc: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_014.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_014.s.snap new file mode 100644 index 000000000..11c71c924 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_014.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_014.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "11": 239, + "13": 160, + "14": 8, + "15": 147, + "19": 115, + "2": 15, + "20": 255, + "21": 65, + "22": 1, + "23": 19, + "25": 17, + "26": 36, + "268435451": 12, + "27": 35, + "29": 129, + "3": 19, + "30": 34, + "31": 35, + "33": 65, + "34": 4, + "35": 19, + "37": 32, + "38": 15, + "39": 19, + "41": 129, + "42": 32, + "43": 131, + "45": 65, + "46": 36, + "47": 3, + "49": 193, + "5": 80, + "50": 1, + "51": 19, + "54": 128, + "55": 103, + "6": 5, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0xc", + "x10,a0": "0x5", + "x17,a7": "0xa", + "x30,t5": "0x2", + mtime: "0xe", + pc: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_015.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_015.s.snap new file mode 100644 index 000000000..14c8b1c0d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_015.s.snap @@ -0,0 +1,60 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_015.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "11": 239, + "13": 160, + "14": 8, + "15": 147, + "19": 115, + "2": 15, + "20": 255, + "21": 65, + "22": 1, + "23": 19, + "25": 17, + "26": 36, + "268435451": 12, + "27": 35, + "29": 129, + "3": 147, + "30": 34, + "31": 35, + "33": 65, + "34": 4, + "35": 19, + "37": 32, + "38": 15, + "39": 147, + "41": 129, + "42": 32, + "43": 131, + "45": 65, + "46": 36, + "47": 3, + "49": 193, + "5": 80, + "50": 1, + "51": 19, + "54": 128, + "55": 103, + "6": 5, + "7": 19, + "9": 192, + }, + registers: { + "x1,ra": "0xc", + "x10,a0": "0x5", + "x17,a7": "0xa", + "x31,t6": "0x2", + mtime: "0xe", + pc: "0x14", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_016.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_016.s.snap new file mode 100644 index 000000000..7446e0332 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_016.s.snap @@ -0,0 +1,57 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_016.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 4, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435447": 5, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x8,fp,s0": "0x5", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_017.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_017.s.snap new file mode 100644 index 000000000..edf8df1e4 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_017.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_017.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 4, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 4, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x9,s1": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x9,s1 was used but never saved to memory", + register: "x9,s1", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x9,s1 value changed but not properly restored", + register: "x9,s1", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_018.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_018.s.snap new file mode 100644 index 000000000..4ff6c3a7b --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_018.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_018.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 9, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 9, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x18,s2": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x18,s2 was used but never saved to memory", + register: "x18,s2", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x18,s2 value changed but not properly restored", + register: "x18,s2", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_019.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_019.s.snap new file mode 100644 index 000000000..9aba61272 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_019.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_019.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 9, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 9, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x19,s3": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x19,s3 was used but never saved to memory", + register: "x19,s3", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x19,s3 value changed but not properly restored", + register: "x19,s3", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_020.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_020.s.snap new file mode 100644 index 000000000..b93aca60d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_020.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_020.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 10, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 10, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x20,s4": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x20,s4 was used but never saved to memory", + register: "x20,s4", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x20,s4 value changed but not properly restored", + register: "x20,s4", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_021.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_021.s.snap new file mode 100644 index 000000000..4d74b4e7a --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_021.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_021.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 10, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 10, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x21,s5": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x21,s5 was used but never saved to memory", + register: "x21,s5", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x21,s5 value changed but not properly restored", + register: "x21,s5", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_022.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_022.s.snap new file mode 100644 index 000000000..1fa7c4a71 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_022.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_022.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 11, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 11, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x22,s6": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x22,s6 was used but never saved to memory", + register: "x22,s6", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x22,s6 value changed but not properly restored", + register: "x22,s6", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_023.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_023.s.snap new file mode 100644 index 000000000..3a32ce3c1 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_023.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_023.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 11, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 11, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x23,s7": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x23,s7 was used but never saved to memory", + register: "x23,s7", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x23,s7 value changed but not properly restored", + register: "x23,s7", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_024.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_024.s.snap new file mode 100644 index 000000000..ab9c89b39 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_024.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_024.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 12, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 12, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x24,s8": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x24,s8 was used but never saved to memory", + register: "x24,s8", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x24,s8 value changed but not properly restored", + register: "x24,s8", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_025.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_025.s.snap new file mode 100644 index 000000000..d920e4b6e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_025.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_025.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 12, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 12, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x25,s9": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x25,s9 was used but never saved to memory", + register: "x25,s9", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x25,s9 value changed but not properly restored", + register: "x25,s9", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_026.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_026.s.snap new file mode 100644 index 000000000..555a9316c --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_026.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_026.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 13, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 19, + "30": 4, + "31": 19, + "33": 32, + "34": 13, + "35": 19, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x26,s10": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x26,s10 was used but never saved to memory", + register: "x26,s10", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x26,s10 value changed but not properly restored", + register: "x26,s10", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_027.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_027.s.snap new file mode 100644 index 000000000..bf95b1867 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_027.s.snap @@ -0,0 +1,72 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_027.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 65, + "18": 1, + "19": 19, + "2": 13, + "21": 17, + "22": 36, + "23": 35, + "25": 129, + "26": 34, + "268435451": 8, + "27": 35, + "29": 65, + "3": 147, + "30": 4, + "31": 19, + "33": 32, + "34": 13, + "35": 147, + "37": 129, + "38": 32, + "39": 131, + "41": 65, + "42": 36, + "43": 3, + "45": 193, + "46": 1, + "47": 19, + "5": 192, + "50": 128, + "51": 103, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x27,s11": "0x2", + mtime: "0xd", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x27,s11 was used but never saved to memory", + register: "x27,s11", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x27,s11 value changed but not properly restored", + register: "x27,s11", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_028.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_028.s.snap new file mode 100644 index 000000000..c1f6c2cee --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_028.s.snap @@ -0,0 +1,33 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_028.s 1`] = ` +{ + display: "", + error: "Error decoding instruction: Illegal Instruction: 0x00000000", + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "18": 16, + "19": 183, + "20": 8, + "21": 160, + "22": 128, + "23": 147, + "26": 128, + "27": 103, + "3": 147, + "5": 192, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x108a", + mtime: "0x5", + pc: "0x108a", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_029.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_029.s.snap new file mode 100644 index 000000000..0bd820345 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_029.s.snap @@ -0,0 +1,42 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_029.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 192, + "11": 115, + "12": 255, + "13": 193, + "14": 1, + "15": 19, + "18": 128, + "19": 103, + "3": 239, + "5": 160, + "6": 8, + "7": 147, + }, + registers: { + "x1,ra": "0x4", + "x17,a7": "0xa", + "x2,sp": "0xffffff8", + mtime: "0x5", + pc: "0xc", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Stack pointer not restored: entered at 0xffffffc, exited at 0xffffff8", + register: undefined, + rule: "STACK_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_030.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_030.s.snap new file mode 100644 index 000000000..e287dd757 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_030.s.snap @@ -0,0 +1,33 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_030.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "17": 80, + "18": 1, + "19": 147, + "2": 1, + "22": 128, + "23": 103, + "3": 147, + "5": 192, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x3,gp": "0x5", + mtime: "0x6", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_031.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_031.s.snap new file mode 100644 index 000000000..f4aeb993e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_031.s.snap @@ -0,0 +1,33 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_031.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "17": 80, + "18": 2, + "19": 19, + "2": 2, + "22": 128, + "23": 103, + "3": 19, + "5": 192, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x4,tp": "0x5", + mtime: "0x6", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_032.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_032.s.snap new file mode 100644 index 000000000..d6692847f --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_032.s.snap @@ -0,0 +1,47 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_032.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 129, + "18": 1, + "19": 19, + "2": 4, + "21": 145, + "22": 32, + "23": 35, + "25": 32, + "26": 4, + "268435447": 2, + "27": 147, + "29": 1, + "3": 147, + "30": 36, + "31": 131, + "33": 129, + "34": 1, + "35": 19, + "38": 128, + "39": 103, + "5": 192, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x9,s1": "0x2", + mtime: "0xa", + pc: "0x10", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_033.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_033.s.snap new file mode 100644 index 000000000..ec4cdad04 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_033.s.snap @@ -0,0 +1,55 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_033.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 80, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 193, + "18": 1, + "19": 19, + "2": 4, + "21": 145, + "22": 32, + "23": 35, + "25": 80, + "26": 4, + "268435451": 5, + "27": 147, + "29": 65, + "3": 147, + "30": 1, + "31": 19, + "34": 128, + "35": 103, + "5": 192, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + "x9,s1": "0x5", + mtime: "0x9", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x9,s1 was saved but never restored", + register: "x9,s1", + rule: "RESTORE_REQUIRED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_034.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_034.s.snap new file mode 100644 index 000000000..824c70881 --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_034.s.snap @@ -0,0 +1,62 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_034.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 129, + "18": 1, + "19": 19, + "2": 4, + "21": 145, + "22": 32, + "23": 35, + "25": 32, + "26": 4, + "268435447": 2, + "27": 147, + "29": 65, + "3": 147, + "30": 36, + "31": 131, + "33": 129, + "34": 1, + "35": 19, + "38": 128, + "39": 103, + "5": 192, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + mtime: "0xa", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x9,s1 saved at 0xffffff4 but restored from 0xffffff8", + register: "x9,s1", + rule: "RESTORE_ADDRESS_MISMATCH", + }, + { + message: "Register x9,s1 value changed but not properly restored", + register: "x9,s1", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_035.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_035.s.snap new file mode 100644 index 000000000..ffeb3b15e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_035.s.snap @@ -0,0 +1,62 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_035.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 129, + "18": 1, + "19": 19, + "2": 4, + "21": 145, + "22": 32, + "23": 35, + "25": 32, + "26": 4, + "268435447": 2, + "27": 147, + "29": 1, + "3": 147, + "30": 20, + "31": 131, + "33": 129, + "34": 1, + "35": 19, + "38": 128, + "39": 103, + "5": 192, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + mtime: "0xa", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x9,s1 saved with 4 bytes but restored with 2 bytes", + register: "x9,s1", + rule: "SIZE_MISMATCH", + }, + { + message: "Register x9,s1 value changed but not properly restored", + register: "x9,s1", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_036.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_036.s.snap new file mode 100644 index 000000000..3ea87479e --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_036.s.snap @@ -0,0 +1,59 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_036.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 8, + "11": 147, + "15": 115, + "16": 255, + "17": 129, + "18": 1, + "19": 19, + "2": 4, + "21": 145, + "22": 32, + "23": 35, + "25": 81, + "26": 32, + "27": 35, + "29": 32, + "3": 147, + "30": 4, + "31": 147, + "33": 1, + "34": 36, + "35": 131, + "37": 129, + "38": 1, + "39": 19, + "42": 128, + "43": 103, + "5": 192, + "7": 239, + "9": 160, + }, + registers: { + "x1,ra": "0x8", + "x17,a7": "0xa", + mtime: "0xb", + pc: "0x10", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x9,s1 value changed but not properly restored", + register: "x9,s1", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "test", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_037.s.snap b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_037.s.snap new file mode 100644 index 000000000..17cc9969d --- /dev/null +++ b/tests/arch/__snapshots__/riscv/sentinel/test_riscv_sentinels_037.s.snap @@ -0,0 +1,145 @@ +export const snapshot = {}; + +snapshot[`riscv/sentinel/test_riscv_sentinels_037.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 6, + "1": 64, + "10": 9, + "11": 147, + "12": 2, + "13": 160, + "14": 10, + "15": 19, + "16": 5, + "17": 64, + "18": 10, + "19": 147, + "2": 4, + "20": 1, + "21": 64, + "23": 239, + "24": 1, + "25": 36, + "26": 130, + "268435451": 24, + "27": 179, + "28": 1, + "29": 73, + "3": 147, + "30": 131, + "31": 51, + "33": 160, + "34": 8, + "35": 147, + "39": 115, + "4": 12, + "40": 255, + "41": 65, + "42": 1, + "43": 19, + "45": 17, + "46": 36, + "47": 35, + "49": 129, + "5": 128, + "50": 34, + "51": 35, + "53": 65, + "54": 4, + "55": 19, + "56": 62, + "57": 112, + "58": 4, + "59": 147, + "6": 9, + "60": 55, + "61": 128, + "62": 9, + "63": 19, + "64": 48, + "65": 144, + "66": 9, + "67": 147, + "68": 1, + "69": 90, + "7": 19, + "70": 4, + "71": 179, + "72": 34, + "73": 176, + "74": 4, + "75": 147, + "76": 27, + "77": 192, + "78": 9, + "79": 19, + "8": 18, + "81": 129, + "82": 32, + "83": 131, + "85": 65, + "86": 36, + "87": 3, + "89": 193, + "9": 192, + "90": 1, + "91": 19, + "94": 128, + "95": 103, + }, + registers: { + "x1,ra": "0x18", + "x17,a7": "0xa", + "x18,s2": "0x1bc", + "x19,s3": "0x309", + "x20,s4": "0x2a", + "x21,s5": "0x54", + "x5,t0": "0x3e7", + "x6,t1": "0x333", + "x9,s1": "0x22b", + mtime: "0x18", + pc: "0x28", + }, + sentinel_errors: [ + { + errors: [ + { + message: "Register x9,s1 was used but never saved to memory", + register: "x9,s1", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x9,s1 value changed but not properly restored", + register: "x9,s1", + rule: "VALUE_NOT_RESTORED", + }, + { + message: "Register x18,s2 was used but never saved to memory", + register: "x18,s2", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x18,s2 value changed but not properly restored", + register: "x18,s2", + rule: "VALUE_NOT_RESTORED", + }, + { + message: "Register x19,s3 was used but never saved to memory", + register: "x19,s3", + rule: "SAVE_BEFORE_USE", + }, + { + message: "Register x19,s3 value changed but not properly restored", + register: "x19,s3", + rule: "VALUE_NOT_RESTORED", + }, + ], + function: "bad_function", + }, + ], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/add_test.s.snap b/tests/arch/__snapshots__/riscv64/add_test.s.snap new file mode 100644 index 000000000..2ee764591 --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/add_test.s.snap @@ -0,0 +1,32 @@ +export const snapshot = {}; + +snapshot[`riscv64/add_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 255, + "1": 240, + "10": 2, + "11": 179, + "14": 128, + "15": 103, + "2": 3, + "3": 19, + "4": 255, + "5": 240, + "6": 3, + "7": 147, + "9": 115, + }, + registers: { + "x5,t0": "0xfffffffffffffffe", + "x6,t1": "0xffffffffffffffff", + "x7,t2": "0xffffffffffffffff", + mtime: "0x4", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/addiw_test.s.snap b/tests/arch/__snapshots__/riscv64/addiw_test.s.snap new file mode 100644 index 000000000..ca2e697a3 --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/addiw_test.s.snap @@ -0,0 +1,85 @@ +export const snapshot = {}; + +snapshot[`riscv64/addiw_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 1, + "10": 9, + "11": 55, + "12": 252, + "13": 233, + "14": 9, + "15": 155, + "18": 26, + "19": 55, + "2": 4, + "20": 128, + "21": 10, + "22": 10, + "23": 155, + "24": 128, + "25": 10, + "26": 138, + "27": 155, + "29": 16, + "3": 55, + "30": 11, + "31": 55, + "32": 127, + "33": 251, + "34": 11, + "35": 155, + "36": 127, + "37": 255, + "38": 252, + "39": 55, + "4": 6, + "40": 127, + "41": 252, + "42": 12, + "43": 155, + "44": 127, + "45": 252, + "46": 140, + "47": 155, + "49": 28, + "5": 68, + "50": 140, + "51": 155, + "53": 28, + "54": 140, + "55": 155, + "56": 128, + "58": 13, + "59": 55, + "6": 4, + "60": 255, + "61": 253, + "62": 13, + "63": 155, + "66": 128, + "67": 103, + "7": 155, + "9": 2, + }, + registers: { + "x18,s2": "0x20000", + "x19,s3": "0x1ffce", + "x20,s4": "0x1000", + "x22,s6": "0x100000", + "x23,s7": "0x1007ff", + "x24,s8": "0x7ffff000", + "x25,s9": "0xffffffff80000000", + "x26,s10": "0xffffffff80000000", + "x27,s11": "0x7fffffff", + "x8,fp,s0": "0x10000", + "x9,s1": "0x10064", + mtime: "0x11", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/addw_test.s.snap b/tests/arch/__snapshots__/riscv64/addw_test.s.snap new file mode 100644 index 000000000..ea5dfcfea --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/addw_test.s.snap @@ -0,0 +1,59 @@ +export const snapshot = {}; + +snapshot[`riscv64/addw_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 1, + "10": 137, + "11": 187, + "12": 127, + "13": 255, + "14": 10, + "15": 55, + "16": 1, + "17": 74, + "18": 10, + "19": 187, + "2": 4, + "20": 128, + "22": 11, + "23": 55, + "24": 1, + "25": 100, + "26": 139, + "27": 187, + "28": 127, + "29": 255, + "3": 183, + "30": 12, + "31": 55, + "33": 156, + "34": 12, + "35": 187, + "38": 128, + "39": 103, + "5": 2, + "6": 9, + "7": 55, + "8": 1, + "9": 36, + }, + registers: { + "x18,s2": "0x20000", + "x19,s3": "0x30000", + "x20,s4": "0x7fff0000", + "x21,s5": "0xfffffffffffe0000", + "x22,s6": "0xffffffff80000000", + "x23,s7": "0xffffffff80010000", + "x24,s8": "0x7fff0000", + "x25,s9": "0xffffffff80000000", + "x9,s1": "0x10000", + mtime: "0xa", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/beq_test.s.snap b/tests/arch/__snapshots__/riscv64/beq_test.s.snap new file mode 100644 index 000000000..01da1796d --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/beq_test.s.snap @@ -0,0 +1,39 @@ +export const snapshot = {}; + +snapshot[`riscv64/beq_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "11": 19, + "15": 19, + "19": 19, + "2": 14, + "21": 3, + "22": 147, + "23": 147, + "26": 128, + "27": 103, + "28": 50, + "29": 18, + "3": 99, + "30": 130, + "31": 147, + "34": 5, + "35": 19, + "38": 128, + "39": 103, + "4": 18, + "5": 48, + "6": 3, + "7": 19, + }, + registers: { + "x5,t0": "0x321", + mtime: "0x4", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/load_test.s.snap b/tests/arch/__snapshots__/riscv64/load_test.s.snap new file mode 100644 index 000000000..0f9ee65cf --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/load_test.s.snap @@ -0,0 +1,310 @@ +export const snapshot = {}; + +snapshot[`riscv64/load_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 3, + "101": 190, + "102": 168, + "103": 35, + "105": 181, + "106": 70, + "107": 51, + "109": 206, + "11": 23, + "110": 170, + "111": 35, + "113": 181, + "114": 102, + "115": 179, + "117": 222, + "118": 172, + "119": 35, + "121": 181, + "122": 119, + "123": 51, + "125": 238, + "126": 174, + "127": 35, + "129": 14, + "13": 3, + "130": 53, + "131": 3, + "132": 2, + "133": 174, + "134": 176, + "135": 35, + "137": 142, + "138": 53, + "139": 131, + "14": 3, + "140": 2, + "141": 190, + "142": 180, + "143": 35, + "144": 85, + "145": 170, + "146": 85, + "147": 55, + "148": 90, + "149": 165, + "15": 19, + "150": 5, + "151": 27, + "152": 2, + "153": 174, + "154": 168, + "155": 35, + "157": 16, + "158": 5, + "159": 19, + "161": 128, + "162": 5, + "163": 147, + "164": 3, + "165": 78, + "166": 134, + "167": 19, + "17": 32, + "170": 128, + "171": 103, + "18": 3, + "19": 151, + "2": 2, + "20": 1, + "2097152": 66, + "2097153": 115, + "2097154": 165, + "2097155": 255, + "2097156": 128, + "2097157": 127, + "2097159": 55, + "2097160": 18, + "2097161": 52, + "2097162": 86, + "2097163": 120, + "2097164": 171, + "2097165": 205, + "2097166": 239, + "2097167": 18, + "2097168": 128, + "2097170": 127, + "2097171": 255, + "2097174": 48, + "2097175": 57, + "2097184": 18, + "2097185": 52, + "2097186": 86, + "2097187": 120, + "2097188": 135, + "2097189": 101, + "2097190": 67, + "2097191": 33, + "2097192": 222, + "2097193": 173, + "2097194": 190, + "2097195": 239, + "2097196": 202, + "2097197": 254, + "2097198": 186, + "2097199": 190, + "2097200": 128, + "2097204": 127, + "2097205": 255, + "2097206": 255, + "2097207": 255, + "2097213": 15, + "2097214": 66, + "2097215": 64, + "2097216": 18, + "2097217": 52, + "2097218": 86, + "2097219": 120, + "2097220": 154, + "2097221": 188, + "2097222": 222, + "2097223": 240, + "2097224": 254, + "2097225": 220, + "2097226": 186, + "2097227": 152, + "2097228": 118, + "2097229": 84, + "2097230": 50, + "2097231": 16, + "2097232": 1, + "2097233": 35, + "2097234": 69, + "2097235": 103, + "2097236": 137, + "2097237": 171, + "2097238": 205, + "2097239": 239, + "2097240": 170, + "2097241": 170, + "2097242": 187, + "2097243": 187, + "2097244": 204, + "2097245": 204, + "2097246": 221, + "2097247": 221, + "2097248": 72, + "2097249": 101, + "2097250": 108, + "2097251": 108, + "2097252": 111, + "2097253": 44, + "2097254": 32, + "2097255": 82, + "2097256": 73, + "2097257": 83, + "2097258": 67, + "2097259": 45, + "2097260": 86, + "2097261": 33, + "2097264": 64, + "2097265": 73, + "2097266": 15, + "2097267": 219, + "2097268": 64, + "2097269": 45, + "2097270": 248, + "2097271": 84, + "2097280": 66, + "2097281": 255, + "2097282": 67, + "2097284": 18, + "2097285": 52, + "2097286": 239, + "2097287": 18, + "2097288": 1, + "2097289": 70, + "2097292": 18, + "2097293": 52, + "2097294": 86, + "2097295": 120, + "2097296": 202, + "2097297": 254, + "2097298": 186, + "2097299": 190, + "2097300": 216, + "2097301": 202, + "2097302": 236, + "2097303": 198, + "2097304": 218, + "2097305": 254, + "2097306": 254, + "2097307": 254, + "2097308": 2, + "2097309": 52, + "2097310": 18, + "2097311": 56, + "2097312": 18, + "2097313": 52, + "2097314": 86, + "2097315": 120, + "2097316": 154, + "2097317": 188, + "2097318": 222, + "2097319": 240, + "2097320": 254, + "2097321": 220, + "2097322": 186, + "2097323": 152, + "2097324": 118, + "2097325": 84, + "2097326": 50, + "2097327": 16, + "2097328": 85, + "2097329": 170, + "2097330": 85, + "2097331": 170, + "21": 3, + "22": 131, + "23": 147, + "25": 32, + "26": 14, + "27": 23, + "28": 2, + "29": 142, + "3": 151, + "30": 14, + "31": 19, + "33": 32, + "34": 14, + "35": 151, + "36": 6, + "37": 14, + "38": 142, + "39": 147, + "41": 2, + "42": 133, + "43": 3, + "45": 174, + "46": 128, + "47": 35, + "49": 50, + "5": 2, + "50": 133, + "51": 131, + "53": 190, + "54": 128, + "55": 163, + "57": 21, + "58": 5, + "59": 19, + "6": 130, + "61": 174, + "62": 129, + "63": 35, + "65": 3, + "66": 21, + "67": 3, + "69": 174, + "7": 147, + "70": 146, + "71": 35, + "73": 99, + "74": 21, + "75": 131, + "77": 190, + "78": 147, + "79": 35, + "81": 181, + "82": 6, + "83": 51, + "85": 206, + "86": 148, + "87": 35, + "89": 3, + "9": 32, + "90": 165, + "91": 3, + "93": 174, + "94": 166, + "95": 35, + "97": 195, + "98": 165, + "99": 131, + }, + registers: { + "x10,a0": "0x1", + "x11,a1": "0x8", + "x12,a2": "0x2000b4", + "x13,a3": "0xdafefefe", + "x14,a4": "0x2341238", + "x28,t3": "0x200040", + "x29,t4": "0x200080", + "x5,t0": "0x200000", + "x6,t1": "0x200008", + "x7,t2": "0x200020", + mtime: "0x2b", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/lui_test.s.snap b/tests/arch/__snapshots__/riscv64/lui_test.s.snap new file mode 100644 index 000000000..cc95f73ff --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/lui_test.s.snap @@ -0,0 +1,35 @@ +export const snapshot = {}; + +snapshot[`riscv64/lui_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 6, + "11": 55, + "12": 127, + "13": 255, + "14": 246, + "15": 183, + "18": 128, + "19": 103, + "2": 21, + "3": 55, + "4": 255, + "5": 255, + "6": 245, + "7": 183, + "8": 128, + }, + registers: { + "x10,a0": "0x1000", + "x11,a1": "0xfffffffffffff000", + "x12,a2": "0xffffffff80000000", + "x13,a3": "0x7ffff000", + mtime: "0x5", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/memory_test.s.snap b/tests/arch/__snapshots__/riscv64/memory_test.s.snap new file mode 100644 index 000000000..0bcf9b917 --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/memory_test.s.snap @@ -0,0 +1,105 @@ +export const snapshot = {}; + +snapshot[`riscv64/memory_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 32, + "10": 82, + "11": 131, + "13": 32, + "14": 2, + "15": 23, + "16": 255, + "17": 194, + "18": 2, + "19": 19, + "2": 2, + "2097152": 241, + "2097153": 35, + "2097154": 241, + "2097156": 241, + "2097157": 35, + "2097158": 18, + "2097159": 52, + "2097162": 241, + "2097163": 35, + "2097166": 241, + "2097167": 35, + "2097168": 241, + "2097169": 35, + "2097170": 18, + "2097171": 52, + "2097179": 241, + "21": 82, + "22": 17, + "23": 35, + "25": 32, + "26": 2, + "27": 23, + "28": 255, + "29": 66, + "3": 23, + "30": 2, + "31": 19, + "33": 82, + "34": 32, + "35": 35, + "37": 32, + "38": 2, + "39": 23, + "40": 254, + "41": 2, + "42": 2, + "43": 19, + "45": 2, + "46": 34, + "47": 131, + "49": 32, + "5": 2, + "50": 2, + "51": 23, + "52": 254, + "53": 2, + "54": 2, + "55": 19, + "57": 82, + "58": 32, + "59": 35, + "6": 2, + "61": 32, + "62": 2, + "63": 23, + "64": 252, + "65": 98, + "66": 2, + "67": 19, + "69": 2, + "7": 19, + "70": 66, + "71": 131, + "73": 32, + "74": 2, + "75": 23, + "76": 253, + "77": 2, + "78": 2, + "79": 19, + "81": 82, + "82": 1, + "83": 163, + "86": 128, + "87": 103, + "9": 2, + }, + registers: { + "x4,tp": "0x200018", + "x5,t0": "0xf1", + mtime: "0x16", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/slli_test.s.snap b/tests/arch/__snapshots__/riscv64/slli_test.s.snap new file mode 100644 index 000000000..efea5898f --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/slli_test.s.snap @@ -0,0 +1,67 @@ +export const snapshot = {}; + +snapshot[`riscv64/slli_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "10": 153, + "11": 19, + "14": 9, + "15": 183, + "17": 25, + "18": 137, + "19": 147, + "2": 4, + "20": 1, + "21": 73, + "22": 154, + "23": 19, + "24": 255, + "25": 240, + "26": 10, + "27": 147, + "28": 2, + "29": 10, + "3": 183, + "30": 155, + "31": 19, + "34": 11, + "35": 183, + "37": 27, + "38": 139, + "39": 147, + "40": 3, + "41": 251, + "42": 156, + "43": 19, + "44": 127, + "45": 255, + "46": 252, + "47": 183, + "49": 28, + "5": 20, + "50": 157, + "51": 19, + "54": 128, + "55": 103, + "6": 132, + "7": 147, + "9": 20, + }, + registers: { + "x18,s2": "0x2", + "x19,s3": "0x1", + "x20,s4": "0x100000", + "x21,s5": "0xffffffffffffffff", + "x23,s7": "0x1", + "x25,s9": "0x7ffff000", + "x26,s10": "0xffffe000", + "x9,s1": "0x1", + mtime: "0xe", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/slliw_test.s.snap b/tests/arch/__snapshots__/riscv64/slliw_test.s.snap new file mode 100644 index 000000000..82a252e30 --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/slliw_test.s.snap @@ -0,0 +1,38 @@ +export const snapshot = {}; + +snapshot[`riscv64/slliw_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 16, + "10": 4, + "11": 19, + "13": 20, + "14": 20, + "15": 155, + "17": 20, + "18": 217, + "19": 27, + "2": 4, + "22": 128, + "23": 103, + "3": 19, + "4": 2, + "5": 4, + "6": 20, + "7": 19, + "8": 255, + "9": 244, + }, + registers: { + "x18,s2": "0x7fffffff", + "x8,fp,s0": "0xffffffffffffffff", + "x9,s1": "0xfffffffe", + mtime: "0x6", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/sllw_test.s.snap b/tests/arch/__snapshots__/riscv64/sllw_test.s.snap new file mode 100644 index 000000000..47ff5275c --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/sllw_test.s.snap @@ -0,0 +1,36 @@ +export const snapshot = {}; + +snapshot[`riscv64/sllw_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "0": 253, + "1": 208, + "10": 90, + "11": 147, + "12": 64, + "13": 26, + "14": 91, + "15": 19, + "18": 128, + "19": 103, + "2": 9, + "3": 147, + "5": 25, + "6": 154, + "7": 19, + "9": 26, + }, + registers: { + "x19,s3": "0xffffffffffffffdd", + "x20,s4": "0xffffffba", + "x21,s5": "0x7fffffdd", + "x22,s6": "0x7fffffdd", + mtime: "0x5", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/__snapshots__/riscv64/subw_test.s.snap b/tests/arch/__snapshots__/riscv64/subw_test.s.snap new file mode 100644 index 000000000..a0b1764bc --- /dev/null +++ b/tests/arch/__snapshots__/riscv64/subw_test.s.snap @@ -0,0 +1,63 @@ +export const snapshot = {}; + +snapshot[`riscv64/subw_test.s 1`] = ` +{ + display: "", + error: false, + keyboard: "", + memory: { + "1": 3, + "10": 9, + "11": 59, + "13": 1, + "14": 9, + "15": 183, + "17": 2, + "18": 10, + "19": 55, + "2": 4, + "20": 65, + "21": 73, + "22": 138, + "23": 187, + "25": 5, + "26": 11, + "27": 55, + "28": 65, + "29": 107, + "3": 55, + "30": 13, + "31": 59, + "32": 127, + "33": 255, + "34": 13, + "35": 183, + "36": 64, + "37": 13, + "38": 139, + "39": 187, + "42": 128, + "43": 103, + "5": 1, + "6": 4, + "7": 183, + "8": 64, + "9": 148, + }, + registers: { + "x18,s2": "0x40000", + "x19,s3": "0x10000", + "x20,s4": "0x20000", + "x21,s5": "0x30000", + "x22,s6": "0x50000", + "x23,s7": "0x7fff0000", + "x26,s10": "0xa0000", + "x27,s11": "0x7fff0000", + "x8,fp,s0": "0x30000", + "x9,s1": "0x10000", + mtime: "0xb", + pc: "0xfffffffffffffffe", + }, + sentinel_errors: [], +} +`; diff --git a/tests/arch/arch_utils.mts b/tests/arch/arch_utils.mts new file mode 100644 index 000000000..3fa88d4ca --- /dev/null +++ b/tests/arch/arch_utils.mts @@ -0,0 +1,177 @@ +import { assertSnapshot } from "jsr:@std/testing/snapshot"; +import { assertEquals } from "https://deno.land/std/assert/mod.ts"; +import * as path from "jsr:@std/path"; +import fs from "node:fs"; +import { + executeStep, + loadArchitecture, + compileAssembly, + CompileResult, +} from "../unit/arch/simulator-test-utils.mts"; +import { testKeyboard } from "../../src/core/executor/IO.mjs"; +import * as creator from "../../src/core/core.mjs"; +import { coreEvents, CoreEventTypes } from "../../src/core/events.mts"; +import { logger } from "../../src/core/utils/creator_logger.mjs"; +import { assembleCreator } from "../../src/core/assembler/creatorAssembler/deno/creatorAssembler.mjs"; +import { getCleanErrorMessage } from "../../src/core/assembler/assembler.mjs"; + +export const ARCH = { + riscv: "RISCV/RV32IMFD.yml", + riscv64: "RISCV/RV64IMFD.yml", + mips: "MIPS32.yml", + simple8: "simple8.yml", +}; + +const PREFIX = path.fromFileUrl(import.meta.url + "/../../../"); + +/** + * Callback to run within a test + * @param t - Deno context of the test + * @param file - Name of the assembly file + * @param testAssembly - Contents of the assembly file + * @param snapPath - Path in which the snapshot files should be stored + */ +type TestFN = ( + t: Deno.TestContext, + file: string, + testAssembly: string, + snapPath: string, +) => void | Promise; + +/** + * Executes a group of snapshot tests + * @param archPath - Path to the YAML architecture configuration file, from the architectures folder + * @param dir - Path to the directory with the assembly files + * @param fn - Callback to run within the test + */ +function run_tests(archPath: string, dir: string, fn: TestFN): void { + logger.disable(); + const ARCH_PATH = "architecture/" + archPath; + loadArchitecture(ARCH_PATH); + const DIR = `./tests/arch/${dir}`; + for (const file of fs.globSync("*.s", { cwd: DIR })) { + Deno.test(`${dir}/${file}`, async t => { + const testAssembly = fs.readFileSync(`${DIR}/${file}`, "utf8"); + const path = `${PREFIX}/tests/arch/__snapshots__/${dir}/${file}.snap`; + await fn(t, file, testAssembly, path); + }); + } +} + +/** + * Executes a group of execution snapshot tests + * @param archPath - Path to the YAML architecture configuration file, from the architectures folder + * @param dir - Path to the directory with the assembly files + * @param keyboard - Map of test file name to its corresponding keyboard input. Unspecified files + * use an empty input + * @param expect_error - Set of test file names that are expected to throw errors during execution + * @param library - Whether tests should be executed with a library + */ +export function execution_tests( + archPath: string, + dir: string, + keyboard: Map = new Map(), + expect_error: Set = new Set(), + library: boolean = false, +): void { + testKeyboard.enable = true; + run_tests(archPath, dir, async (t, file, testAssembly, snapPath) => { + const errors = expect_error.has(file); + if (library) { + const libPath = `./tests/arch/${dir}/${file.slice(0, -2)}.yml`; + const testLib = fs.readFileSync(libPath, "utf8"); + creator.load_library(testLib); + } + + // Record passing convention errors + const sentinel_errors: object[] = []; + coreEvents.on(CoreEventTypes.SENTINEL_ERROR, e => + sentinel_errors.push({ + function: e.functionName, + errors: e.errors.map(e => { + return { + rule: e.rule, + register: e.register?.join(","), + message: e.message, + }; + }), + }), + ); + + // Compile code + await compileAssembly(testAssembly); + + // Setup keyboard input if specified + testKeyboard.data = keyboard.get(file) || []; + + // Execute code + let result = { output: "", error: false }; + const instruction_errors: { i: number; error: string }[] = []; + for (let i = 0; i < 1000; i++) { + try { + result = executeStep(); + if (result.error || creator.status.execution_index === -2) + break; + } catch (e) { + if (errors) + instruction_errors.push({ + i, + error: (e as Error).message, + }); + else throw e; + } + } + + // Save state + const memory = creator.main_memory + .getWritten() + .map(d => [d.addr, d.value]) + .filter(x => x[1] !== 0); + + const registers = creator.REGISTERS.flatMap(r => r.elements) + .filter(r => r.value !== r.default_value) + .map(r => [r.name.join(","), "0x" + r.value.toString(16)]); + + const state = { + error: result.error === false ? false : result.output, + memory: Object.fromEntries(memory), + registers: Object.fromEntries(registers), + display: creator.status.display, + keyboard: creator.status.keyboard, + sentinel_errors, + ...(errors ? { instruction_errors } : {}), + }; + + await assertSnapshot(t, state, { path: snapPath }); + creator.remove_library(); + }); +} + +/** + * Executes a group of compiler error snapshot tests + * @param archPath - Path to the YAML architecture configuration file, from the architectures folder + * @param dir - Path to the directory with the assembly files + */ +export function compile_error_tests(archPath: string, dir: string): void { + run_tests(archPath, dir, async (t, _, testAssembly, snapPath) => { + // Compile code + const res_ansi = (await creator.assembly_compile( + testAssembly, + assembleCreator, + true, + )) as CompileResult; + const res_html = (await creator.assembly_compile( + testAssembly, + assembleCreator, + false, + )) as CompileResult; + + const cleanMsg = getCleanErrorMessage(res_html.msg, false); + assertEquals(getCleanErrorMessage(res_ansi.msg, true), cleanMsg); + assertEquals(res_ansi.linter, res_html.linter); + await assertSnapshot(t, res_html.linter, { path: snapPath }); + await assertSnapshot(t, cleanMsg, { path: snapPath }); + await assertSnapshot(t, res_html.msg, { path: snapPath }); + await assertSnapshot(t, res_ansi.msg, { path: snapPath }); + }); +} diff --git a/tests/arch/mips/correct.test.mts b/tests/arch/mips/correct.test.mts new file mode 100644 index 000000000..96fbc690b --- /dev/null +++ b/tests/arch/mips/correct.test.mts @@ -0,0 +1,32 @@ +import { ARCH, execution_tests } from "../arch_utils.mts"; + +const long_str = + "This is a very long string with many characters and a lot of data. :) 123\n"; + +execution_tests( + ARCH.mips, + "mips/correct/examples", + new Map([ + ["test_mips_example_009.s", ["123\n", "456\n"]], + ["test_mips_example_010.s", [long_str.length + "\n", long_str]], + ["test_mips_example_017.s", ["String in UTF-8: ∀ ∫ ∇ ∈ 🠬\n"]], + ]), +); +execution_tests( + ARCH.mips, + "mips/correct/libraries", + undefined, + undefined, + true, +); +execution_tests( + ARCH.mips, + "mips/correct/syscalls", + new Map([ + ["test_mips_syscall_005.s", ["1234567\n"]], + ["test_mips_syscall_006.s", ["1.234567\n"]], + ["test_mips_syscall_007.s", ["1.234567890123456\n"]], + ["test_mips_syscall_008.s", ["This is a long string\n"]], + ["test_mips_syscall_012.s", ["a\n"]], + ]), +); diff --git a/tests/arch/mips/correct/examples/test_mips_example_001.s b/tests/arch/mips/correct/examples/test_mips_example_001.s index 7961619d5..c44649b70 100644 --- a/tests/arch/mips/correct/examples/test_mips_example_001.s +++ b/tests/arch/mips/correct/examples/test_mips_example_001.s @@ -3,17 +3,35 @@ # Creator (https://creatorsim.github.io/creator/) # - .data +.data - byte: .byte 12 + byte: .byte 12 - .align 1 - half: .half 34 + .align 1 + half: .half 34 - .align 2 - word: .word -5678 - float: .float 456.322 - double: .double 9741.34 - stringZ: .asciiz "This is a string" - string: .ascii "This is another string" - space: .space 32 + .align 2 + word: .word -5678 + float: .float 456.322 + double: .double 9741.34 + stringZ: .asciiz "This is a string" + string: .ascii "This is another string" + space: .space 32 + +.text + main: + + # print byte value +first:la $a0, byte + lb $a0, 0($a0) + li $v0, 1 + syscall + + # print half value + la $a0, half + lh $a0, 0($a0) + li $v0, 1 + syscall + + #return + jr $ra diff --git a/tests/arch/mips/correct/examples/test_mips_example_002.out b/tests/arch/mips/correct/examples/test_mips_example_002.out deleted file mode 100644 index 4329ef305..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_002.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[8,t0]:0xa; ir[9,t1]:0xd; ir[10,t2]:0x2d; ir[11,t3]:0x21; ir[12,t4]:0x17; ir[13,t5]:0xc; ir[14,t6]:0x441; ir[15,t7]:0x53; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_002.s b/tests/arch/mips/correct/examples/test_mips_example_002.s index d4b38f55b..968178cff 100644 --- a/tests/arch/mips/correct/examples/test_mips_example_002.s +++ b/tests/arch/mips/correct/examples/test_mips_example_002.s @@ -15,3 +15,4 @@ main: sub $t5, $t2, $t3 # 45-33 mul $t6, $t3, $t3 # 33*33 div $t7, $t6, $t1 # $t6/13 + jr $ra diff --git a/tests/arch/mips/correct/examples/test_mips_example_003.out b/tests/arch/mips/correct/examples/test_mips_example_003.out deleted file mode 100644 index 043764100..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_003.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x78; ir[1,at]:0x20000e; ir[8,t0]:0x200000; ir[9,t1]:0x200004; ir[10,t2]:0x200006; ir[11,t3]:0xe; ir[12,t4]:0xe; ir[13,t5]:0x78; ir[14,t6]:0x78; ir[15,t7]:0x16; ir[24,t8]:0x16; memory[0x20000f]:0x16; memory[0x20000c]:0x78; memory[0x20000b]:0x0e; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_003.s b/tests/arch/mips/correct/examples/test_mips_example_003.s index d1686ba04..c16a5f7d1 100644 --- a/tests/arch/mips/correct/examples/test_mips_example_003.s +++ b/tests/arch/mips/correct/examples/test_mips_example_003.s @@ -22,16 +22,16 @@ main: la $t1, b1 #b1 address -> $t1 la $t2, h1 #h1 address -> $t2 - lw $t3, ($t0) #Memory[$t0] -> $t3 + lw $t3, 0($t0) #Memory[$t0] -> $t3 lw $t4, w1 #Memory[w1] -> $t4 - lb $t5, ($t1) #Memory[$t1] -> $t5 + lb $t5, 0($t1) #Memory[$t1] -> $t5 lb $t6, b1 #Memory[b1] -> $t6 - lh $t7, ($t2) #Memory[$t2] -> $t7 + lh $t7, 0($t2) #Memory[$t2] -> $t7 lh $t8, h1 #Memory[h1] -> $t8 sw $t3, w2 #$t3 -> Memory[w2] sb $t5, b2 #$t5 -> Memory[b2] sh $t7, h2 #$t7 -> Memory[h2] - \ No newline at end of file + jr $ra diff --git a/tests/arch/mips/correct/examples/test_mips_example_004.out b/tests/arch/mips/correct/examples/test_mips_example_004.out deleted file mode 100644 index 5afd90f0b..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_004.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x64; ir[1,at]:0x200018; ir[2,v0]:0xa; ir[8,t0]:0x200000; ir[9,t1]:0x200008; ir[10,t2]:0x200010; ir[11,t3]:0x200028; sfpr[f0]:0x405145A1; sfpr[f1]:0xCAC08312; sfpr[f2]:0x4026E2D0; sfpr[f3]:0xE5604189; sfpr[f4]:0x4082A27E; sfpr[f5]:0xF9DB22D1; sfpr[f10]:0x4084CB33; sfpr[f11]:0x33333333; sfpr[f12]:0x404D1315; sfpr[f13]:0x4689C3E9; dfpr[FP0]:0x405145A1CAC08312; dfpr[FP2]:0x4026E2D0E5604189; dfpr[FP4]:0x4082A27EF9DB22D1; dfpr[FP10]:0x4084CB3333333333; dfpr[FP12]:0x404D13154689C3E9; memory[0x20002f]:0xE9; memory[0x20002e]:0xC3; memory[0x20002d]:0x89; memory[0x20002c]:0x46; memory[0x20002b]:0x15; memory[0x20002a]:0x13; memory[0x200029]:0x4D; memory[0x200028]:0x40; memory[0x200027]:0xD1; memory[0x200026]:0x22; memory[0x200025]:0xDB; memory[0x200024]:0xF9; memory[0x200023]:0x7E; memory[0x200022]:0xA2; memory[0x200021]:0x82; memory[0x200020]:0x40; memory[0x20001f]:0x12; memory[0x20001e]:0x83; memory[0x20001d]:0xC0; memory[0x20001c]:0xCA; memory[0x20001b]:0xA1; memory[0x20001a]:0x45; memory[0x200019]:0x51; memory[0x200018]:0x40; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_004.s b/tests/arch/mips/correct/examples/test_mips_example_004.s index 981c7ca0a..b281964dc 100644 --- a/tests/arch/mips/correct/examples/test_mips_example_004.s +++ b/tests/arch/mips/correct/examples/test_mips_example_004.s @@ -17,18 +17,18 @@ main: la $t2, c la $t3, d - l.d $FP0, ($t0) - l.d $FP2, ($t1) - l.d $FP10, ($t2) + l.d $FP0, 0($t0) + l.d $FP2, 0($t1) + l.d $FP10, 0($t2) add.d $FP0, $FP0, $FP0 sub.d $FP4, $FP10, $FP0 div.d $FP12, $FP10, $FP2 - s.d $FP0, ($t3) + s.d $FP0, 0($t3) addi $t3, $t3, 8 - s.d $FP4, ($t3) + s.d $FP4, 0($t3) addi $t3, $t3, 8 - s.d $FP12, ($t3) + s.d $FP12, 0($t3) li $v0, 10 syscall diff --git a/tests/arch/mips/correct/examples/test_mips_example_005.out b/tests/arch/mips/correct/examples/test_mips_example_005.out deleted file mode 100644 index 85592e9a9..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_005.out +++ /dev/null @@ -1,4 +0,0 @@ - -45 -cr[PC]:0x30; ir[2,v0]:0x1; ir[4,a0]:0x2d; ir[8,t0]:0xa; ir[9,t1]:0xa; keyboard[0x0]:''; display[0x0]:'45'; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_005.s b/tests/arch/mips/correct/examples/test_mips_example_005.s index 6954d93fa..4eb68e0a3 100644 --- a/tests/arch/mips/correct/examples/test_mips_example_005.s +++ b/tests/arch/mips/correct/examples/test_mips_example_005.s @@ -5,18 +5,18 @@ # Sum of the first 10 numbers from 0 to 9 .data - max: .byte 10 + max: .byte 10 .text - main: lb $t0, max - li $t1, 0 - li $a0, 0 - while: bge $t1, $t0, end_while - add $a0, $a0, $t1 - add $t1, $t1, 1 - b while + main: lb $t0, max + li $t1, 0 + li $a0, 0 + while: bge $t1, $t0, end_while + add $a0, $a0, $t1 + add $t1, $t1, 1 + b while - end_while: li $v0, 1 - syscall #print_int + end_while: li $v0, 1 + syscall #print_int + + jr $ra - - \ No newline at end of file diff --git a/tests/arch/mips/correct/examples/test_mips_example_006.out b/tests/arch/mips/correct/examples/test_mips_example_006.out deleted file mode 100644 index 86145f1b7..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_006.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[1,at]:0x1; ir[2,v0]:0xa; ir[8,t0]:0x4; ir[9,t1]:0x2; ir[11,t3]:0x22; ir[24,t8]:0x22b; ir[25,t9]:0xb; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_007.out b/tests/arch/mips/correct/examples/test_mips_example_007.out deleted file mode 100644 index 831227000..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_007.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x44; ir[1,at]:0x200000; ir[2,v0]:0xa; ir[9,t1]:0x5; ir[10,t2]:0x5; ir[11,t3]:0x1; ir[12,t4]:0x4; ir[13,t5]:0x200014; ir[14,t6]:0x5; ir[15,t7]:0xf; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_007.s b/tests/arch/mips/correct/examples/test_mips_example_007.s index a50a482d9..1d475e3d3 100644 --- a/tests/arch/mips/correct/examples/test_mips_example_007.s +++ b/tests/arch/mips/correct/examples/test_mips_example_007.s @@ -22,7 +22,7 @@ loop1: beq $t1, $t2, end1 #if($t1 == $t2) --> jump to fin1 # loop body mul $t6, $t1, $t4 # $t1 * $t4 -> $t6 - lw $t6, ($t5) # Memory[$t5] -> $t6 + lw $t6, 0($t5) # Memory[$t5] -> $t6 add $t7, $t7, $t6 # $t6 + $t7 -> $t7 # loop next... diff --git a/tests/arch/mips/correct/examples/test_mips_example_008.out b/tests/arch/mips/correct/examples/test_mips_example_008.out deleted file mode 100644 index 32452f644..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_008.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x5c; ir[1,at]:0x200040; ir[2,v0]:0xa; ir[8,t0]:0x200040; ir[9,t1]:0x200080; ir[10,t2]:0x4; ir[11,t3]:0x4; ir[12,t4]:0x4; sfpr[f0]:0x33441124; dfpr[FP0]:0x3344112400000000; memory[0x20007f]:0x24; memory[0x20007e]:0x11; memory[0x20007d]:0x44; memory[0x20007c]:0x33; memory[0x20007b]:0x21; memory[0x20007a]:0x43; memory[0x200079]:0x65; memory[0x200078]:0x87; memory[0x200077]:0x78; memory[0x200076]:0x56; memory[0x200075]:0x34; memory[0x200074]:0x12; memory[0x200073]:0x23; memory[0x200072]:0xff; memory[0x20006d]:0xd0; memory[0x20006c]:0x77; memory[0x20006b]:0x12; memory[0x20006a]:0xf0; memory[0x200069]:0xbf; memory[0x200068]:0xaa; memory[0x200067]:0x22; memory[0x200066]:0x11; memory[0x200065]:0x55; memory[0x200064]:0x44; memory[0x200063]:0x14; memory[0x200062]:0x02; memory[0x20005f]:0x14; memory[0x20005e]:0x14; memory[0x20005d]:0x14; memory[0x20005c]:0x14; memory[0x20005b]:0x20; memory[0x20005a]:0x21; memory[0x200059]:0x51; memory[0x200058]:0x77; memory[0x200057]:0x10; memory[0x200056]:0x22; memory[0x200055]:0x43; memory[0x200051]:0x45; memory[0x200050]:0x23; memory[0x20004c]:0x34; memory[0x200048]:0x34; memory[0x200044]:0x34; memory[0x200040]:0x34; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_010.s b/tests/arch/mips/correct/examples/test_mips_example_010.s index 7a926d8bf..c2fe4205f 100644 --- a/tests/arch/mips/correct/examples/test_mips_example_010.s +++ b/tests/arch/mips/correct/examples/test_mips_example_010.s @@ -28,4 +28,6 @@ main: syscall li $v0, 4 - syscall \ No newline at end of file + syscall + + jr $ra diff --git a/tests/arch/mips/correct/examples/test_mips_example_011.out b/tests/arch/mips/correct/examples/test_mips_example_011.out deleted file mode 100644 index 25e4c6e16..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_011.out +++ /dev/null @@ -1,4 +0,0 @@ - --144 -cr[PC]:0x38; ir[1,at]:0xffffffb3; ir[2,v0]:0xa; ir[3,v1]:0x5a; ir[4,a0]:0xffffff70; ir[5,a1]:0x5a; ir[6,a2]:0x2d; ir[9,t1]:0xffffffca; ir[10,t2]:0x5a; ir[31,ra]:0x24; keyboard[0x0]:''; display[0x0]:'-144'; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_012.out b/tests/arch/mips/correct/examples/test_mips_example_012.out deleted file mode 100644 index 8a933c1f1..000000000 --- a/tests/arch/mips/correct/examples/test_mips_example_012.out +++ /dev/null @@ -1,4 +0,0 @@ - -120 -cr[PC]:0x1c; ir[1,at]:0x1; ir[2,v0]:0xa; ir[4,a0]:0x78; ir[9,t1]:0x5; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:'120'; - diff --git a/tests/arch/mips/correct/examples/test_mips_example_012.s b/tests/arch/mips/correct/examples/test_mips_example_012.s index d29c63883..de82be4e1 100644 --- a/tests/arch/mips/correct/examples/test_mips_example_012.s +++ b/tests/arch/mips/correct/examples/test_mips_example_012.s @@ -31,7 +31,7 @@ factorial: # if ($a < 2): # return 1 - bge $a0 2, b_else + bge $a0, 2, b_else li $v0, 1 b b_efs # else: diff --git a/tests/arch/mips/correct/examples/test_mips_example_013.s b/tests/arch/mips/correct/examples/test_mips_example_013.s new file mode 100644 index 000000000..279860f79 --- /dev/null +++ b/tests/arch/mips/correct/examples/test_mips_example_013.s @@ -0,0 +1,16 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.data + utf8: .asciiz "String in UTF-8: ∀ ∫ ∇ ∈ 🠬" + +.text +main: li $v0, 1 + la $t0, utf8 +loop: lbu $a0, 0($t0) + syscall + addi $t0, $t0, 1 + bne $a0, $zero, loop + jr $ra diff --git a/tests/arch/mips/correct/examples/test_mips_example_017.s b/tests/arch/mips/correct/examples/test_mips_example_017.s new file mode 100644 index 000000000..5060fbaad --- /dev/null +++ b/tests/arch/mips/correct/examples/test_mips_example_017.s @@ -0,0 +1,34 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.data + string: .asciiz "Insert the string: " + space: .space 100 + +.text +main: + # print "Insert string..." + la $a0, string + li $v0, 4 + syscall + + # read string + la $a0, space + li $a1, 100 + li $v0, 8 + syscall + + # print enter + la $a0, '\n' + li $v0, 11 + syscall + + # print string + la $a0, space + li $v0, 4 + syscall + + # return + jr $ra diff --git a/tests/arch/mips/correct/libraries/test_mips_libraries_001.o b/tests/arch/mips/correct/libraries/test_mips_libraries_001.o deleted file mode 100644 index d615504d7..000000000 --- a/tests/arch/mips/correct/libraries/test_mips_libraries_001.o +++ /dev/null @@ -1,102 +0,0 @@ -{ - "instructions_binary": [ - { - "Break": null, - "Address": "0x0", - "Label": "max", - "loaded": "00000000100001010000100000101010", - "user": null, - "_rowVariant": "", - "visible": false, - "globl": true - }, - { - "Break": null, - "Address": "0x4", - "Label": "", - "loaded": "00010000001000000000000000000001", - "user": null, - "_rowVariant": "", - "visible": false - }, - { - "Break": null, - "Address": "0x8", - "Label": "", - "loaded": "00000000101000000010000000100000", - "user": null, - "_rowVariant": "", - "visible": false - }, - { - "Break": null, - "Address": "0xc", - "Label": "bigger_symbol", - "loaded": "00000011111000000000000000001000", - "user": null, - "_rowVariant": "", - "visible": false, - "globl": false - }, - { - "Break": null, - "Address": "0x10", - "Label": "min", - "loaded": "00000000101001000000100000101010", - "user": null, - "_rowVariant": "", - "visible": false, - "globl": true - }, - { - "Break": null, - "Address": "0x14", - "Label": "", - "loaded": "00010000001000000000000000000001", - "user": null, - "_rowVariant": "", - "visible": false - }, - { - "Break": null, - "Address": "0x18", - "Label": "", - "loaded": "00000000101000000010000000100000", - "user": null, - "_rowVariant": "", - "visible": false - }, - { - "Break": null, - "Address": "0x1c", - "Label": "minor_symbol", - "loaded": "00000011111000000000000000001000", - "user": null, - "_rowVariant": "", - "visible": false, - "globl": false - } - ], - "instructions_tag": [ - { - "tag": "max", - "addr": 0, - "globl": true - }, - { - "tag": "bigger_symbol", - "addr": 12, - "globl": false - }, - { - "tag": "min", - "addr": 16, - "globl": true - }, - { - "tag": "minor_symbol", - "addr": 28, - "globl": false - } - ] -} \ No newline at end of file diff --git a/tests/arch/mips/correct/libraries/test_mips_libraries_001.out b/tests/arch/mips/correct/libraries/test_mips_libraries_001.out deleted file mode 100644 index cbcdad545..000000000 --- a/tests/arch/mips/correct/libraries/test_mips_libraries_001.out +++ /dev/null @@ -1,9 +0,0 @@ - -10 - - -5 - - -cr[PC]:0x60; ir[2,v0]:0xb; ir[4,a0]:0xa; ir[5,a1]:0xa; ir[31,ra]:0x4c; keyboard[0x0]:''; display[0x0]:'10%0A5%0A'; - diff --git a/tests/arch/mips/correct/libraries/test_mips_libraries_001.s b/tests/arch/mips/correct/libraries/test_mips_libraries_001.s index 1ad6ac0d0..da894137f 100644 --- a/tests/arch/mips/correct/libraries/test_mips_libraries_001.s +++ b/tests/arch/mips/correct/libraries/test_mips_libraries_001.s @@ -1,6 +1,7 @@ .text main: + addi $s0, $ra, 0 li $a0, 5 li $a1, 10 jal max @@ -19,4 +20,7 @@ li $a0, '\n' li $v0, 11 - syscall \ No newline at end of file + syscall + + addi $ra, $s0, 0 + jr $ra diff --git a/tests/arch/mips/correct/libraries/test_mips_libraries_001.yml b/tests/arch/mips/correct/libraries/test_mips_libraries_001.yml new file mode 100644 index 000000000..e2e1fb242 --- /dev/null +++ b/tests/arch/mips/correct/libraries/test_mips_libraries_001.yml @@ -0,0 +1,21 @@ +version: '1.0' +binary: 0085082a1020000800a0202003e0000800a4082a1020000800a0202003e00008 +symbols: + max: + addr: 0 + help: + description: Returns the maximum of two integers + parameters: + a0: First Integer + a1: Second Integer + returns: + a0: Maximum + min: + addr: 16 + help: + description: Returns the minimum of two integers + parameters: + a0: First Integer + a1: Second Integer + returns: + a0: Minimum diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_001.out b/tests/arch/mips/correct/syscalls/test_mips_syscall_001.out deleted file mode 100644 index 1192ad0e9..000000000 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_001.out +++ /dev/null @@ -1,10 +0,0 @@ - -6673 -120 -1 -34 --5678 -1 -1416128883 -cr[PC]:0x74; ir[1,at]:0x200008; ir[2,v0]:0x1; ir[4,a0]:0x54686973; ir[8,t0]:0x4; ir[9,t1]:0x200000; keyboard[0x0]:''; display[0x0]:'6673120134-567811416128883'; - diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_001.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_001.s index 6b17047be..cea51ca33 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_001.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_001.s @@ -6,7 +6,7 @@ .align 2 - byte: .byte 120,257 + byte: .byte 120,1 half: .half 34 word: .word -5678 string: .ascii "This is another string" @@ -36,10 +36,12 @@ main: lw $a0, word syscall - # print float - li $a0, 1.1 + # print int + li $a0, 1 syscall # string string lw $a0, string - syscall \ No newline at end of file + syscall + + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_002.out b/tests/arch/mips/correct/syscalls/test_mips_syscall_002.out deleted file mode 100644 index 396e1786f..000000000 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_002.out +++ /dev/null @@ -1,6 +0,0 @@ - -6673 --86.9739990234375 -1.100000023841858 -cr[PC]:0x34; ir[1,at]:0x3f8ccccd; ir[2,v0]:0x2; sfpr[f12]:0x3F8CCCCD; dfpr[FP12]:0x3F8CCCCD00000000; keyboard[0x0]:''; display[0x0]:'6673-86.97399902343751.100000023841858'; - diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_002.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_002.s index 2b6d4d4cb..3cadd0042 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_002.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_002.s @@ -15,4 +15,5 @@ main: li.s $f12, 1.1 syscall - \ No newline at end of file + + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_003.out b/tests/arch/mips/correct/syscalls/test_mips_syscall_003.out deleted file mode 100644 index 668c40ee9..000000000 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_003.out +++ /dev/null @@ -1,6 +0,0 @@ - -6673 --86.974 -1.1 -cr[PC]:0x58; ir[1,at]:0x3ff19999; ir[2,v0]:0x3; sfpr[f12]:0x3FF19999; sfpr[f13]:0x9999999A; dfpr[FP12]:0x3FF199999999999A; keyboard[0x0]:''; display[0x0]:'6673-86.9741.1'; - diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_003.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_003.s index aba6d1d2b..350992844 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_003.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_003.s @@ -15,4 +15,5 @@ main: li.d $FP12, 1.1 syscall - \ No newline at end of file + + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_004.out b/tests/arch/mips/correct/syscalls/test_mips_syscall_004.out deleted file mode 100644 index 448ffe1e3..000000000 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_004.out +++ /dev/null @@ -1,8 +0,0 @@ - -First String -Second Stringa -a - - -cr[PC]:0x40; ir[1,at]:0x20001a; ir[2,v0]:0xb; ir[4,a0]:0xa; keyboard[0x0]:''; display[0x0]:'First%20StringSecond%20Stringaa%0A'; - diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_004.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_004.s index de034a1ac..ea6263858 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_004.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_004.s @@ -26,3 +26,4 @@ main: li $v0, 11 syscall + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_005.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_005.s index 668534068..852bf8182 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_005.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_005.s @@ -6,4 +6,5 @@ .text main: li $v0, 5 - syscall \ No newline at end of file + syscall + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_006.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_006.s index ab013f90f..c81330dcd 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_006.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_006.s @@ -7,3 +7,4 @@ main: li $v0, 6 syscall + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_007.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_007.s index 88a7ae8a5..fa8a7fd0f 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_007.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_007.s @@ -7,4 +7,4 @@ main: li $v0, 7 syscall - \ No newline at end of file + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_008.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_008.s index c36f690b4..3faed0190 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_008.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_008.s @@ -14,4 +14,5 @@ li $v0, 8 la $a0, buffer li $a1, 5 - syscall \ No newline at end of file + syscall + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_009.out b/tests/arch/mips/correct/syscalls/test_mips_syscall_009.out deleted file mode 100644 index 92d352a61..000000000 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_009.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x1c; ir[2,v0]:0x5bbfcc0; ir[4,a0]:0x8; ir[8,t0]:0xa; ir[9,t1]:0x14; memory[0x5bbfcc7]:0x14; memory[0x5bbfcc3]:0x0a; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_009.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_009.s index 38676b338..1080464c5 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_009.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_009.s @@ -12,5 +12,11 @@ li $a0, 8 syscall - sw $t0, ($v0) - sw $t1, 4($v0) \ No newline at end of file + sw $t0, 0($v0) + sw $t1, 4($v0) + li $v0, 9 + syscall + + sw $t0, 0($v0) + sw $t1, 4($v0) + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_010.out b/tests/arch/mips/correct/syscalls/test_mips_syscall_010.out deleted file mode 100644 index 413fc0e89..000000000 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_010.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x8; ir[2,v0]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_010.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_010.s index c5b86634f..f2662a383 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_010.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_010.s @@ -8,3 +8,4 @@ li $v0, 10 syscall li $t0, 453 + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_011.out b/tests/arch/mips/correct/syscalls/test_mips_syscall_011.out deleted file mode 100644 index 78634f9ba..000000000 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_011.out +++ /dev/null @@ -1,4 +0,0 @@ - -c -cr[PC]:0xc; ir[2,v0]:0xb; ir[4,a0]:0x63; keyboard[0x0]:''; display[0x0]:'c'; - diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_011.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_011.s index 34f522d9c..231dd5e92 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_011.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_011.s @@ -8,3 +8,4 @@ li $v0, 11 li $a0, 'c' syscall + jr $ra diff --git a/tests/arch/mips/correct/syscalls/test_mips_syscall_012.s b/tests/arch/mips/correct/syscalls/test_mips_syscall_012.s index b58a811e1..dca4c5a81 100644 --- a/tests/arch/mips/correct/syscalls/test_mips_syscall_012.s +++ b/tests/arch/mips/correct/syscalls/test_mips_syscall_012.s @@ -3,7 +3,8 @@ # Creator (https://creatorsim.github.io/creator/) # -.text - main: +.text + main: li $v0, 12 - syscall \ No newline at end of file + syscall + jr $ra diff --git a/tests/arch/mips/error.test.mts b/tests/arch/mips/error.test.mts new file mode 100644 index 000000000..54d2a2a7e --- /dev/null +++ b/tests/arch/mips/error.test.mts @@ -0,0 +1,19 @@ +import { ARCH, execution_tests, compile_error_tests } from "../arch_utils.mts"; + +execution_tests( + ARCH.mips, + "mips/error/executor", + undefined, + new Set([ + "test_mips_error_executor_002.s", + "test_mips_error_executor_003.s", + "test_mips_error_executor_004.s", + "test_mips_error_executor_005.s", + "test_mips_error_executor_006.s", + "test_mips_error_executor_007.s", + "test_mips_error_executor_008.s", + "test_mips_error_executor_009.s", + ]), +); + +compile_error_tests(ARCH.mips, "mips/error/compiler") diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_001.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_001.out deleted file mode 100644 index d8f77e300..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_001.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 9 (A): -Repeated tag: A - - 8 a: .byte -1 -->9 A: .half 23 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_002.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_002.out deleted file mode 100644 index 18b3b2fc0..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_002.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 12 (suma): -Instruction 'suma' not found - - 11 main: -->12 suma $t0, $t1, $t2 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_003.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_003.out deleted file mode 100644 index cbf7e3143..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_003.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 12 (add $reg3 $reg2 $reg1): -Incorrect instruction syntax for 'add $reg3 $reg2 $reg1' - - 11 main: -->12 add 25, $t1, 12 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_004.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_004.out deleted file mode 100644 index 639433294..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_004.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 12 (s50): -Register 's50' not found - - 11 main: -->12 add $t0, $t1, $s50 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_005.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_005.out deleted file mode 100644 index 8a51b1caa..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_005.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (0x123): -Number '0x123' is too big - - 6 .data -->7 a: .byte 0x123 - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_006.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_006.out deleted file mode 100644 index 8a51b1caa..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_006.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (0x123): -Number '0x123' is too big - - 6 .data -->7 a: .byte 0x123 - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_007.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_007.out deleted file mode 100644 index d181ef242..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_007.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 11 (mains): -Tag 'mains' is not valid - - 10 li $t0, 10 -->11 j mains - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_008.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_008.out deleted file mode 100644 index 1a1fa1532..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_008.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 8: -Please check instruction syntax, inmediate ranges, register name, etc. - - 7 main: -->8 j 0x12345678 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_009.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_009.out deleted file mode 100644 index b902b990c..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_009.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 8 (0xhello): -Immediate number '0xhello' is not valid - - 7 main: -->8 j 0xhello - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_010.s b/tests/arch/mips/error/compiler/test_mips_error_compiler_010.s index 94af4567c..975b26a38 100644 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_010.s +++ b/tests/arch/mips/error/compiler/test_mips_error_compiler_010.s @@ -5,8 +5,8 @@ .data .align 2 - spa: .space 52428800 + spa: .space 16 * 1024 * 1024 * 1024 .text main: - li $t0, 10 \ No newline at end of file + li $t0, 10 diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_014.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_014.out deleted file mode 100644 index a4744db4d..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_014.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 8 (.directive): -Invalid directive: .directive - - 7 .align 2 -->8 example: .directive 221 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_015.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_015.out deleted file mode 100644 index 691cbf761..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_015.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 8 (hello): -Invalid value 'hello' as number. - - 7 .align 2 -->8 example: .word hello - 9 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_016.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_016.out deleted file mode 100644 index 16bbdbcf2..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_016.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 8: -The string of characters must start with " - - 7 .align 2 -->8 example: .ascii hello world" - 9 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_017.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_017.out deleted file mode 100644 index 252b00265..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_017.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 8: -The string of characters must end with " - - 7 .align 2 -->8 example: .ascii "hello world - 9 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_018.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_018.out deleted file mode 100644 index 89c84b0f2..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_018.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (0x12345): -Number '0x12345' is too big - - 6 .data -->7 example: .half 0x12345 - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_018.s b/tests/arch/mips/error/compiler/test_mips_error_compiler_018.s index ee62c630c..8f6025dc4 100644 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_018.s +++ b/tests/arch/mips/error/compiler/test_mips_error_compiler_018.s @@ -5,4 +5,5 @@ .data example: .half 0x12345 - +.text +main: nop diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_019.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_019.out deleted file mode 100644 index d1dc21973..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_019.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (0x): -Number '0x' is empty - - 6 .data -->7 .byte 0x - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_021.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_021.out deleted file mode 100644 index 35a2ef06c..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_021.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 9: -The data must be aligned - - 8 example: .byte 23 -->9 example2: .half 2 - 10 string: .asciiz "hello" - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_022.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_022.out deleted file mode 100644 index 780eee03b..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_022.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (-10): -The space directive value should be positive and greater than zero - - 6 .data -->7 .space -10 - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_023.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_023.out deleted file mode 100644 index a99e652c7..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_023.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 10: -Empty directive - - 9 example2: .half -->10 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_030.out b/tests/arch/mips/error/compiler/test_mips_error_compiler_030.out deleted file mode 100644 index e7ae53a33..000000000 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_030.out +++ /dev/null @@ -1,10 +0,0 @@ - - -Error at line 1 (Please enter the assembly code before compiling): -Please enter the assembly code before compiling - -->1 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/compiler/test_mips_error_compiler_030.s b/tests/arch/mips/error/compiler/test_mips_error_compiler_030.s index e69de29bb..6ad952bf9 100644 --- a/tests/arch/mips/error/compiler/test_mips_error_compiler_030.s +++ b/tests/arch/mips/error/compiler/test_mips_error_compiler_030.s @@ -0,0 +1,8 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text +main_: + li $t0, 10 diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_001.out b/tests/arch/mips/error/executor/test_mips_error_executor_001.out deleted file mode 100644 index 5c4077cc1..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_001.out +++ /dev/null @@ -1,6 +0,0 @@ - - - Error found. - No instructions in memory -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_001.s b/tests/arch/mips/error/executor/test_mips_error_executor_001.s deleted file mode 100644 index fe029decf..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_001.s +++ /dev/null @@ -1,6 +0,0 @@ - -# -# Creator (https://creatorsim.github.io/creator/) -# - -.text diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_002.out b/tests/arch/mips/error/executor/test_mips_error_executor_002.out deleted file mode 100644 index 0719a3681..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_002.out +++ /dev/null @@ -1,6 +0,0 @@ - - - Error found. - Label "main" not found -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_002.s b/tests/arch/mips/error/executor/test_mips_error_executor_002.s index 6ad952bf9..98f743490 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_002.s +++ b/tests/arch/mips/error/executor/test_mips_error_executor_002.s @@ -4,5 +4,6 @@ # .text -main_: - li $t0, 10 +main: + li $sp, 0xffffffff + jr $ra diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_003.out b/tests/arch/mips/error/executor/test_mips_error_executor_003.out deleted file mode 100644 index 55840b182..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_003.out +++ /dev/null @@ -1,6 +0,0 @@ - - - Error found. - Stack pointer cannot be placed in the text segment -cr[PC]:0x4; ir[29,sp]:0x0; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_003.s b/tests/arch/mips/error/executor/test_mips_error_executor_003.s index b481c85ad..f85c4419d 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_003.s +++ b/tests/arch/mips/error/executor/test_mips_error_executor_003.s @@ -6,3 +6,4 @@ .text main: li $sp, 0 + jr $ra diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_004.out b/tests/arch/mips/error/executor/test_mips_error_executor_004.out deleted file mode 100644 index 64d1a4355..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_004.out +++ /dev/null @@ -1,6 +0,0 @@ - - - Error found. - Stack pointer cannot be placed in the data segment -cr[PC]:0xc; ir[1,at]:0x200000; ir[29,sp]:0x200000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_004.s b/tests/arch/mips/error/executor/test_mips_error_executor_004.s index 63eea2c51..7d4666d73 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_004.s +++ b/tests/arch/mips/error/executor/test_mips_error_executor_004.s @@ -6,3 +6,4 @@ .text main: li $sp, 0x00200000 + jr $ra diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_005.out b/tests/arch/mips/error/executor/test_mips_error_executor_005.out deleted file mode 100644 index 6a1c963ae..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_005.out +++ /dev/null @@ -1,7 +0,0 @@ - -Segmentation fault. You tried to write in the text segment - - Error found. - The program has finished with errors -cr[PC]:0x8; ir[8,t0]:0xa; memory[0x3]:0x0a; memory[0x1]:0x00; memory[0x0]:0x00; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_005.s b/tests/arch/mips/error/executor/test_mips_error_executor_005.s index 2b34bfa8e..4295fb47b 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_005.s +++ b/tests/arch/mips/error/executor/test_mips_error_executor_005.s @@ -7,4 +7,5 @@ main: li $t0, 10 - sw $t0, 0 \ No newline at end of file + sw $t0, 0 + jr $ra diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_006.out b/tests/arch/mips/error/executor/test_mips_error_executor_006.out deleted file mode 100644 index 04b86e53d..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_006.out +++ /dev/null @@ -1,7 +0,0 @@ - -Segmentation fault. You tried to read in the text segment - - Error found. - The program has finished with errors -cr[PC]:0x8; ir[8,t0]:0x2008000a; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_006.s b/tests/arch/mips/error/executor/test_mips_error_executor_006.s index b71603663..f5ac66fb0 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_006.s +++ b/tests/arch/mips/error/executor/test_mips_error_executor_006.s @@ -7,4 +7,5 @@ main: li $t0, 10 - lw $t0, 0 \ No newline at end of file + lw $t0, 0 + jr $ra diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_007.out b/tests/arch/mips/error/executor/test_mips_error_executor_007.out deleted file mode 100644 index a2bde039a..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_007.out +++ /dev/null @@ -1,7 +0,0 @@ - -The memory must be align - - Error found. - The program has finished with errors -cr[PC]:0x14; ir[1,at]:0x200000; ir[8,t0]:0x200000; ir[9,t1]:0xa; memory[0x200004]:0x0a; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_007.s b/tests/arch/mips/error/executor/test_mips_error_executor_007.s index d7dc6f383..ac6904039 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_007.s +++ b/tests/arch/mips/error/executor/test_mips_error_executor_007.s @@ -11,4 +11,5 @@ main: la $t0, a li $t1, 10 - sw $t1, 1($t0) \ No newline at end of file + sw $t1, 1($t0) + jr $ra diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_008.out b/tests/arch/mips/error/executor/test_mips_error_executor_008.out deleted file mode 100644 index 0fe23d1da..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_008.out +++ /dev/null @@ -1,7 +0,0 @@ - -The memory must be align - - Error found. - The program has finished with errors -cr[PC]:0x14; ir[1,at]:0x200000; ir[8,t0]:0x200000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_008.s b/tests/arch/mips/error/executor/test_mips_error_executor_008.s index aa287ad80..c16028e5f 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_008.s +++ b/tests/arch/mips/error/executor/test_mips_error_executor_008.s @@ -11,4 +11,5 @@ main: la $t0, a li $t1, 10 - lw $t1, 1($t0) \ No newline at end of file + lw $t1, 1($t0) + jr $ra diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_009.out b/tests/arch/mips/error/executor/test_mips_error_executor_009.out deleted file mode 100644 index 4250e5e73..000000000 --- a/tests/arch/mips/error/executor/test_mips_error_executor_009.out +++ /dev/null @@ -1,6 +0,0 @@ - - - Error found. - The register 0 | zero cannot be written -cr[PC]:0x4; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/error/executor/test_mips_error_executor_009.s b/tests/arch/mips/error/executor/test_mips_error_executor_009.s index f9fb1b439..3fece1246 100644 --- a/tests/arch/mips/error/executor/test_mips_error_executor_009.s +++ b/tests/arch/mips/error/executor/test_mips_error_executor_009.s @@ -6,4 +6,5 @@ .text main: - li $zero, 10 \ No newline at end of file + li $zero, 10 + jr $ra diff --git a/tests/arch/mips/instructions.test.mts b/tests/arch/mips/instructions.test.mts new file mode 100644 index 000000000..426b2d941 --- /dev/null +++ b/tests/arch/mips/instructions.test.mts @@ -0,0 +1,8 @@ +import { ARCH, execution_tests } from "../arch_utils.mts"; + +execution_tests( + ARCH.mips, + "mips/instructions", + undefined, + new Set(["test_mips_instruction_058.s", "test_mips_instruction_064.s"]), +); diff --git a/tests/arch/mips/instructions/test_mips_instruction_001.out b/tests/arch/mips/instructions/test_mips_instruction_001.out deleted file mode 100644 index 900b4d789..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_001.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[1,at]:0xffffffe2; ir[8,t0]:0xa; ir[9,t1]:0xffffffe2; ir[11,t3]:0x12; ir[12,t4]:0xffffffec; ir[13,t5]:0xffffffe2; ir[14,t6]:0x12; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_001.s b/tests/arch/mips/instructions/test_mips_instruction_001.s index d87d151cd..1a78a7d75 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_001.s +++ b/tests/arch/mips/instructions/test_mips_instruction_001.s @@ -13,4 +13,6 @@ main: add $t4, $t0, $t1 add $t5, $t1, $t2 - add $t6, $t2, $t3 \ No newline at end of file + add $t6, $t2, $t3 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_002.out b/tests/arch/mips/instructions/test_mips_instruction_002.out deleted file mode 100644 index db1062c53..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_002.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[8,t0]:0xa; ir[9,t1]:0xffffffec; ir[10,t2]:0x187; ir[11,t3]:0x193; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_002.s b/tests/arch/mips/instructions/test_mips_instruction_002.s index 2b6b6ab14..b86067357 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_002.s +++ b/tests/arch/mips/instructions/test_mips_instruction_002.s @@ -9,3 +9,5 @@ main: addi $t1, $t0, -30 # 10 - 30 addi $t2, $t1, 411 # x9 + 411 addi $t3, $t2, 12 # x10 - 12 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_003.out b/tests/arch/mips/instructions/test_mips_instruction_003.out deleted file mode 100644 index bacd4ab5c..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_003.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x2c; ir[1,at]:0x123515; ir[8,t0]:0x223; ir[9,t1]:0xfffffc57; ir[10,t2]:0xc; ir[11,t3]:0x123515; ir[12,t4]:0x5cc; ir[13,t5]:0xfffffa40; ir[14,t6]:0x123ad5; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_003.s b/tests/arch/mips/instructions/test_mips_instruction_003.s index 8be9b6661..ec09e2523 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_003.s +++ b/tests/arch/mips/instructions/test_mips_instruction_003.s @@ -13,4 +13,6 @@ main: sub $t4, $t0, $t1 sub $t5, $t2, $t4 - sub $t6, $t3, $t5 \ No newline at end of file + sub $t6, $t3, $t5 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_004.out b/tests/arch/mips/instructions/test_mips_instruction_004.out deleted file mode 100644 index 57115dae6..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_004.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[8,t0]:0x230000; ir[14,t6]:0x56db0000; ir[15,t7]:0x340000; ir[24,t8]:0xff00000; ir[25,t9]:0x20000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_004.s b/tests/arch/mips/instructions/test_mips_instruction_004.s index 638557b1b..5de59e58b 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_004.s +++ b/tests/arch/mips/instructions/test_mips_instruction_004.s @@ -10,4 +10,6 @@ main: lui $t6, 22235 lui $t7, 0x34 lui $t8, 0xFF0 - lui $t9, 2 \ No newline at end of file + lui $t9, 2 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_005.out b/tests/arch/mips/instructions/test_mips_instruction_005.out deleted file mode 100644 index 20e66e4df..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_005.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x38; ir[1,at]:0x123515; ir[4,a0]:0xa; ir[13,t5]:0x223; ir[14,t6]:0xfffffc57; ir[15,t7]:0xc; ir[24,t8]:0x123515; ir[31,ra]:0x24; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_005.s b/tests/arch/mips/instructions/test_mips_instruction_005.s index a1a50a895..db66cdc7c 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_005.s +++ b/tests/arch/mips/instructions/test_mips_instruction_005.s @@ -18,5 +18,5 @@ main: sub $s2, $t8, $s1 end: - li $a0, 10 - syscall \ No newline at end of file + li $v0, 10 + syscall diff --git a/tests/arch/mips/instructions/test_mips_instruction_006.out b/tests/arch/mips/instructions/test_mips_instruction_006.out deleted file mode 100644 index 46acb6292..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_006.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x3c; ir[1,at]:0x123515; ir[4,a0]:0xa; ir[8,t0]:0x223; ir[9,t1]:0xfffffc57; ir[10,t2]:0xc; ir[11,t3]:0x123515; ir[12,t4]:0x28; ir[24,t8]:0x34; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_006.s b/tests/arch/mips/instructions/test_mips_instruction_006.s index d71724420..872dca943 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_006.s +++ b/tests/arch/mips/instructions/test_mips_instruction_006.s @@ -19,5 +19,5 @@ main: sub $t7, $t3, $t4 end: - li $a0, 10 - syscall \ No newline at end of file + li $v0, 10 + syscall diff --git a/tests/arch/mips/instructions/test_mips_instruction_007.out b/tests/arch/mips/instructions/test_mips_instruction_007.out deleted file mode 100644 index 68d7ecac0..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_007.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[1,at]:0x44562; ir[2,v0]:0xa; ir[8,t0]:0x44562; ir[9,t1]:0x2; ir[10,t2]:0x5; ir[11,t3]:0x44562; ir[12,t4]:0xb; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_007.s b/tests/arch/mips/instructions/test_mips_instruction_007.s index f7669e2c0..20c750789 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_007.s +++ b/tests/arch/mips/instructions/test_mips_instruction_007.s @@ -5,19 +5,30 @@ .text main: - li $t0, 0x44562 - li $t1, 2 - li $t2, 5 - li $t3, 0x44562 - beq $t2, $t0, jump1 - beq $t0, $t3, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + beq $s0, $s0, j0 + li $t0, 1 +j0: beq $s0, $s1, j1 + li $t1, 1 +j1: beq $s1, $s0, j2 + li $t2, 1 +j2: beq $s2, $s2, j3 + li $t3, 1 +j3: beq $s2, $s3, j4 + li $t4, 1 +j4: beq $s3, $s2, j5 + li $t5, 1 +j5: beq $s0, $s2, j6 + li $t6, 1 +j6: beq $s2, $s0, j7 + li $t7, 1 +j7: beq $s1, $s3, j8 + li $t8, 1 +j8: beq $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 11 - li $t5, 555 - beq $t0, $t0, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_008.out b/tests/arch/mips/instructions/test_mips_instruction_008.out deleted file mode 100644 index 0528e6b1e..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_008.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 8 (li $rd val): -Incorrect instruction syntax for 'li $rd val' - - 7 main: -->8 li x5, 361 - 9 li x6, 2 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_008.s b/tests/arch/mips/instructions/test_mips_instruction_008.s index 4166e27fd..d9f9b6771 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_008.s +++ b/tests/arch/mips/instructions/test_mips_instruction_008.s @@ -5,18 +5,30 @@ .text main: - li x5, 361 - li x6, 2 - li x7, 5 - li x8, 0x44562 - bne x5, x7, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + bne $s0, $s0, j0 + li $t0, 1 +j0: bne $s0, $s1, j1 + li $t1, 1 +j1: bne $s1, $s0, j2 + li $t2, 1 +j2: bne $s2, $s2, j3 + li $t3, 1 +j3: bne $s2, $s3, j4 + li $t4, 1 +j4: bne $s3, $s2, j5 + li $t5, 1 +j5: bne $s0, $s2, j6 + li $t6, 1 +j6: bne $s2, $s0, j7 + li $t7, 1 +j7: bne $s1, $s3, j8 + li $t8, 1 +j8: bne $s3, $s1, end + li $t9, 1 - jump1: - li x5, 0x754 - li x6, 555 - bne x5, x6, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_009.out b/tests/arch/mips/instructions/test_mips_instruction_009.out deleted file mode 100644 index cbaa6cb41..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_009.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[1,at]:0x1; ir[2,v0]:0xa; ir[8,t0]:0x169; ir[9,t1]:0x2; ir[10,t2]:0x5; ir[11,t3]:0x44562; ir[12,t4]:0xb; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_009.s b/tests/arch/mips/instructions/test_mips_instruction_009.s index 1db9d8bf7..0a9abf99c 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_009.s +++ b/tests/arch/mips/instructions/test_mips_instruction_009.s @@ -5,19 +5,30 @@ .text main: - li $t0, 361 - li $t1, 2 - li $t2, 5 - li $t3, 0x44562 - blt $t0, $t2, jump1 - blt $t1, $t0, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + blt $s0, $s0, j0 + li $t0, 1 +j0: blt $s0, $s1, j1 + li $t1, 1 +j1: blt $s1, $s0, j2 + li $t2, 1 +j2: blt $s2, $s2, j3 + li $t3, 1 +j3: blt $s2, $s3, j4 + li $t4, 1 +j4: blt $s3, $s2, j5 + li $t5, 1 +j5: blt $s0, $s2, j6 + li $t6, 1 +j6: blt $s2, $s0, j7 + li $t7, 1 +j7: blt $s1, $s3, j8 + li $t8, 1 +j8: blt $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 11 - li $t5, 555 - blt $t4, $t5, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_010.out b/tests/arch/mips/instructions/test_mips_instruction_010.out deleted file mode 100644 index d969fee5e..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_010.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[2,v0]:0xa; ir[8,t0]:0x169; ir[9,t1]:0x2; ir[10,t2]:0x5; ir[11,t3]:0x44562; ir[12,t4]:0x754; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_010.s b/tests/arch/mips/instructions/test_mips_instruction_010.s index 0340eec1a..e8fd815f5 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_010.s +++ b/tests/arch/mips/instructions/test_mips_instruction_010.s @@ -5,19 +5,30 @@ .text main: - li $t0, 361 - li $t1, 2 - li $t2, 5 - li $t3, 0x44562 - bge $t0, $t3, jump1 - bge $t3, $t0, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bge $s0, $s0, j0 + li $t0, 1 +j0: bge $s0, $s1, j1 + li $t1, 1 +j1: bge $s1, $s0, j2 + li $t2, 1 +j2: bge $s2, $s2, j3 + li $t3, 1 +j3: bge $s2, $s3, j4 + li $t4, 1 +j4: bge $s3, $s2, j5 + li $t5, 1 +j5: bge $s0, $s2, j6 + li $t6, 1 +j6: bge $s2, $s0, j7 + li $t7, 1 +j7: bge $s1, $s3, j8 + li $t8, 1 +j8: bge $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 0x754 - li $t5, 555 - bge $t4, $t5, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_011.out b/tests/arch/mips/instructions/test_mips_instruction_011.out deleted file mode 100644 index 6b9821a08..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_011.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[1,at]:0x1; ir[2,v0]:0xa; ir[8,t0]:0x169; ir[9,t1]:0x2; ir[10,t2]:0x5; ir[11,t3]:0x44562; ir[12,t4]:0x754; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_011.s b/tests/arch/mips/instructions/test_mips_instruction_011.s index a12ad0d9b..ab3b572c4 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_011.s +++ b/tests/arch/mips/instructions/test_mips_instruction_011.s @@ -5,19 +5,30 @@ .text main: - li $t0, 361 - li $t1, 2 - li $t2, 5 - li $t3, 0x44562 - bltu $t0, $t2, jump1 - bltu $t1, $t0, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bltu $s0, $s0, j0 + li $t0, 1 +j0: bltu $s0, $s1, j1 + li $t1, 1 +j1: bltu $s1, $s0, j2 + li $t2, 1 +j2: bltu $s2, $s2, j3 + li $t3, 1 +j3: bltu $s2, $s3, j4 + li $t4, 1 +j4: bltu $s3, $s2, j5 + li $t5, 1 +j5: bltu $s0, $s2, j6 + li $t6, 1 +j6: bltu $s2, $s0, j7 + li $t7, 1 +j7: bltu $s1, $s3, j8 + li $t8, 1 +j8: bltu $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 0x754 - li $t5, 555 - bltu $t5, $t4, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_012.out b/tests/arch/mips/instructions/test_mips_instruction_012.out deleted file mode 100644 index d969fee5e..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_012.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[2,v0]:0xa; ir[8,t0]:0x169; ir[9,t1]:0x2; ir[10,t2]:0x5; ir[11,t3]:0x44562; ir[12,t4]:0x754; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_012.s b/tests/arch/mips/instructions/test_mips_instruction_012.s index e6cecd784..1d1e51304 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_012.s +++ b/tests/arch/mips/instructions/test_mips_instruction_012.s @@ -5,19 +5,30 @@ .text main: - li $t0, 361 - li $t1, 2 - li $t2, 5 - li $t3, 0x44562 - bgeu $t0, $t3, jump1 - bgeu $t3, $t2, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bgeu $s0, $s0, j0 + li $t0, 1 +j0: bgeu $s0, $s1, j1 + li $t1, 1 +j1: bgeu $s1, $s0, j2 + li $t2, 1 +j2: bgeu $s2, $s2, j3 + li $t3, 1 +j3: bgeu $s2, $s3, j4 + li $t4, 1 +j4: bgeu $s3, $s2, j5 + li $t5, 1 +j5: bgeu $s0, $s2, j6 + li $t6, 1 +j6: bgeu $s2, $s0, j7 + li $t7, 1 +j7: bgeu $s1, $s3, j8 + li $t8, 1 +j8: bgeu $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 0x754 - li $t5, 555 - bgeu $t4, $t5, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_013.out b/tests/arch/mips/instructions/test_mips_instruction_013.out deleted file mode 100644 index ca3e7acd1..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_013.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x84; ir[1,at]:0x20000e; ir[8,t0]:0x200000; ir[9,t1]:0x200004; ir[10,t2]:0x200006; ir[11,t3]:0xe; ir[12,t4]:0xe; ir[13,t5]:0x7f; ir[14,t6]:0x7f; ir[15,t7]:0x7fff; ir[24,t8]:0x7fff; ir[25,t9]:0x20000e; memory[0x20000f]:0xff; memory[0x20000e]:0x7f; memory[0x20000c]:0x7f; memory[0x20000b]:0x0e; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_013.s b/tests/arch/mips/instructions/test_mips_instruction_013.s index 1a671a08a..255a08455 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_013.s +++ b/tests/arch/mips/instructions/test_mips_instruction_013.s @@ -5,15 +5,16 @@ .data w1: .word 14 - b1: .byte 127 + b1: .byte 127, -42 .align 1 - h1: .half 32767 + h1: .half 32767, -12345 + .align 2 w2: .space 4 - b2: .space 1 + b2: .space 2 .align 1 - h2: .space 2 + h2: .space 4 .text main: @@ -27,15 +28,23 @@ main: lb $t5, 0($t1) lbu $t6, b1 + lb $s0, 1($t1) + lbu $s1, b1 + 1 lh $t7, 0($t2) lhu $t8, h1 + lh $s2, 2($t2) + lhu $s3, h1 + 2 la $t9, w2 sw $t3, 0($t9) la $t9, b2 sb $t5, 0($t9) + sb $s0, 1($t9) la $t9, h2 sh $t7, 0($t9) + sh $s2, 2($t9) + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_014.out b/tests/arch/mips/instructions/test_mips_instruction_014.out deleted file mode 100644 index 6b1659aaf..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_014.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x40; ir[1,at]:0x200006; ir[8,t0]:0x200000; ir[9,t1]:0x200002; ir[10,t2]:0x7f; ir[11,t3]:0xffff; ir[12,t4]:0x200004; ir[14,t6]:0x200006; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_014.s b/tests/arch/mips/instructions/test_mips_instruction_014.s index 8b2c9dbbf..80178d397 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_014.s +++ b/tests/arch/mips/instructions/test_mips_instruction_014.s @@ -4,13 +4,14 @@ # .data - b1: .byte 127 + b1: .byte 127, -42 .align 1 - h1: .half 65535 - b2: .space 1 + h1: .half 32767, -12345 + .align 2 + b2: .space 2 .align 1 - h2: .space 2 + h2: .space 4 .text main: @@ -19,10 +20,16 @@ main: la $t1, h1 lbu $t2, 0($t0) + lbu $s0, 1($t0) lhu $t3, 0($t1) + lhu $s1, 2($t1) la $t4, b2 - sb $t5, 0($t4) + sb $t2, 0($t4) + sb $s0, 1($t4) la $t6, h2 - sh $t7, 0($t6) + sh $t3, 0($t6) + sh $s1, 2($t6) + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_015.out b/tests/arch/mips/instructions/test_mips_instruction_015.out deleted file mode 100644 index 59829a8d8..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_015.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[1,at]:0xfffffc00; ir[8,t0]:0x2f0; ir[11,t3]:0x1; ir[12,t4]:0x1; ir[13,t5]:0xfffffc00; ir[24,t8]:0x1; ir[25,t9]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_015.s b/tests/arch/mips/instructions/test_mips_instruction_015.s index c9c855656..06cf9cea7 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_015.s +++ b/tests/arch/mips/instructions/test_mips_instruction_015.s @@ -17,3 +17,5 @@ main: slti $t7, $t5, -1024 slti $t8, $t5, -1023 slti $t9, $t5, -1022 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_016.out b/tests/arch/mips/instructions/test_mips_instruction_016.out deleted file mode 100644 index 59829a8d8..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_016.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[1,at]:0xfffffc00; ir[8,t0]:0x2f0; ir[11,t3]:0x1; ir[12,t4]:0x1; ir[13,t5]:0xfffffc00; ir[24,t8]:0x1; ir[25,t9]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_016.s b/tests/arch/mips/instructions/test_mips_instruction_016.s index 18931a363..8797f2a56 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_016.s +++ b/tests/arch/mips/instructions/test_mips_instruction_016.s @@ -17,3 +17,5 @@ main: sltiu $t7, $t5, -1024 sltiu $t8, $t5, -1023 sltiu $t9, $t5, -1022 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_017.out b/tests/arch/mips/instructions/test_mips_instruction_017.out deleted file mode 100644 index 8f3ec36ae..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_017.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xffffdaf2; ir[8,t0]:0x22346; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x22713; ir[12,t4]:0x13f5; ir[13,t5]:0xffffd50d; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_017.s b/tests/arch/mips/instructions/test_mips_instruction_017.s index c558df997..0f16a6129 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_017.s +++ b/tests/arch/mips/instructions/test_mips_instruction_017.s @@ -14,3 +14,4 @@ main: xori $t4, $t1, 0x222 xori $t5, $t2, 0xFFF + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_018.out b/tests/arch/mips/instructions/test_mips_instruction_018.out deleted file mode 100644 index e4fa60c7e..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_018.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xffffdaf2; ir[8,t0]:0x22346; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x22757; ir[12,t4]:0x13f7; ir[13,t5]:0xffffdfff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_018.s b/tests/arch/mips/instructions/test_mips_instruction_018.s index 187350c05..d9100a7b6 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_018.s +++ b/tests/arch/mips/instructions/test_mips_instruction_018.s @@ -13,3 +13,5 @@ main: ori $t3, $t0, 0x455 ori $t4, $t1, 0x222 ori $t5, $t2, 0xFFF + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_019.out b/tests/arch/mips/instructions/test_mips_instruction_019.out deleted file mode 100644 index 7b376001e..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_019.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xffffdaf2; ir[8,t0]:0x22346; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x44; ir[12,t4]:0x2; ir[13,t5]:0xaf2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_019.s b/tests/arch/mips/instructions/test_mips_instruction_019.s index 6c48b4a04..2303680d0 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_019.s +++ b/tests/arch/mips/instructions/test_mips_instruction_019.s @@ -13,4 +13,5 @@ main: andi $t3, $t0, 0x455 andi $t4, $t1, 0x222 andi $t5, $t2, 0xFFF - + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_020.out b/tests/arch/mips/instructions/test_mips_instruction_020.out deleted file mode 100644 index dad0761ad..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_020.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; cr[HI]:0x18; ir[1,at]:0xffffe000; ir[8,t0]:0x10; ir[9,t1]:0x100; ir[10,t2]:0xffffe000; ir[11,t3]:0x18; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_020.s b/tests/arch/mips/instructions/test_mips_instruction_020.s index 614f46890..7d6dde0cd 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_020.s +++ b/tests/arch/mips/instructions/test_mips_instruction_020.s @@ -12,6 +12,14 @@ main: li $t3, 24 div $t2, $t0 + mfhi $s0 + mflo $s1 div $t1, $t0 + mfhi $s2 + mflo $s3 div $t2, $t3 + mfhi $s4 + mflo $s5 div $t3, $t2 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_021.out b/tests/arch/mips/instructions/test_mips_instruction_021.out deleted file mode 100644 index dad0761ad..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_021.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; cr[HI]:0x18; ir[1,at]:0xffffe000; ir[8,t0]:0x10; ir[9,t1]:0x100; ir[10,t2]:0xffffe000; ir[11,t3]:0x18; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_021.s b/tests/arch/mips/instructions/test_mips_instruction_021.s index a23893e7b..e2bc6996f 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_021.s +++ b/tests/arch/mips/instructions/test_mips_instruction_021.s @@ -12,6 +12,14 @@ main: li $t3, 24 divu $t2, $t0 + mfhi $s0 + mflo $s1 divu $t1, $t0 + mfhi $s2 + mflo $s3 divu $t2, $t3 + mfhi $s4 + mflo $s5 divu $t3, $t2 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_022.out b/tests/arch/mips/instructions/test_mips_instruction_022.out deleted file mode 100644 index f99b8375d..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_022.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[1,at]:0xffffdaf2; ir[8,t0]:0xaad4; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x2ab5; ir[12,t4]:0x7000011d; ir[13,t5]:0xb5e5ffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_022.s b/tests/arch/mips/instructions/test_mips_instruction_022.s index ce58bf55f..6891c41de 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_022.s +++ b/tests/arch/mips/instructions/test_mips_instruction_022.s @@ -13,3 +13,5 @@ main: rotr $t3, $t0, 2 rotr $t4, $t1, 4 rotr $t5, $t2, 15 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_023.out b/tests/arch/mips/instructions/test_mips_instruction_023.out deleted file mode 100644 index 17e3993e1..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_023.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[1,at]:0xffffdaf2; ir[8,t0]:0xaad4; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x2ab50; ir[12,t4]:0x11d70; ir[13,t5]:0xed790000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_023.s b/tests/arch/mips/instructions/test_mips_instruction_023.s index faf899208..901e7d0a8 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_023.s +++ b/tests/arch/mips/instructions/test_mips_instruction_023.s @@ -13,3 +13,5 @@ main: sll $t3, $t0, 2 sll $t4, $t1, 4 sll $t5, $t2, 15 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_024.out b/tests/arch/mips/instructions/test_mips_instruction_024.out deleted file mode 100644 index 6fb5b5912..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_024.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[8,t0]:0x1fff; ir[9,t1]:0x2000; ir[10,t2]:0x2001; ir[11,t3]:0x2002; ir[14,t6]:0x1; ir[15,t7]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_024.s b/tests/arch/mips/instructions/test_mips_instruction_024.s index 61f93bcc6..bab810e37 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_024.s +++ b/tests/arch/mips/instructions/test_mips_instruction_024.s @@ -15,4 +15,5 @@ main: slt $t5, $t1, $t1 slt $t6, $t1, $t2 slt $t7, $t1, $t3 - + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_025.out b/tests/arch/mips/instructions/test_mips_instruction_025.out deleted file mode 100644 index 6fb5b5912..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_025.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[8,t0]:0x1fff; ir[9,t1]:0x2000; ir[10,t2]:0x2001; ir[11,t3]:0x2002; ir[14,t6]:0x1; ir[15,t7]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_025.s b/tests/arch/mips/instructions/test_mips_instruction_025.s index 108210861..8e95e7cac 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_025.s +++ b/tests/arch/mips/instructions/test_mips_instruction_025.s @@ -15,3 +15,5 @@ sltu $t4, $t1, $t0 sltu $t5, $t1, $t1 sltu $t6, $t1, $t2 sltu $t7, $t1, $t3 + +jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_026.out b/tests/arch/mips/instructions/test_mips_instruction_026.out deleted file mode 100644 index 66db93488..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_026.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[1,at]:0xffffdaf2; ir[8,t0]:0x22346; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x455; ir[12,t4]:0x222; ir[13,t5]:0xfff; ir[14,t6]:0x22713; ir[15,t7]:0x13f5; ir[24,t8]:0xffffd50d; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_026.s b/tests/arch/mips/instructions/test_mips_instruction_026.s index 791c9e161..469709e5c 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_026.s +++ b/tests/arch/mips/instructions/test_mips_instruction_026.s @@ -17,4 +17,5 @@ main: xor $t6, $t0, $t3 xor $t7, $t1, $t4 xor $t8, $t2, $t5 - + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_027.out b/tests/arch/mips/instructions/test_mips_instruction_027.out deleted file mode 100644 index 82a1d683e..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_027.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[1,at]:0xffffdaf2; ir[8,t0]:0xaad4; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x2ab5; ir[12,t4]:0x11d; ir[13,t5]:0x1ffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_027.s b/tests/arch/mips/instructions/test_mips_instruction_027.s index af90b6329..1e65511ce 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_027.s +++ b/tests/arch/mips/instructions/test_mips_instruction_027.s @@ -13,3 +13,5 @@ main: srl $t3, $t0, 2 srl $t4, $t1, 4 srl $t5, $t2, 15 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_028.out b/tests/arch/mips/instructions/test_mips_instruction_028.out deleted file mode 100644 index 4a38129f0..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_028.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[1,at]:0xffffdaf2; ir[8,t0]:0xaad4; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x2ab5; ir[12,t4]:0x11d; ir[13,t5]:0xffffffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_028.s b/tests/arch/mips/instructions/test_mips_instruction_028.s index 6dbd5b035..57030738d 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_028.s +++ b/tests/arch/mips/instructions/test_mips_instruction_028.s @@ -13,3 +13,5 @@ main: sra $t3, $t0, 2 sra $t4, $t1, 4 sra $t5, $t2, 15 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_029.out b/tests/arch/mips/instructions/test_mips_instruction_029.out deleted file mode 100644 index e5a99869f..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_029.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[1,at]:0xffffdaf2; ir[8,t0]:0x22346; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x455; ir[12,t4]:0x222; ir[13,t5]:0xfff; ir[14,t6]:0x22757; ir[15,t7]:0x13f7; ir[24,t8]:0xffffdfff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_029.s b/tests/arch/mips/instructions/test_mips_instruction_029.s index 7103732ef..902d0f24d 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_029.s +++ b/tests/arch/mips/instructions/test_mips_instruction_029.s @@ -17,4 +17,5 @@ main: or $t6, $t0, $t3 or $t7, $t1, $t4 or $t8, $t2, $t5 - + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_030.out b/tests/arch/mips/instructions/test_mips_instruction_030.out deleted file mode 100644 index 282f5d001..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_030.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[1,at]:0xffffdaf2; ir[8,t0]:0x22346; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0x455; ir[12,t4]:0x222; ir[13,t5]:0xfff; ir[14,t6]:0x44; ir[15,t7]:0x2; ir[24,t8]:0xaf2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_030.s b/tests/arch/mips/instructions/test_mips_instruction_030.s index 1eff71284..e349a870f 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_030.s +++ b/tests/arch/mips/instructions/test_mips_instruction_030.s @@ -17,3 +17,5 @@ main: and $t6, $t0, $t3 and $t7, $t1, $t4 and $t8, $t2, $t5 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_031.out b/tests/arch/mips/instructions/test_mips_instruction_031.out deleted file mode 100644 index 78a74dbe1..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_031.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x58; ir[1,at]:0x200018; ir[2,v0]:0xa; ir[8,t0]:0x200000; ir[9,t1]:0x200008; ir[10,t2]:0x200010; ir[11,t3]:0x200028; sfpr[f0]:0x404145A1; sfpr[f1]:0xCAC08312; sfpr[f2]:0x4026E2D0; sfpr[f3]:0xE5604189; sfpr[f5]:0x07544FFB; dfpr[FP0]:0x404145A1CAC08312; dfpr[FP2]:0x4026E2D0E5604189; dfpr[FP4]:0x0000000007544FFB; memory[0x20002f]:0xFB; memory[0x20002e]:0x4F; memory[0x20002d]:0x54; memory[0x20002c]:0x07; memory[0x200027]:0x89; memory[0x200026]:0x41; memory[0x200025]:0x60; memory[0x200024]:0xE5; memory[0x200023]:0xD0; memory[0x200022]:0xE2; memory[0x200021]:0x26; memory[0x200020]:0x40; memory[0x20001f]:0x12; memory[0x20001e]:0x83; memory[0x20001d]:0xC0; memory[0x20001c]:0xCA; memory[0x20001b]:0xA1; memory[0x20001a]:0x45; memory[0x200019]:0x41; memory[0x200018]:0x40; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_031.s b/tests/arch/mips/instructions/test_mips_instruction_031.s index e3711dbf8..2e7845123 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_031.s +++ b/tests/arch/mips/instructions/test_mips_instruction_031.s @@ -6,7 +6,7 @@ .data a: .double 34.544 b: .double 11.443 - c: .double 0x7544FFB + c: .doubleword 0x7544FFB d: .space 24 diff --git a/tests/arch/mips/instructions/test_mips_instruction_032.out b/tests/arch/mips/instructions/test_mips_instruction_032.out deleted file mode 100644 index 29b9f23e2..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_032.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xfffffffe; ir[8,t0]:0xa; ir[9,t1]:0xd; ir[10,t2]:0x2d; ir[11,t3]:0xfffffffe; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_032.s b/tests/arch/mips/instructions/test_mips_instruction_032.s index 5e8f65179..9942922c6 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_032.s +++ b/tests/arch/mips/instructions/test_mips_instruction_032.s @@ -12,6 +12,14 @@ main: li $t3, -2 mult $t0, $t1 + mfhi $s0 + mflo $s1 mult $t1, $t2 + mfhi $s2 + mflo $s3 mult $t2, $t3 + mfhi $s4 + mflo $s5 mult $t3, $t4 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_033.out b/tests/arch/mips/instructions/test_mips_instruction_033.out deleted file mode 100644 index 18e6769ae..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_033.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 16 (Please enter the assembly code before compiling): -Please enter the assembly code before compiling - - 15 # srli x10, x7, 15 -->16 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_033.s b/tests/arch/mips/instructions/test_mips_instruction_033.s deleted file mode 100644 index ada9fda11..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_033.s +++ /dev/null @@ -1,15 +0,0 @@ - -# -# Creator (https://creatorsim.github.io/creator/) -# - -#.text -#main: - -# li x5, 0xAAD4 -# li x6, 4567 -# li x7, -9486 - -# srli x8, x5, 2 -# srli x9, x6, 1 -# srli x10, x7, 15 diff --git a/tests/arch/mips/instructions/test_mips_instruction_034.out b/tests/arch/mips/instructions/test_mips_instruction_034.out deleted file mode 100644 index 3d1493dfd..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_034.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xfffffffe; ir[8,t0]:0xa; ir[9,t1]:0xd; ir[10,t2]:0x2d; ir[11,t3]:0xfffffffe; ir[12,t4]:0x82; ir[13,t5]:0x249; ir[14,t6]:0xffffffa6; ir[15,t7]:0xfffffefc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_034.s b/tests/arch/mips/instructions/test_mips_instruction_034.s index 51ac2b04b..d5b1a9d77 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_034.s +++ b/tests/arch/mips/instructions/test_mips_instruction_034.s @@ -15,3 +15,5 @@ main: mul $t5, $t1, $t2 mul $t6, $t2, $t3 mul $t7, $t3, $t4 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_035.out b/tests/arch/mips/instructions/test_mips_instruction_035.out deleted file mode 100644 index 89adf5106..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_035.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x38; ir[1,at]:0xfe9a113d; ir[8,t0]:0x165eeb8; ir[9,t1]:0xde; ir[10,t2]:0xfabb53; ir[11,t3]:0xfe9a113d; ir[12,t4]:0x165ef96; ir[13,t5]:0xfabc31; ir[14,t6]:0xff94cc90; ir[15,t7]:0xfffffff5; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_035.s b/tests/arch/mips/instructions/test_mips_instruction_035.s index 585021ab5..8b830b444 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_035.s +++ b/tests/arch/mips/instructions/test_mips_instruction_035.s @@ -13,4 +13,6 @@ main: addu $t4, $t0, $t1 addu $t5, $t1, $t2 addu $t6, $t2, $t3 - addu $t7, $t3, $t0 \ No newline at end of file + addu $t7, $t3, $t0 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_036.out b/tests/arch/mips/instructions/test_mips_instruction_036.out deleted file mode 100644 index d3566d4b6..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_036.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[1,at]:0x37183; ir[8,t0]:0x25b8; ir[9,t1]:0xde; ir[10,t2]:0x123; ir[11,t3]:0xffffa912; ir[12,t4]:0xffffd8f0; ir[13,t5]:0x16c9; ir[14,t6]:0x247; ir[15,t7]:0x31a95; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_036.s b/tests/arch/mips/instructions/test_mips_instruction_036.s index a6b52a812..679e8290b 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_036.s +++ b/tests/arch/mips/instructions/test_mips_instruction_036.s @@ -13,4 +13,6 @@ main: addiu $t4, $t0, -19656 addiu $t5, $t1, 5611 addiu $t6, $t2, 0x124 - addiu $t7, $t3, 225667 \ No newline at end of file + addiu $t7, $t3, 225667 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_037.out b/tests/arch/mips/instructions/test_mips_instruction_037.out deleted file mode 100644 index ba5eddb6d..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_037.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 19 (Please enter the assembly code before compiling): -Please enter the assembly code before compiling - - 18 # mulhu x12, x8, x5 -->19 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_037.s b/tests/arch/mips/instructions/test_mips_instruction_037.s index 514137a05..42b9e0a54 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_037.s +++ b/tests/arch/mips/instructions/test_mips_instruction_037.s @@ -4,15 +4,23 @@ # -# .text -# main: +.text +main: -# li x5, 10 -# li x6, 13 -# li x7, 45 -# li x8, -2 + li $t0, 10 + li $t1, 13 + li $t2, 45 + li $t3, -2 -# mulhu x9, x5, x6 -# mulhu x10, x6, x7 -# mulhu x11, x7, x8 -# mulhu x12, x8, x5 + multu $t0, $t1 + mfhi $s0 + mflo $s1 + multu $t1, $t2 + mfhi $s2 + mflo $s3 + multu $t2, $t3 + mfhi $s4 + mflo $s5 + multu $t3, $t4 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_038.out b/tests/arch/mips/instructions/test_mips_instruction_038.out deleted file mode 100644 index be16b5c16..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_038.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xffffe000; ir[8,t0]:0x10; ir[9,t1]:0x100; ir[10,t2]:0xffffe000; ir[11,t3]:0x18; ir[12,t4]:0xfffffe00; ir[13,t5]:0x10; ir[14,t6]:0xfffffeab; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_038.s b/tests/arch/mips/instructions/test_mips_instruction_038.s index dc9c8cc58..3169e8611 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_038.s +++ b/tests/arch/mips/instructions/test_mips_instruction_038.s @@ -15,3 +15,5 @@ main: div $t5, $t1, $t0 div $t6, $t2, $t3 div $t7, $t3, $t2 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_039.out b/tests/arch/mips/instructions/test_mips_instruction_039.out deleted file mode 100644 index a35e0b6db..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_039.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xffffe000; ir[8,t0]:0x10; ir[9,t1]:0x100; ir[10,t2]:0xffffe000; ir[11,t3]:0x18; ir[12,t4]:0xffffe00; ir[13,t5]:0x10; ir[14,t6]:0xaaaa955; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_039.s b/tests/arch/mips/instructions/test_mips_instruction_039.s index d4e7ab5ea..842f86225 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_039.s +++ b/tests/arch/mips/instructions/test_mips_instruction_039.s @@ -15,3 +15,5 @@ main: divu $t5, $t1, $t0 divu $t6, $t2, $t3 divu $t7, $t3, $t2 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_040.out b/tests/arch/mips/instructions/test_mips_instruction_040.out deleted file mode 100644 index f06e30407..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_040.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x38; cr[HI]:0x18; ir[1,at]:0xffffe000; ir[8,t0]:0x10; ir[9,t1]:0x100; ir[10,t2]:0xffffe000; ir[11,t3]:0x18; ir[14,t6]:0xfffffff8; ir[15,t7]:0x18; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_040.s b/tests/arch/mips/instructions/test_mips_instruction_040.s index 84ec0633a..d7ef0043e 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_040.s +++ b/tests/arch/mips/instructions/test_mips_instruction_040.s @@ -15,3 +15,5 @@ main: rem $t5, $t1, $t0 rem $t6, $t2, $t3 rem $t7, $t3, $t2 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_041.out b/tests/arch/mips/instructions/test_mips_instruction_041.out deleted file mode 100644 index 843277c82..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_041.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xffffe000; ir[8,t0]:0x10; ir[9,t1]:0x100; ir[10,t2]:0xffffe000; ir[11,t3]:0x18; ir[14,t6]:0x8; ir[15,t7]:0x18; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_041.s b/tests/arch/mips/instructions/test_mips_instruction_041.s index e55c978bd..01653bac7 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_041.s +++ b/tests/arch/mips/instructions/test_mips_instruction_041.s @@ -15,3 +15,5 @@ main: modu $t5, $t1, $t0 modu $t6, $t2, $t3 modu $t7, $t3, $t2 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_042.out b/tests/arch/mips/instructions/test_mips_instruction_042.out deleted file mode 100644 index dd2ef2a4d..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_042.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x2c; ir[1,at]:0x1; ir[2,v0]:0xa; ir[8,t0]:0x372; ir[9,t1]:0x371; ir[10,t2]:0x5; ir[11,t3]:0x21f; ir[12,t4]:0xb; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_042.s b/tests/arch/mips/instructions/test_mips_instruction_042.s index a4658fc3e..bd5e0c85a 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_042.s +++ b/tests/arch/mips/instructions/test_mips_instruction_042.s @@ -5,19 +5,30 @@ .text main: - li $t0, 882 - li $t1, 881 - li $t2, 5 - li $t3, 543 - bgt $t1, $t0, jump1 - bgt $t0, $t3, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bgt $s0, $s0, j0 + li $t0, 1 +j0: bgt $s0, $s1, j1 + li $t1, 1 +j1: bgt $s1, $s0, j2 + li $t2, 1 +j2: bgt $s2, $s2, j3 + li $t3, 1 +j3: bgt $s2, $s3, j4 + li $t4, 1 +j4: bgt $s3, $s2, j5 + li $t5, 1 +j5: bgt $s0, $s2, j6 + li $t6, 1 +j6: bgt $s2, $s0, j7 + li $t7, 1 +j7: bgt $s1, $s3, j8 + li $t8, 1 +j8: bgt $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 11 - li $t5, 555 - bgt $t5, $t4, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_043.out b/tests/arch/mips/instructions/test_mips_instruction_043.out deleted file mode 100644 index 22cb038ed..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_043.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x3c; ir[1,at]:0x1; ir[2,v0]:0xa; ir[8,t0]:0xfffffc8e; ir[9,t1]:0xfffffc8f; ir[10,t2]:0x5; ir[11,t3]:0x21f; ir[12,t4]:0xb; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_043.s b/tests/arch/mips/instructions/test_mips_instruction_043.s index 8eaf28802..b93bf6ec3 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_043.s +++ b/tests/arch/mips/instructions/test_mips_instruction_043.s @@ -5,19 +5,30 @@ .text main: - li $t0, -882 - li $t1, -881 - li $t2, 5 - li $t3, 543 - bgtu $t0, $t1, jump1 - bgtu $t3, $t2, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bgtu $s0, $s0, j0 + li $t0, 1 +j0: bgtu $s0, $s1, j1 + li $t1, 1 +j1: bgtu $s1, $s0, j2 + li $t2, 1 +j2: bgtu $s2, $s2, j3 + li $t3, 1 +j3: bgtu $s2, $s3, j4 + li $t4, 1 +j4: bgtu $s3, $s2, j5 + li $t5, 1 +j5: bgtu $s0, $s2, j6 + li $t6, 1 +j6: bgtu $s2, $s0, j7 + li $t7, 1 +j7: bgtu $s1, $s3, j8 + li $t8, 1 +j8: bgtu $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 11 - li $t5, 555 - bgtu $t5, $t4, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_044.out b/tests/arch/mips/instructions/test_mips_instruction_044.out deleted file mode 100644 index a92e51337..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_044.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x2c; ir[2,v0]:0xa; ir[8,t0]:0x372; ir[9,t1]:0x371; ir[10,t2]:0x5; ir[11,t3]:0x21f; ir[12,t4]:0xb; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_044.s b/tests/arch/mips/instructions/test_mips_instruction_044.s index b3d941fdd..9885838e7 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_044.s +++ b/tests/arch/mips/instructions/test_mips_instruction_044.s @@ -5,19 +5,30 @@ .text main: - li $t0, 882 - li $t1, 881 - li $t2, 5 - li $t3, 543 - ble $t0, $t1, jump1 - ble $t2, $t3, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + ble $s0, $s0, j0 + li $t0, 1 +j0: ble $s0, $s1, j1 + li $t1, 1 +j1: ble $s1, $s0, j2 + li $t2, 1 +j2: ble $s2, $s2, j3 + li $t3, 1 +j3: ble $s2, $s3, j4 + li $t4, 1 +j4: ble $s3, $s2, j5 + li $t5, 1 +j5: ble $s0, $s2, j6 + li $t6, 1 +j6: ble $s2, $s0, j7 + li $t7, 1 +j7: ble $s1, $s3, j8 + li $t8, 1 +j8: ble $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 11 - li $t5, 555 - ble $t4, $t5, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_045.out b/tests/arch/mips/instructions/test_mips_instruction_045.out deleted file mode 100644 index b266a7736..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_045.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x44; ir[2,v0]:0xa; ir[8,t0]:0xfffffc8e; ir[9,t1]:0xfffffc8f; ir[10,t2]:0x5; ir[11,t3]:0xfffffde1; ir[12,t4]:0xb; ir[13,t5]:0xfffffdd5; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_045.s b/tests/arch/mips/instructions/test_mips_instruction_045.s index 2e586c4f4..a2a90b916 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_045.s +++ b/tests/arch/mips/instructions/test_mips_instruction_045.s @@ -5,19 +5,30 @@ .text main: - li $t0, -882 - li $t1, -881 - li $t2, 5 - li $t3, -543 - bleu $t1, $t0, jump1 - bleu $t1, $t3, jump1 + li $s0, -40 + li $s1, -10 + li $s2, 15 + li $s3, 32 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bleu $s0, $s0, j0 + li $t0, 1 +j0: bleu $s0, $s1, j1 + li $t1, 1 +j1: bleu $s1, $s0, j2 + li $t2, 1 +j2: bleu $s2, $s2, j3 + li $t3, 1 +j3: bleu $s2, $s3, j4 + li $t4, 1 +j4: bleu $s3, $s2, j5 + li $t5, 1 +j5: bleu $s0, $s2, j6 + li $t6, 1 +j6: bleu $s2, $s0, j7 + li $t7, 1 +j7: bleu $s1, $s3, j8 + li $t8, 1 +j8: bleu $s3, $s1, end + li $t9, 1 - jump1: - li $t4, 11 - li $t5, -555 - bleu $t5, $t4, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_046.out b/tests/arch/mips/instructions/test_mips_instruction_046.out deleted file mode 100644 index 6a9a67d65..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_046.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xffffdaf2; ir[8,t0]:0x22346; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; ir[11,t3]:0xfffdcc28; ir[12,t4]:0x2408; ir[13,t5]:0x409; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_046.s b/tests/arch/mips/instructions/test_mips_instruction_046.s index 0113ca325..f020ca3a9 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_046.s +++ b/tests/arch/mips/instructions/test_mips_instruction_046.s @@ -12,5 +12,6 @@ main: nor $t3, $t0, $t1 nor $t4, $t1, $t2 - nor $t5, $t2, $t0 - + nor $t5, $t2, $t0 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_047.out b/tests/arch/mips/instructions/test_mips_instruction_047.out deleted file mode 100644 index 03210c2f7..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_047.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[1,at]:0xffffdaf2; ir[8,t0]:0x22346; ir[9,t1]:0x11d7; ir[10,t2]:0xffffdaf2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_047.s b/tests/arch/mips/instructions/test_mips_instruction_047.s index 2259bebe2..af3df45d2 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_047.s +++ b/tests/arch/mips/instructions/test_mips_instruction_047.s @@ -10,3 +10,5 @@ main: li $t1, 4567 nop li $t2, -9486 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_048.out b/tests/arch/mips/instructions/test_mips_instruction_048.out deleted file mode 100644 index 3ec14dc7d..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_048.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0xffffffff; ir[8,t0]:0x1; ir[9,t1]:0x234235; ir[10,t2]:0xffffffff; ir[11,t3]:0x1; ir[12,t4]:0x234235; ir[13,t5]:0xffffffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_048.s b/tests/arch/mips/instructions/test_mips_instruction_048.s index cdc87be7c..709205b4f 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_048.s +++ b/tests/arch/mips/instructions/test_mips_instruction_048.s @@ -13,3 +13,5 @@ main: move $t3, $t0 move $t4, $t1 move $t5, $t2 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_049.out b/tests/arch/mips/instructions/test_mips_instruction_049.out deleted file mode 100644 index e59e3b9d2..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_049.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; cr[HI]:0x234566; cr[LO]:0xfff8e0ca; ir[1,at]:0xfff8e0ca; ir[8,t0]:0x234566; ir[9,t1]:0xfff8e0ca; ir[11,t3]:0x234566; ir[12,t4]:0xfff8e0ca; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_049.s b/tests/arch/mips/instructions/test_mips_instruction_049.s index 3459ab9a6..381e5f6d8 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_049.s +++ b/tests/arch/mips/instructions/test_mips_instruction_049.s @@ -14,3 +14,5 @@ main: mfhi $t3 mflo $t4 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_050.out b/tests/arch/mips/instructions/test_mips_instruction_050.out deleted file mode 100644 index bacd4ab5c..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_050.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x2c; ir[1,at]:0x123515; ir[8,t0]:0x223; ir[9,t1]:0xfffffc57; ir[10,t2]:0xc; ir[11,t3]:0x123515; ir[12,t4]:0x5cc; ir[13,t5]:0xfffffa40; ir[14,t6]:0x123ad5; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_050.s b/tests/arch/mips/instructions/test_mips_instruction_050.s index 66b43ed49..03b97fa23 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_050.s +++ b/tests/arch/mips/instructions/test_mips_instruction_050.s @@ -14,3 +14,5 @@ main: subu $t4, $t0, $t1 subu $t5, $t2, $t4 subu $t6, $t3, $t5 + + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_051.out b/tests/arch/mips/instructions/test_mips_instruction_051.out deleted file mode 100644 index 1336a995d..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_051.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x2c; ir[1,at]:0xffffffff; ir[2,v0]:0xa; ir[8,t0]:0x1; ir[10,t2]:0xffffffff; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_051.s b/tests/arch/mips/instructions/test_mips_instruction_051.s index 7cc2e4ec8..28d33774b 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_051.s +++ b/tests/arch/mips/instructions/test_mips_instruction_051.s @@ -5,18 +5,14 @@ .text main: - li $t0, 1 - li $t1, 0 - li $t2, -1 - beqz $t0, jump1 - beqz $t2, jump1 - beqz $t1, jump1 + li $s0, -10 + li $s1, 15 - jump2: - li $t6, 34 - li $v0, 10 - syscall + beqz $s0, j0 + li $t0, 1 +j0: beqz $s1, j1 + li $t1, 1 +j1: beqz $0, end + li $t2, 1 - jump1: - li $t4, 0 - beqz $t4, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_052.out b/tests/arch/mips/instructions/test_mips_instruction_052.out deleted file mode 100644 index be4fabf45..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_052.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x1c; ir[2,v0]:0xa; ir[8,t0]:0x1; ir[12,t4]:0x2; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_052.s b/tests/arch/mips/instructions/test_mips_instruction_052.s index 4b5d9025d..b2c4476aa 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_052.s +++ b/tests/arch/mips/instructions/test_mips_instruction_052.s @@ -5,16 +5,14 @@ .text main: - li $t0, 1 - li $t1, 0 - bgez $t1, jump1 - bgez $t0, jump1 + li $s0, -10 + li $s1, 15 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bgez $s0, j0 + li $t0, 1 +j0: bgez $s1, j1 + li $t1, 1 +j1: bgez $0, end + li $t2, 1 - jump1: - li $t4, 2 - bgez $t4, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_053.out b/tests/arch/mips/instructions/test_mips_instruction_053.out deleted file mode 100644 index 4c699ccf1..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_053.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x1c; ir[2,v0]:0xa; ir[8,t0]:0x1; ir[12,t4]:0x2; ir[14,t6]:0x22; ir[31,ra]:0x24; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_053.s b/tests/arch/mips/instructions/test_mips_instruction_053.s index bd616b8a4..0c5f02b1e 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_053.s +++ b/tests/arch/mips/instructions/test_mips_instruction_053.s @@ -5,16 +5,19 @@ .text main: - li $t0, 1 - li $t1, 0 - bgezal $t1, jump1 - bgezal $t0, jump1 + li $s0, -10 + li $s1, 15 + move $t4, $ra - jump2: - li $t6, 34 - li $v0, 10 - syscall + bgezal $s0, j0 + li $t0, 1 +j0: move $t5, $ra + bgezal $s1, j1 + li $t1, 1 +j1: move $t6, $ra + bgezal $0, end + li $t2, 1 +end: move $t7, $ra - jump1: - li $t4, 2 - bgezal $t4, jump2 + move $ra, $t4 + jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_054.out b/tests/arch/mips/instructions/test_mips_instruction_054.out deleted file mode 100644 index be4fabf45..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_054.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x1c; ir[2,v0]:0xa; ir[8,t0]:0x1; ir[12,t4]:0x2; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_054.s b/tests/arch/mips/instructions/test_mips_instruction_054.s index 5ef6f8858..ff25bfbc2 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_054.s +++ b/tests/arch/mips/instructions/test_mips_instruction_054.s @@ -5,16 +5,14 @@ .text main: - li $t0, 1 - li $t1, 0 - bgtz $t1, jump1 - bgtz $t0, jump1 + li $s0, -10 + li $s1, 15 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bgtz $s0, j0 + li $t0, 1 +j0: bgtz $s1, j1 + li $t1, 1 +j1: bgtz $0, end + li $t2, 1 - jump1: - li $t4, 2 - bgtz $t4, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_055.out b/tests/arch/mips/instructions/test_mips_instruction_055.out deleted file mode 100644 index 9ab7de936..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_055.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[1,at]:0xffffffff; ir[2,v0]:0xa; ir[8,t0]:0x1; ir[9,t1]:0xffffffff; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_055.s b/tests/arch/mips/instructions/test_mips_instruction_055.s index 0abfb5f6f..4828fb850 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_055.s +++ b/tests/arch/mips/instructions/test_mips_instruction_055.s @@ -5,16 +5,14 @@ .text main: - li $t0, 1 - li $t1, -1 - blez $t0, jump1 - blez $t1, jump1 + li $s0, -10 + li $s1, 15 - jump2: - li $t6, 34 - li $v0, 10 - syscall + blez $s0, j0 + li $t0, 1 +j0: blez $s1, j1 + li $t1, 1 +j1: blez $0, end + li $t2, 1 - jump1: - li $t4, 0 - blez $t4, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_056.out b/tests/arch/mips/instructions/test_mips_instruction_056.out deleted file mode 100644 index ab3d78d7e..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_056.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[1,at]:0x1; ir[2,v0]:0xa; ir[8,t0]:0x372; ir[9,t1]:0x371; ir[10,t2]:0x21f; ir[12,t4]:0xb; ir[13,t5]:0x22b; ir[14,t6]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_056.s b/tests/arch/mips/instructions/test_mips_instruction_056.s index 966a2dcec..ebbfbea42 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_056.s +++ b/tests/arch/mips/instructions/test_mips_instruction_056.s @@ -5,18 +5,14 @@ .text main: - li $t0, 882 - li $t1, 881 - li $t2, 543 - blt $t0, $t1, jump1 - blt $t2, $t1, jump1 + li $s0, -10 + li $s1, 15 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bltz $s0, j0 + li $t0, 1 +j0: bltz $s1, j1 + li $t1, 1 +j1: bltz $0, end + li $t2, 1 - jump1: - li $t4, 11 - li $t5, 555 - blt $t4, $t5, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_057.out b/tests/arch/mips/instructions/test_mips_instruction_057.out deleted file mode 100644 index f8a21d08b..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_057.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 11 (11): -Syntax error near line: 11 - - 10 li $t2, 0xAAB -->11 bnez $t0, $t2, jump1 - 12 bnez $t0, $t1, jump1 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_057.s b/tests/arch/mips/instructions/test_mips_instruction_057.s index 6a807ed58..37bce784f 100644 --- a/tests/arch/mips/instructions/test_mips_instruction_057.s +++ b/tests/arch/mips/instructions/test_mips_instruction_057.s @@ -5,18 +5,14 @@ .text main: - li $t0, 0xAAB - li $t1, 0xBBA - li $t2, 0xAAB - bnez $t0, $t2, jump1 - bnez $t0, $t1, jump1 + li $s0, -10 + li $s1, 15 - jump2: - li $t6, 34 - li $v0, 10 - syscall + bnez $s0, j0 + li $t0, 1 +j0: bnez $s1, j1 + li $t1, 1 +j1: bnez $0, end + li $t2, 1 - jump1: - li $t4, 235363 - li $t5, 0xAA - bnez $t4, $t5, jump2 +end: jr $ra diff --git a/tests/arch/mips/instructions/test_mips_instruction_058.out b/tests/arch/mips/instructions/test_mips_instruction_058.out deleted file mode 100644 index cbf66af21..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_058.out +++ /dev/null @@ -1,5 +0,0 @@ - -Square root of a negative number is not allowed. -Square root of a negative number is not allowed. -cr[PC]:0x8c; ir[1,at]:0x46100000; ir[2,v0]:0xa; sfpr[f0]:0x40700000; sfpr[f2]:0xC0AB3200; sfpr[f4]:0x40B56400; sfpr[f6]:0x46192400; sfpr[f7]:0xC6016400; sfpr[f8]:0x46100000; sfpr[f10]:0x40300000; sfpr[f14]:0x40528000; sfpr[f16]:0x42C60000; sfpr[f18]:0x42C00000; dfpr[FP0]:0x4070000000000000; dfpr[FP2]:0xC0AB320000000000; dfpr[FP4]:0x40B5640000000000; dfpr[FP6]:0x46192400C6016400; dfpr[FP8]:0x4610000000000000; dfpr[FP10]:0x4030000000000000; dfpr[FP14]:0x4052800000000000; dfpr[FP16]:0x42C6000000000000; dfpr[FP18]:0x42C0000000000000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_059.out b/tests/arch/mips/instructions/test_mips_instruction_059.out deleted file mode 100644 index 3f3b26876..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_059.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x8c; ir[1,at]:0x46100000; ir[2,v0]:0xa; sfpr[f0]:0x40700000; sfpr[f2]:0x40AB3200; sfpr[f4]:0x40B56400; sfpr[f6]:0x46192400; sfpr[f7]:0x46016400; sfpr[f8]:0x46100000; sfpr[f10]:0x40800000; sfpr[f12]:0x40BB3200; sfpr[f14]:0x40C56400; sfpr[f16]:0x46992400; sfpr[f17]:0x46816400; sfpr[f18]:0x46900000; dfpr[FP0]:0x4070000000000000; dfpr[FP2]:0x40AB320000000000; dfpr[FP4]:0x40B5640000000000; dfpr[FP6]:0x4619240046016400; dfpr[FP8]:0x4610000000000000; dfpr[FP10]:0x4080000000000000; dfpr[FP12]:0x40BB320000000000; dfpr[FP14]:0x40C5640000000000; dfpr[FP16]:0x4699240046816400; dfpr[FP18]:0x4690000000000000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_060.out b/tests/arch/mips/instructions/test_mips_instruction_060.out deleted file mode 100644 index a0233e6a7..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_060.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x8c; ir[1,at]:0x46100000; ir[2,v0]:0xa; sfpr[f0]:0x40700000; sfpr[f2]:0x40AB3200; sfpr[f4]:0x40B56400; sfpr[f6]:0x46192400; sfpr[f7]:0x46016400; sfpr[f8]:0x46100000; sfpr[f10]:0xC0A93200; sfpr[f12]:0xC09F2C00; sfpr[f14]:0x40B46400; sfpr[f16]:0x44BE0000; sfpr[f17]:0xC469C000; sfpr[f18]:0xC4124000; dfpr[FP0]:0x4070000000000000; dfpr[FP2]:0x40AB320000000000; dfpr[FP4]:0x40B5640000000000; dfpr[FP6]:0x4619240046016400; dfpr[FP8]:0x4610000000000000; dfpr[FP10]:0xC0A9320000000000; dfpr[FP12]:0xC09F2C0000000000; dfpr[FP14]:0x40B4640000000000; dfpr[FP16]:0x44BE0000C469C000; dfpr[FP18]:0xC412400000000000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_061.out b/tests/arch/mips/instructions/test_mips_instruction_061.out deleted file mode 100644 index ef763a1af..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_061.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x8c; ir[1,at]:0xc6100000; ir[2,v0]:0xa; sfpr[f0]:0x40700000; sfpr[f2]:0xC0AB3200; sfpr[f4]:0x40B56400; sfpr[f6]:0xC6192400; sfpr[f7]:0x46016400; sfpr[f8]:0xC6100000; sfpr[f10]:0x40700000; sfpr[f12]:0x40AB3200; sfpr[f14]:0x40B56400; sfpr[f16]:0x46192400; sfpr[f17]:0x46016400; sfpr[f18]:0x46100000; dfpr[FP0]:0x4070000000000000; dfpr[FP2]:0xC0AB320000000000; dfpr[FP4]:0x40B5640000000000; dfpr[FP6]:0xC619240046016400; dfpr[FP8]:0xC610000000000000; dfpr[FP10]:0x4070000000000000; dfpr[FP12]:0x40AB320000000000; dfpr[FP14]:0x40B5640000000000; dfpr[FP16]:0x4619240046016400; dfpr[FP18]:0x4610000000000000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_062.out b/tests/arch/mips/instructions/test_mips_instruction_062.out deleted file mode 100644 index 1876723f8..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_062.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x8c; ir[1,at]:0xc4000000; ir[2,v0]:0xa; sfpr[f0]:0x40700000; sfpr[f2]:0xC0B00000; sfpr[f4]:0x40080000; sfpr[f6]:0xC3960000; sfpr[f7]:0x40A00000; sfpr[f8]:0xC4000000; sfpr[f10]:0xC1300000; sfpr[f12]:0xC0C80000; sfpr[f14]:0x40880000; sfpr[f16]:0xC4BB8000; sfpr[f17]:0xC5200000; sfpr[f18]:0x48160000; dfpr[FP0]:0x4070000000000000; dfpr[FP2]:0xC0B0000000000000; dfpr[FP4]:0x4008000000000000; dfpr[FP6]:0xC396000040A00000; dfpr[FP8]:0xC400000000000000; dfpr[FP10]:0xC130000000000000; dfpr[FP12]:0xC0C8000000000000; dfpr[FP14]:0x4088000000000000; dfpr[FP16]:0xC4BB8000C5200000; dfpr[FP18]:0x4816000000000000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_063.out b/tests/arch/mips/instructions/test_mips_instruction_063.out deleted file mode 100644 index 2f61c3d3e..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_063.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x8c; ir[1,at]:0xc4000000; ir[2,v0]:0xa; sfpr[f0]:0x40700000; sfpr[f2]:0xC0B00000; sfpr[f4]:0x40080000; sfpr[f6]:0xC3960000; sfpr[f7]:0x40A00000; sfpr[f8]:0xC4000000; sfpr[f10]:0xBFB00000; sfpr[f12]:0xC0955555; sfpr[f13]:0x55555555; sfpr[f14]:0x40555555; sfpr[f15]:0x55555555; sfpr[f16]:0xC2700000; sfpr[f17]:0xBC200000; sfpr[f18]:0x3FDA740E; dfpr[FP0]:0x4070000000000000; dfpr[FP2]:0xC0B0000000000000; dfpr[FP4]:0x4008000000000000; dfpr[FP6]:0xC396000040A00000; dfpr[FP8]:0xC400000000000000; dfpr[FP10]:0xBFB0000000000000; dfpr[FP12]:0xC095555555555555; dfpr[FP14]:0x4055555555555555; dfpr[FP16]:0xC2700000BC200000; dfpr[FP18]:0x3FDA740E00000000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_064.out b/tests/arch/mips/instructions/test_mips_instruction_064.out deleted file mode 100644 index 88b64bde0..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_064.out +++ /dev/null @@ -1,5 +0,0 @@ - -Square root of a negative number is not allowed. -Square root of a negative number is not allowed. -cr[PC]:0x8c; ir[1,at]:0x46100000; ir[2,v0]:0xa; sfpr[f0]:0x40700000; sfpr[f2]:0xC0AB3200; sfpr[f4]:0x40B56400; sfpr[f6]:0x46192400; sfpr[f7]:0xC6016400; sfpr[f8]:0x46100000; sfpr[f10]:0x3FB00000; sfpr[f14]:0x3F8BACF9; sfpr[f15]:0x14C1BAD0; sfpr[f16]:0x3C257EB5; sfpr[f18]:0x3C2AAAAB; dfpr[FP0]:0x4070000000000000; dfpr[FP2]:0xC0AB320000000000; dfpr[FP4]:0x40B5640000000000; dfpr[FP6]:0x46192400C6016400; dfpr[FP8]:0x4610000000000000; dfpr[FP10]:0x3FB0000000000000; dfpr[FP14]:0x3F8BACF914C1BAD0; dfpr[FP16]:0x3C257EB500000000; dfpr[FP18]:0x3C2AAAAB00000000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_065.out b/tests/arch/mips/instructions/test_mips_instruction_065.out deleted file mode 100644 index f5851cade..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_065.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x7c; ir[1,at]:0x46100000; ir[2,v0]:0xa; sfpr[f0]:0x40700000; sfpr[f4]:0x40B56400; sfpr[f6]:0x46192400; sfpr[f7]:0xC6016400; sfpr[f8]:0x46100000; sfpr[f10]:0x40C32480; dfpr[FP0]:0x4070000000000000; dfpr[FP4]:0x40B5640000000000; dfpr[FP6]:0x46192400C6016400; dfpr[FP8]:0x4610000000000000; dfpr[FP10]:0x40C3248000000000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_066.out b/tests/arch/mips/instructions/test_mips_instruction_066.out deleted file mode 100644 index a7f2fc49f..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_066.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 15 (t0): -Register 't0' not found - - 14 -->15 cvt.w.d $t0, $FP0 - 16 cvt.w.d $t1, $FP2 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/instructions/test_mips_instruction_067.out b/tests/arch/mips/instructions/test_mips_instruction_067.out deleted file mode 100644 index 9bfd1f418..000000000 --- a/tests/arch/mips/instructions/test_mips_instruction_067.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 17 (t0): -Register 't0' not found - - 16 -->17 cvt.d.w $FP0, $t0 - 18 cvt.d.w $FP2, $t1 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel.test.mts b/tests/arch/mips/sentinel.test.mts new file mode 100644 index 000000000..90e3c6cde --- /dev/null +++ b/tests/arch/mips/sentinel.test.mts @@ -0,0 +1,3 @@ +import { ARCH, execution_tests } from "../arch_utils.mts"; + +execution_tests(ARCH.mips, "mips/sentinel"); diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_001.out b/tests/arch/mips/sentinel/test_mips_sentinels_001.out deleted file mode 100644 index bb418b996..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_001.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_002.out b/tests/arch/mips/sentinel/test_mips_sentinels_002.out deleted file mode 100644 index f46867bca..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_002.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[5,a1]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_003.out b/tests/arch/mips/sentinel/test_mips_sentinels_003.out deleted file mode 100644 index c14ee77a8..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_003.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[6,a2]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_004.out b/tests/arch/mips/sentinel/test_mips_sentinels_004.out deleted file mode 100644 index 50539f39a..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_004.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[7,a3]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_005.out b/tests/arch/mips/sentinel/test_mips_sentinels_005.out deleted file mode 100644 index a0f0cd1bc..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_005.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[2,v0]:0xa; ir[30,fp]:0x5; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_006.out b/tests/arch/mips/sentinel/test_mips_sentinels_006.out deleted file mode 100644 index 3d1295729..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_006.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[2,v0]:0xa; ir[28,gp]:0x5; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_007.out b/tests/arch/mips/sentinel/test_mips_sentinels_007.out deleted file mode 100644 index dd69094bb..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_007.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[2,v0]:0xa; ir[26,k0]:0x5; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_008.out b/tests/arch/mips/sentinel/test_mips_sentinels_008.out deleted file mode 100644 index 4d9b823e3..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_008.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[2,v0]:0xa; ir[27,k1]:0x5; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_009.out b/tests/arch/mips/sentinel/test_mips_sentinels_009.out deleted file mode 100644 index 879dd5bc9..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_009.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x108a; ir[31,ra]:0x108a; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_010.out b/tests/arch/mips/sentinel/test_mips_sentinels_010.out deleted file mode 100644 index 18774653c..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_010.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[16,s0]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_011.out b/tests/arch/mips/sentinel/test_mips_sentinels_011.out deleted file mode 100644 index b51ae811a..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_011.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[17,s1]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_012.out b/tests/arch/mips/sentinel/test_mips_sentinels_012.out deleted file mode 100644 index 506c4585a..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_012.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[18,s2]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_013.out b/tests/arch/mips/sentinel/test_mips_sentinels_013.out deleted file mode 100644 index 3b40f66be..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_013.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[19,s3]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_014.out b/tests/arch/mips/sentinel/test_mips_sentinels_014.out deleted file mode 100644 index 69ae1d83e..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_014.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[20,s4]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_015.out b/tests/arch/mips/sentinel/test_mips_sentinels_015.out deleted file mode 100644 index 21e24116b..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_015.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[21,s5]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_015.s b/tests/arch/mips/sentinel/test_mips_sentinels_015.s index 8f58a2c70..3a645ca42 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_015.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_015.s @@ -24,7 +24,7 @@ sw $fp, 4($sp) addu $fp, $sp, 4 - li $s5 2 + li $s5, 2 b_efs: lw $ra, 8($sp) lw $fp, 4($sp) diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_016.out b/tests/arch/mips/sentinel/test_mips_sentinels_016.out deleted file mode 100644 index 04f024272..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_016.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[22,s6]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_017.out b/tests/arch/mips/sentinel/test_mips_sentinels_017.out deleted file mode 100644 index 5ef9599fa..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_017.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[23,s7]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_018.out b/tests/arch/mips/sentinel/test_mips_sentinels_018.out deleted file mode 100644 index 5142e9336..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_018.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 29 (addi $reg2 $reg1 val): -Incorrect instruction syntax for 'addi $reg2 $reg1 val' - - 28 undefined -->29 undefined - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_018.s b/tests/arch/mips/sentinel/test_mips_sentinels_018.s index fd0689909..5b0a0c82c 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_018.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_018.s @@ -9,7 +9,7 @@ main: - li $sp, 5 + li $s2, 5 jal test # exit @@ -20,7 +20,7 @@ test: # crear "stack frame" para $ra, $fp y una variable local - addi $sp, 4 + addi $sp, $sp, -4 # return $v0 jr $ra diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_019.out b/tests/arch/mips/sentinel/test_mips_sentinels_019.out deleted file mode 100644 index f4832849c..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_019.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[8,t0]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_020.out b/tests/arch/mips/sentinel/test_mips_sentinels_020.out deleted file mode 100644 index d09cc3282..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_020.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[9,t1]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_021.out b/tests/arch/mips/sentinel/test_mips_sentinels_021.out deleted file mode 100644 index 8ee1d8b05..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_021.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[10,t2]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_021.s b/tests/arch/mips/sentinel/test_mips_sentinels_021.s index 371362521..bda3fb15d 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_021.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_021.s @@ -24,7 +24,7 @@ sw $fp, 4($sp) addu $fp, $sp, 4 - li $t2 2 + li $t2, 2 b_efs: lw $ra, 8($sp) lw $fp, 4($sp) diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_022.out b/tests/arch/mips/sentinel/test_mips_sentinels_022.out deleted file mode 100644 index 6c9cac29a..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_022.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[11,t3]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_023.out b/tests/arch/mips/sentinel/test_mips_sentinels_023.out deleted file mode 100644 index 07c9e23dd..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_023.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[12,t4]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_024.out b/tests/arch/mips/sentinel/test_mips_sentinels_024.out deleted file mode 100644 index 9367e8993..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_024.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[13,t5]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_024.s b/tests/arch/mips/sentinel/test_mips_sentinels_024.s index 5bc180a83..514a5bff7 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_024.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_024.s @@ -20,11 +20,11 @@ test: # crear "stack frame" para $ra, $fp y una variable local subu $sp, $sp, 12 - sw $ra 8($sp) - sw $fp 4($sp) + sw $ra, 8($sp) + sw $fp, 4($sp) addu $fp, $sp, 4 - li $t5 2 + li $t5, 2 b_efs: lw $ra, 8($sp) lw $fp, 4($sp) diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_025.out b/tests/arch/mips/sentinel/test_mips_sentinels_025.out deleted file mode 100644 index 14fc5479d..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_025.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[14,t6]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_026.out b/tests/arch/mips/sentinel/test_mips_sentinels_026.out deleted file mode 100644 index f4b028484..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_026.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[15,t7]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_027.out b/tests/arch/mips/sentinel/test_mips_sentinels_027.out deleted file mode 100644 index 232c69474..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_027.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[24,t8]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_028.out b/tests/arch/mips/sentinel/test_mips_sentinels_028.out deleted file mode 100644 index 371ae21e2..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_028.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[1,at]:0xc; ir[2,v0]:0xa; ir[4,a0]:0x5; ir[25,t9]:0x2; ir[31,ra]:0xc; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_029.out b/tests/arch/mips/sentinel/test_mips_sentinels_029.out deleted file mode 100644 index 4d3db4da2..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_029.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_030.out b/tests/arch/mips/sentinel/test_mips_sentinels_030.out deleted file mode 100644 index c8585a613..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_030.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[1,at]:0xc; ir[2,v0]:0xa; ir[3,v1]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_031.out b/tests/arch/mips/sentinel/test_mips_sentinels_031.out deleted file mode 100644 index 4ffae289d..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_031.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[1,at]:0x8; ir[2,v0]:0xa; ir[16,s0]:0x2; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_031.s b/tests/arch/mips/sentinel/test_mips_sentinels_031.s index 3dbbf2ff2..edf1cd97d 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_031.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_031.s @@ -20,11 +20,11 @@ test: # crear "stack frame" para $ra, $fp y una variable local subu $sp, $sp, 8 - sw $s0, ($sp) + sw $s0, 0($sp) li $s0, 2 - b_efs: lw $s0, ($sp) + b_efs: lw $s0, 0($sp) addu $sp, $sp, 8 diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_032.out b/tests/arch/mips/sentinel/test_mips_sentinels_032.out deleted file mode 100644 index 513072789..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_032.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0x4; ir[2,v0]:0xa; ir[16,s0]:0x5; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_032.s b/tests/arch/mips/sentinel/test_mips_sentinels_032.s index ed8cb2f3f..af0e8779e 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_032.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_032.s @@ -20,7 +20,7 @@ test: # crear "stack frame" para $ra, $fp y una variable local subu $sp, $sp, 4 - sw $s0, ($sp) + sw $s0, 0($sp) li $s0, 5 diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_033.out b/tests/arch/mips/sentinel/test_mips_sentinels_033.out deleted file mode 100644 index db4973b2b..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_033.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0x8; ir[2,v0]:0xa; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_033.s b/tests/arch/mips/sentinel/test_mips_sentinels_033.s index 74c232e75..87391980c 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_033.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_033.s @@ -19,8 +19,8 @@ test: # crear "stack frame" para $ra, $fp y una variable local - subu $sp, $sp 8 - sw $s0, ($sp) + subu $sp, $sp, 8 + sw $s0, 0($sp) li $s0, 2 diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_034.out b/tests/arch/mips/sentinel/test_mips_sentinels_034.out deleted file mode 100644 index db4973b2b..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_034.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0x8; ir[2,v0]:0xa; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_034.s b/tests/arch/mips/sentinel/test_mips_sentinels_034.s index 8d73bd065..a3cab173b 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_034.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_034.s @@ -20,11 +20,11 @@ test: # crear "stack frame" para $ra, $fp y una variable local subu $sp, $sp, 8 - sw $s0, ($sp) + sw $s0, 0($sp) li $s0, 2 - b_efs: lh $s0, ($sp) + b_efs: lh $s0, 0($sp) addu $sp, $sp, 8 diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_035.out b/tests/arch/mips/sentinel/test_mips_sentinels_035.out deleted file mode 100644 index db4973b2b..000000000 --- a/tests/arch/mips/sentinel/test_mips_sentinels_035.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[1,at]:0x8; ir[2,v0]:0xa; ir[31,ra]:0x8; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/mips/sentinel/test_mips_sentinels_035.s b/tests/arch/mips/sentinel/test_mips_sentinels_035.s index 932a9aa64..74cd18ec9 100644 --- a/tests/arch/mips/sentinel/test_mips_sentinels_035.s +++ b/tests/arch/mips/sentinel/test_mips_sentinels_035.s @@ -20,12 +20,12 @@ test: # crear "stack frame" para $ra, $fp y una variable local subu $sp, $sp, 8 - sw $s0, ($sp) - sw $t0, ($sp) + sw $s0, 0($sp) + sw $t0, 0($sp) li $s0, 2 - b_efs: lw $s0, ($sp) + b_efs: lw $s0, 0($sp) addu $sp, $sp, 8 diff --git a/tests/arch/riscv/correct.test.mts b/tests/arch/riscv/correct.test.mts new file mode 100644 index 000000000..445b6e377 --- /dev/null +++ b/tests/arch/riscv/correct.test.mts @@ -0,0 +1,32 @@ +import { ARCH, execution_tests } from "../arch_utils.mts"; + +const long_str = + "This is a very long string with many characters and a lot of data. :) 123\n"; + +execution_tests( + ARCH.riscv, + "riscv/correct/examples", + new Map([ + ["test_riscv_example_009.s", ["123\n", "456\n"]], + ["test_riscv_example_010.s", [long_str.length + "\n", long_str]], + ["test_riscv_example_017.s", ["String in UTF-8: ∀ ∫ ∇ ∈ 🠬\n"]], + ]), +); +execution_tests( + ARCH.riscv, + "riscv/correct/libraries", + undefined, + undefined, + true, +); +execution_tests( + ARCH.riscv, + "riscv/correct/syscalls", + new Map([ + ["test_riscv_syscall_005.s", ["1234567\n"]], + ["test_riscv_syscall_006.s", ["1.234567\n"]], + ["test_riscv_syscall_007.s", ["1.234567890123456\n"]], + ["test_riscv_syscall_008.s", ["This is a long string\n"]], + ["test_riscv_syscall_012.s", ["a\n"]], + ]), +); diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_002.out b/tests/arch/riscv/correct/examples/test_riscv_example_002.out deleted file mode 100644 index f585b2625..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_002.out +++ /dev/null @@ -1,4 +0,0 @@ - -4 -cr[PC]:0xfffffffe; ir[x5,t0]:0xa; ir[x6,t1]:0xd; ir[x7,t2]:0x2d; ir[x10,a0]:0x4; ir[x17,a7]:0x1; ir[x28,t3]:0x21; ir[x29,t4]:0x4; keyboard[0x0]:''; display[0x0]:'4'; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_002.s b/tests/arch/riscv/correct/examples/test_riscv_example_002.s index f710bf04e..8f00158bd 100644 --- a/tests/arch/riscv/correct/examples/test_riscv_example_002.s +++ b/tests/arch/riscv/correct/examples/test_riscv_example_002.s @@ -1,68 +1,26 @@ + # # Creator (https://creatorsim.github.io/creator/) -# Example: Store "hello world" byte by byte without data segment # .text - main: - # Use a base memory address - li t1, 0x200000 - - # Store "hello world" byte by byte - # 'h' = 104 - li t0, 104 - sb t0, 0(t1) - - # 'e' = 101 - li t0, 101 - sb t0, 1(t1) - - # 'l' = 108 - li t0, 108 - sb t0, 2(t1) - - # 'l' = 108 - li t0, 108 - sb t0, 3(t1) - - # 'o' = 111 - li t0, 111 - sb t0, 4(t1) - - # ' ' = 32 (space) - li t0, 32 - sb t0, 5(t1) - - # 'w' = 119 - li t0, 119 - sb t0, 6(t1) - - # 'o' = 111 - li t0, 111 - sb t0, 7(t1) - - # 'r' = 114 - li t0, 114 - sb t0, 8(t1) - - # 'l' = 108 - li t0, 108 - sb t0, 9(t1) - - # 'd' = 100 - li t0, 100 - sb t0, 10(t1) - - # null terminator = 0 - li t0, 0 - sb t0, 11(t1) - - # Print the string (system call 4 - print string) - mv a0, t1 # address of string - li a7, 4 # system call for print string - ecall - - # Return - li a7, 10 - ecall +main: + + li t0, 10 + li t1, 13 + li t2, 45 + li t3, 33 + + add t4, t0, t1 # 10+13 + sub t4, t2, t3 # 45-33 + mul t4, t3, t3 # 33*33 + div t4, t2, t0 # 45/10 + + # print last t4 + mv a0, t4 + li a7, 1 + ecall + + # return + jr ra diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_003.out b/tests/arch/riscv/correct/examples/test_riscv_example_003.out deleted file mode 100644 index 83847e45f..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_003.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0xfffffffe; ir[x5,t0]:0x20000e; ir[x6,t1]:0x200004; ir[x7,t2]:0x200006; ir[x28,t3]:0xe; ir[x29,t4]:0x78; ir[x30,t5]:0x16; memory[0x20000f]:0x16; memory[0x20000c]:0x78; memory[0x20000b]:0x0e; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_003.s b/tests/arch/riscv/correct/examples/test_riscv_example_003.s index 3b9c35088..5a372f2dc 100644 --- a/tests/arch/riscv/correct/examples/test_riscv_example_003.s +++ b/tests/arch/riscv/correct/examples/test_riscv_example_003.s @@ -6,7 +6,6 @@ .data w1: .word 14 b1: .byte 120 - b4: .byte 0x7F .align 1 h1: .half 22 diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_004.out b/tests/arch/riscv/correct/examples/test_riscv_example_004.out deleted file mode 100644 index 4004704ae..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_004.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0xfffffffe; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200028; fpr[f0,ft0]:0x405145A1CAC08312; fpr[f2,ft2]:0x4026E2D0E5604189; fpr[f4,ft4]:0x4082A27EF9DB22D1; fpr[f10,fa0]:0x4084CB3333333333; fpr[f12,fa2]:0x404D13154689C3E9; memory[0x20002f]:0xE9; memory[0x20002e]:0xC3; memory[0x20002d]:0x89; memory[0x20002c]:0x46; memory[0x20002b]:0x15; memory[0x20002a]:0x13; memory[0x200029]:0x4D; memory[0x200028]:0x40; memory[0x200027]:0xD1; memory[0x200026]:0x22; memory[0x200025]:0xDB; memory[0x200024]:0xF9; memory[0x200023]:0x7E; memory[0x200022]:0xA2; memory[0x200021]:0x82; memory[0x200020]:0x40; memory[0x20001f]:0x12; memory[0x20001e]:0x83; memory[0x20001d]:0xC0; memory[0x20001c]:0xCA; memory[0x20001b]:0xA1; memory[0x20001a]:0x45; memory[0x200019]:0x51; memory[0x200018]:0x40; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_005.out b/tests/arch/riscv/correct/examples/test_riscv_example_005.out deleted file mode 100644 index 16083806e..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_005.out +++ /dev/null @@ -1,4 +0,0 @@ - -45 -cr[PC]:0xfffffffe; ir[x5,t0]:0xa; ir[x6,t1]:0xa; ir[x10,a0]:0x2d; ir[x17,a7]:0x1; keyboard[0x0]:''; display[0x0]:'45'; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_006.out b/tests/arch/riscv/correct/examples/test_riscv_example_006.out deleted file mode 100644 index 0d638f0c9..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_006.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x1c; ir[x5,t0]:0x4; ir[x6,t1]:0x2; ir[x17,a7]:0xa; ir[x28,t3]:0x22; ir[x29,t4]:0xb; ir[x30,t5]:0x22b; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_007.out b/tests/arch/riscv/correct/examples/test_riscv_example_007.out deleted file mode 100644 index 1bf2a3f44..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_007.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0xfffffffe; ir[x5,t0]:0xf; ir[x6,t1]:0x5; ir[x7,t2]:0x5; ir[x28,t3]:0x1; ir[x29,t4]:0x4; ir[x30,t5]:0x200014; ir[x31,t6]:0x5; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_008.out b/tests/arch/riscv/correct/examples/test_riscv_example_008.out deleted file mode 100644 index 2cca57405..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_008.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0xfffffffe; ir[x5,t0]:0x200040; ir[x6,t1]:0x200080; ir[x7,t2]:0x4; ir[x28,t3]:0x4; ir[x29,t4]:0x4; fpr[f0,ft0]:0xffffffff33441124; memory[0x20007f]:0x24; memory[0x20007e]:0x11; memory[0x20007d]:0x44; memory[0x20007c]:0x33; memory[0x20007b]:0x21; memory[0x20007a]:0x43; memory[0x200079]:0x65; memory[0x200078]:0x87; memory[0x200077]:0x78; memory[0x200076]:0x56; memory[0x200075]:0x34; memory[0x200074]:0x12; memory[0x200073]:0x23; memory[0x200072]:0xff; memory[0x20006d]:0xd0; memory[0x20006c]:0x77; memory[0x20006b]:0x12; memory[0x20006a]:0xf0; memory[0x200069]:0xbf; memory[0x200068]:0xaa; memory[0x200067]:0x22; memory[0x200066]:0x11; memory[0x200065]:0x55; memory[0x200064]:0x44; memory[0x200063]:0x14; memory[0x200062]:0x02; memory[0x20005f]:0x14; memory[0x20005e]:0x14; memory[0x20005d]:0x14; memory[0x20005c]:0x14; memory[0x20005b]:0x20; memory[0x20005a]:0x21; memory[0x200059]:0x51; memory[0x200058]:0x77; memory[0x200057]:0x10; memory[0x200056]:0x22; memory[0x200055]:0x43; memory[0x200051]:0x45; memory[0x200050]:0x23; memory[0x20004c]:0x34; memory[0x200048]:0x34; memory[0x200044]:0x34; memory[0x200040]:0x34; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_011.out b/tests/arch/riscv/correct/examples/test_riscv_example_011.out deleted file mode 100644 index 55200332a..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_011.out +++ /dev/null @@ -1,4 +0,0 @@ - --144 -cr[PC]:0xfffffffe; ir[x6,t1]:0xffffffca; ir[x7,t2]:0x5a; ir[x10,a0]:0xffffff70; ir[x11,a1]:0x5a; ir[x12,a2]:0x2d; ir[x17,a7]:0x1; keyboard[0x0]:''; display[0x0]:'-144'; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_012.out b/tests/arch/riscv/correct/examples/test_riscv_example_012.out deleted file mode 100644 index 1a3ed56da..000000000 --- a/tests/arch/riscv/correct/examples/test_riscv_example_012.out +++ /dev/null @@ -1,4 +0,0 @@ - -120 -cr[PC]:0xfffffffe; ir[x5,t0]:0x2; ir[x6,t1]:0x5; ir[x10,a0]:0x78; ir[x17,a7]:0x1; keyboard[0x0]:''; display[0x0]:'120'; - diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_013.s b/tests/arch/riscv/correct/examples/test_riscv_example_013.s index c7912aa9b..fa6b18fc9 100644 --- a/tests/arch/riscv/correct/examples/test_riscv_example_013.s +++ b/tests/arch/riscv/correct/examples/test_riscv_example_013.s @@ -1,113 +1,16 @@ + # # Creator (https://creatorsim.github.io/creator/) # -.text - -main: - # Create stack frame - addi sp, sp, -16 # Allocate space for 4 words - sw ra, 12(sp) # Save return address - sw s0, 8(sp) # Save callee-saved registers - sw s1, 4(sp) - sw s2, 0(sp) - - # Initialize arguments - li a0, 23 - li a1, -77 - li a2, 45 - - # Call the first level function (starts the nested calls) - jal ra, level1 - - # Store result - mv s0, a0 - - # Print result - li a7, 1 - ecall - - # Restore registers and return - lw s2, 0(sp) - lw s1, 4(sp) - lw s0, 8(sp) - lw ra, 12(sp) - addi sp, sp, 16 - jr ra +.data + utf8: .string "String in UTF-8: ∀ ∫ ∇ ∈ 🠬" -# First level function - calls level2 -level1: - # Create stack frame - addi sp, sp, -16 - sw ra, 12(sp) - sw s0, 8(sp) - sw a0, 4(sp) # Save argument a0 - sw a1, 0(sp) # Save argument a1 - - # Save arguments in saved registers - mv s0, a0 - - # Call level2 - jal ra, level2 - - # Add original a0 to result - add a0, a0, s0 - - # Restore registers and return - lw a1, 0(sp) - lw s0, 8(sp) - lw ra, 12(sp) - addi sp, sp, 16 - jr ra - -# Second level function - calls level3 -level2: - # Create stack frame - addi sp, sp, -12 - sw ra, 8(sp) - sw a1, 4(sp) - sw a2, 0(sp) - - # Call level3 - jal ra, level3 - - # Add original a2 to result - lw t0, 0(sp) - add a0, a0, t0 - - # Restore and return - lw a1, 4(sp) - lw ra, 8(sp) - addi sp, sp, 12 - jr ra - -# Third level function - calls sum -level3: - # Create stack frame - addi sp, sp, -8 - sw ra, 4(sp) - sw a1, 0(sp) - - # First call the original sum function - jal ra, sum - - # Then call sub with result from sum - lw a1, 0(sp) - jal ra, sub - - # Restore and return - lw ra, 4(sp) - addi sp, sp, 8 - jr ra - -# Original functions from the example -sum: - add t1, a0, a1 - add t2, a2, a2 - add a0, t1, zero - add a1, t2, zero - jr ra - -sub: - sub a0, a0, a1 - jr ra +.text +main: li a7, 1 + la t0, utf8 +loop: lbu a0, 0(t0) + ecall + addi t0, t0, 1 + bne a0, zero, loop + jr ra diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_014.s b/tests/arch/riscv/correct/examples/test_riscv_example_014.s index be379ab67..c7912aa9b 100644 --- a/tests/arch/riscv/correct/examples/test_riscv_example_014.s +++ b/tests/arch/riscv/correct/examples/test_riscv_example_014.s @@ -1,97 +1,113 @@ # # Creator (https://creatorsim.github.io/creator/) -# Example: Various data types in data segment and memory operations # -.data -.align 4 +.text -# Different data types in data segment -byte_values: .byte 0x42, 0x73, 0xA5, 0xFF - .byte -128, 127, 0, 55 +main: + # Create stack frame + addi sp, sp, -16 # Allocate space for 4 words + sw ra, 12(sp) # Save return address + sw s0, 8(sp) # Save callee-saved registers + sw s1, 4(sp) + sw s2, 0(sp) -.align 2 -half_values: .half 0x1234, 0x5678, 0xABCD, 0xEF12 - .half -32768, 32767, 0, 12345 + # Initialize arguments + li a0, 23 + li a1, -77 + li a2, 45 + + # Call the first level function (starts the nested calls) + jal ra, level1 + + # Store result + mv s0, a0 + + # Print result + li a7, 1 + ecall -.align 4 -word_values: .word 0x12345678, 0x87654321, 0xDEADBEEF, 0xCAFEBABE - .word -2147483648, 2147483647, 0, 1000000 + # Restore registers and return + lw s2, 0(sp) + lw s1, 4(sp) + lw s0, 8(sp) + lw ra, 12(sp) + addi sp, sp, 16 + jr ra -.align 3 -double_values: .dword 0x123456789ABCDEF0, 0xFEDCBA9876543210 - .dword 0x0123456789ABCDEF, 0xAAAABBBBCCCCDDDD +# First level function - calls level2 +level1: + # Create stack frame + addi sp, sp, -16 + sw ra, 12(sp) + sw s0, 8(sp) + sw a0, 4(sp) # Save argument a0 + sw a1, 0(sp) # Save argument a1 + + # Save arguments in saved registers + mv s0, a0 + + # Call level2 + jal ra, level2 + + # Add original a0 to result + add a0, a0, s0 + + # Restore registers and return + lw a1, 0(sp) + lw s0, 8(sp) + lw ra, 12(sp) + addi sp, sp, 16 + jr ra -# String data -.align 1 -string_data: .string "Hello, RISC-V!" - .byte 0 # Null terminator +# Second level function - calls level3 +level2: + # Create stack frame + addi sp, sp, -12 + sw ra, 8(sp) + sw a1, 4(sp) + sw a2, 0(sp) + + # Call level3 + jal ra, level3 + + # Add original a2 to result + lw t0, 0(sp) + add a0, a0, t0 + + # Restore and return + lw a1, 4(sp) + lw ra, 8(sp) + addi sp, sp, 12 + jr ra -# Float data (stored as word) -.align 4 -float_data: .word 0x40490FDB # Pi as IEEE 754 float (3.14159...) - .word 0x402DF854 # e as IEEE 754 float (2.71828...) +# Third level function - calls sum +level3: + # Create stack frame + addi sp, sp, -8 + sw ra, 4(sp) + sw a1, 0(sp) + + # First call the original sum function + jal ra, sum + + # Then call sub with result from sum + lw a1, 0(sp) + jal ra, sub + + # Restore and return + lw ra, 4(sp) + addi sp, sp, 8 + jr ra -# Target memory locations for writing -.align 4 -target_area: .space 256 # Reserve 256 bytes for writing data +# Original functions from the example +sum: + add t1, a0, a1 + add t2, a2, a2 + add a0, t1, zero + add a1, t2, zero + jr ra -.text -main: - # Set up base addresses - la t0, byte_values - la t1, half_values - la t2, word_values - la t3, double_values - la t4, target_area - - # Copy and manipulate byte data - lb a0, 0(t0) # Load first byte (0x42) - sb a0, 0(t4) # Store to target area - lb a1, 3(t0) # Load fourth byte (0xFF) - sb a1, 1(t4) # Store to target area + 1 - - # Manipulate and store modified byte - addi a0, a0, 1 # Increment byte value - sb a0, 2(t4) # Store modified byte - - # Copy and manipulate half-word data - lh a0, 0(t1) # Load first half (0x1234) - sh a0, 4(t4) # Store to target area + 4 - lh a1, 6(t1) # Load fourth half (0xEF12) - sh a1, 6(t4) # Store to target area + 6 - - # Perform arithmetic on half-word and store - add a2, a0, a1 # Add two half-words - sh a2, 8(t4) # Store result - - # Copy and manipulate word data - lw a0, 0(t2) # Load first word (0x12345678) - sw a0, 12(t4) # Store to target area + 12 - lw a1, 12(t2) # Load fourth word (0xCAFEBABE) - sw a1, 16(t4) # Store to target area + 16 - - # Perform bitwise operations on words - xor a2, a0, a1 # XOR two words - sw a2, 20(t4) # Store XOR result - or a3, a0, a1 # OR two words - sw a3, 24(t4) # Store OR result - and a4, a0, a1 # AND two words - sw a4, 28(t4) # Store AND result - - # Copy double-word data (64-bit) - ld a0, 0(t3) # Load first double-word - sd a0, 32(t4) # Store to target area + 32 - ld a1, 8(t3) # Load second double-word - sd a1, 40(t4) # Store to target area + 40 - - # Create and store new data patterns - li a0, 0x55AA55AA # Create alternating bit pattern - sw a0, 48(t4) # Store pattern - - # Store sequential byte pattern - li a0, 0x01 # Start with 1 - li a1, 8 # Counter for 8 bytes - addi a2, t4, 52 # Start address for pattern - - jr ra \ No newline at end of file +sub: + sub a0, a0, a1 + jr ra diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_015.s b/tests/arch/riscv/correct/examples/test_riscv_example_015.s new file mode 100644 index 000000000..f710bf04e --- /dev/null +++ b/tests/arch/riscv/correct/examples/test_riscv_example_015.s @@ -0,0 +1,68 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# Example: Store "hello world" byte by byte without data segment +# + +.text + main: + # Use a base memory address + li t1, 0x200000 + + # Store "hello world" byte by byte + # 'h' = 104 + li t0, 104 + sb t0, 0(t1) + + # 'e' = 101 + li t0, 101 + sb t0, 1(t1) + + # 'l' = 108 + li t0, 108 + sb t0, 2(t1) + + # 'l' = 108 + li t0, 108 + sb t0, 3(t1) + + # 'o' = 111 + li t0, 111 + sb t0, 4(t1) + + # ' ' = 32 (space) + li t0, 32 + sb t0, 5(t1) + + # 'w' = 119 + li t0, 119 + sb t0, 6(t1) + + # 'o' = 111 + li t0, 111 + sb t0, 7(t1) + + # 'r' = 114 + li t0, 114 + sb t0, 8(t1) + + # 'l' = 108 + li t0, 108 + sb t0, 9(t1) + + # 'd' = 100 + li t0, 100 + sb t0, 10(t1) + + # null terminator = 0 + li t0, 0 + sb t0, 11(t1) + + # Print the string (system call 4 - print string) + mv a0, t1 # address of string + li a7, 4 # system call for print string + ecall + + # Return + li a7, 10 + ecall + diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_016.s b/tests/arch/riscv/correct/examples/test_riscv_example_016.s new file mode 100644 index 000000000..b72f5f3f5 --- /dev/null +++ b/tests/arch/riscv/correct/examples/test_riscv_example_016.s @@ -0,0 +1,40 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# Example: Use %hi and %lo modifiers to load 32 bit constants without +# pseudoinstructions +# +.data +a: .zero 1 +b: .zero 63 +c: .zero 4096 + +.text + main: + lui t0, %hi(0x01020304) + addi t0, t0, %lo(0x01020304) + + lui t1, %hi(0xABCDEF01) + addi t1, t1, %lo(0xABCDEF01) + + lui t2, %hi(a) + addi t2, t2, %lo(a) + + lui t3, %hi(b) + addi t3, t3, %lo(b) + + lui t4, %hi(c) + addi t4, t4, %lo(c) + + lui t5, %hi(1) + addi t5, t5, %lo(1) + + lui t6, %hi(-1) + addi t6, t6, %lo(-1) + + lui s0, %hi(0xFFFFFFFF) + addi s0, s0, %lo(0xFFFFFFFF) + + lui s1, %hi(0xFF00FFFF) + addi s1, s1, %lo(0xFF00FFFF) + + jr ra diff --git a/tests/arch/riscv/correct/examples/test_riscv_example_017.s b/tests/arch/riscv/correct/examples/test_riscv_example_017.s new file mode 100644 index 000000000..c091b1d8b --- /dev/null +++ b/tests/arch/riscv/correct/examples/test_riscv_example_017.s @@ -0,0 +1,34 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.data + string: .string "Insert the string: " + space: .zero 100 + +.text +main: + # print "Insert string..." + la a0, string + li a7, 4 + ecall + + # read string + la a0, space + li a1, 100 + li a7, 8 + ecall + + # print enter + la a0, '\n' + li a7, 11 + ecall + + # print string + la a0, space + li a7, 4 + ecall + + # return + jr ra diff --git a/tests/arch/riscv/correct/libraries/test_riscv_libraries_001.out b/tests/arch/riscv/correct/libraries/test_riscv_libraries_001.out deleted file mode 100644 index f6b8c468b..000000000 --- a/tests/arch/riscv/correct/libraries/test_riscv_libraries_001.out +++ /dev/null @@ -1,9 +0,0 @@ - -10 - - -5 - - -cr[PC]:0x58; ir[x1,ra]:0x44; ir[x10,a0]:0xa; ir[x11,a1]:0xa; ir[x17,a7]:0xb; keyboard[0x0]:''; display[0x0]:'10%0A5%0A'; - diff --git a/tests/arch/riscv/correct/libraries/test_riscv_libraries_001.s b/tests/arch/riscv/correct/libraries/test_riscv_libraries_001.s index 601fa6981..6b32d43dd 100644 --- a/tests/arch/riscv/correct/libraries/test_riscv_libraries_001.s +++ b/tests/arch/riscv/correct/libraries/test_riscv_libraries_001.s @@ -1,17 +1,15 @@ -.data -newline: .string "\r\n" - -.text + .text main: + mv s0, ra li a0, 5 li a1, 10 jal ra, max li a7, 1 ecall - la a0, newline - li a7, 4 + li a0, '\n' + li a7, 11 ecall li a0, 5 @@ -20,9 +18,9 @@ newline: .string "\r\n" li a7, 1 ecall - la a0, newline - li a7, 4 + li a0, '\n' + li a7, 11 ecall - li a7, 10 - ecall + mv ra, s0 + jr ra diff --git a/tests/arch/riscv/correct/libraries/testing.s b/tests/arch/riscv/correct/libraries/testing.s deleted file mode 100644 index 9345b754e..000000000 --- a/tests/arch/riscv/correct/libraries/testing.s +++ /dev/null @@ -1,35 +0,0 @@ -.text -max: - bge a0, a1, bigger - mv a0, a1 -bigger: - jr ra - -min: - ble a0, a1, minor - mv a0, a1 -minor: - jr ra - - - - main: - li a0, 5 - li a1, 10 - jal ra, max - li a7, 1 - ecall - - li a0, '\n' - li a7, 11 - ecall - - li a0, 5 - li a1, 10 - jal ra, min - li a7, 1 - ecall - - li a0, '\n' - li a7, 11 - ecall diff --git a/tests/arch/riscv/correct/libraries/testing2.s b/tests/arch/riscv/correct/libraries/testing2.s deleted file mode 100644 index 8318dd513..000000000 --- a/tests/arch/riscv/correct/libraries/testing2.s +++ /dev/null @@ -1,8 +0,0 @@ -.text -main: -jal x0, 2 -jal x0, -2 -jal x0, 1048574 -jal x0, -1048576 -jal x0, 100000 -jal x0, -100000 \ No newline at end of file diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_001.out b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_001.out deleted file mode 100644 index cddaf93dd..000000000 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_001.out +++ /dev/null @@ -1,9 +0,0 @@ - -6673 -120 -34 --5678 -1066192077 -this is a string -cr[PC]:0x64; ir[x6,t1]:0x20001c; ir[x10,a0]:0x200008; ir[x17,a7]:0x4; fpr[f0,ft0]:0xffffffff3F8CCCCD; keyboard[0x0]:''; display[0x0]:'667312034-56781066192077this%20is%20a%20string'; - diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_002.out b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_002.out deleted file mode 100644 index f5a0b4798..000000000 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_002.out +++ /dev/null @@ -1,6 +0,0 @@ - -6673 --86 -1 -cr[PC]:0x2c; ir[x5,t0]:0x1; ir[x17,a7]:0x2; fpr[f10,fa0]:0xffffffff3F800000; keyboard[0x0]:''; display[0x0]:'6673-861'; - diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_003.out b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_003.out deleted file mode 100644 index bf4dd79ce..000000000 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_003.out +++ /dev/null @@ -1,6 +0,0 @@ - -6673 --86 -1 -cr[PC]:0x2c; ir[x5,t0]:0x1; ir[x17,a7]:0x3; fpr[f10,fa0]:0x3FF0000000000000; keyboard[0x0]:''; display[0x0]:'6673-861'; - diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_004.out b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_004.out deleted file mode 100644 index d08cb5580..000000000 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_004.out +++ /dev/null @@ -1,8 +0,0 @@ - -First String -Second String -a - - -cr[PC]:0x34; ir[x10,a0]:0xa; ir[x17,a7]:0xb; keyboard[0x0]:''; display[0x0]:'First%20StringSecond%20Stringa%0A'; - diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_005.s b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_005.s index 05f1fb810..ac99a90fd 100644 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_005.s +++ b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_005.s @@ -6,4 +6,5 @@ .text main: li a7, 5 - ecall \ No newline at end of file + ecall + jr ra \ No newline at end of file diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_006.s b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_006.s index b3ad184d5..f1770f2dd 100644 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_006.s +++ b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_006.s @@ -7,3 +7,4 @@ main: li a7, 6 ecall + jr ra diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_007.s b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_007.s index 177ae9419..cb406937d 100644 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_007.s +++ b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_007.s @@ -7,4 +7,4 @@ main: li a7, 7 ecall - \ No newline at end of file + jr ra \ No newline at end of file diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_008.s b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_008.s index e339d211c..28f0ce457 100644 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_008.s +++ b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_008.s @@ -14,4 +14,5 @@ li a7, 8 la a0, buffer li a1, 5 - ecall \ No newline at end of file + ecall + jr ra \ No newline at end of file diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_009.out b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_009.out deleted file mode 100644 index eff92bddb..000000000 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_009.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x1c; ir[x5,t0]:0xa; ir[x6,t1]:0x14; ir[x10,a0]:0x5bbfcc0; ir[x17,a7]:0x9; memory[0x5bbfcc7]:0x14; memory[0x5bbfcc3]:0x0a; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_009.s b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_009.s index 300d643e2..637c53162 100644 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_009.s +++ b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_009.s @@ -13,4 +13,10 @@ ecall sw t0, 0(a0) - sw t1, 4(a0) \ No newline at end of file + sw t1, 4(a0) + li a0, 8 + ecall + + sw t0, 0(a0) + sw t1, 4(a0) + jr ra diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_010.out b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_010.out deleted file mode 100644 index ffed9be10..000000000 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_010.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x8; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_010.s b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_010.s index 800efcdeb..5355c5c8c 100644 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_010.s +++ b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_010.s @@ -8,3 +8,4 @@ li a7, 10 ecall li t0, 453 + jr ra diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_011.out b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_011.out deleted file mode 100644 index 2e7d093b0..000000000 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_011.out +++ /dev/null @@ -1,4 +0,0 @@ - -c -cr[PC]:0xc; ir[x10,a0]:0x63; ir[x17,a7]:0xb; keyboard[0x0]:''; display[0x0]:'c'; - diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_011.s b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_011.s index 61cb6278f..0b7064bf5 100644 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_011.s +++ b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_011.s @@ -8,3 +8,4 @@ li a7, 11 li a0, 'c' ecall + jr ra diff --git a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_012.s b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_012.s index 7f3b95895..3a734cb42 100644 --- a/tests/arch/riscv/correct/syscalls/test_riscv_syscall_012.s +++ b/tests/arch/riscv/correct/syscalls/test_riscv_syscall_012.s @@ -7,3 +7,4 @@ main: li a7, 12 ecall + jr ra diff --git a/tests/arch/riscv/error.test.mts b/tests/arch/riscv/error.test.mts new file mode 100644 index 000000000..cfa60fb8b --- /dev/null +++ b/tests/arch/riscv/error.test.mts @@ -0,0 +1,18 @@ +import { ARCH, execution_tests, compile_error_tests } from "../arch_utils.mts"; + +execution_tests( + ARCH.riscv, + "riscv/error/executor", + undefined, + new Set([ + "test_riscv_error_executor_002.s", + "test_riscv_error_executor_003.s", + "test_riscv_error_executor_004.s", + "test_riscv_error_executor_005.s", + "test_riscv_error_executor_006.s", + "test_riscv_error_executor_007.s", + "test_riscv_error_executor_008.s", + ]), +); + +compile_error_tests(ARCH.riscv, "riscv/error/compiler") diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_001.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_001.out deleted file mode 100644 index 8155de365..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_001.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 9 (A): -Repeated tag: A - - 8 a: .byte -1 -->9 A: .half 23 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_002.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_002.out deleted file mode 100644 index 3c2aa4610..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_002.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 12 (suma): -Instruction 'suma' not found - - 11 main: -->12 suma t0, t1, t2 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_003.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_003.out deleted file mode 100644 index 5a0b754b2..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_003.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 12 (add rd rs1 rs2): -Incorrect instruction syntax for 'add rd rs1 rs2' - - 11 main: -->12 add t0, t1 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_004.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_004.out deleted file mode 100644 index 9b2d1dc38..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_004.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 12 (s50): -Register 's50' not found - - 11 main: -->12 add t0, t1, s50 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_005.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_005.out deleted file mode 100644 index 8a51b1caa..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_005.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (0x123): -Number '0x123' is too big - - 6 .data -->7 a: .byte 0x123 - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_006.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_006.out deleted file mode 100644 index 8a51b1caa..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_006.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (0x123): -Number '0x123' is too big - - 6 .data -->7 a: .byte 0x123 - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_007.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_007.out deleted file mode 100644 index 77e040699..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_007.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 11 (mains): -Tag 'mains' is not valid - - 10 li t0, 10 -->11 j mains - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_008.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_008.out deleted file mode 100644 index 1a1fa1532..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_008.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 8: -Please check instruction syntax, inmediate ranges, register name, etc. - - 7 main: -->8 j 0x12345678 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_009.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_009.out deleted file mode 100644 index 338606755..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_009.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 8: -Please check instruction syntax, inmediate ranges, register name, etc. - - 7 main: -->8 j 0xhello - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_010.s b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_010.s index d7c8857d4..99317a3d8 100644 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_010.s +++ b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_010.s @@ -5,8 +5,8 @@ .data .align 2 - spa: .zero 52428800 + spa: .zero 16 * 1024 * 1024 * 1024 .text main: - li t0, 10 \ No newline at end of file + li t0, 10 diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_014.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_014.out deleted file mode 100644 index a4744db4d..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_014.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 8 (.directive): -Invalid directive: .directive - - 7 .align 2 -->8 example: .directive 221 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_015.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_015.out deleted file mode 100644 index 691cbf761..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_015.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 8 (hello): -Invalid value 'hello' as number. - - 7 .align 2 -->8 example: .word hello - 9 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_016.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_016.out deleted file mode 100644 index d56d429ca..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_016.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 8: -The string of characters must start with " - - 7 .align 2 -->8 example: .string hello world" - 9 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_017.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_017.out deleted file mode 100644 index 81a724a14..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_017.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 8: -The string of characters must end with " - - 7 .align 2 -->8 example: .string "hello world - 9 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_018.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_018.out deleted file mode 100644 index 89c84b0f2..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_018.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (0x12345): -Number '0x12345' is too big - - 6 .data -->7 example: .half 0x12345 - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_019.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_019.out deleted file mode 100644 index d1dc21973..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_019.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (0x): -Number '0x' is empty - - 6 .data -->7 .byte 0x - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_021.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_021.out deleted file mode 100644 index 90b6f30f3..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_021.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 9: -The data must be aligned - - 8 example: .byte 23 -->9 example2: .half 2 - 10 string: .string "hello" - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_022.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_022.out deleted file mode 100644 index df7b1e2b4..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_022.out +++ /dev/null @@ -1,12 +0,0 @@ - - -Error at line 7 (-10): -The space directive value should be positive and greater than zero - - 6 .data -->7 .zero -10 - 8 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_023.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_023.out deleted file mode 100644 index a99e652c7..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_023.out +++ /dev/null @@ -1,11 +0,0 @@ - - -Error at line 10: -Empty directive - - 9 example2: .half -->10 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_030.out b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_030.out deleted file mode 100644 index e7ae53a33..000000000 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_030.out +++ /dev/null @@ -1,10 +0,0 @@ - - -Error at line 1 (Please enter the assembly code before compiling): -Please enter the assembly code before compiling - -->1 - -Not executed -keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_030.s b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_030.s index e69de29bb..4f8f3a5a4 100644 --- a/tests/arch/riscv/error/compiler/test_riscv_error_compiler_030.s +++ b/tests/arch/riscv/error/compiler/test_riscv_error_compiler_030.s @@ -0,0 +1,8 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text +main_: + li t0, 10 diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_002.s b/tests/arch/riscv/error/executor/test_riscv_error_executor_002.s new file mode 100644 index 000000000..3aa637410 --- /dev/null +++ b/tests/arch/riscv/error/executor/test_riscv_error_executor_002.s @@ -0,0 +1,9 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text +main: + li sp, 0xffffffff + jr ra diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_003.out b/tests/arch/riscv/error/executor/test_riscv_error_executor_003.out deleted file mode 100644 index 41f939f68..000000000 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_003.out +++ /dev/null @@ -1,6 +0,0 @@ - - - Error found. - Stack pointer cannot be placed in the text segment -cr[PC]:0x4; ir[x2,sp]:0x0; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_003.s b/tests/arch/riscv/error/executor/test_riscv_error_executor_003.s index d61e3decb..6e4c1c4c8 100644 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_003.s +++ b/tests/arch/riscv/error/executor/test_riscv_error_executor_003.s @@ -6,3 +6,4 @@ .text main: li sp, 0 + jr ra diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_004.out b/tests/arch/riscv/error/executor/test_riscv_error_executor_004.out deleted file mode 100644 index fffc73ce7..000000000 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_004.out +++ /dev/null @@ -1,6 +0,0 @@ - - - Error found. - Stack pointer cannot be placed in the data segment -cr[PC]:0xc; ir[x2,sp]:0x200000; ir[x5,t0]:0x200000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_004.s b/tests/arch/riscv/error/executor/test_riscv_error_executor_004.s index 57d3a7ae8..10506d2ba 100644 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_004.s +++ b/tests/arch/riscv/error/executor/test_riscv_error_executor_004.s @@ -7,3 +7,4 @@ main: li t0, 0x00200000 mv sp, t0 + jr ra diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_005.out b/tests/arch/riscv/error/executor/test_riscv_error_executor_005.out deleted file mode 100644 index ebc756a9e..000000000 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_005.out +++ /dev/null @@ -1,7 +0,0 @@ - -Segmentation fault. You tried to write in the text segment - - Error found. - The program has finished with errors -cr[PC]:0x8; ir[x5,t0]:0xa; memory[0x3]:0x0a; memory[0x2]:0x00; memory[0x1]:0x00; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_005.s b/tests/arch/riscv/error/executor/test_riscv_error_executor_005.s index 6f81fdadc..acd9bceea 100644 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_005.s +++ b/tests/arch/riscv/error/executor/test_riscv_error_executor_005.s @@ -7,4 +7,5 @@ main: li t0, 10 - sw t0, 0(zero) \ No newline at end of file + sw t0, 0(zero) + jr ra diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_006.out b/tests/arch/riscv/error/executor/test_riscv_error_executor_006.out deleted file mode 100644 index 641a1da44..000000000 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_006.out +++ /dev/null @@ -1,7 +0,0 @@ - -Segmentation fault. You tried to read in the text segment - - Error found. - The program has finished with errors -cr[PC]:0x8; ir[x5,t0]:0xa00293; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_006.s b/tests/arch/riscv/error/executor/test_riscv_error_executor_006.s index c72cd28e6..aaae79cb6 100644 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_006.s +++ b/tests/arch/riscv/error/executor/test_riscv_error_executor_006.s @@ -7,4 +7,5 @@ main: li t0, 10 - lw t0, 0(zero) \ No newline at end of file + lw t0, 0(zero) + jr ra diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_007.out b/tests/arch/riscv/error/executor/test_riscv_error_executor_007.out deleted file mode 100644 index 15ec1b3b1..000000000 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_007.out +++ /dev/null @@ -1,7 +0,0 @@ - -The memory must be align - - Error found. - The program has finished with errors -cr[PC]:0x10; ir[x5,t0]:0x200000; ir[x6,t1]:0xa; memory[0x200004]:0x0a; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_007.s b/tests/arch/riscv/error/executor/test_riscv_error_executor_007.s index dd90edd83..c591ec62d 100644 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_007.s +++ b/tests/arch/riscv/error/executor/test_riscv_error_executor_007.s @@ -11,4 +11,5 @@ main: la t0, a li t1, 10 - sw t1, 1(t0) \ No newline at end of file + sw t1, 1(t0) + jr ra diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_008.out b/tests/arch/riscv/error/executor/test_riscv_error_executor_008.out deleted file mode 100644 index 949224d25..000000000 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_008.out +++ /dev/null @@ -1,7 +0,0 @@ - -The memory must be align - - Error found. - The program has finished with errors -cr[PC]:0x10; ir[x5,t0]:0x200000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_008.s b/tests/arch/riscv/error/executor/test_riscv_error_executor_008.s index 519330089..8535757fa 100644 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_008.s +++ b/tests/arch/riscv/error/executor/test_riscv_error_executor_008.s @@ -11,4 +11,5 @@ main: la t0, a li t1, 10 - lw t1, 1(t0) \ No newline at end of file + lw t1, 1(t0) + jr ra diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_009.out b/tests/arch/riscv/error/executor/test_riscv_error_executor_009.out deleted file mode 100644 index e65d3b74b..000000000 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_009.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x4; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/error/executor/test_riscv_error_executor_009.s b/tests/arch/riscv/error/executor/test_riscv_error_executor_009.s index 8e37924be..fdb3b3167 100644 --- a/tests/arch/riscv/error/executor/test_riscv_error_executor_009.s +++ b/tests/arch/riscv/error/executor/test_riscv_error_executor_009.s @@ -6,4 +6,5 @@ .text main: - li zero, 10 \ No newline at end of file + li zero, 10 + jr ra diff --git a/tests/arch/riscv/instructions.test.mts b/tests/arch/riscv/instructions.test.mts new file mode 100644 index 000000000..5239ed99d --- /dev/null +++ b/tests/arch/riscv/instructions.test.mts @@ -0,0 +1,3 @@ +import { ARCH, execution_tests } from "../arch_utils.mts"; + +execution_tests(ARCH.riscv, "riscv/instructions"); diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_001.out b/tests/arch/riscv/instructions/test_riscv_instruction_001.out deleted file mode 100644 index 9b6c2763c..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_001.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[x5,t0]:0xa; ir[x6,t1]:0xffffffe2; ir[x8,fp,s0]:0xffffff; ir[x9,s1]:0xffffffec; ir[x10,a0]:0xffffffec; ir[x11,a1]:0xffffeb; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_001.s b/tests/arch/riscv/instructions/test_riscv_instruction_001.s index 6cc090db2..598092385 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_001.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_001.s @@ -13,7 +13,7 @@ main: add x9, x5, x6 # 10 - 30 add x10, x7, x9 # -20 + 0 - add x11, x8, x10 # -20 + 0xFFFFFF noo -> 0xFFFFFF - 20 + add x11, x8, x10 # -20 + 0xFFFFFF # end program jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_002.out b/tests/arch/riscv/instructions/test_riscv_instruction_002.out deleted file mode 100644 index 86264c0de..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_002.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x5,t0]:0xa; ir[x9,s1]:0xffffffec; ir[x10,a0]:0x187; ir[x11,a1]:0x193; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_002.s b/tests/arch/riscv/instructions/test_riscv_instruction_002.s index e6db252ef..d4fb18e85 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_002.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_002.s @@ -10,4 +10,6 @@ main: addi x9, x5, -30 # 10 - 30 addi x10, x9, 411 # x9 + 411 addi x11, x10, 12 # x10 - 12 - #addi x11, x10, 42568 # x10 - 42568 \ No newline at end of file + #addi x11, x10, 42568 # x10 - 42568 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_003.out b/tests/arch/riscv/instructions/test_riscv_instruction_003.out deleted file mode 100644 index 00aa1c232..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_003.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[x5,t0]:0x223; ir[x6,t1]:0xfffffc57; ir[x7,t2]:0xc; ir[x8,fp,s0]:0x123515; ir[x9,s1]:0x5cc; ir[x10,a0]:0xfffffa40; ir[x11,a1]:0x123ad5; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_003.s b/tests/arch/riscv/instructions/test_riscv_instruction_003.s index a0496bffd..219cd60ed 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_003.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_003.s @@ -13,4 +13,6 @@ main: sub x9, x5, x6 # 547 - (-937) sub x10, x7, x9 # 12 - 1484 - sub x11, x8, x10 # 0x123515 + 1472 \ No newline at end of file + sub x11, x8, x10 # 0x123515 + 1472 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_004.out b/tests/arch/riscv/instructions/test_riscv_instruction_004.out deleted file mode 100644 index 3804ee956..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_004.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[x5,t0]:0x23000; ir[x6,t1]:0x56db000; ir[x7,t2]:0x34000; ir[x8,fp,s0]:0xff002000; ir[x9,s1]:0x2000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_004.s b/tests/arch/riscv/instructions/test_riscv_instruction_004.s index fba8eb31a..1d7a55472 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_004.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_004.s @@ -10,4 +10,6 @@ main: lui x6, 22235 lui x7, 0x34 lui x8, 0xFF002 - lui x9, 2 \ No newline at end of file + lui x9, 2 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_005.out b/tests/arch/riscv/instructions/test_riscv_instruction_005.out deleted file mode 100644 index 1271c94c8..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_005.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x2c; ir[x1,ra]:0x18; ir[x5,t0]:0x223; ir[x6,t1]:0xfffffc57; ir[x7,t2]:0xc; ir[x8,fp,s0]:0x123515; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_006.out b/tests/arch/riscv/instructions/test_riscv_instruction_006.out deleted file mode 100644 index 1271c94c8..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_006.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x2c; ir[x1,ra]:0x18; ir[x5,t0]:0x223; ir[x6,t1]:0xfffffc57; ir[x7,t2]:0xc; ir[x8,fp,s0]:0x123515; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_006.s b/tests/arch/riscv/instructions/test_riscv_instruction_006.s index 37b337e98..2fed5e543 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_006.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_006.s @@ -11,7 +11,8 @@ main: li x7, 12 li x8, 0x123515 - jal x1, end + jal x0, mid +mid:jalr x1, 0x28(x0) sub x9, x5, x6 # 547 - (-937) sub x10, x7, x9 # 12 - 1484 @@ -19,4 +20,4 @@ main: end: li a7, 10 - ecall \ No newline at end of file + ecall diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_007.out b/tests/arch/riscv/instructions/test_riscv_instruction_007.out deleted file mode 100644 index af8d133ea..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_007.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x2c; ir[x5,t0]:0x44562; ir[x6,t1]:0x2; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x44562; ir[x17,a7]:0xa; ir[x28,t3]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_007.s b/tests/arch/riscv/instructions/test_riscv_instruction_007.s index cf3a3dea5..0d7cc9674 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_007.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_007.s @@ -5,19 +5,30 @@ .text main: - li x5, 0x44562 - li x6, 2 - li x7, 5 - li x8, 0x44562 - beq x7, x5, jump1 - beq x5, x6, jump1 + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + beq t0, t0, j0 + li s0, 1 +j0: beq t0, t1, j1 + li s1, 1 +j1: beq t1, t0, j2 + li s2, 1 +j2: beq t2, t2, j3 + li s3, 1 +j3: beq t2, t3, j4 + li s4, 1 +j4: beq t3, t2, j5 + li s5, 1 +j5: beq t0, t2, j6 + li s6, 1 +j6: beq t2, t0, j7 + li s7, 1 +j7: beq t1, t3, j8 + li s8, 1 +j8: beq t3, t1, end + li s9, 1 - jump1: - li x5, 11 - li x6, 555 - beq x0, x0, jump2 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_008.out b/tests/arch/riscv/instructions/test_riscv_instruction_008.out deleted file mode 100644 index 21d396ff4..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_008.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0x754; ir[x6,t1]:0x22b; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x44562; ir[x17,a7]:0xa; ir[x28,t3]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_008.s b/tests/arch/riscv/instructions/test_riscv_instruction_008.s index 512216c24..f6b2657e0 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_008.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_008.s @@ -5,18 +5,30 @@ .text main: - li x5, 361 - li x6, 2 - li x7, 5 - li x8, 0x44562 - bne x5, x7, jump1 + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + bne t0, t0, j0 + li s0, 1 +j0: bne t0, t1, j1 + li s1, 1 +j1: bne t1, t0, j2 + li s2, 1 +j2: bne t2, t2, j3 + li s3, 1 +j3: bne t2, t3, j4 + li s4, 1 +j4: bne t3, t2, j5 + li s5, 1 +j5: bne t0, t2, j6 + li s6, 1 +j6: bne t2, t0, j7 + li s7, 1 +j7: bne t1, t3, j8 + li s8, 1 +j8: bne t3, t1, end + li s9, 1 - jump1: - li x5, 0x754 - li x6, 555 - bne x5, x6, jump2 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_009.out b/tests/arch/riscv/instructions/test_riscv_instruction_009.out deleted file mode 100644 index d4bf66ee9..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_009.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[x5,t0]:0x169; ir[x6,t1]:0x2; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x44562; ir[x9,s1]:0x754; ir[x10,a0]:0x22b; ir[x17,a7]:0xa; ir[x28,t3]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_009.s b/tests/arch/riscv/instructions/test_riscv_instruction_009.s index ff148e7f8..aaa296f7a 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_009.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_009.s @@ -5,19 +5,30 @@ .text main: - li x5, 361 - li x6, 2 - li x7, 5 - li x8, 0x44562 - blt x5, x7, jump1 - blt x6, x5, jump1 + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + blt t0, t0, j0 + li s0, 1 +j0: blt t0, t1, j1 + li s1, 1 +j1: blt t1, t0, j2 + li s2, 1 +j2: blt t2, t2, j3 + li s3, 1 +j3: blt t2, t3, j4 + li s4, 1 +j4: blt t3, t2, j5 + li s5, 1 +j5: blt t0, t2, j6 + li s6, 1 +j6: blt t2, t0, j7 + li s7, 1 +j7: blt t1, t3, j8 + li s8, 1 +j8: blt t3, t1, end + li s9, 1 - jump1: - li x9, 0x754 - li x10, 555 - blt x10, x9, jump2 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_010.out b/tests/arch/riscv/instructions/test_riscv_instruction_010.out deleted file mode 100644 index cd97af2a3..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_010.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[x5,t0]:0x754; ir[x6,t1]:0x2; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x44562; ir[x17,a7]:0xa; ir[x28,t3]:0x22; ir[x31,t6]:0x22b; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_010.s b/tests/arch/riscv/instructions/test_riscv_instruction_010.s index 0169ef8bd..6463d2a44 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_010.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_010.s @@ -5,20 +5,30 @@ .text main: - li x5, 361 - li x6, 2 - li x7, 5 - li x8, 0x44562 - bge x5, x8, jump1 - bge x8, x5, jump1 - - jump2: - li t3, 34 - li a7, 10 - ecall + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump1: - li x5, 0x754 - li t6, 555 - bge x5, x6, jump2 + bge t0, t0, j0 + li s0, 1 +j0: bge t0, t1, j1 + li s1, 1 +j1: bge t1, t0, j2 + li s2, 1 +j2: bge t2, t2, j3 + li s3, 1 +j3: bge t2, t3, j4 + li s4, 1 +j4: bge t3, t2, j5 + li s5, 1 +j5: bge t0, t2, j6 + li s6, 1 +j6: bge t2, t0, j7 + li s7, 1 +j7: bge t1, t3, j8 + li s8, 1 +j8: bge t3, t1, end + li s9, 1 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_011.out b/tests/arch/riscv/instructions/test_riscv_instruction_011.out deleted file mode 100644 index d4bf66ee9..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_011.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[x5,t0]:0x169; ir[x6,t1]:0x2; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x44562; ir[x9,s1]:0x754; ir[x10,a0]:0x22b; ir[x17,a7]:0xa; ir[x28,t3]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_011.s b/tests/arch/riscv/instructions/test_riscv_instruction_011.s index 63348a230..d3e9ca304 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_011.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_011.s @@ -5,19 +5,30 @@ .text main: - li x5, 361 - li x6, 2 - li x7, 5 - li x8, 0x44562 - bltu x5, x7, jump1 - bltu x6, x5, jump1 + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + bltu t0, t0, j0 + li s0, 1 +j0: bltu t0, t1, j1 + li s1, 1 +j1: bltu t1, t0, j2 + li s2, 1 +j2: bltu t2, t2, j3 + li s3, 1 +j3: bltu t2, t3, j4 + li s4, 1 +j4: bltu t3, t2, j5 + li s5, 1 +j5: bltu t0, t2, j6 + li s6, 1 +j6: bltu t2, t0, j7 + li s7, 1 +j7: bltu t1, t3, j8 + li s8, 1 +j8: bltu t3, t1, end + li s9, 1 - jump1: - li x9, 0x754 - li x10, 555 - bltu x10, x9, jump2 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_012.out b/tests/arch/riscv/instructions/test_riscv_instruction_012.out deleted file mode 100644 index cd97af2a3..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_012.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[x5,t0]:0x754; ir[x6,t1]:0x2; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x44562; ir[x17,a7]:0xa; ir[x28,t3]:0x22; ir[x31,t6]:0x22b; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_012.s b/tests/arch/riscv/instructions/test_riscv_instruction_012.s index 00dcd7b82..5b86789b4 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_012.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_012.s @@ -5,20 +5,30 @@ .text main: - li x5, 361 - li x6, 2 - li x7, 5 - li x8, 0x44562 - bgeu x5, x8, jump1 - bgeu x8, x5, jump1 - - jump2: - li t3, 34 - li a7, 10 - ecall + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump1: - li x5, 0x754 - li t6, 555 - bgeu x5, x6, jump2 + bgeu t0, t0, j0 + li s0, 1 +j0: bgeu t0, t1, j1 + li s1, 1 +j1: bgeu t1, t0, j2 + li s2, 1 +j2: bgeu t2, t2, j3 + li s3, 1 +j3: bgeu t2, t3, j4 + li s4, 1 +j4: bgeu t3, t2, j5 + li s5, 1 +j5: bgeu t0, t2, j6 + li s6, 1 +j6: bgeu t2, t0, j7 + li s7, 1 +j7: bgeu t1, t3, j8 + li s8, 1 +j8: bgeu t3, t1, end + li s9, 1 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_013.s b/tests/arch/riscv/instructions/test_riscv_instruction_013.s new file mode 100644 index 000000000..8505e6ef6 --- /dev/null +++ b/tests/arch/riscv/instructions/test_riscv_instruction_013.s @@ -0,0 +1,48 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.data + w1: .word 14 + b1: .byte 127, -42 + + .align 1 + h1: .half 32767, -12345 + .align 2 + w2: .zero 4 + b2: .zero 2 + + .align 1 + h2: .zero 4 + +.text +main: + + la x5, w1 # w1 address -> x5 + la x6, b1 # b1 address -> x6 + la x7, h1 # h1 address -> x7 + + lw x8, 0 (x5) # Memory[x5] -> x8 + #lw x9, w1 # Memory[w1] -> x9 + + lb x10, 0(x6) # Memory[x6] -> x10 + lb x11, 1(x6) # Memory[x6+1] -> x11 + #lb x11, b1 # Memory[b1] -> x11 + + lh x12, 0 (x7) # Memory[x7] -> x12 + lh x13, 2 (x7) # Memory[x7+2] -> x12 + #lh x13, h1 # Memory[h1] -> x13 + + la x14, w2 # w2 address -> x14 + sw x8, 0(x14) # x8 -> Memory[w2] + + la x14, b2 # b2 address -> x14 + sb x10, 0(x14) # x10 -> Memory[b2] + sb x11, 1(x14) # x11 -> Memory[b2+1] + + la x14, h2 # h2 address -> x14 + sh x12, 0(x14) # x12 -> Memory[h2] + sh x13, 2(x14) # x13 -> Memory[h2+2] + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_014.out b/tests/arch/riscv/instructions/test_riscv_instruction_014.out deleted file mode 100644 index 7059f0735..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_014.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[x6,t1]:0x200000; ir[x7,t2]:0x200002; ir[x10,a0]:0x7f; ir[x12,a2]:0xffff; ir[x14,a4]:0x200006; memory[0x200007]:0xff; memory[0x200006]:0xff; memory[0x200004]:0x7f; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_014.s b/tests/arch/riscv/instructions/test_riscv_instruction_014.s index 4226d8430..09dcb5c8a 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_014.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_014.s @@ -4,13 +4,13 @@ # .data - b1: .byte 127 + b1: .byte 127, -42 .align 1 - h1: .half 65535 - b2: .zero 1 + h1: .half 32767, -12345 + b2: .zero 2 .align 1 - h2: .zero 2 + h2: .zero 4 .text main: @@ -19,13 +19,17 @@ main: la x7, h1 # h1 address -> x7 lbu x10, 0(x6) # Memory[x6] -> x10 + lbu x11, 1(x6) # Memory[x6+1] -> x13 lhu x12, 0 (x7) # Memory[x7] -> x12 + lhu x13, 2 (x7) # Memory[x7+2] -> x13 la x14, b2 # b2 address -> x14 sb x10, 0(x14) # x10 -> Memory[b2] + sb x11, 1(x14) # x11 -> Memory[b2+1] la x14, h2 # h2 address -> x14 sh x12, 0(x14) # x12 -> Memory[h2] + sh x13, 2(x14) # x13 -> Memory[h2+2] - + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_015.out b/tests/arch/riscv/instructions/test_riscv_instruction_015.out deleted file mode 100644 index 77770faba..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_015.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[x5,t0]:0x2f0; ir[x8,fp,s0]:0x1; ir[x9,s1]:0x1; ir[x10,a0]:0xfffffc00; ir[x13,a3]:0x1; ir[x14,a4]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_015.s b/tests/arch/riscv/instructions/test_riscv_instruction_015.s index 855a234f0..2d478dbf2 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_015.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_015.s @@ -17,3 +17,5 @@ main: slti x12, x10, -1024 slti x13, x10, -1023 slti x14, x10, -1022 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_016.out b/tests/arch/riscv/instructions/test_riscv_instruction_016.out deleted file mode 100644 index 77770faba..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_016.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x28; ir[x5,t0]:0x2f0; ir[x8,fp,s0]:0x1; ir[x9,s1]:0x1; ir[x10,a0]:0xfffffc00; ir[x13,a3]:0x1; ir[x14,a4]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_016.s b/tests/arch/riscv/instructions/test_riscv_instruction_016.s index 0281f6484..bfb5d0e11 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_016.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_016.s @@ -17,4 +17,5 @@ main: sltiu x12, x10, -1024 sltiu x13, x10, -1023 sltiu x14, x10, -1022 - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_017.out b/tests/arch/riscv/instructions/test_riscv_instruction_017.out deleted file mode 100644 index f66ba25a1..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_017.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0x22346; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x22713; ir[x9,s1]:0x13f5; ir[x10,a0]:0xffffdd0d; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_017.s b/tests/arch/riscv/instructions/test_riscv_instruction_017.s index f60d28db0..163a93426 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_017.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_017.s @@ -13,4 +13,5 @@ main: xori x8, x5, 0x455 xori x9, x6, 0x222 xori x10, x7, 0x7FF - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_018.out b/tests/arch/riscv/instructions/test_riscv_instruction_018.out deleted file mode 100644 index 86396ba9b..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_018.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0x22346; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x22757; ir[x9,s1]:0x13f7; ir[x10,a0]:0xffffdfff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_018.s b/tests/arch/riscv/instructions/test_riscv_instruction_018.s index 3afe33af6..0d4b1b46b 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_018.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_018.s @@ -13,4 +13,5 @@ main: ori x8, x5, 0x455 ori x9, x6, 0x222 ori x10, x7, 0x7FF - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_019.out b/tests/arch/riscv/instructions/test_riscv_instruction_019.out deleted file mode 100644 index 542127014..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_019.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0x22346; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x44; ir[x9,s1]:0x2; ir[x10,a0]:0x2f2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_019.s b/tests/arch/riscv/instructions/test_riscv_instruction_019.s index 02ab3a5a5..d561e683e 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_019.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_019.s @@ -13,4 +13,5 @@ main: andi x8, x5, 0x455 andi x9, x6, 0x222 andi x10, x7, 0x7FF - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_020.out b/tests/arch/riscv/instructions/test_riscv_instruction_020.out deleted file mode 100644 index b77dbf3fb..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_020.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0xaad4; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x2ab50; ir[x9,s1]:0x11d70; ir[x10,a0]:0xed790000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_020.s b/tests/arch/riscv/instructions/test_riscv_instruction_020.s index e9402f6a9..32e0555b4 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_020.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_020.s @@ -13,5 +13,5 @@ main: slli x8, x5, 2 slli x9, x6, 4 slli x10, x7, 15 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_021.out b/tests/arch/riscv/instructions/test_riscv_instruction_021.out deleted file mode 100644 index 4061495a9..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_021.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0xaad4; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x2ab5; ir[x9,s1]:0x11d; ir[x10,a0]:0x1ffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_021.s b/tests/arch/riscv/instructions/test_riscv_instruction_021.s index 8230216ef..06880a71a 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_021.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_021.s @@ -13,5 +13,5 @@ main: srli x8, x5, 2 srli x9, x6,4 srli x10, x7, 15 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_022.out b/tests/arch/riscv/instructions/test_riscv_instruction_022.out deleted file mode 100644 index 4061495a9..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_022.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0xaad4; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x2ab5; ir[x9,s1]:0x11d; ir[x10,a0]:0x1ffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_022.s b/tests/arch/riscv/instructions/test_riscv_instruction_022.s index 334e2d526..980c04dbc 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_022.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_022.s @@ -13,5 +13,5 @@ main: srai x8, x5, 2 srai x9, x6, 4 srai x10, x7, 15 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_023.out b/tests/arch/riscv/instructions/test_riscv_instruction_023.out deleted file mode 100644 index 388f71930..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_023.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[x5,t0]:0xaad4; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x2; ir[x9,s1]:0x1; ir[x10,a0]:0x554; ir[x11,a1]:0x2ab50; ir[x12,a2]:0x23ae; ir[x13,a3]:0xaf200000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_023.s b/tests/arch/riscv/instructions/test_riscv_instruction_023.s index 0fcd4cba9..966b579d0 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_023.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_023.s @@ -17,5 +17,5 @@ main: sll x11, x5, x8 sll x12, x6, x9 sll x13, x7, x10 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_024.out b/tests/arch/riscv/instructions/test_riscv_instruction_024.out deleted file mode 100644 index 16aa3e8f5..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_024.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[x4,tp]:0x1fff; ir[x5,t0]:0x2000; ir[x6,t1]:0x2001; ir[x7,t2]:0x2002; ir[x10,a0]:0x1; ir[x11,a1]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_024.s b/tests/arch/riscv/instructions/test_riscv_instruction_024.s index ce6a1636a..bcaa66a29 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_024.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_024.s @@ -15,5 +15,5 @@ main: slt x9, x5, x5 slt x10, x5, x6 slt x11, x5, x7 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_025.out b/tests/arch/riscv/instructions/test_riscv_instruction_025.out deleted file mode 100644 index 16aa3e8f5..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_025.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[x4,tp]:0x1fff; ir[x5,t0]:0x2000; ir[x6,t1]:0x2001; ir[x7,t2]:0x2002; ir[x10,a0]:0x1; ir[x11,a1]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_025.s b/tests/arch/riscv/instructions/test_riscv_instruction_025.s index bb195955d..059c11d0b 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_025.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_025.s @@ -15,5 +15,5 @@ main: sltu x9, x5, x5 sltu x10, x5, x6 sltu x11, x5, x7 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_026.out b/tests/arch/riscv/instructions/test_riscv_instruction_026.out deleted file mode 100644 index 096e3c74a..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_026.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[x5,t0]:0x22346; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x455; ir[x9,s1]:0x222; ir[x10,a0]:0xfff; ir[x11,a1]:0x22713; ir[x12,a2]:0x13f5; ir[x13,a3]:0xffffd50d; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_026.s b/tests/arch/riscv/instructions/test_riscv_instruction_026.s index a4a23438c..50ad86b15 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_026.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_026.s @@ -16,4 +16,5 @@ main: xor x11, x5, x8 xor x12, x6, x9 xor x13, x7, x10 - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_027.out b/tests/arch/riscv/instructions/test_riscv_instruction_027.out deleted file mode 100644 index 6f7aacc1f..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_027.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[x5,t0]:0xaad4; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x2; ir[x9,s1]:0x1; ir[x10,a0]:0x554; ir[x11,a1]:0x2ab5; ir[x12,a2]:0x8eb; ir[x13,a3]:0xfff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_027.s b/tests/arch/riscv/instructions/test_riscv_instruction_027.s index a4f9a6850..fa173b152 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_027.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_027.s @@ -17,5 +17,5 @@ main: srl x11, x5, x8 srl x12, x6, x9 srl x13, x7, x10 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_028.out b/tests/arch/riscv/instructions/test_riscv_instruction_028.out deleted file mode 100644 index 2e3bd4b04..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_028.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x30; ir[x5,t0]:0xaad4; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x2; ir[x9,s1]:0x1; ir[x10,a0]:0x3; ir[x11,a1]:0x2ab5; ir[x12,a2]:0x8eb; ir[x13,a3]:0xfffffb5e; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_028.s b/tests/arch/riscv/instructions/test_riscv_instruction_028.s index 6ee6c537d..fc827460c 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_028.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_028.s @@ -17,5 +17,5 @@ main: sra x11, x5, x8 sra x12, x6, x9 sra x13, x7, x10 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_029.out b/tests/arch/riscv/instructions/test_riscv_instruction_029.out deleted file mode 100644 index 24437a090..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_029.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[x5,t0]:0x22346; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x455; ir[x9,s1]:0x222; ir[x10,a0]:0xfff; ir[x11,a1]:0x22757; ir[x12,a2]:0x13f7; ir[x13,a3]:0xffffdfff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_029.s b/tests/arch/riscv/instructions/test_riscv_instruction_029.s index 0bb5ada10..75185d581 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_029.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_029.s @@ -17,4 +17,5 @@ main: or x11, x5, x8 or x12, x6, x9 or x13, x7, x10 - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_030.out b/tests/arch/riscv/instructions/test_riscv_instruction_030.out deleted file mode 100644 index 07949e23b..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_030.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x34; ir[x5,t0]:0x22346; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x455; ir[x9,s1]:0x222; ir[x10,a0]:0xfff; ir[x11,a1]:0x44; ir[x12,a2]:0x2; ir[x13,a3]:0xaf2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_030.s b/tests/arch/riscv/instructions/test_riscv_instruction_030.s index af649328a..0a12873b1 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_030.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_030.s @@ -17,4 +17,5 @@ main: and x11, x5, x8 and x12, x6, x9 and x13, x7, x10 - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_031.out b/tests/arch/riscv/instructions/test_riscv_instruction_031.out deleted file mode 100644 index fa69ecb29..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_031.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x48; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200028; ir[x17,a7]:0xa; fpr[f0,ft0]:0x404145A1CAC08312; fpr[f2,ft2]:0x4026E2D0E5604189; fpr[f10,fa0]:0x0000000007544FFB; memory[0x20002f]:0xFB; memory[0x20002e]:0x4F; memory[0x20002d]:0x54; memory[0x20002c]:0x07; memory[0x200027]:0x89; memory[0x200026]:0x41; memory[0x200025]:0x60; memory[0x200024]:0xE5; memory[0x200023]:0xD0; memory[0x200022]:0xE2; memory[0x200021]:0x26; memory[0x200020]:0x40; memory[0x20001f]:0x12; memory[0x20001e]:0x83; memory[0x20001d]:0xC0; memory[0x20001c]:0xCA; memory[0x20001b]:0xA1; memory[0x20001a]:0x45; memory[0x200019]:0x41; memory[0x200018]:0x40; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_032.out b/tests/arch/riscv/instructions/test_riscv_instruction_032.out deleted file mode 100644 index 3b389b284..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_032.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0xaad4; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x11,a1]:0x2ab50; ir[x12,a2]:0x23ae; ir[x13,a3]:0xed790000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_032.s b/tests/arch/riscv/instructions/test_riscv_instruction_032.s index 3eb06ea4d..961877008 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_032.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_032.s @@ -13,5 +13,5 @@ main: slli x11, x5, 2 slli x12, x6, 1 slli x13, x7, 15 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_033.out b/tests/arch/riscv/instructions/test_riscv_instruction_033.out deleted file mode 100644 index 2457c5412..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_033.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0xaad4; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0x2ab5; ir[x9,s1]:0x8eb; ir[x10,a0]:0x1ffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_033.s b/tests/arch/riscv/instructions/test_riscv_instruction_033.s index b5ef81c57..f3d4b7a91 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_033.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_033.s @@ -13,5 +13,5 @@ main: srli x8, x5, 2 srli x9, x6, 1 srli x10, x7, 15 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_034.out b/tests/arch/riscv/instructions/test_riscv_instruction_034.out deleted file mode 100644 index 11914d179..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_034.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[x5,t0]:0xa; ir[x6,t1]:0xd; ir[x7,t2]:0x2d; ir[x8,fp,s0]:0xfffffffe; ir[x9,s1]:0x82; ir[x10,a0]:0x249; ir[x11,a1]:0xffffffa6; ir[x12,a2]:0xffffffec; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_034.s b/tests/arch/riscv/instructions/test_riscv_instruction_034.s index 2febf9bb1..5f4dd8861 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_034.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_034.s @@ -14,4 +14,6 @@ main: mul x9, x5, x6 mul x10, x6, x7 mul x11, x7, x8 - mul x12, x8, x5 \ No newline at end of file + mul x12, x8, x5 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_035.out b/tests/arch/riscv/instructions/test_riscv_instruction_035.out deleted file mode 100644 index f44fa7a68..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_035.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[x5,t0]:0xa; ir[x6,t1]:0xd; ir[x7,t2]:0x2d; ir[x8,fp,s0]:0xfffffffe; ir[x11,a1]:0xffffffff; ir[x12,a2]:0xffffffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_035.s b/tests/arch/riscv/instructions/test_riscv_instruction_035.s index 22d187c2e..ba7eadb3f 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_035.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_035.s @@ -14,4 +14,6 @@ main: mulh x9, x5, x6 mulh x10, x6, x7 mulh x11, x7, x8 - mulh x12, x8, x5 \ No newline at end of file + mulh x12, x8, x5 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_036.out b/tests/arch/riscv/instructions/test_riscv_instruction_036.out deleted file mode 100644 index ea927e21c..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_036.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[x5,t0]:0xa; ir[x6,t1]:0xd; ir[x7,t2]:0x2d; ir[x8,fp,s0]:0xfffffffe; ir[x11,a1]:0x2c; ir[x12,a2]:0xffffffff; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_036.s b/tests/arch/riscv/instructions/test_riscv_instruction_036.s index 21bd31725..8d8b115f9 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_036.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_036.s @@ -14,4 +14,6 @@ main: mulhsu x9, x5, x6 mulhsu x10, x6, x7 mulhsu x11, x7, x8 - mulhsu x12, x8, x5 \ No newline at end of file + mulhsu x12, x8, x5 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_037.out b/tests/arch/riscv/instructions/test_riscv_instruction_037.out deleted file mode 100644 index 28c4473a5..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_037.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x20; ir[x5,t0]:0xa; ir[x6,t1]:0xd; ir[x7,t2]:0x2d; ir[x8,fp,s0]:0xfffffffe; ir[x11,a1]:0x2c; ir[x12,a2]:0x9; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_037.s b/tests/arch/riscv/instructions/test_riscv_instruction_037.s index d8aa6bcb8..f2e4855d8 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_037.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_037.s @@ -14,4 +14,6 @@ main: mulhu x9, x5, x6 mulhu x10, x6, x7 mulhu x11, x7, x8 - mulhu x12, x8, x5 \ No newline at end of file + mulhu x12, x8, x5 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_038.out b/tests/arch/riscv/instructions/test_riscv_instruction_038.out deleted file mode 100644 index c4e091cd4..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_038.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0x10; ir[x6,t1]:0x100; ir[x7,t2]:0xffffe000; ir[x8,fp,s0]:0x18; ir[x9,s1]:0xfffffe00; ir[x10,a0]:0x10; ir[x11,a1]:0xfffffeab; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_038.s b/tests/arch/riscv/instructions/test_riscv_instruction_038.s index 872c90619..c4dc3fa11 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_038.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_038.s @@ -14,4 +14,6 @@ main: div x9, x7, x5 div x10, x6, x5 div x11, x7, x8 - div x12, x8, x7 \ No newline at end of file + div x12, x8, x7 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_039.out b/tests/arch/riscv/instructions/test_riscv_instruction_039.out deleted file mode 100644 index f7fe5caf1..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_039.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0x10; ir[x6,t1]:0x100; ir[x7,t2]:0xffffe000; ir[x8,fp,s0]:0x18; ir[x9,s1]:0xffffe00; ir[x10,a0]:0x10; ir[x11,a1]:0xaaaa955; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_039.s b/tests/arch/riscv/instructions/test_riscv_instruction_039.s index e3e35296c..73d502bcd 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_039.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_039.s @@ -14,4 +14,6 @@ main: divu x9, x7, x5 divu x10, x6, x5 divu x11, x7, x8 - divu x12, x8, x7 \ No newline at end of file + divu x12, x8, x7 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_040.out b/tests/arch/riscv/instructions/test_riscv_instruction_040.out deleted file mode 100644 index 2faa31cb3..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_040.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x24; ir[x5,t0]:0x10; ir[x6,t1]:0x100; ir[x7,t2]:0xffffe000; ir[x8,fp,s0]:0x18; ir[x11,a1]:0x8; ir[x12,a2]:0x18; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_040.s b/tests/arch/riscv/instructions/test_riscv_instruction_040.s index 1646350c8..ebc40381d 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_040.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_040.s @@ -14,4 +14,6 @@ main: rem x9, x7, x5 rem x10, x6, x5 rem x11, x7, x8 - rem x12, x8, x7 \ No newline at end of file + rem x12, x8, x7 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_041.out b/tests/arch/riscv/instructions/test_riscv_instruction_041.out deleted file mode 100644 index a6c4184e4..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_041.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0x10; ir[x6,t1]:0x100; ir[x7,t2]:0xffffe000; ir[x8,fp,s0]:0x18; ir[x11,a1]:0x8; ir[x12,a2]:0x18; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_041.s b/tests/arch/riscv/instructions/test_riscv_instruction_041.s index 8f0998d68..09ac24249 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_041.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_041.s @@ -14,4 +14,6 @@ main: remu x9, x7, x5 remu x10, x6, x5 remu x11, x7, x8 - remu x12, x8, x7 \ No newline at end of file + remu x12, x8, x7 + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_042.out b/tests/arch/riscv/instructions/test_riscv_instruction_042.out deleted file mode 100644 index d540a9815..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_042.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0xb; ir[x6,t1]:0x22b; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x21f; ir[x17,a7]:0xa; ir[x28,t3]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_042.s b/tests/arch/riscv/instructions/test_riscv_instruction_042.s index ca3df7384..5e6cea4c0 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_042.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_042.s @@ -5,19 +5,30 @@ .text main: - li x5, 882 - li x6, 881 - li x7, 5 - li x8, 543 - bgt x6, x5, jump1 - bgt x5, x8, jump1 + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + bgt t0, t0, j0 + li s0, 1 +j0: bgt t0, t1, j1 + li s1, 1 +j1: bgt t1, t0, j2 + li s2, 1 +j2: bgt t2, t2, j3 + li s3, 1 +j3: bgt t2, t3, j4 + li s4, 1 +j4: bgt t3, t2, j5 + li s5, 1 +j5: bgt t0, t2, j6 + li s6, 1 +j6: bgt t2, t0, j7 + li s7, 1 +j7: bgt t1, t3, j8 + li s8, 1 +j8: bgt t3, t1, end + li s9, 1 - jump1: - li x5, 11 - li x6, 555 - bgt x6, x5, jump2 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_043.out b/tests/arch/riscv/instructions/test_riscv_instruction_043.out deleted file mode 100644 index b1e9bb09b..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_043.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x24; ir[x5,t0]:0xb; ir[x6,t1]:0x22b; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x21f; ir[x17,a7]:0xa; ir[x28,t3]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_043.s b/tests/arch/riscv/instructions/test_riscv_instruction_043.s index 94823d18a..b67f6d2cf 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_043.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_043.s @@ -5,19 +5,30 @@ .text main: - li x5, -882 - li x6, -881 - li x7, 5 - li x8, 543 - bgtu x5, x6, jump1 - bgtu x8, x7, jump1 + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + bgtu t0, t0, j0 + li s0, 1 +j0: bgtu t0, t1, j1 + li s1, 1 +j1: bgtu t1, t0, j2 + li s2, 1 +j2: bgtu t2, t2, j3 + li s3, 1 +j3: bgtu t2, t3, j4 + li s4, 1 +j4: bgtu t3, t2, j5 + li s5, 1 +j5: bgtu t0, t2, j6 + li s6, 1 +j6: bgtu t2, t0, j7 + li s7, 1 +j7: bgtu t1, t3, j8 + li s8, 1 +j8: bgtu t3, t1, end + li s9, 1 - jump1: - li x5, 11 - li x6, 555 - bgtu x6, x5, jump2 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_044.out b/tests/arch/riscv/instructions/test_riscv_instruction_044.out deleted file mode 100644 index d540a9815..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_044.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x24; ir[x5,t0]:0xb; ir[x6,t1]:0x22b; ir[x7,t2]:0x5; ir[x8,fp,s0]:0x21f; ir[x17,a7]:0xa; ir[x28,t3]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_044.s b/tests/arch/riscv/instructions/test_riscv_instruction_044.s index 3d01c9b49..6b84468ac 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_044.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_044.s @@ -5,19 +5,30 @@ .text main: - li x5, 882 - li x6, 881 - li x7, 5 - li x8, 543 - ble x5, x6, jump1 - ble x7, x8, jump1 + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + ble t0, t0, j0 + li s0, 1 +j0: ble t0, t1, j1 + li s1, 1 +j1: ble t1, t0, j2 + li s2, 1 +j2: ble t2, t2, j3 + li s3, 1 +j3: ble t2, t3, j4 + li s4, 1 +j4: ble t3, t2, j5 + li s5, 1 +j5: ble t0, t2, j6 + li s6, 1 +j6: ble t2, t0, j7 + li s7, 1 +j7: ble t1, t3, j8 + li s8, 1 +j8: ble t3, t1, end + li s9, 1 - jump1: - li x5, 11 - li x6, 555 - ble x5, x6, jump2 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_045.out b/tests/arch/riscv/instructions/test_riscv_instruction_045.out deleted file mode 100644 index 5f5ed833a..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_045.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x24; ir[x5,t0]:0xb; ir[x6,t1]:0xfffffdd5; ir[x7,t2]:0x5; ir[x8,fp,s0]:0xfffffde1; ir[x17,a7]:0xa; ir[x28,t3]:0x22; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_045.s b/tests/arch/riscv/instructions/test_riscv_instruction_045.s index c5cd3d611..1fbdaaa97 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_045.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_045.s @@ -5,19 +5,30 @@ .text main: - li x5, -882 - li x6, -881 - li x7, 5 - li x8, -543 - ble x6, x5, jump1 - ble x6, x8, jump1 + li t0, -40 + li t1, -10 + li t2, 15 + li t3, 32 - jump2: - li t3, 34 - li a7, 10 - ecall + bleu t0, t0, j0 + li s0, 1 +j0: bleu t0, t1, j1 + li s1, 1 +j1: bleu t1, t0, j2 + li s2, 1 +j2: bleu t2, t2, j3 + li s3, 1 +j3: bleu t2, t3, j4 + li s4, 1 +j4: bleu t3, t2, j5 + li s5, 1 +j5: bleu t0, t2, j6 + li s6, 1 +j6: bleu t2, t0, j7 + li s7, 1 +j7: bleu t1, t3, j8 + li s8, 1 +j8: bleu t3, t1, end + li s9, 1 - jump1: - li x5, 11 - li x6, -555 - ble x6, x5, jump2 +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_046.out b/tests/arch/riscv/instructions/test_riscv_instruction_046.out deleted file mode 100644 index 3764481ae..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_046.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x24; ir[x5,t0]:0x22346; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0xfffddcb9; ir[x9,s1]:0xffffee28; ir[x10,a0]:0x250d; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_046.s b/tests/arch/riscv/instructions/test_riscv_instruction_046.s index 4d6501f09..df1b8b884 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_046.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_046.s @@ -13,4 +13,5 @@ main: not x8, x5 not x9, x6 not x10, x7 - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_047.out b/tests/arch/riscv/instructions/test_riscv_instruction_047.out deleted file mode 100644 index a33577387..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_047.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x24; ir[x5,t0]:0x22346; ir[x6,t1]:0x11d7; ir[x7,t2]:0xffffdaf2; ir[x8,fp,s0]:0xfffddcba; ir[x9,s1]:0xffffee29; ir[x10,a0]:0x250e; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_047.s b/tests/arch/riscv/instructions/test_riscv_instruction_047.s index a2dafd5c6..1cdb1fb66 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_047.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_047.s @@ -13,4 +13,5 @@ main: neg x8, x5 neg x9, x6 neg x10, x7 - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_048.out b/tests/arch/riscv/instructions/test_riscv_instruction_048.out deleted file mode 100644 index fb4cb4600..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_048.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x18; ir[x4,tp]:0x1; ir[x6,t1]:0xffffffff; ir[x9,s1]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_048.s b/tests/arch/riscv/instructions/test_riscv_instruction_048.s index 9f2ef07ea..433c21075 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_048.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_048.s @@ -13,5 +13,5 @@ main: seqz x8, x4 seqz x9, x5 seqz x10, x6 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_049.out b/tests/arch/riscv/instructions/test_riscv_instruction_049.out deleted file mode 100644 index 3e9ef139c..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_049.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x18; ir[x4,tp]:0x1; ir[x6,t1]:0xffffffff; ir[x8,fp,s0]:0x1; ir[x10,a0]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_049.s b/tests/arch/riscv/instructions/test_riscv_instruction_049.s index 506fd2134..efac8dc73 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_049.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_049.s @@ -13,5 +13,5 @@ main: snez x8, x4 snez x9, x5 snez x10, x6 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_050.out b/tests/arch/riscv/instructions/test_riscv_instruction_050.out deleted file mode 100644 index 6a6e64bc5..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_050.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x18; ir[x4,tp]:0x1; ir[x6,t1]:0xffffffff; ir[x8,fp,s0]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_050.s b/tests/arch/riscv/instructions/test_riscv_instruction_050.s index 8a89e59bd..c6cbd74d1 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_050.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_050.s @@ -13,5 +13,5 @@ main: sgtz x8, x4 sgtz x9, x5 sgtz x10, x6 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_051.out b/tests/arch/riscv/instructions/test_riscv_instruction_051.out deleted file mode 100644 index e4b537b15..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_051.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[pc]:0x18; ir[x4,tp]:0x1; ir[x6,t1]:0xffffffff; ir[x10,a0]:0x1; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_051.s b/tests/arch/riscv/instructions/test_riscv_instruction_051.s index 4f1efa007..4104e8ddb 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_051.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_051.s @@ -13,5 +13,5 @@ main: sltz x8, x4 sltz x9, x5 sltz x10, x6 - - \ No newline at end of file + + jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_052.out b/tests/arch/riscv/instructions/test_riscv_instruction_052.out deleted file mode 100644 index 2072776ab..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_052.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x408354FA6DEFC7A4; fpr[f2,ft2]:0x408C12C083126E98; fpr[f4,ft4]:0x40C35CC666666666; fpr[f6,ft6]:0x409354FA6DEFC7A4; fpr[f8,fs0]:0x409C12C083126E98; fpr[f10,fa0]:0x40D35CC666666666; fpr[f12,fa2]:0xffffffff42F73E9B; fpr[f14,fa4]:0xffffffff43E42C08; fpr[f16,fa6]:0xffffffffC5EC1466; fpr[f18,fs2]:0xffffffff4410FDD7; fpr[f20,fs4]:0xffffffffC5DDD1A6; fpr[f22,fs6]:0xffffffffC5E8376C; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_053.out b/tests/arch/riscv/instructions/test_riscv_instruction_053.out deleted file mode 100644 index 15fb6e89e..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_053.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x408354FA6DEFC7A4; fpr[f2,ft2]:0x408C12C083126E98; fpr[f4,ft4]:0x40C35CC666666666; fpr[f6,ft6]:0xC0717B8C2A454DE8; fpr[f8,fs0]:0xC0C19B9A5E353F7C; fpr[f10,fa0]:0x40C22776BF8769EC; fpr[f12,fa2]:0xffffffff42F73E9B; fpr[f14,fa4]:0xffffffff43E42C08; fpr[f16,fa6]:0xffffffffC5EC1466; fpr[f18,fs2]:0xffffffffC3A65C61; fpr[f20,fs4]:0xffffffff45FA5726; fpr[f22,fs6]:0xffffffffC5EFF160; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_054.out b/tests/arch/riscv/instructions/test_riscv_instruction_054.out deleted file mode 100644 index fe84e09e1..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_054.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x408354FA6DEFC7A4; fpr[f2,ft2]:0x408C12C083126E98; fpr[f4,ft4]:0x40C35CC666666666; fpr[f6,ft6]:0x41175B9619EB7E4E; fpr[f8,fs0]:0x4128A0DBE279DD3C; fpr[f10,fa0]:0x41976E712668F5C2; fpr[f12,fa2]:0xffffffff42F73E9B; fpr[f14,fa4]:0xffffffff43E42C08; fpr[f16,fa6]:0xffffffffC5EC1466; fpr[f18,fs2]:0xffffffff475C5E49; fpr[f20,fs4]:0xffffffffCA526AC6; fpr[f22,fs6]:0xffffffffC964016A; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_055.out b/tests/arch/riscv/instructions/test_riscv_instruction_055.out deleted file mode 100644 index 492f0cd5a..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_055.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x408354FA6DEFC7A4; fpr[f2,ft2]:0x408C12C083126E98; fpr[f4,ft4]:0x40C35CC666666666; fpr[f6,ft6]:0x3FF0000000000000; fpr[f8,fs0]:0x3FF0000000000000; fpr[f10,fa0]:0x3FF0000000000000; fpr[f12,fa2]:0xffffffff42F73E9B; fpr[f14,fa4]:0xffffffff43E42C08; fpr[f16,fa6]:0xffffffffC5EC1466; fpr[f18,fs2]:0xffffffff3E8AB307; fpr[f20,fs4]:0xffffffffBD776CD1; fpr[f22,fs6]:0xffffffffC2747094; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_056.out b/tests/arch/riscv/instructions/test_riscv_instruction_056.out deleted file mode 100644 index 3408223c1..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_056.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x408354FA6DEFC7A4; fpr[f2,ft2]:0x408C12C083126E98; fpr[f4,ft4]:0x40C35CC666666666; fpr[f6,ft6]:0x408354FA6DEFC7A4; fpr[f8,fs0]:0x408C12C083126E98; fpr[f10,fa0]:0x408354FA6DEFC7A4; fpr[f12,fa2]:0xffffffff42F73E9B; fpr[f14,fa4]:0xffffffff43E42C08; fpr[f16,fa6]:0xffffffffC5EC1466; fpr[f18,fs2]:0xffffffff42F73E9B; fpr[f20,fs4]:0xffffffffC5EC1466; fpr[f22,fs6]:0xffffffffC5EC1466; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_057.out b/tests/arch/riscv/instructions/test_riscv_instruction_057.out deleted file mode 100644 index 88886b8b8..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_057.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x408354FA6DEFC7A4; fpr[f2,ft2]:0x408C12C083126E98; fpr[f4,ft4]:0x40C35CC666666666; fpr[f6,ft6]:0x408C12C083126E98; fpr[f8,fs0]:0x40C35CC666666666; fpr[f10,fa0]:0x40C35CC666666666; fpr[f12,fa2]:0xffffffff42F73E9B; fpr[f14,fa4]:0xffffffff43E42C08; fpr[f16,fa6]:0xffffffffC5EC1466; fpr[f18,fs2]:0xffffffff43E42C08; fpr[f20,fs4]:0xffffffff43E42C08; fpr[f22,fs6]:0xffffffff42F73E9B; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_058.out b/tests/arch/riscv/instructions/test_riscv_instruction_058.out deleted file mode 100644 index 149d7c395..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_058.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x4070000000000000; fpr[f2,ft2]:0x40AB320000000000; fpr[f4,ft4]:0x40B5640000000000; fpr[f6,ft6]:0xffffffff42C60000; fpr[f8,fs0]:0xffffffff42B60000; fpr[f10,fa0]:0xffffffff42C00000; fpr[f12,fa2]:0xffffffff46192400; fpr[f14,fa4]:0xffffffff46016400; fpr[f16,fa6]:0xffffffff46100000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_059.out b/tests/arch/riscv/instructions/test_riscv_instruction_059.out deleted file mode 100644 index d5d9b9daf..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_059.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x4070000000000000; fpr[f2,ft2]:0x40AB320000000000; fpr[f4,ft4]:0x40B5640000000000; fpr[f6,ft6]:0xffffffff4CB73CE3; fpr[f8,fs0]:0xffffffff4C82CFE9; fpr[f10,fa0]:0xffffffff4CA20480; fpr[f12,fa2]:0xffffffff46192400; fpr[f14,fa4]:0xffffffff46016400; fpr[f16,fa6]:0xffffffff46100000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_060.out b/tests/arch/riscv/instructions/test_riscv_instruction_060.out deleted file mode 100644 index 061097777..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_060.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x4070000000000000; fpr[f2,ft2]:0x40AB320000000000; fpr[f4,ft4]:0x40B5640000000000; fpr[f6,ft6]:0xffffffff4CB73351; fpr[f8,fs0]:0xffffffff4C82C7D3; fpr[f10,fa0]:0xffffffff4CA1FB80; fpr[f12,fa2]:0xffffffff46192400; fpr[f14,fa4]:0xffffffff46016400; fpr[f16,fa6]:0xffffffff46100000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_061.out b/tests/arch/riscv/instructions/test_riscv_instruction_061.out deleted file mode 100644 index 30306dda4..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_061.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x4070000000000000; fpr[f2,ft2]:0xC0AB320000000000; fpr[f4,ft4]:0x40B5640000000000; fpr[f6,ft6]:0x4070000000000000; fpr[f8,fs0]:0x40AB320000000000; fpr[f10,fa0]:0x40B5640000000000; fpr[f12,fa2]:0xffffffffC6192400; fpr[f14,fa4]:0xffffffff46016400; fpr[f16,fa6]:0xffffffffC6100000; fpr[f18,fs2]:0xffffffff46192400; fpr[f20,fs4]:0xffffffff46016400; fpr[f22,fs6]:0xffffffff46100000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_062.out b/tests/arch/riscv/instructions/test_riscv_instruction_062.out deleted file mode 100644 index 074efd0ac..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_062.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x68; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x7,t2]:0x200010; ir[x8,fp,s0]:0x200018; ir[x9,s1]:0x20001c; ir[x10,a0]:0x200020; ir[x17,a7]:0xa; fpr[f0,ft0]:0x4070000000000000; fpr[f2,ft2]:0xC0AB320000000000; fpr[f4,ft4]:0x40B5640000000000; fpr[f6,ft6]:0xC070000000000000; fpr[f8,fs0]:0x40AB320000000000; fpr[f10,fa0]:0xC0B5640000000000; fpr[f12,fa2]:0xffffffffC6192400; fpr[f14,fa4]:0xffffffff46016400; fpr[f16,fa6]:0xffffffffC6100000; fpr[f18,fs2]:0xffffffff46192400; fpr[f20,fs4]:0xffffffffC6016400; fpr[f22,fs6]:0xffffffff46100000; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_063.out b/tests/arch/riscv/instructions/test_riscv_instruction_063.out deleted file mode 100644 index 24c2f0562..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_063.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x40; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x8,fp,s0]:0x200010; ir[x9,s1]:0x200014; ir[x11,a1]:0x1; ir[x17,a7]:0xa; fpr[f0,ft0]:0x4070000000000000; fpr[f2,ft2]:0x40AB320000000000; fpr[f12,fa2]:0xffffffff46192400; fpr[f14,fa4]:0xffffffff46192400; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_063.s b/tests/arch/riscv/instructions/test_riscv_instruction_063.s index c3b0ab67b..395757004 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_063.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_063.s @@ -6,26 +6,42 @@ .data a: .double 256.0 b: .double 3481.0 + c: .double NaN d: .float 9801.0 - e: .float 9801.0 + e: .float 10502.5 + f: .double NaN .text main: - la x5, a - la x6, b - la x8, d - la x9, e + la x5, a + la x6, b + la x7, c + la x8, d + la x9, e + la x10, f fld f0, 0(x5) fld f2, 0(x6) + fld f4, 0(x7) - feq.d x10, f0, f2 + feq.d x11, f0, f0 + feq.d x12, f2, f2 + feq.d x13, f0, f2 + feq.d x14, f2, f0 + feq.d x15, f0, f4 + feq.d x16, f4, f4 flw f12, 0(x8) flw f14, 0(x9) + flw f16, 0(x10) - feq.s x11, f12, f14 + feq.s x17, f12, f12 + feq.s x18, f14, f14 + feq.s x19, f12, f14 + feq.s x20, f14, f12 + feq.s x21, f12, f16 + feq.s x22, f16, f16 li a7, 10 ecall diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_064.out b/tests/arch/riscv/instructions/test_riscv_instruction_064.out deleted file mode 100644 index 96c1e52c8..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_064.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x40; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x8,fp,s0]:0x200010; ir[x9,s1]:0x200014; ir[x10,a0]:0x1; ir[x11,a1]:0x1; ir[x17,a7]:0xa; fpr[f0,ft0]:0x4070000000000000; fpr[f2,ft2]:0x40AB320000000000; fpr[f12,fa2]:0xffffffff46192400; fpr[f14,fa4]:0xffffffff46192400; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_064.s b/tests/arch/riscv/instructions/test_riscv_instruction_064.s index bc3634cf7..4edf15363 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_064.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_064.s @@ -6,26 +6,42 @@ .data a: .double 256.0 b: .double 3481.0 + c: .double NaN d: .float 9801.0 - e: .float 9801.0 + e: .float 10502.5 + f: .double NaN .text main: - la x5, a - la x6, b - la x8, d - la x9, e + la x5, a + la x6, b + la x7, c + la x8, d + la x9, e + la x10, f fld f0, 0(x5) fld f2, 0(x6) + fld f4, 0(x7) - fle.d x10, f0, f2 + fle.d x11, f0, f0 + fle.d x12, f2, f2 + fle.d x13, f0, f2 + fle.d x14, f2, f0 + fle.d x15, f0, f4 + fle.d x16, f4, f4 flw f12, 0(x8) flw f14, 0(x9) + flw f16, 0(x10) - fle.s x11, f12, f14 + fle.s x17, f12, f12 + fle.s x18, f14, f14 + fle.s x19, f12, f14 + fle.s x20, f14, f12 + fle.s x21, f12, f16 + fle.s x22, f16, f16 li a7, 10 ecall diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_065.out b/tests/arch/riscv/instructions/test_riscv_instruction_065.out deleted file mode 100644 index 626ebf364..000000000 --- a/tests/arch/riscv/instructions/test_riscv_instruction_065.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x40; ir[x5,t0]:0x200000; ir[x6,t1]:0x200008; ir[x8,fp,s0]:0x200010; ir[x9,s1]:0x200014; ir[x10,a0]:0x1; ir[x17,a7]:0xa; fpr[f0,ft0]:0x4070000000000000; fpr[f2,ft2]:0x40AB320000000000; fpr[f12,fa2]:0xffffffff46192400; fpr[f14,fa4]:0xffffffff46192400; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_065.s b/tests/arch/riscv/instructions/test_riscv_instruction_065.s index 43942b9b5..6f9a6b693 100644 --- a/tests/arch/riscv/instructions/test_riscv_instruction_065.s +++ b/tests/arch/riscv/instructions/test_riscv_instruction_065.s @@ -6,26 +6,42 @@ .data a: .double 256.0 b: .double 3481.0 + c: .double NaN d: .float 9801.0 - e: .float 9801.0 + e: .float 10502.5 + f: .double NaN .text main: - la x5, a - la x6, b - la x8, d - la x9, e + la x5, a + la x6, b + la x7, c + la x8, d + la x9, e + la x10, f fld f0, 0(x5) fld f2, 0(x6) + fld f4, 0(x7) - flt.d x10, f0, f2 + flt.d x11, f0, f0 + flt.d x12, f2, f2 + flt.d x13, f0, f2 + flt.d x14, f2, f0 + flt.d x15, f0, f4 + flt.d x16, f4, f4 flw f12, 0(x8) flw f14, 0(x9) + flw f16, 0(x10) - flt.s x11, f12, f14 + flt.s x17, f12, f12 + flt.s x18, f14, f14 + flt.s x19, f12, f14 + flt.s x20, f14, f12 + flt.s x21, f12, f16 + flt.s x22, f16, f16 li a7, 10 ecall diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_066.s b/tests/arch/riscv/instructions/test_riscv_instruction_066.s new file mode 100644 index 000000000..6f8c6b60a --- /dev/null +++ b/tests/arch/riscv/instructions/test_riscv_instruction_066.s @@ -0,0 +1,18 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text + main: + li s0, -10 + li s1, 15 + + beqz s0, j0 + li t0, 1 +j0: beqz s1, j1 + li t1, 1 +j1: beqz x0, end + li t2, 1 + +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_067.s b/tests/arch/riscv/instructions/test_riscv_instruction_067.s new file mode 100644 index 000000000..60b9c325d --- /dev/null +++ b/tests/arch/riscv/instructions/test_riscv_instruction_067.s @@ -0,0 +1,18 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text + main: + li s0, -10 + li s1, 15 + + bgez s0, j0 + li t0, 1 +j0: bgez s1, j1 + li t1, 1 +j1: bgez x0, end + li t2, 1 + +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_068.s b/tests/arch/riscv/instructions/test_riscv_instruction_068.s new file mode 100644 index 000000000..c83042bd2 --- /dev/null +++ b/tests/arch/riscv/instructions/test_riscv_instruction_068.s @@ -0,0 +1,18 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text + main: + li s0, -10 + li s1, 15 + + bgtz s0, j0 + li t0, 1 +j0: bgtz s1, j1 + li t1, 1 +j1: bgtz x0, end + li t2, 1 + +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_069.s b/tests/arch/riscv/instructions/test_riscv_instruction_069.s new file mode 100644 index 000000000..447bd11c4 --- /dev/null +++ b/tests/arch/riscv/instructions/test_riscv_instruction_069.s @@ -0,0 +1,18 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text + main: + li s0, -10 + li s1, 15 + + blez s0, j0 + li t0, 1 +j0: blez s1, j1 + li t1, 1 +j1: blez x0, end + li t2, 1 + +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_070.s b/tests/arch/riscv/instructions/test_riscv_instruction_070.s new file mode 100644 index 000000000..5318bf129 --- /dev/null +++ b/tests/arch/riscv/instructions/test_riscv_instruction_070.s @@ -0,0 +1,18 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text + main: + li s0, -10 + li s1, 15 + + bltz s0, j0 + li t0, 1 +j0: bltz s1, j1 + li t1, 1 +j1: bltz x0, end + li t2, 1 + +end: jr ra diff --git a/tests/arch/riscv/instructions/test_riscv_instruction_071.s b/tests/arch/riscv/instructions/test_riscv_instruction_071.s new file mode 100644 index 000000000..d0e91ed9c --- /dev/null +++ b/tests/arch/riscv/instructions/test_riscv_instruction_071.s @@ -0,0 +1,18 @@ + +# +# Creator (https://creatorsim.github.io/creator/) +# + +.text + main: + li s0, -10 + li s1, 15 + + bnez s0, j0 + li t0, 1 +j0: bnez s1, j1 + li t1, 1 +j1: bnez x0, end + li t2, 1 + +end: jr ra diff --git a/tests/arch/riscv/sentinel.test.mts b/tests/arch/riscv/sentinel.test.mts new file mode 100644 index 000000000..c8d22d86f --- /dev/null +++ b/tests/arch/riscv/sentinel.test.mts @@ -0,0 +1,3 @@ +import { ARCH, execution_tests } from "../arch_utils.mts"; + +execution_tests(ARCH.riscv, "riscv/sentinel"); diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_001.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_001.out deleted file mode 100644 index ec02416fe..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_001.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x10,a0]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_002.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_002.out deleted file mode 100644 index f63ccfd64..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_002.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x11,a1]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_003.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_003.out deleted file mode 100644 index 1f2506910..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_003.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x12,a2]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_004.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_004.out deleted file mode 100644 index 2078e8118..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_004.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x13,a3]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_005.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_005.out deleted file mode 100644 index 661a7d162..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_005.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x14,a4]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_006.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_006.out deleted file mode 100644 index 459d42467..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_006.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x15,a5]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_007.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_007.out deleted file mode 100644 index 975dc033b..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_007.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x16,a6]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_008.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_008.out deleted file mode 100644 index d41f24c40..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_008.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_009.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_009.out deleted file mode 100644 index b1f6ae203..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_009.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[x1,ra]:0xc; ir[x5,t0]:0x2; ir[x10,a0]:0x5; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_010.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_010.out deleted file mode 100644 index 0bacf9fc3..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_010.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[x1,ra]:0xc; ir[x6,t1]:0x2; ir[x10,a0]:0x5; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_011.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_011.out deleted file mode 100644 index dfb9e1353..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_011.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[x1,ra]:0xc; ir[x7,t2]:0x2; ir[x10,a0]:0x5; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_012.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_012.out deleted file mode 100644 index 7589a33bc..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_012.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[x1,ra]:0xc; ir[x10,a0]:0x5; ir[x17,a7]:0xa; ir[x28,t3]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_013.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_013.out deleted file mode 100644 index ae29f2f30..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_013.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[x1,ra]:0xc; ir[x10,a0]:0x5; ir[x17,a7]:0xa; ir[x29,t4]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_014.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_014.out deleted file mode 100644 index 95447ea10..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_014.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[x1,ra]:0xc; ir[x10,a0]:0x5; ir[x17,a7]:0xa; ir[x30,t5]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_015.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_015.out deleted file mode 100644 index c376cd77f..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_015.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x14; ir[x1,ra]:0xc; ir[x10,a0]:0x5; ir[x17,a7]:0xa; ir[x31,t6]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_016.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_016.out deleted file mode 100644 index 4c91bfdcb..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_016.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x8,fp,s0]:0x5; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_017.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_017.out deleted file mode 100644 index f57049ea3..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_017.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x9,s1]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_017.s b/tests/arch/riscv/sentinel/test_riscv_sentinels_017.s index ed7294e8b..df5fbce1b 100644 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_017.s +++ b/tests/arch/riscv/sentinel/test_riscv_sentinels_017.s @@ -1,62 +1,34 @@ + # # ARCOS.INF.UC3M.ES # BY-NC-SA (https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es) # -# BAD EXAMPLE: This code VIOLATES RISC-V parameter conventions -# DO NOT follow this pattern in real code! -# + .text main: - # Set up important values in saved registers - li s0, 100 # Important value that should be preserved - li s1, 200 # Another important value - li s2, 300 # Yet another important value - - # Pass parameters incorrectly - using saved registers instead of a0-a7 - li s3, 42 # WRONG: Should use a0 for first parameter - li s4, 84 # WRONG: Should use a1 for second parameter - - # Call function - caller expects s0-s4 to be unchanged after call - jal ra, bad_function - - # Try to use the values we set earlier - they will be corrupted! - add t0, s0, s1 # Expected: 100 + 200 = 300, but will be wrong - add t1, s2, s3 # Expected: 300 + 42 = 342, but will be wrong + li s1, 5 + jal ra, test + # exit li a7, 10 ecall - bad_function: - # WRONG: Create stack frame but don't save caller's saved registers + test: + # crear "stack frame" para ra, fp y una variable local addi sp, sp, -12 sw ra, 8(sp) sw fp, 4(sp) addi fp, sp, 4 - # VIOLATION 1: Destroy caller's saved registers without saving them - li s0, 999 # WRONG: Overwrites caller's s0 (was 100) - li s1, 888 # WRONG: Overwrites caller's s1 (was 200) - li s2, 777 # WRONG: Overwrites caller's s2 (was 300) - - # VIOLATION 2: Use saved registers for parameters instead of a0-a7 - # Should read parameters from a0, a1, etc. but using s3, s4 instead - add s0, s3, s4 # WRONG: Should use a0, a1 for parameters - - # VIOLATION 3: Don't set return value in a0 - # Function should return result in a0, but doesn't - - # VIOLATION 4: Use saved registers for local variables - li s1, 555 # WRONG: Should use temporary registers t0-t6 - li s2, 444 # WRONG: Should use temporary registers t0-t6 + li s1, 2 - b_efs: # WRONG: Restore stack but not the saved registers we corrupted - lw ra, 8(sp) + b_efs: lw ra, 8(sp) lw fp, 4(sp) addi sp, sp, 12 - # Return without setting a0 and with corrupted saved registers - jr ra + # return a7 + jr ra diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_018.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_018.out deleted file mode 100644 index a1e7af79f..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_018.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x18,s2]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_019.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_019.out deleted file mode 100644 index aabace55c..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_019.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x19,s3]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_020.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_020.out deleted file mode 100644 index 02498398f..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_020.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x20,s4]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_021.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_021.out deleted file mode 100644 index 1add8318d..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_021.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x21,s5]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_022.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_022.out deleted file mode 100644 index c7b7cf6a1..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_022.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x22,s6]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_023.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_023.out deleted file mode 100644 index faad03f5f..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_023.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x23,s7]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_024.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_024.out deleted file mode 100644 index 89404f49f..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_024.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x24,s8]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_025.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_025.out deleted file mode 100644 index 79a87be11..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_025.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x25,s9]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_026.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_026.out deleted file mode 100644 index d8033c781..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_026.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x26,s10]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_027.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_027.out deleted file mode 100644 index 543a02c79..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_027.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; ir[x27,s11]:0x2; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_028.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_028.out deleted file mode 100644 index db9165564..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_028.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x108a; ir[x1,ra]:0x108a; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_029.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_029.out deleted file mode 100644 index bb60acf12..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_029.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Stack memory has not been released successfully -cr[PC]:0xc; ir[x1,ra]:0x4; ir[x2,sp]:0x10000000; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_029.s b/tests/arch/riscv/sentinel/test_riscv_sentinels_029.s index 3571d72ef..10622106f 100644 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_029.s +++ b/tests/arch/riscv/sentinel/test_riscv_sentinels_029.s @@ -19,7 +19,7 @@ test: # crear "stack frame" para ra, fp y una variable local - addi sp, sp, 4 + addi sp, sp, -4 # return a7 jr ra diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_030.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_030.out deleted file mode 100644 index d2239354a..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_030.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x3,gp]:0x5; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_031.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_031.out deleted file mode 100644 index 60cc8943a..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_031.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x4,tp]:0x5; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_032.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_032.out deleted file mode 100644 index a01e19525..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_032.out +++ /dev/null @@ -1,3 +0,0 @@ - -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x9,s1]:0x2; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_033.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_033.out deleted file mode 100644 index 9a879306b..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_033.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x9,s1]:0x5; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_034.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_034.out deleted file mode 100644 index 06d1055ae..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_034.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_035.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_035.out deleted file mode 100644 index 06d1055ae..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_035.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_036.out b/tests/arch/riscv/sentinel/test_riscv_sentinels_036.out deleted file mode 100644 index 06d1055ae..000000000 --- a/tests/arch/riscv/sentinel/test_riscv_sentinels_036.out +++ /dev/null @@ -1,4 +0,0 @@ - -DANGER: Possible failure in the parameter passing convention -cr[PC]:0x10; ir[x1,ra]:0x8; ir[x17,a7]:0xa; keyboard[0x0]:''; display[0x0]:''; - diff --git a/tests/arch/riscv/sentinel/test_riscv_sentinels_037.s b/tests/arch/riscv/sentinel/test_riscv_sentinels_037.s new file mode 100644 index 000000000..2005eb5a3 --- /dev/null +++ b/tests/arch/riscv/sentinel/test_riscv_sentinels_037.s @@ -0,0 +1,62 @@ +# +# ARCOS.INF.UC3M.ES +# BY-NC-SA (https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es) +# +# BAD EXAMPLE: This code VIOLATES RISC-V parameter conventions +# DO NOT follow this pattern in real code! +# + +.text + + main: + # Set up important values in saved registers + li s1, 100 # Important value that should be preserved + li s2, 200 # Another important value + li s3, 300 # Yet another important value + + # Pass parameters incorrectly - using saved registers instead of a0-a7 + li s4, 42 # WRONG: Should use a0 for first parameter + li s5, 84 # WRONG: Should use a1 for second parameter + + # Call function - caller expects s0-s5 to be unchanged after call + jal ra, bad_function + + # Try to use the values we set earlier - they will be corrupted! + add t0, s1, s2 # Expected: 100 + 200 = 300, but will be wrong + add t1, s3, s4 # Expected: 300 + 42 = 342, but will be wrong + + # exit + li a7, 10 + ecall + + + bad_function: + # WRONG: Create stack frame but don't save caller's saved registers + addi sp, sp, -12 + sw ra, 8(sp) + sw fp, 4(sp) + addi fp, sp, 4 + + # VIOLATION 1: Destroy caller's saved registers without saving them + li s1, 999 # WRONG: Overwrites caller's s0 (was 100) + li s2, 888 # WRONG: Overwrites caller's s1 (was 200) + li s3, 777 # WRONG: Overwrites caller's s2 (was 300) + + # VIOLATION 2: Use saved registers for parameters instead of a0-a7 + # Should read parameters from a0, a1, etc. but using s3, s4 instead + add s1, s4, s5 # WRONG: Should use a0, a1 for parameters + + # VIOLATION 3: Don't set return value in a0 + # Function should return result in a0, but doesn't + + # VIOLATION 4: Use saved registers for local variables + li s1, 555 # WRONG: Should use temporary registers t0-t6 + li s2, 444 # WRONG: Should use temporary registers t0-t6 + + b_efs: # WRONG: Restore stack but not the saved registers we corrupted + lw ra, 8(sp) + lw fp, 4(sp) + addi sp, sp, 12 + + # Return without setting a0 and with corrupted saved registers + jr ra diff --git a/tests/arch/riscv64/add_test.s b/tests/arch/riscv64/add_test.s index 44b3d91a0..502a5187e 100644 --- a/tests/arch/riscv64/add_test.s +++ b/tests/arch/riscv64/add_test.s @@ -4,3 +4,4 @@ main: li t1, 0xffffffffffffffff li t2, 0xffffffffffffffff add t0, t1, t2 +jr ra diff --git a/tests/arch/riscv64/addiw_test.s b/tests/arch/riscv64/addiw_test.s index 315b215ed..0262e61a3 100644 --- a/tests/arch/riscv64/addiw_test.s +++ b/tests/arch/riscv64/addiw_test.s @@ -9,9 +9,9 @@ main: addiw s3, s2, -50 # Expected s3 = 0x1FFCE # Test 3: Addition resulting in zero - lui s4, 0x00001 # s4 = 0x1000 - addiw s5, s4, -2048 # E xpected s5 = 0x800 - addiw s5, s5, -2048 # Expected s5 = 0x0 + lui s4, 0x00001 # s4 = 0x1000 + addiw s5, s4, -2048 # Expected s5 = 0x800 + addiw s5, s5, -2048 # Expected s5 = 0x0 # Test 4: Maximum positive immediate lui s6, 0x00100 # s6 = 0x100000 @@ -19,11 +19,12 @@ main: # Test 5: Positive overflow lui s8, 0x7FFFF # s8 = 0x7FFFF000 - addiw s9, s8, 2047 # Need to do it in steps to avoid inmediate overflow + addiw s9, s8, 2047 # Need to do it in steps to avoid immediate overflow addiw s9, s9, 2047 addiw s9, s9, 1 # s8 = 0x7FFFFFFF addiw s9, s9, 1 # Expected s9 = 0xFFFFFFFF80000000 # Test 6: Negative overflow lui s10, 0x80000 # s10 = 0x80000000 - addiw s11, s10, -1 # Expected s11 = 0x7FFFFFFF \ No newline at end of file + addiw s11, s10, -1 # Expected s11 = 0x7FFFFFFF + jr ra diff --git a/tests/arch/riscv64/addw_test.s b/tests/arch/riscv64/addw_test.s index 5fd955f2e..9f0930cb5 100644 --- a/tests/arch/riscv64/addw_test.s +++ b/tests/arch/riscv64/addw_test.s @@ -2,10 +2,10 @@ main: # Initialize registers with 32-bit values (sign-extended to 64 bits) # s1 = 0x00010000 - lui s1, 0x00010 # s1 = 0x0000000000010000 + lui s1, 0x00010 # s1 = 0x0000000000010000 # s2 = 0x00020000 - lui s2, 0x00020 # s2 = 0x0000000000020000 + lui s2, 0x00020 # s2 = 0x0000000000020000 # Test 1: Small positive addition addw s3, s1, s2 # Expected s3 = 0x0000000000030000 @@ -20,4 +20,5 @@ main: # Test 4: Edge case - max 32-bit signed + 0x10000 lui s8, 0x7FFF0 # s8 = 0x0000000007FFF0000 - addw s9, s8, s1 # Expected s9 = 0x0000000080000000 + addw s9, s8, s1 # Expected s9 = 0xFFFFFFFF80000000 + jr ra diff --git a/tests/arch/riscv64/beq_test.s b/tests/arch/riscv64/beq_test.s index 784f1f1f6..306f19802 100644 --- a/tests/arch/riscv64/beq_test.s +++ b/tests/arch/riscv64/beq_test.s @@ -1,13 +1,14 @@ .text main: - addi x1, x0, 1 beq x0, x0, target # Branch if equal using local label - addi x6, x0, 0x123 # test value + addi x6, x0, 0x123 # test value addi x0, x0, 0 # NOP addi x0, x0, 0 # NOP addi x0, x0, 0 # NOP - slli x7, x7, 0 # Increment x7 + slli x7, x7, 0 # Increment x7 + jr ra target: addi x5, x5, 0x321 # Increment x5 # Exit with status code 0 - li a0, 0 \ No newline at end of file + li a0, 0 + jr ra diff --git a/tests/arch/riscv64/instructions.test.mts b/tests/arch/riscv64/instructions.test.mts new file mode 100644 index 000000000..83b856aa6 --- /dev/null +++ b/tests/arch/riscv64/instructions.test.mts @@ -0,0 +1,3 @@ +import { ARCH, execution_tests } from "../arch_utils.mts" + +execution_tests(ARCH.riscv64, "riscv64"); diff --git a/tests/arch/riscv64/load_test.s b/tests/arch/riscv64/load_test.s new file mode 100644 index 000000000..be379ab67 --- /dev/null +++ b/tests/arch/riscv64/load_test.s @@ -0,0 +1,97 @@ +# +# Creator (https://creatorsim.github.io/creator/) +# Example: Various data types in data segment and memory operations +# + +.data +.align 4 + +# Different data types in data segment +byte_values: .byte 0x42, 0x73, 0xA5, 0xFF + .byte -128, 127, 0, 55 + +.align 2 +half_values: .half 0x1234, 0x5678, 0xABCD, 0xEF12 + .half -32768, 32767, 0, 12345 + +.align 4 +word_values: .word 0x12345678, 0x87654321, 0xDEADBEEF, 0xCAFEBABE + .word -2147483648, 2147483647, 0, 1000000 + +.align 3 +double_values: .dword 0x123456789ABCDEF0, 0xFEDCBA9876543210 + .dword 0x0123456789ABCDEF, 0xAAAABBBBCCCCDDDD + +# String data +.align 1 +string_data: .string "Hello, RISC-V!" + .byte 0 # Null terminator + +# Float data (stored as word) +.align 4 +float_data: .word 0x40490FDB # Pi as IEEE 754 float (3.14159...) + .word 0x402DF854 # e as IEEE 754 float (2.71828...) + +# Target memory locations for writing +.align 4 +target_area: .space 256 # Reserve 256 bytes for writing data + +.text +main: + # Set up base addresses + la t0, byte_values + la t1, half_values + la t2, word_values + la t3, double_values + la t4, target_area + + # Copy and manipulate byte data + lb a0, 0(t0) # Load first byte (0x42) + sb a0, 0(t4) # Store to target area + lb a1, 3(t0) # Load fourth byte (0xFF) + sb a1, 1(t4) # Store to target area + 1 + + # Manipulate and store modified byte + addi a0, a0, 1 # Increment byte value + sb a0, 2(t4) # Store modified byte + + # Copy and manipulate half-word data + lh a0, 0(t1) # Load first half (0x1234) + sh a0, 4(t4) # Store to target area + 4 + lh a1, 6(t1) # Load fourth half (0xEF12) + sh a1, 6(t4) # Store to target area + 6 + + # Perform arithmetic on half-word and store + add a2, a0, a1 # Add two half-words + sh a2, 8(t4) # Store result + + # Copy and manipulate word data + lw a0, 0(t2) # Load first word (0x12345678) + sw a0, 12(t4) # Store to target area + 12 + lw a1, 12(t2) # Load fourth word (0xCAFEBABE) + sw a1, 16(t4) # Store to target area + 16 + + # Perform bitwise operations on words + xor a2, a0, a1 # XOR two words + sw a2, 20(t4) # Store XOR result + or a3, a0, a1 # OR two words + sw a3, 24(t4) # Store OR result + and a4, a0, a1 # AND two words + sw a4, 28(t4) # Store AND result + + # Copy double-word data (64-bit) + ld a0, 0(t3) # Load first double-word + sd a0, 32(t4) # Store to target area + 32 + ld a1, 8(t3) # Load second double-word + sd a1, 40(t4) # Store to target area + 40 + + # Create and store new data patterns + li a0, 0x55AA55AA # Create alternating bit pattern + sw a0, 48(t4) # Store pattern + + # Store sequential byte pattern + li a0, 0x01 # Start with 1 + li a1, 8 # Counter for 8 bytes + addi a2, t4, 52 # Start address for pattern + + jr ra \ No newline at end of file diff --git a/tests/arch/riscv64/lui_test.s b/tests/arch/riscv64/lui_test.s index 0142f3d41..51c91404e 100644 --- a/tests/arch/riscv64/lui_test.s +++ b/tests/arch/riscv64/lui_test.s @@ -1,13 +1,14 @@ .text main: # Test 1: Small positive immediate value - lui x1, 0x1 # Expected x1 = 0x0000000000001000 + lui x10, 0x1 # Expected x1 = 0x0000000000001000 # Test 2: Large positive immediate value - lui x2, 0xFFFFF # Expected x2 = 0x00000FFFFF000 + lui x11, 0xFFFFF # Expected x2 = 0x00000FFFFF000 # Test 3: Negative immediate value - lui x3, 0x80000 # Expected x3 = 0xFFFFFFFF80000000 + lui x12, 0x80000 # Expected x3 = 0xFFFFFFFF80000000 # Test 4: Edge case (maximum 20-bit value) - lui x4, 0x7FFFF # Expected x4 = 0x0007FFFF00000 \ No newline at end of file + lui x13, 0x7FFFF # Expected x4 = 0x0007FFFF00000 + jr ra diff --git a/tests/arch/riscv64/memory_test.s b/tests/arch/riscv64/memory_test.s index 199d7be8c..391eff96d 100644 --- a/tests/arch/riscv64/memory_test.s +++ b/tests/arch/riscv64/memory_test.s @@ -43,4 +43,5 @@ lbu x5, 0(x4) # Now we try to save it la x4, z5 -sb x5, 3(x4) \ No newline at end of file +sb x5, 3(x4) +jr ra diff --git a/tests/arch/riscv64/slli_test.s b/tests/arch/riscv64/slli_test.s index 547379d4e..073efdfc3 100644 --- a/tests/arch/riscv64/slli_test.s +++ b/tests/arch/riscv64/slli_test.s @@ -12,8 +12,7 @@ main: slli s4, s3, 20 # Expected: 0x100000 # Test 3: Shift negative - lui s5, 0xFFFFF # Load -1 - addi s5, s5, 0xFFF # s5 = -1 + addi s5, zero, -1 # Load -1 slli s6, s5, 32 # Expected: 0xFFFFFFFF00000000 # Test 4: Maximum shift (63) @@ -23,4 +22,5 @@ main: # Test 5: Large value shift lui s9, 0x7FFFF # Load large positive - slli s10, s9, 1 # Expected: 0xFFFE0000 \ No newline at end of file + slli s10, s9, 1 # Expected: 0xFFFE0000 + jr ra diff --git a/tests/arch/riscv64/slliw_test.s b/tests/arch/riscv64/slliw_test.s index be73706ac..18315dc82 100644 --- a/tests/arch/riscv64/slliw_test.s +++ b/tests/arch/riscv64/slliw_test.s @@ -9,4 +9,5 @@ li s0, 0xFFFFFFFF slliw s1, s0, 1 # Shift right by 1 - should become positive -srliw s2, s1, 1 \ No newline at end of file +srliw s2, s1, 1 +jr ra diff --git a/tests/arch/riscv64/sllw_test.s b/tests/arch/riscv64/sllw_test.s index dcd30cb7e..c2fba0f91 100644 --- a/tests/arch/riscv64/sllw_test.s +++ b/tests/arch/riscv64/sllw_test.s @@ -4,4 +4,5 @@ main: li s3, -35 # Load same test value slli s4, s3, 1 srli s5, s4, 1 - srai s6, s4, 1 \ No newline at end of file + srai s6, s4, 1 + jr ra diff --git a/tests/arch/riscv64/subw_test.s b/tests/arch/riscv64/subw_test.s index 0256e3fac..daa368583 100644 --- a/tests/arch/riscv64/subw_test.s +++ b/tests/arch/riscv64/subw_test.s @@ -16,4 +16,5 @@ main: # Test 4: Edge case - max 32-bit value lui s11, 0x7FFF0 # s11 = 0x7FFF0000 - subw s7, s11, x0 # Expected s7 = 0x7FFF0000 \ No newline at end of file + subw s7, s11, x0 # Expected s7 = 0x7FFF0000 + jr ra diff --git a/tests/unit/arch/mips/mips_example_002.test.mts b/tests/unit/arch/mips/mips_example_002.test.mts index eaa100dea..f88a8a982 100644 --- a/tests/unit/arch/mips/mips_example_002.test.mts +++ b/tests/unit/arch/mips/mips_example_002.test.mts @@ -1,57 +1,39 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("MIPS Basic Arithmetic Operations", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # .text main: - + li $t0, 10 li $t1, 13 li $t2, 45 li $t3, 33 - + add $t4, $t0, $t1 # 10+13 sub $t5, $t2, $t3 # 45-33 mul $t6, $t3, $t3 # 33*33 div $t7, $t6, $t1 # $t6/13 + jr $ra +`; - `; - - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Basic Arithmetic Operations", + assertExecution("MIPS32.yml", testAssembly, { registers: { - r8: 0xan, // t0 = 10 - r9: 0xdn, // t1 = 13 - r10: 0x2dn, // t2 = 45 - r11: 0x21n, // t3 = 33 - r12: 0x17n, // t4 = 23 - r13: 0xcn, // t5 = 12 - r14: 0x441n, // t6 = 1089 - r15: 0x53n, // t7 = 83 + "8": 0xan, // t0 = 10 + "9": 0xdn, // t1 = 13 + "10": 0x2dn, // t2 = 45 + "11": 0x21n, // t3 = 33 + "12": 0x17n, // t4 = 23 + "13": 0xcn, // t5 = 12 + "14": 0x441n, // t6 = 1089 + "15": 0x53n, // t7 = 83 }, display: "", // Display buffer should be empty keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/mips/mips_example_003.test.mts b/tests/unit/arch/mips/mips_example_003.test.mts index b63d0c45d..0991ab236 100644 --- a/tests/unit/arch/mips/mips_example_003.test.mts +++ b/tests/unit/arch/mips/mips_example_003.test.mts @@ -1,14 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("MIPS Data Types and Memory Operations", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -27,48 +19,40 @@ Deno.test("MIPS Data Types and Memory Operations", async () => { .text main: - + la $t0, w1 #w1 address -> $t0 la $t1, b1 #b1 address -> $t1 la $t2, h1 #h1 address -> $t2 - + lw $t3, 0($t0) #Memory[$t0] -> $t3 lw $t4, w1 #Memory[w1] -> $t4 - + lb $t5, 0($t1) #Memory[$t1] -> $t5 lb $t6, b1 #Memory[b1] -> $t6 - + lh $t7, 0($t2) #Memory[$t2] -> $t7 lh $t8, h1 #Memory[h1] -> $t8 - + sw $t3, w2 #$t3 -> Memory[w2] sb $t5, b2 #$t5 -> Memory[b2] sh $t7, h2 #$t7 -> Memory[h2] + jr $ra +`; - `; - - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Data Types and Memory Operations", + assertExecution("MIPS32.yml", testAssembly, { registers: { - r1: 0x20000en, // at - r8: 0x200000n, // t0 - r9: 0x200004n, // t1 - r10: 0x200006n, // t2 - r11: 0xen, // t3 - r12: 0xen, // t4 - r13: 0x78n, // t5 - r14: 0x78n, // t6 - r15: 0x16n, // t7 - r24: 0x16n, // t8 + "1": 0x20000en, // at + "8": 0x200000n, // t0 + "9": 0x200004n, // t1 + "10": 0x200006n, // t2 + "11": 0xen, // t3 + "12": 0xen, // t4 + "13": 0x78n, // t5 + "14": 0x78n, // t6 + "15": 0x16n, // t7 + "24": 0x16n, // t8 }, memory: { "0x20000f": 0x16n, @@ -77,7 +61,5 @@ main: }, display: "", // Display buffer should be empty keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/mips/mips_example_004.test.mts b/tests/unit/arch/mips/mips_example_004.test.mts index 799293147..aeac318a1 100644 --- a/tests/unit/arch/mips/mips_example_004.test.mts +++ b/tests/unit/arch/mips/mips_example_004.test.mts @@ -1,31 +1,24 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; +import { assertExecution } from "../simulator-test-utils.mts"; -Deno.test("MIPS Floating Point Operations", async () => { - const testAssembly = ` +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # - + .data a: .double 34.544 b: .double 11.443 c: .double 665.4 - + d: .space 24 - + .text main: la $t0, a la $t1, b la $t2, c la $t3, d - + l.d $f0, 0($t0) l.d $f2, 0($t1) l.d $f10, 0($t2) @@ -41,31 +34,21 @@ main: li $v0, 10 syscall +`; - `; - - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - // TODO: finish the conditions below - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Floating Point Operations", + assertExecution("MIPS32.yml", testAssembly, { + // TODO: finish the conditions below registers: { - r1: 0x200018n, // at - r2: 0xan, // v0 - r8: 0x200000n, // t0 - r9: 0x200008n, // t1 - r10: 0x200010n, // t2 - r11: 0x200028n, // t3 + "1": 0x200018n, // at + "2": 0xan, // v0 + "8": 0x200000n, // t0 + "9": 0x200008n, // t1 + "10": 0x200010n, // t2 + "11": 0x200028n, // t3 }, display: "", // Display buffer should be empty keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/mips/mips_example_005.test.mts b/tests/unit/arch/mips/mips_example_005.test.mts index 698ee5827..4905cc6ab 100644 --- a/tests/unit/arch/mips/mips_example_005.test.mts +++ b/tests/unit/arch/mips/mips_example_005.test.mts @@ -1,14 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("MIPS Loop and Print Sum", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -27,31 +19,19 @@ Deno.test("MIPS Loop and Print Sum", async () => { end_while: li $v0, 1 syscall #print_int + jr $ra +`; - - - `; - - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Loop and Print Sum", + assertExecution("MIPS32.yml", testAssembly, { registers: { - r2: 0x1n, // v0 - r4: 0x2dn, // a0 = 45 - r8: 0xan, // t0 = 10 - r9: 0xan, // t1 = 10 + "2": 0x1n, // v0 + "4": 0x2dn, // a0 = 45 + "8": 0xan, // t0 = 10 + "9": 0xan, // t1 = 10 }, display: "45", // Should display '45' keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/mips/mips_example_006.test.mts b/tests/unit/arch/mips/mips_example_006.test.mts index eb988f863..3ae682947 100644 --- a/tests/unit/arch/mips/mips_example_006.test.mts +++ b/tests/unit/arch/mips/mips_example_006.test.mts @@ -1,14 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("MIPS Branching Instructions", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -18,8 +10,8 @@ Deno.test("MIPS Branching Instructions", async () => { li $t0, 4 li $t1, 2 ble $t0, 5, jump1 - - jump2: + + jump2: li $t3, 34 li $v0, 10 syscall @@ -28,32 +20,21 @@ Deno.test("MIPS Branching Instructions", async () => { li $t9, 11 li $t8, 555 b jump2 +`; - `; - - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Branching Instructions", + assertExecution("MIPS32.yml", testAssembly, { registers: { - r1: 0x1n, // at - r2: 0xan, // v0 - r8: 0x4n, // t0 - r9: 0x2n, // t1 - r11: 0x22n, // t3 - r24: 0x22bn, // t8 - r25: 0xbn, // t9 + "1": 0x1n, // at + "2": 0xan, // v0 + "8": 0x4n, // t0 + "9": 0x2n, // t1 + "11": 0x22n, // t3 + "24": 0x22bn, // t8 + "25": 0xbn, // t9 }, display: "", // Display buffer should be empty keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/mips/mips_example_007.test.mts b/tests/unit/arch/mips/mips_example_007.test.mts index 25215688c..3c3af6981 100644 --- a/tests/unit/arch/mips/mips_example_007.test.mts +++ b/tests/unit/arch/mips/mips_example_007.test.mts @@ -1,14 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("MIPS Array Sum Loop", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -41,40 +33,27 @@ loop1: beq $t1, $t2, end1 #if($t1 == $t2) --> jump to fin1 b loop1 # loop end -end1: +end1: li $v0, 10 syscall +`; - - - `; - - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Array Sum Loop", + assertExecution("MIPS32.yml", testAssembly, { registers: { PC: 0x44n, - r1: 0x200000n, // at - r2: 0xan, // v0 - r9: 0x5n, // t1 - r10: 0x5n, // t2 - r11: 0x1n, // t3 - r12: 0x4n, // t4 - r13: 0x200014n, // t5 - r14: 0x5n, // t6 - r15: 0xfn, // t7 + "1": 0x200000n, // at + "2": 0xan, // v0 + "9": 0x5n, // t1 + "10": 0x5n, // t2 + "11": 0x1n, // t3 + "12": 0x4n, // t4 + "13": 0x200014n, // t5 + "14": 0x5n, // t6 + "15": 0xfn, // t7 }, display: "", // Display buffer should be empty keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/mips/mips_example_008.test.mts b/tests/unit/arch/mips/mips_example_008.test.mts index 1f172c007..8f06781a8 100644 --- a/tests/unit/arch/mips/mips_example_008.test.mts +++ b/tests/unit/arch/mips/mips_example_008.test.mts @@ -1,14 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("MIPS Matrix Copy with Floats", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -33,7 +25,7 @@ main: li $t3, 4 move $t4, $zero move $t5, $zero - + loop1: beq $t2, $t4, end1 loop2: beq $t3, $t5, end2 l.s $f0, 0($t0) @@ -47,28 +39,19 @@ end2: addi $t4, $t4, 1 b loop1 end1: li $v0, 10 syscall +`; - `; - - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Matrix Copy with Floats", + assertExecution("MIPS32.yml", testAssembly, { registers: { - r1: 0x200040n, // at - r2: 0xan, // v0 - r8: 0x200040n, // t0 - r9: 0x200080n, // t1 - r10: 0x4n, // t2 - r11: 0x4n, // t3 - r12: 0x4n, // t4 + "1": 0x200040n, // at + "2": 0xan, // v0 + "8": 0x200040n, // t0 + "9": 0x200080n, // t1 + "10": 0x4n, // t2 + "11": 0x4n, // t3 + "12": 0x4n, // t4 }, memory: { "0x20007f": 0x24n, @@ -117,7 +100,5 @@ end1: li $v0, 10 }, display: "", // Display buffer should be empty keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/mips/mips_example_011.test.mts b/tests/unit/arch/mips/mips_example_011.test.mts index 379ef3f58..64beb4195 100644 --- a/tests/unit/arch/mips/mips_example_011.test.mts +++ b/tests/unit/arch/mips/mips_example_011.test.mts @@ -1,14 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("MIPS Function Calls", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -28,47 +20,35 @@ main: syscall li $v0, 10 syscall - + sum: add $t1, $a0, $a1 add $t2, $a2, $a2 move $v0, $t1 move $v1, $t2 - jr $ra + jr $ra sub: sub $v0, $a0, $a1 jr $ra - - - `; +`; - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Function Calls", + assertExecution("MIPS32.yml", testAssembly, { registers: { PC: 0x38n, - r1: 0xffffffb3n, // at - r2: 0xan, // v0 - r3: 0x5an, // v1 - r4: 0xffffff70n, // a0 - r5: 0x5an, // a1 - r6: 0x2dn, // a2 - r9: 0xffffffcan, // t1 - r10: 0x5an, // t2 - r31: 0x24n, // ra + "1": 0xffffffb3n, // at + "2": 0xan, // v0 + "3": 0x5an, // v1 + "4": 0xffffff70n, // a0 + "5": 0x5an, // a1 + "6": 0x2dn, // a2 + "9": 0xffffffcan, // t1 + "10": 0x5an, // t2 + "31": 0x24n, // ra }, display: "-144", // Should display '-144' keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/mips/mips_example_012.test.mts b/tests/unit/arch/mips/mips_example_012.test.mts index 0fd08c544..973a01705 100644 --- a/tests/unit/arch/mips/mips_example_012.test.mts +++ b/tests/unit/arch/mips/mips_example_012.test.mts @@ -1,14 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("MIPS Recursive Factorial", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # ARCOS.INF.UC3M.ES # BY-NC-SA (https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es) @@ -17,7 +9,7 @@ Deno.test("MIPS Recursive Factorial", async () => { .text - main: + main: # v1 = factorial(5) li $a0, 5 jal factorial @@ -42,7 +34,7 @@ factorial: # if ($a < 2): # return 1 bge $a0, 2, b_else - li $v0, 1 + li $v0, 1 b b_efs # else: # return $a0 * factorial($a0 - 1) @@ -59,31 +51,20 @@ factorial: # return $v0 jr $ra +`; - `; - - const MIPS_ARCH_PATH = "../../../architecture/MIPS32.yml"; - - // Setup simulator with MIPS architecture - await setupSimulator(testAssembly, MIPS_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "MIPS Recursive Factorial", + assertExecution("MIPS32.yml", testAssembly, { registers: { PC: 0x1cn, - r1: 0x1n, // at - r2: 0xan, // v0 - r4: 0x78n, // a0 - r9: 0x5n, // t1 - r31: 0x8n, // ra + "1": 0x1n, // at + "2": 0xan, // v0 + "4": 0x78n, // a0 + "9": 0x5n, // t1 + "31": 0x8n, // ra }, display: "120", // Should display '120' keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/riscv/entry_point_demo.test.mts b/tests/unit/arch/riscv/entry_point_demo.test.mts new file mode 100644 index 000000000..b437645a1 --- /dev/null +++ b/tests/unit/arch/riscv/entry_point_demo.test.mts @@ -0,0 +1,41 @@ +import { assertExecution } from "../simulator-test-utils.mts"; + +const testAssembly = ` +# +# Creator (https://creatorsim.github.io/creator/) +# +.text + foo: + # Not executed + addi t0, x0, 1 + addi t1, x0, 2 + addi t2, x0, 3 + addi t3, x0, 4 + addi t4, x0, 5 + main: + # Start of the program + addi t0, t0, 5 + addi t1, t1, 5 + addi t2, t2, 5 + addi t3, t3, 5 + addi t4, t4, 5 + + # exit program + li a7, 10 + ecall +`; + +Deno.test( + "Architecture-agnostic testing - RISC-V Execution entry point", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + t0: 5n, + t1: 5n, + t2: 5n, + t3: 5n, + t4: 5n, + }, + display: "", + keyboard: "", + }), +); diff --git a/tests/unit/arch/riscv/example_001.test.mts b/tests/unit/arch/riscv/example_001.test.mts index 4cafdc26f..38196a9da 100644 --- a/tests/unit/arch/riscv/example_001.test.mts +++ b/tests/unit/arch/riscv/example_001.test.mts @@ -1,36 +1,26 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test( - "Architecture-agnostic testing - RISC-V Basic Data Types and Print Operations", - async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # .data - + byte: .byte 12 - + .align 1 half: .half 34 - + .text main: - - # print byte value + + # print byte value la a0, byte lb a0, 0(a0) li a7, 1 ecall - + # print half value la a0, half lh a0, 0(a0) @@ -40,31 +30,15 @@ Deno.test( # exit program li a7, 10 ecall +`; - `; - - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals( - result.error, - false, - `Execution should not error. ${result.output}`, - ); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - a0: 0x22n, // a0 should contain 34 (0x22) - }, - display: "1234", // Should show '1234' (12 followed by 34) - keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); - }, +Deno.test( + "Architecture-agnostic testing - RISC-V Basic Data Types and Print Operations", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + a0: 0x22n, // a0 should contain 34 (0x22) + }, + display: "1234", // Should show '1234' (12 followed by 34) + keyboard: "", // Keyboard buffer should be empty + }), ); diff --git a/tests/unit/arch/riscv/example_002.test.mts b/tests/unit/arch/riscv/example_002.test.mts index 1c30b9995..a3ab71f8b 100644 --- a/tests/unit/arch/riscv/example_002.test.mts +++ b/tests/unit/arch/riscv/example_002.test.mts @@ -1,16 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; +import { assertExecution } from "../simulator-test-utils.mts"; -Deno.test( - "Architecture-agnostic testing - RISC-V Store Hello World without Data Segment", - - async () => { - const testAssembly = ` +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # Example: Store "hello world" byte by byte without data segment @@ -18,102 +8,91 @@ Deno.test( .text main: - # Use a base memory address + # Use a base memory address li t1, 0x200000 - + # Store "hello world" byte by byte # 'h' = 104 li t0, 104 sb t0, 0(t1) - - # 'e' = 101 + + # 'e' = 101 li t0, 101 sb t0, 1(t1) - + # 'l' = 108 li t0, 108 sb t0, 2(t1) - + # 'l' = 108 li t0, 108 sb t0, 3(t1) - + # 'o' = 111 li t0, 111 sb t0, 4(t1) - + # ' ' = 32 (space) li t0, 32 sb t0, 5(t1) - + # 'w' = 119 li t0, 119 sb t0, 6(t1) - + # 'o' = 111 li t0, 111 sb t0, 7(t1) - + # 'r' = 114 li t0, 114 sb t0, 8(t1) - + # 'l' = 108 li t0, 108 sb t0, 9(t1) - + # 'd' = 100 li t0, 100 sb t0, 10(t1) - + # null terminator = 0 li t0, 0 sb t0, 11(t1) - + # Print the string (system call 4 - print string) mv a0, t1 # address of string li a7, 4 # system call for print string ecall - + # exit program li a7, 10 ecall - `; - - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - x5: 0x0n, // t0 - last value stored - x6: 0x200000n, // t1 - base address - x10: 0x200000n, // a0 - string address - }, - memory: { - "0x200000": 0x68n, // 'h' = 104 - "0x200001": 0x65n, // 'e' = 101 - "0x200002": 0x6cn, // 'l' = 108 - "0x200003": 0x6cn, // 'l' = 108 - "0x200004": 0x6fn, // 'o' = 111 - "0x200005": 0x20n, // ' ' = 32 (space) - "0x200006": 0x77n, // 'w' = 119 - "0x200007": 0x6fn, // 'o' = 111 - "0x200008": 0x72n, // 'r' = 114 - "0x200009": 0x6cn, // 'l' = 108 - "0x20000a": 0x64n, // 'd' = 100 - "0x20000b": 0x0n, // null terminator - }, - display: "hello world", - keyboard: "", - }); - - cleanupSimulator(); - }, +`; + +Deno.test( + "Architecture-agnostic testing - RISC-V Store Hello World without Data Segment", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + x5: 0x0n, // t0 - last value stored + x6: 0x200000n, // t1 - base address + x10: 0x200000n, // a0 - string address + }, + memory: { + "0x200000": 0x68n, // 'h' = 104 + "0x200001": 0x65n, // 'e' = 101 + "0x200002": 0x6cn, // 'l' = 108 + "0x200003": 0x6cn, // 'l' = 108 + "0x200004": 0x6fn, // 'o' = 111 + "0x200005": 0x20n, // ' ' = 32 (space) + "0x200006": 0x77n, // 'w' = 119 + "0x200007": 0x6fn, // 'o' = 111 + "0x200008": 0x72n, // 'r' = 114 + "0x200009": 0x6cn, // 'l' = 108 + "0x20000a": 0x64n, // 'd' = 100 + "0x20000b": 0x0n, // null terminator + }, + display: "hello world", + keyboard: "", + }), ); diff --git a/tests/unit/arch/riscv/example_003.test.mts b/tests/unit/arch/riscv/example_003.test.mts index 6c8003c53..5d8c4e50b 100644 --- a/tests/unit/arch/riscv/example_003.test.mts +++ b/tests/unit/arch/riscv/example_003.test.mts @@ -1,16 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test( - "Architecture-agnostic testing - RISC-V Load and Store Operations", - async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -29,13 +19,13 @@ Deno.test( .text main: - + la t0, w1 # w1 address -> t0 lw t3, 0(t0) # Memory[t0] -> t3 la t1, b1 # b1 address -> t1 lb t4, 0(t1) # Memory[t1] -> t4 - + la t2, h1 # h1 address -> t2 lh t5, 0 (t2) # Memory[t2] -> t5 @@ -47,44 +37,32 @@ main: la t0, h2 # h2 address -> t0 sh t5, 0(t0) # t5 -> Memory[h2] - + # exit program li a7, 10 ecall +`; - `; - - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - x5: 0x20000en, // t0 - h2 address - x6: 0x200004n, // t1 - b1 address - x7: 0x200006n, // t2 - h1 address - x28: 0xen, // t3 - loaded w1 value - x29: 0x78n, // t4 - loaded b1 value (120) - x30: 0x16n, // t5 - loaded h1 value - }, - memory: { - "0x200003": 0xen, // w1 = 14 - "0x200004": 0x78n, // b1 = 120 - "0x200007": 0x16n, // h1 = 22 - "0x20000b": 0xen, // w2 = copied from w1 - "0x20000c": 0x78n, // b2 = copied from b1 - "0x20000f": 0x16n, // h2 = copied from h1 - }, - display: "", - keyboard: "", - }); - - cleanupSimulator(); - }, +Deno.test( + "Architecture-agnostic testing - RISC-V Load and Store Operations", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + x5: 0x20000en, // t0 - h2 address + x6: 0x200004n, // t1 - b1 address + x7: 0x200006n, // t2 - h1 address + x28: 0xen, // t3 - loaded w1 value + x29: 0x78n, // t4 - loaded b1 value (120) + x30: 0x16n, // t5 - loaded h1 value + }, + memory: { + "0x200003": 0xen, // w1 = 14 + "0x200004": 0x78n, // b1 = 120 + "0x200007": 0x16n, // h1 = 22 + "0x20000b": 0xen, // w2 = copied from w1 + "0x20000c": 0x78n, // b2 = copied from b1 + "0x20000f": 0x16n, // h2 = copied from h1 + }, + display: "", + keyboard: "", + }), ); diff --git a/tests/unit/arch/riscv/example_004.test.mts b/tests/unit/arch/riscv/example_004.test.mts index e3cab9647..fe2bf33ce 100644 --- a/tests/unit/arch/riscv/example_004.test.mts +++ b/tests/unit/arch/riscv/example_004.test.mts @@ -1,43 +1,32 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; -// This test has been verified with SPIKE -Deno.test( - "Architecture-agnostic testing - RISC-V Double Precision Floating Point Operations", - // eslint-disable-next-line max-lines-per-function - async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # - + .data a: .double 34.544 b: .double 11.443 c: .double 665.4 - + d: .zero 24 - + .text main: - + la x5, a la x6, b la x7, c la x8, d - + fld f0, 0(x5) fld f2, 0(x6) fld f10, 0(x7) fadd.d f0, f0, f0 fsub.d f4, f10, f0 fdiv.d f12, f10, f2 - + fsd f0, 0(x8) addi x8, x8, 8 fsd f4, 0(x8) @@ -47,87 +36,76 @@ main: # exit program li a7, 10 ecall +`; - `; - - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - x5: 0x200000n, // should contain 0x200000 - x6: 0x200008n, // should contain 0x200008 - x7: 0x200010n, // should contain 0x200010 - x8: 0x200028n, // should contain 0x200028 - f0: 0x405145a1cac08312n, // should contain 0x405145A1CAC08312 - f2: 0x4026e2d0e5604189n, // should contain 0x4026E2D0E5604189 - f4: 0x4082a27ef9db22d1n, // should contain 0x4082A27EF9DB22D1 - f10: 0x4084cb3333333333n, // should contain 0x4084CB3333333333 - f12: 0x404d13154689c3e9n, // should contain 0x404D13154689C3E9 - }, - memory: { - // Original double values in memory - "0x200000": 0x40n, - "0x200001": 0x41n, - "0x200002": 0x45n, - "0x200003": 0xa1n, - "0x200004": 0xcan, - "0x200005": 0xc0n, - "0x200006": 0x83n, - "0x200007": 0x12n, // a: 34.544 - "0x200008": 0x40n, - "0x200009": 0x26n, - "0x20000a": 0xe2n, - "0x20000b": 0xd0n, - "0x20000c": 0xe5n, - "0x20000d": 0x60n, - "0x20000e": 0x41n, - "0x20000f": 0x89n, // b: 11.443 - "0x200010": 0x40n, - "0x200011": 0x84n, - "0x200012": 0xcbn, - "0x200013": 0x33n, - "0x200014": 0x33n, - "0x200015": 0x33n, - "0x200016": 0x33n, - "0x200017": 0x33n, // c: 665.4 - // Results stored by the program - "0x200018": 0x40n, - "0x200019": 0x51n, - "0x20001a": 0x45n, - "0x20001b": 0xa1n, - "0x20001c": 0xcan, - "0x20001d": 0xc0n, - "0x20001e": 0x83n, - "0x20001f": 0x12n, // f0: fadd.d result - "0x200020": 0x40n, - "0x200021": 0x82n, - "0x200022": 0xa2n, - "0x200023": 0x7en, - "0x200024": 0xf9n, - "0x200025": 0xdbn, - "0x200026": 0x22n, - "0x200027": 0xd1n, // f4: fsub.d result - "0x200028": 0x40n, - "0x200029": 0x4dn, - "0x20002a": 0x13n, - "0x20002b": 0x15n, - "0x20002c": 0x46n, - "0x20002d": 0x89n, - "0x20002e": 0xc3n, - "0x20002f": 0xe9n, // f12: fdiv.d result - }, - display: "", // Display buffer should be empty - keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); - }, +// This test has been verified with SPIKE +Deno.test( + "Architecture-agnostic testing - RISC-V Double Precision Floating Point Operations", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + x5: 0x200000n, + x6: 0x200008n, + x7: 0x200010n, + x8: 0x200028n, + f0: 0x405145a1cac08312n, + f2: 0x4026e2d0e5604189n, + f4: 0x4082a27ef9db22d1n, + f10: 0x4084cb3333333333n, + f12: 0x404d13154689c3e9n, + }, + memory: { + // Original double values in memory + "0x200000": 0x40n, + "0x200001": 0x41n, + "0x200002": 0x45n, + "0x200003": 0xa1n, + "0x200004": 0xcan, + "0x200005": 0xc0n, + "0x200006": 0x83n, + "0x200007": 0x12n, // a: 34.544 + "0x200008": 0x40n, + "0x200009": 0x26n, + "0x20000a": 0xe2n, + "0x20000b": 0xd0n, + "0x20000c": 0xe5n, + "0x20000d": 0x60n, + "0x20000e": 0x41n, + "0x20000f": 0x89n, // b: 11.443 + "0x200010": 0x40n, + "0x200011": 0x84n, + "0x200012": 0xcbn, + "0x200013": 0x33n, + "0x200014": 0x33n, + "0x200015": 0x33n, + "0x200016": 0x33n, + "0x200017": 0x33n, // c: 665.4 + // Results stored by the program + "0x200018": 0x40n, + "0x200019": 0x51n, + "0x20001a": 0x45n, + "0x20001b": 0xa1n, + "0x20001c": 0xcan, + "0x20001d": 0xc0n, + "0x20001e": 0x83n, + "0x20001f": 0x12n, // f0: fadd.d result + "0x200020": 0x40n, + "0x200021": 0x82n, + "0x200022": 0xa2n, + "0x200023": 0x7en, + "0x200024": 0xf9n, + "0x200025": 0xdbn, + "0x200026": 0x22n, + "0x200027": 0xd1n, // f4: fsub.d result + "0x200028": 0x40n, + "0x200029": 0x4dn, + "0x20002a": 0x13n, + "0x20002b": 0x15n, + "0x20002c": 0x46n, + "0x20002d": 0x89n, + "0x20002e": 0xc3n, + "0x20002f": 0xe9n, // f12: fdiv.d result + }, + display: "", // Display buffer should be empty + keyboard: "", // Keyboard buffer should be empty + }), ); diff --git a/tests/unit/arch/riscv/example_005.test.mts b/tests/unit/arch/riscv/example_005.test.mts index 959c3b7ff..03aeb701d 100644 --- a/tests/unit/arch/riscv/example_005.test.mts +++ b/tests/unit/arch/riscv/example_005.test.mts @@ -1,16 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test( - "Architecture-agnostic testing - RISC-V Sum of First 10 Numbers", - async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -20,12 +10,12 @@ Deno.test( max: .byte 10 .text - main: + main: la t0, max lb t0, 0 (t0) li t1, 0 li a0, 0 - + while: bge t1, t0, end_while add a0, a0, t1 addi t1, t1, 1 @@ -37,29 +27,17 @@ Deno.test( # exit program li a7, 10 ecall +`; - `; - - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - x5: 0xan, // t0 should contain 0xa (10) - x6: 0xan, // t1 should contain 0xa (10 - loop counter after completion) - x10: 0x2dn, // a0 should contain 0x2d (45 - sum of 0+1+2+...+9) - }, - display: "45", // Display should show '45' - keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); - }, +Deno.test( + "Architecture-agnostic testing - RISC-V Sum of First 10 Numbers", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + x5: 0xan, // t0 should contain 0xa (10) + x6: 0xan, // t1 should contain 0xa (10 - loop counter after completion) + x10: 0x2dn, // a0 should contain 0x2d (45 - sum of 0+1+2+...+9) + }, + display: "45", // Display should show '45' + keyboard: "", // Keyboard buffer should be empty + }), ); diff --git a/tests/unit/arch/riscv/example_006.test.mts b/tests/unit/arch/riscv/example_006.test.mts index 6b6d93d9f..a83ea0a76 100644 --- a/tests/unit/arch/riscv/example_006.test.mts +++ b/tests/unit/arch/riscv/example_006.test.mts @@ -1,16 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test( - "Architecture-agnostic testing - RISC-V Branch and Jump Operations", - async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -22,8 +12,8 @@ Deno.test( li t1, 2 li t3, 5 bge t3, t0, jump1 - - jump2: + + jump2: li t3, 34 li a7, 10 ecall @@ -36,32 +26,20 @@ Deno.test( # exit program li a7, 10 ecall - `; - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - x5: 0x4n, // t0 should contain 0x4 - x6: 0x2n, // t1 should contain 0x2 - x17: 0xan, // a7 should contain 0xa (syscall 10 - exit) - x28: 0x22n, // t3 should contain 0x22 (34 in decimal) - x29: 0xbn, // t4 should contain 0xb (11 in decimal) - x30: 0x22bn, // t5 should contain 0x22b (555 in decimal) - }, - display: "", // Display buffer should be empty - keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); - }, +Deno.test( + "Architecture-agnostic testing - RISC-V Branch and Jump Operations", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + x5: 0x4n, // t0 should contain 0x4 + x6: 0x2n, // t1 should contain 0x2 + x17: 0xan, // a7 should contain 0xa (syscall 10 - exit) + x28: 0x22n, // t3 should contain 0x22 (34 in decimal) + x29: 0xbn, // t4 should contain 0xb (11 in decimal) + x30: 0x22bn, // t5 should contain 0x22b (555 in decimal) + }, + display: "", // Display buffer should be empty + keyboard: "", // Keyboard buffer should be empty + }), ); diff --git a/tests/unit/arch/riscv/example_007.test.mts b/tests/unit/arch/riscv/example_007.test.mts index e3be55599..e38dd8f02 100644 --- a/tests/unit/arch/riscv/example_007.test.mts +++ b/tests/unit/arch/riscv/example_007.test.mts @@ -1,14 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test("Architecture-agnostic testing - RISC-V Array Sum Loop", async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -42,24 +34,15 @@ loop1: beq t1, t2, end1 # if(t1 == t2) --> jump to fin1 beq x0, x0, loop1 # loop end -end1: +end1: # exit program li a7, 10 ecall +`; - `; - - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ +Deno.test( + "Architecture-agnostic testing - RISC-V Array Sum Loop", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { registers: { x5: 0xfn, // t0 should contain 0xf (15 - sum of 1+2+3+4+5) x6: 0x5n, // t1 should contain 0x5 (loop counter after completion) @@ -71,7 +54,5 @@ end1: }, display: "", // Display buffer should be empty keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); -}); + }), +); diff --git a/tests/unit/arch/riscv/example_008.test.mts b/tests/unit/arch/riscv/example_008.test.mts index 2f497014f..2d56fbf31 100644 --- a/tests/unit/arch/riscv/example_008.test.mts +++ b/tests/unit/arch/riscv/example_008.test.mts @@ -1,17 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test( - "Architecture-agnostic testing - RISC-V Matrix Copy with Floating Point", - - async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -37,7 +26,7 @@ main: li t3, 4 add t4, zero, zero add t5, zero, zero - + loop1: beq t2, t4, end1 loop2: beq t3, t5, end2 flw f0, 0(t0) @@ -49,43 +38,32 @@ loop2: beq t3, t5, end2 end2: addi t4, t4, 1 add t5, zero, zero beq x0, x0, loop1 -end1: +end1: # exit program li a7, 10 ecall +`; - - `; - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - x5: 0x200040n, - x6: 0x200080n, - x7: 0x4n, - x28: 0x4n, - x29: 0x4n, - f0: 0xffffffff33441124n, - }, - memory: { - "0x20007f": 0x24n, - "0x20007e": 0x11n, - "0x20007d": 0x44n, - "0x20007c": 0x33n, - "0x200040": 0x34n, - "0x200044": 0x34n, - "0x200048": 0x34n, - "0x20004c": 0x34n, - }, - }); - - cleanupSimulator(); - }, +Deno.test( + "Architecture-agnostic testing - RISC-V Matrix Copy with Floating Point", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + x5: 0x200040n, + x6: 0x200080n, + x7: 0x4n, + x28: 0x4n, + x29: 0x4n, + f0: 0xffffffff33441124n, + }, + memory: { + "0x20007f": 0x24n, + "0x20007e": 0x11n, + "0x20007d": 0x44n, + "0x20007c": 0x33n, + "0x200040": 0x34n, + "0x200044": 0x34n, + "0x200048": 0x34n, + "0x20004c": 0x34n, + }, + }), ); diff --git a/tests/unit/arch/riscv/example_011.test.mts b/tests/unit/arch/riscv/example_011.test.mts index 0689f843f..05d817460 100644 --- a/tests/unit/arch/riscv/example_011.test.mts +++ b/tests/unit/arch/riscv/example_011.test.mts @@ -1,16 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test( - "Architecture-agnostic testing - RISC-V Function Calls and Stack Operations", - async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -40,36 +30,24 @@ sum: add t2, a2, a2 add a0, t1, zero add a1, t2, zero - jr ra + jr ra sub: sub a0, a0, a1 jr ra +`; - `; - - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - x6: 0xffffffcan, // t1 should contain 0xffffffca (-54 in 2's complement) - x7: 0x5an, // t2 should contain 0x5a (90 in decimal) - x10: 0xffffff70n, // a0 should contain 0xffffff70 (-144 in 2's complement) - x11: 0x5an, // a1 should contain 0x5a (90 in decimal) - x12: 0x2dn, // a2 should contain 0x2d (45 in decimal) - }, - display: "-144", // Display should show '-144' - keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); - }, +Deno.test( + "Architecture-agnostic testing - RISC-V Function Calls and Stack Operations", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + x6: 0xffffffcan, // t1 should contain 0xffffffca (-54 in 2's complement) + x7: 0x5an, // t2 should contain 0x5a (90 in decimal) + x10: 0xffffff70n, // a0 should contain 0xffffff70 (-144 in 2's complement) + x11: 0x5an, // a1 should contain 0x5a (90 in decimal) + x12: 0x2dn, // a2 should contain 0x2d (45 in decimal) + }, + display: "-144", // Display should show '-144' + keyboard: "", // Keyboard buffer should be empty + }), ); diff --git a/tests/unit/arch/riscv/example_012.test.mts b/tests/unit/arch/riscv/example_012.test.mts index 05ba77ebc..d706f4565 100644 --- a/tests/unit/arch/riscv/example_012.test.mts +++ b/tests/unit/arch/riscv/example_012.test.mts @@ -1,17 +1,6 @@ -import { assertEquals } from "https://deno.land/std/assert/mod.ts"; -import { - setupSimulator, - executeN, - cleanupSimulator, - assertSimulatorState, -} from "../simulator-test-utils.mts"; - -Deno.test( - "Architecture-agnostic testing - RISC-V Recursive Factorial Function", - - async () => { - const testAssembly = ` +import { assertExecution } from "../simulator-test-utils.mts"; +const testAssembly = ` # # ARCOS.INF.UC3M.ES # BY-NC-SA (https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es) @@ -20,7 +9,7 @@ Deno.test( .text - main: + main: addi sp, sp, -4 sw ra, 0(sp) @@ -51,7 +40,7 @@ factorial: # return 1 li x5, 2 bge a0, t0, b_else - li a0, 1 + li a0, 1 beq x0, x0, b_efs # else: # return a0 * factorial(a0 - 1) @@ -68,29 +57,17 @@ factorial: # return t0 jr ra +`; - `; - - const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; - - // Setup simulator with RISC-V architecture - await setupSimulator(testAssembly, RISCV_ARCH_PATH); - - // Execute the program - const result = executeN(1000); - assertEquals(result.error, false, "Execution should not error"); - - // Assert all expected state using the wrapper function - assertSimulatorState({ - registers: { - x5: 0x2n, // t0 should contain 0x2 (comparison value) - x6: 0x5n, // t1 should contain 0x5 (last factorial parameter) - x10: 0x78n, // a0 should contain 0x78 (120 - factorial of 5) - }, - display: "120", // Display should show '120' (5! = 120) - keyboard: "", // Keyboard buffer should be empty - }); - - cleanupSimulator(); - }, +Deno.test( + "Architecture-agnostic testing - RISC-V Recursive Factorial Function", + assertExecution("RISCV/RV32IMFD.yml", testAssembly, { + registers: { + x5: 0x2n, // t0 should contain 0x2 (comparison value) + x6: 0x5n, // t1 should contain 0x5 (last factorial parameter) + x10: 0x78n, // a0 should contain 0x78 (120 - factorial of 5) + }, + display: "120", // Display should show '120' (5! = 120) + keyboard: "", // Keyboard buffer should be empty + }), ); diff --git a/tests/unit/arch/riscv/example_013.test.mts b/tests/unit/arch/riscv/example_013.test.mts index 800807de9..97f35b69e 100644 --- a/tests/unit/arch/riscv/example_013.test.mts +++ b/tests/unit/arch/riscv/example_013.test.mts @@ -7,11 +7,7 @@ import { } from "../simulator-test-utils.mts"; import * as creator from "@/core/core.mjs"; -Deno.test( - "Architecture-agnostic testing - RISC-V Nested Function Calls with Stack", - // eslint-disable-next-line max-lines-per-function - async () => { - const testAssembly = ` +const testAssembly = ` # # Creator (https://creatorsim.github.io/creator/) # @@ -30,13 +26,13 @@ main: li a0, 23 li a1, -77 li a2, 45 - + # Call the first level function (starts the nested calls) jal ra, level1 - + # Store result mv s0, a0 - + # Print result li a7, 1 ecall @@ -59,16 +55,16 @@ level1: sw s0, 8(sp) sw a0, 4(sp) # Save argument a0 sw a1, 0(sp) # Save argument a1 - + # Save arguments in saved registers mv s0, a0 - + # Call level2 jal ra, level2 - + # Add original a0 to result add a0, a0, s0 - + # Restore registers and return lw a1, 0(sp) lw s0, 8(sp) @@ -83,14 +79,14 @@ level2: sw ra, 8(sp) sw a1, 4(sp) sw a2, 0(sp) - + # Call level3 jal ra, level3 - + # Add original a2 to result lw t0, 0(sp) add a0, a0, t0 - + # Restore and return lw a1, 4(sp) lw ra, 8(sp) @@ -103,14 +99,14 @@ level3: addi sp, sp, -8 sw ra, 4(sp) sw a1, 0(sp) - + # First call the original sum function jal ra, sum - + # Then call sub with result from sum lw a1, 0(sp) jal ra, sub - + # Restore and return lw ra, 4(sp) addi sp, sp, 8 @@ -122,14 +118,16 @@ sum: add t2, a2, a2 add a0, t1, zero add a1, t2, zero - jr ra + jr ra sub: sub a0, a0, a1 jr ra +`; - `; - +Deno.test( + "Architecture-agnostic testing - RISC-V Nested Function Calls with Stack", + async () => { const RISCV_ARCH_PATH = "../../../architecture/RISCV/RV32IMFD.yml"; // Setup simulator with RISC-V architecture diff --git a/tests/unit/arch/riscv/floating_point_demo.test.mts b/tests/unit/arch/riscv/floating_point_demo.test.mts index 19306a1b3..a26e88474 100644 --- a/tests/unit/arch/riscv/floating_point_demo.test.mts +++ b/tests/unit/arch/riscv/floating_point_demo.test.mts @@ -12,27 +12,27 @@ const FLOATING_POINT_DEMO_ASSEMBLY = ` pi: .float 3.14159265 e: .float 2.71828183 radius: .float 5.0 - + .text main: # Load floating point constants la t0, pi flw f0, 0(t0) # f0 = pi - + la t0, e flw f1, 0(t0) # f1 = e - + la t0, radius flw f2, 0(t0) # f2 = radius (5.0) - + # Mathematical operations fadd.s f3, f0, f1 # f3 = pi + e fmul.s f4, f0, f1 # f4 = pi * e - + # Circle area calculation: area = pi * radius^2 fmul.s f5, f2, f2 # f5 = radius^2 fmul.s f6, f0, f5 # f6 = pi * radius^2 - + # exit program li a7, 10 ecall diff --git a/tests/unit/arch/simulator-test-utils.mts b/tests/unit/arch/simulator-test-utils.mts index d05ed3891..9f087eb06 100644 --- a/tests/unit/arch/simulator-test-utils.mts +++ b/tests/unit/arch/simulator-test-utils.mts @@ -24,6 +24,7 @@ export interface ArchResult { export interface CompileResult { status: string; msg?: string; + linter?: { errorText: string, line: number, column: number } } export interface ExecutionResult { @@ -98,24 +99,13 @@ export function getByteAtAddress(address: bigint): bigint { } /** - * Setup function to initialize simulator state with architecture from YAML file - * @param testAssembly - Assembly code to compile and load + * Load an architecture from YAML file into the simulator * @param yamlPath - Path to the YAML architecture configuration file - * @returns Setup results including architecture and compilation status + * @returns Architecture loading result */ -export async function setupSimulator( - testAssembly: string, - yamlPath: string, - assembler: string = "default", -): Promise<{ - archResult: ArchResult; - compileResult: CompileResult; -}> { - logger.disable(); - +export function loadArchitecture(yamlPath: string|URL): ArchResult { // Load architecture configuration from file synchronously - const archPath = new URL(yamlPath, import.meta.url); - const architectureConfigContent = fs.readFileSync(archPath, "utf8"); + const architectureConfigContent = fs.readFileSync(yamlPath, "utf8"); // yaml.load returns unknown; narrow its type and validate at runtime const archObject = yaml.load(architectureConfigContent) as | { config?: { plugin?: string } } @@ -145,26 +135,59 @@ export async function setupSimulator( `Failed to load architecture from ${yamlPath}: ${archResult.token}`, ); } - const compilerKey = assembler || "default"; + return archResult; +} - if (!isValidCompilerKey(compilerKey)) { +/** + * Setup function to initialize simulator state with architecture from YAML file + * @param testAssembly - Assembly code to compile and load + * @param assembler - Name of the assembler to use + * @returns Setup results including architecture and compilation status + */ +export async function compileAssembly( + testAssembly: string, + assembler: string = "default", +): Promise { + if (!isValidCompilerKey(assembler)) { throw new Error( - `Invalid assembler: ${compilerKey}. Valid options are: ${Object.keys(compiler_map).join(", ")}`, + `Invalid assembler: ${assembler}. Valid options are: ${Object.keys(compiler_map).join(", ")}`, ); } - const compilerFunction = compiler_map[compilerKey]; + creator.reset(); + + const compilerFunction = compiler_map[assembler]; // Compile assembly code const compileResult = (await creator.assembly_compile( testAssembly, compilerFunction, + true, )) as CompileResult; if (compileResult.status !== "ok") { throw new Error(`Failed to compile assembly: ${compileResult.msg}`); } - creator.reset(); + return compileResult; +} +/** + * Setup function to initialize simulator state with architecture from YAML file + * @param testAssembly - Assembly code to compile and load + * @param yamlPath - Path to the YAML architecture configuration file + * @returns Setup results including architecture and compilation status + */ +export async function setupSimulator( + testAssembly: string, + yamlPath: string, + assembler: string = "default", +): Promise<{ + archResult: ArchResult; + compileResult: CompileResult; +}> { + logger.disable(); + const archPath = new URL(yamlPath, import.meta.url); + const archResult = loadArchitecture(archPath) + const compileResult = await compileAssembly(testAssembly, assembler) return { archResult, compileResult }; } @@ -384,3 +407,28 @@ export function assertSimulatorState( ); } } + +/** + * Verifies the execution of an assembly code + * @param arch - Architecture file to use + * @param code - Assembly code to execute + * @param expected - Object containing expected values for registers, memory, display, and keyboard + */ +export function assertExecution( + arch: string, + code: string, + expected: ExpectedState, +): () => Promise { + return async () => { + const ARCH_PATH = "../../../architecture/" + arch; + await setupSimulator(code, ARCH_PATH); + const result = executeN(1000); + assertEquals( + result.error, + false, + `Execution should not error. ${result.output}`, + ); + assertSimulatorState(expected) + cleanupSimulator(); + } +} diff --git a/tests/unit/core/memory/memory.test.mjs b/tests/unit/core/memory/memory.test.mjs index 0f8610864..0dbc5a517 100644 --- a/tests/unit/core/memory/memory.test.mjs +++ b/tests/unit/core/memory/memory.test.mjs @@ -281,9 +281,35 @@ Deno.test("Memory - dump and restore 4-bit memory", () => { assertEquals(memory.read(7n), 1); }); -Deno.test("Memory - restore throws error for mismatched dump size", () => { +Deno.test("Memory - restore smaller memory", () => { + const memory = new Memory({ sizeInBytes: 10 }); + const dump = { + addresses: [0, 1, 5], + values: [1, 213, 42], + bitsPerByte: 8, + size: 6, + hints: [], + } + + assertEquals(memory.read(0n), 0); + assertEquals(memory.read(1n), 0); + assertEquals(memory.read(5n), 0); + + memory.restore(dump); + assertEquals(memory.read(0n), 1); + assertEquals(memory.read(1n), 213); + assertEquals(memory.read(5n), 42); +}); + +Deno.test("Memory - restore throws error for bigger dump size", () => { const memory = new Memory({ sizeInBytes: 10, bitsPerByte: 8 }); - const wrongSizeDump = [1, 2, 3]; // Should be 10 elements + const wrongSizeDump = { + addresses: [5], + values: [42], + bitsPerByte: 8, + size: 20, + hints: [], + } assertThrows( () => memory.restore(wrongSizeDump), @@ -292,6 +318,22 @@ Deno.test("Memory - restore throws error for mismatched dump size", () => { ); }); +Deno.test("Memory - restore throws error for mismatched bits/byte", () => { + const memory = new Memory({ sizeInBytes: 10, bitsPerByte: 8 }); + const wrongSizeDump = { + addresses: [5], + values: [42], + bitsPerByte: 16, + size: 10, + hints: [], + } + const msg = "Dump metadata does not match current memory configuration"; + + assertThrows(() => memory.restore(wrongSizeDump), Error, msg); + wrongSizeDump.bitsPerByte = 6 + assertThrows(() => memory.restore(wrongSizeDump), Error, msg); +}); + Deno.test("Memory - getBitsPerByte and getMaxByteValue", () => { const memory8 = new Memory({ sizeInBytes: 100, bitsPerByte: 8 }); assertEquals(memory8.getBitsPerByte(), 8); @@ -1546,10 +1588,115 @@ Deno.test("Memory - getUsedAddresses stress test", () => { memory.write(300n, 0); const usedAddresses = memory.getUsedAddresses(); - expectedAddresses.sort((a, b) => { - if (a > b) return -1; - if (a < b) return 1; - return 0; - }); // Sort highest to lowest + // Sort highest to lowest + expectedAddresses.sort((a, b) => Number(b - a)); assertEquals(usedAddresses, expectedAddresses); }); + +Deno.test("Memory - alloc center", () => { + const memory = new Memory({ + sizeInBytes: 100, + memoryLayout: new Map([ + ["data", { start: 0, end: 3 }], + ["stack", { start: 90, end: 99 }], + ]), + }); + + const addr1 = memory.alloc(1, "data"); + assertEquals(addr1, 4n); + assertEquals(memory.getMemorySegments().get("data"), { start: 0, end: 4 }); + assertEquals(memory.getSize(), 100); + memory.write(addr1, 123) + assertEquals(memory.read(addr1), 123); + + const addr2 = memory.alloc(6, "data"); + assertEquals(addr2, 5n); + assertEquals(memory.getMemorySegments().get("data"), { start: 0, end: 10 }); + assertEquals(memory.getSize(), 100); + memory.write(addr2, 234) + memory.write(addr2 + 5n, 12) + assertEquals(memory.read(addr2), 234); + assertEquals(memory.read(addr2 + 5n), 12); + + const addr3 = memory.alloc(50, "data"); + assertEquals(addr3, 11n); + assertEquals(memory.getMemorySegments().get("data"), { start: 0, end: 60 }); + assertEquals(memory.getSize(), 100); + memory.write(addr3, 98) + memory.write(addr3 + 49n, 45) + assertEquals(memory.read(addr3), 98); + assertEquals(memory.read(addr3 + 49n), 45); +}); + +Deno.test("Memory - alloc resize", () => { + const memory = new Memory({ + sizeInBytes: 10, + memoryLayout: new Map([ + ["stack", { start: 0, end: 3 }], + ["data", { start: 8, end: 9 }], + ]), + }); + + const addr1 = memory.alloc(1, "data"); + assertEquals(addr1, 10n); + assertEquals(memory.getMemorySegments().get("data"), { start: 8, end: 10 }); + assertEquals(memory.getSize(), 11); + memory.write(addr1, 123) + assertEquals(memory.read(addr1), 123); + + const addr2 = memory.alloc(6, "data"); + assertEquals(addr2, 11n); + assertEquals(memory.getMemorySegments().get("data"), { start: 8, end: 16 }); + assertEquals(memory.getSize(), 17); + memory.write(addr2, 234) + memory.write(addr2 + 5n, 12) + assertEquals(memory.read(addr2), 234); + assertEquals(memory.read(addr2 + 5n), 12); + + const addr3 = memory.alloc(50, "data"); + assertEquals(addr3, 17n); + assertEquals(memory.getMemorySegments().get("data"), { start: 8, end: 66 }); + assertEquals(memory.getSize(), 67); + memory.write(addr3, 98) + memory.write(addr3 + 49n, 45) + assertEquals(memory.read(addr3), 98); + assertEquals(memory.read(addr3 + 49n), 45); +}); + +Deno.test("Memory - alloc mixed", () => { + const memory = new Memory({ + sizeInBytes: 10, + memoryLayout: new Map([ + ["dataA", { start: 0, end: 1 }], + ["dataB", { start: 8, end: 9 }], + ]), + }); + + const addr1 = memory.alloc(5, "dataA"); + assertEquals(addr1, 2n); + assertEquals(memory.getMemorySegments().get("dataA"), { start: 0, end: 6 }); + assertEquals(memory.getMemorySegments().get("dataB"), { start: 8, end: 9 }); + assertEquals(memory.getSize(), 10); + memory.write(addr1, 123) + memory.write(addr1 + 4n, 78) + assertEquals(memory.read(addr1), 123); + assertEquals(memory.read(addr1 + 4n), 78); + + const addr2 = memory.alloc(5, "dataB"); + assertEquals(addr2, 10n); + assertEquals(memory.getMemorySegments().get("dataA"), { start: 0, end: 6 }); + assertEquals(memory.getMemorySegments().get("dataB"), { start: 8, end: 14 }); + assertEquals(memory.getSize(), 15); + memory.write(addr2, 123) + memory.write(addr2 + 4n, 78) + assertEquals(memory.read(addr2), 123); + assertEquals(memory.read(addr2 + 4n), 78); + + const addr3 = memory.alloc(1, "dataA"); + assertEquals(addr3, 7n); + assertEquals(memory.getMemorySegments().get("dataA"), { start: 0, end: 7 }); + assertEquals(memory.getMemorySegments().get("dataB"), { start: 8, end: 14 }); + assertEquals(memory.getSize(), 15); + memory.write(addr3, 91) + assertEquals(memory.read(addr3), 91); +}); diff --git a/tsconfig.json b/tsconfig.json index b1c1495bd..fcc34c1d2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,7 @@ } ], "compilerOptions": { + "types": ["vite/client", "vitest/globals"], "target": "es2024", "lib": ["dom", "es2024"], "strict": true,