vga=no mode and serial echo
This commit is contained in:
parent
842826c1b0
commit
00db6ddd62
2
Makefile
2
Makefile
|
@ -48,7 +48,9 @@ qemu: $(KBUILD)/harddrive.bin
|
||||||
else
|
else
|
||||||
LD=ld
|
LD=ld
|
||||||
QEMUFLAGS+=-enable-kvm -cpu host -machine q35 -smp 4
|
QEMUFLAGS+=-enable-kvm -cpu host -machine q35 -smp 4
|
||||||
|
ifeq ($(vga),no)
|
||||||
QEMUFLAGS+=-nographic -vga none
|
QEMUFLAGS+=-nographic -vga none
|
||||||
|
endif
|
||||||
#,int,pcall
|
#,int,pcall
|
||||||
#-device intel-iommu
|
#-device intel-iommu
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,22 @@ impl SerialPort {
|
||||||
self.data.write(data)
|
self.data.write(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn write_translate(&mut self, data: u8) {
|
||||||
|
match data {
|
||||||
|
8 | 0x7F => {
|
||||||
|
self.write(8);
|
||||||
|
self.write(b' ');
|
||||||
|
self.write(8);
|
||||||
|
},
|
||||||
|
b'\r' => {
|
||||||
|
self.write(b'\n');
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
self.write(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn init(&mut self) {
|
fn init(&mut self) {
|
||||||
//TODO: Cleanup
|
//TODO: Cleanup
|
||||||
self.int_en.write(0x00);
|
self.int_en.write(0x00);
|
||||||
|
@ -86,19 +102,14 @@ impl SerialPort {
|
||||||
|
|
||||||
pub fn on_receive(&mut self) {
|
pub fn on_receive(&mut self) {
|
||||||
let data = self.data.read();
|
let data = self.data.read();
|
||||||
let _ = write!(self, "SERIAL {:X}\n", data);
|
self.write_translate(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Write for SerialPort {
|
impl Write for SerialPort {
|
||||||
fn write_str(&mut self, s: &str) -> Result<(), fmt::Error> {
|
fn write_str(&mut self, s: &str) -> Result<(), fmt::Error> {
|
||||||
for byte in s.bytes() {
|
for byte in s.bytes() {
|
||||||
self.write(byte);
|
self.write_translate(byte);
|
||||||
|
|
||||||
if byte == 8 {
|
|
||||||
self.write(b' ');
|
|
||||||
self.write(8);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue