Searched on the Internet for a long time, only slowly understand the method of retaining memory at boot, now summarize the learning process at this stage! (I am experimenting on the arm board, the kernel version is 2.6.38)
There are three ways to reserve memory at boot:
1. reserve_bootmem(addr,size, Flag)
This method, I have not succeeded in doing experiments …
If there is success, I hope the message of God, ask for guidance!
2. alloc_bootmem(size)
In fact, it is relatively simple, in int/main.c:
//Set global variable
char * reserve_memory;
EXPORT_SYMBOL_GPL(reserve_memory);
void __init start_kernel()
{
…
trap_init();
//Add code here, keep 40M of memory in the zone
reserve_memory=alloc_bootmem(0x2800000);
mem_init();
…
}
But after getting reserve_memory in the kernel, how to map to kernel space, there is no clue and …
Someone said on the Internet,
With the address returned by allco_bootmem,
In the kernel mode, find the task_struct to use this memory;
and then force the page table to be created;
If there is a god Understand this sentence, or better mapping method, please leave a message, thank you!
3. Set Linux kernel parameters at boot time
mem=180M /* Only 180M memory space is given to the system when booting, and the rest are reserved*/
Simple, but when set up and used, it needs to be compatible with the physical size of the hardware memory.
In the kernel driver, you can map to kernel space in the form of ioremap(), or mmap() to read and write in user space.
Ubuntu is a good Linux operating system, but for newcomers who just installed it, how to connect to
One User Profile 1 User Information File /etc/passwd Lets open this file to see There
This article address: http://www.cnblogs.com/archimedes/p/bash-shell1.html, please indicate the sour
Computer technology: 10 ways to generate random passwords using Linux system
Vi editor paste copy cut function under Linux
Log Management in Linux System
Linux solves file deletion but disk availability has not changed
Real-time automatic backup of switch configuration files every day with Linux server
Linux interrupt processing flow
Win7 combat: using the built-in PSR to record desktop operations
Solve the problem that D, E, F disk can not be found after installing Windows7
Microsoft partners confirm that Windows XP SP3 has been delivered to production
Win7 system IE browser prompt has been completed but there is an error on the page?
Analyze why the U disk can not be uninstalled under XP system
Tools commonly used in Windows 8 system advanced system settings
Solve the problem that Windows 7 system audio service can't run
How to improve the startup speed of Windows7 under dual-core CPU