On Thu, Mar 29, 2018 at 11:12:44AM +0800, Daniel Lu wrote:
> Hi Hesham,
>
> No, I haven't. supervisor code is Linux, I think it will setup page table.
> Linux code will setup page table very short(several instructions later)
> after go into supervisor mode, I do see some code like(setup_vm to do it).
> If I setup page table, it would only serve the several instructions? My
> real question here is:
> 1. Do I have to setup page table to translate the physical address to
> virtual address, even if I don't need it while I'm using mret to enter
> supervisor?
> 2. I know linux va start address is 0xfffff..f80000000, aka. page
> offset. but vmlinux image(binary format) is relative to 0 offset, all linux
> internal address should be relative address. so, do I have to setup page
> table in order to translate my vmlinux load PA to this VA? or I could just
> setup a page table hierarchy to do a pa==va fake mapping, and let linux to
> do the job for setup up a real page table?
>
> sorry for these linux related question, I'm not very familiar with linux
> startup code, these questions do looks like linux related but they also
> tight connect to RISC-V supervisor mode.
Did you look into how riscv-pk does it? This is the code that enters
the kernel, where fn is the kernel entry point, arg0 is the hart
number, arg1 is the address of the DTB located on the next page
boundary after the kernel:
https://github.com/riscv/riscv-pk/blob/dcd6ee0893f784320db857cb66f8424a1d154d8d/machine/minit.c#L175
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top