stevenbaby / onix Goto Github PK
View Code? Open in Web Editor NEWOnix - 操作系统实现
License: MIT License
Onix - 操作系统实现
License: MIT License
大佬好,我在哔哩哔哩看到UP主的视频,我将内核代码放到 0x6efffff 之后,printk 传递的字符串常量用指针取出来是空的,bochs 的内存我设置了 512MB,可以请教一下这是什么原因吗?
请问一下,在 kernel/memory.c
中的第 171
行,函数 get_page()
中这一句断言:
Line 171 in ff4eee0
为什么是有效的呢?无符号整数应该无论如何都会大于等于 0
吧
如果确实有错误的话,能否将该部分改成如下形式:
assert(free_pages > 0);
free_pages--;
望解答疑惑。初来 Github,如若有冒犯,望谅解。
minix.c文件中int minix_readdir(inode_t *inode, dentry_t *entry, size_t count, off_t offset)函数 size_t count疑似没有被该函数使用
minix.c文件中static inode_t *iget(dev_t dev, idx_t nr)函数中出现inode->mtime = inode->mtime;疑似笔误
这个宏可以直接使用 GCC 提供的 offset 宏来替代,Linux 目前也是也是采用 GCC 的这个宏来实现 container_of
Line 28 in 748013c
1、应该使用 typedef signed char int8; 因为 char 的符号类型标准未明确,取决于编译器实现。
2、如何判断出 int 就是 int32 而 long long 就是 int64,之前看有 LP32、LP64这些,如果自己写话要如何精确定义。
ref:
https://zh.cppreference.com/w/cpp/language/types
https://www.ibm.com/docs/en/zos/2.1.0?topic=options-lp64-ilp32
[kernel/memory.c][154] total pages 131072 fee pages 130784
请教一个Onix的问题,task_to_user_mode函数里面为什么不用设置tss.esp0的值?这样用户态init_user_thread在调用系统调用或者被时钟中断的时候,不就无法进行栈切换吗?
brk向下调整堆空间时,未没有修改task_t中的brk字段。导致即使缩下了堆空间的最高位置,仍能触发缺页中断访问到其不应该拥有的虚拟内存地址。
console.c文件
static _inline void state_esc(console_t *con, char ch)
是否考虑在最开始添加con->state = STATE_NOR; 将状态设置为STATE_NOR状态
我自己写了一个内核,用objcopy转成了raw binary,但是如果我使用类似这样的代码:
printk("hello world");
或者是其他的全局变量,都是读不出任何数据。
char tmp[128] = "ok xdm";
int init()
{
printk(tmp);
return 0;
}
我反汇编看了一下,发现这些数据都在,只是汇编代码中都访问了错误的地址,有没有什么办法解决呢?
arena.cc文件里面的kfree函数中:
free_kpage((u32)arena, 1);函数应该在
arena->desc->page_count--;
assert(arena->desc->page_count >= BUF_COUNT);
后面调用,不然这属于典型的释放了内存,但继续引用这块内存,这样很危险!!!
在做全局描述符表时,使用__atrribute__((packed)) 会报错
src/include/onix/global.h:22:17: error: expected declaration specifiers or ‘...’ before ‘(’ token
22 | } atrribute((packed)) descriptor_t;
gcc 版本
gcc (Ubuntu 11.1.0-1ubuntu1~18.04.1) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Onix 中将识别硬盘获得的数据的第 1、3、6 个 word 分别视为 cylinders, heads, sectors per track 信息,但是我查询了 相关手册 (硬盘识别数据说明部分位于 7.16.7) ,里面对这些 word 的说明是 Obsolete 即这些数据是无效信息。想请教一下作者参考的资料?
大佬,我看了你的视频和你的代码,也想自己写一个,但是进入了保护模式后,怎么也无法跳转。每次一跳转就会崩溃,我怀疑是GDT表写得有问题,但是我检查了很多遍还是没有成功,能帮我看看代码嘛。
https://github.com/miny1233/xsOS/blob/main/boot/setup.s
就是这个程序里面,setup载入到0x90000上,想用保护模式进入head程序,head在0x0上。
您好,objcopy将elf文件转为binary文件时(objcopy -O binary),是不是会将.bss部分填充为0呢?
网上说先输入gnome-terminal查看报错
[root@staraire ~]# gnome-terminal
# Locale not supported by C library.
# Using the fallback 'C' locale.
# Failed to parse arguments: Cannot open display:
sudo locale-gen en_US.UTF-8
下载了en_US.UTF-8
网上的很多方案都试过了,最终找到一个办法解决了
https://qastack.cn/ubuntu/599808/cannot-set-lc-ctype-to-default-locale-no-such-file-or-directory
sudo echo "LC_ALL=en_US.UTF-8" >> /etc/environment
sudo echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
sudo echo "LANG=en_US.UTF-8" > /etc/locale.conf
sudo locale-gen en_US.UTF-8
device_request中idx_t offset = idx + device_ioctl(device->dev, DEV_CMD_SECTOR_START, 0, 0);计算了一遍lba,在ide_pio_part_write中,又加了一遍part->start。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.