diff options
author | Jiaxun Yang <jiaxun.yang@flygoat.com> | 2020-12-15 14:45:06 +0800 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2021-01-14 17:13:53 +0100 |
commit | 07ae8ccd0fc4ab5a9766ebc1486ed81a1b4c5f41 (patch) | |
tree | 59aabae6139d8e0ff496105363f18c14d1740d78 /target | |
parent | b4cbbb47b0143bcf4e07a6bda5bb98b3f69c6c24 (diff) | |
download | qemu-07ae8ccd0fc4ab5a9766ebc1486ed81a1b4c5f41.zip |
target/mips/addr: Add translation helpers for KSEG1
It's useful for bootloader to do I/O operations.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Huacai Chen <chenhuacai@kernel.org>
Message-Id: <20201215064507.30148-3-jiaxun.yang@flygoat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'target')
-rw-r--r-- | target/mips/addr.c | 10 | ||||
-rw-r--r-- | target/mips/cpu.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/target/mips/addr.c b/target/mips/addr.c index 27a6036c45..86f1c129c9 100644 --- a/target/mips/addr.c +++ b/target/mips/addr.c @@ -40,6 +40,16 @@ uint64_t cpu_mips_kvm_um_phys_to_kseg0(void *opaque, uint64_t addr) return addr | 0x40000000ll; } +uint64_t cpu_mips_kseg1_to_phys(void *opaque, uint64_t addr) +{ + return addr & 0x1fffffffll; +} + +uint64_t cpu_mips_phys_to_kseg1(void *opaque, uint64_t addr) +{ + return (addr & 0x1fffffffll) | 0xffffffffa0000000ll; +} + bool mips_um_ksegs_enabled(void) { return mips_um_ksegs; diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 0086f95ea2..0c2d397e4a 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1312,6 +1312,8 @@ uint64_t cpu_mips_kseg0_to_phys(void *opaque, uint64_t addr); uint64_t cpu_mips_phys_to_kseg0(void *opaque, uint64_t addr); uint64_t cpu_mips_kvm_um_phys_to_kseg0(void *opaque, uint64_t addr); +uint64_t cpu_mips_kseg1_to_phys(void *opaque, uint64_t addr); +uint64_t cpu_mips_phys_to_kseg1(void *opaque, uint64_t addr); bool mips_um_ksegs_enabled(void); void mips_um_ksegs_enable(void); |