bootloader

Far jump in gdt in bootloader

亡梦爱人 提交于 2019-12-04 10:56:36
问题 flush_gdt: lgdt [gdtr] jmp 0x08:complete_flush complete_flush: mov ax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax ret I am unable to understand what this code does . flush_gdt is a label okay , then lgdt [gdtr] loads the 48-bit pointer in gdtr register and after that from jmp 0x08:complet_flush . What does jmp instruction do ? and then why are we moving 0x10 to ax and then subsequently to other registers 回答1: x86 supports two virtual memory schemes (read about it here):

How do you jump to the bootloader (DFU mode) in software on the STM32 F072?

时光毁灭记忆、已成空白 提交于 2019-12-04 09:47:47
问题 The STM32 App Note 2606 discusses this, but there is no simple code example. 回答1: This answer has been tested on the STM32F072 Nucleo board using IAR EWARM. This answer uses the "STM32 Standard Peripheral Library" and nothing else. Note that the best/easiest way to verify you are successfully in bootloader mode (DFU mode) is to hookup a USB-2-UART converter (get one here from Sparkfun: http://sfe.io/p9873 for $15) on lines PA_9 (USART1_TX) and PA_10 (USART1_RX) (don't forget to connect ground

Develop a Bootloader In Assembly

放肆的年华 提交于 2019-12-04 09:30:21
I've already done a part of my OS in Assembly, but now I want to build a own bootloader for it too instead of using GRUB. When I was developing my test OS in Assembly I remember that I boot it like this: org 0x7c00 bits 16 ; OS Kernel Here times 510 - ($-$$) db 0 dw 0xAA55 This I've already know. Now I want to use this and execute the "real" OS that will be a *.bin file written to the 2nd sector of the floppy. Then I want to know somethings How can I do a bootloader in Assembly to execute what will be starting on the 2nd sector of the floppy? I need to add anything to the Assembly source that

Write a simple Bootloader HelloWorld - Error function print string

馋奶兔 提交于 2019-12-04 08:40:26
问题 I try to create a simple bootloader which print "hello world". I can do it when I call a function which only print "hello world", but when I call a function to print a specific string, nothing is happening. For it, I use two files. The first one is boot.ld and the second is boot.cpp (it also work in C with boot.c). Firstly, I create the floppy disk from my terminal: dd if=/dev/zero of=floppy.img bs=512 count=2880 Secondly, I compile the code (boot.cpp and boot.ld): gcc -c -g -Os -m64

Linker file unselected

試著忘記壹切 提交于 2019-12-04 06:21:25
问题 I am dealing with a problem in my application with the linker file. What's happening is in the explorer tab it seems the linker file it's not "selected" I have to refer that I also have a bootloader. I'm getting an error of "(944) data conflict at address 1FC02FF8h" and I think it's related with that. Can anyone help me on that? Many Thanks. 回答1: Right click your linker files folder and make sure that the file is not excluded in your current config. Edit: Right Click "Linker Files"-

ucore_lab1

时光毁灭记忆、已成空白 提交于 2019-12-04 04:12:01
一、实验内容 通过阅读bootmain.c,了解bootloader如何加载ELF文件。通过分析源代码和通过qemu来运行并调试bootloader&OS, bootloader如何读取硬盘扇区的? bootloader是如何加载ELF格式的OS? 二、实验相关 ELF文件格式 ELF(Executable and linking format)文件格式是Linux系统下的一种常用 目标文件(object file)格式 ,有 三种主要类型 : 用于执行的可执行文件(executable file),用于提供程序的进程映像,加载到内存执行。 这也是本实验的OS文件类型。 用于连接的可重定位文件(relocatable file),可与其它目标文件一起创建可执行文件和共享目标文件。 共享目标文件(shared object file),连接器可将它与其它可重定位文件和共享目标文件连接成其它的目标文件,动态连接器又可将它与可执行文件和其它共享目标文件结合起来创建一个进程映像。 ELF文件有 两种视图 (View), 链接视图和执行视图 ,如下图: 链接视图通过Section Header Table描述,执行视图通过Program Header Table描述。Section Header Table描述了所有Section的信息,包括所在的文件偏移和大小等;Program

操作系统实现(一):从Bootloader到ELF内核(转载)

心不动则不痛 提交于 2019-12-04 03:44:16
原文链接: http://www.cppblog.com/airtrack/archive/2014/10/30/208729.html Bootloader 我们知道计算机启动是从BIOS开始,再由BIOS决定从哪个设备启动以及启动顺序,比如先从DVD启动再从硬盘启动等。计算机启动后,BIOS根据配置找到启动设备,并读取这个设备的第0个扇区,把这个扇区的内容加载到0x7c00,之后让CPU从0x7c00开始执行,这时BIOS已经交出了计算机的控制权,由被加载的扇区程序接管计算机。 这第一个扇区的程序就叫Boot,它一般做一些准备工作,把操作系统内核加载进内存,并把控制权交给内核。由于Boot只能有一个扇区大小,即512字节,它所能做的工作很有限,因此它有可能不直接加载内核,而是加载一个叫Loader的程序,再由Loader加载内核。因为Loader不是BIOS直接加载的,所以它可以突破512字节的程序大小限制(在实模式下理论上可以达到1M)。如果Boot没有加载Loader而直接加载内核,我们可以把它叫做Bootloader。 Bootloader加载内核就要读取文件,在实模式下可以用BIOS的INT 13h中断。内核文件放在哪里,怎么查找读取,这里牵涉到文件系统,Bootloader要从硬盘(软盘)的文件系统中查找内核文件,因此Bootloader需要解析文件系统的能力

How does UEFI work?

陌路散爱 提交于 2019-12-04 02:56:20
I was studying about bootloaders when exactly came upon the term UEFI. I can understand some things about UEFI. But still, In what mode(Real,Protected,Long) does a system with UEFI start? If normal boot loaders cant work with UEFI, Then what is the alternate of boot loader while dealing with UEFI? And do I need any other programming to create one, than assembly? UEFI firmware runs in 64 bit long mode for 64 bit platforms and flat mode for 32 bit platforms; Unlike BIOS, UEFI features its own architecture, independent of the CPU, and its own device drivers. UEFI can mount partitions and read

Linux系统移植(1)

杀马特。学长 韩版系。学妹 提交于 2019-12-03 23:17:41
一、u-boot工程    1.BootLoader介绍     BootLoader是操作系统运行之前要执行的一段程序,它复制初始化硬件设备、建立内存空间映射,为操作系统的运行做好准备,是一个专门加载操作系统的程序。     对于嵌入式系统而言,没有通用的硬件平台,因此也没有通用的BootLoader,不同的平台、CPUyi架构都有不同的BootLoader,因为BootLoader不光依赖CPU的体系结构,也以来硬件平台的配置,对于不同的开发板而言,哪怕它的CPU一样,BootLoader也会有区别,因此我们为每一款开发板制作属于它的BootLoader程序。     但大部分开发板的BootLoader仍有许多共性,所以我们没有必须全部从零制作,而对一个基础的BootLoader进行 修改 ,制作出能用的BootLoader程序。    2.u-boot简介     u-boot( Universal Boot Loader )是BootLoader的一种,它遵循 GPL通用许可证 的开源项目,它的源码的目录、编译形式都和Linux的源码很相似,可以说u-boot就是仿照Linux开发的。    3.u-boot源码的获取     ① 源头的代码是u-boot官网下载的,这种源码是最干净最存粹的,一般CPU 的生产厂商会下载这种源码。     

Reading from memory in 8086 real mode while using 'ORG 0x0000'

限于喜欢 提交于 2019-12-03 20:33:27
问题 I've been messing around with x86-16 assembly and running it with VirtualBox. For some reason when I read from memory and try to print it as a character, I get completely different results from what I was expecting. However when I hard-code the character as part of the instruction, it works fine. Here's the code: ORG 0 BITS 16 push word 0xB800 ; Address of text screen video memory in real mode for colored monitors push cs pop ds ; ds = cs pop es ; es = 0xB800 jmp start ; input = di (position