Initial import of ViperOS

This commit is contained in:
Viper
2026-07-19 12:38:20 +08:00
commit 6813947181
104 changed files with 26710 additions and 0 deletions

View 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*)
}
}

View 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
}
}

View 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"))