瀏覽代碼

Remove some obsolete sections of librm.h and libkir.h.

Add some of the missing parts to libkir.h.
tags/v0.9.3
Michael Brown 17 年之前
父節點
當前提交
75912b3b77
共有 2 個文件被更改,包括 25 次插入39 次删除
  1. 25
    25
      src/arch/i386/include/libkir.h
  2. 0
    14
      src/arch/i386/include/librm.h

+ 25
- 25
src/arch/i386/include/libkir.h 查看文件

@@ -13,6 +13,8 @@
13 13
 /* Access to variables in .data16 and .text16 in a way compatible with librm */
14 14
 #define __data16( variable ) variable
15 15
 #define __data16_array( variable, array ) variable array
16
+#define __bss16( variable ) variable
17
+#define __bss16_array( variable, array ) variable array
16 18
 #define __text16( variable ) variable
17 19
 #define __text16_array( variable,array ) variable array
18 20
 #define __use_data16( variable ) variable
@@ -38,34 +40,41 @@ static inline __attribute__ (( always_inline )) unsigned int _rm_ds ( void ) {
38 40
 
39 41
 /* Copy to/from base memory */
40 42
 
41
-static inline void copy_to_real_libkir ( uint16_t dest_seg, uint16_t dest_off,
43
+static inline void copy_to_real_libkir ( unsigned int dest_seg,
44
+					 unsigned int dest_off,
42 45
 					 const void *src, size_t n ) {
43
-	__asm__ __volatile__ ( "movw %4, %%es\n\t"
44
-			       "cld\n\t"
46
+	unsigned int discard_D, discard_S, discard_c;
47
+
48
+	__asm__ __volatile__ ( "pushw %%es\n\t"
49
+			       "movw %3, %%es\n\t"
45 50
 			       "rep movsb\n\t"
46
-			       "pushw %%ds\n\t" /* restore %es */
47 51
 			       "popw %%es\n\t"
48
-			       : "=S" ( src ), "=D" ( dest_off ),
49
-			         "=c" ( n ) /* clobbered */
50
-			       : "S" ( src ), "r" ( dest_seg ),
51
-			         "D" ( dest_off ), "c" ( n )
52
+			       : "=D" ( discard_D ), "=S" ( discard_S ),
53
+			         "=c" ( discard_c )
54
+			       : "r" ( dest_seg ), "D" ( dest_off ),
55
+			         "S" ( src ),
56
+			         "c" ( n )
52 57
 			       : "memory" );
53 58
 }
54 59
 
55 60
 static inline void copy_from_real_libkir ( void *dest,
56
-					   uint16_t src_seg, uint16_t src_off,
61
+					   unsigned int src_seg,
62
+					   unsigned int src_off,
57 63
 					   size_t n ) {
58
-	__asm__ __volatile__ ( "movw %%ax, %%ds\n\t"
59
-			       "cld\n\t"
64
+	unsigned int discard_D, discard_S, discard_c;
65
+
66
+	__asm__ __volatile__ ( "pushw %%ds\n\t"
67
+			       "movw %4, %%ds\n\t"
60 68
 			       "rep movsb\n\t"
61
-			       "pushw %%es\n\t" /* restore %ds */
62 69
 			       "popw %%ds\n\t"
63
-			       : "=S" ( src_off ), "=D" ( dest ),
64
-			         "=c" ( n ) /* clobbered */
65
-			       : "a" ( src_seg ), "S" ( src_off ),
66
-			         "D" ( dest ), "c" ( n )
70
+			       : "=D" ( discard_D ), "=S" ( discard_S ),
71
+			         "=c" ( discard_c )
72
+			       : "D" ( dest ),
73
+			         "r" ( src_seg ), "S" ( src_off ),
74
+			         "c" ( n )
67 75
 			       : "memory" );
68 76
 }
77
+
69 78
 #define copy_to_real copy_to_real_libkir
70 79
 #define copy_from_real copy_from_real_libkir
71 80
 
@@ -204,15 +213,6 @@ virt_to_user ( void * virtual ) {
204 213
 	return real_to_user ( rm_ds, ( intptr_t ) virtual );
205 214
 }
206 215
 
207
-/* Place/remove parameter on real-mode stack in a way that's
208
- * compatible with libkir
209
- */
210
-#define BASEMEM_PARAMETER_INIT_LIBKIR( param ) \
211
-	( ( uint16_t ) ( ( uint32_t ) & ( param ) ) )
212
-#define BASEMEM_PARAMETER_DONE_LIBKIR( param )
213
-#define BASEMEM_PARAMETER_INIT BASEMEM_PARAMETER_INIT_LIBKIR
214
-#define BASEMEM_PARAMETER_DONE BASEMEM_PARAMETER_DONE_LIBKIR
215
-
216 216
 /* TEXT16_CODE: declare a fragment of code that resides in .text16 */
217 217
 #define TEXT16_CODE( asm_code_str )			\
218 218
 	".section \".text16\", \"ax\", @progbits\n\t"	\

+ 0
- 14
src/arch/i386/include/librm.h 查看文件

@@ -263,20 +263,6 @@ user_to_phys ( userptr_t buffer, off_t offset ) {
263 263
 	return virt_to_phys ( ( void * ) buffer + offset );
264 264
 }
265 265
 
266
-/* Copy to/from real-mode stack */
267
-extern uint16_t copy_to_rm_stack ( void *data, size_t size );
268
-extern void remove_from_rm_stack ( void *data, size_t size );
269
-
270
-/* Place/remove parameter on real-mode stack in a way that's
271
- * compatible with libkir
272
- */
273
-#define BASEMEM_PARAMETER_INIT_LIBRM( param ) \
274
-	copy_to_rm_stack ( & ( param ), sizeof ( param ) )
275
-#define BASEMEM_PARAMETER_DONE_LIBRM( param ) \
276
-	remove_from_rm_stack ( & ( param ), sizeof ( param ) )
277
-#define BASEMEM_PARAMETER_INIT BASEMEM_PARAMETER_INIT_LIBRM
278
-#define BASEMEM_PARAMETER_DONE BASEMEM_PARAMETER_DONE_LIBRM
279
-
280 266
 /* TEXT16_CODE: declare a fragment of code that resides in .text16 */
281 267
 #define TEXT16_CODE( asm_code_str )			\
282 268
 	".section \".text16\", \"ax\", @progbits\n\t"	\

Loading…
取消
儲存