Compile on aarch64.

This commit is contained in:
4lDO2
2024-06-24 22:15:35 +02:00
parent c1ce1d76f9
commit 87046b77c7
4 changed files with 31 additions and 5 deletions
+12
View File
@@ -26,6 +26,12 @@ pub struct ScratchRegisters {
}
impl ScratchRegisters {
pub fn a(&self) -> usize {
self.x0
}
pub fn b(&self) -> usize {
self.x1
}
pub fn dump(&self) {
println!("X0: {:>016X}", { self.x0 });
println!("X1: {:>016X}", { self.x1 });
@@ -123,6 +129,12 @@ impl InterruptStack {
pub fn set_instr_pointer(&mut self, ip: usize) {
self.iret.elr_el1 = ip;
}
pub fn instr_pointer(&self) -> usize {
self.iret.elr_el1
}
pub fn flags(&self) -> usize {
0 // TODO
}
// TODO: This can maybe be done in userspace?
pub fn set_syscall_ret_reg(&mut self, ret: usize) {
self.scratch.x0 = ret;
+1
View File
@@ -100,6 +100,7 @@ pub fn signal_handler() {
thread_ctl.saved_scratch_b.set(scratch_b);
thread_ctl.control_flags.store((control_flags | SigcontrolFlags::INHIBIT_DELIVERY).bits(), Ordering::Release);
log::info!("delivering");
}
pub fn excp_handler(signal: usize) {
let current = context::current().expect("CPU exception but not inside of context!");
+17 -4
View File
@@ -74,6 +74,21 @@ impl KernelScheme for DtbScheme {
Err(Error::new(ENOENT))
}
fn fsize(&self, id: usize) -> Result<u64> {
let mut handles = HANDLES.write();
let handle = handles.get_mut(&id).ok_or(Error::new(EBADF))?;
if handle.stat {
return Err(Error::new(EBADF));
}
let file_len = match handle.kind {
HandleKind::RawData => DATA.get().ok_or(Error::new(EBADFD))?.len(),
};
Ok(file_len as u64)
}
fn close(&self, id: usize) -> Result<()> {
if HANDLES.write().remove(&id).is_none() {
return Err(Error::new(EBADF));
@@ -81,7 +96,7 @@ impl KernelScheme for DtbScheme {
Ok(())
}
fn kreadoff(&self, id: usize, dst_buf: UserSliceWo, offset: u64, flags: u32, _stored_flags: u32) -> Result<usize> {
fn kreadoff(&self, id: usize, dst_buf: UserSliceWo, offset: u64, _flags: u32, _stored_flags: u32) -> Result<usize> {
let mut handles = HANDLES.write();
let handle = handles.get_mut(&id).ok_or(Error::new(EBADF))?;
@@ -98,9 +113,7 @@ impl KernelScheme for DtbScheme {
.get(src_offset..)
.expect("expected data to be at least data.len() bytes long");
let bytes_copied = dst_buf.copy_common_bytes_from_slice(src_buf)?;
Ok(bytes_copied)
dst_buf.copy_common_bytes_from_slice(src_buf)
}
fn kfstat(&self, id: usize, buf: UserSliceWo) -> Result<()> {
+1 -1
Submodule syscall updated: c230cec21c...9eb2eccfc3