Changeset 20

Show
Ignore:
Timestamp:
11/12/05 13:21:36 (6 years ago)
Author:
dkaplan1
Message:

Regression tests passed
Fixed printk implementation
Added lots of callgates to support rtc.c
rtc.c is UNTESTED
Added calldriver calls in for /proc support and for timers
Also added possibility of calling driver method asynchronously

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • arch/i386/kernel/callgate.c

    r18 r20  
    7373void callgate_entry4(int oldcs, unsigned long func, unsigned long param1, unsigned long param2, unsigned long param3); 
    7474void callgate_entry5(int oldcs, unsigned long func, unsigned long param1, unsigned long param2, unsigned long param3, unsigned long param4); 
     75void callgate_entry6(int oldcs, unsigned long func, unsigned long param1, unsigned long param2, unsigned long param3, unsigned long param4, unsigned long p5); 
    7576void callgate_entry10(int olcs, unsigned long param1,  
    7677                                unsigned long param2, 
     
    8384                                unsigned long param9, 
    8485                                unsigned long param10); 
     86 
     87void callgate_entry15(int olcs, unsigned long param1,  
     88                                unsigned long param2, 
     89                                unsigned long param3, 
     90                                unsigned long param4, 
     91                                unsigned long param5, 
     92                                unsigned long param6, 
     93                                unsigned long param7, 
     94                                unsigned long param8, 
     95                                unsigned long param9, 
     96                                unsigned long param10, 
     97                                unsigned long param11, 
     98                                unsigned long param12, 
     99                                unsigned long param13, 
     100                                unsigned long param14, 
     101                                unsigned long param15); 
     102struct task_struct *mod_get_current(void) { 
     103    struct task_struct *tsk=current; 
     104    if (tsk->currentmapped) 
     105        return tsk->currentaddr; 
     106    tsk->currentaddr=(struct task_struct*) map_struct(tsk, sizeof(*tsk), tsk->ring, &tsk->origcurrentaddr); 
     107    tsk->currentmapped=1; 
     108    return tsk->currentaddr; 
     109} 
     110 
    85111__asm__("callgate_entry2:" 
    86112        "pushl %ebp\n\t" 
     
    90116        "pushl 16(%ebp)\n\t" 
    91117        "decl %ecx\n\t" 
    92         "cmpl $5, %ecx\n\t" 
     118        "cmpl $7, %ecx\n\t" 
    93119        "ja done2\n\t" 
    94120        "call *callgate_table2(,%ecx,4)\n\t" 
     
    97123        "leave\n\t" 
    98124        "lret $8\n\t" 
    99         "callgate_table2: .long driver_printdiag, do_exit, driver_exit, misc_register, misc_deregister
     125        "callgate_table2: .long driver_printdiag, do_exit, driver_exit, misc_register, misc_deregister, unregister_sysctl_table, del_timer
    100126); 
    101127 
     
    109135        "pushl 16(%ebp)\n\t" 
    110136        "decl %ecx\n\t" 
    111         "cmpl $5, %ecx\n\t" 
     137        "cmpl $7, %ecx\n\t" 
    112138        "ja done4\n\t" 
    113139        "call *callgate_table4(,%ecx,4)\n\t" 
     
    116142        "leave\n\t" 
    117143        "lret $16\n\t" 
    118         "callgate_table4: .long register_chrdev, copy_from_user, copy_to_user, no_llseek, mod_request_region, mod_request_mem_region
     144        "callgate_table4: .long register_chrdev, copy_from_user, copy_to_user, no_llseek, mod_request_region, mod_request_mem_region, kill_fasync, mod_poll_wait
    119145); 
    120146 
     
    129155        "pushl 16(%ebp)\n\t" 
    130156        "decl %ecx\n\t" 
    131         "cmpl $-1, %ecx\n\t" 
     157        "cmpl $1, %ecx\n\t" 
    132158        "ja done5\n\t" 
    133159        "call *callgate_table5(,%ecx,4)\n\t" 
     
    136162        "leave\n\t" 
    137163        "lret $20\n\t" 
    138         "callgate_table5: .long 0" 
     164        "callgate_table5: .long __wake_up, fasync_helper" 
     165); 
     166 
     167__asm__("callgate_entry6:" 
     168        "pushl %ebp\n\t" 
     169        "movl %esp, %ebp\n\t" 
     170        SAVE_SEG 
     171        "movl 12(%ebp), %ecx\n\t" 
     172        "pushl 32(%ebp)\n\t" 
     173        "pushl 28(%ebp)\n\t" 
     174        "pushl 24(%ebp)\n\t" 
     175        "pushl 20(%ebp)\n\t" 
     176        "pushl 16(%ebp)\n\t" 
     177        "decl %ecx\n\t" 
     178        "cmpl $1, %ecx\n\t" 
     179        "ja done6\n\t" 
     180        "call *callgate_table6(,%ecx,4)\n\t" 
     181        "done6: addl $20, %esp\n\t" 
     182        RESTORE_SEG 
     183        "leave\n\t" 
     184        "lret $24\n\t" 
     185        "callgate_table6: .long request_irq, mod_create_proc_read_entry" 
    139186); 
    140187__asm__("callgate_entry1:" 
     
    144191        "movl 12(%ebp), %ecx\n\t" 
    145192        "decl %ecx\n\t" 
    146         "cmpl $0, %ecx\n\t" 
     193        "cmpl $2, %ecx\n\t" 
    147194        "ja done1\n\t" 
    148195        "call *callgate_table1(,%ecx,4)\n\t" 
     
    151198        "leave\n\t" 
    152199        "lret $4\n\t" 
    153         "callgate_table1: .long
     200        "callgate_table1: .long mod_get_current, mod_schedule, mod_get_jiffies
    154201); 
    155202 
     
    163210        "pushl 16(%ebp)\n\t" 
    164211        "decl %ecx\n\t" 
    165         "cmpl $1, %ecx\n\t" 
     212        "cmpl $8, %ecx\n\t" 
    166213        "ja done3\n\t" 
    167214        "call *callgate_table3(,%ecx,4)\n\t" 
     
    170217        "leave\n\t" 
    171218        "lret $12\n\t" 
    172         "callgate_table3: .long mod_release_region, mod_release_mem_region
     219        "callgate_table3: .long mod_release_region, mod_release_mem_region, register_sysctl_table, mod_timer, __mod_timer, add_wait_queue, remove_wait_queue, free_irq, remove_proc_entry
    173220); 
    174221 
     
    188235        "pushl 16(%ebp)\n\t" 
    189236        "decl %ecx\n\t" 
    190         "cmpl $1, %ecx\n\t" 
     237        "cmpl $0, %ecx\n\t" 
    191238        "ja done10\n\t" 
    192239        "call *callgate_table10(,%ecx,4)\n\t" 
     
    198245); 
    199246 
     247 
     248__asm__("callgate_entry15:" 
     249        "pushl %ebp\n\t" 
     250        "movl %esp, %ebp\n\t" 
     251        SAVE_SEG 
     252        "movl 12(%ebp), %ecx\n\t" 
     253        "pushl 68(%ebp)\n\t" 
     254        "pushl 64(%ebp)\n\t" 
     255        "pushl 60(%ebp)\n\t" 
     256        "pushl 56(%ebp)\n\t" 
     257        "pushl 52(%ebp)\n\t" 
     258        "pushl 48(%ebp)\n\t" 
     259        "pushl 44(%ebp)\n\t" 
     260        "pushl 40(%ebp)\n\t" 
     261        "pushl 36(%ebp)\n\t" 
     262        "pushl 32(%ebp)\n\t" 
     263        "pushl 28(%ebp)\n\t" 
     264        "pushl 24(%ebp)\n\t" 
     265        "pushl 20(%ebp)\n\t" 
     266        "pushl 16(%ebp)\n\t" 
     267        "decl %ecx\n\t" 
     268        "cmpl $0, %ecx\n\t" 
     269        "ja done15\n\t" 
     270        "call *callgate_table15(,%ecx,4)\n\t" 
     271        "done15: addl $56, %esp\n\t" 
     272        RESTORE_SEG 
     273        "leave\n\t" 
     274        "lret $60\n\t" 
     275        "callgate_table15: .long sprintf" 
     276); 
    200277 
    201278 
     
    241318    create_callgate((unsigned long) callgate_entry4, 2, 4); 
    242319    create_callgate((unsigned long) callgate_entry5, 2, 5); 
     320    create_callgate((unsigned long) callgate_entry6, 2, 6); 
     321    create_callgate((unsigned long) callgate_entry15, 2, 15); 
    243322} 
    244323 
     
    252331    int i; 
    253332    void * origmems[argc]; 
    254     if (in_interrupt()
     333    if (in_interrupt() && !(ptrbitmap & NO_WAIT)
    255334    { 
    256335        printk(KERN_ERR "Cannot call driver code from interrupt handler\n"); 
     
    291370        tsk->active_mm=mm; 
    292371    } 
     372 
     373    //Set capabilities basedo on who called us 
     374    tsk->cap_effective=current->cap_effective; 
    293375 
    294376    //Set new state for thread 
     
    331413    }*/ 
    332414    wake_up_process(tsk); 
    333     interruptible_sleep_on(&tsk->wait_driverfinish); 
    334     //Free any memory we allocated 
    335     for (i=0; i<argc; i++) { 
    336         if (addrs[i]) { 
    337             ClearPageReserved(pfn_to_page(__pa(argv[i]) >> PAGE_SHIFT)); 
    338             vunmap(origmems[i]); 
     415    if (!(ptrbitmap & NO_WAIT)) { 
     416        tsk->bytes_to_pop=0; 
     417        interruptible_sleep_on(&tsk->wait_driverfinish); 
     418        //Free any memory we allocated 
     419        for (i=0; i<argc; i++) { 
     420            if (addrs[i]) { 
     421                ClearPageReserved(pfn_to_page(__pa(argv[i]) >> PAGE_SHIFT)); 
     422                vunmap(origmems[i]); 
     423            } 
     424            regs->esp+=4; 
    339425        } 
    340         regs->esp+=4; 
    341     } 
    342     return tsk->exit_code; 
     426        return tsk->exit_code; 
     427    } else { 
     428        tsk->bytes_to_pop=argc*4; 
     429        return 0; 
     430    } 
    343431} 
    344432 
  • arch/i386/kernel/process.c

    r16 r20  
    387387  else 
    388388      BUG(); 
    389   stack_start=(unsigned char*) orig_stack + 8152; //leave 40 bytes empty 
     389  stack_start=(unsigned char*) orig_stack + 8112; //leave 80 bytes empty 
    390390        regs.orig_eax = -1; 
    391391   
     
    398398  find_task_by_pid(pid)->orig_stack=orig_stack; 
    399399  find_task_by_pid(pid)->available=0; 
     400  find_task_by_pid(pid)->currentmapped=0; 
    400401  return pid; 
    401402} 
  • .config

    r14 r20  
    615615CONFIG_HW_RANDOM=y 
    616616# CONFIG_NVRAM is not set 
    617 CONFIG_RTC=y 
     617# CONFIG_RTC is not set 
     618# CONFIG_GEN_RTC is not set 
    618619# CONFIG_DTLK is not set 
    619620# CONFIG_R3964 is not set 
  • .config.old

    r13 r20  
    105105# CONFIG_TOSHIBA is not set 
    106106# CONFIG_I8K is not set 
    107 CONFIG_MICROCODE=m 
    108 CONFIG_X86_MSR=m 
    109 CONFIG_X86_CPUID=m 
     107# CONFIG_MICROCODE is not set 
     108# CONFIG_X86_MSR is not set 
     109# CONFIG_X86_CPUID is not set 
    110110 
    111111# 
     
    168168# 
    169169CONFIG_BINFMT_ELF=y 
    170 CONFIG_BINFMT_AOUT=m 
    171 CONFIG_BINFMT_MISC=m 
     170# CONFIG_BINFMT_AOUT is not set 
     171# CONFIG_BINFMT_MISC is not set 
    172172 
    173173# 
     
    178178# Generic Driver Options 
    179179# 
    180 CONFIG_FW_LOADER=m 
     180# CONFIG_FW_LOADER is not set 
    181181# CONFIG_DEBUG_DRIVER is not set 
    182182 
     
    299299# SCSI Transport Attributes 
    300300# 
    301 CONFIG_SCSI_SPI_ATTRS=m 
     301CONFIG_SCSI_SPI_ATTRS=y 
    302302# CONFIG_SCSI_FC_ATTRS is not set 
    303303 
     
    308308# CONFIG_SCSI_ACARD is not set 
    309309# CONFIG_SCSI_AACRAID is not set 
    310 CONFIG_SCSI_AIC7XXX=m 
    311 CONFIG_AIC7XXX_CMDS_PER_DEVICE=8 
    312 CONFIG_AIC7XXX_RESET_DELAY_MS=15000 
    313 # CONFIG_AIC7XXX_BUILD_FIRMWARE is not set 
    314 # CONFIG_AIC7XXX_DEBUG_ENABLE is not set 
    315 CONFIG_AIC7XXX_DEBUG_MASK=0 
    316 # CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set 
     310# CONFIG_SCSI_AIC7XXX is not set 
    317311# CONFIG_SCSI_AIC7XXX_OLD is not set 
    318312# CONFIG_SCSI_AIC79XX is not set 
    319 CONFIG_SCSI_DPT_I2O=m 
     313# CONFIG_SCSI_DPT_I2O is not set 
    320314# CONFIG_SCSI_ADVANSYS is not set 
    321 CONFIG_SCSI_MEGARAID=m 
     315# CONFIG_SCSI_MEGARAID is not set 
    322316# CONFIG_SCSI_SATA is not set 
    323 CONFIG_SCSI_BUSLOGIC=m 
    324 # CONFIG_SCSI_OMIT_FLASHPOINT is not set 
     317# CONFIG_SCSI_BUSLOGIC is not set 
    325318# CONFIG_SCSI_DMX3191D is not set 
    326319# CONFIG_SCSI_EATA is not set 
     
    330323# CONFIG_SCSI_IPS is not set 
    331324# CONFIG_SCSI_INIA100 is not set 
    332 CONFIG_SCSI_SYM53C8XX_2=m 
    333 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 
    334 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 
    335 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 
    336 # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 
     325# CONFIG_SCSI_SYM53C8XX_2 is not set 
    337326# CONFIG_SCSI_IPR is not set 
    338327# CONFIG_SCSI_QLOGIC_ISP is not set 
     
    384373CONFIG_PACKET=y 
    385374CONFIG_PACKET_MMAP=y 
    386 CONFIG_NETLINK_DEV=m 
     375# CONFIG_NETLINK_DEV is not set 
    387376CONFIG_UNIX=y 
    388 CONFIG_NET_KEY=m 
     377# CONFIG_NET_KEY is not set 
    389378CONFIG_INET=y 
    390379CONFIG_IP_MULTICAST=y 
    391380# CONFIG_IP_ADVANCED_ROUTER is not set 
    392381# CONFIG_IP_PNP is not set 
    393 CONFIG_NET_IPIP=m 
    394 CONFIG_NET_IPGRE=m 
    395 CONFIG_NET_IPGRE_BROADCAST=y 
     382# CONFIG_NET_IPIP is not set 
     383# CONFIG_NET_IPGRE is not set 
    396384# CONFIG_IP_MROUTE is not set 
    397385# CONFIG_ARPD is not set 
    398386CONFIG_SYN_COOKIES=y 
    399 CONFIG_INET_AH=m 
    400 CONFIG_INET_ESP=m 
    401 CONFIG_INET_IPCOMP=m 
     387# CONFIG_INET_AH is not set 
     388# CONFIG_INET_ESP is not set 
     389# CONFIG_INET_IPCOMP is not set 
    402390 
    403391# 
     
    412400# IP: Netfilter Configuration 
    413401# 
    414 CONFIG_IP_NF_CONNTRACK=m 
    415 CONFIG_IP_NF_FTP=m 
    416 CONFIG_IP_NF_IRC=m 
    417 # CONFIG_IP_NF_TFTP is not set 
    418 # CONFIG_IP_NF_AMANDA is not set 
    419 CONFIG_IP_NF_QUEUE=m 
    420 CONFIG_IP_NF_IPTABLES=m 
    421 CONFIG_IP_NF_MATCH_LIMIT=m 
    422 # CONFIG_IP_NF_MATCH_IPRANGE is not set 
    423 CONFIG_IP_NF_MATCH_MAC=m 
    424 # CONFIG_IP_NF_MATCH_PKTTYPE is not set 
    425 CONFIG_IP_NF_MATCH_MARK=m 
    426 CONFIG_IP_NF_MATCH_MULTIPORT=m 
    427 CONFIG_IP_NF_MATCH_TOS=m 
    428 # CONFIG_IP_NF_MATCH_RECENT is not set 
    429 # CONFIG_IP_NF_MATCH_ECN is not set 
    430 # CONFIG_IP_NF_MATCH_DSCP is not set 
    431 CONFIG_IP_NF_MATCH_AH_ESP=m 
    432 CONFIG_IP_NF_MATCH_LENGTH=m 
    433 CONFIG_IP_NF_MATCH_TTL=m 
    434 CONFIG_IP_NF_MATCH_TCPMSS=m 
    435 # CONFIG_IP_NF_MATCH_HELPER is not set 
    436 CONFIG_IP_NF_MATCH_STATE=m 
    437 # CONFIG_IP_NF_MATCH_CONNTRACK is not set 
    438 CONFIG_IP_NF_MATCH_OWNER=m 
    439 CONFIG_IP_NF_FILTER=m 
    440 CONFIG_IP_NF_TARGET_REJECT=m 
    441 CONFIG_IP_NF_NAT=m 
    442 CONFIG_IP_NF_NAT_NEEDED=y 
    443 CONFIG_IP_NF_TARGET_MASQUERADE=m 
    444 CONFIG_IP_NF_TARGET_REDIRECT=m 
    445 # CONFIG_IP_NF_TARGET_NETMAP is not set 
    446 # CONFIG_IP_NF_TARGET_SAME is not set 
    447 # CONFIG_IP_NF_NAT_LOCAL is not set 
    448 CONFIG_IP_NF_NAT_SNMP_BASIC=m 
    449 CONFIG_IP_NF_NAT_IRC=m 
    450 CONFIG_IP_NF_NAT_FTP=m 
    451 CONFIG_IP_NF_MANGLE=m 
    452 CONFIG_IP_NF_TARGET_TOS=m 
    453 # CONFIG_IP_NF_TARGET_ECN is not set 
    454 # CONFIG_IP_NF_TARGET_DSCP is not set 
    455 CONFIG_IP_NF_TARGET_MARK=m 
    456 # CONFIG_IP_NF_TARGET_CLASSIFY is not set 
    457 CONFIG_IP_NF_TARGET_LOG=m 
    458 CONFIG_IP_NF_TARGET_ULOG=m 
    459 CONFIG_IP_NF_TARGET_TCPMSS=m 
    460 CONFIG_IP_NF_ARPTABLES=m 
    461 CONFIG_IP_NF_ARPFILTER=m 
    462 CONFIG_IP_NF_ARP_MANGLE=m 
     402# CONFIG_IP_NF_CONNTRACK is not set 
     403# CONFIG_IP_NF_QUEUE is not set 
     404# CONFIG_IP_NF_IPTABLES is not set 
     405# CONFIG_IP_NF_ARPTABLES is not set 
    463406# CONFIG_IP_NF_COMPAT_IPCHAINS is not set 
    464407# CONFIG_IP_NF_COMPAT_IPFWADM is not set 
    465 # CONFIG_IP_NF_RAW is not set 
    466 CONFIG_XFRM=y 
    467 # CONFIG_XFRM_USER is not set 
    468408 
    469409# 
     
    505445# CONFIG_EQUALIZER is not set 
    506446# CONFIG_TUN is not set 
    507 # CONFIG_ETHERTAP is not set 
    508447 
    509448# 
     
    611550CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 
    612551CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 
    613 CONFIG_INPUT_JOYDEV=m 
     552# CONFIG_INPUT_JOYDEV is not set 
    614553# CONFIG_INPUT_TSDEV is not set 
    615 CONFIG_INPUT_EVDEV=m 
     554# CONFIG_INPUT_EVDEV is not set 
    616555# CONFIG_INPUT_EVBUG is not set 
    617556 
     
    675614# CONFIG_WATCHDOG is not set 
    676615CONFIG_HW_RANDOM=y 
    677 CONFIG_NVRAM=m 
     616# CONFIG_NVRAM is not set 
    678617CONFIG_RTC=y 
    679618# CONFIG_DTLK is not set 
     
    851790# CONFIG_JFS_FS is not set 
    852791CONFIG_FS_POSIX_ACL=y 
    853 CONFIG_XFS_FS=y 
    854 # CONFIG_XFS_RT is not set 
    855 CONFIG_XFS_QUOTA=y 
    856 # CONFIG_XFS_SECURITY is not set 
    857 CONFIG_XFS_POSIX_ACL=y 
     792# CONFIG_XFS_FS is not set 
    858793# CONFIG_MINIX_FS is not set 
    859794# CONFIG_ROMFS_FS is not set 
     
    930865CONFIG_NLS=y 
    931866CONFIG_NLS_DEFAULT="cp437" 
    932 CONFIG_NLS_CODEPAGE_437=m 
     867# CONFIG_NLS_CODEPAGE_437 is not set 
    933868# CONFIG_NLS_CODEPAGE_737 is not set 
    934869# CONFIG_NLS_CODEPAGE_775 is not set 
     
    953888# CONFIG_NLS_CODEPAGE_1250 is not set 
    954889# CONFIG_NLS_CODEPAGE_1251 is not set 
    955 CONFIG_NLS_ISO8859_1=m 
     890# CONFIG_NLS_ISO8859_1 is not set 
    956891# CONFIG_NLS_ISO8859_2 is not set 
    957892# CONFIG_NLS_ISO8859_3 is not set 
     
    966901# CONFIG_NLS_KOI8_R is not set 
    967902# CONFIG_NLS_KOI8_U is not set 
    968 CONFIG_NLS_UTF8=m 
     903# CONFIG_NLS_UTF8 is not set 
    969904 
    970905# 
     
    1017952# CONFIG_CRYPTO_NULL is not set 
    1018953# CONFIG_CRYPTO_MD4 is not set 
    1019 CONFIG_CRYPTO_MD5=m 
    1020 CONFIG_CRYPTO_SHA1=m 
     954# CONFIG_CRYPTO_MD5 is not set 
     955# CONFIG_CRYPTO_SHA1 is not set 
    1021956# CONFIG_CRYPTO_SHA256 is not set 
    1022957# CONFIG_CRYPTO_SHA512 is not set 
    1023 CONFIG_CRYPTO_DES=m 
     958# CONFIG_CRYPTO_DES is not set 
    1024959# CONFIG_CRYPTO_BLOWFISH is not set 
    1025960# CONFIG_CRYPTO_TWOFISH is not set 
     
    1029964# CONFIG_CRYPTO_CAST6 is not set 
    1030965# CONFIG_CRYPTO_ARC4 is not set 
    1031 CONFIG_CRYPTO_DEFLATE=m 
     966# CONFIG_CRYPTO_DEFLATE is not set 
    1032967# CONFIG_CRYPTO_MICHAEL_MIC is not set 
    1033968# CONFIG_CRYPTO_CRC32C is not set 
     
    1040975# CONFIG_LIBCRC32C is not set 
    1041976CONFIG_ZLIB_INFLATE=y 
    1042 CONFIG_ZLIB_DEFLATE=m 
    1043977CONFIG_X86_BIOS_REBOOT=y 
    1044978CONFIG_X86_STD_RESOURCES=y 
  • fs/proc/generic.c

    r1 r20  
    116116                         *    absorbed. 
    117117                         */ 
    118                         n = dp->read_proc(page, &start, *ppos, 
    119                                           count, &eof, dp->data); 
     118        if ((unsigned long) dp->read_proc > PAGE_OFFSET) { 
     119            n = dp->read_proc(page, &start, *ppos, 
     120                    count, &eof, dp->data); 
     121        } else { 
     122            unsigned long args[6]={(unsigned long) page, (unsigned long) &start, (unsigned long) *ppos, (unsigned long) count, (unsigned long) &eof, (unsigned long) dp->data}; 
     123            n=calldriver((unsigned long) dp->read_proc, args, 6, current->mm, 19); 
     124        } 
    120125                } else 
    121126                        break; 
     
    613618} 
    614619 
     620struct proc_dir_entry *mod_create_proc_read_entry(const char *name, unsigned long mode, 
     621        struct proc_dir_entry *base, read_proc_t *read_proc, void *data) 
     622{ 
     623    return create_proc_read_entry(name, (mode_t) mode, base, read_proc, data); 
     624} 
     625 
    615626struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 
    616627                                         struct proc_dir_entry *parent) 
  • fs/select.c

    r1 r20  
    8686 
    8787EXPORT_SYMBOL(poll_freewait); 
     88 
     89//NEW FOR RING CYCLE 
     90void mod_poll_wait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p) 
     91{ 
     92    poll_wait(filp, wait_address, p); 
     93} 
     94 
    8895 
    8996void __pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *_p) 
  • include/asm-i386/callgate.h

    r18 r20  
    2525extern int calldriver(unsigned long addr, unsigned long *argv, int argc, struct mm_struct *mm, unsigned long ptrbitmap); 
    2626extern unsigned long map_struct(void *kernel_struct, unsigned long size, int ring, void **origmem); 
    27 //flags for calldriver 
    28 #define DO_EXIT 0x1 
     27 
     28//FLAGS for calldriver 
     29#define NO_WAIT 0x80000000 
    2930 
    3031/* So here's what going on: 
     
    3435 */ 
    3536 
     37//0 parameter functions 
     38#define CALLGATE_mod_get_current "pushl $1\n\t" 
     39#define CALLGATE_schedule "pushl $2\n\t" 
     40#define CALLGATE_mod_get_jiffies "pushl $3\n\t" 
    3641//1 parameter functions 
    3742#define CALLGATE_DRIVERPRINTDIAG "pushl $1\n\t" 
     
    4045#define CALLGATE_misc_register "pushl $4\n\t" 
    4146#define CALLGATE_misc_deregister "pushl $5\n\t" 
     47#define CALLGATE_unregister_sysctl_table "pushl $6\n\t" 
     48#define CALLGATE_del_timer "pushl $7\n\t" 
    4249 
    4350//2 parameter functions 
    4451#define CALLGATE_release_region "pushl $1\n\t" 
    4552#define CALLGATE_release_mem_region "pushl $2\n\t" 
    46  
     53#define CALLGATE_register_sysctl_table "pushl $3\n\t" 
     54#define CALLGATE_mod_timer "pushl $4\n\t" 
     55#define CALLGATE___mod_timer "pushl $5\n\t" 
     56#define CALLGATE_add_wait_queue "pushl $6\n\t" 
     57#define CALLGATE_remove_wait_queue "pushl $7\n\t" 
     58#define CALLGATE_free_irq "pushl $8\n\t" 
     59#define CALLGATE_remove_proc_entry "pushl $9\n\t" 
    4760//3 parameter functions 
    4861#define CALLGATE_REGISTERCHRDEV "pushl $1\n\t" 
     
    5265#define CALLGATE_request_region "pushl $5\n\t" 
    5366#define CALLGATE_request_mem_region "pushl $6\n\t" 
     67#define CALLGATE_kill_fasync "pushl $7\n\t" 
     68#define CALLGATE_pollwait "pushl $8\n\t" 
    5469//4 parameter functions 
    55 #define CALLGATE___request_region "pushl $1\n\t" 
     70#define CALLGATE___wake_up "pushl $1\n\t" 
     71#define CALLGATE_fasync_helper "pushl $2\n\t" 
     72//#define CALLGATE___request_region "pushl $1\n\t" 
     73 
     74//5 parameter functions 
     75#define CALLGATE_request_irq "pushl $1\n\t" 
     76#define CALLGATE_create_proc_read_entry "pushl $2\n\t" 
    5677//10 parameter functions 
    5778#define CALLGATE_printk "pushl $1\n\t" 
    58  
     79//15 parameter functions 
     80#define CALLGATE_sprintf "pushl $1\n\t" 
    5981#endif 
  • include/asm-i386/current.h

    r1 r20  
    1010        return current_thread_info()->task; 
    1111} 
    12   
     12 
     13extern struct task_struct * mod_get_current(void); 
     14#ifndef MODULE 
    1315#define current get_current() 
    14  
     16#endif 
     17#ifdef MODULE 
     18#define current mod_get_current() 
     19#endif 
    1520#endif /* !(_I386_CURRENT_H) */ 
  • include/asm-i386/dapi.h

    r18 r20  
    55#include <asm-generic/errno-base.h> 
    66 
     7#define make_wrap0(func, ret) \ 
     8    static inline ret func ( void ) { \ 
     9        ret myret;  \ 
     10        asm volatile (  CALLGATE_ ## func  \ 
     11                        LCALL1       \ 
     12                : "=a"(myret));  \ 
     13        return myret;  \ 
     14    } 
    715#define make_wrap1(func, ret, type1) \ 
    816    static inline ret func ( type1 param1 ) { \ 
    917        ret myret;  \ 
    10         asm volatile ("pushl %0\n\t"   \ 
     18        asm volatile ("pushl %1\n\t"   \ 
    1119                CALLGATE_ ## func  \ 
    1220                LCALL1       \ 
    13                 : "=a"(myret) : "r"(param1));  \ 
     21                : "=a"(myret) : "g"(param1));  \ 
    1422        return myret;  \ 
    1523    } 
     
    1927    static inline ret func ( type1 param1 , type2 param2 ) { \ 
    2028        ret myret;  \ 
    21         asm volatile ("pushl %%eax\n\t"   \ 
    22                 "pushl %%ebx\n\t" \ 
     29        asm volatile ("pushl %1\n\t"   \ 
     30                "pushl %2\n\t" \ 
    2331                CALLGATE_ ## func  \ 
    2432                LCALL2       \ 
    25                 : "=a"(myret) : "a"(param2), "b"(param1));  \ 
     33                : "=a"(myret) : "g"(param2), "g"(param1));  \ 
    2634        return myret;  \ 
    2735    } 
     
    3139    static inline ret func ( type1 param1 , type2 param2, type3 param3 ) { \ 
    3240        ret myret;  \ 
    33         asm volatile ("pushl %%eax\n\t"   \ 
    34                 "pushl %%ebx\n\t" \ 
    35                 "pushl %%ecx\n\t" \ 
     41        asm volatile ("pushl %1\n\t"   \ 
     42                "pushl %2\n\t" \ 
     43                "pushl %3\n\t" \ 
    3644                CALLGATE_ ## func  \ 
    3745                LCALL3       \ 
    38                 : "=a"(myret) : "a"(param3), "b"(param2), "c"(param1));  \ 
     46                : "=a"(myret) : "g"(param3), "g"(param2), "g"(param1));  \ 
    3947        return myret;  \ 
    4048    } 
     
    4452    static inline ret func ( type1 param1 , type2 param2, type3 param3, type4 param4 ) { \ 
    4553        ret myret;  \ 
     54        asm volatile ("pushl %1\n\t"   \ 
     55                "pushl %2\n\t" \ 
     56                "pushl %3\n\t" \ 
     57                "pushl %4\n\t" \ 
     58                CALLGATE_ ## func  \ 
     59                LCALL4       \ 
     60                : "=a"(myret) : "g"(param4), "g"(param3), "g"(param2), "g"(param1));  \ 
     61        return myret;  \ 
     62    } 
     63 
     64#define make_wrap5(func, ret, type1, type2, type3, type4, type5) \ 
     65    static inline ret func ( type1 param1 , type2 param2, type3 param3, type4 param4, type5 param5 ) { \ 
     66        ret myret;  \ 
     67        asm volatile ("pushl %1\n\t"   \ 
     68                "pushl %2\n\t" \ 
     69                "pushl %3\n\t" \ 
     70                "pushl %4\n\t" \ 
     71                "pushl %5\n\t" \ 
     72                CALLGATE_ ## func  \ 
     73                LCALL5       \ 
     74                : "=a"(myret) : "m"(param5), "m"(param4), "m"(param3), "m"(param2), "m"(param1));  \ 
     75        return myret;  \ 
     76    } 
     77#define make_void_wrap0(func) \ 
     78    static inline void func ( void ) { \ 
     79        asm volatile (  CALLGATE_ ## func  \ 
     80                        LCALL1       \ 
     81                );  \ 
     82    } 
     83#define make_void_wrap1(func, type1) \ 
     84    static inline void func ( type1 param1 ) { \ 
     85        asm volatile ("pushl %0\n\t"   \ 
     86                CALLGATE_ ## func  \ 
     87                LCALL1       \ 
     88                :  : "g"(param1));  \ 
     89    } 
     90 
     91 
     92#define make_void_wrap2(func, type1, type2) \ 
     93    static inline void func ( type1 param1 , type2 param2 ) { \ 
    4694        asm volatile ("pushl %0\n\t"   \ 
    4795                "pushl %1\n\t" \ 
     96                CALLGATE_ ## func  \ 
     97                LCALL2       \ 
     98                :  : "g"(param2), "g"(param1));  \ 
     99    } 
     100 
     101 
     102#define make_void_wrap3(func, type1, type2, type3) \ 
     103    static inline void func ( type1 param1 , type2 param2, type3 param3 ) { \ 
     104        asm volatile ("pushl %0\n\t"   \ 
     105                "pushl %1\n\t" \ 
     106                "pushl %2\n\t" \ 
     107                CALLGATE_ ## func  \ 
     108                LCALL3       \ 
     109                : : "g"(param3), "g"(param2), "g"(param1));  \ 
     110    } 
     111 
     112 
     113#define make_void_wrap4(func, type1, type2, type3, type4) \ 
     114    static inline void func ( type1 param1 , type2 param2, type3 param3, type4 param4 ) { \ 
     115        asm volatile ("pushl %0\n\t"   \ 
     116                "pushl %1\n\t" \ 
    48117                "pushl %2\n\t" \ 
    49118                "pushl %3\n\t" \ 
    50119                CALLGATE_ ## func  \ 
    51120                LCALL4       \ 
    52                 : "=a"(myret) : "r"(param4), "r"(param3), "r"(param2), "r"(param1));  \ 
    53         return myret;  \ 
     121                :  : "g"(param4), "g"(param3), "g"(param2), "g"(param1));  \ 
    54122    } 
    55123#define make_wrap10(func, ret, type1, ... ) \ 
    56124    static ret func (type1 param1, ... ) { \ 
    57125        ret myret;  \ 
    58         asm (    "pushl %%ebp\n\t" \ 
     126        asm volatile (    "pushl %%ebp\n\t" \ 
    59127                "movl %%esp, %%ebp\n\t" \ 
    60                 "pushl %0\n\t"   \ 
     128                "pushl 44(%%ebp)\n\t" \ 
     129                "pushl 40(%%ebp)\n\t" \ 
    61130                "pushl 36(%%ebp)\n\t" \ 
    62131                "pushl 32(%%ebp)\n\t" \ 
     
    66135                "pushl 16(%%ebp)\n\t" \ 
    67136                "pushl 12(%%ebp)\n\t" \ 
    68                 "pushl 8(%%ebp)\n\t" \ 
    69137                CALLGATE_ ## func  \ 
    70138                LCALL10       \ 
    71139                "leave\n\t"   \ 
    72                 : "=a"(myret) : "r"(param1));  \ 
    73         return myret;  \ 
    74     } 
    75  
     140                : "=a"(myret));  \ 
     141        return myret;  \ 
     142    } 
     143 
     144#define make_wrap15(func, ret, type1, type2,... ) \ 
     145    static ret func (type1 param1, type2 param2, ... ) { \ 
     146        ret myret;  \ 
     147        asm (    "pushl %%ebp\n\t" \ 
     148                "movl %%esp, %%ebp\n\t" \ 
     149                "pushl 64(%%ebp)\n\t" \ 
     150                "pushl 60(%%ebp)\n\t" \ 
     151                "pushl 56(%%ebp)\n\t" \ 
     152                "pushl 52(%%ebp)\n\t" \ 
     153                "pushl 48(%%ebp)\n\t" \ 
     154                "pushl 44(%%ebp)\n\t" \ 
     155                "pushl 40(%%ebp)\n\t" \ 
     156                "pushl 36(%%ebp)\n\t" \ 
     157                "pushl 32(%%ebp)\n\t" \ 
     158                "pushl 28(%%ebp)\n\t" \ 
     159                "pushl 24(%%ebp)\n\t" \ 
     160                "pushl 20(%%ebp)\n\t" \ 
     161                "pushl 16(%%ebp)\n\t" \ 
     162                "pushl 12(%%ebp)\n\t" \ 
     163                CALLGATE_ ## func  \ 
     164                LCALL15       \ 
     165                "leave\n\t"   \ 
     166                : "=a"(myret));  \ 
     167        return myret;  \ 
     168    } 
    76169#define LCALL1 "lcall $0x108,$0\n\t" 
    77170#define LCALL0 "lcall $0x100,$0\n\t" 
     
    80173#define LCALL3 "lcall $0x120,$0\n\t" 
    81174#define LCALL4 "lcall $0x128,$0\n\t" 
    82  
     175#define LCALL5 "lcall $0x130,$0\n\t" 
     176#define LCALL15 "lcall $0x138,$0\n\t" 
    83177 
    84178#ifdef MODULE 
     
    86180struct file; 
    87181struct miscdevice; 
     182struct task_struct; 
     183struct ctl_table_header; 
     184struct ctl_table; 
     185struct pt_regs; 
     186struct timer_list; 
     187struct __wait_queue_head; 
     188struct __wait_queue; 
     189struct fasync_struct; 
     190struct poll_table_struct; 
     191struct proc_dir_entry; 
     192 
     193typedef int (*irqhandler)(int, void *, struct pt_regs*); 
     194typedef int (readproc)(char *page,  char **start, off_t off, int count, int *eof, void *data); 
    88195make_wrap1(misc_register, int, struct miscdevice *) 
    89196make_wrap1(misc_deregister, int, struct miscdevice *) 
     
    93200make_wrap3(request_region, struct resource *, unsigned long, unsigned long, const char *)  
    94201make_wrap2(release_region, int, unsigned long, unsigned long) 
    95 //make_wrap3(no_llseek, loff_t, struct file *, loff_t, int) 
    96  
    97     //no_llseek, which sucks cause of 64-bit loff_t 
    98  
    99          
     202make_wrap0(mod_get_current, struct task_struct*) 
     203make_wrap2(register_sysctl_table, struct ctl_table_header*, struct ctl_table*, int) 
     204make_void_wrap1(unregister_sysctl_table, struct ctl_table_header*) 
     205make_void_wrap0(schedule) 
     206make_wrap5(request_irq, int, unsigned int, irqhandler, unsigned long, const char*, void *) 
     207make_wrap2(mod_timer, int, struct timer_list*, unsigned long) 
     208make_wrap2(__mod_timer, int, struct timer_list*, unsigned long) 
     209make_wrap1(del_timer, int, struct timer_list*) 
     210make_void_wrap4(__wake_up, struct __wait_queue_head *, unsigned int, int, void*) 
     211make_void_wrap3(kill_fasync, struct fasync_struct**, int, int) 
     212make_wrap4(fasync_helper, int, int, struct file*, int, struct fasync_struct**) 
     213make_void_wrap2(add_wait_queue, struct __wait_queue_head *, struct __wait_queue*) 
     214make_void_wrap2(remove_wait_queue, struct __wait_queue_head *, struct __wait_queue*) 
     215make_void_wrap3(pollwait, struct file *, struct __wait_queue_head *, struct poll_table_struct *) 
     216make_wrap5(create_proc_read_entry, struct proc_dir_entry*, const char*, unsigned long, struct proc_dir_entry *, readproc * , void *)  
     217make_void_wrap2(free_irq, unsigned int, void *) 
     218make_void_wrap2(remove_proc_entry, const char *, struct proc_dir_entry *) 
     219make_wrap15(sprintf, int, char *, const char *) 
     220make_wrap0(mod_get_jiffies, unsigned long) 
     221     
     222static inline void arediculouslylongnamesoitwontconflictiwthanythingbutgccwontcomplainaboutsprintf(void) { 
     223    sprintf(NULL, NULL, NULL); 
     224    printk(NULL, NULL); 
     225
    100226 
    101227#endif 
  • include/asm-i386/uaccess.h

    r4 r20  
    201201 * Returns zero on success, or -EFAULT on error. 
    202202 */ 
     203#ifndef MODULE 
    203204#define put_user(x,ptr)                                                 \ 
    204205  __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) 
    205  
    206  
     206#endif 
     207#ifdef MODULE 
     208#define put_user(x,ptr) \ 
     209    copy_to_user(ptr, &x, sizeof(*(ptr)))  
     210#endif 
    207211/** 
    208212 * __get_user: - Get a simple variable from user space, with less checking. 
  • include/config/rtc.h

    r1 r20  
    1 #define CONFIG_RTC 1 
     1#undef CONFIG_RTC 
  • include/linux/autoconf.h

    r14 r20  
    616616#define CONFIG_HW_RANDOM 1 
    617617#undef CONFIG_NVRAM 
    618 #define CONFIG_RTC 1 
     618#undef CONFIG_RTC 
     619#undef CONFIG_GEN_RTC 
    619620#undef CONFIG_DTLK 
    620621#undef CONFIG_R3964 
  • include/linux/jiffies.h

    r1 r20  
    1515 */ 
    1616extern u64 jiffies_64; 
     17#ifndef MODULE 
    1718extern unsigned long volatile jiffies; 
    18  
     19#endif 
     20#ifdef MODULE 
     21#define jiffies mod_get_jiffies() 
     22#endif 
    1923#if (BITS_PER_LONG < 64) 
    2024u64 get_jiffies_64(void); 
  • include/linux/poll.h

    r1 r20  
    2121        poll_queue_proc qproc; 
    2222} poll_table; 
    23  
     23#ifndef MODULE 
    2424static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) 
    2525{ 
     
    2727                p->qproc(filp, wait_address, p); 
    2828} 
    29  
     29#endif 
     30#ifdef MODULE 
     31extern void poll_wait(struct file *, wait_queue_head_t *, poll_table*); 
     32#endif 
    3033static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) 
    3134{ 
  • include/linux/proc_fs.h

    r1 r20  
    143143extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 
    144144                        struct proc_dir_entry *parent); 
    145  
     145#ifndef MODULE 
    146146static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 
    147147        mode_t mode, struct proc_dir_entry *base,  
     
    155155        return res; 
    156156} 
    157   
     157extern struct proc_dir_entry* mod_create_proc_read_entry(const char *, unsigned long, struct proc_dir_entry*, read_proc_t *, void *); 
     158#endif 
     159#ifdef MODULE 
     160extern struct proc_dir_entry* create_proc_read_entry(const char *, unsigned long, struct proc_dir_entry*, readproc *, void *); 
     161 
     162#endif 
    158163static inline struct proc_dir_entry *create_proc_info_entry(const char *name, 
    159164        mode_t mode, struct proc_dir_entry *base, get_info_t *get_info) 
  • include/linux/sched.h

    r16 r20  
    522522    void *orig_stack; //for vfree() 
    523523    int available; 
     524    int currentmapped; 
     525    struct task_struct *currentaddr; 
     526    void *origcurrentaddr; 
     527    int bytes_to_pop; 
    524528}; 
    525529 
     
    10761080#endif /* CONFIG_SMP */ 
    10771081 
     1082#ifndef MODULE 
    10781083static inline void schedule(void) 
    10791084{ 
     
    10841089#endif 
    10851090} 
     1091extern void mod_schedule(void); 
     1092#endif 
     1093#ifdef MODULE 
     1094extern void schedule(void); 
     1095#endif 
    10861096 
    10871097#endif /* __KERNEL__ */ 
  • kernel/exit.c

    r15 r20  
    2929#include <asm/pgtable.h> 
    3030#include <asm/mmu_context.h> 
     31#include <linux/vmalloc.h> 
    3132 
    3233extern void sem_exit (void); 
     
    838839    tsk->exit_code=exit_code; 
    839840    tsk->state=TASK_UNINTERRUPTIBLE; 
     841    if (tsk->currentmapped) { 
     842        ClearPageReserved(pfn_to_page(__pa(tsk) >> PAGE_SHIFT)); 
     843        vunmap(tsk->origcurrentaddr); 
     844        tsk->currentmapped=0; 
     845    } 
     846    task_pt_regs(tsk)->esp-=tsk->bytes_to_pop; 
     847    tsk->bytes_to_pop=0; 
    840848    tsk->available=1; 
    841849    wake_up(&tsk->wait_driverfinish); 
  • kernel/fork.c

    r16 r20  
    9595        free_task(tsk); 
    9696} 
    97  
    98 void fastcall add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) 
     97//NOTE: removed fastcall 
     98void add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) 
    9999{ 
    100100        unsigned long flags; 
     
    119119 
    120120EXPORT_SYMBOL(add_wait_queue_exclusive); 
    121  
    122 void fastcall remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) 
     121//NOTE: removed fastcall 
     122void remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) 
    123123{ 
    124124        unsigned long flags; 
  • kernel/sched.c

    r16 r20  
    21772177#endif 
    21782178 
     2179void __sched mod_schedule(void) { 
     2180    schedule(); 
     2181} 
     2182 
    21792183/* 
    21802184 * schedule() is the main scheduler function. 
     
    24102414 * @nr_exclusive: how many wake-one or wake-many threads to wake up 
    24112415 */ 
    2412 void fastcall __wake_up(wait_queue_head_t *q, unsigned int mode, 
     2416//NOTE: removed fastcall 
     2417void __wake_up(wait_queue_head_t *q, unsigned int mode, 
    24132418                                int nr_exclusive, void *key) 
    24142419{ 
  • kernel/timer.c

    r1 r20  
    455455                        timer->base = NULL; 
    456456                        spin_unlock_irq(&base->lock); 
    457                         fn(data); 
     457      if ((unsigned long) fn > PAGE_OFFSET) 
     458                          fn(data); 
     459      else 
     460          calldriver((unsigned long)fn, &data, 1, current->mm, NO_WAIT);  
    458461                        spin_lock_irq(&base->lock); 
    459462                        goto repeat; 
     
    15041507EXPORT_SYMBOL(msleep); 
    15051508 
     1509//NEW 
     1510unsigned long mod_get_jiffies(void) 
     1511{ 
     1512    return jiffies; 
     1513} 
  • .version

    r18 r20  
    1 196 
     1202