Browse Source

Allow ourselves to be freed by basemem.c without being damaged.

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
1f6dfd7047
1 changed files with 16 additions and 0 deletions
  1. 16
    0
      src/arch/i386/transitions/librm.S

+ 16
- 0
src/arch/i386/transitions/librm.S View File

@@ -8,6 +8,9 @@
8 8
 /* Drag in local definitions */
9 9
 #include "librm.h"
10 10
 
11
+/* Drag in FREE_BASEMEM_HEADER_SIZE */
12
+#include "basemem.h"
13
+
11 14
 /****************************************************************************
12 15
  * This file defines librm: a block of code that is designed to reside
13 16
  * permanently in base memory and provide the interface between
@@ -129,6 +132,19 @@ _librm_start:
129 132
 	.equ _ ## sym, OFFSET(sym) ; \
130 133
 	sym
131 134
 
135
+/****************************************************************************
136
+ * Note that the first sizeof(struct free_base_memory_header) bytes of
137
+ * librm will get vapourised by free_base_memory().  Since we need
138
+ * librm to continue working even when this happens, we put some
139
+ * padding here.
140
+ *
141
+ * We must also ensure that the total size of librm is <1kB, otherwise
142
+ * free_base_memory() will stomp somewhere in the middle of us as
143
+ * well...
144
+ ****************************************************************************
145
+ */
146
+	.fill FREE_BASEMEM_HEADER_SIZE, 1, 0
147
+	
132 148
 /****************************************************************************
133 149
  * GDT for initial transition to protected mode
134 150
  *

Loading…
Cancel
Save