qemu-fwcfg: use pread/pwrite for port access

This commit is contained in:
K. Lange 2024-02-08 16:49:06 +09:00
parent 2eb7d97464
commit 1e6316122a

View File

@ -31,14 +31,12 @@ static int port_fd = -1;
/* outw / inb helper functions */ /* outw / inb helper functions */
static void outports(unsigned short _port, unsigned short _data) { static void outports(unsigned short _port, unsigned short _data) {
lseek(port_fd, _port, SEEK_SET); pwrite(port_fd, &_data, 2, _port);
write(port_fd, &_data, 2);
} }
static unsigned char inportb(unsigned short _port) { static unsigned char inportb(unsigned short _port) {
unsigned char out; unsigned char out;
lseek(port_fd, _port, SEEK_SET); pread(port_fd, &out, 1, _port);
read(port_fd, &out, 1);
return out; return out;
} }