]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[librm] Mark virt_offset, text16, data16, rm_cs, and rm_ds as constant
authorMichael Brown <mcb30@ipxe.org>
Sun, 21 Feb 2016 11:13:04 +0000 (11:13 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sun, 21 Feb 2016 11:13:04 +0000 (11:13 +0000)
The physical locations of .textdata, .text16 and .data16 are constant
from the point of view of C code.  Mark the relevant variables as
constant to allow gcc to optimise out redundant reads.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/include/librm.h

index bc925a2db5f540c444050fa7d49448ce53508122..efc8b114af5b7eaa22d28e053b69fbfa2898547d 100644 (file)
@@ -79,7 +79,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
        "call prot_call\n\t"
 
 /* Variables in librm.S */
-extern unsigned long virt_offset;
+extern const unsigned long virt_offset;
 
 /**
  * Convert physical address to user pointer
@@ -170,8 +170,8 @@ UACCESS_INLINE ( librm, memchr_user ) ( userptr_t buffer, off_t offset,
  *
  */
 
-extern char *data16;
-extern char *text16;
+extern char * const data16;
+extern char * const text16;
 
 #define __data16( variable )                                           \
        __attribute__ (( section ( ".data16" ) ))                       \
@@ -216,9 +216,9 @@ extern char *text16;
 /* Variables in librm.S, present in the normal data segment */
 extern uint16_t rm_sp;
 extern uint16_t rm_ss;
-extern uint16_t __text16 ( rm_cs );
+extern const uint16_t __text16 ( rm_cs );
 #define rm_cs __use_text16 ( rm_cs )
-extern uint16_t __text16 ( rm_ds );
+extern const uint16_t __text16 ( rm_ds );
 #define rm_ds __use_text16 ( rm_ds )
 
 extern uint16_t copy_user_to_rm_stack ( userptr_t data, size_t size );