Write to port 0cf8h fails with segfault

前端 未结 1 1007
北海茫月
北海茫月 2021-01-27 02:59

I have an AMD processor of e2-2000 model. THis is family 0fh. According to family 0fh BKDG I have this code to read device and vendor ID:

ReadPCIConfiguration:
m         


        
相关标签:
1条回答
  • 2021-01-27 03:39

    Linux does not, by default, allow userland code to write to I/O ports. (Doing so can be quite dangerous from a security perspective.) If you’d like Linux to give your process access to the I/O ports, you have two options:

    1. You can use the ioperm system call. However, ioperm has been deprecated for some time, and Josh Triplett recently pushed a patch that allows users to remove it from the kernel. Avoid ioperm if you want your code to continue working for the forseeable future.

    2. You can read from and write to /dev/port. See mem(4). Your process will, obviously, need read and write permissions for /dev/mem; on Wheezy, that means it needs to run as root, unless you change the permissions on the device.

    0 讨论(0)
提交回复
热议问题