Skip to contentSkip to conversation

minios: set text and rodata read-only, free unused pages 0 and 1

PATCH New Samuel Thibault 1 participant 1 message Jan 18, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 minios: set text and rodata read-only, free unused pages 0 and 1

minios: set text and rodata read-only, free unused pages 0 and 1

extras/mini-os/Makefile +1 -1
diff -r b0e2c382ffb2 extras/mini-os/Makefile
@@ -53,7 +53,7 @@ include minios.mk
 # Define some default flags for linking.
 LDLIBS := 
 LDARCHLIB := -L$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME)
-LDFLAGS_FINAL := -N -T $(TARGET_ARCH_DIR)/minios-$(TARGET_ARCH).lds
+LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(TARGET_ARCH).lds
 
 # Prefix for global API names. All other symbols are localised before
 # linking with EXTRA_OBJS.
extras/mini-os/arch/x86/minios-x86_32.lds +2 -0
diff -r b0e2c382ffb2 extras/mini-os/arch/x86/minios-x86_32.lds
@@ -13,6 +13,8 @@ SECTIONS
   _etext = .;			/* End of text section */
 
   .rodata : { *(.rodata) *(.rodata.*) }
+  . = ALIGN(4096);
+  _erodata = .;
 
   .data : {			/* Data */
 	*(.data)
extras/mini-os/arch/x86/minios-x86_64.lds +2 -0
diff -r b0e2c382ffb2 extras/mini-os/arch/x86/minios-x86_64.lds
@@ -13,6 +13,8 @@ SECTIONS
   _etext = .;			/* End of text section */
 
   .rodata : { *(.rodata) *(.rodata.*) }
+  . = ALIGN(4096);
+  _erodata = .;
 
   .data : {			/* Data */
 	*(.data)
extras/mini-os/arch/x86/mm.c +85 -4

123 lines not on this page · raw message

extras/mini-os/include/x86/arch_mm.h +1 -1
diff -r b0e2c382ffb2 extras/mini-os/include/x86/arch_mm.h
@@ -189,7 +189,7 @@ typedef unsigned long maddr_t;
 #endif
 
 extern unsigned long *phys_to_machine_mapping;
-extern char _text, _etext, _edata, _end;
+extern char _text, _etext, _erodata, _edata, _end;
 #define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)])
 static __inline__ maddr_t phys_to_machine(paddr_t phys)
 {