Initial import of ViperOS
This commit is contained in:
34
Libs/SerialLogger/linker.ld
Normal file
34
Libs/SerialLogger/linker.ld
Normal file
@@ -0,0 +1,34 @@
|
||||
SECTIONS {
|
||||
. = 0;
|
||||
|
||||
.text : {
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
}
|
||||
|
||||
.rodata : {
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
}
|
||||
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
}
|
||||
|
||||
.bss : {
|
||||
PROVIDE(__bss_start = .);
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
PROVIDE(__bss_end = .);
|
||||
}
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.comment)
|
||||
*(.note)
|
||||
*(.eh_frame)
|
||||
*(.eh_frame_hdr)
|
||||
*(.reloc)
|
||||
*(.debug*)
|
||||
}
|
||||
}
|
||||
34
Libs/SerialLogger/project.json
Normal file
34
Libs/SerialLogger/project.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "SerialLogger",
|
||||
"version": "1.0.0",
|
||||
"source_dir": "./",
|
||||
"temp_dir": "./temp",
|
||||
"output_dir": "./output",
|
||||
"compiler": {
|
||||
"cmd": "llc",
|
||||
"flags": ["-filetype=obj", "-mtriple=x86_64-none-elf", "-relocation-model=pic", "-O2"]
|
||||
},
|
||||
"linker": {
|
||||
"cmd": "ld.lld.exe",
|
||||
"flags": [
|
||||
"-m", "elf_x86_64",
|
||||
"-T", "linker.ld",
|
||||
"--oformat", "elf64-x86-64",
|
||||
"-shared",
|
||||
"-z", "notext",
|
||||
"--no-relax",
|
||||
"--strip-all"
|
||||
],
|
||||
"output": "slog.so"
|
||||
},
|
||||
"includes": ["../.."],
|
||||
"target": {
|
||||
"triple": "x86_64-none-elf",
|
||||
"datalayout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
},
|
||||
"options": {
|
||||
"slice_level": 3,
|
||||
"target": "llvm",
|
||||
"strict_mode": true
|
||||
}
|
||||
}
|
||||
12
Libs/SerialLogger/serial_logger.py
Normal file
12
Libs/SerialLogger/serial_logger.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import vpsdk.syscall as syscall
|
||||
import t, c
|
||||
|
||||
def log_info(msg: t.CConst | t.CChar | t.CPtr) -> t.CVoid | t.CExport:
|
||||
syscall._syscall1(t.CUInt64T(syscall.SERIAL_PUTS), t.CUInt64T("[SerialLogger] "))
|
||||
syscall._syscall1(t.CUInt64T(syscall.SERIAL_PUTS), t.CUInt64T(msg))
|
||||
syscall._syscall1(t.CUInt64T(syscall.SERIAL_PUTS), t.CUInt64T("\n"))
|
||||
|
||||
def log_warn(msg: t.CConst | t.CChar | t.CPtr) -> t.CVoid | t.CExport:
|
||||
syscall._syscall1(t.CUInt64T(syscall.SERIAL_PUTS), t.CUInt64T("[SerialLogger:WARN] "))
|
||||
syscall._syscall1(t.CUInt64T(syscall.SERIAL_PUTS), t.CUInt64T(msg))
|
||||
syscall._syscall1(t.CUInt64T(syscall.SERIAL_PUTS), t.CUInt64T("\n"))
|
||||
Reference in New Issue
Block a user