In our previous C code we were reading and writing to physical address directly to 0x10000000. This is because ADS project has MMU programmed in flat segments where virtual address is directly mapping to corresponding physical address. That is why we did not encounter any MMU fault.
Now we cannot do this same if we are running in Linux or Windows. OS runs in protected paging mode of MMU where each process has translation tables named as page directory and child page tables. So physical address is never mapped to virtual unless we do it explicitly. Usermode program can map unmapped physical address my /dev/mem device file. This device gives mmap() operations to map physical pages to user address space. mmap() takes physical offset , size and read/write protection flags and uses remap_pfn_range() kernel call to map pages in the page table in device driver .
Once mapping is done with mmap() this user mode program will look same as ADS project code. Only difference is interrupt from EINT3 will be suppressed/masked as prom user mode there is no way to handle it.
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average