1) FS-baremetal: You could run your binary in FS mode instead of SE mode. You would have to compile the C program with the baremetal toolchain. At compile/link time, you would create a section/segment starting at 0x10000000. At reset, the FS Arm MMU is switched off (SCTLR.M bit == 0) so every cpu access would be physical.
You might try the configs/example/arm/baremetal.py, and pass the elf binary via the --kernel option. The platform should automatically detect the entry point and set the Arm reset address to point to it. 2) SE-mmap: If you don't want to go baremetal (FS) or you can't, a solution would consist on using mmap with "/dev/mem" file descriptor in your C program to generate the mapping at runtime. By being in SE mode, this would require an extra work to emulate /dev/mem. 3) FS-Non-baremetal: You can mix the first two options: run in a NON-baremetal FS environment, which means compiling with aarch64-gnu-linux toolchain, boot linux in FS mode and run your C program (with mmap) from userspace. 4) SE-hack: The most horrible solution (it's a hack) would be to patch translateSe (in src/arch/arm/tlb.cc) to avoid translating addresses coming from your desired range. I advise against this. Regards Giacomo Giacomo ________________________________ From: gem5-users <[email protected]> on behalf of Giacomo Travaglini <[email protected]> Sent: 27 December 2019 11:24 To: [email protected] <[email protected]> Subject: Re: [gem5-users] how to disable MMU or directly access physical address ? Apologies, I missed the last bit when you specify you want to access DRAM (DDR3_1600_8x8). ________________________________ From: Giacomo Travaglini <[email protected]> Sent: 27 December 2019 11:16 To: [email protected] <[email protected]> Subject: Re: how to disable MMU or directly access physical address ? There are several ways to address this. Can I ask you what are you trying to access first? Normal memory or device memory? Giacomo ________________________________ From: gem5-users <[email protected]> on behalf of 朱海周 <[email protected]> Sent: 25 December 2019 06:45 To: [email protected] <[email protected]> Subject: [gem5-users] how to disable MMU or directly access physical address ? [EXTERNAL EMAIL] Hi all, I am new to the gem5, and ran "./build/ARM/gem5.opt ./config/learning_gem5/part1/simple.py -c ./tests/test-progs/hello/bin/linux/hello" successfully. But when I changed hello.c to the following, and I got an error as "panic: Page table fault when accessing virtual address 0x10000000". #include <stdio.h> #define ADDR *(volatile unsigned int *) (0x10000000) int main() { ADDR = 0x12345678; int read_data; read_data = ADDR; printf("Hello world!\n"); } My real need was to access DDR3_1600_8x8()'s address region directly as physical address. Could you please teach me how to disable MMU or how to directly access physical address in hello.c? BRs Haizhou _______________________________________________ gem5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
_______________________________________________ gem5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
