Hi,
I'm working with an ARM926EJ-S-based processor that has some external RAM and an SD card. There's a file several times larger than my available RAM stored on the SD card. An existing library of code would like to be able to read the file's contents as if it were all stored in memory. Without needing to have the library rewritten, is there a way to make it appear that the file is loaded into memory without the entire file actually being loaded into memory?
An approach I was considering was to use the data abort exception: 1) Set up a page table with a virtual address to represent the file. Initialize related pages to disallow read access. 2) Program attempts to read from somewhere in the memory space for the file; data abort exception thrown. 3) Data abort exception checks to see what type of exception occurred and to what address. If in the file memory space, continue as follows. Otherwise, valid exception. 4) Exception handler loads the page, or multiple pages, of content from the SD card into an allocated space in RAM. 5) It then updates the page table accordingly (also disabling any pages that were using the allocated space previously) and flushes the TLB. 6) It goes back to the point in code that was trying to access the was-invalid-but-is-now-valid memory (at R14_abt-8) and continues operation.
Is this feasible? I understand the performance hit of having to load content from the SD card as needed, but it saves having to get the library rewritten.
Is there a different approach?
Thanks,
Ken