精華區beta Programming 關於我們 聯絡資訊
※ 引述《tester.bbs@bbs.csie.ncu.edu.tw (try or test)》之銘言: > 在 Window OS 或 Linux 的 User mode 下可以讓一般 user program 做 > 1, 2, 3, 5 的程式練習嗎 ? > 是否是用組語直接設定 I/O port 與 kernel memory space ? 還是透過 > libray system call ? 在 Linux,user mode 之下,如果有 root 權限,可以呼叫 iopl() 然後可以存取 I/O port 比如說以下程式在一般 PC 上執行,可以直接進行 hard reboot 你可以用 gcc 編譯然後執行看看 #include <sys/io.h> int main (){ iopl (3); /* we can make a hard reboot through the keyboard port 0x64 with a byte 0xFE */ asm("mov $0xFE, %al"); asm("out %al, $0x64"); // never reach here... iopl (0); return 0; } -- , 秘密情人 (bbs.cse.ttu.edu.tw) ~\ Post From: 61-70-137-117.adsl.static.giga.net.tw