mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
doc
This commit is contained in:
parent
8796f78bf5
commit
c2e412fb7f
@ -679,8 +679,8 @@ special_syms = {
|
||||
|
||||
def gentext():
|
||||
instrs.seek(0)
|
||||
# print(instrs.read())
|
||||
# instrs.seek(0)
|
||||
print(instrs.read())
|
||||
instrs.seek(0)
|
||||
|
||||
text_start = 0x100000
|
||||
data_start = text_start + ptext
|
||||
|
6
ka/ABI
6
ka/ABI
@ -19,7 +19,7 @@ A function's assembly code looks like this:
|
||||
'N' is the number of local variables used by the function,
|
||||
and is omitted if there are none ('enter' alone takes N=0).
|
||||
|
||||
The above code is equivalent to the following, but faster:
|
||||
The above code is equivalent to the following, but much faster:
|
||||
label:
|
||||
mov [rsp-8], rbp
|
||||
lea rbp, [rsp-8]
|
||||
@ -27,8 +27,8 @@ The above code is equivalent to the following, but faster:
|
||||
...
|
||||
...
|
||||
...
|
||||
lea rsp, [rbp]
|
||||
mov rbp, [rsp]
|
||||
lea rsp, [rbp+8]
|
||||
mov rbp, [rbp]
|
||||
ret
|
||||
|
||||
Between the 'enter' and the 'leave', the stack looks like this:
|
||||
|
3
ka/dos.k
3
ka/dos.k
@ -8,6 +8,9 @@ _start:
|
||||
mov rsp, 0x200000
|
||||
xor rbp, rbp
|
||||
|
||||
__push 11
|
||||
__pop rbi
|
||||
|
||||
call main
|
||||
|
||||
.1:
|
||||
|
@ -48,12 +48,6 @@ for _, line in enumerate(fi):
|
||||
if len(tok) == 0:
|
||||
continue
|
||||
|
||||
cond = False
|
||||
if tok[0][0] == '!':
|
||||
#assert(len(tok[0]) > 1)
|
||||
#tok[0] = tok[0][1:]
|
||||
continue
|
||||
|
||||
i = tok[0].strip()
|
||||
|
||||
if len(tok) == 1:
|
||||
@ -77,6 +71,14 @@ fp.seek(0)
|
||||
for _, line in enumerate(fp):
|
||||
tok = line.strip().split(' ')
|
||||
|
||||
assert(len(tok) > 0)
|
||||
|
||||
deprecated = ''
|
||||
if tok[0][0] == '!':
|
||||
assert(len(tok[0]) > 1)
|
||||
deprecated = '__'
|
||||
tok[0] = tok[0][1:]
|
||||
|
||||
if len(tok) == 1:
|
||||
name = tok[0]
|
||||
p1 = "NOPRM"
|
||||
@ -97,11 +99,11 @@ for _, line in enumerate(fp):
|
||||
p1 = "__TOK_ERROR__"
|
||||
p2 = "__TOK_ERROR__"
|
||||
|
||||
ls.write("{}\n".format(name));
|
||||
ls.write("{}{}\n".format(deprecated, name))
|
||||
|
||||
hd.write("#ifdef _NEED_ARCH_I\n")
|
||||
hd.write('{{ "{}", "{}", {}, {}, i_{} }},\n'\
|
||||
.format(tok[0], name, p1, p2, tok[0]))
|
||||
hd.write('{{ "{}{}", "{}{}", {}, {}, i_{} }},\n'\
|
||||
.format(deprecated, tok[0], deprecated, name, p1, p2, tok[0]))
|
||||
hd.write("#else\n")
|
||||
hd.write("#define I_{} {}\n".format(name.upper(), count))
|
||||
hd.write("extern bool i_{}(ctx_t *, acc_t *, acc_t *, ulong *, ulong *);\n"
|
||||
|
Loading…
Reference in New Issue
Block a user