Changeset 60887 in vbox for trunk/src/VBox
- Timestamp:
- May 9, 2016 9:27:56 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/system.c
r60614 r60887 268 268 // @todo: This method is silly. The RTC should be programmed to fire an interrupt 269 269 // instead of hogging the CPU with inaccurate code. 270 void timer_wait(uint16_t lo, uint16_t hi); 271 #pragma aux timer_wait = \ 272 ".386" \ 273 "shl eax, 16" \ 274 "mov ax, dx" \ 275 "mov ebx, 15" \ 276 "xor edx, edx" \ 277 "div ebx" \ 278 "mov ecx, eax" \ 279 "in al, 61h" \ 280 "and al, 10h" \ 281 "mov ah, al" \ 282 "or ecx, ecx" \ 283 "je int1586_tick_end" \ 284 "int1586_tick:" \ 285 "in al, 61h" \ 286 "and al, 10h" \ 287 "cmp al, ah" \ 288 "je int1586_tick" \ 289 "mov ah, al" \ 290 "dec ecx" \ 291 "jnz int1586_tick" \ 292 "int1586_tick_end:" \ 293 parm [dx] [ax] modify [bx cx] nomemory; 294 270 void timer_wait(uint32_t usec_wait) 271 { 272 uint32_t cycles; 273 uint8_t old_val; 274 uint8_t cur_val; 275 276 /* We wait in 15 usec increments. */ 277 cycles = usec_wait / 15; 278 279 old_val = inp(0x61) & 0x10; 280 while (cycles--) { 281 /* Wait 15us. */ 282 do { 283 cur_val = inp(0x61) & 0x10; 284 } while (cur_val != old_val); 285 old_val = cur_val; 286 } 287 } 295 288 296 289 bx_bool set_enable_a20(bx_bool val) … … 585 578 // refresh request port 0x61 bit4, toggling every 15usec 586 579 int_enable(); 587 timer_wait( DX, CX);580 timer_wait(((uint32_t)CX << 16) | DX); 588 581 break; 589 582
Note:
See TracChangeset
for help on using the changeset viewer.