bootloader

PC与Android分别是如何启动的?

旧巷老猫 提交于 2019-12-11 12:06:59
大佬详细讲解 个人纪录: pc: 程序与系统都是存放在硬盘中,启动时需要从硬盘读取到内存中,再加载到cpu中运行 按下开机键会先启动bios(基本输入输出系统),bios读取到硬盘中的系统,把系统加载到cpu中的开始运行系统 bios启动时会先自我检测如果有问题就会发出响声来提示(不同的错误响声次数不同和长度), 如果没问题则会按照bios中的Boot Sequence(启动顺序)来启动相应的系统(重装系统时需要设置u盘的启动顺数为第一位就是利用了这个) android: 没有bios,有的是bootloader(与bios的作用一样) ROM(只读存储器)相当于pc的硬盘。(RAM(读写存储器)) 那么 Bootloader 是如何被加载的呢?跟 PC 启动过程类似,当开机通电时首先会加载 Bootloader,Bootloader 会读取 ROM 找到操作系统并将 Linux 内核加载到 RAM 中。 Linux 内核加载的最后阶段会启动执行第一个用户空间进程 init 进程 来源: CSDN 作者: 小矮子tt 链接: https://blog.csdn.net/qq_38287890/article/details/103489472

Convert hexadecimal number to hexadecimal string in assembly language (NASM) (debug)

北战南征 提交于 2019-12-11 11:53:10
问题 OK, before someone else marks this question as a duplicate. Let me make this very clear that this is more of a debugging problem than a logical problem. The logic is correct as far as I know because if I individually print the value in bx register after each operation, then I get correct output. The problem is that storing the results in bx register should make changes in the memory location it holds which is not happening. So, I was learning assembly language these days, in NASM. I am

Upload Arduino code on virtual serial port through Arduino IDE

我是研究僧i 提交于 2019-12-11 05:36:41
问题 I downloaded several software that provide virtual COM ports. These COM ports do appear in the Device Manager and can be selected for upload from the Arduino IDE, menu Tools -> Serial Port -> COM3. It starts uploading and reaches 90% and then it either times out or just does nothing. I want to upload onto the virtual COM port so I could then read the compilation output files in another program. I don't want to use my Arduino at all, and I don't want to manually get the verbose output files

What is the proper way to write a BIOS Parameter Block? (Bootloader)

江枫思渺然 提交于 2019-12-11 01:40:12
问题 After writing some basic code for a bootloader, I made an .img image to test it. On Bochs, it ran just as expected; however, when I wrote the image to a USB and tried to test it on a real device, I suddenly got a No bootable device found message. After a bit of web crawling on the internet, I found out that I may need a BIOS Parameter Block (BPB). I copied and pasted a BPB that I found, and suddenly everything worked. Here is the code, in case it is needed: bpbBytesPerSector: DW 512

Converting the cluster number stored in FAT table (of FAT12 filesystem) for reading from a floppy disk

こ雲淡風輕ζ 提交于 2019-12-11 00:30:47
问题 I'm writing a two stage bootloader for a FAT12 filesystem. The stage1 of the bootloader loads the stage2 from a floppy disk which is in FAT12 filesystem. Now I am having problem converting the cluster number (that I obtain from the FAT table) to a format containing the track, head and sector number. I was following the tutorial http://www.brokenthorn.com/Resources/OSDev6.html for making the bootloader. My confusion here is that in the tutorial the Cluster Number obtained from the FAT is

Why do the bytes “0xea 0000 ffff” in a bootloader cause the computer to reboot?

会有一股神秘感。 提交于 2019-12-10 18:21:23
问题 I was researching boot loaders and I found this interesting piece of assembly: ;Sends us to the end of the memory ;causing reboot db 0x0ea dw 0x0000 dw 0xffff By the comment I know what it does; sends the computer to the end of memory, but what I can't figure out is how those numbers reboot the computer (x86_64 processor on 16-bit mode). 回答1: Those bytes correspond to jmp word 0xffff:0000 (you can see this by assembling with NASM and then disassembling the resulting binary), which happens to

Confused with CMPSB instruction

非 Y 不嫁゛ 提交于 2019-12-10 14:20:15
问题 I have been looking at this code and I'm confused about the rep cmpsb line. .LOOP: push cx mov cx, 0x000B ; eleven character name mov si, ImageName ; image name to find push di rep cmpsb ; test for entry match pop di je LOAD_FAT pop cx add di, 0x0020 ; queue next directory entry loop .LOOP jmp FAILURE I understand that it repeats cmpsb cx times but how does this compare the two strings? Say for example was comparing "Hey\0" and "hey\0" and this loop was comparing 4 character strings. The

Why do interrupts need to be disabled before switching to protected mode from real mode?

為{幸葍}努か 提交于 2019-12-10 13:36:59
问题 I saw in many many oses (and some bootloader), they all disable interrupt ( cli ) before switch to protected mode from real mode. Why we need do that? 回答1: BIOSes use PIT interrupt (IRQ0) to track time. As soon as you enter protected mode, real mode interrupt handling is no longer valid; CPU in protected mode requires protected mode IDT (Interrupt Descriptor Table). Upon entering protected mode, IDT limit in IDTR (IDT Register) is set to 0 (any interrupt number makes CPU generate an exception

Writing a C program to call another program without using any built-in libraries

流过昼夜 提交于 2019-12-10 12:25:59
问题 I am trying to write a simple 'go-command' for boot-loader that takes me to specific address in RAM say 0x18000000 and it should execute a program that blinks led. I have two .c files say led.c and go.c in which led.c blinks two leds. But I am wondering and don't know that how can I pass a control/invoke its main() to this go.c file to go to that address and start blinking leds? But it should be done without including other header files, libraries, etc. Kindly help me!! Thanks in advance.

Loading elf-i386 from my boot loader

▼魔方 西西 提交于 2019-12-10 12:00:42
问题 I am doing operating system project, until now I have my bootloader running. I can load binary file using bios interuppt, but I am unable to load and call C function from ELF file format: Here is my C program that I want to finally execute: //build :: cc -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -c -o kmain.o kmain.c void kmain(){ int a = 5; for(;;); } Here is assembly code to call kmain() ; build :: nasm -f elf loader.asm [BITS 32] [GLOBAL start] [EXTERN kmain] section .text