mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
enter
This commit is contained in:
parent
9ec996b4e6
commit
b6f7b3ec16
@ -5,8 +5,9 @@
|
||||
; Main function
|
||||
;
|
||||
main:
|
||||
enter
|
||||
ret
|
||||
|
||||
itoa_test:
|
||||
mov ax0, .buf
|
||||
mov ax1, -9223372036854775807
|
||||
mov ax2, 10
|
||||
@ -28,7 +29,6 @@ main:
|
||||
mov rdi, 8
|
||||
lea rbi, b[rdi + rsi * 2 + 1]
|
||||
|
||||
leave
|
||||
ret
|
||||
|
||||
.buf = [32]
|
||||
|
@ -359,17 +359,19 @@ ret
|
||||
#
|
||||
# PUSH(RBP)
|
||||
# RBP = RSP
|
||||
# RSP = RSP - $1
|
||||
#
|
||||
# Throws:
|
||||
# See PUSH
|
||||
#
|
||||
enter
|
||||
enter i
|
||||
|
||||
#
|
||||
# Leave stack frame (LEAVE)
|
||||
#
|
||||
# RBP = *RSP
|
||||
# RSP = RSP + 8
|
||||
# RSP = RBP
|
||||
# POP(RBP)
|
||||
#
|
||||
leave
|
||||
|
||||
@ -377,7 +379,6 @@ leave
|
||||
# Supervisor only instructions #
|
||||
#---------------------------------------------------------------------------#
|
||||
|
||||
|
||||
pushf
|
||||
popf
|
||||
|
||||
@ -455,7 +456,7 @@ cla
|
||||
cln
|
||||
|
||||
#
|
||||
# Send a character to standard output
|
||||
# Send a character to standard output (PRN)
|
||||
#
|
||||
# Throws:
|
||||
# #PRN if DV text mode enabled
|
||||
|
@ -41,8 +41,14 @@ IMPL_START_0(enter)
|
||||
// We don't CHK_STACK(<) here because ENTER
|
||||
// (should) always be preceded by a CALL,
|
||||
// which already checks the stack
|
||||
|
||||
PUSH(rbp);
|
||||
rbp = rsp;
|
||||
|
||||
if (p1) {
|
||||
GETV(v1, p1);
|
||||
rsp -= v1 * 8;
|
||||
}
|
||||
}
|
||||
IMPL_END;
|
||||
|
||||
@ -50,6 +56,7 @@ IMPL_START_0(leave)
|
||||
{
|
||||
// Do NOT check stack here
|
||||
// (it would always fail)
|
||||
rsp = rbp;
|
||||
POP(rbp);
|
||||
}
|
||||
IMPL_END;
|
||||
|
13
vm/pc/decd.c
13
vm/pc/decd.c
@ -289,11 +289,14 @@ static bool eval_cond(ctx_t *ctx, uint cond)
|
||||
//
|
||||
// Executes an instruction
|
||||
//
|
||||
void exec_instr(
|
||||
ctx_t *ctx, instr_t *in,
|
||||
acc_t *p1, acc_t *p2,
|
||||
bool lock, bool rep,
|
||||
uint cond, ulong pc)
|
||||
void exec_instr(ctx_t *ctx,
|
||||
instr_t *in,
|
||||
acc_t *p1,
|
||||
acc_t *p2,
|
||||
bool lock,
|
||||
bool rep,
|
||||
uint cond,
|
||||
ulong pc)
|
||||
{
|
||||
bool out;
|
||||
ulong r1 = 0, r2 = 0;
|
||||
|
13
vm/pc/dump.c
13
vm/pc/dump.c
@ -64,11 +64,14 @@ static void dump_acc(ctx_t *ctx, acc_t *p)
|
||||
}
|
||||
}
|
||||
|
||||
void dump_instr(
|
||||
ctx_t *ctx, instr_t *in,
|
||||
acc_t *p1, acc_t *p2,
|
||||
bool lock, bool rep,
|
||||
uint cond, ulong pc)
|
||||
void dump_instr(ctx_t *ctx,
|
||||
instr_t *in,
|
||||
acc_t *p1,
|
||||
acc_t *p2,
|
||||
bool lock,
|
||||
bool rep,
|
||||
uint cond,
|
||||
ulong pc)
|
||||
{
|
||||
log("0x%lX: ", pc);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user