In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
I. Hello, the creation of DTOS
Q: is the master bootstrap software or firmware? If it is software, who will develop it? How to develop it?
a. Master bootstrap program
1. A valid code stored in the main boot area
two。 It is not fixed on the hardware and is part of the operating system code.
3. The bridge to boot the operating system kernel, written by the assembler
4. The total amount of code cannot exceed 512 bytes (including 0x55aa)
From the figure, we can see the comparison between the entrance of BIOS and the entrance of Cmax Cymbal +.
Experiment-write a master bootstrap (assembly language) that can run independently on x86 hosts (without an operating system), and then print "Hello,DTOS!" on the screen.
a. Realization idea
1. Set the key register value to 0 (mov ax,0)
two。 Define the data to be printed (db "Hello,D.T.OS!")
3. Print predefined character data (int 0x10)
What you need to know here is
Mov: assignment operation, assigning the right Operand to the left Operand
Int: triggering interrupts
Hlt: stops running, CPU enters a paused state, and no action is performed
How to access addresses in assembly: segment addresses: intra-segment offset addresses
Label
b. Interrupt call VS function call
Design of experimental solution
1. Compile the assembly source code into binary machine code (nasm)
Create a virtual network disk
two。 Create a virtual disk (bximage)
Set Siz
3. Write the binary code to the start position of the virtual disk (dd)
If is input of is output bs is size continuous write without interval
4. Execute the virtual disk as a boot disk in the virtual machine (vmware)
b. The implementation process is as follows
a. Write assembly language
Org 0x7c00start: mov ax, cs// key register address is 0 mov ss, ax mov ds, ax mov es, ax mov si, msg// assignment operation assigns the first line address of msg to the si register print: mov al, [si] / / [] indicates to take the data add si, the address value saved by 1//si + 1 cmp al, and the end position je last// of 0x00// to compare and jump mov ah, 0x0e mov bx 0x0f int 0x10// triggers interrupt Print character jmp print// is equivalent to while loop last: hlt jmp last// unconditional jump msg: db 0x0a, 0x0a// defines two consecutive data 0x0a newline db "Hello, DTOS!" / / defines string data db 0x0a, 0x0a// defines line feed times 510-($- $$) db 0x00// fill 0 satisfies 512 bytes db 0x55, 0xaa// occupies two bytes
b. Compile it to binary under Linux
One-two. Binary compilation through the nasm command, if nasm is not installed, install it at the prompt
3-4. Use the bximage command to set up the network disk, and if you do not install bximage, use the prompt to install.
5-8. Set the virtual network disk as a virtual network disk respectively, then set it to a standard size of 1.44 megabytes, and name it a.img.
9. Write the binary code to the start of the virtual disk through the dd command, with an uninterrupted write size of 512
The generated a.img is shown in the figure
c. Create a new operating system on the virtual machine, set it up, set the boot disk, and copy the generated a.img to the new virtual machine for setting.
d. Start the operating system after the setup is completed, and we can get the print results we need as shown in the figure.
Summary
1. The amount of code of the master bootstrapper cannot exceed 512 bytes
two。 The main bootstrapper needs to be developed in assembly language
3. Hardware functions can be used in the master bootstrapper through BIOS interrupts
4. The main bootstrapper runs in real mode (the addresses are all actual physical addresses)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.