refactor: migrate server-framework to depend on libkos
This commit is contained in:
@@ -5,4 +5,4 @@ edition = "2024"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
types = { workspace = true }
|
types = { workspace = true }
|
||||||
userspace = { workspace = true }
|
libkos = { workspace = true }
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
use types::bounded::CapSlot;
|
use types::bounded::CapSlot;
|
||||||
|
|
||||||
pub async fn send(endpoint: CapSlot, w0: usize, w1: usize, w2: usize, w3: usize) -> usize {
|
pub async fn send(endpoint: CapSlot, w0: usize, w1: usize, w2: usize, w3: usize) -> usize {
|
||||||
userspace::syscall::send(endpoint, w0, w1, w2, w3)
|
libkos::syscall::send(endpoint, w0, w1, w2, w3)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn receive(endpoint: CapSlot) -> (usize, usize, usize, usize) {
|
pub async fn receive(endpoint: CapSlot) -> (usize, usize, usize, usize) {
|
||||||
userspace::syscall::receive(endpoint)
|
libkos::syscall::receive(endpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn wait_for_interrupt(_irq: CapSlot) {
|
pub async fn wait_for_interrupt(_irq: CapSlot) {
|
||||||
userspace::syscall::yield_now();
|
libkos::syscall::yield_now();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn acknowledge_interrupt(_irq: CapSlot) {
|
pub async fn acknowledge_interrupt(_irq: CapSlot) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ pub fn block_on<F: Future>(future: F) -> F::Output {
|
|||||||
Poll::Ready(output) => return output,
|
Poll::Ready(output) => return output,
|
||||||
Poll::Pending => {
|
Poll::Pending => {
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
userspace::syscall::yield_now();
|
libkos::syscall::yield_now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ macro_rules! select {
|
|||||||
) => {
|
) => {
|
||||||
{
|
{
|
||||||
let sources = types::syscall_abi::SYS_WAIT_ANY;
|
let sources = types::syscall_abi::SYS_WAIT_ANY;
|
||||||
let wake = userspace::syscall::receive($ep as usize);
|
let wake = libkos::syscall::receive($ep as usize);
|
||||||
let $msg = wake;
|
let $msg = wake;
|
||||||
$ipc_body
|
$ipc_body
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ pub trait Server {
|
|||||||
|
|
||||||
fn run(&mut self, endpoint: CapSlot) {
|
fn run(&mut self, endpoint: CapSlot) {
|
||||||
loop {
|
loop {
|
||||||
let words = userspace::syscall::receive(endpoint);
|
let words = libkos::syscall::receive(endpoint);
|
||||||
if let Some(request) = Self::Request::decode([words.0, words.1, words.2, words.3]) {
|
if let Some(request) = Self::Request::decode([words.0, words.1, words.2, words.3]) {
|
||||||
let response = self.handle(request);
|
let response = self.handle(request);
|
||||||
let encoded = response.encode();
|
let encoded = response.encode();
|
||||||
userspace::syscall::send(endpoint, encoded[0], encoded[1], encoded[2], encoded[3]);
|
libkos::syscall::send(endpoint, encoded[0], encoded[1], encoded[2], encoded[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user