瀏覽代碼

[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 年之前
父節點
當前提交
b6ebafe1bb
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5
    5
      src/arch/x86/include/librm.h

+ 5
- 5
src/arch/x86/include/librm.h 查看文件

@@ -79,7 +79,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
79 79
 	"call prot_call\n\t"
80 80
 
81 81
 /* Variables in librm.S */
82
-extern unsigned long virt_offset;
82
+extern const unsigned long virt_offset;
83 83
 
84 84
 /**
85 85
  * Convert physical address to user pointer
@@ -170,8 +170,8 @@ UACCESS_INLINE ( librm, memchr_user ) ( userptr_t buffer, off_t offset,
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 176
 #define __data16( variable )						\
177 177
 	__attribute__ (( section ( ".data16" ) ))			\
@@ -216,9 +216,9 @@ extern char *text16;
216 216
 /* Variables in librm.S, present in the normal data segment */
217 217
 extern uint16_t rm_sp;
218 218
 extern uint16_t rm_ss;
219
-extern uint16_t __text16 ( rm_cs );
219
+extern const uint16_t __text16 ( rm_cs );
220 220
 #define rm_cs __use_text16 ( rm_cs )
221
-extern uint16_t __text16 ( rm_ds );
221
+extern const uint16_t __text16 ( rm_ds );
222 222
 #define rm_ds __use_text16 ( rm_ds )
223 223
 
224 224
 extern uint16_t copy_user_to_rm_stack ( userptr_t data, size_t size );

Loading…
取消
儲存