karana
asked on
/proc/iomem
cat /proc/iomem
00000000-0009fbff : System RAM
0009fc00-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000c7fff : Video ROM
000f0000-000fffff : System ROM
00100000-07eeffff : System RAM
00100000-0022614c : Kernel code
0022614d-0029547f : Kernel data
07ef0000-07ef7fff : ACPI Tables
07ef8000-07efffff : ACPI Non-volatile Storage
07f00000-07ffffff : reserved
e7b00000-e7bfffff : PCI Bus #01
e7bfff00-e7bfffff : Analog Devices SM56 PCI modem
e8000000-ebffffff : Intel Corp. 82810E DC-133 CGC [Chipset Graphics Controller]
efd00000-efdfffff : PCI Bus #01
eff80000-efffffff : Intel Corp. 82810E DC-133 CGC [Chipset Graphics Controller]
i think addresses in the above are virual addresses . If u want to read or write , there is no need to call
ioremap()
But when i tried to readb ,writeb() , it leads to OOPS
why ?
can we derefernce these virtuals address directly ? (eg : *ptr =0x88 )
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi,
Memory != ram
for eg, In your system,
00000000-0009fbff : System RAM (RAM)
0009fc00-0009ffff : reserved (RAM)
000a0000-000bffff : Video RAM area (VIDEO RAM; not RAM)
000c0000-000c7fff : Video ROM (ROM or EPROM; Not RAM)
000f0000-000fffff : System ROM (ROM ; Not RAM)
00100000-07eeffff : System RAM (RAM)
00100000-0022614c : Kernel code (RAM)
0022614d-0029547f : Kernel data (RAM)
...
e7b00000-e7bfffff : PCI Bus #01 (Memory mapped I/O; not RAM).
e7bfff00-e7bfffff : Analog Devices SM56 PCI modem (Memory mapped I/O; not RAM).
PS: You might have studied address decoding in computer architecture class.
>> if i/o is memory mapped .
>> consider this address
>> 0xeff80000
>> it is actually comes after 3gb . I have only 128 mb ram .
If you had RAM at that place, that device would have been mapped to some other(higher) place (AFAIK by BIOS).
regards
Manish Regmi
Memory != ram
for eg, In your system,
00000000-0009fbff : System RAM (RAM)
0009fc00-0009ffff : reserved (RAM)
000a0000-000bffff : Video RAM area (VIDEO RAM; not RAM)
000c0000-000c7fff : Video ROM (ROM or EPROM; Not RAM)
000f0000-000fffff : System ROM (ROM ; Not RAM)
00100000-07eeffff : System RAM (RAM)
00100000-0022614c : Kernel code (RAM)
0022614d-0029547f : Kernel data (RAM)
...
e7b00000-e7bfffff : PCI Bus #01 (Memory mapped I/O; not RAM).
e7bfff00-e7bfffff : Analog Devices SM56 PCI modem (Memory mapped I/O; not RAM).
PS: You might have studied address decoding in computer architecture class.
>> if i/o is memory mapped .
>> consider this address
>> 0xeff80000
>> it is actually comes after 3gb . I have only 128 mb ram .
If you had RAM at that place, that device would have been mapped to some other(higher) place (AFAIK by BIOS).
regards
Manish Regmi
ASKER
hi manish ,
int no1;
init_module() {
printk("<1> %x \n" ,&no1);
}
i get the answer as 0xc8891150
int no2;
int main()
{
printf("%x \n" ,&no2);
}
i get the answer as 0x80494e0
int init_module()
{
printk("<1> %x \n" ,__pa(0xc8891150));
printk("<1> %x \n" ,__ pa(0x80494e0));
}
i get the output as
0x8891150
0x480494e0
but from
(00100000-07eeffff : System RAM )
the physical address from __pa() should be between 0x100000 and 0x07eeffff . why we get 0x8891150 and 0x480494e0
int no1;
init_module() {
printk("<1> %x \n" ,&no1);
}
i get the answer as 0xc8891150
int no2;
int main()
{
printf("%x \n" ,&no2);
}
i get the answer as 0x80494e0
int init_module()
{
printk("<1> %x \n" ,__pa(0xc8891150));
printk("<1> %x \n" ,__ pa(0x80494e0));
}
i get the output as
0x8891150
0x480494e0
but from
(00100000-07eeffff : System RAM )
the physical address from __pa() should be between 0x100000 and 0x07eeffff . why we get 0x8891150 and 0x480494e0
>> int no1;
>> ...
>> i get the answer as 0xc8891150
Because the kernel virtual address is beyond 3G.
>> int no2;
>> ...
>> i get the answer as 0x80494e0
User apps Virtual address is around that address.
USER:- 0-3G
KERNEL:- 3G-4G
>> printk("<1> %x \n" ,__pa(0xc8891150));
>> printk("<1> %x \n" ,__ pa(0x80494e0));
>> i get the output as
>> 0x8891150
>> 0x480494e0
As intended, because __pa converts kernel virtual ro physical. Actually it substracts 3 G(0xc0000000) from the address.
regards
Manish Regmi
>> ...
>> i get the answer as 0xc8891150
Because the kernel virtual address is beyond 3G.
>> int no2;
>> ...
>> i get the answer as 0x80494e0
User apps Virtual address is around that address.
USER:- 0-3G
KERNEL:- 3G-4G
>> printk("<1> %x \n" ,__pa(0xc8891150));
>> printk("<1> %x \n" ,__ pa(0x80494e0));
>> i get the output as
>> 0x8891150
>> 0x480494e0
As intended, because __pa converts kernel virtual ro physical. Actually it substracts 3 G(0xc0000000) from the address.
regards
Manish Regmi
ASKER
if i/o is memory mapped .
consider this address
0xeff80000
it is actually comes after 3gb . I have only 128 mb ram .
if i/o is i/o mapped , it wont come under
cat /proc/iomem .