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
1 changed files with 2 additions and 4 deletions

View File

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