Windows CE Virtual Memory Architecture

advertisement
Windows CE Virtual Memory Architecture
Lab 1:Exploring the Windows Virtual Memory Architecture
with Platform Builder
1.1 Objectives:
This lab will help you exploring the usage of Windows CE virtual memory by shell options
provided with Platform Builder. And you will learn how to analysis the virtual addressing space
using Windows CE Shell.
 Explore the virtual memory structure using the shell command provided by Platform Builder.
 Observe the allocating and freeing of the address space.
1.2 Prerequisite Knowledge:
Both Windows CE and Windows XP are 32-bit operating systems, and as such support a 4GB
virtual address space. But quite different from windows XP,the 4GB virtual address space When a
Windows CE-based device starts up, the operating system creates a single, 4-GB virtual address
space, which all processes share.
FFFF FFFF
E000 0000
Kernel Space
Kernel Addresses:
KPAGE, Trap
Area, Others
Unused
C400 0000
Total 4 GB
Virtual
Space
2 GB
Kernel
Space
User Space
7FFF FFFF
Slots 33-63
Object Store and
Memory-Mapped Files
Slot 97: NK.EXE
C200 0000
Unused
C000 0000
A000 0000
8000 0000
Statically Mapped
Virtual Addresses:
Un-Cached
Statically Mapped
Virtual Addresses:
Cached
4200 0000
2 GB
User
Space
Slots 2-32 - Processes
Slot 1 – XIP DLL code
Slot 0 – Current Process
0400 0000
0200 0000
0000 0000
The address space is divided into two 2 GB areas,The bottom 2 GB of the address space is
user space replicated for each running application. The top 2 GB of the address space are reserved
by the system.
Physical Memory
Virtual Memory
Kernel
Space
512 MB
512 MB
2 GB
32 MB Flash
User
32 MB Flash
Cached
64 MB RAM
Uncached
32 MB Flash
64 MB RAM
04000000
64 MB RAM
Address
Translation
User
Spac
e
n
1.3 Anticipated Time:
30~40 minutes
1.4 Detailed Steps:
1.4.1
Create and start the platform using the New Platform Wizard
1.
Launch Platform Builder
2.
Start an existed platform. You can use the New Platform Wizard within Platform Builder to
create an initial platform workspace if there is no existed platform.
1.4.2
Exploring the virtual memory structure using the shell options provided with
Platform Builder
1.
On the Target menu of Platform Builder, choose CE Target Control. Then the CE shell
console will be displayed as follow.
2.
You can get help information by input ?.
A list of commands will be displayed as
following:
Welcome to the Windows CE Shell. Type ? for help.
Windows CE>?
Enter any of the following commands at the prompt:
break : Breaks into the debugger
s <procname> : Starts new process
gi ["proc","thrd","mod","all"]* ["<pattern>"] : Get Information
proc -> Lists all processes in the system
thrd -> Lists all processes with their threads
delta -> Lists only threads that have changes in CPU times
mod -> Lists all modules loaded
all: Lists all of the above
mi ["kernel","full"] : Memory information
kernel-> Lists kernel memory detail
full -> Lists full memory maps
……
3.
You can input mi [kernel | full] to display memory information. The full parameter displays a
set of tables showing the virtual memory usage for all the processes in the system. The
following output example shows an excerpt from the results of the mi full command.
Windows CE Kernel Memory Usage Tool 0.2
Page size=4096, 4886 total pages, 4410 free pages. 4383 MinFree pages
(2060288 MaxUsed bytes)
89 pages used by kernel, 0 pages held by kernel, 476 pages consumed.
Inx Size Used
Max Extra Entries Name
0: 424 21200 22048 848 50( 52) Thrd
1: 216 10584 11232 648 49( 52) Mod
2:
48
21936
22224
288
457(463)
API/CStk/ClnEvt/StbEvt/Prxy/HData/KMod
3: 168 129696 131376 1680 772(782) Crit/Evt/Sem/Mut/ThrdDbg
4: 64 3584 3776 192 56( 59) FullRef/FSMap/ThrdTm
5: 16 13296 13488 192 831(843) MemBlock
6: 524
0 8908 8908 0( 17) Name
7: 2048 102400 102400
0 50( 50) HlprStk
Total Used = 302696 Total Extra = 12756 Waste = 364
Memory usage for Process 819b5b60: 'NK.EXE' pid 0
SECURE SECTION:
Slot base c2000000 Section ptr 819b2760
c2000000(1): -----r---------c2010000(0): ---------------S
c2020000(0): ---------------S
c2030000(0): ---------------S
c3f00000(0): ---------------c3ff0000(0): ---------------W
Page summary: code=0(0) data r/o=0 r/w=2 stack=3 reserved=315
ROM DLL CODE SECTION:
Slot base 02000000 Section ptr 83ffb000
02010000(0): 03160000(0): -CC------------03190000(0): -CCCC----------031a0000(0): -CCCCCCCCCCCCCCC
031b0000(0): CC-------------031c0000(0): -CCCCCCCCCCC---031d0000(0): -CCCCCCCCCCCCCC031f0000(0): -CCCCCCCCCCCCCCC
03200000(0): CCCCCCCCCCC----03210000(0): -CCCCCCCCCCCCCCC
03220000(0): C--------------03230000(0): -CC------------03580000(0): -CC------------03590000(0): -CCCCCCCCCCCCCCC
035a0000(0): CCCCCCCCCCCCCCCC
035b0000(0): CCCCCCCCCCCCCCCC
035c0000(0): -RRRRRRRRRRR---035d0000(0): -CCCCCCCCCCCCCCC
035e0000(0):
038d0000(0):
038e0000(0):
038f0000(0):
03900000(0):
03910000(0):
03920000(0):
03930000(0):
03940000(0):
03960000(0):
03970000(0):
03980000(0):
03990000(0):
039a0000(0):
039b0000(0):
039c0000(0):
039d0000(0):
039e0000(0):
039f0000(0):
03a00000(0):
03a10000(0):
03a20000(0):
03a40000(0):
03a50000(0):
03a60000(0):
03a70000(0):
03a80000(0):
03a90000(0):
03aa0000(0):
03ab0000(0):
03ac0000(0):
03ad0000(0):
03ae0000(0):
03af0000(0):
03b00000(0):
03b40000(0):
03b50000(0):
03b60000(0):
03b70000(0):
03b80000(0):
03b90000(0):
03ba0000(0):
03bb0000(0):
03bc0000(0):
CC-R------------CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCC---R
RRR-------------CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCC-----------CCCCCCCCCCCCC--CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCC--RR------CCCCCCCCCCCCCCC
C---------------CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCC--CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCC-R---CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCC----------CCCCCCCCC------CCC------------CC-------------CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCC------CCCCCCCCCCCCCCC
03bd0000(0):
03be0000(0):
03bf0000(0):
03c00000(0):
03c10000(0):
03c20000(0):
03c30000(0):
03c40000(0):
03c50000(0):
03c60000(0):
03c90000(0):
03ca0000(0):
03cb0000(0):
03cc0000(0):
03cd0000(0):
03ce0000(0):
03cf0000(0):
03d00000(0):
03d10000(0):
03d20000(0):
03d30000(0):
03d40000(0):
03d50000(0):
03d60000(0):
03d90000(0):
03da0000(0):
03db0000(0):
03dc0000(0):
03dd0000(0):
03de0000(0):
03e10000(0):
03e20000(0):
03e30000(0):
03e60000(0):
03e70000(0):
03e80000(0):
03e90000(0):
03ea0000(0):
03eb0000(0):
03ec0000(0):
03ed0000(0):
03ee0000(0):
03ef0000(0):
03f10000(0):
CCCCCCCCCCCCCCCC
CCCCCC----------CCCCCCCCCCCC---CCCCCCCCCCCCCCC
C---------------CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCC--------CCCC-----------CCCCCCCCCCC----CC-------------CCCCCCCCCCC----C--------------CCCCCCCCCCCCCCC
CC--------------CCCCC----------CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCR---------------c-c---c-c------cc---------------------cc-----CC-------------CCCCCCCCCCCC---CCCCCCCCCCCCCCC
CCCCCCCCC-RR----CCCCCCCCCCCCCCC
CCCCC-----------CCCC-----RRRRRR
RRRRR-----------CCCCC-R--------CCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCR---------------C--------------
03f20000(0): -CCCCCC--------03f30000(0): -CCCCCCCCCCCCCCC
03f40000(0): CCCCCC---------03f50000(0): -CC------------03f60000(0): -CCCCCCCCCCCCCCC
03f70000(0): CCCCCCCCCCCCCCCC
03f80000(0): CCCCCCCCCCCCCCCC
03f90000(0): CCCCCCCCCCCCCCCC
03fa0000(0): CCCCCCCCCCCCCCCC
03fb0000(0): CCCCCCCCCCCCCCCC
03fc0000(0): CCCCCCCCCCCCCCCC
03fd0000(0): CCCCCCCCCCCCCCCC
03fe0000(0): CCCCCCCCCCCCCC-R
03ff0000(0): RRRRRR---------Page summary: code=1311(8) data r/o=42 r/w=0 stack=0 reserved=2392
Memory usage for Process 819b5c38: 'filesys.exe' pid 1
Slot base 04000000 Section ptr 83fec000
04000000(1): -----r---------04010000(0): -CCCCCCCCCCCCCCC
04020000(0): CCCCCCCCCCCCCCCC
04030000(0): CCCCCCCCCCCCCCCC
04040000(0): CCCCCCCCCCCCCCCC
04050000(0): CCCCCCCCCCCCCCCC
04060000(0): CCCCCCCWWWWWWWWR
04070000(0): ---------------S
04080000(0): WWWWWWWWWW-----040a0000(0): --------------040b0000(0): ---------------S
05f00000(0): ---------------05fe0000(0): --W------------05ff0000(0): ---------W-----c
Page summary: code=87(1) data r/o=1 r/w=21 stack=2 reserved=336
Memory usage for Process 819b5d10: 'shell.exe' pid 2
Slot base 06000000 Section ptr 83fc5000
06000000(1): -----r---------06010000(0): -CCCCCCCCCCCCCCC
06020000(0): WWW
06030000(0): --------------SS
06040000(0): W--------------06060000(0): --------------06070000(0): WW
07f00000(0): ----------------
07ff0000(0): -------W-------c
Page summary: code=16(1) data r/o=0 r/w=8 stack=2 reserved=330
Memory usage for Process 819b5de8: 'device.exe' pid 3
Slot base 08000000 Section ptr 83fca000
08000000(1): -----r---------08010000(0): -CCCCCCCCCCCc
08020000(0): ------------S--S
08030000(0): WWWWWWWWWWWWWWWW
08040000(0): WWWWWWWWWWWWWWWW
08050000(0): WWWWWW--------08060000(0): ---------------S
08070000(0): ---------------S
08080000(0): ---------------S
08090000(0): ---------------S
080a0000(0): --------------SS
080b0000(0): ------------SS-S
080c0000(0): PP
080d0000(0): ---------------S
080e0000(0): ---------------S
080f0000(0): PPP
08100000(0): ---------------S
08110000(0): ---------------S
08120000(0): ---------------S
08130000(0): -------------SSS
08140000(0): ---------------S
08150000(1): WW
08160000(1): WWWWWWWWWWWWWWWW
08170000(1): WWWWWWWWWW
08180000(1): W
08190000(1): W
081a0000(1): WW
081b0000(0): ---------------S
081c0000(0): ---------------S
081d0000(0): -------------SSS
081e0000(0): -------------SSS
081f0000(0): ---------------S
08200000(0): ---------------S
08210000(0): ---------------S
08220000(0): WWWWWWWWWWWWWWWW
08230000(0): WWWWWWWWWWWWWWWW
08240000(0): --------------08250000(0): ---------------S
08260000(0): --------------SS
08270000(0): W--------------08290000(0): --------------082a0000(0): ---------------S
082b0000(0): ---------------S
082c0000(0): ---------------S
082d0000(0): ---------------S
082f0000(0): ---------------S
09f00000(0): ---------------W
09f20000(0): ---------W-W-W-09f30000(0): ------WWWWW-W--09f70000(0): --W------------09f90000(0): --WW---W-W--W-WW
09fa0000(0): -W-WWWWWWWW----09fb0000(0): W-W-W-W-W-W-W-WW
09fc0000(0): -W-W------W-W-W09fd0000(0): W-W-W-W-W-W-W-W09fe0000(0): W-------WWWWW-W09ff0000(0): --W--------c-W-c
Page summary: code=14(3) data r/o=0 r/w=162 stack=39 reserved=691
Memory usage for Process 819b5ec0: 'gwes.exe' pid 4
Slot base 0a000000 Section ptr 83edf000
0a000000(1): -----r---------0a010000(0): -CCCCCCCCCCCCCCC
0a020000(0): CCCCCCCCCCCCCCCC
0a030000(0): CCCCCCCCCCCCCCCC
0a040000(0): CCCCCCCCCCCCCCCC
0a050000(0): CCCCCCCCCCCCCCCC
0a060000(0): CCCCCCCCCCCCCCCC
0a070000(0): CCCCCCCCCCCCCCCC
0a080000(0): CCCCCCCCCCCCCCCC
0a090000(0): CCCCCCCCCCCCCCCC
0a0a0000(0): CCCCCCCCCCCCCCCC
0a0b0000(0): CCCCCCCCCCCCCCCC
0a0c0000(0): CCCCCCCCCCCCCCCC
0a0d0000(0): CCCCCCCCCCCCCCCC
0a0e0000(0): CCCCCCCCCCCCCCCC
0a0f0000(0): CCCCCCCCCCCCCCCC
0a100000(0): CCCCCCCCCCCCCCCC
0a110000(0): CccccccRRRRRRRR
0a120000(0): ---------------S
0a130000(0): WWWWWWWWWWWWWWWW
0a140000(0): WWWWWWWWWWWWWWWW
0a150000(0): WWWWWWWWW------
0a160000(0): ---------------S
0a170000(0): ---------------S
0a180000(0): -------------SSS
0a190000(0): ---------------S
0a1a0000(0): ---------------S
0a1b0000(0): ---------------S
0a1c0000(0): ---------------S
0a1e0000(0): ---------------S
0a1f0000(0): ---------------S
0bf00000(0): ---------------0bf20000(0): ---------------W
0bf30000(0): -WWWW----------0bfd0000(0): ------------W--0bff0000(0): ---------------c
Page summary: code=263(7) data r/o=8 r/w=48 stack=12 reserved=419
Memory usage for Process 819b5f98: 'ceemulsrv.exe' pid 5
Slot base 0c000000 Section ptr 83ee0000
0c000000(1): -----r---------0c010000(0): -CRW
0c020000(0): ---------------0c030000(0): ---------------0c040000(0): ---------------0c050000(0): ---------------0c060000(0): ---------------0c070000(0): ---------------0c080000(0): ---------------0c090000(0): ---------------0c0a0000(0): ---------------0c0b0000(0): ---------------0c0c0000(0): ---------------0c0d0000(0): ---------------0c0e0000(0): ---------------0c0f0000(0): ---------------0c100000(0): ---------------0c110000(0): -------------SSS
0c120000(0): W--------------0c140000(0): --------------0df00000(0): ---------------0dff0000(0): ---------------c
Page summary: code=2(1) data r/o=1 r/w=3 stack=3 reserved=570
Memory usage for Process 819b6070: 'explorer.exe' pid 6
Slot base 0e000000 Section ptr 83e96000
0e000000(1): -----r---------0e010000(0): -CCCCCCCCCCCCCCC
0e020000(0): CCCCCCCCCCCCCCCC
0e030000(0): CCCCCCCCCCCCCW-R
0e040000(0): RRRRRRRRRRRRRRRR
0e050000(0): RRRRRRRRRRRRRRRR
0e060000(0): R
0e070000(0): ---------------S
0e080000(0): WWWWWWWWWWWWWWWW
0e0a0000(0): --------------0e0b0000(0): ---------------S
0e0c0000(0): -------------SSS
0e0d0000(0): ---------------S
0e0e0000(0): ---------------S
0ff00000(0): ---------------0ff60000(0): --------------W0ff70000(0): W-W------------0ff80000(0): --------------WW
0ff90000(0): W-WW-----------0fff0000(0): --W------------c
Page summary: code=45(1) data r/o=34 r/w=27 stack=7 reserved=367
Mapped file section 0
Slot base 42000000 Section ptr 83fed000
42000000(0): PWWWWWWWWWWWWWWW
42010000(0): WWWWWWWWWWWWWWWW
42020000(0): WWWWWWWWWWWWWWWW
………………………………………………
43300000(0): WWWWWWWWWWWWWWWW
43310000(0): W--------------Page summary: code=0(0) data r/o=0 r/w=4880 stack=0 reserved=3311
Mapped file section 1
Slot base 44000000 Section ptr 83fdd000
44000000(0): ---------------Page summary: code=0(0) data r/o=0 r/w=0 stack=0 reserved=8192
Mapped file section 2
Slot base 46000000 Section ptr 83fcf000
46000000(0): W--------------46100000(0): RRRRRRRRRRRRRRRR
46110000(0): RRRRRRRRRRRRRRRR
46120000(0): RRRRRRRRRRRRRRRR
46130000(0): RRRRRRRRRRRRRRRR
46140000(0):
46150000(0):
46160000(0):
46170000(0):
46180000(0):
46190000(0):
461a0000(0):
46200000(0):
46300000(0):
46310000(0):
46320000(0):
RRRRRRRRRRRRRRRR
RRRRRRRRRRRRRRRR
RRRRRRRRRRRRRRRR
RRRRRRRRRRRRRRRR
RRRRRRRRRRRRRRRR
RRRRRRRRRRRRRRRR
RRRRRRRRRRR----W--------------PPPPPPPPPPPPPPPP
PPPPPPPPPPPPPPPP
PPPPPPPPPPPPPPPP
………………………………………………
466f0000(0): PPPPPPPPPPPPPPPP
46700000(0): RRRRRRRRRRRRRRRR
………………………………………………
471f0000(0): RRRRRRRRRRRRRRRR
47200000(0): RRRRR----------Page summary: code=0(0) data r/o=2768 r/w=2 stack=0 reserved=4398
Total R/W data + stack + RAM code = 5243
1.4.3
Analysis on the Virtual Memory Information
In the memory information,
“--” represents the memory space is reserved but not in use.
Which indicates that a virtual page is currently allocated but not mapped to any physical memory.
“C” represent code pages in ROM,
“S” Indicates a virtual page that holds a stack,
“W”
Indicates a virtual page that holds read-write data. “R”represent Read-only data pages in ROM.
Windows CE allocates pages along 64KB regions. Thus each line in the above graphic represent
64K。But Windows CE allocates memory at the page level; the page being the smallest unit of
memory that can be allocated or freed by the CPU. The 4 KB page size is used in x86 system. So
each character in the above graphic represents one page.
The first section of the memory information printed is about the kernel usage memory, such
as Thread, module, synchronized objects and so on. We won’t discuss them in details.
In the following section, the virtual address space of the process NK.EXE was printed out.
We can find that the address begin from 0xC200 000. Which are consistent with the graphics
about the memory model.
Then the ROM DLL information are printed。The address begin from 0x0200 0000 where is
the Slot 1。We can find that there are only two kinds of information in Slot 1,the code pages and
the read-only data pages. As we know, the code and read-only data can be shared among all
processes,thus they are allocated in Slot 1.
Then the memory usage of each process in the system are printed out. Let’s explore the
structure of the 32MB virtual memory inside the process. For example, the memory usage for
process shell.exe is listed here.
Memory usage for Process 819b5d10: 'shell.exe' pid 2
Slot base 06000000 Section ptr 83fc5000
06000000(1): -----r---------06010000(0): -CCCCCCCCCCCCCCC
06020000(0): WWW
06030000(0): --------------SS
06040000(0): W--------------06060000(0): --------------06070000(0): WW
07f00000(0): ---------------07ff0000(0): -------W-------c
Page summary: code=16(1) data r/o=0 r/w=8 stack=2 reserved=330
At first, the first line of virtual memory is useless. It is reserved for catching the null points.
Then, begin from 0x0601 0000, there are 64K code pages/
The following 64K from 0x0602 0000 are read-write data.
The stack begin from 0x0603 0000. The heap begin from 0x0602 0000. We can use
LocalAlloc to allocate the specified number of bytes from the heap.
DLLs are loaded at the top of the slot, followed by the stack, the heap, and the executable
(.exe) file. The last two line show the top address of the process and there are some read-write data
pages.
Try to analysis the memory structures and you can understand it better.
The last section printed out in the shell window represents the data shared by all the
processes. The address begin from 0x4200 000. You can find there are two mapped file sections,
one is read-only section and the other is read-write section.
Lab 2:Allocating and Freeing Virtual Memory Dynamically
1.5 Objectives:
In this lab, you will use windows CE Shell command to explore the structure of the virtual
memory. And then you can observe the allocating and freeing of the memory via a special
program.


