2362N/A; Copyright (C) 2006 InnoTek Systemberatung GmbH
2362N/A; This file is part of VirtualBox Open Source Edition (OSE), as
0N/A; you can redistribute it
and/or modify it under the terms of the GNU
0N/A; General Public License as published by the Free Software Foundation,
0N/A; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
0N/A; distribution. VirtualBox OSE is distributed in the hope that it will
0N/A; be useful, but WITHOUT ANY WARRANTY of any kind.
0N/A; If you received this file as part of a commercial VirtualBox
0N/A; distribution, then only the terms of your commercial VirtualBox
0N/A; license agreement apply instead of the previous paragraph.
0N/A;; @def VBOX_WITH_STATISTICS
0N/A; When defined all statistics will be included in the build.
0N/A; This is enabled by default in all debug builds.
0N/A%ifndef VBOX_WITH_STATISTICS
0N/A %define VBOX_WITH_STATISTICS
0N/A;%define UART_BASE 2f8h ; com2
0N/A%define UART_BASE 3f8h ; com1
0N/A%define UART_RATE 12 ; 9600 bps
0N/A%define UART_PARAMS 00000011b ; 8n1
0N/A; Initializes the com port to 9600 baud 8n1.
0N/A; al and dx are wasted.
0N/A; @todo comport init doesn't quite work. :/
0N/A mov dx, UART_BASE + 3
0N/A out dx, al ; make DL register accessible
0N/A out dx, ax ; write bps rate divisor
0N/A mov dx, UART_BASE + 3
0N/A out dx, al ; write parameters
0N/A mov dx, UART_BASE + 4 ; disconnect the UART from the int line
0N/A mov dx, UART_BASE + 1 ; disable UART ints
0N/A mov dx, UART_BASE + 2 ; disable the fifos (old software relies on it)
0N/A in al, dx ; clear receiver
0N/A mov dx, UART_BASE + 5
0N/A in al, dx ; clear line status
0N/A in al, dx ; clear modem status
0N/A; writes string to comport
0N/A; trashes nothing (uses stack though)
0N/A%macro COM32_S_PRINT 1+
0N/A mov cx, %%stringend - %%string
lea rsi, [%%string wrt rip]
mov cx, %%stringend - %%string
; trashes nothing (uses stack though)
; trashes nothing (uses stack though)
;; Writes a dword from register to com port.
; edi cannot be used as input register
mov ebx, %1 ; get value we're supposed to print
mov ah, 8 ; loop counter.
rol ebx, 4 ; shift next digit to the front
mov al, bl ; get next char
jae short %%hex ; yasm BUG! It sometimes generate a near jump here. YASMCHECK!
jnz short %%daloop ; loop
mov ebx, edi ; restore ebx
;; Writes a dword from register to com port.
; trashes nothing (uses stack though)
%macro COM32_S_DWORD_REG 1
mov ebx, %1 ; get value we're supposed to print
mov ah, 8 ; loop counter.
rol ebx, 4 ; shift next digit to the front
mov al, bl ; get next char
jae short %%hex ; yasm BUG! It sometimes generate a near jump here. YASMCHECK!
jnz short %%daloop ; loop
%macro COM64_S_DWORD_REG 1
mov ebx, %1 ; get value we're supposed to print
mov ah, 8 ; loop counter.
rol ebx, 4 ; shift next digit to the front
mov al, bl ; get next char
jae short %%hex ; yasm BUG! It sometimes generate a near jump here. YASMCHECK!
jnz short %%daloop ; loop
;; Writes a qword from register to com port.
; trashes nothing (uses stack though)
%macro COM64_S_QWORD_REG 1
mov rbx, %1 ; get value we're supposed to print
mov ah, 16 ; loop counter.
rol rbx, 4 ; shift next digit to the front
mov al, bl ; get next char
jae short %%hex ; yasm BUG! It sometimes generate a near jump here. YASMCHECK!
jnz short %%daloop ; loop
;; Writes a byte from register to com port.
; trashes nothing (uses stack though)
%macro COM32_S_BYTE_REG 1
mov ebx, %1 ; get value we're supposed to print
mov ah, 2 ; loop counter.
ror ebx, 8 ; shift next digit to the front
rol ebx, 4 ; shift next digit to the front
mov al, bl ; get next char
jae short %%hex ; yasm BUG! It sometimes generate a near jump here. YASMCHECK!
jnz short %%daloop ; loop
%macro COM64_S_BYTE_REG 1
mov ebx, %1 ; get value we're supposed to print
mov ah, 2 ; loop counter.
ror ebx, 8 ; shift next digit to the front
rol ebx, 4 ; shift next digit to the front
mov al, bl ; get next char
jae short %%hex ; yasm BUG! It sometimes generate a near jump here. YASMCHECK!
jnz short %%daloop ; loop
;; Writes a single hex digit from register to com port.
; trashes nothing (uses stack though)
%macro COM32_S_DIGIT_REG 1
mov ebx, %1 ; get value we're supposed to print
mov al, bl ; get next char
jae short %%hex ; yasm BUG! It sometimes generate a near jump here. YASMCHECK!
%macro COM64_S_DIGIT_REG 1
mov ebx, %1 ; get value we're supposed to print
mov al, bl ; get next char
jae short %%hex ; yasm BUG! It sometimes generate a near jump here. YASMCHECK!
; Loops for a short while.
%macro LOOP_SHORT_WHILE 0