MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / dispatch

Function dispatch

src/sys/sc/mod.rs:61–143  ·  view source on GitHub ↗

Dispatcher for system-calls

(n: usize, a1: usize, a2: usize, a3: usize)

Source from the content-addressed store, hash-verified

59
60// Dispatcher for system-calls
61pub fn dispatch(n: usize, a1: usize, a2: usize, a3: usize) -> usize
62{
63 match n
64 {
65 // Close
66 CLOSE =>
67 {
68 let handle = a1;
69 close(handle);
70 0
71 }
72
73
74 // Duplicate
75 DUPLICATE =>
76 {
77 let original = a1;
78 let new = a2;
79 crate::sys::sc::svc::dp(original, new) as usize
80 }
81
82
83 // Read
84 READ =>
85 {
86 let handle = a1;
87 let ptr = crate::sys::proc::ptr_from_address(a2 as u64);
88 let len = a3;
89 let buffer = unsafe
90 {
91 core::slice::from_raw_parts_mut(ptr, len)
92 };
93
94 crate::sys::sc::svc::rd(handle, buffer) as usize
95 }
96
97 // Real-time
98 RT =>
99 {
100 // TODO: Convert time, using FL32's conv_to_bits
101 crate::sys::sc::svc::rt() as usize
102 }
103
104
105 // Sleep
106 SLEEP =>
107 {
108 crate::sys::sc::svc::sl(a1 as f64);
109 0
110 }
111
112
113
114 // SPAWN
115 SPAWN =>
116 {
117 let ptr = crate::sys::proc::ptr_from_address(a1 as u64);
118 let len = a2;

Callers 1

schFunction · 0.85

Calls 7

closeFunction · 0.85
dpFunction · 0.85
ptr_from_addressFunction · 0.85
rdFunction · 0.85
slFunction · 0.85
rtFunction · 0.70
spawnFunction · 0.70

Tested by

no test coverage detected