使用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

@ -1,31 +1,6 @@
#include <common/glib.h>
#include <common/string.h>
/**
* @brief 这个函数让蜂鸣器发声,目前仅用于真机调试。未来将移除,请勿依赖此函数。
*
* @param times 发声循环多少遍
*/
void __experimental_beep(uint64_t times)
{
io_out8(0x43, 182&0xff);
io_out8(0x42, 2280&0xff);
io_out8(0x42, (2280>>8)&0xff);
uint32_t x = io_in8(0x61)&0xff;
x |= 3;
io_out8(0x61, x&0xff);
times *= 10000;
for(uint64_t i=0;i<times;++i)
pause();
x = io_in8(0x61);
x &= 0xfc;
io_out8(0x61, x&0xff);
// 延迟一段时间
for(uint64_t i=0;i<times;++i)
pause();
}
/**
* @brief 将数据从src搬运到dst并能正确处理地址重叠的问题

View File

@ -1,25 +1,6 @@
#include <common/unistd.h>
#include <common/glib.h>
/**
* @brief fork当前进程
*
* @return pid_t
*/
pid_t fork(void)
{
return (pid_t)enter_syscall_int(SYS_FORK, 0, 0, 0, 0, 0, 0, 0, 0);
}
/**
* @brief vfork当前进程
*
* @return pid_t
*/
pid_t vfork(void)
{
return (pid_t)enter_syscall_int(SYS_VFORK, 0, 0, 0, 0, 0, 0, 0, 0);
}
void swab(void *restrict src, void *restrict dest, ssize_t nbytes)
{