LinuxÏÂÉèÖö˿ÚȨÏÞµÄϵͳµ÷ÓÃÓÐÁ½¸ö£ºiopermºÍiopl
Linux
ÏÂÉèÖö˿ÚȨÏÞµÄϵͳµ÷ÓÃÓÐÁ½¸ö£º
ioperm
ºÍ
iopl
¡£
Ò»¡¢
ioperm
ºÍ
iopl
½éÉÜ¡£
1.ioperm
¹¦ÄÜÃèÊö£º
Ϊµ÷Óýø³ÌÉèÖÃ
I/O
¶Ë¿Ú·ÃÎÊȨÄÜ¡£
ioperm
µÄʹÓÃÐèÒª¾ßÓг¬¼¶Óû§µÄȨÏÞ£¬Ö»ÓеͶ˵Ä
[0-0x3ff] I/O
¶Ë¿Ú¿É±»ÉèÖã¬ÒªÏëÖ¸¶¨¸ü¶à¶Ë¿ÚµÄȨÄÜ£¬¿ÉʹÓÃ
iopl
º¯Êý¡£ÕâÒ»µ÷ÓÃÖ»¿ÉÓÃÓÚ
i386
ƽ̨¡£
Ó÷¨£º
#include <unistd.h> /* for libc5 */
#include <sys/io.h> /* for glibc */
int ioperm(unsigned long from, unsigned long num, int turn_on);
²ÎÊý£º
from
£ºÆðʼ¶Ë¿ÚµØÖ·¡£
num
£ºÐèÒªÐÞ¸ÄȨÄܵĶ˿ÚÊý¡£
turn_on
£º¶Ë¿ÚµÄÐÂȨÄÜλ¡£
1
Ϊ¿ªÆô£¬
0
Ϊ¹Ø±Õ¡£
·µ»Ø˵Ã÷£º
³É¹¦Ö´ÐÐʱ£¬·µ»Ø
0
¡£Ê§°Ü·µ»Ø
-1
£¬
errno
±»ÉèΪÒÔϵÄij¸öÖµ
EINVAL
£º²ÎÊýÎÞЧ
EIO
£ºÕâÒ»µ÷Óò»±»Ö§³Ö
EPERM
£ºµ÷Óýø³ÌȨÄܲ»×ã¡£
2. iopl
¹¦ÄÜÃèÊö£º¸Ãµ÷ÓÃÓÃÓÚÐ޸ĵ±Ç°½ø³ÌµÄ²Ù×÷¶Ë¿ÚµÄȨÏÞ¡£¿ÉÒÔÓÃÓÚËùÓÐ
65536
¸ö¶Ë¿ÚµÄȨÏÞ¡£Òò´Ë£¬
ioperm
Ï൱Óڸõ÷ÓõÄ×Ó¼¯¡£ºÍ
ioperm
Ò»Ñù£¬ÕâÒ»µ÷ÓýöÊÊÓÃÓÚ
i386
ƽ̨¡£
Ó÷¨£º
#include <sys/io.h>
int iopl(int level);
²ÎÊý£º
level
£º
¶Ë¿ÚµÄȨÏÞ¼¶±ð
¡£Îª
3
ʱ¿ÉÒÔ¶Áд¶Ë¿Ú¡£Ä¬ÈÏȨÄܼ¶±ðΪ
0
£¬Óû§¿Õ¼ä²»¿É¶Áд¡£
·µ»Ø˵Ã÷£º³É¹¦Ö´ÐÐʱ£¬·µ»Ø
0
¡£Ê§°Ü·µ»Ø
-1
£¬
errno
±»ÉèΪÒÔϵÄij¸öÖµ
EINVAL
£º
level
Öµ´óÓÚ
3
ENOSYS
£ºÎ´ÊµÏָõ÷ÓÃ
EPERM
£ºµ÷Óýø³ÌȨÄܲ»×ã¡£
¶þ¡¢³ÌÐòʾÀý
1. ioperm.c
²Ù×÷µÍÓÚ
0x3FF
µÄ¶Ë¿Ú
¸Ã³ÌÐòÊ×ÏÈÉèÖÃ
0x3FF
¶Ë¿ÚµÄ¶ÁдȨÏÞ£¬È»ºó¶Á³öÔÏȵÄÖµ£¬È»ºó½«ÔÖµµÄ
LSB
·×ª²¢Ð´»Ø¶Ë¿Ú£¬²¢Ôڴ˶ÁÈ¡¶Ë¿ÚÖµ¡£
/*Godbach. Dec 18, 2008
Description:This function is used to test ioperm()*/
#include <stdio.h>
#include <unistd.h>
#include <sys/io.h>
#define PORT_ADDR 0x3FF
int main(void)
{
int ret;
char port_val;
/*set r/w permission of port_addr on, only one port*/
ret = ioperm(PORT_ADDR, 1, 1);
if(ret < 0){
Ïà¹ØÎĵµ£º
ÊÖÍ·Óиöep9315µÄ°å£¬½ñÌìͻȻÏëÆðÅÜÒ»ÏÂadslÉÏÍø¡£ÍíÉÏ»ØÀ´¾Í¿ªÊ¼¸ã¡£
´Ó10µãµ½ÏÖÔÚ£¬ÖÕÓÚÄܹ»ÅÜÆðÀ´¡£
¸ø´ó¼Ò½è¼øһϡ£
1.±àÒëÄںˣ¬°ÑpppµÄÄÇЩѡÏîÑ¡ÉÏ¡£ (ÎÒÓÃ2.6.8.1µÄkernel£¬cirrus µÄpatch)
2.libpcap-0.9.1 Õâ¸ö°üÊÇpppdÐèÒªµÄ¡£
./configure CC=arm-linux-gcc CFLAGS=-msoft-float --target=arm-linu ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
Linux
ÊÀ½çºÜ¾«²Ê£¬ÁîÈËÑÛ»¨çÔÂÒ¡£½üÆÚÒÔÀ´£¬¸÷ÖÖÇáÐÍ
Linux
°æ±¾²»¶ÏµÇ̨ÁÁÏ֪࣬ÃûµÄ
Puppy
£¨Ð¡¹·Ö®Ãû£©±ãÊÇÒ»Àý¡£ºÎ¹Ê£¿
......
ѧϰӦ¸ÃÊÇÒ»¸öÏÈ°ÑÎÊÌâ¼òµ¥»¯£¬ÔÚ°ÑÎÊÌ⸴ÔÓ»¯µÄ¹ý³Ì¡£Ò»¿ªÊ¼¾Í×ÅÊÖ´¦Àí¸´ÔÓµÄÎÊÌ⣬ÄÑÃâÈà ÈËÓÐÐľªµ¨²ü£¬×½½ó¼ûÖâµÄ¸Ð¾õ¡£¶ÁLinuxÍø¿¨Çý¶¯Ò²ÊÇÒ»Ñù¡£Ädz¤³¤µÄÔ´Âë¼ÐÔÓ×ÅÄÇЩÎÒÃÇÄ°ÉúµÄ±äÁ¿ºÍ·ûºÅ£¬Íû¶øÉúη±ãÊÇÀíËùµ±È»µÄÁË¡£²»Òªµ£ÐÄ£¬ÊÂÇé ×ÜÓнâ¾öµÄ°ì·¨£¬ÏÈ°ÑһЩÎÒÃǹܲ»×ŵĴúÂëÇиî³öÈ¥£¬ÁôϱØÐëµÄ²¿·Ö£¬°Ñ¿ò¼ÜÕ ......
ǶÈëʽLinuxÆô¶¯·ÖΪÁ½¸ö²¿·Ö£¬ÏµÍ³Òýµ¼ÓëLinuxÆô¶¯¡£ÏµÍ³Òýµ¼½«Íê³ÉLinux×°ÈëÄÚ´æÇ°£¬³õʼ»¯CPUºÍÏà¹ØI/OÉ豸£¬²¢½«Linuxµ÷ÈëÄÚ´æµÄ¹¤×÷¡£ÏµÍ³Òýµ¼Ö÷ÒªÓÉBootLoaderʵÏÖ¡£ÔÚBootLoader½«LinuxÄں˵÷ÈëÄÚ´æÖ®ºó£¬½«È¨Á¦½»¸øLinuxKernel£¬½øÈëLinuxµÄÆô¶¯²¿·Ö¡£ÒÔÏÂÏêϸ·ÖÎöÆô¶¯µÄ¹ý³ÌÓëʹÓõÄÎļþ¡£
Ò»¡¢ÏµÍ³Òýµ¼ÓëBootLoa ......