Linux Kernel series-6. Memory paging mechanism for operating system development, linux Paging
A. Overview
The page size is 4 kb, and each table item occupies 4 bytes. The Register provides the physical base address of the page Directory. The page Directory provides the physical address of all the page tables, each page table provides the physical address of the page it contains.
The page components of the p
Linux Interim Summary
The first week of the Linux curriculum Experiment and Summary: [http://www.cnblogs.com/20135302wei/p/5218607.html]
The core idea of the von Neumann architecture is to store program computers. There are two kinds of instructions in the computer, one is the user instruction, the other is the system call.
When the user uses the computer, the computer according t
Linux Kernel series-embedded compilation of asm _ volatile __and asm _ volatile _ in C Language _
In Embedded Assembly, the C language expression can be specified as the operand of the assembly instruction, and you do not have to worry about how to read the value of the C language expression into which register, and how to write the calculation result back to the C variable, you only need to tell the program the ing between the C language expression a
Author: Sandy Original works reproduced please indicate the source"Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000 "Experimental environment: C+linux64 bit (32-bit system may result in different)In accordance with the academic integrity of the terms, I guarantee that the answer for my original, all the references to the external materials have been marked by provenance.
Source code and operating environment to build
the stack.Call puts; call"Puts" routine (libc ?)Add esp, byte 4; clean the stack?Ret; Exit.
Msg:Db "Hello World! ", 0
Compile:Nasm-f elfHello. asmGcc-o hello. o
Note: This program is actually called. The Linux system's puts function is the same as calling the C language function under DOS. Use extern to declare puts as an external function, press the parameter (msg address) into the stack, and the call function outputs the result.
Let's look at a pro
first, System call
The operating system provides a series of system call functions to service the application. For more information on system calls, see the For the x86 operating system, the interrupt command "int 0x80" is used to make the systems call, before system calls, the system call number needs to be put into the%EAX registers, the system parameters are put into registers%ebx,%ECX,%edx and%esi and%edi in turn.
Take the write system call as an
The shellcode on linux is slightly different from the shellcode on windows. The shellcode on linux is called by the system to execute the desired function. View the system call number cat/usr/src/linux-2.6.38.8/arch/x86/include/asm/unistd_32.h basically small kernel version changes will not change the system call number, so you can be assured to use
#define __NR_
1. The Code in the underlying Linux kernel is mostly completed in assembly language. assembly code exists in two forms. One is a pure assembly code file suffixed with. S. Of course, the precompilation option is also added to such assembly code, rather than just assembly. The other is to embed the assembly language in the C language. Although there are no provisions on Assembly fragments in ansi c language standards, in fact, all the actually used C
position respectively.
Register addressing with% ID does not "deal" with memory
Direct addressing immediate number addressing
MOVL $0x123,%eax--%eax=0x123
MOVL 0x123,%eax--Immediate number is a hexadecimal value that begins with $. Directly accesses the data in the specified memory address (0x123) and assigns it to%eax
Variable address addressingmovl 4(%ebx),%edx//edx =
execution are as follows:$ as-o hello.o hello.s$ ld-o Hello hello.o $./hello Hello world!$system calls under Linux are implemented by means of interrupts (int 0x80). When the int 0X80 instruction is executed, the system call number is stored in the register eax, and the parameters passed to the system call must be placed in the Register Ebx,ecx,edx,esi,edi in order, and when the system call is complete, th
is "system space" for mapping (0xc000 0000-0xffff FFFF) 1G bytes of virtual address. It can be seen that the second part of the page directory of each process in the Linux system is the same, so from a process point of view, each process has 4G bytes of virtual space, the lower 3G bytes are its own user space, the highest 1G bytes are the system space shared with all processes and the kernel.(4) Now suppose we have the following scenario:In process A
Final Summary of Linux kernel analysisNote: Xuan Wenjun, original works reproduced please indicate the source, "Linux kernel analysis"MOOC course http://mooc.study.163.com/course/ USTC-1000029000First, how the computer works1. Reference link:http://www.cnblogs.com/CatherineZang/p/5218570.html2. Compile statement: gcc-s-o main.s main.c-m323, "three Magic Weapon"(1) Storage program computer working model, the
1. What is system callIn the Linux World, we often encounter the term system call. The so-called system call is a series of functions provided by the kernel with very powerful functions. These system calls are implemented in the kernel, and then the system is called to the user in a certain way. Generally, they are implemented through gate traps. System calling is an interface for user programs to interact with the kernel.Ii. Functions of system calls
service and call the program to respond and handle interrupts.
Linux is a portable operating system. That is, most C code is architecture-independent and can be compiled and executed on many computers of different architectures.
Blog directory:
Linux kernel analysis 1
von Neumann the core idea of the architecture is to store the program computer. There are two kinds
This series of articles summarizes Linux network stacks, including:(1) Linux Network protocol Stack Summary(2) Network multipart offload technology Gso/tso/ufo/lro/gro in non-virtualized Linux environment(3) QEMU/KVM Network multipart offload technology in virtualized Linux environment Gso/tso/ufo/lro/gro1.
the address of the string.
That
beginning_of_shellcode:jmp subroutine_call subroutine:popl%esi ... (Shellcode itself) ... subroutine_call:call subroutine/bin/sh
Below, we construct shellcode in the form of assembler in C language.
root@linux:~/pentest# Cat shellcode_asm.c #include intMainintargcCharNBSP;**ARGV) { __asm__ ("\ jmpsubroutine_call; \ subroutine: \ popl%esi; \ movl% esi,0x8 (%esi);\ movl{ 1}X0,0XC (%es
1, what is Linux?
To be exact, the Linux kernel (the core program of the system), whose kernel copyright belongs to Linus Torvalds, is issued under the GPL (GNU general public License) Copyright Agreement, and anyone can copy (copy) and modify ( Change), package distribution (distribute), sales, but can not add any restrictions at the time of distribution, and all the original code must be public, so anyone
Week 8 process switching and general execution of the system "20135239 original please specify the source" Linux kernel Analysis "MOOC course http://mooc.study.163.com/course/USTC-1000029000" one, Timing analysis of process scheduling and process scheduling
The principle of operating system describes a large number of process scheduling algorithms, these algorithms from the perspective of implementation is only to choose a new process from the run
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.