1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
This commit is contained in:
julianb0 2019-07-08 15:01:31 +02:00
parent 785648e3db
commit 972ea65016
No known key found for this signature in database
GPG Key ID: 9C7ACF0C053FB8A1
2 changed files with 149 additions and 134 deletions

View File

@ -53,7 +53,7 @@ def leave():
pdefs = dict()
# registers
pregs = list()
pregs = dict()
# instructions
pinstrs = list()
@ -101,8 +101,16 @@ def arith_eval(s):
def parse_lst_regs():
global pregs
i = 0
for _, line in enumerate(lst_regs):
pregs.append(line.strip())
line = line.strip()
if len(line) == 0:
continue
for reg in line.split():
pregs[reg] = i
i += 1
def parse_lst_instrs():
global pinstrs
@ -636,7 +644,7 @@ def parse_instr(line):
# register index $reg
if len(word) == 4 and word[0] == '$':
if word[1:] in pregs:
word = str(pregs.index(word[1:]))
word = str(pregs[word[1:]])
# for now every immediate is 64-bit
if is_number(word):
@ -747,7 +755,7 @@ def gentext():
continue
if word in pregs:
idx = pregs.index(word)
idx = pregs[word]
b_text.write(idx.to_bytes(2, byteorder='little', signed=False))
continue
@ -758,8 +766,8 @@ def gentext():
sys.exit(1)
reg2, reg1 = word.split(':', 1)
idx1 = pregs.index(reg1)
idx2 = pregs.index(reg2)
idx1 = pregs[reg1]
idx2 = pregs[reg2]
b_text.write(((idx1 << 8) | idx2).to_bytes(2, byteorder='little', signed=False))
continue

View File

@ -1,128 +1,135 @@
inv
flg
rip
rpc
px0
px1
fc1
fx2
sa0
sa1
sa2
sa3
sa4
sa5
sa6
sa7
dr0
dr1
dr2
dr3
dr4
dr5
dr6
dr7
cr0
cr1
cr2
cr3
cr4
cr5
cr6
cr7
rax
rbx
rcx
rdx
rsi
rdi
rbp
rsp
rx8
rx9
r10
r11
r12
r13
r14
r15
r16
r17
r18
r19
r20
r21
r22
r23
r24
r25
r26
r27
r28
r29
r30
r31
ax0
ax1
ax2
ax3
ax4
ax5
ax6
ax7
ax8
ax9
a10
a11
a12
a13
a14
a15
a16
a17
a18
a19
a20
a21
a22
a23
a24
a25
a26
a27
a28
a29
a30
a31
nx0
nx1
nx2
nx3
nx4
nx5
nx6
nx7
nx8
nx9
n10
n11
n12
n13
n14
n15
n16
n17
n18
n19
n20
n21
n22
n23
n24
n25
n26
n27
n28
n29
n30
n31
inv x0
flg x1
rip eip ip x2
rpc epc pc x3
px0 p0 x4
px1 p1 x5
fc1 f1 x6
fc2 f2 x7
sa0 k0 x8
sa1 k1 x9
sa2 k2 x10
sa3 k3 x11
sa4 k4 x12
sa5 k5 x13
sa6 k6 x14
sa7 k7 x15
dr0 d0 x16
dr1 d1 x17
dr2 d2 x18
dr3 d3 x19
dr4 d4 x20
dr5 d5 x21
dr6 d6 x22
dr7 d7 x23
cr0 c0 x24
cr1 c1 x25
cr2 c2 x26
cr3 c3 x27
cr4 c4 x28
cr5 c5 x29
cr6 c6 x30
cr7 c7 x31
rax eax ax rx0 r0 x32
rbx ebx bx rx1 r1 x33
rcx ecx cx rx2 r2 x34
rdx edx dx rx3 r3 x35
rsi esi si rx4 r4 x36
rdi edi di rx5 r5 x37
rbp ebp bp rx6 r6 x38
rsp esp sp rx7 r7 x39
rx8 r8 x40
rx9 r9 x41
r10 x42
r11 x43
r12 x44
r13 x45
r14 x46
r15 x47
r16 x48
r17 x49
r18 x50
r19 x51
r20 x52
r21 x53
r22 x54
r23 x55
r24 x56
r25 x57
r26 x58
r27 x59
r28 x60
r29 x61
r30 x62
r31 x63
ax0 a0 x64
ax1 a1 x65
ax2 a2 x66
ax3 a3 x67
ax4 a4 x68
ax5 a5 x69
ax6 a6 x70
ax7 a7 x71
ax8 a8 x72
ax9 a9 x73
a10 x74
a11 x75
a12 x76
a13 x77
a14 x78
a15 x79
a16 x80
a17 x81
a18 x82
a19 x83
a20 x84
a21 x85
a22 x86
a23 x87
a24 x88
a25 x89
a26 x90
a27 x91
a28 x92
a29 x93
a30 x94
a31 x95
nx0 n0 x96
nx1 n1 x97
nx2 n2 x98
nx3 n3 x99
nx4 n4 x100
nx5 n5 x101
nx6 n6 x102
nx7 n7 x103
nx8 n8 x104
nx9 n9 x105
n10 x106
n11 x107
n12 x108
n13 x109
n14 x110
n15 x111
n16 x112
n17 x113
n18 x114
n19 x115
n20 x116
n21 x117
n22 x118
n23 x119
n24 x120
n25 x121
n26 x122
n27 x123
n28 x124
n29 x125
n30 x126
n31 x127