使用cargo管理一些C文件的编译,并且移动部分汇编到arch目录 (#447)

* 使用cargo管理main.c的编译

* 使用build-scripts编译架构相关的c代码

* 删除elf.h
This commit is contained in:
LoGin
2023-11-17 21:25:15 +08:00
committed by GitHub
parent e4600f7f7d
commit 46e234aef6
36 changed files with 556 additions and 1683 deletions

View File

@ -17,9 +17,6 @@ pub struct Partition {
pub sectors_num: u64, // 该分区的扇区数
disk: Weak<dyn BlockDevice>, // 当前分区所属的磁盘
pub partno: u16, // 在磁盘上的分区号
// struct block_device_request_queue *bd_queue; // 请求队列
// struct vfs_superblock_t *bd_superblock; // 执行超级块的指针
}
/// @brief: 分区信息 - 成员函数

View File

@ -44,7 +44,7 @@ hardware_intr_controller ps2_keyboard_intr_controller =
* @param filp 文件指针
* @return long
*/
long ps2_keyboard_open(struct vfs_index_node_t *inode, struct vfs_file_t *filp)
long ps2_keyboard_open(void *inode, void *filp)
{
ps2_keyboard_reset_buffer(&kb_buf);
return 0;
@ -57,7 +57,7 @@ long ps2_keyboard_open(struct vfs_index_node_t *inode, struct vfs_file_t *filp)
* @param filp 文件指针
* @return long
*/
long ps2_keyboard_close(struct vfs_index_node_t *inode, struct vfs_file_t *filp)
long ps2_keyboard_close(void *inode, void *filp)
{
ps2_keyboard_reset_buffer(&kb_buf);
return 0;
@ -72,7 +72,7 @@ long ps2_keyboard_close(struct vfs_index_node_t *inode, struct vfs_file_t *filp)
* @param arg 参数
* @return long
*/
long ps2_keyboard_ioctl(struct vfs_index_node_t *inode, struct vfs_file_t *filp, uint64_t cmd, uint64_t arg)
long ps2_keyboard_ioctl(void *inode, void *filp, uint64_t cmd, uint64_t arg)
{
switch (cmd)
{
@ -95,7 +95,7 @@ long ps2_keyboard_ioctl(struct vfs_index_node_t *inode, struct vfs_file_t *filp,
* @param position 读取的位置
* @return long 读取的字节数
*/
long ps2_keyboard_read(struct vfs_file_t *filp, char *buf, int64_t count, long *position)
long ps2_keyboard_read(void *filp, char *buf, int64_t count, long *position)
{
// 缓冲区为空则等待
while (kfifo_empty(&kb_buf))
@ -114,7 +114,7 @@ long ps2_keyboard_read(struct vfs_file_t *filp, char *buf, int64_t count, long *
* @param position
* @return long
*/
long ps2_keyboard_write(struct vfs_file_t *filp, char *buf, int64_t count, long *position)
long ps2_keyboard_write(void *filp, char *buf, int64_t count, long *position)
{
return 0;
}

View File

@ -1,4 +1,4 @@
use core::sync::atomic::AtomicI32;
use core::{ffi::c_void, sync::atomic::AtomicI32};
use alloc::sync::{Arc, Weak};
@ -11,7 +11,7 @@ use crate::{
Metadata, PollStatus,
},
},
include::bindings::bindings::{vfs_file_operations_t, vfs_file_t, vfs_index_node_t},
include::bindings::bindings::vfs_file_operations_t,
libs::{keyboard_parser::TypeOneFSM, rwlock::RwLock, spinlock::SpinLock},
syscall::SystemError,
time::TimeSpec,
@ -104,7 +104,7 @@ impl IndexNode for LockedPS2KeyBoardInode {
let func = guard.f_ops.read.unwrap();
let r = unsafe {
func(
0 as *mut vfs_file_t,
0 as *mut c_void,
&mut buf[0..len] as *mut [u8] as *mut i8,
len as i64,
0 as *mut i64,
@ -133,7 +133,7 @@ impl IndexNode for LockedPS2KeyBoardInode {
// 第一次打开,需要初始化
let guard = self.0.write();
let func = guard.f_ops.open.unwrap();
let _ = unsafe { func(0 as *mut vfs_index_node_t, 0 as *mut vfs_file_t) };
let _ = unsafe { func(0 as *mut c_void, 0 as *mut c_void) };
}
return Ok(());
}
@ -147,7 +147,7 @@ impl IndexNode for LockedPS2KeyBoardInode {
// 最后一次关闭,需要释放
let guard = self.0.write();
let func = guard.f_ops.close.unwrap();
let _ = unsafe { func(0 as *mut vfs_index_node_t, 0 as *mut vfs_file_t) };
let _ = unsafe { func(0 as *mut c_void, 0 as *mut c_void) };
}
return Ok(());
}