Skip to content

Commit

Permalink
riscv: make address calculation more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
axel-h committed Jul 12, 2024
1 parent 703c08a commit f26e82c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions include/arch/riscv/arch/32/mode/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@
* This represents the physical address that the kernel image will be linked to. This needs to
* be on a 1gb boundary as we currently require being able to creating a mapping to this address
* as the largest frame size */
#define KERNEL_ELF_PADDR_BASE UL_CONST(0x84000000)
#define KERNEL_ELF_PADDR_OFFSET UL_CONST(0x4000000)
#define KERNEL_ELF_PADDR_BASE (physBase() + KERNEL_ELF_PADDR_OFFSET)
/* For use by the linker (only integer constants allowed) */
#define KERNEL_ELF_PADDR_BASE_RAW KERNEL_ELF_PADDR_BASE
#define KERNEL_ELF_PADDR_BASE_RAW (PHYS_BASE_RAW + KERNEL_ELF_PADDR_OFFSET)

/* The base address in virtual memory to use for the kernel ELF mapping */
#define KERNEL_ELF_BASE UL_CONST(0xFF800000)
Expand Down
5 changes: 3 additions & 2 deletions include/arch/riscv/arch/64/mode/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@
/* This represents the physical address that the kernel image will be linked to. This needs to
* be on a 1gb boundary as we currently require being able to creating a mapping to this address
* as the largest frame size */
#define KERNEL_ELF_PADDR_BASE (physBase() + UL_CONST(0x4000000))
#define KERNEL_ELF_PADDR_OFFSET UL_CONST(0x4000000)
#define KERNEL_ELF_PADDR_BASE (physBase() + KERNEL_ELF_PADDR_OFFSET)
/* For use by the linker (only integer constants allowed) */
#define KERNEL_ELF_PADDR_BASE_RAW (PHYS_BASE_RAW + UL_CONST(0x4000000))
#define KERNEL_ELF_PADDR_BASE_RAW (PHYS_BASE_RAW + KERNEL_ELF_PADDR_OFFSET)

/* The base address in virtual memory to use for the kernel ELF mapping */
#define KERNEL_ELF_BASE (PPTR_TOP + (KERNEL_ELF_PADDR_BASE & MASK(30)))
Expand Down

0 comments on commit f26e82c

Please sign in to comment.