|
xy_god
中级用户
   疯狂的流浪者
积分 276
发帖 56
注册 2003-9-25
状态 离线
|
『楼 主』:
[原创]操作系统之实现篇
使用 LLM 解释/回答一下
em07]呵呵,诸位,其实这个很简单的啦!我记得我在一开始接触电脑的时候就一直在想做一个操作系统!但是那个时候没有人教啦,很苦闷!但是我不想大家一起老是苦恼,那样的话,我们的操作系统老也出不来了,呵呵!
OK,下面我告诉大家如何去实现一个操作系统!
第一步,大家最困惑的可能就是如何实现一个自引导的程序罢?!其实,自引导的实现原理很简单的,在软盘的0磁道1扇区的最后2字节写成55AA(16进制),然后呢,前面的字节写成机器代码,那么计算机就执行了!注意,调用中断的时候不要调用DOS软中断,否则会死机,因为这个时候我们是脱离任何操作系统的,那些中断我们还没有填写,呵呵!
第二步,当然是要自己设计一个磁盘文件系统格式啦,以便于管理磁盘!初学者注意啦,文件夹实际上设计成指针就行了,因为在磁盘文件系统上文件夹是一个动态变化的
结构,每个文件夹下都存了很多指针,指向其他文件或文件夹所在的地址!
第三,如何实现进程调用!其实在实模式下,很简单的,你可以从磁盘文件中获得
机器码,然后读入内存(这时候要记住内存地址,包括CS,IP),然后用PUSH指令
和RET指令啦,代码就被调入内存啦,如果不是非法指令,他就会顺利执行,呵呵!
OK,操作系统最重要的东西已经实现了,即文件系统和进程装载器啦!其实这些东西在我的机器上已经实现了,不过还很雏形,还不如DOS好用!
其实好多资料我都是在网络上找到的,然后看啊,做实验啊,最后再自己设计的!可惜一切都是我自己实现的,没有人和我合作。。。。。。。。。痛苦 。。。。。。。
em07]Hehe, everyone, actually this is very simple! I remember when I first got in touch with computers, I always wanted to make an operating system! But no one taught me back then, and I was very depressed! But I didn't want everyone to keep being depressed like that, otherwise our operating system would never come out, hehe!
OK, now I'll tell you how to implement an operating system!
The first step, everyone's most confused thing might be how to implement a self-booting program?! Actually, the principle of self-booting is very simple. Write 55AA (hexadecimal) in the last 2 bytes of sector 1, track 0 of the floppy disk, and then write machine code in the preceding bytes, and then the computer will execute it! Note that when calling interrupts, don't call DOS soft interrupts, otherwise the computer will crash, because at this time we are independent of any operating system, and those interrupts we haven't filled in yet, hehe!
The second step, of course, is to design a disk file system format by yourself, so as to manage the disk! Beginners, pay attention! Folders are actually designed as pointers, because on the disk file system, folders are a dynamically changing structure, and each folder stores many pointers, pointing to the addresses of other files or folders!
Third, how to implement process calls! Actually, in real mode, it's very simple. You can get the machine code from the disk file, then load it into memory (remember the memory address at this time, including CS, IP), and then use the PUSH instruction and RET instruction, and the code will be loaded into memory. If it's not an illegal instruction, it will execute smoothly, hehe!
OK, the most important things of the operating system have been implemented, namely the file system and the process loader! Actually, these things have been implemented on my machine, but they are still very rudimentary, not as easy to use as DOS!
In fact, a lot of materials I found on the Internet, then read and did experiments, and finally designed by myself! Unfortunately, everything is implemented by myself, and there is no one to cooperate with me... Pain...
|

临河居士
http://www.xygod.pc5.org |
|
2003-10-8 00:00 |
|
|
xy_god
中级用户
   疯狂的流浪者
积分 276
发帖 56
注册 2003-9-25
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
补充两句,获得机器代码呢,我用的是ULTRA EDIT!其实只要懂得MZ文件格式就OK啦,用
DEBUG也行啊,如果你不闲累的话!
To obtain machine code, I'm using ULTRA EDIT! Actually, as long as you understand the MZ file format, it's okay! You can also use DEBUG, if you don't mind the trouble!
|

临河居士
http://www.xygod.pc5.org |
|
2003-10-8 00:00 |
|
|
QB45
高级用户
   
积分 677
发帖 194
注册 2003-9-13
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
如果这样的话 xy_god 你写一个主引导区病毒是很简单的事情了!
实际上有些软件如《还原精灵》、还有多系统引导等等这些软件都改写了主引导区,先把主引导区的内容搬到别处去,(或者是用一个跳转指令执行完后在回来),执行完自己的代码在执行主引导区的代码!
If that's the case, xy_god, it's a very simple thing for you to write a master boot record virus! In fact, some software such as "Return Genius" and multi-system booting and so on have rewritten the master boot record. First, move the content of the master boot record to another place, (or use a jump instruction to execute and then come back), execute your own code and then execute the code of the master boot record!
|

