Bladeren bron

Update to REAL_CODE()

tags/v0.9.3
Michael Brown 18 jaren geleden
bovenliggende
commit
04d6005d77
1 gewijzigde bestanden met toevoegingen van 29 en 38 verwijderingen
  1. 29
    38
      src/arch/i386/firmware/pcbios/memmap.c

+ 29
- 38
src/arch/i386/firmware/pcbios/memmap.c Bestand weergeven

@@ -75,19 +75,16 @@ static unsigned int extmemsize_e801 ( void ) {
75 75
 	unsigned int flags;
76 76
 	unsigned int extmem;
77 77
 
78
-	REAL_EXEC ( rm_mem_e801,
79
-		    "stc\n\t"
80
-		    "int $0x15\n\t"
81
-		    "pushfw\n\t"
82
-		    "popw %w0\n\t",
83
-		    5,
84
-		    OUT_CONSTRAINTS ( "=r" ( flags ),
85
-				      "=a" ( extmem_1m_to_16m_k ),
86
-				      "=b" ( extmem_16m_plus_64k ),
87
-				      "=c" ( confmem_1m_to_16m_k ),
88
-				      "=d" ( confmem_16m_plus_64k ) ),
89
-		    IN_CONSTRAINTS ( "a" ( 0xe801 ) ),
90
-		    CLOBBER ( "cc" ) );
78
+	__asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
79
+					   "int $0x15\n\t"
80
+					   "pushfw\n\t"
81
+					   "popw %w0\n\t" )
82
+			       : "=r" ( flags ),
83
+				 "=a" ( extmem_1m_to_16m_k ),
84
+				 "=b" ( extmem_16m_plus_64k ),
85
+				 "=c" ( confmem_1m_to_16m_k ),
86
+				 "=d" ( confmem_16m_plus_64k )
87
+			       : "a" ( 0xe801 ) );
91 88
 
92 89
 	if ( flags & CF )
93 90
 		return 0;
@@ -111,13 +108,9 @@ static unsigned int extmemsize_e801 ( void ) {
111 108
 static unsigned int extmemsize_88 ( void ) {
112 109
 	uint16_t extmem;
113 110
 
114
-	REAL_EXEC ( rm_mem_88,
115
-		    /* Ignore CF; it is not reliable for this call */
116
-		    "int $0x15\n\t",
117
-		    1,
118
-		    OUT_CONSTRAINTS ( "=a" ( extmem ) ),
119
-		    IN_CONSTRAINTS ( "a" ( 0x8800 ) ),
120
-		    CLOBBER ( "cc" ) );
111
+	/* Ignore CF; it is not reliable for this call */
112
+	__asm__ __volatile__ ( REAL_CODE ( "int $0x15" )
113
+			       : "=a" ( extmem ) : "a" ( 0x8800 ) );
121 114
 
122 115
 	DBG ( "Extended memory size %d kB\n", extmem );
123 116
 	return extmem;
@@ -153,32 +146,30 @@ static int meme820 ( struct memory_region *memmap, unsigned int entries ) {
153 146
 	unsigned int discard_c, discard_d, discard_D;
154 147
 
155 148
 	do {
156
-		REAL_EXEC ( rm_mem_e820,
157
-			    "stc\n\t"
158
-			    "int $0x15\n\t"
159
-			    "pushfw\n\t"
160
-			    "popw %w0\n\t",
161
-			    6,
162
-			    OUT_CONSTRAINTS ( "=r" ( flags ),
163
-					      "=a" ( smap ),
164
-					      "=b" ( next ),
165
-					      "=D" ( discard_D ),
166
-					      "=c" ( discard_c ),
167
-					      "=d" ( discard_d ) ),
168
-			    IN_CONSTRAINTS ( "a" ( 0xe820 ),
169
-					     "b" ( next ),
170
-					     "D" ( &__from_data16 ( e820buf )),
171
-					     "c" ( sizeof ( e820buf ) ),
172
-					     "d" ( SMAP ) ),
173
-			    CLOBBER ( "memory" ) );
149
+		__asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
150
+						   "int $0x15\n\t"
151
+						   "pushfw\n\t"
152
+						   "popw %w0\n\t" )
153
+				       : "=r" ( flags ), "=a" ( smap ),
154
+					 "=b" ( next ), "=D" ( discard_D ),
155
+					 "=c" ( discard_c ), "=d" ( discard_d )
156
+				       : "a" ( 0xe820 ), "b" ( next ),
157
+					 "D" ( &__from_data16 ( e820buf ) ),
158
+					 "c" ( sizeof ( e820buf ) ),
159
+					 "d" ( SMAP )
160
+				       : "memory" );
161
+
174 162
 		if ( smap != SMAP )
175 163
 			return -ENOTSUP;
164
+
176 165
 		if ( flags & CF )
177 166
 			break;
167
+
178 168
 		DBG ( "E820 region [%llx,%llx) type %d\n", e820buf.start,
179 169
 		      ( e820buf.start + e820buf.len ), ( int ) e820buf.type );
180 170
 		if ( e820buf.type != E820_TYPE_RAM )
181 171
 			continue;
172
+
182 173
 		memmap[index].start = e820buf.start;
183 174
 		memmap[index].end = e820buf.start + e820buf.len;
184 175
 		index++;

Laden…
Annuleren
Opslaan