亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? silly.c

?? Linux設備驅動程序第二版
?? C
字號:
/* * silly.c -- Simple Tool for Unloading and Printing ISA Data (v2.1) * * Tested with 2.0 on the x86? *  * This module won't work on the sparc, where there's no concept of I/O space * */#ifndef __KERNEL__#  define __KERNEL__#endif#ifndef MODULE#  define MODULE#endif#ifdef __sparc__#  error "This module can't run on the Sparc platform"#else#define __NO_VERSION__ /* don't define kernel_verion in module.h */#include <linux/module.h>#include <linux/version.h>char kernel_version [] = UTS_RELEASE;#include <linux/sched.h>#include <linux/kernel.h> /* printk() */#include <linux/fs.h>     /* everything... */#include <linux/errno.h>  /* error codes */#include <linux/tqueue.h>#include <linux/malloc.h>#include <linux/mm.h>#include <linux/ioport.h>#include <asm/io.h>#include <asm/segment.h>  /* memcpy to/from fs */#include "sysdep-2.1.h"int silly_major = 0;static int lines=25, columns=80; /* can be changed at load time *//* * The devices access the 640k-1M memory. * minor 0 uses readb/writeb * minor 1 uses readw/writew * minor 2 uses readl/writel * minor 3 uses memcpy_fromio()/memcpy_toio() * minor 4 uses readl/writel over VGA mem (0xb8000-0xc0000) * minor 5 only drops letters in the VGA buffer */static int silly_joke_write(int count);int silly_open (struct inode *inode, struct file *filp){    MOD_INC_USE_COUNT;    return 0;}release_t silly_release (struct inode *inode, struct file *filp){    MOD_DEC_USE_COUNT;    release_return(0);}enum silly_modes {M_8=0, M_16, M_32, M_memcpy, M_vga, M_joke};read_write_t silly_read (struct inode *inode, struct file *filp,                char *buf, count_t count){    int retval;    int mode = MINOR(inode->i_rdev);    unsigned long add = 0xA0000 + filp->f_pos;    unsigned char *kbuf, *ptr;    if (mode == M_joke) return 0;  /* no read on /dev/silliest */    if (mode == M_vga) {        add = 0xB8000 + filp->f_pos; /* range: 0xB8000-0xC0000 */        if (add + count > 0xC0000)            count = 0xC0000 - add;        mode = M_32; /* and fall back to normal xfer */    }    else         if (add + count > 0x100000) /* range: 0xA0000-0x100000 */            count = 0x100000 - add;    /*     * too big an f_pos (caused by a malicious lseek())     * would result in a negative count     */    if (count < 0) return 0;    kbuf = kmalloc(count, GFP_KERNEL);    if (!kbuf) return -ENOMEM;    ptr=kbuf;    retval=count;    /*     * kbuf is aligned, but the reads might not. In order not to     * drive me mad with unaligned leading and trailing bytes,     * I downgrade the `mode' if unaligned xfers are requested.     */    if (mode==M_32 && ((add | count) & 3))        mode = M_16;    if (mode==M_16 && ((add | count) & 1))        mode = M_8;    switch(mode) {      case M_32:         while (count >= 4) {            *(u32 *)ptr = readl(add);            add+=4; count-=4; ptr+=4;        }        break;                  case M_16:         while (count >= 2) {            *(u16 *)ptr = readw(add);            add+=2; count-=2; ptr+=2;        }        break;                  case M_8:         while (count) {            *ptr = readb(add);            add++; count--; ptr++;        }        break;      case M_memcpy:        memcpy_fromio(ptr, add, count);        break;      default:        return -EINVAL;    }    if (retval > 0)        copy_to_user(buf, kbuf, retval);    kfree(kbuf);    filp->f_pos += retval;    return retval;}read_write_t silly_write (struct inode *inode, struct file *filp,                const char *buf, count_t count){    int retval;    int mode = MINOR(inode->i_rdev);    unsigned long add = 0xA0000 + filp->f_pos;    unsigned char *kbuf, *ptr;    /*     * Writing is dangerous.     * Allow root-only, independently of device permissions     */    if (!suser()) return -EPERM;    if (mode == M_joke)        return silly_joke_write(count);    if (mode == M_vga) {        add = 0xB8000 + filp->f_pos; /* range: 0xB8000-0xC0000 */        if (add + count > 0xC0000)            count = 0xC0000 - add;        mode = M_32; /* and fall back to normal xfer */    }    else         if (add + count > 0x100000) /* range: 0xA0000-0x100000 */            count = 0x100000 - add;    /*     * too big an f_pos (caused by a malicious lseek())     * results in a negative count     */    if (count < 0) return 0;    kbuf = kmalloc(count, GFP_KERNEL);    if (!kbuf) return -ENOMEM;    ptr=kbuf;    retval=count;    /*     * kbuf is aligned, but the writes might not. In order not to     * drive me mad with unaligned leading and trailing bytes,     * I downgrade the `mode' if unaligned xfers are requested.     */    if (mode==M_32 && ((add | count) & 3))        mode = M_16;    if (mode==M_16 && ((add | count) & 1))        mode = M_8;    copy_from_user(kbuf, buf, count);    ptr=kbuf;    switch(mode) {      case M_32:         while (count >= 4) {            writel(*(u32 *)ptr, add);            add+=4; count-=4; ptr+=4;        }        break;                  case M_16:         while (count >= 2) {            writel(*(u16 *)ptr, add);            add+=2; count-=2; ptr+=2;        }        break;                  case M_8:         while (count) {            writeb(*ptr, add);            add++; count--; ptr++;        }        break;      case M_memcpy:        memcpy_toio(add, ptr, count);        break;      default:        return -EINVAL;    }    filp->f_pos += retval;    return retval;}#ifdef __USE_OLD_SELECT__int silly_poll (struct inode *inode, struct file *filp,                  int mode, select_table *table){    return mode==SEL_EX ? 0 : 1; /* readable, writable, not-exceptionable */}#elseunsigned int silly_poll (struct file *filp, poll_table *wait){    return (POLLIN | POLLHUP);}#endif/* * Dropping letters: use the timer queue to drop 10 rows per second. * Put the writing process to sleep, and don't manage more than 1 writer. * * Note that this isn't meant to show how to access the text buffer: * it must *not* be accessed this way. Look at selection.c for information * about the text buffer. */struct wait_queue *jokeq;struct tq_struct silly_task;void silly_timerfn(void *ptr){    unsigned long place = (unsigned long)ptr;    char *ch, *ch2;    static int time;    ch = (char *)(0xb8000 + place*2);  /* two bytes every char-cell */    ch2 = ch + columns * 2;    if (place >= lines*columns || readb(ch) == ' ' || readb(ch2) != ' ') {        /* printk("not good\n"); */        wake_up_interruptible(&jokeq);        return;    }    /* don't do it everytime, only ten times per second */    if (time++ >= HZ/10) {        time = 0;        /* ("in queue: place %4i (%i,%i) -- %x %x\n", place, place%columns,               place/columns, (int)ch, (int)ch2); */        place += columns;        writeb(readb(ch),ch2); writeb(' ',ch); /* down one */        silly_task.data = (void *)place;    }    queue_task(&silly_task, &tq_timer);    return;}    static int silly_joke_write(int count){    int i, j;    unsigned long place;    char *ch, *ch2;        for (i=0; i<count; i++) {        /* choose a place with any algorithm */        place = (unsigned int)(jiffies * 443) % (lines * columns);        for (j=0; j<50; j++) { /* try 50 times */            ch = (char *)(0xb8000 + place*2);            ch2 = ch + 2*columns;            if (readb(ch) == ' ' || readb(ch2) != ' ') {                place *= 331; place %= (lines * columns);                continue;            }            break;        }        silly_task.routine = silly_timerfn;        silly_task.data = (void *)place;        queue_task(&silly_task, &tq_timer);        interruptible_sleep_on(&jokeq);        if (current->signal & ~current->blocked)            return -ERESTARTSYS;    }    return i;}/* * Done, the rest is normal */struct file_operations silly_fops = {    NULL,          /* silly_lseek */    silly_read,    silly_write,    NULL,          /* silly_readdir */    silly_poll,    NULL,          /* silly_ioctl */    NULL,          /* silly_mmap */    silly_open,    silly_release,    NULL,          /* silly_fsync */    NULL,          /* silly_fasync */                   /* nothing more, fill with NULLs */};int init_module(void){    int result = register_chrdev(silly_major, "silly", &silly_fops);    if (result < 0) {        printk(KERN_INFO "silly: can't get major number\n");        return result;    }    if (silly_major == 0) silly_major = result; /* dynamic */    return 0;}void cleanup_module(void){    unregister_chrdev(silly_major, "silly");}#endif /* __386__ */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品香蕉一区二区三区| 国产三级精品视频| 亚洲国产精品一区二区久久| 日本久久电影网| 亚洲一区自拍偷拍| 欧美丰满美乳xxx高潮www| 日本麻豆一区二区三区视频| 日韩欧美精品在线视频| 国产福利一区二区三区视频| 国产精品麻豆欧美日韩ww| 91婷婷韩国欧美一区二区| 亚洲综合在线电影| 欧美一级黄色片| 国产成人精品三级| 一级精品视频在线观看宜春院| 在线91免费看| 国产成+人+日韩+欧美+亚洲| 国产精品久久久久天堂| 在线观看免费视频综合| 蜜桃一区二区三区在线| 国产欧美一区二区精品婷婷| 91免费视频观看| 美女视频黄久久| 国产精品美女久久久久av爽李琼| 色88888久久久久久影院按摩| 日本va欧美va瓶| 国产精品每日更新在线播放网址 | 99久久精品国产毛片| 亚洲精品videosex极品| 日韩视频免费观看高清完整版 | 国产成人精品www牛牛影视| 亚洲色大成网站www久久九九| 3atv在线一区二区三区| 欧美三级视频在线播放| 玖玖九九国产精品| 亚洲日本在线天堂| 欧美成人女星排行榜| 一本大道久久精品懂色aⅴ| 奇米777欧美一区二区| 国产精品拍天天在线| 555夜色666亚洲国产免| eeuss鲁片一区二区三区在线观看| 亚洲一区二区欧美激情| 欧美国产成人精品| 日韩一区二区中文字幕| 色av综合在线| 成人性生交大合| 婷婷丁香激情综合| 亚洲免费视频中文字幕| 久久精品亚洲乱码伦伦中文 | 亚洲人成精品久久久久| 久久一区二区视频| 欧美顶级少妇做爰| 色8久久精品久久久久久蜜 | 国产成人精品免费在线| 麻豆一区二区三| 亚洲第四色夜色| 亚洲乱码国产乱码精品精可以看 | 偷窥少妇高潮呻吟av久久免费| 国产精品久久毛片av大全日韩| 欧美一区二区三区免费| 欧美日韩久久久一区| 精品国产污网站| 69av一区二区三区| 欧美在线免费播放| 色综合天天综合网天天看片| 成人国产精品视频| 国产a精品视频| 国产乱一区二区| 国产一区二区免费在线| 久久国产人妖系列| 男人操女人的视频在线观看欧美| 亚洲一区二区成人在线观看| 亚洲免费观看视频| 亚洲精品高清在线| 一区二区在线观看视频| ...xxx性欧美| 亚洲精品乱码久久久久| 亚洲欧美激情小说另类| 亚洲你懂的在线视频| 亚洲天堂中文字幕| 亚洲免费三区一区二区| 亚洲精品五月天| 亚洲一区二区在线观看视频| 亚洲国产wwwccc36天堂| 亚洲3atv精品一区二区三区| 天天操天天色综合| 免费成人小视频| 黄色成人免费在线| 成人小视频在线| 91色porny在线视频| 欧洲亚洲国产日韩| 正在播放一区二区| 欧美成人综合网站| 国产欧美在线观看一区| 136国产福利精品导航| 伊人夜夜躁av伊人久久| 日韩—二三区免费观看av| 久久精品国产澳门| 成人午夜伦理影院| 91国偷自产一区二区开放时间 | 99久久精品国产一区二区三区| 99久久精品国产观看| 91国内精品野花午夜精品| 56国语精品自产拍在线观看| 欧美精品一区二区三区视频| 国产女主播一区| 一区二区三区成人在线视频| 日韩精品欧美成人高清一区二区| 久久电影网电视剧免费观看| 风流少妇一区二区| 欧美日韩在线精品一区二区三区激情 | 色婷婷综合五月| 欧美日韩视频专区在线播放| 欧美videossexotv100| 国产精品久久久久久久午夜片 | 国产揄拍国内精品对白| 97久久超碰国产精品| 91精品国产综合久久久久久久久久 | 日韩午夜在线观看| 中文字幕一区二区三区精华液 | 久久av中文字幕片| 99re在线精品| 日韩欧美国产电影| 亚洲人成网站在线| 捆绑变态av一区二区三区| www.欧美.com| 精品国产免费一区二区三区四区| 亚洲同性同志一二三专区| 美女脱光内衣内裤视频久久网站| thepron国产精品| 日韩免费观看2025年上映的电影 | 欧美亚洲国产一卡| 国产日产欧美一区二区视频| 亚洲成人久久影院| 成人18精品视频| 日韩美女视频在线| 亚洲图片欧美色图| 北条麻妃国产九九精品视频| 日韩免费成人网| 亚洲国产精品精华液网站| 波多野结衣在线aⅴ中文字幕不卡| 欧美一区二区三区免费观看视频| 亚洲黄网站在线观看| 国产宾馆实践打屁股91| 欧美刺激脚交jootjob| 亚洲国产精品尤物yw在线观看| 国产91露脸合集magnet| 日韩你懂的在线观看| 亚洲观看高清完整版在线观看| www.av亚洲| 亚洲国产综合色| 91麻豆swag| 亚洲男女一区二区三区| av高清不卡在线| 欧美激情中文不卡| 国产精品一区二区三区99| 日韩欧美色综合| 日韩成人av影视| 欧美日韩免费视频| 亚洲午夜三级在线| 欧美在线观看视频在线| 亚洲欧美激情视频在线观看一区二区三区| 国产91露脸合集magnet| 国产无一区二区| 国产aⅴ精品一区二区三区色成熟| 精品三级在线观看| 麻豆国产精品777777在线| 日韩一二三区不卡| 麻豆精品视频在线观看视频| 日韩三级免费观看| 久久99精品久久久久久久久久久久| 欧美一二区视频| 久久精品国产精品青草| 久久看人人爽人人| 国产美女久久久久| 国产农村妇女毛片精品久久麻豆| 国产精品系列在线观看| 中文字幕精品三区| av高清久久久| 亚洲欧美日韩国产成人精品影院 | 蜜臀av一区二区| 2014亚洲片线观看视频免费| 国内精品视频666| 中文字幕精品一区| 色av成人天堂桃色av| 日韩精品国产精品| 精品精品国产高清一毛片一天堂| 国产呦精品一区二区三区网站| 欧美精彩视频一区二区三区| 99视频超级精品| 亚洲成人动漫在线免费观看| 日韩欧美在线1卡| 国产精品1区2区3区| 亚洲品质自拍视频网站| 欧美精品乱码久久久久久按摩| 久久国产精品第一页| 国产精品久久久久久久久搜平片 | 91麻豆精品国产91| 国产一区二区不卡在线|