I had an interesting chat with my friend qunying about how to caculate the hex presentation of address to a size:
(14:29:56) vincentinsz: on x86 32bit the kernel image located at physical address 1MiB, which translate to 0x00100000, but how 0x00100000 equals 1M, how to caculate it?
(14:32:00) qunying: 1024*1024 = 0x100000
(14:32:11) qunying: that is 1MiB
(14:33:56) vincentinsz: is there easy way to see 0x100000 as 1024 * 1024?
(14:34:18) qunying: just count the zeros
(14:34:36) qunying: one 0 in hex is 2^^2
(14:34:49) qunying: there is 5 zero, that is 2^^10
(14:35:00) qunying: that is 1M
(14:35:54) qunying: one 0 is 2^^4
(14:35:58) qunying: not 2,
(14:36:09) qunying: 5 zero is 2^^20
(14:37:59) vincentinsz: how do you get one 0 is 2^^4?
(14:38:27) qunying: for one number in hex represents 4 bits in binary
(14:38:55) qunying: 0x10 = 2^4, 0x100 = 2^8, etc
(14:40:01) vincentinsz: 0x10 = 1000 0000
(14:40:13) qunying: ya
(14:40:23) qunying: no
(14:40:29) qunying: 001 000
(14:40:34) qunying: 0001 0000
(14:40:47) vincentinsz: i see
(14:42:20) vincentinsz: what about some other hex address like 0xC0000000 which is about 3G, How to caculate
(14:45:10) vincentinsz: so there is 7 0s which is 2^^28?
(14:45:24) qunying: ya
(14:45:35) qunying: C is 1100
(14:46:00) qunying: so times 2^12
(14:46:35) vincentinsz: ah, so 2^^30 * 3?
(14:48:33) qunying: ya
---
Thursday, July 2, 2009
kernel virtual address caculation
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2009
(16)
-
▼
July
(11)
- gfp_zone analysis
- Chat about git on how to apply local custom patch ...
- include/linux/gfp.h
- The heart of zoned buddy allocator
- Analysis of shrink_slab function in mm/vmscan.c
- A sample git work flow to send/receive patch by email
- Direct Page reclaim and Background Page reclaim ca...
- VM_BUG_ON(PageLRU(page) and VM_BUG_ON(!PageLRU(pag...
- kernel virtual address caculation
- Return page_count(page) - !!page_has_private(page)...
- I had a chat on #mm channel with hnaz about task_s...
-
▼
July
(11)
No comments:
Post a Comment