First of all the memory of the overall distribution map, not yet fully understand After LAB1, the state of the physical memory that is formed is the following After the mapping mechanism is manually turned on, the memory starting from 0xf0100000 is mapped to the location of the 0x0100000 Part1: Physical Memory Allocator The first is to write a physical memory allocator, which allocates physical memory, to track what physical memory is available in memory and which is not. The list of free phy
A brief analysis of stack switching based on Jos 80x86This problem has been plagued for a long time, found still a little careless, source-stack initialization is not how to understand.First of all, it is important to understand the mechanisms of segmentation and paging protection.Existing segments, after pagination, paging is optional, see if the Register CR0 open PE bit (page enable. It has been opened in the Boot.s of the
Jos lab1
Hey, the experiment environment is quite friendly. A lot of things are ready, and the focus is on the theoretical validation.
MIT is the best school to change and lead the world ~
At Peking University in China, the OS labs of schools such as handed-In are all directly using Jos. This evidence is still easy to find... to explain what is self-evident...
Certificate ---------------------------------
MIT Jos lab2
You can see this code in/Kern/kdebug. C. Follow the section _ stab_begin _ below.
_ Stab_begin _ stab_end _ is defined in/Kern/kernel. lD.
The main contents of kernel. LD are as follows:
ENTRY(_start)SECTIONS{/* Link the kernel at this address: "." means the current address */. = 0xF0100000;/* AT(...) gives the load address of this section, which tells the boot loader where to load the kernel in physical memory */.text : AT
This section is for preemptive scheduling and interprocess communication The preceding schedule is that the process resource discards the CPU, but in practice no process will do so, and in order to not let a process run out of CPU resources, preemptive scheduling is required, and hardware timing is required. But the external hardware timing was closed during the bootloader, so far it has not been opened The Jos strategy is that when the kernel is in t
I have recently started to work on MIT's Jos. After some time, I plan to summarize it. As the basis of several subsequent experiments, there may be many errors. Please give me more advice.
1. Lab1-Booting a PC
Lab1 is about the PC startup process. PC boot follows BIOS loading (real mode)-> BIOS jump to boot loader (the address in Jos is 0x7c00)-> Boot Loader imports OS kernel. In the first step, you can
Analysis of segment descriptor
In/Kern/env. C, you can see the definition of gdt (Global Descriptor Table), which separates the data segment and code segment of the user space from the code segment of the kernel data segment.
Gd _ ** is defined in/INC/memlayout. h.
We will find that gd_kt gd_kd here... their low 3bits are all 0. Why? The definition of segment descriptor
CPL: current privilege level current privileged level
So... privileged?
OK. Here, the Gobal
Lab 1 Part 2 The Boot loaderloading the KernelWe can now take a closer look at the C-language part of boot loader, the BOOT/MAIN.C. But before we analyze it, we should review some basic knowledge of C language.
Exercise 4:Read the knowledge of the pointers section of the C language. The best reference book is Naturally "the C programming Language".Read Sections 5.1 to 5.5. Then download the code for POINTERS.C and run it, making sure you understand how all the values printed on the screen
difficult to find ... In the Jos inside, in the lab2 inside can temporarily not pipe segment translation, can be regarded as the whole system is a paragraph, namely its section base is 0, paragraph range (limit) is 0xFFFFFFFF. The system is divided into a segment, so the system can be seen asPure page-paged form. In the paging, the conversion of the address is also relatively simple, Jos is designed to 0-2
LAB1 The main content of the experiment is familiar with the assembly, C language pointers and GDB debugging, as well as understanding the Jos start-up process and what to do, why do these processingPhysical memory allocation for a typical PCAn early 16-bit processor can address up to 1MB of memory spaceAnd the area that can actually be used as RAM is from 0 to 640KB.And from 640KB to 1MB where is reserved for special purposes, the most important is t
For Jos Loops, the key to simplifying the problem and code with recursive formulas is to find the correct recursive formula, which can be found using an example.(Poor math skills, have to make a watch to find the law)For the convenience of the remainder operation, the index number 1---n is indicated as 0--(n-1) example n=11,m=3, that is, 11 people count off, check in 3 of the people outSubscript 0 1 2 3 4 5 6 7 8 9Serial 1 2 3 4 5 6 7 8 9 10 11One, 4
Lab 1 part 3:the kernelNow we will start to discuss the Jos kernel in detail. Just like boot loader, the kernel begins with some assembly statements that set things up to ensure that the C-language program executes correctly.Using virtual memoryWhen you run boot loader, the link address (virtual address) in boot loader is the same as the load address (physical address). But when the kernel program is entered, the two addresses are no longer the same.T
Recently started to do MIT's Jos, did a period of time, intends to summarize, as a basis for a few experiments, the wrong estimate will be many, but also ask you a lot of advice.
A Lab1-booting a PC
LAB1 is about the PC boot process, the PC starts to follow the BIOS load (real mode)->bios jump to boot loader (the address in Jos is 0x7c00)->boot loader The process of importing the OS kernel. In the first st
Tags: Operating System
In Kern/pmap. C, the following code will be added. You must know that boot_alloc will only allocate linear addresses, and page_alloc will be used to build the paging between virtual pages and physical pages.
//////////////////////////////////////// //////////////////////////////// Create initial page Directory.Kern_pgdir = (pde_t *) boot_alloc (pgsize );Memset (kern_pgdir, 0, pgsize );
Here is a question: memset only accepts virtual addresses. Here, the kern_pgdir alloca
Analysis of implementation mechanism of JOS fork functionIt's a little chick freeze. It was a very confusing moment before the place. Now, the chatter about the fork.This article will focus on two implementation strategies for fork:1. Do not use the cow policy to achieve dumbfork (very violent copy)2. Fork using Cow Technology (copy-on-write, parent process, child process any process to the co-mapping of the space has changed, the copy action, changed
MIT JOS # Round-robin scheduling#The following is the implementation of the Round-robin scheduling strategy in the MIT Jos.Inside the KERN/SCHED.C.The following from The combination of code can be a very image of understanding round-robin.Every time we call Sched_yeild (), we're going to let the current process get out of the CPU.So the idle = thiscpu->cpu_env;Each time we give up the current process and then let the queue run from the "most recent" p
This section is expected to handle page faults, breakpoints, and system callsHandling System Page ErrorsAfter the page fault has occurred, enter into the system interrupt, then go through the _alltraps, into the trap, and then through the Trap_dispatch distribution, the interrupt type of T_pgflt interrupt should be processedOf course, page faults also have kernel page faults and user page errorsWorking with breakpointsIn Jos, breakpoint interrupts are
the commandMake qemu-gdb At this point, the following information is printed on the screen: 2. Let's create a new terminal, or come to the lab directory, enter the GDB command, and the screen output information: This is actually ready to start debugging!We're going to look at the bottom 5 lines here.[F000:FFF0] 0xffff0:ljmp $0xf000, $0xe05bThis instruction is the first instruction that executes the BIOS after the entire PC is booted. Exercise 2: Use GdB's ' si ' command to trace the ROM BIOS
JOS LAB3 Partial User program analysisIn Lab 4 's branch, there will be a variety of fun user programs. As follows:I think it is necessary to make a brief analysis of it one by one. Top-down understanding of the OS mechanismAnalyze the user program order arbitrarily, not according to the difficulty sortBADSEGMENT.C:The only line here is that the embedded assembly tries to assign the 0x28 number to the data segment register DSSee here Global describe t
Jos cannot solve lab2 Problems
This bird problem has been bothering me for a long time!
Lab2 requires Kern/pmap. C! But there is no
First, git checkout-B lab2 origin/lab2
(As long as you do this, you can make sure that you can adjust the file! It has been six hours since now !)
Next, git fetch
Then git merge lab1 (others and so on)
It can be seen that on July 15, October 14, the MIT only release 4 experiments were not completely r
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.