آره فعلا همون رو ترجمه كننقل قول:
منم ميرم مقاله رو تر جمه كنم . راستي كدو م يكيهمينيكه قرار بود دوستم تر جمه كنه ؟ اگه اره ok here we go
موفق باشي
آره فعلا همون رو ترجمه كننقل قول:
منم ميرم مقاله رو تر جمه كنم . راستي كدو م يكيهمينيكه قرار بود دوستم تر جمه كنه ؟ اگه اره ok here we go
موفق باشي
Invalid ضميمه specified. If you followed a valid link, please notify the administrator
آقا لينك فايل بوت سكتور خراه لطف ميكنيد اونرو براي مي ميل كني تا بذارم روي سايت
آدرس ميل
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
فرستاده شدنقل قول:
Invalid ضميمه specified. If you followed a valid link, please notify the administrator
آقا لينك فايل بوت سكتور خراه لطف ميكنيد اونرو براي مي ميل كني تا بذارم روي سايت
آدرس ميل
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
لاو كودر جان برام مقدورنيست دنلود كنم اگه ميشه تمام متن رو همين جا كپي پيست كن ( تو كافي نت اجازه ي دنلود ندارم . هاردمو دادمگارانتي براي همينم نميتونم باسيستم خودم بيام.ببخشيد .ممنونم .
چی شد پس لاو کودر جان ؟ عجله نداری ؟؟؟ معلوم نیست این هارد ما کی قراره برسه . شما یه لطفی کن متن رو اینجا کپی پیست کن .ممنونم
به نام خدا
طراحي سيستم عامل قسمت اول Boot Sector
Boot Sector
مي دانيم كه براي اينكه هر سيستم عاملي كه بخواهد از روي هارد , فلاپي , سي دي و ... اجرا شود براي بوت شدن نياز به Boot Sector دارد
بوت سكتور چيست ؟
وقتي كه ما سيستم را روشن مي كنيم سيسم ابتدا خودش را چك مي كند تا ببيند قطعات مورد نياز متصل هستند يا نه سپس بعد از كامل شدن عمل چك كردن , سيستم اولين سكتور (از هارد, فلاپي يا سي دي رام كه در بايوس ما انتخاب كرديم ) رو به حافظه لود مي كند كه به اين سكتور Boot Sector گفته مي شود در اصل اين سكتور با بقيه سكتورها هيچ فرقي ندارد !! ولي چون بايوس اولين سكتوري را كه مي خواند اين سكتور هست و به وسيله اين سكتور سيستم عامل رو به حافظه مي آورد به اين سكتور Boot Sector گفته مي شود
شما اگر كمي به اسمبلي اشنا باشيد مي تونيد در بايوس به دنبال كدي كه باعث لود شدن اولين سكتور هارد مي شود بگرديد و با پيدا كردن و عوض كردن اون كد بهش بگيد كه مثلا سكتور 10 ما رو به عنوان اولين سكتور بوت كنه !!
در واقع كدي كه ما در اين سكتور مي نويسم بسيار مهم است زيرا اين كد اولين كدي هست كه پس از چك كردن سيستم اجرا مي شود و مي تواند كد راه انداز يك سيستم عامل يا يك برنامه و يا يك ويروس باشه !!!
چند شرط بسيار مهم براي اينكه اين سكتور بطور كار كنه مورد نياز هست (يعني توسط بايوس لود و اجرا شود)
1 - برنامه اي كه براي بوت شدن نوشته شده بعد از كامپايل حتماً حتماً بايد 512 بايت باشه چون هر سكتور 512 بايت هست
2 - آدرس شروع برنامه اي كه نوشتيم حتما بايد Org 0x7C00 باشه چون بايوس بعد از چك كردن سيستم سكتور اول هارد يا فلاپي رو كه مي خواند به اين آدرس مي بره و بعد از خواندن سكتور اول به اين ادرس پرش ميكنه و اگر ما در اول برنامه مان اين ادرس را قرار ندهيم بعد از لود شدن سكتور اول در اين ادرس چون ادرسهاي داخل برنامه مان با اين ادرس يكي نيست برنامه دچار فرو پاشي ميشه و به هيچ وجه اجرا نميشه پس ما با قرار دادن Org 0x7C00 در اول برنامه مان ادرسها داخل برنامه مان را با اين ادرس يكي مي كنيم و آدرسهاي داخل برنامه معتبر مي شود
3 - برنامه شما بايد حداكثر 510 بايت بشه نه بيشتر و شما بايد در بايت 511 و 512 اين عدد رو بنويسيد 0xAA55 كه جمعا با اين كلمه كه دو بايت است اندازه برنامه شما 512 بايت ميشود اگر اين دوبايت رو در انتهاي برنامه قرار ندهيد بايوس نمي تواند سكتور بوت را به حافظه بياورد تقريبا ميشه گفت اين دو بايت تاييد مي كنند كه برنامه اي كه در بوت سكتور هست براي بوت كردن است و اگر نباشند سيستم بوت نمي شود
نكته : برنامه ما با داده هايش بايد در داخل يك سگمنت جاي گيرد يعني برنامه مابايد COM باشد نه EXE !! و ما بعد از اينكه فايل COM ايجاد شد مي توانيم پسوند آن را به BIN يا هر پسوند غير قابل اجرا دلخواه ديگر تبديل كنيم براي اينكه هم مشخص شود اين فايل تحت سيستم عامل كه روش اين برنامه را نوشتيم اجرا نمي شود و اگر هم اشتباه اجرا كنيم برنامه فروپاشي مي نه و اجرا نمي شه و روي سيستم هاي غير از NT باعث كراش شدن سيستم مي شود در كل بهتر هست پسوند فايل عوض شود
اين مثال اجراي رو براي Nasm نوشتم
کد:
شما بايد اين برنامه را با Nasm كامپايل كنيد و از وقفه 21 كه مخصوص داس است و ديگر وقفه ها مخصوص سيستم عامل داس استفاده نكنيد! چون سيستم عامل داس اجرا نشده پس وقفه هاي كه مخصوص محيط داس است غير فعال است و اگر از اين وقفه ها استفاده كنيم برنامه مان دچار فروپاشي مي شود البته از وقفه 10 و 16 و ديگر وقفه هاي بايوس مي توانيد استفاده كنيدکد:
1. ; // MiniOs.Asm
2. [BITS 16]
3. Org 0x7C00
4. Start:
5. jmp MyCode
6. MyStr DB "Hello To All Programer Irani",0
7. MyCode:
8. ; Here Program
9. ; Set Segment Data To CS
10. Mov Ax,Cs
11. Mov Ds,Ax
12. Mov Es,Ax
13. ; Get Size Str To CX
14. Cld
15. Mov Ax,0
16. Mov Di,MyStr
17. Mov Cx,0xFFFF
18. Repnz Scasb
19. Not cx
20. ; Set Segment ES To Address Screen
21. Mov Ax,0xB800
22. Mov Es,Ax
23. ; Set Addres Str To Si
24. Mov Si,MyStr
25. ; Set Cruser To Line 3
26. Mov Di,80*6
27. ; Main Loop For Print Str
28. PrintStr:
29. Push Cx
30. Mov Al,[Si]
31. Mov Ah,7
32. Inc Si
33. Stosb
34. Inc Di
35. Pop Cx
36. loop PrintStr
37. ; End Your Program
38. Jmp $ ; Crash
39. times 512-($-$$)-2 db 0
40. DW 0xAA55
حالا فايل توليد شده به صورت Binary بوده و چون ادرس شروع اين فايل 0x100 نيست پس در محيط داس قابل اجرا نيست حالا شما مي توانيد اين برنامه را در سكتور اول بنويسيد
البته من براي اين كار هم برنامه اي با سي نوشتم
کد:
حالا شما بعد از ساختن فايل Binary كه قرار است در زمان بوت سيستم اجرا شود نام فايل Binary را در جلوي برنامه اي كه به زبان سي نوشتيم قرار مي دهيم و سپس برنامه را اجرا مي كنيدکد:1. // WSector.Cpp
2. #include <Bios.h>
3. #include <Conio.h>
4. #include <Mem.h>
5. #include <Stdio.h>
6. long filesize(FILE * stream(
7. {
8. long curpos, length;
9. curpos= ftell(stream(;
10. fseek(stream, 0L, SEEK_END);
11. length = ftell(stream);
12. fseek(stream, curpos, SEEK_SET);
13. return length;
14. }
15. void LoadFileToMem(char*fs,char mem[])
16. {
17. long sz;
18. FILE * File;
19. File=fopen(fs,"rb");
20. sz=filesize(File);
21. fread(mem,sz,1,File);
22. fclose(File);
23. printf("Load Ok Size = %i\n",sz);
24. };
25. int main(int argc,char *argv[])
26. {
27. struct diskinfo_t dinfo;
28. int result;
29. static char buf1[512];
30. char buffer[512];
31. dinfo.drive = 0; /* drive number for A */ /* ---- Select Driver A */
32. dinfo.head = 0; /* disk head number */
33. dinfo.track = 0; /* track number */
34. dinfo.sector = 1; /* sector number */
35. dinfo.nsectors = 1; /* sector count */
36. dinfo.buffer = buf1; /* data buffer */
37. memset(buf1,0,sizeof(buf1)-1);
38. if (argc<2) return 0;
39. clrscr();
40. printf("Testing to see if drive _A_ is ready ? \n");
41. result = biosdisk(4,0,0,0,0,1,buffer);
42. result &= 0x02;
43. if (result)
44. {
45. printf("Drive A: Ready\n");
46. }
47. else
48. {
49. printf("Drive A: Not Ready\n");
50. return 0;
51. };
52. LoadFileToMem(argv[1],buf1);
53. /* Write Mini Os To Floppy */
54. _bios_disk(_DISK_WRITE, &dinfo);
55. printf("Ok \nWrite Your Program To Drive A\n");
56. return 0;
57. }
مثلآ :
WSector.exe MiniOs.Bin
حالا برنامه شما در بوت سكتور قرار گرفته و شما يك فلاپي بوت داريد كه با قرار دادن آن در سيستم , اتوماتيك برنامه شما رو اجراميكنه
به همين راحتي !!
نكته مهم : براي اينكه به سكتور اول هارد شما كه محل بوت ويندوز و بقيه سيستم عامل ها است آسيبي نرسد اين برنامه(سي) , برنامه مان(اسمبلي) را در سكتور اول فلاپي مي نويسد
اگر در مورد اين متن مشكلي , نظري يا سوالي داشتيد مي توانيد با من تماس بگيريد
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
به اميد روزي كه ايرانيان برقله علم و دانش در جهان تكيه زنند
اميدوارم موفق باشيد
*******************
به خاطر درخواست مستر عزيز اين گذاشتم
امكان داره بهم ريخته بشه شرمنده
در ضمن PDF ش رو مي تونيد از ادرسي كه نت داد دريافت كنيد
لاو کودر جان ممننونم . ولی من منظورم همخون متنی بود که باید تر جمه می کردم . اونو کپی پیست کن تا من بتونم یه پرینت بگیرم و برم خونه تر جمش کنم
خودم قبلا ترجمه اش كرده بودم ولي يادم نيست ترجمه اش كجا گذاشتمنقل قول:
لاو کودر جان ممننونم . ولی من منظورم همخون متنی بود که باید تر جمه می کردم . اونو کپی پیست کن تا من بتونم یه پرینت بگیرم و برم خونه تر جمش کنم
ترجمه اش راحت هست موفق باشي
کد:Getting Started in OS Development
1 of 4
Getting Started in OS Development
It seems that most people really want to write an OS but they don't know where to start and they don't know
what programming lanuages they need to know.
Well, when I started my OS I was pretty much the same way, so I'm writting this tutorial on getting started in
OS development.
I've written this in Q&A format for easier understanding.
Q: So what languages do I need to know to make my own OS.
A: You should at least know assembly(ASM) language because you will need it to write your
bootsector(more on this in the next question) and quite a few other things. I suggest that you also learn
C/C++, because it's a much more understandable language compared to ASM. You can then use both C/C++
and ASM in your OS.
You might consider writting your OS in Pascal and ASM instead of C/C++ and ASM, but I suggest C/C++
and ASM.(note that there are some special problems with C++ and OS dev)
Q: What is a bootsector.
A: A bootsector is a small program that is stored at the very start of a floppy disk and/or hard drive. It is
responsible for finding your kernel(the MAIN part of you OS that does most everything), loading it into
memory, and running it.
Q: Do I already have to have an OS to make an OS.
A: Yes. Most people use Windows and/or Linux for OS development.
Q: What compiler(s) should I use.
A: For assembly lanuage, I suggest NASM because it's free, has good documentation, outputs to many file
formats, is availible for most OS'es, source code for it is availible, and most assembly example found on OS
dev sites need it. For C/C++ I suggest gcc under Linux and DJGPP under Windows(both are compatible with
the other).
Q: How do I make my OS bootsector bootable.
A: You will need to output it to a flat binary file. For NASM use -f bin. If you are using C/C++ you will
need to use a linker to do this(see next question).
Getting Started in OS Development
2 of 4
Q: What's a linker and how do use it for OS development.
A: A linker takes the output file(s) that a compiler(s) generates and links it into one file. For OS dev, you will
normally want to link your files into a flat binary file. For LD(the linker that is most often used with DJGPP
and gcc) use the option --oformat binary. If you use LD you should use a linker script for better control of
linking. See My suggestions for making your OS.
Q: What is Real Mode.
A: Real Mode is the state that a x86(386, 486, Pentium, etc) is in when you first turn on your PC. Real Mode
has several disadvantiges:
It lacks Protection, the ability to keep programs from messing around and crashing each other.
1.
You may only have one task.
2.
You are limited to 1Meg of address space.
3.
You must use segmentation to access memory.
4.
Q: What is Protected Mode.
A: Protected Mode(also known as PMode) is a step up from Real Mode. Protected Mode has several
advanteges over Real Mode:
Protected Mode has Protection, the ability to keep programs from messing around and crashing each
other(this is how Proctected Mode got its name).
1.
You may only have several tasks(like Windows and Linux).
2.
You have 4Gig, yes 4 gigabytes, of address space(once the A20-Gate is enabled, see next question).
3.
You can use paging to access memory.
4.
If it isn't already obvious, your OS should run in Protected Mode unless you have a very specific reason to use
Real Mode.
Q: Q: What is that A20-Gate.
A: The 8086 microprocessor(the processor that came before the 286, 386, 486, Pentium, etc) could only
access 1MB of address space. For that address range, 20 address bits(A0 - A19) are sufficent. Then, Intel
invented the 80286(often called just the "286"). The 80286 could access up to 16MB of address space, but the
80286 had to be compatible with the 8086(programs that were made for the 8086 had to be able to run on the
80286). What was the solution. To give the 80286 more address gates for the address range, but some
programs depended on the fact, that the addresses wrapped around at 1MB:
Let's see it in the way the 8086 saw it: You have the address 11111111111111111111 in dual system and add
1 to it. The result is 0 as you don't have a 21th bit (A20!). But the 80286 actually had more bits.
To solve the problem, Intel made the 80286 disable the A20-Gate, and the limit the address range to 20 bits.
Getting Started in OS Development
3 of 4
So, to access more than 1MB memory, we need to enable the A20-Gate.
Q: What is a selector.
A: A selector(sometimes also called a descriptor) is a definition of a segment. It contains a description of
basic segment attributes, like the segment base (it's starting address) and the segments limit (it's length). Each
selector is 64 bits long. More about them in the description of a GDT and LDT.
Q: What is a GDT.
A: A gdt is a table containing selectors. Basically it provides a starting address to address all selectors.
Q: What is an interrupt.
A: An interrupt is a signal that interrupts the current task that the CPU is doing. It tells the CPU that an
important event has arrived, for example hardware interrupts, and that the CPU needs to stop the current task
and run the proper interrupt handler. The interrupt handler is a special function which is designed to handle a
specific interrupt(like a key press from the keyboard). As interrupts have special properties, for example they
can be used to switch from ring 3 to ring 0, they might be used in operating systems as a way to do system
calls. Linux system calls are handled via interrupts.
Q: What is PIC.
A: The PIC, the Programmable Interrupt Controller, is a device which collects hardware interrupt requests
and signals the cpu that an interrupt has occured. When this happens, both the PIC and CPU communicate
about which request has occured and the cpu will stop the current task and execute the the interrupt handler
for that request.
Q: What is PIT.
A: The PIT, Programmable Interrupt Timer, is a programmable(you can change the speed of it) hardware
timer that fires off an interrupt when it goes off(IRQ 0). It is mainly used for task schedualing.
Q: In what order should I make my OS in.
A: Well, you could start just about anywhere, but you would probably end up with dozens of bugs. I suggest
that you start by making a bootsector, then making a basic kernel, and then add on to your kernel.
Q: What are the basic steps for setting up PMode at boot time.
Getting Started in OS Development
4 of 4
A:
Disable interrupts so nothing gets messed up.
1.
Setup a GDT.
2.
Enable the A20.
3.
Set the first bit of CR0 to 1.
4.
Load the segment registers with correct values from the GDT.
5.
Load CS and EIP with correct values by doing a far jump.
6.
You are now in PMode
7.
This is covered in more detail in Protected Mode by Chris Giese.
Q: My question isn't answered here. What do I do.
A: You can email it to me and I'll try to answer it and add it on to this(this tutorial is far from done).
This tutorial is written by K.J. and Joachim Nock. Updated 2002.11.20 by K.J.
شرمنده كه بهم ريخته شد
---------------------
نت جان شما چه كردي ؟
اقا تر جمه کارش تموم شد ( همون ه.قع ) ولی حالا دارم تایپش می کنم . به زودی حاظر می شه .