我(QB45)的照片与简历
http://www.programfan.com/club/showbbs.asp?id=197280
|
|
2003-10-9 00:00 |
|
|
xy_god
中级用户
   疯狂的流浪者
积分 276
发帖 56
注册 2003-9-25
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
其实我当初学这些东西的动力之一也 就 是 作个病毒之类的东东啦!
Actually, one of the motivations for me to learn these things back then was to make something like a virus or something!
|

临河居士
http://www.xygod.pc5.org |
|
2003-10-10 00:00 |
|
|
iceboy
银牌会员
    
积分 1681
发帖 512
注册 2003-8-2
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
如果你做的操作系统和 DOS 兼容,那么就不用愁“没有人和我合作”...
要不就像 Unix 刚开始一样艰难。
If you make an operating system compatible with DOS, then you don't have to worry about "no one cooperating with me"...
Or it will be as difficult as the beginning of Unix.
|

Somehow somewhere I've got to choose.
No matter if it is win or lose. |
|
2003-10-10 00:00 |
|
|
QB45
高级用户
   
积分 677
发帖 194
注册 2003-9-13
状态 离线
|
|
2003-10-10 00:00 |
|
|
cn_archer
元老会员
         农民
积分 2903
发帖 991
注册 2003-7-23 来自 福建省
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
呵呵,大家对操作系统应该都会有兴趣吧,可以一起讨论呢。
另外,楼上的好象挺喜欢玩帝国的,不知道会不会玩征服者啊。
Hehe, everyone should be interested in operating systems, and we can discuss together.
Also, the person above seems to like playing Empire, I wonder if they will play Conqueror.
|

艰难奋长戟,万古用一夫
中国DOS联盟 http://www.cn-dos.net 欢迎大家来共同学习
我的MSN&E-Mail cn_archer@hotmail.com QQ 56049418
|
|
2003-10-11 00:00 |
|
|
QB45
高级用户
   
积分 677
发帖 194
注册 2003-9-13
状态 离线
|
|
2003-10-13 00:00 |
|
|
凌晨一点
初级用户
 
积分 255
发帖 54
注册 2003-10-24
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
做吧做吧,这个世界,没有什么不可能的(楼上的别介意啊^_^) 有什么需要帮忙的尽管说,大家一定会给你做主的!!
Go ahead, go ahead. In this world, nothing is impossible (don't mind the person above ^_^). If there's anything you need help with, just let us know, everyone will definitely stand up for you!
|
|
2003-10-25 00:00 |
|
|
xy_god
中级用户
   疯狂的流浪者
积分 276
发帖 56
注册 2003-9-25
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
恩,我现在正在写鼠标驱动,好不容易找到写资料和全是E文的,只好自己翻了!
Well, I'm currently writing a mouse driver. It's hard to find the writing materials and they're all in English, so I have to translate them myself!
|

临河居士
http://www.xygod.pc5.org |
|
2003-10-26 00:00 |
|
|
凌晨一点
初级用户
 
积分 255
发帖 54
注册 2003-10-24
状态 离线
|
|
2003-10-27 00:00 |
|
|
hunome
银牌会员
     颓废青年
积分 2265
发帖 721
注册 2003-5-12
状态 离线
|
|
2003-10-27 00:00 |
|
|
lghseaman
新手上路

积分 18
发帖 5
注册 2006-3-12
状态 离线
|
|
2006-3-12 22:27 |
|
|
hj_18
中级用户
  
积分 255
发帖 57
注册 2003-6-26
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
有本书叫《自己动手写操作系统》,我买了,还行,就是没空看,建议大家也到书店翻翻。
There is a book called "Write Your Own Operating System". I bought it. It's okay. I just don't have time to read it. I suggest everyone also go to the bookstore and flip through it.
|
|
2006-3-14 07:32 |
|
|
yk141
初级用户
 
积分 46
发帖 21
注册 2006-3-8 来自 中华人民共和国
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
引导程序是最容易搞的,连我都会!
我的电脑的引导程序是自已搞的,电脑上装了
MS-DOS 6.22
Windows 98
Windows XP
Fedora Core 2
The boot program is the easiest to handle, even I can do it!
The boot program of my computer was made by myself. There are installed on the computer:
MS-DOS 6.22
Windows 98
Windows XP
Fedora Core 2
|
|
2006-3-17 13:18 |
|