mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
Rename ioreq to syscall
This commit is contained in:
parent
b79a107a3d
commit
61fe0e8647
20 changed files with 187 additions and 190 deletions
|
|
@ -12,7 +12,7 @@ jal ra, main
|
|||
#include "non-rust-crt0-hack.S"
|
||||
#else
|
||||
// only rust will see this
|
||||
li a7, {IOREQ_HALT}
|
||||
li a7, {UVM32_SYSCALL_HALT}
|
||||
#endif
|
||||
ecall
|
||||
.section .data
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
.global _start
|
||||
_start:
|
||||
la a0, str
|
||||
li a7, IOREQ_PRINTLN
|
||||
li a7, UVM32_SYSCALL_PRINTLN
|
||||
ecall
|
||||
li a7, IOREQ_HALT
|
||||
li a7, UVM32_SYSCALL_HALT
|
||||
ecall
|
||||
str:
|
||||
.ascii "Hi\0"
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
li a7,IOREQ_HALT
|
||||
li a7,UVM32_SYSCALL_HALT
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ use core::arch::global_asm;
|
|||
use core::arch::asm;
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
// fetch IOREQ definitions from C header
|
||||
// fetch UVM32_SYSCALL definitions from C header
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
// startup code
|
||||
global_asm!(include_str!("../../crt0.S"), IOREQ_HALT = const IOREQ_HALT);
|
||||
global_asm!(include_str!("../../crt0.S"), UVM32_SYSCALL_HALT = const UVM32_SYSCALL_HALT);
|
||||
|
||||
fn syscall(id: u32, n: u32) -> u32 {
|
||||
let mut value;
|
||||
|
|
@ -25,11 +25,11 @@ fn syscall(id: u32, n: u32) -> u32 {
|
|||
|
||||
fn println(message: &str) {
|
||||
let addr_value = message.as_ptr() as u32;
|
||||
syscall(IOREQ_PRINTLN, addr_value);
|
||||
syscall(UVM32_SYSCALL_PRINTLN, addr_value);
|
||||
}
|
||||
|
||||
fn printd(n: u32) {
|
||||
syscall(IOREQ_PRINTD, n);
|
||||
syscall(UVM32_SYSCALL_PRINTD, n);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ pub inline fn syscall(id: u32, param: u32) u32 {
|
|||
}
|
||||
|
||||
pub inline fn println(val: [:0]const u8) void {
|
||||
_ = syscall(uvm32.IOREQ_PRINTLN, @intFromPtr(val.ptr));
|
||||
_ = syscall(uvm32.UVM32_SYSCALL_PRINTLN, @intFromPtr(val.ptr));
|
||||
}
|
||||
|
||||
pub inline fn yield() void {
|
||||
_ = syscall(uvm32.IOREQ_YIELD, 0);
|
||||
_ = syscall(uvm32.UVM32_SYSCALL_YIELD, 0);
|
||||
}
|
||||
|
||||
pub inline fn printc(c:u8) void {
|
||||
_ = syscall(uvm32.IOREQ_PRINTC, c);
|
||||
_ = syscall(uvm32.UVM32_SYSCALL_PRINTC, c);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ pub inline fn syscall(id: u32, param: u32) u32 {
|
|||
}
|
||||
|
||||
pub inline fn getch() ?u8 {
|
||||
const key = syscall(uvm32.IOREQ_GETC, 0);
|
||||
const key = syscall(uvm32.UVM32_SYSCALL_GETC, 0);
|
||||
if (key == 0xFFFFFFFF) {
|
||||
return null;
|
||||
} else {
|
||||
|
|
@ -24,7 +24,7 @@ pub inline fn getch() ?u8 {
|
|||
}
|
||||
|
||||
pub inline fn millis() u32 {
|
||||
return syscall(uvm32.IOREQ_MILLIS, 0);
|
||||
return syscall(uvm32.UVM32_SYSCALL_MILLIS, 0);
|
||||
}
|
||||
|
||||
// dupeZ would be better, but want to avoid using an allocator
|
||||
|
|
@ -35,21 +35,21 @@ pub inline fn print(m: []const u8) void {
|
|||
@memcpy(termination_buf[0..m.len], m);
|
||||
termination_buf[m.len] = 0;
|
||||
const s = termination_buf[0..m.len :0];
|
||||
_ = syscall(uvm32.IOREQ_PRINT, @intFromPtr(s.ptr));
|
||||
_ = syscall(uvm32.UVM32_SYSCALL_PRINT, @intFromPtr(s.ptr));
|
||||
}
|
||||
|
||||
pub inline fn println(m: []const u8) void {
|
||||
@memcpy(termination_buf[0..m.len], m);
|
||||
termination_buf[m.len] = 0;
|
||||
const s = termination_buf[0..m.len :0];
|
||||
_ = syscall(uvm32.IOREQ_PRINTLN, @intFromPtr(s.ptr));
|
||||
_ = syscall(uvm32.UVM32_SYSCALL_PRINTLN, @intFromPtr(s.ptr));
|
||||
}
|
||||
|
||||
pub inline fn yield() void {
|
||||
_ = syscall(uvm32.IOREQ_YIELD, 0);
|
||||
_ = syscall(uvm32.UVM32_SYSCALL_YIELD, 0);
|
||||
}
|
||||
|
||||
pub inline fn printc(c:u8) void {
|
||||
_ = syscall(uvm32.IOREQ_PRINTC, c);
|
||||
_ = syscall(uvm32.UVM32_SYSCALL_PRINTC, c);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue