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-06-12 18:43:24 +02:00
parent 9ec996b4e6
commit b6f7b3ec16
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
5 changed files with 30 additions and 16 deletions

View File

@ -5,8 +5,9 @@
; Main function ; Main function
; ;
main: main:
enter ret
itoa_test:
mov ax0, .buf mov ax0, .buf
mov ax1, -9223372036854775807 mov ax1, -9223372036854775807
mov ax2, 10 mov ax2, 10
@ -28,7 +29,6 @@ main:
mov rdi, 8 mov rdi, 8
lea rbi, b[rdi + rsi * 2 + 1] lea rbi, b[rdi + rsi * 2 + 1]
leave
ret ret
.buf = [32] .buf = [32]

View File

@ -359,17 +359,19 @@ ret
# #
# PUSH(RBP) # PUSH(RBP)
# RBP = RSP # RBP = RSP
# RSP = RSP - $1
# #
# Throws: # Throws:
# See PUSH # See PUSH
# #
enter enter
enter i
# #
# Leave stack frame (LEAVE) # Leave stack frame (LEAVE)
# #
# RBP = *RSP # RSP = RBP
# RSP = RSP + 8 # POP(RBP)
# #
leave leave
@ -377,7 +379,6 @@ leave
# Supervisor only instructions # # Supervisor only instructions #
#---------------------------------------------------------------------------# #---------------------------------------------------------------------------#
pushf pushf
popf popf
@ -455,7 +456,7 @@ cla
cln cln
# #
# Send a character to standard output # Send a character to standard output (PRN)
# #
# Throws: # Throws:
# #PRN if DV text mode enabled # #PRN if DV text mode enabled

View File

@ -41,8 +41,14 @@ IMPL_START_0(enter)
// We don't CHK_STACK(<) here because ENTER // We don't CHK_STACK(<) here because ENTER
// (should) always be preceded by a CALL, // (should) always be preceded by a CALL,
// which already checks the stack // which already checks the stack
PUSH(rbp); PUSH(rbp);
rbp = rsp; rbp = rsp;
if (p1) {
GETV(v1, p1);
rsp -= v1 * 8;
}
} }
IMPL_END; IMPL_END;
@ -50,6 +56,7 @@ IMPL_START_0(leave)
{ {
// Do NOT check stack here // Do NOT check stack here
// (it would always fail) // (it would always fail)
rsp = rbp;
POP(rbp); POP(rbp);
} }
IMPL_END; IMPL_END;

View File

@ -289,11 +289,14 @@ static bool eval_cond(ctx_t *ctx, uint cond)
// //
// Executes an instruction // Executes an instruction
// //
void exec_instr( void exec_instr(ctx_t *ctx,
ctx_t *ctx, instr_t *in, instr_t *in,
acc_t *p1, acc_t *p2, acc_t *p1,
bool lock, bool rep, acc_t *p2,
uint cond, ulong pc) bool lock,
bool rep,
uint cond,
ulong pc)
{ {
bool out; bool out;
ulong r1 = 0, r2 = 0; ulong r1 = 0, r2 = 0;

View File

@ -64,11 +64,14 @@ static void dump_acc(ctx_t *ctx, acc_t *p)
} }
} }
void dump_instr( void dump_instr(ctx_t *ctx,
ctx_t *ctx, instr_t *in, instr_t *in,
acc_t *p1, acc_t *p2, acc_t *p1,
bool lock, bool rep, acc_t *p2,
uint cond, ulong pc) bool lock,
bool rep,
uint cond,
ulong pc)
{ {
log("0x%lX: ", pc); log("0x%lX: ", pc);