Skip to content

Commit

Permalink
vm_arm: make entry offset calculation more generic
Browse files Browse the repository at this point in the history
Also avoid having conditional code in the files that are generated for
a very specific target anyway.

Signed-off-by: Axel Heider <[email protected]>
  • Loading branch information
Axel Heider authored and kent-mcleod committed Mar 20, 2023
1 parent 4dcfd51 commit ce598e4
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions templates/seL4VMParameters.template.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
/*- set linux_address_config = configuration[me.name].get('linux_address_config') -*/
/*- set linux_image_config = configuration[me.name].get('linux_image_config') -*/

/*# For legacy compatibility, a fall back to the standard Linux entry exists. #*/
/*- set is_64_bit = (8 == macros.get_word_size(options.architecture)) -*/
/*- set entry_offset = 0x80000 if is_64_bit else 0x8000 -*/

/*- if vm_address_config -*/

const unsigned long ram_base = /*? vm_address_config.get('ram_base') ?*/;
Expand All @@ -23,15 +27,8 @@ const unsigned long initrd_addr = /*? vm_address_config.get('initrd_addr') ?*/;
/*- if vm_address_config.get('kernel_entry_addr') != '-1' -*/
const unsigned long entry_addr = /*? vm_address_config.get('kernel_entry_addr') ?*/;
/*- else -*/

#warning Entry address has been calculated. Please use vm_address_config.kernel_entry_addr

#ifdef CONFIG_ARCH_AARCH64
const unsigned long entry_addr = /*? vm_address_config.get('ram_base') ?*/ + 0x80000;
#else
const unsigned long entry_addr = /*? vm_address_config.get('ram_base') ?*/ + 0x8000;
#endif

#warning Using standard Linux entry point, please consider setting kernel_entry_addr explicitly.
const unsigned long entry_addr = ram_base + /*? '0x%x'%entry_offset ?*/;
/*- endif -*/

/*- else -*/
Expand All @@ -43,12 +40,8 @@ const unsigned long ram_paddr_base = /*? linux_address_config.get('linux_ram_pad
const unsigned long ram_size = /*? linux_address_config.get('linux_ram_size') ?*/;
const unsigned long dtb_addr = /*? linux_address_config.get('dtb_addr') ?*/;
const unsigned long initrd_addr = /*? linux_address_config.get('initrd_addr') ?*/;

#ifdef CONFIG_ARCH_AARCH64
const unsigned long entry_addr = /*? linux_address_config.get('linux_ram_base') ?*/ + 0x80000;
#else
const unsigned long entry_addr = /*? linux_address_config.get('linux_ram_base') ?*/ + 0x8000;
#endif
/* Use standard Linux entry point. */
const unsigned long entry_addr = ram_base + /*? '0x%x'%entry_offset ?*/;

/*- endif -*/

Expand Down

0 comments on commit ce598e4

Please sign in to comment.