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-16 22:18:09 +02:00
parent 47b2677430
commit d8893823b6
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
3 changed files with 52 additions and 8 deletions

View File

@ -5,7 +5,7 @@
; Main function ; Main function
; ;
main: main:
call itoa_test call str_test
ret ret
showoff: showoff:

View File

@ -605,6 +605,23 @@ nop
# #
cpuid cpuid
#
# Pseudo-random number generation (RAND32/RAND64)
#
# RAND32 generates a 32-bit pseudo-random number using
# a nonlinear additive feedback pseudo-random number generator
# of period 16 * (2^31 - 1).
#
# RAND64 generates two such numbers, and store them in the destination
# operand's higher and lower double words respectively
#
# The running program does not control the seeding and the processor
# may generate numbers from the same generator for other purposes
# than this instruction
#
rand32 rm
rand64 rm
# #
# Get code/data offset (GCO/GCD) # Get code/data offset (GCO/GCD)
# #

View File

@ -2,10 +2,13 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include <in/instrs.h> #include <in/instrs.h>
#include <sys/time.h>
#define _NEED_ARCH_I #define _NEED_ARCH_I
#include <in/arch_i.h> #include <in/arch_i.h>
//----------------------------------------------------------------------------//
IMPL_START_0(nop) IMPL_START_0(nop)
{ {
} }
@ -13,6 +16,37 @@ IMPL_END;
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
IMPL_START_0(cpuid)
{
}
IMPL_END;
//----------------------------------------------------------------------------//
IMPL_START_1(rand32)
{
v1 = (int)random();
}
IMPL_OUT;
IMPL_START_1(rand64)
{
v1 = (random() << 32) | (int)random();
}
IMPL_OUT;
//----------------------------------------------------------------------------//
IMPL_START_1(time)
{
struct timeval time;
gettimeofday(&time, NULL);
v1 = (time.tv_sec * 1000) + (time.tv_usec / 1000);
}
IMPL_OUT;
//----------------------------------------------------------------------------//
IMPL_START_1(prn) IMPL_START_1(prn)
{ {
if (p1->mlen > 1) { if (p1->mlen > 1) {
@ -39,10 +73,3 @@ IMPL_START_0(cla)
IMPL_END; IMPL_END;
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
IMPL_START_0(cpuid)
{
}
IMPL_END;
//----------------------------------------------------------------------------//