From: Michael Brown Date: Sun, 21 Feb 2016 11:13:04 +0000 (+0000) Subject: [librm] Mark virt_offset, text16, data16, rm_cs, and rm_ds as constant X-Git-Tag: v1.20.1~577 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6ebafe1bba5fa841c71a03f1a264e6a17ed8584;p=thirdparty%2Fipxe.git [librm] Mark virt_offset, text16, data16, rm_cs, and rm_ds as constant 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 --- diff --git a/src/arch/x86/include/librm.h b/src/arch/x86/include/librm.h index bc925a2db..efc8b114a 100644 --- a/src/arch/x86/include/librm.h +++ b/src/arch/x86/include/librm.h @@ -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 );