Browse Source

[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 <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
b6ebafe1bb
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      src/arch/x86/include/librm.h

+ 5
- 5
src/arch/x86/include/librm.h View File

79
 	"call prot_call\n\t"
79
 	"call prot_call\n\t"
80
 
80
 
81
 /* Variables in librm.S */
81
 /* Variables in librm.S */
82
-extern unsigned long virt_offset;
82
+extern const unsigned long virt_offset;
83
 
83
 
84
 /**
84
 /**
85
  * Convert physical address to user pointer
85
  * Convert physical address to user pointer
170
  *
170
  *
171
  */
171
  */
172
 
172
 
173
-extern char *data16;
174
-extern char *text16;
173
+extern char * const data16;
174
+extern char * const text16;
175
 
175
 
176
 #define __data16( variable )						\
176
 #define __data16( variable )						\
177
 	__attribute__ (( section ( ".data16" ) ))			\
177
 	__attribute__ (( section ( ".data16" ) ))			\
216
 /* Variables in librm.S, present in the normal data segment */
216
 /* Variables in librm.S, present in the normal data segment */
217
 extern uint16_t rm_sp;
217
 extern uint16_t rm_sp;
218
 extern uint16_t rm_ss;
218
 extern uint16_t rm_ss;
219
-extern uint16_t __text16 ( rm_cs );
219
+extern const uint16_t __text16 ( rm_cs );
220
 #define rm_cs __use_text16 ( rm_cs )
220
 #define rm_cs __use_text16 ( rm_cs )
221
-extern uint16_t __text16 ( rm_ds );
221
+extern const uint16_t __text16 ( rm_ds );
222
 #define rm_ds __use_text16 ( rm_ds )
222
 #define rm_ds __use_text16 ( rm_ds )
223
 
223
 
224
 extern uint16_t copy_user_to_rm_stack ( userptr_t data, size_t size );
224
 extern uint16_t copy_user_to_rm_stack ( userptr_t data, size_t size );

Loading…
Cancel
Save