Explore the virtual memory structure using the shell command provided by Platform Builder.
Observe the allocating and freeing of the address space.
1.6 Prerequisites

You should familiar with the Windows CE virtual memory architectur;

You should familiar with the the virtual memory application programming interface
1.7 Detailed steps
1.7.1
1.
Create and build the test program
Launch the Platform Builder. From the File menu, choose New Project or File and create the
HelloWorld application following the wizard.
2.
Add the following code in winproc function
case WM_LBUTTONDOWN:
{
static int flag = 0;
static HANDLE hMem = NULL;
static HANDLE hMem2 = NULL;
switch(flag)
{
case 0:
// Resevering Memory , 2 pages, 8K
hMem = VirtualAlloc(NULL, 1024 * 4 * 2, MEM_RESERVE,
PAGE_READWRITE);
NKDbgPrintfW(TEXT("hMem is %p. \r\n"), hMem);
flag ++;
break;
case 1:
hMem2 = VirtualAlloc(NULL, 1024 * 4, MEM_RESERVE,
PAGE_READONLY);
NKDbgPrintfW( L"hMem2 is %p. \r\n", hMem2);
flag ++;
break;
case 2:
// Commit Memory, 1K
VirtualAlloc(hMem,
1024,
MEM_COMMIT,
PAGE_READWRITE);
flag ++;
break;
case 3:
// Release Memory
VirtualFree(hMem, 1024 * 4 * 2, MEM_RELEASE);
flag = 1;
break;
default:
;
// error here
}
}
Hint:In this code the VirtualAlloc function is used twice at first to reserve virtual address space.
And then we call the VirtualAlloc function again to submit the virtual memory. So we can
observer the granularity of the address space when reserved or submitted.
3.
Use MakeImage to generate the OS Image again with the test program.
4.
run the application in the Emulator on the custom OS image
1.7.2
1.
Observe the result of the test
Start the test program,input mi full in the target control window. The information of the
memory usage are printed out as following
Memory usage for Process 819b6148: 'bb.exe' pid 7
Slot base 10000000 Section ptr 83e2f000
10000000(1): -----r---------10010000(0): -CRWR
10020000(0): --------------SS
10030000(0): W--------------10050000(0): --------------11f00000(0): ---------------11ff0000(0): ---------------c
Page summary: code=2(1) data r/o=2 r/w=3 stack=2 reserved=331
We will continue out observation based on the output.
2.
Left click your mouse in the window of the test application. Two pages of virtual memory
will be reserved. Input mi full in CE Target Control again and try to analysis the new memory
usage.
Memory usage for Process 819b6148: 'bb.exe' pid 7
Slot base 10000000 Section ptr 83e2f000
10000000(1): -----r---------10010000(0): -CRWR
10020000(0): --------------SS
10030000(0): W--------------10050000(0): --------------10060000(0): -11f00000(0): ---------------11ff0000(0): ---------------c
Page summary: code=2(1) data r/o=2 r/w=3 stack=2 reserved=333
Result in the Output window:
4294881056 PID:23e2e2ea TID:23e2ef3e 0x83e38800: hMem is 60000.
Hint:We can find that Windows CE reserved 2 pages virtual address space from 0x1006 0000.
The process is mapped to slot 0, so you can find the output in Output windows is 60000 .
3.
Left click in the window of the test program. One more page virtual address space will be
reservered. Then input mi full in CE Target Control again.
Memory usage for Process 819b6148: 'bb.exe' pid 7
Slot base 10000000 Section ptr 83e2f000
10000000(1): -----r---------10010000(0): -CRWR
10020000(0): --------------SS
10030000(0): W--------------10050000(0): --------------10060000(0): -10070000(0): -
11f00000(0): ---------------11ff0000(0): ---------------c
Page summary: code=2(1) data r/o=2 r/w=3 stack=2 reserved=334
Output:
4294939016 PID:23e2e2ea TID:23e2ef3e 0x83e38800: hMem2 is 70000.
Hint:The program reserverd one page virtual mermoy from 0x1007 0000. Compared with the
first click,the deviation is 0x70000 - 0x60000 = 0x10000 and it is 64KB space。Which proves
that Window CE allocate address in the process from bottom to the top. And windows CE
allocates pages along 64KB regions every time.
4.
Left click in the test window, 1K virtual memory will be submitted. Then we use the mi full
command again.
Memory usage for Process 819b6148: 'bb.exe' pid 7
Slot base 10000000 Section ptr 83e2f000
10000000(1): -----r---------10010000(0): -CRWR
10020000(0): --------------SS
10030000(0): W--------------10050000(0): --------------10060000(0): W10070000(0): 11f00000(0): ---------------11ff0000(0): ---------------c
Page summary: code=2(1) data r/o=2 r/w=4 stack=2 reserved=333
Hint:As shown in the above graphics,Windows CE submitted 1 Page memory,and the page was
labeled as read-write data page. Windows CE submitted 1 page 4K memory though we only
submitted 1 K memory. So you can find that the memory unit is 4KB.
Download