Restructure

This commit is contained in:
felsabbagh3
2019-03-22 04:14:52 -04:00
parent 097e0217de
commit 6c64fa35f8
239 changed files with 3839 additions and 819 deletions

BIN
kernel/vx_os/vx_io/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,29 @@
#include "vx_io.h"
void vx_print_hex(unsigned f)
{
if (f < 16)
{
vx_print_str(hextoa[f]);
return;
}
int temp;
int sf = 32;
bool start = false;
do
{
temp = (f >> (sf - 4)) & 0xf;
if (temp != 0) start = true;
if (start) vx_print_str(hextoa[temp]);
sf -= 4;
} while(sf > 0);
}
void vx_printf(char * c, unsigned f)
{
vx_print_str(c);
vx_print_hex(f);
vx_print_str("\n");
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include <stdbool.h>
static char * hextoa[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
void vx_print_hex(unsigned);
void vx_print_str(char *);
void vx_printf(char *, unsigned);

View File

@@ -0,0 +1,30 @@
.type vx_print_str, @function
.global vx_print_str
vx_print_str:
addi sp, sp, -12
sw ra, 0(sp)
sw a1, 4(sp)
bl:
lbu a1,0(a0)
beqz a1,be
jal vx_printc
addi a0, a0, 1
j bl
be:
lw ra, 0(sp)
lw a1, 4(sp)
addi sp, sp, 12
ret
.type vx_printc, @function
.global vx_printc
vx_printc:
la a7, 0x00010000
sw a1, 0(a7)
ret