Serial port output cannot be observed on VMware
Posted: Tue Jul 30, 2024 4:05 am
I am attempting to add debug logging via the COM1 serial port into my microkernel, which is currently being executed parallel to another operating system (a Windows 11 instance) both as guests in a VMware instance. Below is the code I've been using to setup the COM1 serial port, along with an example of logging a simple debug string to the port. I can't seem to observe this output--even in isolated cases where my microkernel is not fully initialized parallel to the operating system executing it.
Code for my output byte function + output byte string function, which was supplemented by derivatives provided by the host operating system; so I don't believe the error is here.
I can't seem to observe any sort of serial port output produced given the configuration above. Before anybody asks, I did attempt to implement the entire example port setup from the OSDev wiki (code included below), which also goes on to test the port output by reading in loopback mode, and I can confirm I receive the 0xAE test byte when executing an IN instruction.
PuTTY is currently being used in a baseline attempt to record output from COM1, though the same result--which is no data--can be seen in redirecting the port from within VMware. The settings within PuTTY are as follows:
The physical processor backing the VM is an Intel i9-13900K, running on VMware Workstation 17 Pro (17.5.0 build-22583795).
Thank you for your time. I really appreciate it, and all the best.
Code: Select all
__outbyte( 0x03F8 + 3, 0x80 ); // Enable DLAB to change the BAUD rate
__outbyte( 0x03F8 + 0, 1 ); // Set the BAUD rate to 115200
__outbyte( 0x03F8 + 1, 0 ); // Set the BAUD rate to 115200
__outbyte( 0x03F8 + 3, 3 ); // Disable DLAB, specify 8-bit data unit sizes, one stop bit, and no parity
__outbyte( 0x03F8 + 1, 0 ); // Disable interrupts
__outbyte( 0x03F8 + 2, 7 ); // Enable FIFO, clear out the receive and transmit buffers
Code: Select all
void
output_byte(
_input u16 port_address,
_input u8 value
);
void
output_byte_string(
_input u16 port_address,
_input char* str,
_input u32 len
);
Code: Select all
output_byte PROC
mov al, dl
mov dx, cx
out dx, al
ret
output_byte ENDP
output_byte_string PROC
push rsi
mov rsi, rdx
mov dx, cx
mov ecx, r8d
rep outsb dx, byte ptr [rsi]
pop rsi
ret
output_byte_string ENDP
Code: Select all
__outbyte( 0x03F8 + 1, 0x00 ); // Disable all interrupts
__outbyte( 0x03F8 + 3, 0x80 ); // Enable DLAB (set baud rate divisor)
__outbyte( 0x03F8 + 0, 0x03 ); // Set divisor to 3 (lo byte) 38400 baud
__outbyte( 0x03F8 + 1, 0x00 ); // (hi byte)
__outbyte( 0x03F8 + 3, 0x03 ); // 8 bits, no parity, one stop bit
__outbyte( 0x03F8 + 2, 0xC7 ); // Enable FIFO, clear them, with 14-byte threshold
__outbyte( 0x03F8 + 4, 0x0B ); // IRQs enabled, RTS/DSR set
__outbyte( 0x03F8 + 4, 0x1E ); // Set in loopback mode, test the serial chip
__outbyte( 0x03F8 + 0, 0xAE ); // Test serial chip (send byte 0xAE and check if serial returns same byte)
byte = __inbyte( 0x03F8 ); // Confirmed: return result is 0xAE
__outbyte( 0x03F8 + 4, 0x0F );
- Serial mode
- Serial line: COM1
- Speed (baud): 115200
- Data bits: 8
- Stop bits: 1
- Parity: None
- Flow control: XON/XOFF (Default)
The physical processor backing the VM is an Intel i9-13900K, running on VMware Workstation 17 Pro (17.5.0 build-22583795).
Thank you for your time. I really appreciate it, and all the best.