Changeset 2084 for Whitix

Show
Ignore:
Timestamp:
05/17/10 15:54:05 (2 years ago)
Author:
mwhitworth
Message:

Merge all changes so far in network stack, too many to count.

Location:
Whitix/branches/netchannel
Files:
9 added
1 removed
203 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/netchannel/Makefile

    r2061 r2084  
    5353 
    5454kern: subdirs 
    55         ld -M -T link.ld arch/$(ARCH)/boot/*.o arch/$(ARCH)/acpi/*.o arch/$(ARCH)/lib/*.o arch/$(ARCH)/kernel/*.o \ 
     55        ld -M -T arch/i386/kernel/link.lds arch/$(ARCH)/boot/*.o arch/$(ARCH)/acpi/*.o arch/$(ARCH)/lib/*.o arch/$(ARCH)/kernel/*.o \ 
    5656         arch/$(ARCH)/mm/*.o fs/icfs/*.o fs/kfs/*.o fs/vfs/*.o fs/devfs/*.o \ 
    57          devices/kedev/*.o devices/acpi/*.o devices/misc/*.o devices/pci/*.o kernel/*.o lib/*.o memory/*.o net/*.o net/channels/*.o video/*.o \ 
     57         devices/kedev/*.o devices/acpi/*.o devices/input/*.o devices/misc/*.o devices/pci/*.o kernel/*.o lib/*.o memory/*.o net/*.o net/channels/*.o video/*.o \ 
    5858          -o kern > kernel.txt 
    5959        mkdir -p $(DIRMODULES) 
  • Whitix/branches/netchannel/arch/i386/boot/Makefile

    r1218 r2084  
    44build: $(OBJS) 
    55 
     6multiboot.o: $(DEPTH)include/config.h 
     7 
    68include ../../../make.inc 
  • Whitix/branches/netchannel/arch/i386/boot/multiboot.S

    r1315 r2084  
    66#define MULTIBOOT_HEADER_MAGIC          0x1BADB002 
    77#define MULTIBOOT_HEADER_FLAGS          0x00000003 
     8 
     9#define VA_TO_PA(addr) (addr - KERNEL_ADDRESS_BASE) 
    810 
    911.text 
     
    2426 
    2527realStart: 
    26         /* Set up GDT */ 
     28        cld 
     29 
     30        /* Set up the page tables. Map in 16mb at 0x0 and KERNEL_ADDRESS_BASE */ 
     31        xorl %edx, %edx 
     32        movl $(VA_TO_PA(bootFirstTable)), %ecx 
     33fill: 
     34        orl %edx, (%ecx) 
     35        orl $0x03, (%ecx) 
     36        addl $0x04, %ecx 
     37        addl $0x1000, %edx 
     38        cmp $0x1400000, %edx 
     39        jl fill 
     40 
     41#if 0 
     42        /* Invalidate first page to catch null pointer accesses */ 
     43        mov $(VA_TO_PA(bootFirstTable)), %ecx 
     44        movl $0x0, (%ecx) 
     45#endif 
     46 
     47        mov $(VA_TO_PA(bootPageDirectory)), %ecx 
     48        mov %ecx, %cr3 
     49        mov %cr0, %ecx 
     50        orl $0x80000000, %ecx 
     51        mov %ecx, %cr0 
     52        ljmp $0x08, $HigherHalfStart 
     53 
     54HigherHalfStart: 
    2755        lgdt gdtr 
    28          
     56 
    2957        mov $(idleStack+4096), %esp 
    3058         
     
    3866        call i386CopyMultiBoot 
    3967 
    40         add %esp, 8 
     68        add $0x08, %esp 
    4169 
    4270        mov $0x28, %ax /* TSS_SEL in the GDT */ 
     
    6290 
    6391.data 
     92.align 0x1000 
     93.globl bootPageDirectory 
     94bootPageDirectory: 
     95        .long VA_TO_PA(bootFirstTable)+3 
     96        .fill ((KERNEL_ADDRESS_BASE) >> 22) - 1, 4, 0 
     97        .long VA_TO_PA(bootFirstTable)+3 
     98        .long VA_TO_PA(bootSecondTable)+3 
     99        .long VA_TO_PA(bootThirdTable)+3 
     100        .long VA_TO_PA(bootFourthTable)+3 
     101        .long VA_TO_PA(bootFifthTable)+3 
     102        .fill (1023 - (KERNEL_ADDRESS_BASE >> 22) - 5), 4, 0 
     103        .long VA_TO_PA(bootPageDirectory)+3 /* Map directory to self. */ 
     104 
     105bootFirstTable: 
     106        .fill 1024, 4, 0 
     107bootSecondTable: 
     108        .fill 1024, 4, 0 
     109bootThirdTable: 
     110        .fill 1024, 4, 0 
     111bootFourthTable: 
     112        .fill 1024, 4, 0 
     113bootFifthTable: 
     114        .fill 1024, 4, 0 
    64115 
    65116gdtr: 
    66117gdtSize: .short gdtEnd-gdt-1 
    67118gdtBase: .long gdt 
     119 
     120.globl gdt 
    68121 
    69122gdt: 
     
    96149        /* TSS selector */ 
    97150        .word 0x68      /* Limit (length of TSS) */ 
    98         .word 0x2000 /* Base */ 
     151        .word 0x2200 /* Base; TODO: Use macro */ 
    99152        .word 0x8900    /* Type */ 
    100153        .word 0x0000 /* Granularity and limit */ 
    101154 
     155        /* TLS selector. Modified at every task switch */ 
     156        .word 0x0 
     157        .word 0x0 
     158        .word 0x0 
     159        .word 0x0 
     160 
    102161gdtEnd:  
  • Whitix/branches/netchannel/arch/i386/kernel/Makefile

    r1030 r2084  
    11DEPTH=../../../ 
    22 
    3 OBJS := pic.o init.o process.o ints.o idtstubs.o idt.o pit.o reboot.o process.o \ 
    4          smp.o cpuid.o time.o ioperms.o multiboot.o 
     3OBJS := pic.o init.o process.o ints.o idtstubs.o idt.o pit.o reboot.o process.o smp.o cpuid.o time.o ioperms.o multiboot.o debug.o 
     4EXTRA_OBJS := link.lds 
    55 
    6 build: $(OBJS) 
     6build: $(OBJS) $(EXTRA_OBJS) 
     7 
     8link.lds: $(DEPTH)include/config.h 
    79 
    810include $(DEPTH)make.inc 
  • Whitix/branches/netchannel/arch/i386/kernel/init.c

    r1444 r2084  
    8989{ 
    9090        KePrint(KERN_INFO "Whitix x86 v0.2-svn, built on %s at %s\n",__DATE__,__TIME__); 
     91        KePrint(KERN_DEBUG "KERN: start address = %#X\n", KERNEL_ADDRESS_BASE); 
    9192        i386InitMultiBoot(); 
    9293        PhysInit(); 
  • Whitix/branches/netchannel/arch/i386/kernel/ints.c

    r2061 r2084  
    6969SYMBOL_EXPORT(IrqAdd); 
    7070 
    71 int IrqRemove(BYTE irq,Irq isr,void* data) 
     71int IrqRemove(BYTE irq, Irq isr, void* data) 
    7272{ 
    7373        struct IrqEntry* entry; 
     
    128128        if (!funcAddr) 
    129129                return -ENOSYS; 
    130          
     130 
    131131        /* Verify stack */ 
    132132        return DispatchSysCall(funcAddr, stackPointer, numArgBytes); 
     
    198198        /* PAGE FAULT */ 
    199199        case 14: 
     200                if (currThread->preemptCount > 0) 
     201                        KePrint("eip = %#lX\n", curr->eip); 
    200202                asm volatile("mov %%cr2,%0" : "=r"(address)); 
    201203                if (MmapHandleFault(current, address, curr->error)) 
     
    218220                { 
    219221                        /* User process caused an exception */ 
    220                         KePrint("Exception: %s (%#X), at %#X. Exiting process.\n",exceptionName[irq],address,curr->eip); 
     222                        KePrint("Exception: %s (%#lX), at %#lX. Exiting process.\n",exceptionName[irq],address,curr->eip); 
    221223                        ThrArchPrintContext(curr); /* Debug */ 
    222224                        ThrProcessExit(-1); 
     
    225227                        cli(); /* Just get the message out */ 
    226228                        if (irq == 14 && address < PAGE_SIZE) 
    227                                 KePrint("\nNULL POINTER EXCEPTION (address = %#.8X)\n", address); 
     229                                KePrint("\nNULL POINTER EXCEPTION (address = %#.8lX)\n", address); 
    228230                        else 
    229                                 KePrint("KERNEL EXCEPTION\nProcessor exception: %s (%#X)\n",exceptionName[irq], address); 
     231                                KePrint("KERNEL EXCEPTION\nProcessor exception: %s (%#lX)\n",exceptionName[irq], address); 
    230232                        ThrArchPrintContext(curr); 
    231233                        hlt(); 
     
    254256 
    255257        ListForEachEntry(curr,&irqsHead[irq],next) 
     258        { 
     259                if (!curr->irq) 
     260                { 
     261                        ThrArchPrintContext(currThread->currContext); /* Debug */ 
     262                        cli(); hlt(); 
     263                } 
     264 
    256265                if (!(curr->irq(curr->data))) 
    257266                        break; 
     267        } 
    258268} 
    259269 
     
    292302 
    293303                default: 
    294                         KePrint("Unhandled interrupt : index = %#X\n", irq); 
     304                        KePrint("Unhandled interrupt : index = %#lX\n", irq); 
    295305        } 
    296306 
  • Whitix/branches/netchannel/arch/i386/kernel/multiboot.c

    r1319 r2084  
    6464        DWORD i; 
    6565        struct MbModule* curr = mbInfo->modAddr; 
    66          
     66 
    6767        for (i=0; i<mbInfo->modCount; i++) 
    6868        { 
     
    7878                        KernelPanic("Could not initialize the kernel"); 
    7979                } 
    80                  
    81 //              KePrint(KERN_INFO "Loaded %s\n", curr[i].string); 
    8280        } 
    8381} 
  • Whitix/branches/netchannel/arch/i386/kernel/process.c

    r2061 r2084  
    1818 
    1919#include <i386/process.h> 
     20#include <addresses.h> 
    2021#include <i386/i386.h> 
    2122#include <task.h> 
     
    2829#include <sections.h> 
    2930 
    30 #define TSS_ADDR                0x2000 
     31#define TSS_ADDR                0x2200 
    3132 
    3233void i386ExitThread(); 
     
    3435DWORD exitCode=0xF8000000; 
    3536 
    36 struct TSS* tss=(struct TSS*)TSS_ADDR; 
     37struct TSS* tss=(struct TSS*)(TSS_ADDR); 
    3738 
    3839struct Thread* ThrArchSwitch(struct Thread* prev,struct Thread* next) 
     
    9495 
    9596        /* The thread returns to the exit code page upon finishing. */ 
    96         *--currP=exitCode; 
    97         ret->esp3=(DWORD)currP; 
     97        *--currP = exitCode; 
     98        ret->esp3 = (DWORD)currP; 
    9899 
    99100        /* And restore the current process. */ 
     
    190191 
    191192        KePrint("Thread context:\n"); 
    192         KePrint("eax = %#08X ebx = %#08X ecx = %#08X edx = %#08X\n",curr->eax,curr->ebx,curr->ecx,curr->edx); 
    193         KePrint("ebp = %#08X edi = %#08X esi = %#08X eip = %#08X\n",curr->ebp,curr->edi,curr->esi,curr->eip); 
    194         KePrint("cs = %#02X ds = %#02X es = %#02X fs = %#02X gs = %#02X esp = %#08X\n",curr->cs,curr->ds,curr->es,curr->fs,curr->gs,curr->esp0); 
    195         KePrint("esp3 = %#08X cr0 = %#X cr3 = %#X eflags = %#X\n",curr->esp3,GetCr0(),GetCr3(),curr->eflags); 
    196         KePrint("irqs enabled = %u, currThread = %#X\n",(curr->eflags >> 9) & 1, currThread); 
     193        KePrint("eax = %#08lX ebx = %#08lX ecx = %#08lX edx = %#08lX\n",curr->eax,curr->ebx,curr->ecx,curr->edx); 
     194        KePrint("ebp = %#08lX edi = %#08lX esi = %#08lX eip = %#08lX\n",curr->ebp,curr->edi,curr->esi,curr->eip); 
     195        KePrint("cs = %#02lX ds = %#02lX es = %#02lX fs = %#02lX gs = %#02lX esp = %#08lX\n",curr->cs,curr->ds,curr->es,curr->fs,curr->gs,curr->esp0); 
     196        KePrint("esp3 = %#08lX cr0 = %#lX cr3 = %#lX eflags = %#lX\n",curr->esp3,GetCr0(),GetCr3(),curr->eflags); 
     197        KePrint("irqs enabled = %lu, currThread = %p, error code = " 
     198                        "%#lX\n",(curr->eflags >> 9) & 1, currThread, curr->error); 
    197199 
    198200        if (current) 
    199                 KePrint("process id = %u process name = %s\n",current->pid,ThrGetProcName(current->pid)); 
     201                KePrint("process id = %lu process name = %s\n",current->pid, ThrGetProcName(current->pid)); 
    200202 
    201203        cli(); hlt(); 
  • Whitix/branches/netchannel/arch/i386/kernel/smp.c

    r1071 r2084  
    9494 
    9595found: 
    96         KePrint(KERN_INFO "SMP: MP table found at %#X\n",addr); 
     96        KePrint(KERN_INFO "SMP: MP table found at %#lX\n",addr); 
    9797        return 0; 
    9898} 
  • Whitix/branches/netchannel/arch/i386/mm/init.c

    r1678 r2084  
    1919#include <i386/physical.h> 
    2020#include <pg_alloc.h> 
     21#include <addresses.h> 
    2122#include <print.h> 
    2223 
     
    228229        { 
    229230                currEntry=&entries[i]; 
    230                 KePrint(KERN_INFO "Start: %#016X  End: %#016X  Type: ",(DWORD)currEntry->base,(DWORD)(currEntry->base+currEntry->length)); 
     231                KePrint(KERN_INFO "Start: %#016lX  End: %#016lX  Type: ",(DWORD)currEntry->base,(DWORD)(currEntry->base+currEntry->length)); 
    231232                 
    232233                switch (currEntry->rangeType) 
     
    245246                        break; 
    246247                default: 
    247                         KePrint("Type = %u\n",currEntry->rangeType); 
     248                        KePrint("Type = %lu\n", currEntry->rangeType); 
    248249                } 
    249250        } 
     
    347348         */ 
    348349 
    349         ebdaSeg = *(WORD*)0x40E; 
     350        ebdaSeg = *(WORD*)PA_TO_VA(0x40E); 
    350351         
    351352        if (ebdaSeg) 
     
    356357 
    357358        /* Reserve BIOS code/data areas */ 
    358         PageReserveArea(0xA0000,0x100000-0xA0000); 
     359        PageReserveArea(0xA0000, 0x100000-0xA0000); 
    359360} 
    360361 
     
    364365         
    365366        PhysReadMemoryMap(); 
    366  
    367367        maxPfn=GetMaxPfn(); 
    368  
    369368        PageEarlyInit(maxPfn); 
    370  
    371369        /* Print memory size for information purposes */ 
    372370        memSize=(maxPfn >> 8); 
    373         KePrint(KERN_INFO "PHYS: %umb physical memory available\n", memSize); 
     371        KePrint(KERN_INFO "PHYS: %lumb physical memory available\n", memSize); 
    374372 
    375373        if (memSize < 2) 
  • Whitix/branches/netchannel/arch/i386/mm/virt.c

    r1678 r2084  
    2121#include <sections.h> 
    2222#include <malloc.h> 
     23#include <addresses.h> 
    2324#include <slab.h> 
    2425#include <print.h> 
     
    3435 
    3536#define invlpg(page) asm volatile("invlpg %0" :: "m"(*(char*)page)) 
     37#define KERNEL_DIR_BEGIN        (KERNEL_ADDRESS_BASE >> 22) 
     38 
    3639struct Cache* managerCache; 
    37  
    38 void PagingEnable(struct MemManager* manager) 
    39 { 
    40         VirtSetCurrent(manager); 
    41         SetCr0(GetCr0() | CR0_PG); 
    42 } 
    4340 
    4441/*********************************************************************** 
     
    6158} 
    6259 
    63 int VirtKeInit(struct MemManager* manager) 
    64 { 
    65         DWORD* firstPageTable, *secondPageTable; 
    66         DWORD i, address = PAGE_SIZE; 
    67  
    68         /*  
    69          * Accessed through virtual memory at the top of the address space, 
    70          * therefore no need to map. Also, this is before paging is enabled. 
    71         */ 
    72  
    73         firstPageTable=(DWORD*)(PageAlloc()->physAddr); 
    74          
    75         if (!firstPageTable) 
    76                 return NULL; 
    77  
    78         /* The first page of memory is not mapped, so we can easily catch 
    79          * NULL pointer exceptions. 
    80          */ 
    81           
    82         firstPageTable[0]=0; 
    83  
    84         for (i=1; i<((DWORD)code >> 14); i++) 
    85         { 
    86                 firstPageTable[i]=address | PAGE_PRESENT | PAGE_RW | PAGE_KERNEL; 
    87                 address+=PAGE_SIZE; 
    88         } 
    89  
    90         /* Now map the kernel code pages read-only */ 
    91         for (;i<((DWORD)endCode >> 14); i++) 
    92         { 
    93                 firstPageTable[i]=address | PAGE_PRESENT | PAGE_KERNEL | PAGE_READONLY; 
    94                 address+=PAGE_SIZE; 
    95         } 
    96  
    97         /* And map the rest read-write */ 
    98         for (; i<1024; i++) 
    99         { 
    100                 firstPageTable[i]=address | PAGE_PRESENT | PAGE_RW | PAGE_KERNEL; 
    101                 address+=PAGE_SIZE; 
    102         } 
    103  
    104         manager->pageDir[0]=(DWORD)firstPageTable | PAGE_KERNEL | PAGE_PRESENT | PAGE_RW; 
    105  
    106         /* And map a second page table so the page stack functions ok for machines with large physical memory */ 
    107  
    108         secondPageTable=(DWORD*)(PageAlloc()->physAddr); 
    109          
    110         for (i=0; i<1024; i++) 
    111         { 
    112                 secondPageTable[i]=address | PAGE_PRESENT | PAGE_RW | PAGE_KERNEL; 
    113                 address+=PAGE_SIZE; 
    114         } 
    115  
    116         manager->pageDir[1]=(DWORD)secondPageTable | PAGE_KERNEL | PAGE_PRESENT | PAGE_RW; 
    117                  
    118         /* Map it to itself so we can keep track of physical addresses of  
    119          * tables and the directory. 
    120          */ 
    121  
    122         manager->pageDir[PGDIR_SELF]=((DWORD)manager->pageDir) | PAGE_PRESENT | PAGE_KERNEL | PAGE_RW; 
    123  
    124         PagingEnable(manager); 
    125  
    126         return 0; 
    127 } 
    128  
    12960int VirtMemManagerInit(struct MemManager* manager,int kernel) 
    13061{ 
    131         DWORD i; 
    132  
    133         ZeroMemory(manager,sizeof(struct MemManager)); 
    134  
    135         manager->pageDir=(DWORD*)(PageAlloc()->physAddr); 
    136  
    137         if (!manager->pageDir) 
    138                 goto error; 
     62        ZeroMemory(manager, sizeof(struct MemManager)); 
    13963 
    14064        if (kernel) 
    14165        { 
    142         if (VirtKeInit(manager)) 
     66                extern DWORD bootPageDirectory[]; 
     67                manager->pageDir = (DWORD*)(VA_TO_PA(&bootPageDirectory)); 
     68        }else{ 
     69                manager->pageDir=(DWORD*)(PageAlloc()->physAddr); 
     70 
     71                if (!manager->pageDir) 
    14372                        goto error; 
    144         }else{ 
     73                         
    14574                DWORD* vPageDir, *kPageDir; 
    14675         
     
    15382                ZeroMemory(vPageDir, PAGE_SIZE); 
    15483 
    155                 /* Allocate a temporary mapping to map in the kernel page directory so entries can be copied over */ 
    156                 kPageDir=(DWORD*)VirtAllocateTemp((DWORD)kernelMem.pageDir); 
    157                 if (!kPageDir) 
    158                         goto error; 
    159  
    160                 /* Copy the first 8MB of pages to the new page directory. */ 
    161                 for (i=0; i<2; i++) 
    162                         vPageDir[i]=(DWORD)kPageDir[i]; 
    163  
    164                 /* 0xC0000000 to 0xD0000000 is the slab's memory */ 
    165                 for (i=(0xC0000000 >> 22); i<(0xFF000000 >> 22); i++) 
    166                         vPageDir[i]=(DWORD)kPageDir[i]; 
    167  
    168                 /* No more need for the kernel page directory */ 
    169                 VirtUnmapPhysPage((DWORD)kPageDir); 
    170  
     84                kPageDir=kernelMem.pageDir; 
     85 
     86                memcpy(&vPageDir[KERNEL_DIR_BEGIN], 
     87                                &kPageDir[KERNEL_DIR_BEGIN], sizeof(DWORD)*(1023 - 
     88                                        KERNEL_DIR_BEGIN)); 
     89 
     90                vPageDir[0] = vPageDir[KERNEL_DIR_BEGIN]; 
    17191                vPageDir[1023]=((DWORD)manager->pageDir) | PAGE_PRESENT | PAGE_RW | PAGE_KERNEL; 
    17292                VirtUnmapPhysPage((DWORD)vPageDir); 
     
    17797                PreemptDisable(); 
    17898 
    179         ListAddTail(&manager->list,&managerList); 
     99        ListAddTail(&manager->list, &managerList); 
    180100 
    181101        if (currThread) 
     
    210130{ 
    211131        /* Go through all the page tables, releasing the memory if allocated. No need to release kernel page tables */ 
    212         int i; 
     132        DWORD i; 
    213133        struct PhysPage* curr=NULL; 
    214134        DWORD* vPageDir; 
     
    224144        vPageDir=(DWORD*)VirtAllocateTemp((DWORD)manager->pageDir); 
    225145 
    226         /* Free all the private page directories */ 
    227         for (i=2; i<768; i++) 
     146        for (i=2; i<KERNEL_DIR_BEGIN; i++) 
    228147        { 
    229148                if (vPageDir[i] & PAGE_PRESENT) 
     
    239158        PreemptEnable(); 
    240159 
    241         MemCacheFree(managerCache,manager); 
     160        MemCacheFree(managerCache, manager); 
    242161 
    243162        return 0; 
     
    247166{ 
    248167        /* Init the kernel page tables */ 
    249         VirtMemManagerInit(&kernelMem, true); 
    250  
    251         return 0; 
     168        return VirtMemManagerInit(&kernelMem, true); 
    252169} 
    253170 
    254171int VirtInit() 
    255172{        
    256         managerCache=MemCacheCreate("Manager Cache",sizeof(struct MemManager),NULL,NULL,0); 
     173        managerCache=MemCacheCreate("VmManagers", sizeof(struct MemManager), NULL, NULL, 0); 
     174 
    257175        if (!managerCache) 
    258176                return -ENOMEM; 
     
    263181int VirtMemMapPage(DWORD virt,DWORD phys,int perms) 
    264182{ 
    265         DWORD virtEnt, flags; 
     183        DWORD flags; 
     184        DWORD virtEnt; 
    266185        struct MemManager* manager; 
    267186        DWORD* virtDir; 
     
    271190                return -EFAULT; 
    272191 
    273         virtEnt=PGDIR_ENT(virt); 
     192        virtEnt = PGDIR_ENT(virt); 
    274193 
    275194        IrqSaveFlags(flags); 
     
    278197        { 
    279198                pageDir[virtEnt]=PageAlloc()->physAddr | perms | PAGE_RW; 
     199         
    280200                /* Zero out the whole page table */ 
    281201                ZeroMemory(&pageTable[virtEnt*1024], PAGE_SIZE); 
    282  
     202                 
    283203                /* If in kernel memory space, map to all other page directories */ 
    284                 if (virtEnt >= 768) 
     204                if (virtEnt >= (KERNEL_DIR_BEGIN)) 
    285205                { 
    286206                        ListForEachEntry(manager,&managerList,list) 
    287207                        { 
     208                                /* Avoid copying to the same page table entry */ 
     209                                if ((DWORD)manager->pageDir == VirtToPhys((DWORD)pageDir)) 
     210                                        break; 
     211                                         
    288212                                virtDir=(DWORD*)VirtAllocateTemp((DWORD)manager->pageDir); 
    289                                 virtDir[virtEnt]=pageDir[virtEnt]; 
     213                                virtDir[virtEnt] = pageDir[virtEnt]; 
    290214                                VirtUnmapPhysPage((DWORD)virtDir); 
    291215                        } 
    292216                } 
    293217        } 
    294  
     218         
    295219        pageTable[PGTABLE_ENT(virt)]=phys | perms; 
    296220        invlpg(virt); 
    297  
     221         
    298222        IrqRestoreFlags(flags); 
    299223        return 0; 
     
    312236                VirtUnmapPhysPage(curr); 
    313237} 
    314  
    315 /*  
    316  * Whitix currently doesn't map every physical page into kernel memory, because that allows just < 1gb on a system. 
    317  * So the current way to map pages is to call this function, with a virtual address range that's acceptable  
    318  * Should it? 
    319  */ 
    320238 
    321239DWORD VirtMapPhysPage(DWORD virt,DWORD endVirt,int perms) 
     
    339257                if (!(pageDir[PGDIR_ENT(i)]) || !(pageTable[PGTABLE_ENT(i)])) /* Definitely not used */ 
    340258                { 
    341                         VirtMemMapPage(i,page,perms); 
     259                        VirtMemMapPage(i, page, perms); 
    342260                        IrqRestoreFlags(flags); 
    343261                        return i; 
     
    360278 
    361279        IrqSaveFlags(flags); 
    362  
    363 //      KePrint("VirtMapPhysRange(%#X,%#X,%u,%d)\n",virt,endVirt,numPages,perms); 
    364280 
    365281        for (i=virt; i<endVirt; i+=PAGE_SIZE) 
     
    424340                                pageTable[PGTABLE_ENT(address)] &= ~(0xFFF); 
    425341                                pageTable[PGTABLE_ENT(address)] |= protection; 
    426 //                              KePrint("address = %#X\n", pageTable[PGTABLE_ENT(address)]); 
    427342                        } 
    428343                } 
     
    436351void VirtUnmapPhysPage(DWORD virt) 
    437352{ 
     353        DWORD flags; 
     354         
     355        IrqSaveFlags(flags); 
     356                 
    438357        if (!pageDir[PGDIR_ENT(virt)] || !pageTable[PGTABLE_ENT(virt)]) 
    439358                /* Doesn't exist */ 
    440                 return; 
     359                goto out; 
    441360 
    442361        pageTable[PGTABLE_ENT(virt)]=0; 
    443362        invlpg(virt); 
     363         
     364out: 
     365        IrqRestoreFlags(flags); 
    444366} 
    445367 
     
    450372        DWORD i; 
    451373 
    452         /* 0xF0000000 to 0xF8000000 is the space for temporarily mapping physical memory */ 
    453  
    454         for (i=0xF0000000; i<0xF8000000; i+=PAGE_SIZE) 
     374        /* 0xF0080000 to 0xF8000000 is the space for temporarily mapping physical memory */ 
     375 
     376        for (i=0xF0080000; i<0xF8000000; i+=PAGE_SIZE) 
    455377                if (!pageDir[PGDIR_ENT(i)] || !pageTable[PGTABLE_ENT(i)]) /* Definitely not used */ 
    456378                { 
    457                         VirtMemMapPage(i,phys,PAGE_PRESENT | PAGE_KERNEL | PAGE_RW); 
     379                        VirtMemMapPage(i, phys, PAGE_PRESENT | PAGE_KERNEL | PAGE_RW); 
    458380                        return i; 
    459381                } 
     
    467389void VirtShowFault(DWORD address,int error) 
    468390{ 
    469         KePrint("\nAddress = %#X (pageDir[%d] = %#X)",address,address >> 22,pageDir[address >> 22]); 
     391        KePrint("\nAddress = %#lX (pageDir[%d] = %#lX)",address, address >> 22, pageDir[address >> 22]); 
    470392 
    471393        if (pageDir[address >> 22]) 
    472                 KePrint(" pageTable[%d] = %#X",address >> 12,pageTable[address >> 12]); 
     394                KePrint(" pageTable[%d] = %#X (%d)",address >> 12,pageTable[address >> 12], pageTable[address >> 12] & 7); 
    473395 
    474396        KePrint("\n"); 
  • Whitix/branches/netchannel/bochsrc.txt

    r2061 r2084  
    44megs: 64 
    55romimage: file="/usr/share/bochs/BIOS-bochs-latest", address=0x00000 
    6 vgaromimage: file="/usr/share/vgabios/vgabios.bin" 
     6#vgaromimage: file="/usr/share/vgabios/vgabios.bin" 
    77boot: cdrom 
    88floppy_bootsig_check: disabled=0 
     
    2222com4: enabled=0 
    2323usb1: enabled=0 
    24 #i440fxsupport: enabled=1, slot2=ne2k 
     24ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:01, ethmod=linux, ethdev=eth0 
     25i440fxsupport: enabled=1 
    2526vga_update_interval: 40000 
    2627vga: extension=vbe 
     
    3031clock: sync=none, time0=local 
    3132# no cmosimage 
    32 ne2k: enabled=1, ioaddr=0x800, irq=7, mac=b0:c4:20:00:00:01, ethmod=vnet, ethdev=eth0 
    33 pnic: enabled=0 
    3433sb16: enabled=0 
    3534# no loader 
     
    4544keyboard_serial_delay: 250 
    4645keyboard_paste_delay: 100000 
    47 keyboard_mapping: enabled=1, map=/usr/local/share/bochs/keymaps/x11-pc-uk.map 
    4846user_shortcut: keys=none 
    4947mouse: enabled=0, type=ps2 
  • Whitix/branches/netchannel/devices/Makefile

    r2061 r2084  
    1010 
    1111modules_install: 
    12         $(MAKE) -C input modules_install 
    1312        $(MAKE) -C net modules_install 
    1413        $(MAKE) -C storage modules_install 
  • Whitix/branches/netchannel/devices/input/Makefile

    r653 r2084  
    11DEPTH=../../ 
    22 
    3 MODULES := ps2mouse.sys keyboard.sys ps2.sys 
    4  
    5 build: $(MODULES) 
    6  
    7 modules_install: 
    8         cp -f *.sys ../../CdRoot/System/Modules/Input 
     3build: keyboard.o ps2.o 
    94 
    105include $(DEPTH)make.inc 
  • Whitix/branches/netchannel/devices/input/keyboard.c

    r955 r2084  
    108108BYTE prevScancode=0; 
    109109 
     110#ifdef CONFIG_DEBUG 
     111extern int DebugLoop(); 
     112#endif 
     113 
    110114static int KeyboardIrq(void* data) 
    111115{ 
     
    144148                isCaps=isCaps ^ true; 
    145149                break; 
     150 
     151#ifdef CONFIG_DEBUG 
     152        case 0x01: 
     153                DebugLoop(); 
     154                break; 
     155#endif 
    146156 
    147157        case 0x9D: 
     
    221231        return 0; 
    222232} 
    223  
    224 ModuleInit(KeyboardInit); 
  • Whitix/branches/netchannel/devices/input/ps2.c

    r559 r2084  
    3636 
    3737SYMBOL_EXPORT(Ps2Wait); 
     38 
     39int Ps2WaitForData() 
     40{ 
     41        int i; 
     42 
     43        for (i = 0; i< 0x10000; i++) 
     44                if (!(inb(0x64) & 0x01)) 
     45                        return 0; 
     46 
     47        return -EIO; 
     48} 
     49 
     50SYMBOL_EXPORT(Ps2WaitForData); 
    3851 
    3952static int Ps2SendByte(int byte) 
  • Whitix/branches/netchannel/devices/input/ps2mouse.c

    r1054 r2084  
    145145        while (size >= sizeof(struct Ps2MousePacket)) 
    146146        { 
    147                 WAIT_ON(mouseQueue, mouseHead != mouseTail); 
     147                WAIT_ON(&mouseQueue, mouseHead != mouseTail); 
    148148 
    149149                while (Ps2TryRead(data)); 
  • Whitix/branches/netchannel/devices/kedev/class.c

    r1283 r2084  
    22#include <devices/class.h> 
    33#include <fs/devfs.h> 
     4#include <print.h> 
    45#include <module.h> 
    56#include <keobject.h> 
     
    2122SYMBOL_EXPORT(DevClassCreate); 
    2223 
     24int DevClassLookup(char* name, struct DevClass** class) 
     25{ 
     26        KePrint("DevClassLookup\n"); 
     27        return 0; 
     28} 
     29 
     30SYMBOL_EXPORT(DevClassLookup); 
     31 
    2332int ClassInit() 
    2433{ 
  • Whitix/branches/netchannel/devices/kedev/sdevice.c

    r1283 r2084  
    199199         
    200200        SpinLockIrq(&requestLock); 
    201         ListRemove(&request->list); 
     201        ListRemoveInit(&request->list); 
    202202        SpinUnlockIrq(&requestLock); 
    203203 
    204204        if (status > 0) 
    205205                KePrint("I/O error reading sector %u\n",request->sector); 
    206                  
     206 
    207207        /* BufferUnlock also wakes up the queue that's waiting for it */ 
    208208        BufferUnlock(request->buffer); 
  • Whitix/branches/netchannel/devices/linux/dma.c

    r2061 r2084  
    33#include <print.h> 
    44#include <typedefs.h> 
     5#include <i386/virtual.h> 
     6#include <pci.h> 
    57 
    68#include "include/pci.h" 
    79#include "include/module.h" 
    810 
    9 quickcall void* dma_alloc_coherent(struct device* dev, unsigned long size, void* handle, int gfp); 
    10 void* dma_free_coherent(struct device* dev, unsigned long size, void* cpu_addr, unsigned int handle); 
     11quickcall void* dma_alloc_coherent(struct device* dev, unsigned long size, void* handle, unsigned long gfp); 
     12quickcall void* dma_free_coherent(struct device* dev, unsigned long size, void* cpu_addr, unsigned long handle); 
    1113quickcall unsigned long dma_map_single(struct device* hwdev, void* ptr, unsigned long size, int direction); 
    1214quickcall void dma_unmap_single(struct device* hwdev, void* ptr, unsigned long size, int direction); 
     
    5153SYMBOL_EXPORT(dma_ops); 
    5254 
    53 quickcall void* dma_alloc_coherent(struct device* dev, unsigned long size, void* handle, int gfp) 
     55quickcall void* dma_alloc_coherent(struct device* dev, unsigned long size, void* handle, unsigned long gfp) 
    5456{ 
    5557        struct PciDevice* device = (struct PciDevice*)dev->devP; 
     
    6365SYMBOL_EXPORT(dma_alloc_coherent); 
    6466 
    65 void* dma_free_coherent(struct device* dev, unsigned long size, void* cpu_addr, unsigned int handle) 
     67quickcall void* dma_free_coherent(struct device* dev, unsigned long size, void* cpu_addr, unsigned long handle) 
    6668{ 
    6769        KePrint("dma_free_coherent\n"); 
     
    7375quickcall unsigned long dma_map_single(struct device* hwdev, void* ptr, unsigned long size, int direction) 
    7476{ 
    75         DWORD virt = ptr + 0xC0000000; 
     77        DWORD virt = (DWORD)ptr + 0xC0000000; 
    7678         
    7779        return VirtToPhys(virt); 
  • Whitix/branches/netchannel/devices/linux/eth.c

    r2061 r2084  
    6060} 
    6161 
     62SYMBOL_EXPORT(ethtool_op_set_sg); 
     63 
     64DWORD ethtool_op_get_sg(void* dev) 
     65{ 
     66        KePrint("ethtool_op_get_sg\n"); 
     67        return 0; 
     68} 
     69 
     70SYMBOL_EXPORT(ethtool_op_get_sg); 
     71 
     72DWORD ethtool_op_get_tso(void* dev) 
     73{ 
     74        KePrint("ethtool_op_get_tso\n"); 
     75        return 0; 
     76} 
     77 
     78SYMBOL_EXPORT(ethtool_op_get_tso); 
     79 
     80/*int ethtool_op_set_tx_csum(void* dev, DWORD data) 
     81{ 
     82        KePrint("ethtool_op_set_tx_csum\n"); 
     83        return 0; 
     84} 
     85 
     86SYMBOL_EXPORT(ethtool_op_set_tx_csum); 
     87 
     88DWORD ethtool_op_get_tx_csum(void* dev) 
     89{ 
     90        KePrint("ethtool_op_get_tx_csum\n"); 
     91        return 0; 
     92} 
     93 
     94SYMBOL_EXPORT(ethtool_op_get_tx_csum);*/ 
     95 
     96int ethtool_op_set_tx_hw_csum(void* dev, DWORD data) 
     97{ 
     98        KePrint("ethtool_op_set_tx_hw_csum\n"); 
     99        return 0; 
     100} 
     101 
     102SYMBOL_EXPORT(ethtool_op_set_tx_hw_csum); 
     103 
    62104unsigned short eth_type_trans(void* skb, void* dev) 
    63105{ 
     
    99141quickcall struct net_device* alloc_etherdev_mq(int priv, unsigned int queue_count) 
    100142{ 
    101         struct net_device* ret = (struct net_device*)MemAlloc(sizeof(struct net_device) + priv + 1000); 
     143        struct net_device* ret = (struct net_device*)MemAlloc(sizeof(struct net_device) + priv + 100); 
    102144         
    103145        INIT_LIST_HEAD(&ret->dev_list); 
    104146        INIT_LIST_HEAD(&ret->napi_list); 
    105147         
    106 //      KePrint("alloc_etherdev_mq\n"); 
     148        ret->addr_len = 6; 
     149        ret->mtu = 1492; 
    107150         
    108151        return ret; 
  • Whitix/branches/netchannel/devices/linux/include/irq.h

    r2063 r2084  
    77#include "module.h" 
    88 
    9 typedef quickcall void (*irq_func)(int, void*); 
     9typedef quickcall void (*irq_func)(int, void*, void*); 
    1010 
    1111struct linux_irq 
  • Whitix/branches/netchannel/devices/linux/include/net.h

    r2061 r2084  
    7272        char name[16]; 
    7373        char hlist[8]; 
    74         char* ifalias; 
     74        char* if_alias; 
    7575         
    7676        unsigned long mem_end; 
     
    9595        void* get_stats; 
    9696        struct net_device_stats stats; 
     97         
     98        void* wireless_handlers; 
     99        void* wireless_data; 
    97100                         
    98101        void* ethtool_ops; 
     
    129132        unsigned int allmulti; 
    130133         
    131         void* privdatas[6]; 
    132          
    133         struct ListHead poll_list; 
    134         int (*poll)(void* dev, int* quota); 
    135         int quota; 
    136         int weight; 
     134        void* privdatas[8]; 
    137135         
    138136        unsigned long last_rx; 
     
    245243}; 
    246244 
     245#define __bitwise__ 
     246typedef unsigned __bitwise__ gfp_t; 
     247 
     248quickcall char* print_mac(char* mac, unsigned char* addr); 
     249 
    247250#endif 
  • Whitix/branches/netchannel/devices/linux/irq.c

    r2061 r2084  
    33#include <pci.h> 
    44#include <print.h> 
     5#include <malloc.h> 
    56 
    67#include "include/irq.h" 
     
    5758         
    5859        if (entry->func) 
    59                 entry->func(entry->irq, entry->data); 
    60         else 
    61                 return 0; 
     60                entry->func(entry->irq, entry->data, NULL); 
     61                 
     62        return 0; 
    6263} 
    6364 
    64 quickcall int request_irq(unsigned int irq, void (*handler)(int, void*, void*), 
     65quickcall int request_irq(unsigned int irq, quickcall void (*handler)(int, void*, void*), 
    6566        unsigned long irqflags, const char* devname, void* devid) 
    6667{ 
     
    7374        entry->func = handler; 
    7475        entry->data = devid; 
    75                  
     76         
     77        KePrint("request_irq(%u)\n", irq); 
     78 
    7679        IrqAddEntry(irq, &entry->entry); 
    7780         
  • Whitix/branches/netchannel/devices/linux/mem.c

    r2061 r2084  
    88quickcall void kfree(void* addr) 
    99{ 
    10         KePrint("kfree(%#X)\n", addr); 
     10//      KePrint("kfree(%#X)\n", addr); 
    1111        MemFree(addr); 
    1212} 
     
    4545 
    4646SYMBOL_EXPORT(warn_on_slowpath); 
     47 
     48quickcall void iounmap(void* addr) 
     49{ 
     50        KePrint("iounmap\n"); 
     51} 
     52 
     53SYMBOL_EXPORT(iounmap); 
     54 
     55 
     56struct kmem_cache { 
     57        unsigned long flags; 
     58        int size; 
     59        int objsize; 
     60        int offset; 
     61         
     62        /* More stuff here... */ 
     63}; 
     64/* Don't know the real size of the array. */ 
     65struct kmem_cache kmalloc_caches[100]; 
     66  
     67SYMBOL_EXPORT(kmalloc_caches); 
  • Whitix/branches/netchannel/devices/linux/net.c

    r2061 r2084  
    11#include <console.h> 
    22#include <module.h> 
     3#include <locks.h> 
    34#include <print.h> 
    45#include <tasklet.h> 
     
    3435SYMBOL_EXPORT(__netif_schedule); 
    3536 
    36 void netif_carrier_off(void* dev) 
     37quickcall void netif_carrier_off(void* dev) 
    3738{ 
    3839        KePrint("netif_carrier_off\n"); 
     
    4142SYMBOL_EXPORT(netif_carrier_off); 
    4243 
    43 void netif_carrier_on(void* dev) 
    44 { 
    45         KePrint("netif_carrier_on\n"); 
     44quickcall void netif_carrier_on(void* dev) 
     45{ 
    4646} 
    4747 
     
    6666        skb->buffer.data = skb->buffer.start = skb->data; 
    6767        skb->buffer.length = skb->len; 
     68 
     69//      KePrint("netif_receive_skb(%#X, %d)\n", skb->data, skb->len); 
    6870         
    6971        return EthRecv(skb->dev->ethDevice, &skb->buffer); 
     
    7173 
    7274SYMBOL_EXPORT(netif_receive_skb); 
     75 
     76int LinuxNetStart(struct NetDevice* device) 
     77{ 
     78        struct net_device* dev = (struct net_device*)(device->priv); 
     79 
     80        BitSet(&dev->state, 0); 
     81 
     82        return dev->open(dev); 
     83} 
    7384 
    7485int LinuxNetSend(struct NetDevice* device, struct NetBuffer* sockBuff) 
     
    7687        struct net_device* dev = (struct net_device*)(device->priv); 
    7788        struct sk_buff* skb = dev_alloc_skb(sockBuff->length); 
     89        int ret; 
    7890         
    7991        memcpy(skb->data, sockBuff->data, sockBuff->length); 
     
    8193        skb->end = skb->tail = skb->head + sockBuff->length;     
    8294        skb->len = sockBuff->length; 
    83          
    84         return dev->hard_start_xmit(skb, dev); 
     95 
     96        ret = dev->hard_start_xmit(skb, dev); 
     97         
     98        if (!ret) 
     99                return sockBuff->length; 
     100        else 
     101                return ret; 
    85102} 
    86103 
    87104struct NetDevOps linuxNetOps= 
    88105{ 
     106        .start = LinuxNetStart, 
    89107        .send = LinuxNetSend, 
    90108}; 
     
    93111quickcall int register_netdev(struct net_device* dev) 
    94112{ 
    95         char buf[18]; 
    96113        int ret = 0; 
    97114        struct EthDevice* ethDev; 
    98115        struct NetDevice* netDev; 
    99                  
    100         /* Figure out offset of dev_addr */ 
    101         memset(dev->dev_addr, 0x22, 6); 
    102                  
     116 
    103117        /* Alloc in ethdev_mq */ 
    104118        dev->tx_queue = (struct net_queue*)MemAlloc(sizeof(struct net_queue)); 
    105119        dev->tx_queue->state = 0; 
    106120         
    107         netDev = NetDeviceAlloc();       
     121        netDev = NetDeviceAlloc(); 
    108122        ethDev = dev->ethDevice = EthDeviceAlloc(netDev); 
    109123         
     124//      KePrint(KERN_DEBUG "mac = %s (%#X), %#X\n", print_mac(buf, dev->perm_addr), OffsetOf(struct net_device, perm_addr), dev->perm_addr[0]); 
     125//      KePrint(KERN_DEBUG "mac = %s (%#X), %#X\n", print_mac(buf, dev->dev_addr), OffsetOf(struct net_device, dev_addr), dev->dev_addr[0]); 
     126         
    110127        memcpy(ethDev->macAddress, dev->dev_addr, 6); 
    111128         
     129        netDev->ops = &linuxNetOps; 
     130        netDev->priv = dev; 
     131        netDev->procPriv = ethDev; 
     132        netDev->mtu = dev->mtu; 
     133         
    112134        EthDeviceRegister(ethDev); 
    113135         
    114         netDev->ops = &linuxNetOps; 
    115         netDev->priv = netDev->procPriv = dev; 
    116          
    117         strcpy(dev->name, "eth0", sizeof("eth0")); 
    118          
    119         if (dev->open) 
    120                 ret = dev->open(dev); 
     136        strncpy(dev->name, "eth0", sizeof("eth0")); 
    121137                         
    122138        return ret; 
     
    148164 
    149165        if (n->state & 0x1) 
    150                 work = n->poll(n, 16); 
     166                work = n->poll(n, 100); 
    151167 
    152168        IrqRestoreFlags(flags); 
     
    155171SYMBOL_EXPORT(__napi_schedule); 
    156172 
    157 void dev_kfree_skb_any(void* skb) 
     173void dev_kfree_skb_any(struct sk_buff* skb) 
    158174{ 
    159175        if (!IrqsEnabled()) 
    160176        { 
    161                 KePrint("dev_kfree_skb_any: free in irq\n"); 
     177//              MemFree(skb->head); 
     178//              MemFree(skb); 
    162179        }else{ 
    163180                KePrint("dev_kfree_skb_any: free in normal\n"); 
     
    186203SYMBOL_EXPORT(dev_alloc_skb); 
    187204 
     205void* __netdev_alloc_skb(void* dev, unsigned int length, gfp_t gfp_mask) 
     206{ 
     207        KePrint("__netdev_alloc_skb\n"); 
     208        return NULL; 
     209} 
     210 
     211SYMBOL_EXPORT(__netdev_alloc_skb); 
     212 
    188213unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta) 
    189214{ 
     
    201226 
    202227SYMBOL_EXPORT(__vlan_hwaccel_rx); 
     228 
     229int ___pskb_trim(void* skb, unsigned int len) 
     230{ 
     231        KePrint("___pskb_trim\n"); 
     232        return 0; 
     233} 
     234 
     235SYMBOL_EXPORT(___pskb_trim); 
     236 
     237int pskb_expand_head(void* skb, int nhead, int ntail, gfp_t gfp_mask) 
     238{ 
     239        KePrint("pskb_expand_head\n"); 
     240        return 0; 
     241} 
     242 
     243SYMBOL_EXPORT(pskb_expand_head); 
     244 
     245void* kmem_cache_alloc(void* s, gfp_t gfpflags) 
     246{ 
     247        KePrint("kmem_cache_alloc\n"); 
     248        return NULL; 
     249} 
     250 
     251SYMBOL_EXPORT(kmem_cache_alloc); 
     252 
     253int capable(int cap) 
     254{ 
     255        KePrint("capable\n"); 
     256        return 0; 
     257} 
     258 
     259SYMBOL_EXPORT(capable); 
     260 
     261void dev_kfree_skb_irq(struct sk_buff *skb) 
     262{ 
     263        KePrint("dev_kfree_skb_irq\n"); 
     264} 
     265 
     266SYMBOL_EXPORT(dev_kfree_skb_irq); 
     267 
     268enum system_states { 
     269        SYSTEM_BOOTING, 
     270        SYSTEM_RUNNING, 
     271        SYSTEM_HALT, 
     272        SYSTEM_POWER_OFF, 
     273        SYSTEM_RESTART, 
     274        SYSTEM_SUSPEND_DISK, 
     275} system_state; 
     276 
     277SYMBOL_EXPORT(system_state); 
     278 
     279/* Workqueue stuff. I'll put it here for now. */ 
     280int cancel_work_sync(void* work) 
     281{ 
     282        KePrint("cancel_work_sync\n"); 
     283        return 0; 
     284} 
     285 
     286SYMBOL_EXPORT(cancel_work_sync); 
     287 
     288int schedule_work(void* work) 
     289{ 
     290        KePrint("schedule_work\n"); 
     291        return 0; 
     292} 
     293 
     294SYMBOL_EXPORT(schedule_work); 
     295 
     296void* mem_map; 
     297 
     298SYMBOL_EXPORT(mem_map); 
     299 
     300int _spin_trylock(void* lock) 
     301{ 
     302        KePrint("_spin_trylock\n"); 
     303        return 0; 
     304} 
     305 
     306SYMBOL_EXPORT(_spin_trylock); 
     307 
  • Whitix/branches/netchannel/devices/linux/pci.c

    r2061 r2084  
    11#include <console.h> 
     2#include <malloc.h> 
    23#include <module.h> 
    34#include <pci.h> 
     
    1213         U pci_enable_device 
    1314         U pci_enable_device_mem 
    14          U pci_enable_msi 
    1515         U pci_find_capability 
    1616         U pci_release_selected_regions 
     
    1919         U pci_save_state 
    2020         U pci_select_bars 
    21          U pci_set_consistent_dma_mask 
    22          U pci_set_dma_mask 
    2321         U pci_set_mwi 
    2422         U pcix_get_mmrbc 
     
    9492         
    9593        dev->dev.devP = device; 
    96          
     94 
    9795        return driver->probe(dev, devId); 
    9896} 
     
    144142 
    145143SYMBOL_EXPORT(pci_unregister_driver); 
     144 
     145int pci_set_consistent_dma_mask(void* dev, QWORD mask) 
     146{ 
     147        KePrint("pci_set_consistent_dma_mask\n"); 
     148        return 0; 
     149} 
     150 
     151SYMBOL_EXPORT(pci_set_consistent_dma_mask); 
     152 
     153void* pci_iomap(void* dev, int bar, unsigned long max) 
     154{ 
     155        KePrint("pci_iomap\n"); 
     156        return NULL; 
     157} 
     158 
     159SYMBOL_EXPORT(pci_iomap); 
     160 
     161void* ioremap_nocache(DWORD phys_addr, unsigned long size) 
     162{ 
     163        KePrint("ioremap_nocache\n"); 
     164        return NULL; 
     165} 
     166 
     167SYMBOL_EXPORT(ioremap_nocache); 
     168 
     169int pci_enable_msi(void* pdev) 
     170{ 
     171        KePrint("pci_enable_msi\n"); 
     172        return 0; 
     173} 
     174 
     175SYMBOL_EXPORT(pci_enable_msi); 
     176 
     177void pci_disable_msi(void* dev) 
     178{ 
     179        KePrint("pci_disable_msi\n"); 
     180} 
     181 
     182SYMBOL_EXPORT(pci_disable_msi); 
     183 
     184int pci_request_regions(void* dev, const char *res_name) 
     185{ 
     186        KePrint("pci_request_regions\n"); 
     187        return 0; 
     188} 
     189 
     190SYMBOL_EXPORT(pci_request_regions); 
     191 
     192void pci_release_regions(void* dev) 
     193{ 
     194        KePrint("pci_release_regions\n"); 
     195} 
     196 
     197SYMBOL_EXPORT(pci_release_regions); 
     198 
     199const char *dev_driver_string(const void* dev) 
     200{ 
     201        KePrint("dev_driver_string\n"); 
     202        return ""; 
     203} 
     204 
     205SYMBOL_EXPORT(dev_driver_string); 
     206 
     207struct pci_bus; 
     208 
     209int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, void* val) 
     210{ 
     211        KePrint("pci_bus_read_config_byte\n"); 
     212        return 0; 
     213} 
     214 
     215SYMBOL_EXPORT(pci_bus_read_config_byte); 
     216 
     217int pci_bus_write_config_word(void* bus, unsigned int devfn, int where, WORD val) 
     218{ 
     219        KePrint("pci_bus_write_config_word\n"); 
     220        return 0; 
     221} 
     222 
     223SYMBOL_EXPORT(pci_bus_write_config_word); 
     224 
     225int pci_bus_write_config_dword(void* bus, unsigned int devfn, int where, DWORD val) 
     226{ 
     227        KePrint("pci_bus_write_config_dword\n"); 
     228        return 0; 
     229} 
     230 
     231SYMBOL_EXPORT(pci_bus_write_config_dword); 
     232 
     233int pci_set_dma_mask(void* dev, QWORD mask) 
     234{ 
     235        KePrint("pci_set_dma_mask\n"); 
     236        return 0; 
     237} 
     238 
     239SYMBOL_EXPORT(pci_set_dma_mask); 
  • Whitix/branches/netchannel/devices/linux/resource.c

    r2061 r2084  
    77quickcall void* __request_region(void* parent, unsigned long start, unsigned long n, char* name) 
    88{ 
    9         return 0xDEADCAFE; 
     9        return (void*)0xDEADCAFE; 
    1010} 
    1111 
  • Whitix/branches/netchannel/devices/linux/timer.c

    r2061 r2084  
    44#include <timer.h> 
    55 
     6#include "include/timer.h" 
    67#include "include/module.h" 
    78 
    8 quickcall void init_timer(struct Timer* timer) 
     9void LinuxTimerProxyFunc(void* data); 
     10 
     11quickcall void init_timer(struct linux_timer* timer) 
    912{ 
    10         KePrint("init_timer(%#X)\n", timer); 
    11 //      KePrint("addr = %#X\n", *((DWORD*)0xC00a1588)); 
     13        timer->timer = (struct Timer*)MemAlloc(sizeof(struct Timer)); 
     14        INIT_LIST_HEAD(&timer->timer->list); 
     15        timer->timer->func = LinuxTimerProxyFunc; 
     16        timer->timer->data = timer; 
    1217} 
    1318 
    1419SYMBOL_EXPORT(init_timer); 
    1520 
    16 void mod_timer(void* timer, unsigned long expires) 
     21void LinuxTimerProxyFunc(void* data) 
    1722{ 
    18         KePrint("mod_timer\n"); 
     23        struct linux_timer* timer = (struct linux_timer*)data; 
     24        timer->function(timer->data); 
     25} 
     26 
     27quickcall void mod_timer(struct linux_timer* timer, unsigned long expires) 
     28{ 
     29        TimerRemove(timer->timer); 
     30        timer->expires = expires; 
     31        timer->timer->expires = expires; 
     32        TimerAdd(timer->timer); 
    1933} 
    2034 
  • Whitix/branches/netchannel/devices/misc/misc.c

    r1078 r2084  
    2323#include <i386/i386.h> 
    2424#include <i386/virtual.h> 
     25#include <print.h> 
    2526#include <keobject.h> 
    2627#include <devices/class.h> 
     28#include <i386/pit.h> 
    2729 
    2830#define MISC_MAJOR 2 
     
    5153} 
    5254 
     55int RandomGetBytes(void* data, int length) 
     56{ 
     57        DWORD rand = (DWORD)PitGetQuantums() ^ length ^ (DWORD)data; 
     58 
     59        memcpy(data, &rand, length); 
     60 
     61        return length; 
     62} 
     63 
     64SYMBOL_EXPORT(RandomGetBytes); 
     65 
     66static int RandomRead(struct File* file, BYTE* data, DWORD size) 
     67{ 
     68        KePrint("RandomRead(%u)\n", size); 
     69        return 0; 
     70} 
     71 
    5372struct FileOps nullOps={ 
    5473        .write = NullWrite, 
     
    6483}; 
    6584 
     85struct FileOps ranOps={ 
     86        .read = RandomRead, 
     87}; 
     88 
    6689struct DevClass specialClass; 
    67 static struct KeDevice nullDev, zeroDev, memDev; 
     90static struct KeDevice nullDev, zeroDev, memDev, ranDev; 
    6891 
    6992int MiscInit() 
     
    77100        KeDeviceCreate(&memDev, &specialClass.set, DEV_ID_MAKE(MISC_MAJOR, 2), &memOps, 
    78101                DEVICE_CHAR, "Memory"); 
     102        KeDeviceCreate(&ranDev, &specialClass.set, DEV_ID_MAKE(MISC_MAJOR, 3), 
     103                        &ranOps, DEVICE_CHAR, "Random"); 
    79104 
    80105        return 0; 
  • Whitix/branches/netchannel/devices/net/Makefile

    r1683 r2084  
    55 
    66modules_install: 
    7         cp ne2k-pci.sys ../../CdRoot/System/Modules/Network 
     7        cp ne2k-pci.sys ../../CdRoot/System/Modules/Network/ne2k_pci.sys 
    88        cp pcnet.sys ../../CdRoot/System/Modules/Network 
    99 
  • Whitix/branches/netchannel/devices/net/ne2k-pci.c

    r1683 r2084  
    135135        unsigned char rxPage, thisFrame; 
    136136        struct Ne2kHeader packetHeader; 
     137        DWORD data; 
    137138 
    138139        while (++rxPacketCount < 10) 
     
    161162                outb(ne2kDev->ioAddr+NE2K_CMD, NE2K_CMD_RREAD | NE2K_CMD_START); 
    162163 
    163                 *((DWORD*)&packetHeader)=ind(ne2kDev->ioAddr+NE2K_DATA); 
     164                data = ind(ne2kDev->ioAddr + NE2K_DATA); 
     165                memcpy(&packetHeader, &data, 4); 
    164166 
    165167                outb(ne2kDev->ioAddr+NE2K_ISR, NE2K_RDMA_COMPLETE); 
     
    298300#define CLONE_INFO(var, cName, cFlags) \ 
    299301        static struct Ne2kCloneInfo var = { .name = cName, .flags = (cFlags) }  
    300  
    301302 
    302303CLONE_INFO(chipRealTek,                         "RealTek RTL-8029", FDX_REALTEK); 
     
    311312CLONE_INFO(chipHoltek_HT80229,          "Holtek HT80229", ONLY_32BIT_IO | FDX_HOLTEK | STOP_PG_0x60); 
    312313CLONE_INFO(chipWinBond_89C940_8c4a, "Winbond W89C940 (misprogrammed)", 0); 
    313  
    314314 
    315315struct PciDeviceId ne2kIdTable[]= 
     
    528528        KePrint("NE2K: Found %s. I/O base = %#X, irq = %u. MAC = ", ne2kDev->info->name, ioAddr, device->irq); 
    529529 
    530         EthPrintMacAddress(ethDev); 
     530        EthPrintMacAddress(ethDev->macAddress); 
    531531        EthDeviceRegister(ethDev); 
    532532 
  • Whitix/branches/netchannel/devices/net/pcnet.c

    r2061 r2084  
    184184static int PcNetOpen(struct NetDevice* dev) 
    185185{ 
    186         struct PcNetDevice* pcDev = NetDevPriv(dev); 
     186//      struct PcNetDevice* pcDev = NetDevPriv(dev); 
    187187         
    188188        return 0; 
     
    259259         
    260260        PcNetReadMacAddress(ops, ioAddr, macAddr); 
    261         EthPrintMacAddress(macAddr); 
     261        EthPrintMacAddress(ethDev->macAddress); 
    262262         
    263263        /* Set the init block. */ 
  • Whitix/branches/netchannel/devices/pci/pci_core.c

    r2061 r2084  
    8282                DWORD n; 
    8383        }u; 
     84         
     85        if (bus > 255 || dev > 255 || func > 255) 
     86                return -EINVAL; 
    8487 
    8588        u.n=0; 
  • Whitix/branches/netchannel/devices/pci/pci_lib.c

    r1684 r2084  
    2626#include <pci.h> 
    2727#include <slab.h> 
     28#include <print.h> 
    2829 
    2930LIST_HEAD(pciDriverList); 
     
    8990 
    9091        /* For now, just enable I/O and memory. */ 
    91         command = command | PCI_COMMAND_IO | PCI_COMMAND_MEM; 
     92        command |= PCI_COMMAND_IO | PCI_COMMAND_MEM; 
     93 
     94        KePrint(KERN_DEBUG "PCI: Enabling device at %d:%d:%d\n", device->bus->index, device->dev, device->func); 
    9295 
    9396        return PciWriteConfigWord(device, PCI_COMMAND, command); 
     
    9598 
    9699SYMBOL_EXPORT(PciEnableDevice); 
     100 
     101static void PciSetMasterLatency(struct PciDevice* device) 
     102{ 
     103        BYTE lat; 
     104         
     105        PciReadConfigByte(device, PCI_LATENCY_TIMER, &lat); 
     106         
     107        if (lat < 16) 
     108                lat = 64; 
     109        else if (lat > 64) 
     110                lat = 64; 
     111                 
     112        KePrint(KERN_DEBUG "PCI: Setting latency timer to %d.\n", lat); 
     113        PciWriteConfigByte(device, PCI_LATENCY_TIMER, lat); 
     114} 
    97115 
    98116int PciSetMaster(struct PciDevice* device) 
     
    103121                return -EIO; 
    104122 
    105         command |= PCI_COMMAND_MASTER; 
    106  
    107         return PciWriteConfigWord(device, PCI_COMMAND, command); 
     123        if (!(command & PCI_COMMAND_MASTER)) 
     124        { 
     125                command |= PCI_COMMAND_MASTER; 
     126                PciWriteConfigWord(device, PCI_COMMAND, command); 
     127        } 
     128         
     129        PciSetMasterLatency(device); 
     130         
     131        return 0; 
    108132} 
    109133 
  • Whitix/branches/netchannel/devices/pci/pci_mem.c

    r2061 r2084  
    3434        } 
    3535         
    36         ret = VirtMapPhysPage(0xC0000000, 0xD0000000, 3); 
     36        ret = (void*)VirtMapPhysPage(0xC0000000, 0xD0000000, 3); 
    3737         
    38         *dmaAddr = VirtToPhys(ret); 
     38        *dmaAddr = VirtToPhys((DWORD)ret); 
    3939         
    4040        return ret; 
  • Whitix/branches/netchannel/devices/storage/ata/ata-cd.c

    r1368 r2084  
    248248 
    249249        IrqRestoreFlags(flags); 
    250  
    251 //      printf("AtapiRead(%u)\n", request->sector); 
    252  
     250         
    253251        return -SIOPENDING; 
    254252} 
  • Whitix/branches/netchannel/devices/storage/ata/ata.c

    r1682 r2084  
    213213         * on the controller. 
    214214         */ 
    215           
    216          if (err == -SIOPENDING) 
    217          { 
    218                 controller->timer.expires = 1000; /* 1 second? */ 
    219                  
    220                 TimerAdd(&controller->timer); 
    221          } 
     215        if (err != -SIOPENDING) 
     216        { 
     217                KePrint("err = %d\n", err); 
     218                cli(); hlt(); 
     219        } 
     220 
     221        controller->timer.expires = 1000; /* 1 second? */ 
     222        TimerAdd(&controller->timer); 
    222223          
    223224         return err; 
     
    227228{ 
    228229        struct AtaController* controller = drive->parent; 
    229  
    230         StorageEndRequest(drive->sDev, status);  
    231230 
    232231        controller->busy = 0; 
     
    239238 
    240239        TimerRemove(&controller->timer); 
     240 
     241        StorageEndRequest(drive->sDev, status);  
    241242         
    242243        /* See if there any pending requests that another drive was waiting for. */ 
     
    257258        struct AtaController* controller = (struct AtaController*)data; 
    258259         
    259          
    260260        if (!controller->busy) 
    261261                return; 
    262          
    263          
     262 
    264263        TimerRemove(&controller->timer); 
    265264         
  • Whitix/branches/netchannel/fs/Makefile

    r977 r2084  
    1616        $(MAKE) -C reiserfs modules_install 
    1717        $(MAKE) -C journal modules_install 
    18         $(MAKE) -C icfs modules_install 
    1918 
    2019clean: 
  • Whitix/branches/netchannel/fs/devfs/devfs.c

    r1365 r2084  
    202202} 
    203203 
    204 int DevFsLookup(struct VNode** retVal,struct VNode* dir, char* name, int nameLength) 
     204int DevFsLookup(struct VNode** retVal,struct VNode* dir, char* name, size_t nameLength) 
    205205{ 
    206206        struct KeFsEntry* entry; 
  • Whitix/branches/netchannel/fs/ext3/ext3.h

    r965 r2084  
    190190int Ext3WriteVNode(struct VNode* vNode); 
    191191int Ext3DirtyVNode(struct VNode* vNode); 
    192 int Ext3Lookup(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
     192int Ext3Lookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
    193193int Ext3ReadDir(struct File* file,void* dirEntries); 
    194194int Ext3BlockMap(struct VNode* vNode, DWORD block, int flags); 
    195195struct Buffer* Ext3BlockRead(struct VNode* vNode,int block, int create); 
    196 int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
     196int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
    197197int Ext3Truncate(struct VNode* vNode, DWORD size); 
    198 int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
     198int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
    199199struct VNode* Ext3CreateINode(struct JournalHandle* handle, struct VNode* dir, int isDir); 
    200 int Ext3Remove(struct VNode* dir, char* name, int nameLength); 
    201 int Ext3RemoveDir(struct VNode* dir, char* name, int nameLength); 
     200int Ext3Remove(struct VNode* dir, char* name, size_t nameLength); 
     201int Ext3RemoveDir(struct VNode* dir, char* name, size_t nameLength); 
    202202 
    203203int Ext3FileWrite(struct File* file,BYTE* buffer,DWORD len); 
  • Whitix/branches/netchannel/fs/ext3/inode.c

    r1086 r2084  
    197197} 
    198198 
    199 int Ext3FindEntry(struct VNode* dir, char* name, int nameLength, struct Ext3DirEntry** ext3Entry, 
     199int Ext3FindEntry(struct VNode* dir, char* name, size_t nameLength, struct Ext3DirEntry** ext3Entry, 
    200200        struct Buffer** buffer) 
    201201{ 
     
    324324} 
    325325 
    326 int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name,int nameLength) 
     326int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 
    327327{ 
    328328        struct JournalHandle* handle; 
     
    374374} 
    375375 
    376 int Ext3Remove(struct VNode* dir, char* name, int nameLength) 
     376int Ext3Remove(struct VNode* dir, char* name, size_t nameLength) 
    377377{ 
    378378        struct JournalHandle* handle; 
     
    398398} 
    399399 
    400 int Ext3Lookup(struct VNode** retVal,struct VNode* dir,char* name,int nameLength) 
     400int Ext3Lookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 
    401401{ 
    402402        int ret; 
    403403        struct Ext3DirEntry* ext3Entry; 
    404404         
    405         ret=Ext3FindEntry(dir, name, nameLength, &ext3Entry, NULL); 
     405        ret = Ext3FindEntry(dir, name, nameLength, &ext3Entry, NULL); 
    406406         
    407407        if (!ret) 
     
    537537 ******************************************************************************/ 
    538538  
    539 int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name,int nameLength) 
     539int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 
    540540{ 
    541541        struct VNode* vNode; 
     
    588588} 
    589589 
    590 int Ext3RemoveDir(struct VNode* dir, char* name, int nameLength) 
     590int Ext3RemoveDir(struct VNode* dir, char* name, size_t nameLength) 
    591591{ 
    592592        return -ENOTIMPL; 
  • Whitix/branches/netchannel/fs/fat/dir.c

    r1339 r2084  
    154154 ***********************************************************************/ 
    155155 
    156 int FatScanDir(struct VNode* vNode,const char* name,int nameLength,struct FatDirEntry* retVal,DWORD* vNum,DWORD* dirPos) 
     156int FatScanDir(struct VNode* vNode,const char* name, size_t nameLength,struct FatDirEntry* retVal,DWORD* vNum,DWORD* dirPos) 
    157157{ 
    158158        DWORD pos; 
  • Whitix/branches/netchannel/fs/fat/fat.h

    r1340 r2084  
    165165}; 
    166166 
    167 int FatCreate(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
    168 int FatRemove(struct VNode* dir,char* name,int nameLength); 
    169 int FatLookup(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
    170 int FatRmDir(struct VNode* dir,char* name,int nameLength); 
     167int FatCreate(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
     168int FatRemove(struct VNode* dir,char* name, size_t nameLength); 
     169int FatLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
     170int FatRmDir(struct VNode* dir,char* name, size_t nameLength); 
    171171int FatWriteVNode(struct VNode* vNode); 
    172172int FatReadVNode(struct VNode* vNode); 
    173173int FatNameToStr(char* fat12Name,char* name); 
    174 int FatMkDir(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
     174int FatMkDir(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
    175175int FatTruncate(struct VNode* vNode, DWORD size); 
    176 int FatScanDir(struct VNode* vNode,const char* name,int nameLength,struct FatDirEntry* retVal,DWORD* vNum,DWORD* dirPos); 
    177 int FatCreateShortName(struct VNode* dir,char* fatName,char* name,int nameLength, int* isShortName); 
     176int FatScanDir(struct VNode* vNode,const char* name, size_t nameLength,struct FatDirEntry* retVal,DWORD* vNum,DWORD* dirPos); 
     177int FatCreateShortName(struct VNode* dir,char* fatName,char* name, size_t nameLength, int* isShortName); 
    178178int FatIsLong(const char* name,int nameLength); 
    179179 
     
    190190/* Directory functions */ 
    191191int FatAddEntries(struct VNode* dir,int numEntries); 
    192 int FatAddName(struct VNode* dir,char* fatName,char* name,int nameLength,DWORD* vNum,int attr, int isShortName); 
     192int FatAddName(struct VNode* dir,char* fatName,char* name, size_t nameLength,DWORD* vNum,int attr, int isShortName); 
    193193int FatReadDir(struct File* file,void* dirEntries); 
    194194int FatGetDirEntry(struct VNode* vNode,struct FatDirEntry* dirEntry,int currPos); 
  • Whitix/branches/netchannel/fs/fat/vnode.c

    r1344 r2084  
    2424#include <slab.h> 
    2525#include <malloc.h> 
     26#include <assert.h> 
    2627#include <print.h> 
    2728 
     
    223224} 
    224225 
    225 int FatLookup(struct VNode** retVal,struct VNode* dir,char* name,int nameLength) 
     226int FatLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 
    226227{ 
    227228        DWORD vNum=0; 
     
    320321} 
    321322 
    322 int FatCreateShortName(struct VNode* vNode,char* fatName,char* name,int nameLength, int* isShortName) 
     323int FatCreateShortName(struct VNode* vNode,char* fatName,char* name, size_t nameLength, int* isShortName) 
    323324{ 
    324325        int i=0; 
     
    588589/* Function should be cleared up soon */ 
    589590 
    590 int FatAddName(struct VNode* dir, char* fatName, char* name, int nameLength, 
     591int FatAddName(struct VNode* dir, char* fatName, char* name, size_t nameLength, 
    591592        DWORD* vNum, int attr, int isShortName) 
    592593{ 
     
    648649/* Creates a file */ 
    649650 
    650 int FatCreate(struct VNode** retVal,struct VNode* dir,char* name,int nameLength) 
     651int FatCreate(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 
    651652{ 
    652653        int err; 
     
    666667#define FAT_MKDIR_SIZE          64 
    667668 
    668 int FatMkDir(struct VNode** retVal,struct VNode* dir,char* name,int nameLength) 
     669int FatMkDir(struct VNode** retVal, struct VNode* dir, char* name, size_t nameLength) 
    669670{ 
    670671        int err; 
     
    738739} 
    739740 
    740 int FatRemoveLongEntry(struct VNode* dir,char* name,int nameLength) 
     741int FatRemoveLongEntry(struct VNode* dir,char* name, size_t nameLength) 
    741742{ 
    742743        int err,extLen; 
     
    779780} 
    780781 
    781 int FatRemove(struct VNode* dir,char* name,int nameLength) 
     782int FatRemove(struct VNode* dir,char* name, size_t nameLength) 
    782783{ 
    783784        struct VNode* vNode; 
    784785        int err; 
    785786 
    786         err=FatLookup(&vNode,dir,name,nameLength); 
     787        KeAssert(vNode->refs == 1); 
     788 
     789        err=FatLookup(&vNode, dir, name, nameLength); 
    787790 
    788791        if (err) 
    789792                return err; 
    790793 
    791         if (vNode->refs > 1) 
    792         { 
    793                 VNodeRelease(vNode); 
    794                 return -EACCES; 
    795         } 
    796  
    797         FatRemoveClusters(vNode,0); 
    798         vNode->size=0; 
     794        FatRemoveClusters(vNode, 0); 
     795        vNode->size = 0; 
    799796        SetVNodeDirty(vNode); 
    800797        VNodeRelease(vNode); /* Update to disk */ 
     
    825822                        continue; 
    826823 
    827                 if (strncmp(dirEntry.fileName,FAT_DOT,11) && 
    828                         strncmp(dirEntry.fileName,FAT_DOTDOT,11)) 
     824                if (strncmp(dirEntry.fileName,FAT_DOT, 11) && 
     825                        strncmp(dirEntry.fileName,FAT_DOTDOT, 11)) 
    829826                        return 1; 
    830827        } 
     
    833830} 
    834831 
    835 int FatRmDir(struct VNode* dir,char* name,int nameLength) 
     832int FatRmDir(struct VNode* dir,char* name, size_t nameLength) 
    836833{ 
    837834        struct VNode* vNode; 
  • Whitix/branches/netchannel/fs/icfs/Makefile

    r879 r2084  
    11DEPTH=../../ 
    2 OBJS = icsetup.o info.o info_cpu.o config.o 
     2OBJS = icsetup.o info.o info_cpu.o config.o icfs.o  
    33 
    4 build: $(OBJS) icfs.sys 
    5  
    6 modules_install: 
    7         cp icfs.sys ../../CdRoot/System/Modules/Filesystems 
     4build: $(OBJS)  
    85 
    96include $(DEPTH)make.inc 
  • Whitix/branches/netchannel/fs/icfs/config.c

    r1081 r2084  
    3737} 
    3838 
    39 int SysConfRead(char* name, BYTE* data, int size) 
     39int SysConfRead(char* name, char* data, int size) 
    4040{ 
    4141        struct KeFsEntry* entry; 
     
    4747                return -ENOENT; 
    4848         
    49         IcRead(&position, entry->file, data, size); 
    50          
    51         return 0; 
     49        return IcRead(&position, entry->file, (BYTE*)data, size); 
    5250} 
    5351 
    54 int SysConfWrite(char* name, BYTE* data, int size) 
     52int SysConfWrite(char* name, char* data, int size) 
    5553{ 
    5654        struct KeFsEntry* entry; 
     
    5856         
    5957        entry=ConfigResolvePath(name); 
    60          
     58 
    6159        if (!entry) 
    6260                return -ENOENT; 
    6361         
    64         IcWrite(&position, entry->file, data, size); 
    65          
    66         return 0; 
     62        return IcWrite(&position, entry->file, (BYTE*)data, size); 
    6763} 
    6864 
  • Whitix/branches/netchannel/fs/icfs/icfs.c

    r1081 r2084  
    3939}; 
    4040 
    41 int IcFsLookup(struct VNode** retVal, struct VNode* dir, char* name, int nameLength) 
     41int IcFsLookup(struct VNode** retVal, struct VNode* dir, char* name, size_t nameLength) 
    4242{ 
    4343        struct KeFsEntry* entry; 
     
    8888        vNode->fileOps=&icFsFileOps; 
    8989 
    90         vNode->mode=entry->type; 
    91          
     90        vNode->mode = entry->type; 
     91                 
    9292        if (vNode->mode & VFS_ATTR_DIR) 
    93                 vNode->size=KeFsDirSize(&entry->dir); 
     93                vNode->size = KeFsDirSize(&entry->dir); 
    9494        else if (vNode->mode & VFS_ATTR_FILE) 
    9595        { 
     
    104104                                 
    105105                        case ICFS_TYPE_STR: 
    106                                 vNode->size=strlen(iEnt->sVal); 
     106                                vNode->size=strlen((const char*)iEnt->sVal); 
    107107                                break; 
    108108                                 
     
    110110                                vNode->size=iEnt->size; 
    111111                                break; 
    112                                  
     112 
     113                        case ICFS_TYPE_FUNC: 
     114                                vNode->size = 0; /* Can't give a size. */ 
     115                                break; 
     116         
    113117                        default: 
    114                                 KePrint("TODO: %d\n", iEnt->type); 
     118                                KePrint("IcFsReadVNode: %d\n", iEnt->type); 
    115119                } 
    116120        } 
     
    153157        return VfsRegisterFileSystem(&icFileSystem); 
    154158} 
    155  
    156 ModuleInit(IcFsInit); 
  • Whitix/branches/netchannel/fs/icfs/icfs.h

    r896 r2084  
    44#include <fs/icfs.h> 
    55#include <typedefs.h> 
     6#include <malloc.h> 
    67 
    78/* Internal function prototypes. */ 
     
    1112DWORD IcFsGetRootId(); 
    1213 
     14/* Internal utility functions. */ 
     15 
     16static inline struct IcFsEntry* IcEntryAlloc() 
     17{ 
     18        return (struct IcFsEntry*)MemAlloc(sizeof(struct IcFsEntry)); 
     19} 
     20 
    1321#endif 
  • Whitix/branches/netchannel/fs/icfs/icsetup.c

    r1417 r2084  
    1313        return 0; 
    1414} 
     15 
     16ModuleInit(IcInit); 
  • Whitix/branches/netchannel/fs/icfs/info.c

    r1091 r2084  
    77#include <print.h> 
    88 
     9#include "icfs.h" 
     10 
    911struct KeFsEntry root; 
    1012 
    11 int InfoReadInt(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size) 
     13int InfoReadInt(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
    1214{ 
    1315        DWORD copied; 
     
    2224} 
    2325 
    24 int InfoReadStr(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size) 
    25 { 
    26         DWORD copied; 
    27          
    28         copied=MIN(size-*position, (DWORD)strlen(iEnt->sVal)-*position); 
    29          
    30         memcpy(data, iEnt->sVal+*position, copied); 
     26int InfoReadStr(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
     27{ 
     28        DWORD copied; 
     29         
     30        copied=MIN(size-*position, (DWORD)strlen(*iEnt->sVal)-*position); 
     31         
     32        memcpy(data, (*iEnt->sVal)+*position, copied); 
    3133         
    3234        *position+=copied; 
     
    3537} 
    3638 
    37 int InfoReadArray(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size) 
     39int InfoReadArray(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
    3840{ 
    3941        DWORD copied; 
     
    4850} 
    4951 
    50 int IcRead(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size) 
     52int InfoReadFunc(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
     53{ 
     54        int ret; 
     55        struct KeObject* object = iEnt->owner; 
     56 
     57        if (iEnt->entry.readFunc == NULL) 
     58                return -EPERM; 
     59 
     60        ret = iEnt->entry.readFunc(object, data, size, *position); 
     61 
     62        if (ret >= 0) 
     63                *position += ret; 
     64 
     65        return ret; 
     66} 
     67 
     68int IcRead(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
    5169{ 
    5270        switch (iEnt->type) 
     
    6078                case ICFS_TYPE_BYTE: 
    6179                        return InfoReadArray(position, iEnt, data, size); 
    62                          
    63                 default: 
    64                         KePrint("TODO: %d\n", iEnt->type); 
     80                 
     81                case ICFS_TYPE_FUNC: 
     82                        return InfoReadFunc(position, iEnt, data, size);         
     83         
     84                default:         
     85                        KePrint("IcRead: %d\n", iEnt->type); 
    6586        } 
    6687         
     
    7091SYMBOL_EXPORT(IcRead); 
    7192 
    72 int IcWriteInt(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size) 
     93int IcWriteInt(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
    7394{ 
    7495        DWORD copied; 
    7596         
    7697        copied=MIN(size-*position, sizeof(int)-*position); 
    77          
    7898        memcpy(iEnt->iVal+*position, data, copied); 
    79          
    8099        *position+=copied; 
    81100         
     
    83102} 
    84103 
    85 int IcWrite(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size) 
     104int IcDoWriteFunc(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
     105{ 
     106        struct KeObject* object = iEnt->owner; 
     107 
     108        if (iEnt->entry.writeFunc == NULL) 
     109                return -EPERM; 
     110 
     111        return iEnt->entry.writeFunc(object, data, size, *position); 
     112} 
     113 
     114/* TODO: Allow size to move between minLen and maxLen */ 
     115int IcWriteArray(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
     116{ 
     117        DWORD copied; 
     118         
     119        copied = MIN(size-*position, iEnt->size-*position); 
     120        memcpy(iEnt->csVal+*position, data, copied); 
     121        *position += copied; 
     122 
     123        return copied; 
     124} 
     125 
     126int IcWrite(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 
    86127{ 
    87128        switch (iEnt->type) 
     
    89130                case ICFS_TYPE_INT: 
    90131                        return IcWriteInt(position, iEnt, data, size); 
     132 
     133                case ICFS_TYPE_BYTE: 
     134                        return IcWriteArray(position, iEnt, data, size); 
     135 
     136                case ICFS_TYPE_FUNC: 
     137                        return IcDoWriteFunc(position, iEnt, data, size); 
    91138                         
    92139                default: 
    93                         KePrint("TODO: %d\n", iEnt->type);               
     140                        KePrint("IcWrite: %d\n", iEnt->type);            
    94141        } 
    95142         
     
    99146SYMBOL_EXPORT(IcWrite); 
    100147 
    101 int IcFsAddIntEntry(struct KeFsEntry* dir, char* name, int* value, DWORD permissions) 
     148int IcFsAddIntEntry(struct KeFsEntry* dir, const char* name, int* value, DWORD permissions) 
    102149{ 
    103150        struct KeFsEntry* entry; 
     
    109156        entry=KeFsAddEntry(&dir->dir, name, permissions); 
    110157         
    111         newEnt=(struct IcFsEntry*)MemAlloc(sizeof(struct IcFsEntry)); 
     158        newEnt = IcEntryAlloc(); 
    112159        newEnt->type=ICFS_TYPE_INT; 
    113160        newEnt->iVal=value; 
     
    120167SYMBOL_EXPORT(IcFsAddIntEntry); 
    121168 
    122 struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, char* name, char* str, DWORD permissions) 
     169struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, const char* name, char** str, DWORD permissions) 
    123170{ 
    124171        struct KeFsEntry* entry; 
     
    128175                dir=&root; 
    129176                 
    130         entry=KeFsAddEntry(&dir->dir, name, VFS_ATTR_RW); 
    131          
    132         newEnt=(struct IcFsEntry*)MemAlloc(sizeof(struct IcFsEntry)); 
    133         newEnt->type=ICFS_TYPE_STR; 
    134         newEnt->sVal=str; 
     177        entry=KeFsAddEntry(&dir->dir, name, permissions); 
     178         
     179        newEnt = IcEntryAlloc(); 
     180        newEnt->type = ICFS_TYPE_STR; 
     181        newEnt->sVal = str; 
    135182         
    136183        entry->file=newEnt; 
     
    139186} 
    140187 
    141 int IcFsAddSoftLink(struct KeFsEntry* dir, char* name, 
     188SYMBOL_EXPORT(IcFsAddStrEntry); 
     189 
     190int IcFsAddArrayEntry(struct KeFsEntry* dir, const char* name, char* array, unsigned int minLen, unsigned int size, unsigned int maxLen) 
     191{ 
     192        struct KeFsEntry* entry; 
     193        struct IcFsEntry* newEnt; 
     194         
     195        if (!dir) 
     196                dir = &root; 
     197                 
     198        entry = KeFsAddEntry ( &dir->dir, name, VFS_ATTR_RW     ); 
     199         
     200        newEnt = IcEntryAlloc(); 
     201        newEnt->type = ICFS_TYPE_BYTE; 
     202        newEnt->csVal = array; 
     203        newEnt->minLen = minLen; 
     204        newEnt->maxLen = maxLen; 
     205        newEnt->size = size; 
     206         
     207        entry->file = newEnt;    
     208        return 0; 
     209} 
     210 
     211SYMBOL_EXPORT(IcFsAddArrayEntry); 
     212 
     213int IcFsAddFuncEntry(struct KeFsEntry* dir, struct KeObject* object, const char* name, IcReadFunc readFunc, IcWriteFunc writeFunc) 
     214{ 
     215        struct KeFsEntry* entry; 
     216        struct IcFsEntry* newEnt; 
     217        int permissions = 0; 
     218         
     219        if (!dir) 
     220                dir = &root; 
     221                 
     222        if (readFunc) 
     223                permissions |= VFS_ATTR_READ; 
     224                 
     225        if (writeFunc) 
     226                permissions |= VFS_ATTR_WRITE; 
     227                 
     228        entry = KeFsAddEntry ( &dir->dir, name, permissions ); 
     229         
     230        newEnt = IcEntryAlloc(); 
     231        newEnt->type = ICFS_TYPE_FUNC; 
     232        newEnt->owner = object; 
     233        newEnt->entry.readFunc = readFunc; 
     234        newEnt->entry.writeFunc = writeFunc; 
     235         
     236        entry->file = newEnt; 
     237         
     238        return 0; 
     239} 
     240 
     241SYMBOL_EXPORT(IcFsAddFuncEntry); 
     242 
     243int IcFsAddSoftLink(struct KeFsEntry* dir, const char* name, 
    142244        int (*followLink)(struct KeFsEntry**, struct KeFsEntry*)) 
    143245{ 
     
    167269} 
    168270 
     271SYMBOL_EXPORT(IcFsCreateDir); 
     272 
    169273int IcFsRemoveDir(struct KeFsEntry* dir) 
    170274{ 
     
    172276} 
    173277 
     278/* Process an array of IC attributes and add them to a particular directory. */ 
     279int IcAddAttributes(struct KeObject* object, struct IcAttribute* attributes, int objOffset) 
     280{ 
     281        char* base; 
     282                 
     283        if (!object->parent || !object->dir) 
     284                return -EFAULT; 
     285         
     286        base = ((char*)object) - objOffset; 
     287         
     288        /* Go through the array and register each element.*/ 
     289        while (attributes->type != -1) 
     290        { 
     291                int permissions = 0; 
     292                 
     293                /* Convert IC permissions to VFS permissions. */ 
     294                if (attributes->perms == IC_READ) 
     295                        permissions = VFS_ATTR_READ; 
     296                else if (attributes->perms == IC_RW) 
     297                        permissions = VFS_ATTR_WRITE; 
     298                 
     299                switch (attributes->type) 
     300                { 
     301                        case ICFS_TYPE_INT: 
     302                                IcFsAddIntEntry(object->dir, attributes->name, (int*)(base+attributes->offset), 
     303                                        permissions); 
     304                                break; 
     305                                 
     306                        case ICFS_TYPE_STR: 
     307                        { 
     308                                char** p = (char**)(base+attributes->offset); 
     309                                IcFsAddStrEntry(object->dir, attributes->name, p, permissions); 
     310                                break; 
     311                        } 
     312                                 
     313                        case ICFS_TYPE_FUNC: 
     314                                IcFsAddFuncEntry(object->dir, object, attributes->name, attributes->readFunc, 
     315                                        attributes->writeFunc); 
     316                                break; 
     317                                 
     318                        default: 
     319                                KePrint(KERN_WARNING "icfs: unhandled object type %d\n", attributes->type); 
     320                                break; 
     321                                 
     322                } 
     323 
     324                attributes++; 
     325        } 
     326         
     327        return 0; 
     328} 
     329 
     330 
    174331DWORD IcFsGetRootId() 
    175332{ 
     
    179336SYMBOL_EXPORT(IcFsGetRootId); 
    180337 
    181 int InfoRootCreate() 
     338int InfoInit() 
    182339{ 
    183340        KeFsInitRoot(&root); 
     
    185342        return 0; 
    186343} 
    187  
    188 int InfoCpuInit(); 
    189  
    190 int InfoInit() 
    191 { 
    192         InfoRootCreate(); 
    193  
    194 #if 0 
    195         InfoCreateDir(NULL, "Devices"); 
    196         InfoCpuInit(); 
    197         InfoCreateDir(NULL, "Memory"); 
    198 //      InfoMemInit(); 
    199         InfoCreateDir(NULL, "Processes"); 
    200 #endif 
    201  
    202         return 0; 
    203 } 
  • Whitix/branches/netchannel/fs/isofs/dir.c

    r1128 r2084  
    183183} 
    184184 
    185 int IsoLookup(struct VNode** retVal,struct VNode* dir,char* name,int nameLength) 
     185int IsoLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 
    186186{ 
    187187        DWORD i=0; 
     
    192192        struct IsoSbPriv* sbPriv=IsoGetSbPriv(dir->superBlock); 
    193193        char aName[256]; 
    194         int aNameLen; 
     194        size_t aNameLen; 
    195195 
    196196        while (i < dir->size) 
  • Whitix/branches/netchannel/fs/journal/commit.c

    r885 r2084  
    3939int JournalWaitCommit(struct Journal* journal, DWORD id) 
    4040{ 
    41         INIT_WAITQUEUE_ENTRY(waitEntry); 
     41        WAIT_DEFINE(waitEntry); 
    4242 
    4343        while (id > journal->commitSequence) 
     
    4747                ThrSuspendThread(currThread); 
    4848                ThrSchedule(); 
    49                 WaitRemoveFromQueue(&journal->commitWaitDone, &waitEntry); 
     49                WaitFinishWait(&journal->commitWaitDone, &waitEntry); 
    5050        } 
    5151 
     
    219219                JournalUnlock(journal); 
    220220                KePrint("wait: %u ", commitTrans->updates); 
    221                 WAIT_ON(journal->waitUpdates, !commitTrans->updates); 
     221                WAIT_ON(&journal->waitUpdates, !commitTrans->updates); 
    222222                JournalLock(journal); 
    223223        } 
  • Whitix/branches/netchannel/fs/journal/journals.c

    r1338 r2084  
    137137        struct Journal* journal=(struct Journal*)arg; 
    138138        struct Timer commitTimer; 
    139         INIT_WAITQUEUE_ENTRY(commitWait); 
     139        WAIT_DEFINE(commitWait); 
    140140 
    141141        INIT_WAITQUEUE_HEAD(&journal->commitWait); 
     
    167167                TimerRemove(&commitTimer); 
    168168                 
    169                 WaitRemoveFromQueue(&journal->commitWait, &commitWait); 
     169                WaitFinishWait(&journal->commitWait, &commitWait); 
    170170 
    171171                /* Get the running transaction, if we timed out, and commit that. Check expires. */ 
     
    244244        journal->flags|=JOURN_UNMOUNT; 
    245245        WakeUp(&journal->commitWait); 
    246         WAIT_ON(journal->commitWaitDone, !journal->flags); 
     246        WAIT_ON(&journal->commitWaitDone, !journal->flags); 
    247247         
    248248        if (journal->currTransaction) 
  • Whitix/branches/netchannel/fs/journal/transaction.c

    r885 r2084  
    287287                        JournalUnlock(journal); 
    288288                        KePrint("shadow wait, %#X, %u\n", head, JournHeadToBuffer(head)->blockNum); 
    289                         WAIT_ON(head->wait, head->list != JOURN_SHADOW); 
     289                        WAIT_ON(&head->wait, head->list != JOURN_SHADOW); 
    290290                        JournalLock(journal); 
    291291                        goto repeat; 
  • Whitix/branches/netchannel/fs/kfs/dir.c

    r1091 r2084  
    2323SYMBOL_EXPORT(KeFsDirSize); 
    2424 
    25 struct KeFsEntry* KeFsLookupDir(struct KeFsDir* dir, char* name, int nameLength) 
     25struct KeFsEntry* KeFsLookupDir(struct KeFsDir* dir, char* name, size_t nameLength) 
    2626{ 
    2727        struct KeFsEntry* entry; 
     
    5959SYMBOL_EXPORT(KeFsLookup); 
    6060 
    61 int KeFsReadDir(struct File* file, int (*fillDir)(void*, char*, int, DWORD), void* dirEntries) 
     61int KeFsReadDir(struct File* file, int (*fillDir)(void*, const char*, size_t, DWORD), void* dirEntries) 
    6262{ 
    6363        struct KeFsEntry* entry; 
     
    128128SYMBOL_EXPORT(KeFsNameToDir); 
    129129 
    130 struct KeFsEntry* KeFsAddDir(struct KeFsDir* dir, char* name) 
     130struct KeFsEntry* KeFsAddDir(struct KeFsDir* dir, const char* name) 
    131131{ 
    132132        struct KeFsDir *newDir; 
     
    160160SYMBOL_EXPORT(KeFsAddDir); 
    161161 
    162 struct KeFsEntry* KeFsAddEntry(struct KeFsDir* dir, char* name, DWORD permissions) 
     162struct KeFsEntry* KeFsAddEntry(struct KeFsDir* dir, const char* name, DWORD permissions) 
    163163{ 
    164164        struct KeFsEntry* entry; 
  • Whitix/branches/netchannel/fs/reiserfs/dir.c

    r929 r2084  
    11#include "reiserfs.h" 
    22 
    3 int ReLookup(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
     3int ReLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
    44int ReReadDir(struct File* file, void* dirEntries); 
    55int ReBlockMap(struct VNode* vNode, DWORD offset, int flags); 
     
    4040} 
    4141 
    42 int ReLookup(struct VNode** retVal,struct VNode* dir,char* name,int nameLength) 
     42int ReLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 
    4343{ 
    4444        struct ReCpuKey key; 
  • Whitix/branches/netchannel/fs/vfs/bcache.c

    r1687 r2084  
    9090void BufferUnlock(struct Buffer* buffer) 
    9191{ 
    92         buffer->flags &= ~(1 << BUFFER_LOCKED); 
    93         WakeUp(&buffer->waitQueue); 
     92        BitClear(&buffer->flags, BUFFER_LOCKED); 
     93        WakeUpAll(&buffer->waitQueue); 
    9494} 
    9595 
     
    9999{ 
    100100        BufferGet(buffer); 
    101         INIT_WAITQUEUE_ENTRY(bufferWait); 
    102          
    103         do 
    104         { 
    105                 WaitAddToQueue(&buffer->waitQueue, &bufferWait); 
    106                 ThrSuspendThread(currThread); 
    107                  
    108                 if (!BufferLocked(buffer)) 
    109                         KePrint("Buffer is not locked!\n"); 
    110                  
    111                 ThrSchedule(); 
    112         }while (BufferLocked(buffer)); 
    113  
     101        WAIT_ON(&buffer->waitQueue, !BufferLocked(buffer)); 
    114102        BufferRelease(buffer); 
    115103} 
     
    290278{ 
    291279        struct Buffer* buff; 
    292  
     280         
    293281        /* Exit early if buffer is already in memory */ 
    294282        if ((buff=BlockFindBuffer(device,blockNum))) 
     
    518506} 
    519507 
     508#ifdef CONFIG_DEBUG 
     509int BlockDebug() 
     510{ 
     511        struct StorageDevice* sDevice; 
     512        struct KeObject* object, *object2; 
     513        struct Buffer* curr; 
     514 
     515        KePrint("Block:\n"); 
     516 
     517        ListForEachEntrySafe(object, object2, &storageClass.set.head, next) 
     518        { 
     519                sDevice = KeObjectToStorageDev(object); 
     520                int i; 
     521                for (i = 0; i<HASH_MASK; i++) 
     522                { 
     523                ListForEachEntry(curr, &sDevice->hashLists[i], list) 
     524                { 
     525                        KePrint("(%#X, %d) ", curr->blockNum, curr->flags); 
     526                        if (!ListEmpty(&curr->waitQueue.list)) 
     527                                KePrint(" ##### "); 
     528                } 
     529                } 
     530        } 
     531} 
     532#endif 
     533 
    520534int BlockInit() 
    521535{ 
  • Whitix/branches/netchannel/fs/vfs/dir.c

    r1328 r2084  
    310310 ***********************************************************************/ 
    311311 
    312 int FillDir(void* entries,char* name,int nameLen,DWORD vNum) 
     312int FillDir(void* entries, const char* name, size_t nameLen, DWORD vNum) 
    313313{ 
    314314        struct FillDirInfo* dirEntries=(struct FillDirInfo*)entries; 
     
    524524} 
    525525 
    526 int SysGetCurrDir(char* str,int size) 
     526int SysGetCurrDir(char* str, size_t size) 
    527527{ 
    528528        if (strlen(current->sCwd) > size) 
    529529                return -EFAULT; /* -ETOOLONG */ 
    530530 
    531         if (VirtCheckArea((void*)str,(DWORD)size,VER_WRITE)) 
     531        if (VirtCheckArea((void*)str, (DWORD)size, VER_WRITE)) 
    532532                return -EFAULT; 
    533533 
    534         strncpy(str,current->sCwd,size); 
     534        strncpy(str, current->sCwd, size); 
    535535 
    536536        return strlen(current->sCwd); 
  • Whitix/branches/netchannel/fs/vfs/file.c

    r1686 r2084  
    606606{ 
    607607        struct File* file=FileGet(fd); 
     608         
    608609        if (UNLIKELY(!file)) 
    609610                return -EBADF; 
     
    740741} 
    741742 
    742 /* TODO: Create sync function for file operations. */ 
     743/* TODO: Create sync function for file operations structure. */ 
    743744int SysFileSync(int fd) 
    744745{ 
  • Whitix/branches/netchannel/fs/vfs/poll.c

    r881 r2084  
    2525#include <print.h> 
    2626#include <user_acc.h> 
     27#include <timer.h> 
    2728 
    2829int PollAddWait(struct PollQueue* pollQueue, WaitQueue* newQueue) 
     
    3637 
    3738        /* And add the wait queue to the poll wait queues. */ 
    38         pollQueue->waitQueues[pollQueue->i++]=newQueue; 
     39        pollQueue->waitQueues[pollQueue->i++] = newQueue; 
    3940 
    4041        PreemptEnable(); 
     
    4748int VfsPollFd(int fd, struct PollItem* pollItem, struct PollQueue* waitQueues) 
    4849{ 
    49         struct File* file; 
    50  
    51         file=FileGet(fd); 
     50        struct File* file = FileGet(fd); 
     51         
    5252        if (!file->fileOps || !file->fileOps->poll) 
    5353                return -EINVAL; 
     
    9696                for (i=0; i<numFds; i++) 
    9797                { 
    98                         VfsPollFd(pollArray[i].fd, &pollArray[i], &pollQueue); 
     98                        if (VfsPollFd(pollArray[i].fd, &pollArray[i], &pollQueue) < 0) 
     99                        { 
     100                                changed = -EINVAL; 
     101                                goto error; 
     102                        } 
     103 
     104                        pollArray[i].revents &= pollArray[i].events; 
    99105 
    100106                        if (pollArray[i].revents > 0) 
     
    106112                         
    107113                /* Just wait until someone wakes us up. */ 
    108 //              if (timeout != -1) 
    109 //                      Sleep(timeout); 
    110 //              else{ 
     114                if (timeout != -1) 
     115                        Sleep(timeout); 
     116                else{ 
    111117                        ThrSuspendThread(currThread); 
    112118                        ThrSchedule(); 
    113 //              } 
     119                } 
    114120                 
    115121                timeout=0; 
    116122        } 
    117123 
     124error: 
    118125        IrqSaveFlags(flags); 
    119126 
     
    121128        for (i=0; i<numFds; i++) 
    122129                if (pollQueue.waitQueues[i]) 
    123                         WaitRemoveFromQueue(pollQueue.waitQueues[i], &pollQueue.waitEntries[i]); 
     130                        WaitFinishWait(pollQueue.waitQueues[i], &pollQueue.waitEntries[i]); 
    124131 
    125132        MemFree(pollQueue.waitEntries); 
  • Whitix/branches/netchannel/fs/vfs/vcache.c

    r1329 r2084  
    376376{ 
    377377        if (vNode->lock) 
    378                 WAIT_ON(vNode->waitQueue, vNode->lock == 0); 
     378                WAIT_ON(&vNode->waitQueue, vNode->lock == 0); 
    379379} 
    380380 
     
    390390{ 
    391391        vNode->lock=0; 
    392         WakeUp(&vNode->waitQueue); 
     392        WakeUpAll(&vNode->waitQueue); 
    393393} 
    394394 
  • Whitix/branches/netchannel/fs/vfs/vnode.c

    r1327 r2084  
    306306                return -ENOTIMPL; 
    307307 
    308         blockSize=BYTES_PER_SECTOR(vNode->superBlock); 
     308        blockSize = BYTES_PER_SECTOR(vNode->superBlock); 
    309309 
    310310        /* Read in PAGE_SIZE/blockSize buffers to the page. */ 
     
    317317                        ZeroMemory(page+(i*blockSize), blockSize); 
    318318                else{ 
    319                         buff=BlockRead(vNode->superBlock->sDevice, res); 
     319                        buff = BlockRead(vNode->superBlock->sDevice, res); 
    320320                        if (!buff) 
    321321                        { 
  • Whitix/branches/netchannel/include/config.h

    r1693 r2084  
    33 
    44#define CONFIG_ALL_SYMBOLS 
     5/* #define CONFIG_DEBUG */ 
    56 
    6 #define KERN_LOG_LEVEL          5 
     7#define KERN_LOG_LEVEL          7 
     8#define KERNEL_ADDRESS_BASE             0xC0000000 
    79 
    810#endif 
  • Whitix/branches/netchannel/include/error.h

    r608 r2084  
    5555#define ECONNRESET      26 /* Connection reset by peer. */ 
    5656#define ETIMEDOUT       27 /* Operation timed out. */ 
     57#define ENOROUTE        28 /* There is no route to the specified endpoint. */ 
    5758 
    5859#endif 
  • Whitix/branches/netchannel/include/fs/bcache.h

    r1045 r2084  
    3636 
    3737/* Defines for dealing with flags. */ 
    38 #define BufferLocked(buffer) ((buffer)->flags & (1 << BUFFER_LOCKED)) 
     38#define BufferLocked(buffer) (BitTest(&(buffer)->flags, BUFFER_LOCKED)) 
    3939#define BufferDirty(buffer) ((buffer)->flags & (1 << BUFFER_DIRTY)) 
    4040#define BufferJournal(buffer) ((buffer)->flags & (1 << BUFFER_JOURNAL)) 
  • Whitix/branches/netchannel/include/fs/exports.h

    r1691 r2084  
    5454int SysUnmount(char* mountPoint); 
    5555 
    56 int SysGetCurrDir(char* path,int len); 
     56int SysGetCurrDir(char* path, size_t len); 
    5757 
    5858int SysStat(char* path, void* stat, int fdAt); 
  • Whitix/branches/netchannel/include/fs/icfs.h

    r1081 r2084  
     1/*  This file is part of Whitix. 
     2 * 
     3 *  Whitix is free software; you can redistribute it and/or modify 
     4 *  it under the terms of the GNU General Public License as published by 
     5 *  the Free Software Foundation; either version 2 of the License, or 
     6 *  (at your option) any later version. 
     7 * 
     8 *  Whitix is distributed in the hope that it will be useful, 
     9 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
     10 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     11 *  GNU General Public License for more details. 
     12 * 
     13 *  You should have received a copy of the GNU General Public License 
     14 *  along with Whitix; if not, write to the Free Software 
     15 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
     16 * 
     17 */ 
     18 
    119#ifndef ICFS_H 
    220#define ICFS_H 
    321 
    422#include <llist.h> 
     23#include <keobject.h> 
     24#include <typedefs.h> 
    525 
    626#define ICFS_TYPE_INT   0 
     
    929#define ICFS_TYPE_FUNC  3 
    1030 
     31typedef int (*IcReadFunc)(struct KeObject* object, BYTE* data, unsigned long size, DWORD position); 
     32typedef int (*IcWriteFunc)(struct KeObject* object, BYTE* data, unsigned long size, DWORD position); 
     33 
     34struct IcFuncEntry 
     35{ 
     36        IcReadFunc readFunc; 
     37        IcWriteFunc writeFunc; 
     38}; 
     39 
     40#define IC_READ         0 
     41#define IC_RW           1 
     42 
     43/* Type definitions */ 
     44 
    1145struct IcAttribute 
    1246{ 
     47        int type; 
     48 
     49        IcReadFunc readFunc; 
     50        IcWriteFunc writeFunc; 
     51                 
    1352        int offset; 
     53        int perms; 
     54         
     55        const char* name; 
    1456}; 
    1557 
    16 #define IC_INT(structure, member, perms) \ 
    17         { 0, } 
     58#define IC_INT(structure, member, permissions) \ 
     59        { \ 
     60          .type = ICFS_TYPE_INT, \ 
     61          .offset = OffsetOf(structure, member), \ 
     62          .name = #member, \ 
     63          .perms = permissions \ 
     64        } 
     65         
     66#define IC_INT_NAME(objName, structure, member, permissions) \ 
     67        { \ 
     68          .type = ICFS_TYPE_INT, \ 
     69          .offset = OffsetOf(structure, member), \ 
     70          .name = objName, \ 
     71          .perms = permissions \ 
     72        } 
     73         
     74#define IC_STRING(structure, member, permissions) \ 
     75        { \ 
     76          .type = ICFS_TYPE_STR, \ 
     77          .offset = OffsetOf(structure, member), \ 
     78          .name = #member, \ 
     79          .perms = permissions \ 
     80        } 
     81         
     82#define IC_STRING_NAME(objName, structure, member, permissions) \ 
     83        { \ 
     84                .type = ICFS_TYPE_STR, \ 
     85                .offset = OffsetOf(structure, member) \ 
     86                .name = objName, \ 
     87                .perms = permissions, \ 
     88        } 
     89         
     90#define IC_FUNC(objName, funcRead, funcWrite) \ 
     91        { \ 
     92                .type = ICFS_TYPE_FUNC, \ 
     93                .readFunc = funcRead, \ 
     94                .writeFunc = funcWrite, \ 
     95                .name = objName, \ 
     96        } 
    1897         
    1998#define IC_END() \ 
    20         { 0, } 
     99        { -1, NULL, NULL, -1, -1, NULL } 
    21100 
    22101struct IcFsEntry 
    23102{ 
    24103        int type; 
     104        struct KeObject* owner; 
     105 
    25106        union 
    26107        { 
    27108                int* iVal; 
    28                 char* sVal; 
     109                char** sVal; 
    29110                 
     111                /* Array entries. */ 
    30112                struct 
    31113                { 
    32114                        char* csVal; 
    33                         int minLen, maxLen, size; 
     115                        unsigned int minLen, maxLen, size; 
    34116                }; 
     117                 
     118                /* Function entries. */ 
     119                struct IcFuncEntry entry; 
    35120        }; 
    36121}; 
    37122 
    38123struct KeFsEntry* IcFsCreateDir(struct KeFsEntry* dir, char* name); 
    39 int IcFsAddIntEntry(struct KeFsEntry* dir, char* name, int* value, DWORD permissions); 
    40 struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, char* name, char* str, DWORD permissions); 
    41 int IcFsAddSoftLink(struct KeFsEntry* dir, char* name, 
     124 
     125/* Adding an entry to a IcFs directory. */ 
     126int IcFsAddIntEntry(struct KeFsEntry* dir, const char* name, int* value, DWORD permissions); 
     127 
     128struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, const char* name, char** str, DWORD permissions); 
     129 
     130int IcFsAddArrayEntry(struct KeFsEntry* dir, const char* name, char* array, unsigned int minLen, unsigned int maxLen, unsigned int size); 
     131 
     132int IcFsAddSoftLink(struct KeFsEntry* dir, const char* name, 
    42133        int (*followLink)(struct KeFsEntry**, struct KeFsEntry*)); 
     134         
     135/*  
     136 * Permissions are calculated from the values of readFunc and writeFunc. That is, 
     137 * a entry with no write function is read-only. 
     138 */ 
     139int IcFsAddFuncEntry(struct KeFsEntry* dir, struct KeObject* object, const char* name, IcReadFunc readFunc, IcWriteFunc writeFunc); 
     140 
     141int IcFsRemoveDir(struct KeFsEntry* dir); 
    43142 
    44143#endif 
  • Whitix/branches/netchannel/include/fs/kfs.h

    r1690 r2084  
    2626        }; 
    2727         
    28         char* name; 
     28        const char* name; 
    2929}; 
    3030 
     
    3333int KeFsDirSize(struct KeFsDir* dir); 
    3434struct KeFsEntry* KeFsLookup(struct VNode* dir, char* name, int nameLength); 
    35 int KeFsReadDir(struct File* file, int (*fillDir)(void*, char*, int, DWORD), void* dirEntries); 
    36 struct KeFsEntry* KeFsAddDir(struct KeFsDir* dir, char* name); 
     35int KeFsReadDir(struct File* file, int (*fillDir)(void*, const char*, size_t, DWORD), void* dirEntries); 
     36struct KeFsEntry* KeFsAddDir(struct KeFsDir* dir, const char* name); 
    3737int KeFsRemoveDir(struct KeFsEntry* entry); 
    38 struct KeFsEntry* KeFsAddEntry(struct KeFsDir* dir, char* name, DWORD permissions); 
     38struct KeFsEntry* KeFsAddEntry(struct KeFsDir* dir, const char* name, DWORD permissions); 
    3939struct KeFsDir* KeFsDirLookup(char* name, int nameLength, struct KeFsDir* dir); 
    4040struct KeFsDir* KeFsNameToDir(struct KeFsDir* dir, char** name); 
    41 struct KeFsEntry* KeFsLookupDir(struct KeFsDir* dir, char* name, int nameLength); 
     41struct KeFsEntry* KeFsLookupDir(struct KeFsDir* dir, char* name, size_t nameLength); 
    4242 
    4343#endif 
  • Whitix/branches/netchannel/include/fs/vfs.h

    r1692 r2084  
    138138        struct VNodeOps* vNodeOps; 
    139139        struct FileOps* fileOps; 
     140        struct VmAreaOps* areaOps; 
    140141        struct ListHead next; 
    141142        DevId devId; 
     
    191192}; 
    192193 
    193 int FillDir(void* dirEntry,char* name,int nameLen,DWORD vNodeNum);  
     194int FillDir(void* dirEntry, const char* name, size_t nameLen,DWORD vNodeNum);  
    194195 
    195196/* Flags to pass to block map */ 
     
    198199struct VNodeOps 
    199200{ 
    200         int (*create)(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
    201         int (*remove)(struct VNode* dir,char* name,int nameLen); 
    202         int (*lookup)(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
    203         int (*mkDir)(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
    204         int (*rmDir)(struct VNode* dir,char* name,int nameLength); 
     201        int (*create)(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
     202        int (*remove)(struct VNode* dir,char* name, size_t nameLen); 
     203        int (*lookup)(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
     204        int (*mkDir)(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 
     205        int (*rmDir)(struct VNode* dir,char* name, size_t nameLength); 
    205206        int (*permission)(struct VNode* vNode,int access); 
    206207        int (*followLink)(struct VNode** retVal, struct VNode* vNode); 
  • Whitix/branches/netchannel/include/i386/i386.h

    r1695 r2084  
    3636#define CR0_NW 0x20000000 /* No write-through */ 
    3737 
    38 #define ARCH_STACK_TOP 0xC0000000 
     38#define ARCH_STACK_TOP 0x80000000 
    3939#define ARCH_STACK_SIZE 4096 /* Kernel stack size */ 
    4040 
  • Whitix/branches/netchannel/include/keobject.h

    r1092 r2084  
    216216struct KeObject* KeSetFind(struct KeSet* set, const char* name); 
    217217 
     218#define KeSetForEach(pos, set, object) \ 
     219        ListForEachEntry(pos, &set.head, object.next) 
     220 
    218221struct KeSubsystem 
    219222{ 
  • Whitix/branches/netchannel/include/llist.h

    r1719 r2084  
    6262{ 
    6363        DoListRemove(entry->prev, entry->next); 
    64         entry->prev = NULL; 
    65         entry->next = NULL; 
    6664} 
    6765 
     
    8280 
    8381#define ListForEachEntry(pos,head,member) \ 
    84         for (pos=ListEntry((head)->next,typeof(*pos),member); \ 
     82        for (pos=ListEntry((head)->next,typeof(*pos), member); \ 
    8583         &(pos->member) != head; \ 
    8684         pos=ListEntry(pos->member.next, typeof(*pos), member)) 
  • Whitix/branches/netchannel/include/locks.h

    r666 r2084  
    11#ifndef LOCKS_H 
    22#define LOCKS_H 
     3 
     4#ifndef SMP 
     5#define PREFIX_LOCK             "lock; " 
     6#else 
     7#define PREFIX_LOCK     "" 
     8#endif 
     9 
     10#define ADDR (*(volatile long*)address) 
     11 
     12static inline int BitTest(volatile void* address, int bit) 
     13{ 
     14        int oldBit; 
     15 
     16        asm volatile("" 
     17                "btl %2, %1\n\t" 
     18                "sbbl %0, %0" 
     19                : "=r"(oldBit) 
     20                : "m"(ADDR), "Ir"(bit)); 
     21 
     22        return oldBit; 
     23} 
     24 
     25static inline void BitSet(volatile void* address, int bit) 
     26{ 
     27        asm volatile("" 
     28                "btsl %1, %0" 
     29                :"+m"(ADDR) 
     30                :"Ir"(bit)); 
     31} 
     32 
     33static inline void BitClear(volatile void* address, int bit) 
     34{ 
     35        asm volatile("" 
     36                "btrl %1, %0" 
     37                :"+m"(ADDR) 
     38                :"Ir"(bit)); 
     39} 
    340 
    441static inline int BitTestAndSet(volatile void* address, int bit) 
     
    946                "btsl %2, %1\n\t" 
    1047                "sbbl %0, %0" 
    11                 :"=r"(oldBit), "=m"(*(volatile long*)address) 
    12                 :"Ir"(bit) : "memory"); 
     48                :"=r"(oldBit), "=m"(ADDR) 
     49                :"ir"(bit) : "memory"); 
    1350 
    1451        return oldBit; 
    1552} 
    1653 
     54static inline int BitTestAndClear(volatile void* address, int bit) 
     55{ 
     56        int oldBit; 
     57         
     58        asm volatile("" 
     59                "btr %2, %1\n\t" 
     60                "sbb %0, %0" 
     61                : "=r"(oldBit), "=m"(ADDR) 
     62                : "Ir"(bit) : "memory"); 
     63                 
     64        return oldBit; 
     65} 
     66 
    1767#endif 
  • Whitix/branches/netchannel/include/module.h

    r2061 r2084  
    3232#include <elf.h> 
    3333#include <llist.h> 
     34#include <types.h> 
    3435#include <typedefs.h> 
    3536 
     
    4243 
    4344        struct KernelSymbol* keSymTab; 
    44         int keSymTabSize; 
     45        size_t keSymTabSize; 
    4546 
    4647        /* ELF specific information. */ 
     
    5253 
    5354        char* strTable; 
    54         int strTableSize; 
     55        size_t strTableSize; 
    5556 
    5657        struct ElfSymbol* symTable; 
    57         int symTableSize; 
     58        size_t symTableSize; 
    5859        int flags; 
    5960}; 
  • Whitix/branches/netchannel/include/net/buffer.h

    r2061 r2084  
    88#include <llist.h> 
    99 
     10#include <print.h> 
     11 
    1012struct NetDevice; 
    1113 
     
    1416        struct ListHead next; 
    1517        unsigned char* start, *data; 
    16         int type; 
     18        int type, refs; 
    1719        unsigned int length; 
    1820        struct NetDevice* device; 
     21 
     22        /* Pointers into the buffer */ 
     23        BYTE* macHeader; 
     24        BYTE* networkHeader; 
     25        BYTE* transportHeader; 
    1926}; 
    2027 
     
    6370         
    6471        ret->length = length; 
     72        ret->refs = 1; 
    6573        ret->data = ret->start = (unsigned char*)MemAlloc(length); 
    6674         
     
    7381         
    7482        ret->length = length; 
     83        ret->refs = 1; 
    7584        ret->data = ret->start = data; 
    7685         
     
    8392         
    8493        ret->length = length; 
     94        ret->refs = 1; 
    8595        ret->data = ret->start = (unsigned char*)MemAlloc(length); 
    8696         
     
    90100static inline void NetFreeBuffer(struct NetBuffer* buffer) 
    91101{ 
     102        if (--buffer->refs > 0) 
     103                return; 
     104                 
    92105        MemFree(buffer->start); 
    93106        MemFree(buffer); 
  • Whitix/branches/netchannel/include/net/channels.h

    r2061 r2084  
    2626#include <i386/i386.h> 
    2727#include <wait.h> 
     28#include <fs/vfs.h> 
    2829 
    2930struct ChannelHead; 
     
    3435}PACKED; 
    3536 
     37/* Information that kernel and user code will often need to refer to while 
     38 * constructing a packet */ 
     39struct ChannelInfo 
     40{ 
     41        unsigned short numSendBuffers, numSendPages; 
     42        unsigned short numRecvBuffers, numRecvPages; 
     43        unsigned short sendHeaderBytes, recvHeaderBytes; /* Header bytes for data-link addressing. */ 
     44        unsigned short hwHeaderBytes; 
     45        unsigned short maxPacketSize; 
     46}; 
     47 
    3648/* Channel types. */ 
    3749#define CHANNEL_IP              0x00 
    3850 
    3951#define CHANNEL_MAX     1 
     52 
     53#define CHAN_HEADER_MAGIC       (('N' << 24) | ('C' << 16) | ('H' << 8) | 'L')  
     54 
     55#define CHAN_DEFAULT_SEND_BUFFERS       10 
     56#define CHAN_MAX_SEND_BUFFERS           64 
     57#define CHAN_DEFAULT_RECV_BUFFERS       25 
     58#define CHAN_MAX_RECV_BUFFERS           512 
     59 
     60/* The new structure - see design document. */ 
     61struct ChanUserHeader 
     62{ 
     63        int magic; 
     64        unsigned short recvId; 
     65        BYTE sendAllocMap[(CHAN_MAX_SEND_BUFFERS+7)/8]; 
     66        BYTE recvAllocMap[(CHAN_MAX_RECV_BUFFERS+7)/8]; 
     67 
     68        /* Used in the usercode library. Userspace usually keeps a pointer to this */ 
     69        struct ChannelInfo info; 
     70}; 
     71 
     72#define CHAN_SEND_MAGIC         (('S' << 24) | ('E' << 16) | ('N' << 8) | 'D') 
     73#define CHAN_INDEX_SHIFT        4 
     74 
     75/* Both headers have a indexFlags field. */ 
     76#define ChanSetIndex(header, i) ((header)->indexFlags |= (i << \ 
     77                        CHAN_INDEX_SHIFT)) 
     78#define ChanGetIndex(header) (((header)->indexFlags & (0xF0)) >> \ 
     79                CHAN_INDEX_SHIFT) 
     80 
     81struct ChanSendHeader 
     82{ 
     83        unsigned int magic; 
     84        unsigned short length; 
     85        unsigned short indexFlags; 
     86        int ret; 
     87}; 
     88 
     89struct ChanRecvHeader 
     90{ 
     91        unsigned int magic; 
     92        unsigned short read; 
     93        unsigned short id; 
     94        unsigned short length; 
     95        unsigned short indexFlags; 
     96        void* priv; 
     97}; 
     98 
     99struct ChannelOptions 
     100{ 
     101        int flags; 
     102        unsigned short sendBuffers, recvBuffers; 
     103}; 
     104 
     105 
     106/* Flags */ 
     107 
     108#define CHANNEL_IGNORE_ADDRESSES        0x01 
    40109 
    41110/* struct Channel 
     
    51120{ 
    52121        unsigned short family, type; 
    53         unsigned int flags; 
     122        int flags; 
    54123 
    55124        struct ChannelAddr srcAddr, destAddr; 
     125        struct ChannelInfo info; 
    56126 
    57127        /* Copying data. */ 
    58         struct ChanMasterPage* masterPage; 
    59         unsigned int pos, lastRead; 
    60128        WaitQueue waitQueue; 
     129        char** pages; 
     130 
     131        /* Mapped into kernel space and shared with userspace */ 
     132        struct ChanUserHeader* header; 
     133        unsigned short latestRecv; 
     134 
     135        /* Used for routing data. */ 
     136        void* device; 
     137        void* route; 
     138        void* transPriv; 
     139 
     140        /* File and VMM */ 
     141        struct File* file; 
    61142         
    62143        struct ListHead next; 
    63144}; 
    64145 
     146static inline DWORD ChanHeaderBytes(struct Channel* channel) 
     147{ 
     148        return channel->info.hwHeaderBytes; 
     149} 
     150 
     151static inline DWORD ChanSendHeaderBytes(struct Channel* channel) 
     152{ 
     153        return channel->info.sendHeaderBytes; 
     154} 
     155 
     156static inline DWORD ChanRecvHeaderBytes(struct Channel* channel) 
     157{ 
     158        return channel->info.recvHeaderBytes; 
     159} 
     160 
     161static inline DWORD ChanMaxPacketSize(struct Channel* channel) 
     162{ 
     163        return channel->info.maxPacketSize; 
     164} 
     165 
     166static inline DWORD ChanBufferSize(struct Channel* channel) 
     167{ 
     168        return ChanHeaderBytes(channel) + ChanMaxPacketSize(channel); 
     169} 
     170 
     171static inline DWORD ChanSendPages(struct Channel* channel) 
     172{ 
     173        return channel->info.numSendPages; 
     174} 
     175 
     176static inline DWORD ChanRecvPages(struct Channel* channel) 
     177{ 
     178        return channel->info.numRecvPages; 
     179} 
     180 
    65181struct ChannelOps 
    66182{ 
    67         struct ChannelHead* (*create)(struct Channel* channel); 
     183        int (*create)(struct Channel* channel, struct ChannelHead** head, struct 
     184                        ChannelOptions* options); 
    68185        int (*control)(struct Channel* channel, int code, void* data); 
    69186        int (*write)(struct Channel* channel, void* data, unsigned int length); 
     
    72189}; 
    73190 
    74 #define CHANNEL_NUM_PER_PAGE    (PAGE_SIZE/sizeof(void*)) 
    75 #define CHANNEL_MAX_ITER        10 
    76  
    77 /* One for sending, and one for recieving? */ 
    78 struct ChanMasterPage 
    79 { 
    80         void* pages[CHANNEL_NUM_PER_PAGE]; 
    81 }; 
    82  
    83191struct ChannelHead 
    84192{ 
     
    86194        struct ListHead head; 
    87195}; 
     196 
     197struct Channel* ChannelAlloc(); 
     198void ChannelFree(struct Channel* channel); 
     199int ChannelMemorySetup(struct Channel* channel, struct ChannelOptions* options); 
     200int ChanRegisterFamily(int family, struct ChannelOps* channelOps); 
     201int ChannelCopyPacket(struct Channel* channel, struct NetBuffer* buffer); 
     202int ChanAttachFd(struct Channel* channel); 
     203 
     204void* ChannelMapPage(struct Channel* channel, DWORD address); 
     205void ChannelUnmapPage(void* page); 
    88206 
    89207typedef int (*ChanCompareFunc)(struct Channel*, struct ChannelAddr*, struct ChannelAddr*); 
     
    97215        ListForEachEntry(curr, &head->head, next) 
    98216        { 
    99                 if (compare(curr, src, dest) == 0) 
     217                if (compare(curr, src, dest) != 0) 
    100218                { 
    101219                        ret = curr; 
     
    107225} 
    108226 
    109 /* Flags */ 
    110  
    111 #define CHANNEL_IGNORE_ADDRESSES        0x01 
     227static inline struct Channel* ChanFromVNode(struct VNode* vNode) 
     228{ 
     229        if (!vNode) 
     230                return NULL; 
     231 
     232        return vNode->extraInfo; 
     233} 
     234 
     235static inline struct Channel* ChanFromFile(struct File* file) 
     236{ 
     237        if (!file || !file->vNode) 
     238                return NULL; 
     239                 
     240        return (file->vNode->extraInfo); 
     241} 
    112242 
    113243/* ChannelControl flags */ 
    114244#define CHANNEL_SET_FLAGS               0x01 
    115 #define CHANNEL_SET_DLINK               0x02 
     245#define CHANNEL_SET_INTERFACE   0x02 
     246 
     247/* Return codes, used to indicate incoming packet status to main receiver. */ 
     248#define CHAN_NOT_HANDLED        0 
     249#define CHAN_HANDLED            1 
    116250 
    117251#endif 
  • Whitix/branches/netchannel/include/net/device.h

    r2062 r2084  
    3131struct NetDevOps 
    3232{ 
     33        int (*start)(struct NetDevice* device); 
     34        int (*buildHeader)(struct NetDevice* device, struct NetBuffer* sockBuff, void* address); 
    3335        int (*send)(struct NetDevice* device, struct NetBuffer* sockBuff); 
    3436}; 
     
    3739#define NetDevPriv(dev) ((dev)->priv) 
    3840 
     41/* struct NetDevice - flags */ 
     42#define NET_DEVICE_LOOPBACK             0x01 
     43#define NET_DEVICE_RUNNING              0x02 
     44 
    3945struct NetDevice 
    4046{ 
    4147        struct KeDevice device; 
     48        char* infType; /* Ethernet%d, Loopback%d etc. */ 
    4249        int type; /* Ethernet, wireless etc. */ 
    4350        struct PciDevice* pciDev; 
     
    4754        struct ChannelOps* channelOps; 
    4855        unsigned long netAddress; 
     56        int flags; 
     57         
     58        struct ListHead next; 
    4959         
    5060        /* Data-link layer specifics. */ 
    5161        unsigned int headerLen, addressLen; 
     62        unsigned int mtu; 
    5263}; 
     64 
     65static inline struct NetDevice* NetDeviceFromObj(struct KeObject* object) 
     66{ 
     67        struct KeDevice* device = KeObjectToDevice(object); 
     68        return ContainerOf(device, struct NetDevice, device); 
     69} 
    5370 
    5471static inline unsigned int NetDevHeaderLen(struct NetDevice* device) 
     
    6481struct NetDevice* NetDeviceAlloc(); 
    6582int NetDeviceRegister(struct NetDevice* device); 
     83DWORD NetDevFindMinMtu(); 
     84DWORD NetDevFindMaxHeader(); 
     85int NetDeviceSend(struct NetDevice* device, struct NetBuffer* buffer); 
     86struct NetDevice* NetDeviceFind(); 
    6687 
    6788#endif 
  • Whitix/branches/netchannel/include/net/eth.h

    r1716 r2084  
    2323#include <typedefs.h> 
    2424 
    25 struct sEthMac 
    26 { 
    27         BYTE c[6];       
    28 }PACKED; 
    29  
    30 typedef struct sEthMac EthMac; 
     25typedef char EthMac[6]; 
    3126 
    3227struct EthDevice 
     
    3631}; 
    3732 
    38 static inline unsigned char* EthDevMacAddress(struct NetDevice* device) 
     33static inline BYTE* EthDevMacAddress(struct NetDevice* device) 
    3934{ 
    4035        return ((struct EthDevice*)(device->procPriv))->macAddress; 
     
    5550int EthDeviceRegister(struct EthDevice* device); 
    5651int EthSetAddress(struct EthDevice* device, BYTE* macAddress); 
    57  
     52int EthAddHeader(struct NetBuffer* buffer, unsigned char* srcAddr, unsigned char* dstAddr, unsigned short type); 
    5853int EthRecv(struct EthDevice* device, struct NetBuffer* buffer); 
    5954 
     
    6661} 
    6762 
    68 static inline void EthPrintMacAddress(struct EthDevice* ethDev) 
     63static inline void EthPrintMacAddress(BYTE* macAddress) 
    6964{ 
    7065        int i; 
    7166 
    7267        for (i=0; i<6; i++) 
    73                 KePrint("%2.2X%c", ethDev->macAddress[i], (i == 5) ? '\n' : ':'); 
     68                KePrint("%2.2X%c", macAddress[i], (i == 5) ? '\n' : ':'); 
    7469} 
    7570 
  • Whitix/branches/netchannel/include/net/ipv4.h

    r1715 r2084  
    2525#define IP_CHAN_LIST_MAX        64 
    2626 
     27#define IPV4_NUM_PROTOCOLS      4 
     28 
     29#define NET_CHANNEL_UDP         0x01 
     30#define NET_CHANNEL_ICMP        0x02 
     31#define NET_CHANNEL_TCP         0x03 
     32 
    2733/* Types of protocol in the 'protocol' field of struct IpHeader and struct Ipv4EndPoint. */ 
    28 #define PROTOCOL_TYPE_ICMP      1 
    29 #define PROTOCOL_TYPE_TCP       6 
    30 #define PROTOCOL_TYPE_UDP       17 
     34#define IPV4_PROTOCOL_TYPE_ICMP         1 
     35#define IPV4_PROTOCOL_TYPE_TCP          6 
     36#define IPV4_PROTOCOL_TYPE_UDP          17 
    3137 
    3238struct Ipv4EndPoint 
     
    3440        DWORD address; 
    3541        WORD port; 
    36         WORD protocol; 
    3742}; 
     43 
     44#define IPV4_PORT_ANY                   0x0 
     45 
     46#define IPV4_ALLOCATE_PORT              0x01 
     47 
     48#define IPV4_PMAP_SIZE                  2048 
     49 
     50struct Ipv4Protocol 
     51{ 
     52        char* name; 
     53        int rawProtocol; 
     54         
     55        /* Matching packets and protocols */ 
     56        struct ChannelHead* (*hash)(struct Ipv4EndPoint* src, struct Ipv4EndPoint* dest); 
     57        int (*chanNotFound)(struct NetBuffer* buffer); 
     58        ChanCompareFunc compareFunc; 
     59         
     60        int (*addChecksum)(struct Channel* channel, struct NetBuffer* buffer); 
     61 
     62        int flags; 
     63        BYTE* portMap; 
     64}; 
     65 
     66int Ipv4ProtoRegister(int type, struct Ipv4Protocol* proto); 
    3867 
    3968#define IP_VERSION(header) ((header)->versionLength >> 4) 
     
    6594        { 
    6695//              KePrint("IpCheckSum: odd number of bytes\n"); 
     96                (void)oddByte; 
    6797        } 
    6898         
     
    73103} 
    74104 
     105struct TcpHeader 
     106{ 
     107        WORD sourcePort, destPort; 
     108        DWORD seqNum, ackNum; 
     109        WORD offsetControl; 
     110        WORD window; 
     111        WORD checkSum, urgPointer; 
     112}; 
     113 
     114#define TCP_SYN                 0x02 
     115#define TCP_RST                 0x04 
     116#define TCP_PSH                 0x08 
     117#define TCP_ACK                 0x10 
     118 
     119struct RouteEntry 
     120{ 
     121        DWORD destination; 
     122        DWORD gateway; 
     123        DWORD mask; 
     124        int flags; 
     125        struct ListHead next; 
     126        struct NetDevice* device; 
     127}; 
     128 
     129#define IPV4_BROADCAST          0xFFFFFFFF 
     130 
     131struct RouteEntry* RouteLookup(DWORD address, struct NetDevice** dev); 
     132 
    75133#endif 
  • Whitix/branches/netchannel/include/pci.h

    r2061 r2084  
    6565#define         PCI_COMMAND_MEM         0x02 
    6666#define         PCI_COMMAND_MASTER      0x04 
     67#define PCI_LATENCY_TIMER       0x0D 
    6768#define PCI_SUBSYS_VENDOR_ID 0x2C 
    6869#define PCI_SUBSYS_ID           0x2E 
     
    128129void* PciAllocConsistent(struct PciDevice* device, unsigned int size, DWORD* dmaAddr); 
    129130 
     131/* Resource functions. */ 
     132int PciResourceStart(struct PciDevice* device, int index); 
     133 
    130134#endif 
  • Whitix/branches/netchannel/include/print.h

    r888 r2084  
    33 
    44#include <config.h> 
     5#include <stdarg.h> 
    56 
    67#define KERN_CRITICAL   "<0>" 
     
    1011#define KERN_DEBUG              "<4>" 
    1112 
    12 void KePrint(char* message, ...); 
     13void KeVaPrint(const char* message, VaList args); 
     14void KePrint(char* message, ...) /* __attribute__((format (printf, 1, 2))) */; 
    1315void KeSetOutput(void (*newOutput)(char*, int)); 
    1416 
  • Whitix/branches/netchannel/include/string.h

    r1321 r2084  
    2222#include <stdarg.h> 
    2323#include <typedefs.h> 
     24#include <types.h> 
    2425 
    2526int strncpy(char* dest,char* src,int len); 
    2627int strncmp(const char* s1,const char* s2,int num); 
    27 int strlen(char* str); 
    28 static inline int strcmp(const char* s1,const char* s2) {return strncmp(s1,s2,0xFFFFFFFF);} 
     28int strcmp(const char* s1, const char* s2); 
     29size_t strlen(const char* str); 
    2930int strnicmp(const char* s1,const char* s2,int num); 
    3031char* strcat(char* s1,const char* s2); 
    3132char* strchr(char* string,int c); 
    32 void* memcpy(void* dest,void* src,long size); 
     33void* memcpy(void* dest, const void* src, size_t size); 
     34char* strcpy(char* dest, const char* src); 
    3335 
    3436#if 0 
     
    6264 
    6365char* vasprintf(const char* fmt, VaList args); 
     66unsigned long strlcpy(char* dest, char* src, unsigned long size); 
     67int scnprintf(char* buf, unsigned long size, const char* fmt, ...); 
    6468 
    6569#endif 
  • Whitix/branches/netchannel/include/timer.h

    r2061 r2084  
    2828        void (*func)(void* data); 
    2929        void* data; 
    30         void* timerLevel; 
     30        void* timerPriv[2]; 
    3131}; 
    3232 
  • Whitix/branches/netchannel/include/typedefs.h

    r986 r2084  
    2222#define MIN(a,b) (((a < b) ? a : b)) 
    2323#define MAX(a,b) (((a > b) ? a : b)) 
     24 
     25#include <types.h> 
    2426 
    2527/* Some i386-isms */ 
  • Whitix/branches/netchannel/include/vmm.h

    r1323 r2084  
    5151struct VmAreaOps 
    5252{ 
    53         int (*handleNoPage)(struct VMArea* area, DWORD address, DWORD offset); 
     53        int (*noPage)(struct VMArea* area, DWORD address, DWORD offset); 
    5454        int (*addPage)(struct VMArea* area, DWORD address); 
    5555}; 
     
    6363struct VMArea* VmLookupAddress(struct Process* process,DWORD address); 
    6464struct VMMapPage* VmLookupPage(struct VNode* vNode,DWORD offset); 
     65int VmMapFilePhysPage(struct VNode* vNode, int offset, DWORD address); 
    6566struct VMMapPage* VmCreateMappedPage(DWORD offset,struct PhysPage* page); 
    6667DWORD MMapFindAddress(struct Process* process,DWORD length); 
     
    7576void VmWaitForPage(struct VMMapPage* page); 
    7677int VmFreeMappedPage(struct VNode* vNode, DWORD physAddr); 
     78 
     79static inline int VmPageOffset(struct Process* process, DWORD address) 
     80{ 
     81        struct VMArea* area = VmLookupAddress(process, address); 
     82         
     83        if (!area) 
     84                return -1; 
     85 
     86        return (int)((address - area->start)/PAGE_SIZE); 
     87} 
    7788 
    7889/* General page fault errors */ 
     
    95106/* General mmap defines */ 
    96107#define MMAP_BASE       (0x800000) 
    97 #define MMAP_END        (0xC0000000) 
     108#define MMAP_END        KERNEL_ADDRESS_BASE 
    98109 
    99110#endif 
  • Whitix/branches/netchannel/include/wait.h

    r1689 r2084  
    2525#include <typedefs.h> 
    2626 
    27 void KePrint(char*, ...); 
    28  
    2927/* Uncomment this if you'd like to investigate strange wait-queue behaviour. */ 
    30 /* #define WAIT_DEBUG */  
    3128 
    3229struct WaitQueueTag 
     
    5451}; 
    5552 
    56 #define INIT_WAITQUEUE_ENTRY(waitEntry) \ 
    57         struct WaitQueueEntry waitEntry={currThread, {NULL, NULL}} 
     53#define WAIT_DEFINE(name) \ 
     54        struct WaitQueueEntry name = { \ 
     55                .thread = currThread, \ 
     56                .next = LIST_HEAD_INIT((name).next) \ 
     57        } 
    5858 
    59 static inline void WaitAddToQueue(WaitQueue* waitQueue,struct WaitQueueEntry* waitEntry) 
    60 { 
    61         SpinLockIrq(&waitQueue->spinLock); 
    62  
    63 #ifdef WAIT_DEBUG 
    64         waitEntry->magic = 0xDEADBEEF; 
    65 #endif 
    66  
    67         ListAddTail(&waitEntry->next, &waitQueue->list); 
    68         SpinUnlockIrq(&waitQueue->spinLock); 
    69 } 
    70  
    71 static inline void WaitRemoveFromQueue(WaitQueue* waitQueue,struct WaitQueueEntry* waitEntry) 
    72 { 
    73         SpinLockIrq(&waitQueue->spinLock); 
    74  
    75         ListRemove(&waitEntry->next); 
    76  
    77 #ifdef WAIT_DEBUG 
    78         if (waitEntry->magic != 0xDEADBEEF) KePrint("Remove error!, %#X\n",waitEntry->magic); 
    79 #endif 
    80  
    81         SpinUnlockIrq(&waitQueue->spinLock); 
    82 } 
    83  
    84 #define WAIT_ON(waitQueue,condition) \ 
     59#define PERFORM_WAIT_ON(waitQueue, condition) \ 
    8560do{ \ 
    86         if ((condition)) \ 
    87                 break; \ 
    88         struct WaitQueueEntry waitEntry={currThread,{NULL,NULL}}; \ 
     61        WAIT_DEFINE(waitEntry); \ 
    8962        ThrGetThread(currThread); \ 
    9063        while (1) { \ 
     64                WaitPrepareWait(waitQueue, &waitEntry); \ 
    9165                if ((condition)) break; \ 
    92                 WaitAddToQueue(&(waitQueue),&waitEntry); \ 
    9366                ThrSuspendThread(currThread); \ 
    9467                ThrSchedule(); /* Will return here when the thread is scheduled again */ \ 
    9568        } \ 
     69        WaitFinishWait(waitQueue, &waitEntry); \ 
    9670        ThrReleaseThread(currThread); \ 
    9771}while(0) 
    9872 
    99 void WakeUp(WaitQueue* waitQueue); 
     73#define WAIT_ON(waitQueue, condition) \ 
     74do { \ 
     75        if (!(condition)) \ 
     76                PERFORM_WAIT_ON(waitQueue, condition); \ 
     77}while(0) 
     78 
     79#define SLEEP_ON(waitQueue) \ 
     80do { \ 
     81        WAIT_DEFINE(waitEntry); \ 
     82        ThrGetThread(currThread); \ 
     83        WaitPrepareWait(waitQueue, &waitEntry); \ 
     84        ThrSuspendThread(currThread); \ 
     85        ThrSchedule(); \ 
     86        WaitFinishWait(waitQueue, &waitEntry); \ 
     87        ThrReleaseThread(currThread); \ 
     88}while(0) 
     89 
     90void WakeUpCommon(WaitQueue* waitQueue, int number); 
     91void _WakeUp(WaitQueue* waitQueue, int number); 
     92 
     93#define WakeUp(waitQueue) _WakeUp(waitQueue, 1) 
     94#define WakeUpAll(waitQueue) _WakeUp(waitQueue, 0) 
     95 
     96/* Internal wait functions. */ 
     97void WaitPrepareWait(WaitQueue* waitQueue, struct WaitQueueEntry* waitEntry); 
     98void WaitFinishWait(WaitQueue* waitQueue, struct WaitQueueEntry* waitEntry); 
     99 
     100/* Inline functions. */ 
     101 
     102static inline void WaitAddToQueue(WaitQueue* waitQueue, struct WaitQueueEntry* waitEntry) 
     103{ 
     104        ListAddTail(&waitEntry->next, &waitQueue->list); 
     105} 
    100106 
    101107#endif 
  • Whitix/branches/netchannel/kernel/main.c

    r1675 r2084  
    3131extern int ThrEarlyInit(); 
    3232extern int TimeInit(); 
     33extern int UserCodeInit(); 
    3334extern int ShutdownInit(); 
    3435extern int ModulesBootLoad(); 
     
    4041extern int LoadInit(); 
    4142extern int DevFsInit(); 
     43extern int IcFsInit(); 
    4244extern int DeviceInit(); 
    4345extern int MiscInit(); 
    4446extern int StartInit(); 
     47extern int KeyboardInit(); 
     48extern int ConsoleInit(); 
    4549 
    4650void KernelMain() 
     
    5155        TimeInit(); 
    5256        ShutdownInit(); 
     57        UserCodeInit(); 
    5358         
    5459        /* Set up the device-related subsystems. */ 
     
    5964        VfsInit(); 
    6065        DevFsInit(); 
     66        IcFsInit(); 
    6167        DeviceInit(); 
     68 
     69        ConsoleInit(); 
     70        KeyboardInit(); 
    6271 
    6372        MiscInit(); 
  • Whitix/branches/netchannel/kernel/module.c

    r2061 r2084  
    140140        } 
    141141 
    142         struct Module* curr; 
    143  
    144         PreemptDisable(); 
     142        struct Module* curr, *curr2; 
    145143 
    146144        /* Look through the kernel symbol table of different modules. */ 
    147         ListForEachEntry(curr, &moduleList, next) 
    148         { 
    149                 int i = 0; 
     145        ListForEachEntrySafe(curr, curr2, &moduleList, next) 
     146        { 
     147                size_t i = 0; 
    150148                 
    151149                if (!curr->keSymTab) 
     
    160158                { 
    161159                        if (!strcmp(currSym->name, name)) 
    162                         { 
    163                                 PreemptEnable(); 
    164160                                return currSym->addr; 
    165                         } 
    166161 
    167162                        currSym++; 
     
    169164                } 
    170165        } 
    171  
    172         PreemptEnable(); 
    173166 
    174167        return 0; 
     
    271264} 
    272265 
    273 void* ModuleSectionFind(struct Module* module, const char* sectionNames, const char* name, int total, int* size) 
     266void* ModuleSectionFind(struct Module* module, const char* sectionNames, const char* name, int total, size_t* size) 
    274267{ 
    275268        int i; 
     
    284277                { 
    285278                        if (size) 
    286                                 *size=module->sectionHeaders[i].shSize; 
     279                                *size = module->sectionHeaders[i].shSize; 
    287280 
    288281                        return (void*)(module->sectionHeaders[i].shAddr); 
     
    396389        if (ModuleSymbolPrepare(module)) 
    397390                return -ENOENT; 
    398  
     391         
    399392        for (i=0; i<elfHeader->shEntries; i++) 
    400393        { 
     
    423416                char* verMagic; 
    424417                void* infoAddr; 
    425                 unsigned int infoSize; 
     418                size_t infoSize; 
    426419                 
    427420                modInit = ModuleSymbolFind(module, "init_module", STT_FUNC); 
     
    435428                        /* Find the version string of the module, and make sure the module 
    436429                         * is built to the kernel version we support. */ 
    437                         verMagic = ModuleGetInfo(elfHeader->shEntries, infoAddr, infoSize, "vermagic"); 
     430                        verMagic = ModuleGetInfo(module->sectionHeaders, infoAddr, infoSize, "vermagic"); 
    438431                 
    439432                /* Version check */      
  • Whitix/branches/netchannel/kernel/process.c

    r1677 r2084  
    88#include <keobject.h> 
    99#include <user_acc.h> 
     10#include <print.h> 
    1011#include <fs/icfs.h> 
    1112#include <fs/vfs.h> 
     
    118119        struct KeFsEntry* dir = process->object.dir; 
    119120         
    120         IcFsAddStrEntry(dir, "name", process->name, VFS_ATTR_READ); 
     121        IcFsAddStrEntry(dir, "name", &process->name, VFS_ATTR_READ); 
    121122 
    122123        ListAddTail(&process->next,&processList); 
     
    217218        int retVal=0; 
    218219 
    219         waitEntry.thread=currThread; 
    220          
    221220        if (finishStatus) 
    222221                if (VirtCheckArea(finishStatus,sizeof(int),VER_WRITE)) 
     
    225224        if (pid >= 0) 
    226225        { 
    227                 process=ThrFindProcessById(pid); 
     226                process = ThrFindProcessById(pid); 
    228227                if (!process) 
    229228                        return -ENOENT; 
     
    237236 
    238237repeat: 
    239  
     238        waitEntry.thread=currThread; 
    240239        WaitAddToQueue(&current->waitQueue, &waitEntry); 
    241240        ThrSuspendThread(currThread); 
     
    331330 
    332331        if (current->parent) 
    333                 WakeUp(&current->parent->waitQueue); 
     332                WakeUpAll(&current->parent->waitQueue); 
    334333} 
    335334 
     
    345344 * 
    346345 ***********************************************************************/ 
     346 
     347int MmapProcessRemove(struct Process*); 
     348void LoadReleaseFsContext(); 
    347349 
    348350void ThrProcessExit(int returnCode) 
     
    380382                        if (curr->state != THR_RUNNING) 
    381383                        { 
    382                                 KePrint("Killing waiting thread\n"); 
    383                                 cli(); hlt(); 
     384                                KePrint("WARN: Killing waiting thread\n"); 
    384385                        } 
    385386                         
  • Whitix/branches/netchannel/kernel/sched.c

    r985 r2084  
    128128        if (currThread && currThread->preemptCount) 
    129129        { 
    130                 KePrint("currThread->preemptCount = %u\n", currThread->preemptCount);  
    131                 ModuleSymbolPrint(__builtin_return_address(0)); 
     130                KePrint("currThread->preemptCount = %u, being preempted!\n", currThread->preemptCount);  
     131                KePrint("ra = %#X\n", __builtin_return_address(0)); 
    132132                cli(); hlt(); 
    133133        } 
     
    141141         * in ThrFreeThread. */  
    142142 
    143         prevThread=currThread; 
    144         prev=current; 
    145  
    146         currThread=ThrChooseNewThread(); 
    147         current=currThread->parent; 
     143        prevThread      = currThread; 
     144        prev            = current; 
     145 
     146        currThread      = ThrChooseNewThread(); 
     147        current         = currThread->parent; 
    148148 
    149149        /* The only threads without a parent process are kernel threads - who 
     
    176176         * contexts. 
    177177         */ 
     178 
    178179        if (prevThread != currThread) 
    179180                ThrArchSwitch(prevThread,currThread); 
     
    183184 
    184185SYMBOL_EXPORT(ThrSchedule); 
     186 
     187#ifdef CONFIG_DEBUG 
     188int ThrSchedDebug() 
     189{ 
     190        struct Thread* curr; 
     191 
     192        ListForEachEntry(curr,&threadList,list) 
     193        { 
     194                KePrint("(%#X), id = %d, status = %d (%d), pid = %d\n", curr, curr->id, curr->state, 
     195                                THR_RUNNING, curr->parent 
     196                                ? curr->parent->pid : -1); 
     197        } 
     198} 
     199#endif 
    185200 
    186201/*********************************************************************** 
     
    202217} 
    203218 
     219void ThrEndWait(struct Thread* thread) 
     220{ 
     221    if (thread->parent && thread->parent->state == THR_DYING) 
     222    { 
     223        /* Kill time until process exits. */ 
     224        while (1) 
     225            SysYield(); 
     226    } 
     227} 
     228 
    204229/*********************************************************************** 
    205230 * 
  • Whitix/branches/netchannel/kernel/startup.c

    r1677 r2084  
    1010 
    1111extern int TaskletInit(); 
     12extern int PciInit(); /* FIXME: Does it need to be here? */ 
    1213extern int NetworkInit(); 
    1314extern int ModulesBootLoad(); 
  • Whitix/branches/netchannel/kernel/symbols.c

    r1677 r2084  
    2828 
    2929#define KERNEL_BASE_ADDRESS             0x100000 
     30 
     31/* We call SymbolsCopy before anything else. */ 
    3032#define DATA __attribute__((section(".data"))) 
    3133 
     
    6264        *offset=currOffset; 
    6365        *size=currSym->symSize; 
    64  
    65         if (*offset > *size) 
    66         { 
    67                 KePrint("%#X-%#X = %#X %#X\n", address, symbol->symValue, *offset, *size); 
    68                 while (1); 
    69         } 
    7066 
    7167        return stringTable+currSym->symName; 
  • Whitix/branches/netchannel/kernel/timer.c

    r1325 r2084  
    5353                        { 
    5454                                if (curr->list.prev != &timerList) 
    55                                         timer->expires-=ListEntry(curr->list.prev,struct Timer,list)->expires; 
     55                                        timer->expires -= ListEntry(curr->list.prev,struct Timer,list)->expires; 
    5656 
    57                                 curr->expires-=timer->expires; 
     57                                curr->expires -= timer->expires; 
    5858 
    5959                                /* Add before the current timer. */ 
    60                                 DoListAdd(&timer->list,curr->list.prev,&curr->list); 
     60                                DoListAdd(&timer->list, curr->list.prev, &curr->list); 
    6161                                goto out; 
    6262                        } 
     
    6565                /* Add to end of list */ 
    6666                if (curr->list.prev != &timerList) 
    67                         timer->expires-=ListEntry(curr->list.prev,struct Timer,list)->expires; 
     67                        timer->expires -= ListEntry(curr->list.prev,struct Timer,list)->expires; 
    6868 
    6969                ListAddTail(&timer->list, &timerList); 
     
    136136{ 
    137137        struct Timer* timer; 
     138        DWORD flags; 
    138139 
    139140        if (ListEmpty(&timerList)) 
    140141                return; 
    141142         
     143        IrqSaveFlags(flags); 
     144         
    142145        /* Get head of the list */ 
    143         timer=ListEntry(timerList.next,struct Timer,list); 
    144         timer->expires-=10; /* The timeslice */ 
     146        timer = ListEntry(timerList.next, struct Timer, list); 
     147         
     148        timer->expires -= 10; /* The timeslice */ 
    145149 
    146150//      KePrint("timer->expires = %#X\n", timer->expires); 
     
    165169        struct Timer timer; 
    166170 
    167         timer.func=SleepWakeup; 
    168         timer.expires=milliSeconds; 
    169         timer.data=currThread; 
     171        timer.func = SleepWakeup; 
     172        timer.expires = milliSeconds; 
     173        timer.data = currThread; 
    170174 
    171175        TimerAdd(&timer); 
    172176        ThrSuspendThread(currThread); 
    173177        ThrSchedule(); 
     178         
     179        /* If we aren't called from the timer code, the timer could still be on the 
     180         * list. Remove it. 
     181         */ 
     182        TimerRemove(&timer); 
    174183} 
    175184 
    176185SYMBOL_EXPORT(Sleep); 
     186 
     187/* Kernel system calls for timers */ 
     188int SysTimerCreate() 
     189{ 
     190        return 0; 
     191} 
     192 
     193int SysTimerDestroy() 
     194{ 
     195        return 0; 
     196} 
  • Whitix/branches/netchannel/kernel/wait.c

    r1314 r2084  
    2121#include <task.h> 
    2222#include <wait.h> 
     23#include <print.h> 
    2324 
    2425/*********************************************************************** 
    2526 * 
    26  * FUNCTION: WakeUp 
     27 * FUNCTION: WakeUpCommon 
    2728 * 
    2829 * DESCRIPTION: Wake up all threads waiting on a waitqueue. 
     
    3435 ***********************************************************************/ 
    3536 
    36 void WakeUp(WaitQueue* waitQueue) 
     37void WakeUpCommon(WaitQueue* waitQueue, int number) 
    3738{ 
    3839        struct WaitQueueEntry* curr, *curr2; 
     
    4243                return; 
    4344 
    44         SpinLock(&waitQueue->spinLock); 
    45  
    4645        ListForEachEntrySafe(curr, curr2, &waitQueue->list, next) 
    4746        { 
    48 #ifdef WAIT_DEBUG 
    49                 if (curr->magic != 0xDEADBEEF)           
    50                         KePrint("WakeUp: Error, %#X!, thread = %#X, prev = %#X, next = %#X, magic = %#X, from %#X\n", 
    51                                 waitQueue,curr->thread,curr->next.prev,curr->next.next,curr->magic,__builtin_return_address(0)); 
    52 #endif 
     47                if (curr->next.prev == NULL || curr->next.next == NULL) 
     48                { 
     49                        KePrint("INVALID, %#X (phys = %#X), %#X (%#X %#X)\n", &waitQueue->list, curr->next.next); 
     50                        while(1); 
     51                } 
    5352 
     53                ListRemoveInit(&curr->next); 
    5454                ThrResumeThread(curr->thread); 
    55                 ListRemove(&curr->next); 
    5655 
     56                if (!--number) 
     57                        return; 
    5758        } 
    58  
    59         SpinUnlock(&waitQueue->spinLock); 
    6059} 
    6160 
    62 SYMBOL_EXPORT(WakeUp); 
     61SYMBOL_EXPORT(WakeUpCommon); 
     62 
     63void _WakeUp(WaitQueue* waitQueue, int number) 
     64{ 
     65        DWORD flags; 
     66        IrqSaveFlags(flags); 
     67        WakeUpCommon(waitQueue, number); 
     68        IrqRestoreFlags(flags); 
     69} 
     70 
     71SYMBOL_EXPORT(_WakeUp); 
     72 
     73void WaitPrepareWait(WaitQueue* waitQueue, struct WaitQueueEntry* waitEntry) 
     74{ 
     75        SpinLockIrq(&waitQueue->spinLock); 
     76                 
     77        if (ListEmpty(&waitEntry->next)) 
     78                WaitAddToQueue(waitQueue, waitEntry); 
     79         
     80        SpinUnlockIrq(&waitQueue->spinLock); 
     81} 
     82 
     83SYMBOL_EXPORT(WaitPrepareWait); 
     84 
     85void ThrEndWait(struct Thread* thread); 
     86 
     87void WaitFinishWait(WaitQueue* waitQueue, struct WaitQueueEntry* waitEntry) 
     88{ 
     89        if (!ListEmpty(&waitEntry->next)) 
     90        { 
     91                SpinLockIrq(&waitQueue->spinLock); 
     92                ListRemoveInit(&waitEntry->next); 
     93                SpinUnlockIrq(&waitQueue->spinLock); 
     94        } 
     95         
     96        ThrEndWait(currThread); 
     97} 
     98 
     99SYMBOL_EXPORT(WaitFinishWait); 
  • Whitix/branches/netchannel/lib/Makefile

    r973 r2084  
    11DEPTH=../ 
    22 
    3 OBJS = string.o vsprintf.o bitmap.o keobject.o 
     3OBJS = string.o vsprintf.o bitmap.o keobject.o usercode.o 
    44 
    55build: $(OBJS) 
  • Whitix/branches/netchannel/lib/keobject.c

    r1333 r2084  
    2020#include <fs/kfs.h> 
    2121#include <string.h> 
     22#include <malloc.h> 
    2223#include <keobject.h> 
    2324#include <module.h> 
     
    2526#include <fs/devfs.h> 
    2627#include <fs/icfs.h> 
     28#include <panic.h> 
    2729 
    2830void KeObjectInit(struct KeObject* object, struct KeSet* parent) 
     
    102104int KeObjectVaAttach(struct KeObject* object, const char* name, VaList vaList) 
    103105{ 
    104         int length; 
    105          
    106106        if (!object) 
    107107                return -EFAULT; 
     
    149149struct KeObject* KeSetFind(struct KeSet* set, const char* name) 
    150150{ 
    151         struct KeObject* curr; 
     151        struct KeObject* curr, *curr2; 
    152152         
    153         SpinLock(&set->lock); 
    154          
    155         ListForEachEntry(curr, &set->head, next) 
     153        ListForEachEntrySafe(curr, curr2, &set->head, next) 
    156154        { 
    157155                const char* objName = KeObjGetName(curr); 
     
    161159                         
    162160                if (!strcmp(name, objName)) 
    163                         goto out; 
     161                        return curr; 
    164162        } 
    165163         
    166         curr = NULL; 
    167  
    168 out: 
    169         SpinUnlock(&set->lock); 
    170         return curr; 
     164        return NULL; 
    171165} 
    172166 
  • Whitix/branches/netchannel/lib/string.c

    r2061 r2084  
    2020#include <string.h> 
    2121#include <malloc.h> 
     22#include <task.h> 
     23#include <console.h> 
    2224 
    2325int strncpy(char* dest,char* src, int len) 
    2426{ 
    2527        while (*src != '\0' && len--) 
    26                 *dest++=*src++; 
     28                *dest++=*src++;  
    2729 
    2830        while (len--) 
     
    3840        unsigned char res = 0; 
    3941 
     42 
    4043    while (num) 
    4144        { 
     
    5053 
    5154SYMBOL_EXPORT(strncmp); 
     55 
     56int strcmp(const char* s1, const char* s2) 
     57{ 
     58        return strncmp(s1, s2, ~0); 
     59} 
     60 
     61SYMBOL_EXPORT(strcmp); 
    5262 
    5363int strnicmp(const char* s1,const char* s2,int num) 
     
    8898SYMBOL_EXPORT(stricmp); 
    8999 
    90 int strlen(char* str) 
     100size_t strlen(const char* str) 
    91101{ 
    92102        int ret=0; 
  • Whitix/branches/netchannel/lib/vsprintf.c

    r2061 r2084  
    399399int sprintf(char* str, const char* fmt, ...) 
    400400{ 
    401         KePrint("sprintf"); 
    402401        return 0; 
    403402} 
     
    408407{ 
    409408        VaList args; 
    410         int i; 
     409        size_t i; 
    411410         
    412411        VaStart(args, fmt); 
  • Whitix/branches/netchannel/make.inc

    r2061 r2084  
    1010SED = sed 
    1111override CFLAGS += -fomit-frame-pointer -ffreestanding -fno-stack-protector -fno-builtin \ 
    12         -nostdlib -m32 -Wall -Wextra -Os -I$(DEPTH)include -Wno-unused-parameter 
     12        -nostdlib -m32 -Wall -Wextra -Werror -Os -I$(DEPTH)include -Wno-unused-parameter  
    1313BE_VERBOSE = 0 
    1414LD_R_FLAGS = -r -melf_i386 
     
    2121 
    2222%.o : %.c 
    23         @echo "CC $*.c" 
     23        @echo "  CC $*.c" 
    2424        @$(CC) $(CFLAGS) -c $*.c -o $*.o 
    2525        @$(CC) -MM $(CFLAGS) -c $*.c > .deps/$*.d 
    2626 
    2727%.sys : %.c 
    28         @echo "CC $*.c (M)" 
     28        @echo "  CC $*.c (M)" 
    2929        @$(CC) $(CFLAGS) -DMODULE -fno-common -c $*.c -o $*.sys 
    3030        @$(CC) -MM $(CFLAGS) -DMODULE -c $*.c > .deps/$*.d 
     
    3333#gas assembly files 
    3434%.o : %.S 
    35         $(CC) -I$(DEPTH)include -ffreestanding -fleading-underscore -fno-builtin -m32 -c $*.S -o $*.o 
    36 #       @echo "AS $*.S" 
     35        @$(CC) -I$(DEPTH)include -ffreestanding -fleading-underscore -fno-builtin -m32 -c $*.S -o $*.o 
     36        @echo "  AS $*.S" 
     37 
     38#for linker script 
     39%.lds: %.ld.S 
     40        @$(CC) -I$(DEPTH)include -Ui386 -nostdinc -C -P -E $*.ld.S -o $*.lds 
     41        @echo "  CPP $*.lds.S" 
    3742 
    3843ifneq ($(IGNORE_CLEAN), y) 
  • Whitix/branches/netchannel/memory/mmap.c

    r2061 r2084  
    3232extern struct Cache* areaCache,*mapCache; 
    3333 
    34 /* FIXME: Move more functions into vmm.c */ 
     34/* TODO: Rewrite HandleNoPage to share pages with all other compatible areas 
     35 * once we map it in. */ 
     36 
     37static int VmSharePage(struct VMArea* area, DWORD address) 
     38{ 
     39        return 0; 
     40} 
    3541 
    3642/*********************************************************************** 
     
    5561        int ret; 
    5662 
    57         if (area->areaOps && area->areaOps->handleNoPage) 
    58                 if (!area->areaOps->handleNoPage(area, address, offset)) 
     63        if (area->areaOps && area->areaOps->noPage) 
     64                if (!area->areaOps->noPage(area, address, offset)) 
    5965                        return 0; 
    6066 
     
    8288 
    8389                        if (area->vNode->fileOps->mMap) 
    84                                 ret=area->vNode->fileOps->mMap(area->vNode, address, offset); 
     90                                ret = area->vNode->fileOps->mMap(area->vNode, address, offset); 
    8591                        else 
    86                                 ret=FileGenericReadPage(address, area->vNode, offset); 
     92                                ret = FileGenericReadPage(address, area->vNode, offset); 
     93 
     94                        if (ret) 
     95                                goto fail; 
     96 
     97                        ret = VmSharePage(area, address); 
    8798 
    8899                        if (ret) 
     
    90101                } 
    91102        }else{ 
    92                 mappedPage=VmLookupPage(area->vNode,offset); 
     103                /* TODO: Need to handle race here? */ 
     104                mappedPage = VmLookupPage(area->vNode,offset); 
    93105 
    94106                if (!mappedPage) 
     
    104116 
    105117                        /* Add to shared list so other read-only pages can map this page */ 
    106                         mappedPage=VmCreateMappedPage(offset, newPage); 
     118                        mappedPage = VmCreateMappedPage(offset, newPage); 
    107119 
    108120                        if (!mappedPage) 
     
    171183                return -EFAULT; 
    172184 
    173  
    174         area=VmLookupAddress(process,address); 
    175          
     185        area = VmLookupAddress(process,address); 
     186 
    176187        /* Area of memory not currently mapped? */ 
    177188        if (!area) 
     
    444455/* FIXME: Split this function up. Eight parameters is bad design. */ 
    445456 
    446 DWORD MMapDo(struct Process* process,struct VNode* vNode,DWORD address,DWORD length,int protection,DWORD offset,int flags, struct VmAreaOps* ops) 
     457DWORD MMapDo(struct Process* process, struct VNode* vNode, DWORD address, DWORD length, int protection, DWORD offset, int flags, struct VmAreaOps* ops) 
    447458{ 
    448459        struct VMArea* area=(struct VMArea*)MemCacheAlloc(areaCache); 
     460 
     461//      KePrint("MMap(vNode = %#X, address = %#X, length = %#X, protection = %#X," 
     462//              "offset = %#X)\n", vNode, address, length, protection, offset); 
    449463 
    450464        if (!process || !length || !area) 
     
    478492                flags |= MMAP_ANON; 
    479493        } 
     494 
     495        /* Used for mapping data channels */ 
     496        if (!ops && vNode->areaOps) 
     497                ops = vNode->areaOps; 
    480498 
    481499        /* Fill in the new structure */ 
     
    630648        if (fd != -1 && !(file=FileGet(fd))) 
    631649                return 0; 
    632  
     650         
    633651        if (file) 
    634                 vNode=file->vNode; 
     652                vNode = file->vNode; 
    635653                         
    636654        return MMapDo(current, vNode, PAGE_ALIGN(address), 
     
    780798 
    781799int VmInit(); 
     800int ShMemInit(); 
    782801 
    783802int MMapInit() 
  • Whitix/branches/netchannel/memory/pg_alloc.c

    r1348 r2084  
    3131#include <console.h> 
    3232#include <sections.h> 
     33#include <symbols.h> 
    3334#include <module.h> 
     35#include <locks.h> 
    3436#include <panic.h> 
    3537#include <print.h> 
     38#include <addresses.h> 
    3639 
    3740static BYTE* allocatedBitmap; 
     
    5255 
    5356/* TODO: Better address? */ 
    54 #define PSTACK_START_ADDRESS 0x200000 
     57#define BITMAP_START_ADDRESS (KERNEL_ADDRESS_BASE + 0x180000) 
     58#define PSTACK_START_ADDRESS (KERNEL_ADDRESS_BASE + 0x200000) 
    5559struct PhysPage* pageArrayPtr=(struct PhysPage*)(PSTACK_START_ADDRESS); 
    5660 
     
    5862int PageEarlyInit(DWORD endPfn) 
    5963{ 
    60         DWORD endAddress,numBytes; 
    61  
    62         maxPfn=endPfn; 
    63  
    64         /* Set up a bitmap, right at the end of the physical memory so we can track reservations */ 
    65         endAddress=(maxPfn << PAGE_SHIFT); 
    66         numBytes=((maxPfn+7)/8); 
    67         endAddress-=numBytes; 
    68         allocatedBitmap=(BYTE*)endAddress; 
    69         ZeroMemory(allocatedBitmap,numBytes); 
     64        maxPfn = endPfn; 
     65 
     66        allocatedBitmap=(BYTE*)BITMAP_START_ADDRESS; 
     67 
     68        /* Set up bitmap for first 20mb of memory. */ 
     69        ZeroMemory(allocatedBitmap, (2 << 20)/8); 
    7070 
    7171        /* Reserve the first page of memory. Important structures may be stored there. */ 
     
    7373 
    7474        /* Reserve pages like the kernel's code and data. */ 
    75         PageReserveArea((DWORD)code,(DWORD)end-(DWORD)code); 
     75        PageReserveArea(VA_TO_PA(code), (DWORD)end-(DWORD)code); 
    7676 
    7777        /* Reserve the page stack - each page has it's own structure */ 
    78         PageReserveArea((DWORD)PSTACK_START_ADDRESS, maxPfn*sizeof(struct PhysPage)); 
     78        PageReserveArea(VA_TO_PA(PSTACK_START_ADDRESS), maxPfn*sizeof(struct PhysPage)); 
    7979         
    8080        /* And the waitqueues */ 
    81         PageReserveArea((DWORD)PAGE_ALIGN_UP( 
    82                 (PSTACK_START_ADDRESS+(maxPfn*sizeof(struct PhysPage)))), 
     81        PageReserveArea(VA_TO_PA((DWORD)PAGE_ALIGN_UP( 
     82                (PSTACK_START_ADDRESS+(maxPfn*sizeof(struct PhysPage))))), 
    8383                        ((maxPfn+1023) >> 10)*sizeof(WaitQueue)); 
    8484 
     
    9090        /*  
    9191         * Create 2 stacks of pages. The disadvantage is that it uses quite a lot of memory, 
    92          * maximum 4mb for a system with 4gb. But it's the speediest method possible. 
     92         * maximum 16mb for a system with 4gb. But it's the speediest method possible. 
    9393         */ 
    9494 
     
    9999        isa.numPages=0; 
    100100        INIT_LIST_HEAD(&isa.list); 
     101         
    101102        for (i=0; i<isa.maxPages; i++) 
    102103        { 
    103104                /* Free, can push onto stack */ 
    104105                pageArray[i].physAddr=i << 12; 
    105                 if (!BmapGetBit(allocatedBitmap,i)) 
    106                 { 
    107                         ListAdd(&pageArray[i].list,&isa.list); 
     106 
     107                if (!BitTest(allocatedBitmap, i)) 
     108                { 
     109                        ListAdd(&pageArray[i].list, &isa.list); 
    108110                        ++isa.numPages; 
    109111                } 
     
    116118        { 
    117119                normal.maxPages=maxPfn-4096; 
    118                 /* Go through normal memory and it's bitmap and push onto stack */ 
     120                /* Go through normal memory and push onto stack */ 
    119121                for (i=4096; i<maxPfn; i++) 
    120122                { 
    121123                        pageArray[i].physAddr=i << 12; 
    122                         /* Don't need the allocation bitmap for 16mb - not really used */ 
    123                         ListAdd(&pageArray[i].list,&normal.list); 
    124                         ++normal.numPages; 
     124 
     125                        if (i >= 5120 || (i < 5120 && !BitTest(allocatedBitmap, i))) 
     126                        { 
     127                                ListAdd(&pageArray[i].list, &normal.list); 
     128                                ++normal.numPages; 
     129                        } 
    125130                } 
    126131        } 
     
    147152        IrqSaveFlags(flags); 
    148153 
    149         page=ListEntry(stack->list.next,struct PhysPage,list); 
     154        page=ListEntry(stack->list.next,struct PhysPage,list);   
     155                 
    150156        --stack->numPages; 
    151157        ListRemove(stack->list.next); 
    152          
    153         page->refs=1; 
    154  
    155158        IrqRestoreFlags(flags); 
    156159 
     
    168171{ 
    169172        struct PhysPage* page; 
    170  
    171 //      KePrint("pages left = %u\n", normal.numPages+isa.numPages); 
    172173 
    173174        /* Allocate from the normal page stack first, and then the ISA stack */ 
     
    185186{ 
    186187        /* Just allocate from the ISA stack */ 
    187         if (!isa.numPages) 
     188        if (isa.numPages < 5) 
    188189                KernelPanic("System out of memory"); 
    189190 
     
    198199        IrqSaveFlags(flags); 
    199200 
    200         page->refs=0xDEADBEEF; /* Marker value */ 
    201201        ++stack->numPages; 
    202202 
     
    240240 
    241241        if (!allocatedBitmap) /* Err, someone's reserving memory after the bitmap's gone */ 
    242         { 
    243                 KePrint("PageReserveArea: can't reserve memory!\n"); 
    244                 MachineHalt(); 
    245         } 
     242                KernelPanic("PageReserveArea: can't reserve memory!"); 
    246243 
    247244        /* Set all the pages as allocated */ 
    248245        while (size) 
    249246        { 
    250                 BmapSetBit(allocatedBitmap,(start >> 12),true); 
     247                BitSet(allocatedBitmap, (start >> 12)); 
    251248                start+=PAGE_SIZE; 
    252249                size-=PAGE_SIZE; 
  • Whitix/branches/netchannel/memory/shmem.c

    r2061 r2084  
    4545struct VmAreaOps shMemOps= 
    4646{ 
    47         .handleNoPage = ShMemNoPage, 
     47        .noPage = ShMemNoPage, 
    4848        .addPage = ShMemAddPage, 
    4949}; 
     
    8585        shDesc->size=PAGE_ALIGN_UP(size); 
    8686        shDesc->pages=(DWORD*)MemAlloc(sizeof(DWORD)*numPages); 
    87  
    88         KePrint("size = %u\n", size); 
    8987 
    9088        if (!shDesc->pages) 
     
    143141int ShMemAddPage(struct VMArea* area, DWORD address) 
    144142{ 
     143#if 0 
    145144        struct SharedMemoryDesc* shMem=ShMemFind(area->length); 
    146145        int pageIndex=(address-area->start) >> PAGE_SHIFT; 
    147146 
    148         KePrint("pageIndex = %d\n", pageIndex); 
    149  
    150147        if (!shMem) 
    151148                return -EFAULT; 
    152149 
    153150        while (1); 
     151#endif 
    154152 
    155153        return 0; 
  • Whitix/branches/netchannel/memory/slab.c

    r1349 r2084  
    3838 
    3939/* General slab limits */ 
    40 #define SLAB_START 0xC0000000 
    41 #define SLAB_END   0xD0000000 
     40#define SLAB_START (KERNEL_ADDRESS_BASE + 0x100000) 
     41#define SLAB_END   (KERNEL_ADDRESS_BASE + 0x8000000) 
    4242 
    4343/* How many bytes can fit in a cache? */ 
     
    141141        else 
    142142                /* Make sure it's zeroed for later use */ 
    143                 ZeroMemory(p,cache->size); 
    144                 //memset(p, cache->size, 0xDD); 
     143//              ZeroMemory(p,cache->size); 
     144                memset(p, cache->size, 0xDD); 
    145145} 
    146146 
     
    167167 
    168168/* FIXME! */ 
    169         KePrint("free did not free %#X (from %#X)\n",p,__builtin_return_address(0)); 
     169        KePrint("MemFree did not free %#X (from %#X, %#X, %#X)\n",p,__builtin_return_address(0), __builtin_return_address(1)); 
    170170        cli(); hlt(); 
    171171} 
     
    315315                                                currSlab->isFull=1; 
    316316                                         
    317 //                                      if (!cache->ctor)        
    318 //                                      ZeroMemory(currSlab->page+cache->offset+(i*cache->size), cache->size); 
     317                                        if (!cache->ctor)        
     318                                                ZeroMemory(currSlab->page+cache->offset+(i*cache->size), cache->size); 
    319319 
    320320                                        IrqRestoreFlags(flags); 
  • Whitix/branches/netchannel/memory/vmm.c

    r1347 r2084  
    113113/*********************************************************************** 
    114114 * 
    115  * FUNCTION: VmCreateMappedPage 
    116  * 
    117  * DESCRIPTION: Looks up a page in a vNode by file offset. 
    118  * 
    119  * PARAMETERS: vNode - vNode that contains the shared list. 
    120  *                         offset - file offset needed. 
    121  * 
    122  * RETURNS: the virtual page containing the file data. 
     115 * FUNCTION:    VmCreateMappedPage 
     116 * 
     117 * DESCRIPTION: Creates a VMMapPage structure given a offset and physical 
     118 *                              page 
     119 * 
     120 * PARAMETERS:  offset - file offset needed. 
     121 *                              page - physical page to create 
     122 * 
     123 * RETURNS:     the virtual page structure that links to the physical page 
     124 *                              and the file offset. 
    123125 * 
    124126 ***********************************************************************/ 
     
    126128struct VMMapPage* VmCreateMappedPage(DWORD offset, struct PhysPage* page) 
    127129{ 
    128         struct VMMapPage* mappedPage=(struct VMMapPage*)MemCacheAlloc(mapCache); 
     130        struct VMMapPage* mappedPage = (struct VMMapPage*)MemCacheAlloc(mapCache); 
    129131 
    130132        if (!mappedPage) 
    131133                return NULL; 
    132134 
    133         mappedPage->offset=offset; 
    134         mappedPage->page=page; 
     135        mappedPage->offset = offset; 
     136        mappedPage->page = page; 
    135137 
    136138        return mappedPage; 
     
    193195{ 
    194196        WaitQueue* waitQueue; 
    195         INIT_WAITQUEUE_ENTRY(waitEntry); 
     197        WAIT_DEFINE(waitEntry); 
    196198 
    197199        waitQueue=PageGetWaitQueue(page->page); 
    198  
    199 //      KePrint("Waiting on %#X\n", page->page->physAddr); 
    200200 
    201201        PageGet(page->page); 
     
    256256{ 
    257257        page->flags &= ~(1 << PAGE_LOCKED);      
    258         WakeUp(PageGetWaitQueue(page->page)); 
     258        WakeUpAll(PageGetWaitQueue(page->page)); 
    259259} 
    260260 
  • Whitix/branches/netchannel/net/Makefile

    r2061 r2084  
    11DEPTH=../ 
    2 OBJS =  network.o device.o eth.o 
     2OBJS =  network.o device.o eth.o arp.o 
    33IGNORE_CLEAN = y 
    44 
  • Whitix/branches/netchannel/net/channels/Makefile

    r2066 r2084  
    11DEPTH=../../ 
    2 OBJS = file.o memory.o sys.o recv.o init.o 
     2OBJS = file.o memory.o sys.o recv.o init.o userlib.o 
    33 
    44build: $(OBJS) 
  • Whitix/branches/netchannel/net/channels/file.c

    r2061 r2084  
    2222#include <net/channels.h> 
    2323#include <module.h> 
     24#include <locks.h> 
    2425#include <print.h> 
    2526#include <sys.h> 
    2627#include <fs/vfs.h> 
    2728#include <task.h> 
    28  
    29 static inline struct Channel* ChanFromFile(struct File* file) 
    30 { 
    31         return (file->vNode->extraInfo); 
    32 } 
     29#include <vmm.h> 
    3330 
    3431int ChanRead(struct File* file, BYTE* data, DWORD size); 
    3532int ChanWrite(struct File* file, BYTE* data, DWORD size); 
    36 int ChanMemoryMap(struct VNode* vNode, DWORD address, DWORD offset); 
     33int ChanPoll(struct File* file, struct PollItem* item, struct PollQueue* pollQueue); 
    3734int ChanClose(struct File* file); 
     35int ChanMapNoPage(struct VMArea* area, DWORD address, DWORD offset); 
    3836 
    3937struct FileOps channelFileOps = 
     
    4139        .read = ChanRead, 
    4240        .write = ChanWrite, 
    43         .mMap = ChanMemoryMap, 
     41        .poll = ChanPoll, 
    4442        .close = ChanClose, 
     43}; 
     44 
     45struct VmAreaOps channelAreaOps =  
     46{ 
     47        .noPage = ChanMapNoPage, 
    4548}; 
    4649 
     
    6366        file->vNode = VNodeGetEmpty(); 
    6467        file->fileOps = file->vNode->fileOps = &channelFileOps; 
     68        file->vNode->areaOps = &channelAreaOps; 
    6569        file->vNode->mode = VFS_ATTR_RW | VFS_ATTR_FILE; 
    6670 
    6771        file->vNode->superBlock = &chanSuperBlock; 
    6872        file->vNode->extraInfo=(void*)channel; 
     73        channel->file = file; 
    6974         
    7075        return fd; 
     
    7378int ChanRead(struct File* file, BYTE* data, DWORD size) 
    7479{ 
    75         struct Channel* channel = ChanFromFile(file); 
    76         struct NetBuffer* buffer; 
    77         unsigned int readSize; 
    78                  
    79         if (!(file->flags & FILE_NONBLOCK)) 
    80                 WAIT_ON(channel->waitQueue, channel->lastRead != channel->pos);  
    81          
    82         if (channel->lastRead == channel->pos) 
    83                 return 0; 
    84          
    85         buffer = (struct NetBuffer*)channel->masterPage->pages[channel->lastRead]; 
    86          
    87         readSize = NetBufferCopy(data, buffer, size); 
    88          
    89         if (NetBufferNoMore(buffer)) 
    90                 NetFreeBuffer(buffer); 
    91          
    92         channel->lastRead++; 
    93                  
    94         return readSize; 
     80        /* Should implement as a copy operation into data */ 
     81        return -ENOTIMPL; 
    9582} 
    9683 
     
    9885{ 
    9986        struct Channel* channel = ChanFromFile(file); 
    100          
     87        struct ChanSendHeader* header = (struct ChanSendHeader*)data; 
     88        int ret; 
     89        struct VMArea* area; 
     90 
    10191        if (!channelOps[channel->family]) 
    10292                return -EINVAL; 
     
    10494        if (!channelOps[channel->family]->write) 
    10595                return -ENOTIMPL; 
    106                  
    107         return channelOps[channel->family]->write(channel, data, size); 
     96 
     97        area = VmLookupAddress(current, (DWORD)data); 
     98 
     99        if (!area) 
     100                return -EFAULT; 
     101 
     102        data = (BYTE*)header + sizeof(struct ChanSendHeader); 
     103        size -= sizeof(struct ChanSendHeader); 
     104 
     105        if (size > ChanMaxPacketSize(channel)) 
     106                return -EINVAL; 
     107 
     108        /* Check magic number for any corruption */ 
     109        if (header->magic != CHAN_SEND_MAGIC) 
     110                return -EINVAL; 
     111 
     112        ret = channelOps[channel->family]->write(channel, data, size); 
     113 
     114        if (ret >= 0) 
     115        { 
     116//              KePrint("Free %d\n", ChanSendGetIndex(header)); 
     117        } 
     118 
     119        return ret; 
     120} 
     121 
     122int ChanPoll(struct File* file, struct PollItem* item, struct PollQueue* pollQueue) 
     123{ 
     124        struct Channel* channel = ChanFromFile(file); 
     125 
     126        PollAddWait(pollQueue, &channel->waitQueue); 
     127        item->revents |= POLL_OUT; 
     128 
     129        if (channel->latestRecv != channel->header->recvId) 
     130                item->revents |= POLL_IN; 
     131 
     132        return 0; 
    108133} 
    109134 
     
    111136{ 
    112137        struct Channel* channel = ChanFromFile(file); 
    113  
    114138        ListRemove(&channel->next); 
    115  
    116139        return 0; 
    117140} 
    118  
    119 int ChanMemoryMap(struct VNode* vNode, DWORD address, DWORD offset) 
    120 { 
    121         KePrint("ChanMemoryMap\n"); 
    122         return -EINVAL; /* For now. */ 
    123 } 
  • Whitix/branches/netchannel/net/channels/init.c

    r2066 r2084  
    2828 
    2929extern struct SysCall channelSysCalls[]; 
     30extern int ChannelUserCodeInit(); 
    3031 
    3132int ChannelInit() 
     
    3637        SysRegisterRange(SYS_CHANNEL_BASE, channelSysCalls); 
    3738 
     39        ChannelUserCodeInit(); 
     40 
    3841        return 0; 
    3942} 
  • Whitix/branches/netchannel/net/channels/memory.c

    r2061 r2084  
    2323#include <module.h> 
    2424#include <print.h> 
     25#include <vmm.h> 
    2526#include <sys.h> 
    2627#include <task.h> 
    2728#include <fs/vfs.h> 
    28  
    29 int ChannelAddBuffers(struct Channel* channel) 
    30 { 
    31         /* Create a master page, and set up the read and write information. */ 
    32         struct ChanMasterPage* masterPage; 
     29#include <pg_alloc.h> 
     30#include <bitmap.h> 
     31#include <locks.h> 
     32 
     33void* ChannelMapPage(struct Channel* channel, DWORD address); 
     34 
     35/* Allocation map functions */ 
     36struct ChanRecvHeader* ChanGetFreeRecvBuffer(struct Channel* channel, int* i) 
     37{ 
     38        int index = channel->info.numSendPages+1; 
     39        int hBytes = ChanRecvHeaderBytes(channel); 
     40        int mps = ChanMaxPacketSize(channel); 
     41        int offset; 
     42 
     43        *i = BitFindFirstZero(channel->header->recvAllocMap, 
     44                channel->info.numRecvBuffers); 
     45 
     46//      KePrint("%#X: %d %d\n", *channel->header->recvAllocMap, *i, channel->info.numRecvBuffers); 
     47 
     48        /* Can't receive the packet, as we're out of buffers. */ 
     49        if (*i == channel->info.numRecvBuffers) 
     50                return NULL; 
     51 
     52        BitSet(channel->header->recvAllocMap, *i); 
     53 
     54        index += ((*i)*(hBytes + mps)) /PAGE_SIZE; 
     55        offset = ((*i)*(hBytes + mps)) % PAGE_SIZE; 
     56 
     57        if (!channel->pages[index]) 
     58                channel->pages[index] = ChannelMapPage(channel, PageAlloc()->physAddr); 
     59 
     60        /* Need to map in the next page if the buffer spans two pages */ 
     61        if ((offset + hBytes + mps) > PAGE_SIZE && !channel->pages[index+1]) 
     62                channel->pages[index+1] = ChannelMapPage(channel, 
     63                        PageAlloc()->physAddr); 
    3364         
    34         masterPage = (struct ChanMasterPage*)MemAlloc(sizeof(struct ChanMasterPage)); 
     65        return (struct ChanRecvHeader*)(channel->pages[index] + offset); 
     66} 
     67 
     68void* ChannelMapPage(struct Channel* channel, DWORD address) 
     69{ 
     70        return (void*)VirtAllocateTemp(address); 
     71} 
     72 
     73void ChannelUnmapPage(void* page) 
     74{ 
     75        VirtUnmapPhysPage((DWORD)page); 
     76} 
     77 
     78static void ChanHeaderInit(struct Channel* channel, struct ChanUserHeader* 
     79                header) 
     80{ 
     81        channel->header = header; 
     82        header->magic = CHAN_HEADER_MAGIC; 
     83        ZeroMemory(header->sendAllocMap, (CHAN_MAX_SEND_BUFFERS+7)/8); 
     84        ZeroMemory(header->recvAllocMap, (CHAN_MAX_RECV_BUFFERS+7)/8); 
     85 
     86        memcpy(&header->info, &channel->info, sizeof(struct ChannelInfo)); 
     87} 
     88 
     89static void ChanSendHeaderInit(struct Channel* channel, struct ChanSendHeader* 
     90                header, int i) 
     91{ 
     92        header->magic = CHAN_SEND_MAGIC; 
     93        ChanSetIndex(header, i); 
     94} 
     95 
     96int ChanMapNoPage(struct VMArea* area, DWORD address, DWORD offset) 
     97{ 
     98        int i = offset >> PAGE_SHIFT; 
     99        DWORD phys; 
     100        struct Channel* channel = ChanFromVNode(area->vNode); 
     101 
     102        if (channel->pages[i]) 
     103        { 
     104                VirtMemMapPage(address, VirtToPhys((DWORD)channel->pages[i]), 
     105                                PAGE_PRESENT | PAGE_RW | PAGE_USER); 
     106                return 0; 
     107        } 
    35108         
    36         channel->masterPage = masterPage; 
    37         channel->pos = 0; 
    38         channel->lastRead = 0; 
    39  
    40         return 0; 
    41 } 
    42  
    43 int ChannelCopyPacket(struct Channel* channel, struct NetBuffer* buffer) 
    44 { 
    45         int i, maxIters = CHANNEL_MAX_ITER; 
    46         unsigned int pos = channel->pos; 
     109        phys = PageAlloc()->physAddr; 
     110        channel->pages[i] = ChannelMapPage(channel, phys); 
     111        VirtMemMapPage(address, phys, PAGE_PRESENT | PAGE_RW | PAGE_USER);       
     112        ZeroMemory(address, PAGE_SIZE); 
    47113         
    48         while (maxIters-- >= 0) 
    49         { 
    50                 /* cmpxchg? */ 
    51                 pos &= (CHANNEL_NUM_PER_PAGE-1); 
     114        if (i > 0 && i < channel->info.numSendPages+1) 
     115        { 
     116                int offset = 0, currOffset; 
     117                i--; 
     118                int index = 0; 
     119                int bufferSize = ChanSendHeaderBytes(channel) + ChanMaxPacketSize(channel); 
     120                int buffIndex = 0; 
    52121                 
    53                 if (!channel->masterPage->pages[pos]) 
     122                while (offset < (i*PAGE_SIZE)) 
    54123                { 
    55                         channel->masterPage->pages[pos] = buffer; 
    56                         channel->pos = pos+1; 
    57                         WakeUp(&channel->waitQueue); 
    58                         return 0; 
     124                        buffIndex++; 
     125                        offset += bufferSize; 
    59126                } 
    60127                 
    61                 pos++; 
     128                index = offset/bufferSize; 
     129                offset %= PAGE_SIZE; 
     130 
     131                for (currOffset = offset; currOffset < PAGE_SIZE; currOffset += 
     132                                bufferSize) 
     133                        ChanSendHeaderInit(channel, (struct 
     134                                                ChanSendHeader*)(channel->pages[i+1] + currOffset), 
     135                                        buffIndex++); 
     136        }else if (i >= channel->info.numSendPages+1 && i < 
     137                        channel->info.numSendPages+channel->info.numRecvPages+1) 
     138        { 
    62139        } 
    63                  
    64         return -ENOMEM; 
     140 
     141        return 0; 
     142} 
     143 
     144int ChannelCopyPacket(struct Channel* channel, struct NetBuffer* buffer) 
     145{ 
     146        struct ChanRecvHeader* header; 
     147        int index; 
     148 
     149        header = ChanGetFreeRecvBuffer(channel, &index); 
     150 
     151        if (header == NULL) 
     152                return -ENOMEM; 
     153 
     154//      KePrint("header = %#X, length = %d, index = %d\n", header, buffer->length, 
     155//                      index); 
     156 
     157        /* Set up header */ 
     158        header->length = buffer->length; 
     159        header->priv = NULL; 
     160        header->indexFlags = 0; 
     161        header->read = 0; 
     162        ChanSetIndex(header, index); 
     163        header->id = ++channel->latestRecv; 
     164        memcpy((char*)header + sizeof(struct ChanRecvHeader), buffer->data, 
     165                        buffer->length); 
     166 
     167        WakeUpAll(&channel->waitQueue); 
     168 
     169        return 0; 
    65170} 
    66171 
    67172SYMBOL_EXPORT(ChannelCopyPacket); 
     173 
     174int ChannelMemorySetup(struct Channel* channel, struct ChannelOptions* options) 
     175{ 
     176        int sendBuffers = 0, recvBuffers = 0; 
     177        struct PhysPage* header; 
     178 
     179        channel->info.sendHeaderBytes = sizeof(struct ChanSendHeader) + 
     180                channel->info.hwHeaderBytes; 
     181        channel->info.recvHeaderBytes = sizeof(struct ChanRecvHeader); 
     182 
     183        if (options) 
     184        { 
     185                sendBuffers = options->sendBuffers; 
     186                if (sendBuffers > CHAN_MAX_SEND_BUFFERS) 
     187                        sendBuffers = CHAN_MAX_SEND_BUFFERS; 
     188 
     189                recvBuffers = options->recvBuffers; 
     190                if (recvBuffers > CHAN_MAX_RECV_BUFFERS) 
     191                        recvBuffers = CHAN_MAX_RECV_BUFFERS; 
     192        } 
     193 
     194        if (!sendBuffers) 
     195                sendBuffers = CHAN_DEFAULT_SEND_BUFFERS; 
     196 
     197        if (!recvBuffers) 
     198                recvBuffers = CHAN_DEFAULT_RECV_BUFFERS; 
     199 
     200        channel->info.numSendPages = PAGE_ALIGN_UP((sendBuffers*(sizeof(struct ChanSendHeader) + ChanMaxPacketSize(channel))))/PAGE_SIZE; 
     201        channel->info.numRecvPages = PAGE_ALIGN_UP((recvBuffers*(sizeof(struct ChanRecvHeader) + ChanMaxPacketSize(channel))))/PAGE_SIZE; 
     202        channel->info.numSendBuffers = sendBuffers; 
     203        channel->info.numRecvBuffers = recvBuffers; 
     204 
     205        channel->pages = (char**)MemAlloc(sizeof(char*) * (ChanSendPages(channel) + 
     206                                ChanRecvPages(channel))); 
     207 
     208        if (!channel->pages) 
     209                return -ENOMEM; 
     210 
     211        header = PageAlloc(); 
     212        channel->pages[0] = (char*)VirtAllocateTemp(header->physAddr); 
     213        ChanHeaderInit(channel, (struct ChanUserHeader*)channel->pages[0]); 
     214 
     215        return 0; 
     216} 
     217 
     218/* General channel allocation */ 
     219struct Channel* ChannelAlloc() 
     220{ 
     221        return (struct Channel*)MemAlloc(sizeof(struct Channel)); 
     222} 
     223 
     224void ChannelFree(struct Channel* channel) 
     225{ 
     226        MemFree(channel); 
     227} 
  • Whitix/branches/netchannel/net/channels/recv.c

    r2066 r2084  
    4545 
    4646        if (ops && ops->recvBuffer) 
    47                 if (UNLIKELY(ops->recvBuffer(buffer) == 0)) 
     47                if (UNLIKELY(ops->recvBuffer(buffer) == CHAN_NOT_HANDLED)) 
    4848                        ops = NULL; 
    4949 
     
    5252                int i; 
    5353 
    54  
    5554                for (i = 0; i < CHANNEL_MAX; i++) 
    5655                { 
    57                         if (channelOps[i] && channelOps[i] != buffer->device->channelOps 
    58                                 && channelOps[i]->recvBuffer) 
    59                                 if (channelOps[i]->recvBuffer(buffer) > 0) 
     56                        if (channelOps[i] && channelOps[i]->recvBuffer) 
     57                                if (channelOps[i]->recvBuffer(buffer) == CHAN_HANDLED) 
    6058                                        break; 
    6159                } 
    6260 
    63                 if (i != CHANNEL_MAX) 
    64                 { 
    65                         if (!buffer->device) 
    66                         { 
    67                                 KePrint("3: Eeek? Check skb?, %#X\n", buffer); 
    68                                 cli(); hlt(); 
    69                         } 
    70                          
     61                if (i != CHANNEL_MAX)            
    7162                        buffer->device->channelOps = channelOps[i]; 
    72                 } 
    7363        } 
    7464 
  • Whitix/branches/netchannel/net/channels/sys.c

    r2061 r2084  
    2929extern struct ChannelOps* channelOps[CHANNEL_MAX]; 
    3030 
     31int NetChannelCreate(int chnType, void* source, void* dest, struct 
     32                ChannelOptions* info) 
     33{ 
     34        /* TODO */ 
     35        return 0; 
     36} 
     37 
    3138#define CHAN_TYPE_TO_FAMILY(type) ((type) >> 16) 
    3239 
    33 int SysChannelCreate(int chnType, void* source, void* dest, int flags) 
     40int SysChannelCreate(int chnType, void* source, void* dest, struct 
     41                ChannelOptions* options) 
    3442{ 
    3543        struct ChannelOps* type; 
     
    3745        struct ChannelHead* head; 
    3846        int family = CHAN_TYPE_TO_FAMILY(chnType); 
     47        int ret; 
    3948         
    4049        if (family > CHANNEL_MAX || !channelOps[family]) 
     
    4453         
    4554        /* Allocate channels, and run the family-specific code. */ 
    46         channel = (struct Channel*)MemAlloc(sizeof(struct Channel)); 
     55        channel = ChannelAlloc(); 
    4756 
    4857        channel->family = family;        
    4958        channel->type = (chnType & 0xFFFF); 
    50         channel->flags = flags; 
    5159 
    5260        /* user memcpy? */ 
     
    5664        if (type->create) 
    5765        { 
    58                 head = type->create(channel); 
    59                  
    60                 if (!head) 
    61                 { 
    62                         MemFree(channel); 
    63                         return -EINVAL; 
    64                 } 
    65                  
     66                ret = type->create(channel, &head, options); 
     67 
     68                if (ret < 0) 
     69                        goto freeChannel; 
     70 
     71                ret = ChannelMemorySetup(channel, options); 
     72 
     73                if (ret) 
     74                        goto freeChannel; 
     75 
    6676                /* Spinlock? */ 
    67                 ListAddTail(&channel->next, &head->head); 
    68                  
    69                 ChannelAddBuffers(channel); 
     77                /* Note, we add at the start of the list so more specific channels 
     78                 * can receive the data. */ 
     79                ListAdd(&channel->next, &head->head); 
    7080                INIT_WAITQUEUE_HEAD(&channel->waitQueue); 
    71                  
     81 
    7282                /* Copy address back to memcpy, in case they've changed. For example, 
    7383                 * the Ipv4 code allocates source ports if the application requires 
     
    7787        } 
    7888 
    79         return ChanAttachFd(channel); 
     89        ret = ChanAttachFd(channel); 
     90 
     91        if (options) 
     92                channel->flags = options->flags; 
     93 
     94        if (ret >= 0) 
     95                return ret; 
     96 
     97freeChannel: 
     98        MemFree(channel); 
     99        return ret; 
    80100} 
    81101 
    82102int SysChannelControl(int chnFd, int code, void* data) 
    83103{ 
     104        struct Channel* channel = ChanFromFile(FileGet(chnFd)); 
     105 
     106        if (!channel) 
     107                return -EBADF; 
     108         
     109        switch (code) 
     110        { 
     111                case CHANNEL_SET_INTERFACE: 
     112                { 
     113                        struct NetDevice* device; 
     114                        struct ChanBindInterface 
     115                        { 
     116                                const char* infName; 
     117                        }; 
     118                        struct ChanBindInterface* bind = (struct ChanBindInterface*)data; 
     119 
     120                        /* FIXME: Check if protocol family is local or not. */ 
     121                         
     122                        channel->device = NetDeviceFind(bind->infName); 
     123 
     124                        if (!channel->device) 
     125                                return -ENOENT; 
     126 
     127                        device = (struct NetDevice*)channel->device; 
     128 
     129                        /* TODO: Check pointer */ 
     130                        channel->header->info.hwHeaderBytes = channel->info.hwHeaderBytes = device->headerLen; 
     131                        channel->header->info.maxPacketSize = channel->info.maxPacketSize = 
     132                                device->mtu - device->headerLen; 
     133                        return 0; 
     134                } 
     135        } 
     136         
    84137        return -ENOTIMPL; 
    85138} 
  • Whitix/branches/netchannel/net/device.c

    r2061 r2084  
    2424#include <slab.h> 
    2525#include <fs/devfs.h> 
     26#include <fs/icfs.h> 
    2627 
    2728struct Cache* netDeviceCache; 
    28  
    29 /* Only one device for now! TODO: Add support for multiple devices. */ 
    30 struct NetDevice* currDevice = NULL; 
    31  
    3229struct DevClass networkClass; 
    33  
    34 /* For now */ 
    35 SYMBOL_EXPORT(currDevice); 
    3630 
    3731struct NetDevice* NetDeviceAlloc() 
     
    4236SYMBOL_EXPORT(NetDeviceAlloc); 
    4337 
     38int NetDeviceGetRunning(struct KeObject* object, BYTE* data, unsigned long size, DWORD position) 
     39{ 
     40        return 0; 
     41} 
     42 
     43int NetDeviceSetRunning(struct KeObject* object, BYTE* data, unsigned long size, DWORD position) 
     44{ 
     45        struct NetDevice* device = NetDeviceFromObj(object); 
     46 
     47        if (device == NULL || size != sizeof(int) || position != 0) 
     48                return -EINVAL; 
     49 
     50        int running = *(int*)data; 
     51        int ret; 
     52 
     53        if (running == 1) 
     54        { 
     55                if (device->flags & NET_DEVICE_RUNNING) 
     56                        return 0; 
     57 
     58                if (device->ops && device->ops->start) 
     59                { 
     60                        ret = device->ops->start(device); 
     61 
     62                        if (!ret) 
     63                                device->flags |= NET_DEVICE_RUNNING; 
     64 
     65                        return ret; 
     66                } 
     67        }else if (running == 0){ 
     68                KePrint("Stop\n"); 
     69        } 
     70 
     71        return -EINVAL; 
     72} 
     73 
    4474int NetDeviceRegister(struct NetDevice* device) 
    45 { 
    46         currDevice=device; 
    47          
     75{        
    4876        KeDeviceInit(&device->device, &networkClass.set, 0, NULL, DEVICE_CHAR); 
    4977                 
    50         KeDeviceAttach(&device->device, "Ethernet0");    
    51          
     78        if (KeDeviceAttach(&device->device, device->infType, 0) < 0) 
     79                return -EINVAL; 
     80 
     81        IcFsAddFuncEntry(device->device.object.dir, &device->device.object, "running", NetDeviceGetRunning, NetDeviceSetRunning); 
     82 
    5283        return 0; 
    5384} 
     
    5788int NetDeviceSend(struct NetDevice* device, struct NetBuffer* buffer) 
    5889{ 
     90        int ret; 
     91         
    5992        if (!device->ops || !device->ops->send) 
    6093                return -ENOTIMPL; 
    6194         
     95        ret = device->ops->send(device, buffer); 
     96         
     97        if (ret) 
     98                return ret; 
     99        else 
     100                return buffer->length; 
     101         
    62102//      if (device-> state & NET_DEVICE_QUEUE_RUNNING) 
    63                 return device->ops->send(device, buffer); 
    64103//      else{ 
    65104                /* Add the packet onto the queue, and wait for the device to pick 
     
    72111SYMBOL_EXPORT(NetDeviceSend); 
    73112 
     113DWORD NetDevFindMinMtu() 
     114{ 
     115        struct NetDevice* curr; 
     116        DWORD min = PAGE_SIZE; 
     117 
     118        KeSetForEach(curr, networkClass.set, device.object) 
     119        { 
     120                if (curr->mtu < min) 
     121                        min = curr->mtu; 
     122        } 
     123         
     124        return min; 
     125} 
     126 
     127SYMBOL_EXPORT(NetDevFindMinMtu); 
     128 
     129DWORD NetDevFindMaxHeader() 
     130{ 
     131        struct NetDevice* curr; 
     132        DWORD max = 0; 
     133         
     134        KeSetForEach(curr, networkClass.set, device.object) 
     135        { 
     136                if (curr->headerLen > max) 
     137                        max = curr->headerLen; 
     138        } 
     139         
     140        return max; 
     141} 
     142 
     143SYMBOL_EXPORT(NetDevFindMaxHeader); 
     144 
     145struct NetDevice* NetDeviceFind(const char* name) 
     146{ 
     147        struct NetDevice* curr; 
     148         
     149        KeSetForEach(curr, networkClass.set, device.object) 
     150        { 
     151                const char* infName = KeDeviceGetName(&curr->device); 
     152                 
     153                if (!strcmp(name, infName)) 
     154                        return curr; 
     155        } 
     156         
     157        return NULL; 
     158} 
     159 
     160SYMBOL_EXPORT(NetDeviceFind); 
     161 
    74162int NetDeviceInit() 
    75163{ 
  • Whitix/branches/netchannel/net/eth.c

    r2061 r2084  
    1717 */ 
    1818 
     19#include <net/arp.h> 
    1920#include <net/device.h> 
    2021#include <net/byteswap.h> 
     
    4041SYMBOL_EXPORT(EthDeviceAlloc); 
    4142 
     43int EthBuildHeader(struct NetDevice* device, struct NetBuffer* sockBuff, void* address) 
     44{ 
     45        struct EthHeader* header = (struct EthHeader*)sockBuff->data; 
     46        struct EthDevice* ethDev = (struct EthDevice*)device->procPriv; 
     47        BYTE dest[6]; /* FIXME: Don't need this */ 
     48        DWORD destAddr = *(DWORD*)address; 
     49         
     50        memcpy(&header->src, ethDev->macAddress, 6); 
     51        header->type = NetToHostShort(ETH_IP); 
     52         
     53        ArpGetLinkAddress(device, device->netAddress, destAddr, dest); 
     54         
     55        memcpy(&header->dest, dest, 6); 
     56 
     57        return 0; 
     58} 
     59 
    4260int EthDeviceRegister(struct EthDevice* device) 
    4361{ 
    4462        int ret; 
    4563        struct KeFsEntry* dir; 
     64        struct NetDevice* netDev = device->dev; 
    4665         
    47         ret = NetDeviceRegister(device->dev); 
     66        if (!device->dev && !device->dev->ops) 
     67                return -EFAULT; 
     68         
     69        /* Set Ethernet-specific information */ 
     70        netDev->infType = "Ethernet%d"; 
     71         
     72        netDev->headerLen = sizeof(struct EthHeader); 
     73        netDev->addressLen = sizeof(EthMac); 
     74        netDev->mtu = 1492; 
     75         
     76        if (!netDev->ops->buildHeader) 
     77                netDev->ops->buildHeader = EthBuildHeader; 
     78         
     79        ret = NetDeviceRegister(netDev); 
    4880         
    4981        if (ret) 
     
    5183         
    5284        /* TODO: Use proper IcFs attributes. */ 
    53         dir = KeDeviceGetConfDir(&device->dev->device); 
     85        dir = KeDeviceGetConfDir(&netDev->device); 
    5486                 
    5587        /* TODO: Change to array entry. */ 
    56         IcFsAddStrEntry(dir, "macAddress", device->macAddress, VFS_ATTR_READ | VFS_ATTR_WRITE); 
    57         IcFsAddIntEntry(dir, "netAddress", (int*)&device->dev->netAddress, VFS_ATTR_READ | VFS_ATTR_WRITE); 
    58  
    59         /* Set Ethernet-specific information */ 
    60         device->dev->headerLen = sizeof(struct EthHeader); 
    61         device->dev->addressLen = sizeof(EthMac); 
    62                  
     88        IcFsAddArrayEntry(dir, "macAddress", (char*)&device->macAddress, 6, 6, 6); 
     89        IcFsAddArrayEntry(dir, "netAddress", (char*)&netDev->netAddress, 4, 4, 4); 
     90         
    6391        return 0;        
    6492} 
     
    103131        header->type = NetToHostShort(type); 
    104132         
    105         NetBufferPush(buffer, sizeof(struct EthHeader)); 
    106          
    107133        return 0; 
    108134} 
  • Whitix/branches/netchannel/net/ipv4/Makefile

    r2064 r2084  
    11DEPTH=../../ 
    2 MODULES = init.sys arp.sys icmp.sys 
     2MODULES = init.sys icmp.sys loopback.sys route.sys port.sys udp.sys tcp.sys 
    33 
    44build: $(MODULES) 
  • Whitix/branches/netchannel/net/ipv4/icmp.c

    r2064 r2084  
    1111#include <net/eth.h> 
    1212 
     13#include "ipv4.h" 
     14 
    1315#define ICMP_ECHO_REPLY         0 
    1416#define ICMP_ECHO_REQUEST       8 
     17 
     18struct ChannelHead icmpChannelHead; 
    1519 
    1620struct IcmpHeader 
     
    2731}PACKED; 
    2832 
     33struct IcmpHeader* NetBuffIcmpHeader(struct NetBuffer* buffer) 
     34{ 
     35        return (struct IcmpHeader*)(buffer->transportHeader); 
     36} 
     37 
    2938struct KeTasklet icmpTasklet; 
    3039 
    3140LIST_HEAD(icmpPacketList); 
    3241 
     42void IcmpCopyToChannels(struct NetBuffer* buffer) 
     43{ 
     44        struct Channel* channel; 
     45 
     46        SpinLock(&icmpChannelHead.lock); 
     47         
     48        ListForEachEntry(channel, &icmpChannelHead.head, next) 
     49                ChannelCopyPacket(channel, buffer); 
     50         
     51        SpinUnlock(&icmpChannelHead.lock); 
     52} 
     53 
     54WORD IpChecksum(char* header, int length) 
     55{ 
     56        long sum; 
     57 
     58        sum = IpPartialSum(header, length, 0); 
     59 
     60        sum = (sum >> 16) + (sum & 0xFFFF); 
     61        sum += (sum >> 16); 
     62        sum = ~sum; 
     63 
     64        return NetToHostShort(sum); 
     65} 
     66 
     67int IcmpChecksum(struct IcmpHeader* header, int length) 
     68{ 
     69        int sum = header->checkSum; 
     70        int mySum = 0; 
     71 
     72        header->checkSum = 0; 
     73        mySum = IpChecksum((char*)header, length); 
     74        header->checkSum = sum; 
     75 
     76        return mySum; 
     77} 
     78 
    3379int IcmpRecvBuffer(struct NetBuffer* buffer) 
    3480{ 
     
    3682         
    3783        header = (struct IcmpHeader*)(buffer->data + sizeof(struct IpHeader)); 
    38          
     84 
    3985        switch (header->message) 
    4086        { 
    4187                case ICMP_ECHO_REQUEST: 
    4288                        if (header->code != 0) 
     89                        { 
     90                                IP_DEBUG(("Invalid header code %u", header->code)); 
    4391                                return -EINVAL; 
     92                        } 
    4493                                 
    45                         /* TODO: Check sum */ 
     94                        if (IcmpChecksum(header, buffer->length - sizeof(struct IpHeader)) != header->checkSum) 
     95                        { 
     96                                IP_DEBUG(("Packet failed checksum")); 
     97                                return -EINVAL; 
     98                        } 
    4699                         
    47100                        /* If there are more fragments set, or frame offset != 0, discard. 
    48101                         * Don't want to deal with IP fragmentation in the kernel, and 
    49102                         * ICMP echo requests shouldn't go to userspace. 
     103                         * 
     104                         * Actually, Linux only replies to the first packet! 
    50105                         */ 
    51106                                         
     
    56111         
    57112                        break; 
     113                         
     114                default: 
     115                        IcmpCopyToChannels(buffer); 
     116                        break; 
    58117        } 
    59118         
    60         return 1; 
     119        return CHAN_HANDLED; 
    61120} 
    62121 
     
    73132         
    74133        reply->device = buffer->device; 
    75          
    76         EthAddHeader(reply, EthDevMacAddress(buffer->device), EthDevSender(buffer), ETH_IP); 
    77          
    78         replyIp = (struct IpHeader*)(reply->data); 
     134        reply->type = buffer->type; 
     135 
     136        /* TODO: Should be a copy of the hw address, but we haven't got a good 
     137         * way of doing that yet. */ 
     138        DWORD addr = NetToHostLong(ipHeader->sourceAddr); 
     139        buffer->device->ops->buildHeader(buffer->device, reply, &addr); 
     140         
     141        replyIp = (struct IpHeader*)(reply->data + NetDevHeaderLen(buffer->device)); 
    79142         
    80143        memcpy(replyIp, ipHeader, sizeof(struct IpHeader)); 
     
    84147                 
    85148        /* Construct the ICMP packet */ 
    86         replyIcmp = (struct IcmpHeader*)(reply->data + sizeof(struct IpHeader)); 
     149        replyIcmp = (struct IcmpHeader*)(reply->data + 
     150                                        NetDevHeaderLen(buffer->device) + sizeof(struct IpHeader)); 
    87151         
    88152        memcpy(replyIcmp, icmpHeader, totalLength - sizeof(struct IpHeader)); 
     
    91155        replyIcmp->code = 0; 
    92156        replyIcmp->checkSum = 0; 
    93         replyIcmp->checkSum = IpCheckSum(replyIcmp, totalLength - sizeof(struct IpHeader)); 
     157        replyIcmp->checkSum = IpCheckSum((WORD*)replyIcmp, totalLength - sizeof(struct IpHeader)); 
    94158         
    95159        NetDeviceSend(reply->device, reply); 
    96          
    97         /* TODO: Free both buffers. */ 
     160 
     161//      NetFreeBuffer(buffer); FIXME: We don't know whether this is a userspace 
     162//      buffer or not! 
     163        NetFreeBuffer(reply); 
    98164} 
    99165 
     
    113179                                IcmpEchoReply(curr); 
    114180                                break; 
     181 
     182                        default: 
     183                                IP_DEBUG(("Unrecognised type %u", header->message)); 
    115184                } 
    116185                 
     
    121190} 
    122191 
     192struct ChannelHead* IcmpChannelHash(struct Ipv4EndPoint* src, struct 
     193                                Ipv4EndPoint* dest) 
     194{ 
     195        return &icmpChannelHead; 
     196} 
     197 
     198struct Ipv4Protocol icmpProto = 
     199{ 
     200        name            :       "ICMP", 
     201        rawProtocol :   IPV4_PROTOCOL_TYPE_ICMP, 
     202        hash            :       IcmpChannelHash, 
     203}; 
     204 
    123205int IcmpInit() 
    124206{ 
     
    128210        TaskletAdd(&icmpTasklet); 
    129211         
    130         return 0; 
    131 } 
     212        INIT_LIST_HEAD(&icmpChannelHead.head); 
     213 
     214        return Ipv4ProtoRegister(NET_CHANNEL_ICMP, &icmpProto); 
     215} 
  • Whitix/branches/netchannel/net/ipv4/init.c

    r2064 r2084  
    1010#include <net/eth.h> 
    1111 
    12 struct ChannelHead udpChannelHeads[IP_CHAN_LIST_MAX]; 
    13  
    14 struct ChannelHead* UdpChannelHash(struct Ipv4EndPoint* src, struct Ipv4EndPoint* dest); 
    15  
    16 extern struct NetDevice* currDevice; 
    17  
    18 /*********************************************************************** 
    19  * 
    20  * FUNCTION:    Ipv4AllocatePort 
    21  * 
    22  * DESCRIPTION: Allocate a ephemeral (source) port for a channel. 
    23  * 
    24  * PARAMETERS:  channel - Ipv4 channel to allocate port to. 
    25  * 
    26  * RETURNS:             0 on success. (what on error?) 
    27  * 
    28  ***********************************************************************/ 
    29  
    30 int Ipv4AllocatePorts(struct Channel* channel) 
    31 { 
    32         struct Ipv4EndPoint* src; 
    33                  
    34         src = (struct Ipv4EndPoint*)&channel->srcAddr; 
    35                  
    36         if (src->port == 0) 
    37         { 
    38                 /* Caller wants us to allocate a source port above 50 000 */ 
    39                 src->port = 52500; /* TEMP */ 
     12#include "ipv4.h" 
     13 
     14extern struct ChannelHead icmpChannelHeads[IP_CHAN_LIST_MAX]; 
     15 
     16static struct Ipv4Protocol* protocols[IPV4_NUM_PROTOCOLS]; 
     17 
     18int Ipv4CreateChannel(struct Channel* channel, struct ChannelHead** head, struct 
     19                ChannelOptions* options) 
     20{ 
     21        struct Ipv4Protocol* protocol; 
     22        int protIndex; 
     23 
     24        /* If the flag is set, the user will supply the data-link addresses. */  
     25        if (!options || !(options->flags & CHANNEL_IGNORE_ADDRESSES)) 
     26        { 
     27                struct Ipv4EndPoint* dest = (struct Ipv4EndPoint*)&channel->destAddr; 
     28 
     29                /* A zero destination address is always wrong */ 
     30                if (dest->address == 0) 
     31                        return -ENOROUTE; 
     32 
     33                if (dest->address == IPV4_BROADCAST || (channel->type != NET_CHANNEL_TCP)) 
     34                { 
     35                        /* Find min MTU, max packet header size, because we could send out 
     36                         * over any interface. */ 
     37                        channel->info.hwHeaderBytes = NetDevFindMaxHeader(); 
     38                        channel->info.maxPacketSize = NetDevFindMinMtu() - 
     39                                channel->info.hwHeaderBytes; 
     40                }else{ 
     41                        /* Resolve to device. */ 
     42                        struct NetDevice* device; 
     43                        struct RouteEntry* entry; 
     44 
     45                        entry = RouteLookup(dest->address, &device); 
     46 
     47                        if (!entry) 
     48                                return -ENOROUTE; 
     49 
     50                        channel->route = entry; 
     51                        channel->info.maxPacketSize = device->mtu; 
     52                        channel->info.hwHeaderBytes = device->headerLen; 
     53                } 
     54 
     55                /* Number of buffers is a function of maxPacketSize and *Pages */ 
    4056        }else{ 
    41                 /* Check source port is not being used. */ 
    42         } 
    43 } 
    44  
    45 struct ChannelHead* Ipv4Create(struct Channel* channel) 
    46 { 
    47         struct ChannelHead* head; 
    48         struct Ipv4EndPoint* src; 
    49          
    50         /* If the flag is set, the user will supply the data-link addresses. */ 
    51          
    52         if (!(channel->flags & CHANNEL_IGNORE_ADDRESSES)) 
    53         { 
    54                 /* TODO: Look up in route table to find ethernet device (when we have 
    55                  * multiple devices). */ 
    56                 ((struct Ipv4EndPoint*)&channel->srcAddr)->address = currDevice->netAddress; 
    57         } 
    58          
    59         if (Ipv4AllocatePorts(channel)) 
    60                 return NULL; 
    61                  
    62         if (channel->type == 0x01) 
    63                 head = UdpChannelHash((struct Ipv4EndPoint*)&channel->srcAddr, 
    64                         (struct Ipv4EndPoint*)&channel->destAddr); 
    65          
    66         if (!head) 
     57                channel->info.maxPacketSize = NetDevFindMinMtu(); 
     58                channel->info.hwHeaderBytes = NetDevFindMaxHeader(); 
     59        } 
     60 
     61        if (channel->type >= IPV4_NUM_PROTOCOLS) 
     62                return -ENOTIMPL; 
     63 
     64        IP_DEBUG(("Finding head for channel, type = %u", channel->type)); 
     65         
     66        protIndex = channel->type; 
     67        channel->transPriv = protocols[protIndex]; 
     68        protocol = (struct Ipv4Protocol*)channel->transPriv; 
     69 
     70        IP_DEBUG(("protocol = %p", protocol)); 
     71 
     72        if (protocol == NULL) 
     73                return -ENOTIMPL; 
     74 
     75        if (protocol->flags & IPV4_ALLOCATE_PORT) 
     76                if (Ipv4PortAllocate(channel, protocol->portMap)) 
     77                        return -EINVAL; 
     78         
     79        *head = protocol->hash((struct Ipv4EndPoint*)&channel->srcAddr, 
     80                (struct Ipv4EndPoint*)&channel->destAddr); 
     81 
     82        IP_DEBUG(("Hashing channel, head = %p", *head)); 
     83 
     84        if (!*head) 
    6785                return -EFAULT; 
    68                          
    69         return head; 
     86 
     87        return 0; 
    7088} 
    7189 
     
    7391{ 
    7492        struct NetBuffer* netBuff; 
    75          
     93        struct NetDevice* device = NULL; 
     94        struct RouteEntry* entry; 
     95        struct Ipv4Protocol* protocol; 
     96        int ret; 
     97 
     98        /* FIXME: Remove this to get real speedup. Can make user packet header 
     99        ** longer with no problems. Need to get rid of dynamic allocation.. */ 
    76100        netBuff = NetAllocSendBuffer(data, length); 
    77101         
    78102        if (!netBuff) 
    79103                return -ENOMEM; 
    80                  
    81         /* TODO: Have per-channel device. Check channel device. */ 
    82         if (!currDevice) 
    83                 return -EINVAL; 
    84  
    85         /* TODO: Remove. Make sure DHCP.c can use this. */ 
    86         if (!(channel->flags & CHANNEL_IGNORE_ADDRESSES)) 
    87         { 
    88                 struct EthHeader* header = (struct EthHeader*)data; 
    89                 struct IpHeader* ipHeader = (struct IpHeader*)(data + sizeof(struct EthHeader)); 
    90                 char destAddr[6]; 
    91                 int ret; 
    92                  
    93                 memcpy(&header->src, ((struct EthDevice*)currDevice->procPriv)->macAddress, 6); 
    94                 header->type = HostToNetShort(ETH_IP);           
    95                  
    96                 ret = ArpGetLinkAddress(currDevice, NetToHostLong(currDevice->netAddress), NetToHostLong(ipHeader->destAddr), destAddr); 
    97                  
    98                 if (ret < 0) 
    99                         return -EINVAL; 
    100                 else if (ret > 0) 
    101                         return 0; 
     104 
     105        if (channel->flags & CHANNEL_IGNORE_ADDRESSES) 
     106        { 
     107                /* Need to bind to an interface by calling SysChannelControl first. */ 
     108                if (!channel->device) 
     109                        return -ENOROUTE; 
     110 
     111                device = (struct NetDevice*)(channel->device);           
     112        }else{ 
     113                struct IpHeader* ipHeader = (struct IpHeader*)(data + 
     114                                ChanHeaderBytes(channel)); 
     115                DWORD address = NetToHostLong(ipHeader->destAddr); 
     116 
     117                protocol = (struct Ipv4Protocol*)(channel->transPriv); 
     118                 
     119                if (!channel->route) 
     120                { 
     121                        entry = RouteLookup(address, &device); 
     122 
     123                        if (!entry) 
     124                                return -ENOROUTE; 
    102125                         
    103                 memcpy(&header->dest, destAddr, 6); 
    104         }        
    105          
    106         return NetDeviceSend(currDevice, netBuff); 
     126                        if (entry->gateway != 0) 
     127                                address = entry->gateway; 
     128                                 
     129                        ipHeader->sourceAddr = HostToNetLong(device->netAddress); 
     130                         
     131                        if (protocol->addChecksum && protocol->addChecksum(channel, netBuff)) 
     132                                return -EIO; /* Data error? */ 
     133                }else{ 
     134                        entry = (struct RouteEntry*)channel->route; 
     135                        ipHeader->sourceAddr = HostToNetLong(entry->device->netAddress); 
     136 
     137                        if (entry->gateway != 0) 
     138                                address = entry->gateway; 
     139 
     140                        if (protocol->addChecksum && protocol->addChecksum(channel, netBuff)) 
     141                                return -EIO; /* Data error? */ 
     142 
     143                        device = entry->device; 
     144                } 
     145 
     146                ipHeader->checkSum = IpCheckSum((WORD*)ipHeader, sizeof(struct IpHeader)); 
     147                 
     148                ret = device->ops->buildHeader(device, netBuff, &address); 
     149                 
     150                if (ret) 
     151                        return ret;      
     152        } 
     153         
     154        netBuff->device = device; 
     155        netBuff->type = ETH_IP; 
     156         
     157        return NetDeviceSend(device, netBuff); 
    107158} 
    108159 
     
    129180         * have a valid checksum. */ 
    130181        if (IP_VERSION(ipHeader) != 4) 
     182        { 
     183                IP_DEBUG(("not IPV4? version = %d", IP_VERSION(ipHeader))); 
    131184                return -EINVAL; 
    132                  
    133         /* CHECKSUM */ 
     185        } 
     186                 
     187        /* TODO: IP CHECKSUM */ 
    134188 
    135189        /* TODO: More checks, see if packet is long enough */ 
    136190        switch (ipHeader->protocol) 
    137191        { 
    138                 case PROTOCOL_TYPE_ICMP: 
     192                case IPV4_PROTOCOL_TYPE_ICMP: 
    139193                        break; 
    140194                 
    141                 case PROTOCOL_TYPE_TCP:  
    142                 case PROTOCOL_TYPE_UDP: 
     195                case IPV4_PROTOCOL_TYPE_TCP:     
     196                case IPV4_PROTOCOL_TYPE_UDP: 
    143197                        Ipv4GetPorts(buffer, src, dest); 
    144198                        break; 
     
    148202                        return -EINVAL; 
    149203        } 
    150  
    151         src->protocol = ipHeader->protocol; 
    152          
    153         return 0; 
    154 } 
    155  
    156 struct ChannelHead* UdpChannelHash(struct Ipv4EndPoint* src, struct Ipv4EndPoint* dest) 
    157 { 
    158         return (udpChannelHeads + (src->port & (IP_CHAN_LIST_MAX-1))); 
    159 } 
    160  
    161 static int UdpChannelCompare(struct Channel* channel, struct ChannelAddr* src, 
    162         struct ChannelAddr* dest) 
    163 { 
    164         struct Ipv4EndPoint* localSrc, *remoteDest; 
    165          
    166         localSrc = (struct Ipv4EndPoint*)&channel->srcAddr; 
    167         remoteDest = (struct Ipv4EndPoint*)dest; 
    168          
    169         return (localSrc->port != remoteDest->port); 
     204         
     205        return 0; 
    170206} 
    171207 
     
    175211        struct IpHeader* header = (struct IpHeader*)(buffer->data); 
    176212         
    177         return (header->protocol == PROTOCOL_TYPE_ICMP); 
     213        return (header->protocol == IPV4_PROTOCOL_TYPE_ICMP); 
     214} 
     215 
     216int Ipv4ArpRequest(struct NetBuffer* buffer); 
     217int IcmpRecvBuffer(struct NetBuffer* buffer); 
     218 
     219static struct Ipv4Protocol* Ipv4ProtocolFind(int type) 
     220{ 
     221        int i; 
     222         
     223        for (i = 0; i < IPV4_NUM_PROTOCOLS; i++) 
     224        { 
     225                if (protocols[i] && protocols[i]->rawProtocol == type) 
     226                        return protocols[i]; 
     227        } 
     228         
     229        IP_DEBUG(("type %d not handled", type)); 
     230         
     231        return NULL; 
    178232} 
    179233 
     
    183237        struct ChannelHead* head = NULL; 
    184238        struct Channel* channel; 
    185  
     239        struct Ipv4Protocol* proto; 
     240        struct IpHeader* ipHeader; 
    186241        ChanCompareFunc func = NULL; 
    187242 
    188         struct IpHeader* ipHeader = (struct IpHeader*)(buffer->data); 
     243        ipHeader = (struct IpHeader*)(buffer->data); 
    189244 
    190245        if (buffer->type == ETH_ARP) 
     
    192247 
    193248        if (buffer->type != ETH_IP) 
    194                 return 0; 
    195          
     249                return CHAN_NOT_HANDLED; 
     250 
     251        /* TODO: Do we need to copy src and dest? Return pointers? */ 
    196252        if (Ipv4GetInfo(buffer, &src, &dest) < 0) 
    197                 return 0; 
     253                return CHAN_NOT_HANDLED; 
    198254         
    199255        if (Ipv4IsIcmpPacket(buffer)) 
    200256                return IcmpRecvBuffer(buffer); 
    201                  
    202         switch (ipHeader->protocol) 
    203         { 
    204                 case PROTOCOL_TYPE_UDP: 
    205                         head = UdpChannelHash(&dest, &src); 
    206                         func = UdpChannelCompare; 
    207                         break; 
    208         } 
    209          
    210         if (func) 
    211         { 
    212                 channel = ChannelSearchList(head, func, &src, &dest); 
     257 
     258        proto = Ipv4ProtocolFind(ipHeader->protocol); 
     259         
     260        if (!proto || !proto->hash)  
     261                return CHAN_NOT_HANDLED; 
     262 
     263        func = proto->compareFunc; 
     264        head = proto->hash((struct Ipv4EndPoint*)&dest, (struct Ipv4EndPoint*)&src); 
     265 
     266        IP_DEBUG(("head = %p", head)); 
     267 
     268        if (func && head) 
     269        { 
     270                channel = ChannelSearchList(head, func, 
     271                        (struct ChannelAddr*)&src, (struct ChannelAddr*)&dest); 
    213272         
    214273                if (!channel) 
    215                         return -EINVAL; 
    216                  
     274                { 
     275                        IP_DEBUG(("no match for packet")); 
     276                        /* Let protocol know we haven't matched packet up with a channel. UDP may 
     277                         * send port unreachable, TCP may send RST. */ 
     278                        if (proto->chanNotFound) 
     279                                proto->chanNotFound(buffer); 
     280 
     281                        return CHAN_HANDLED; 
     282                } 
     283 
     284                /* May fail with -ENOMEM, but we have still handled it anyway. */ 
    217285                ChannelCopyPacket(channel, buffer); 
    218         } 
    219                  
    220         return 1; 
     286        }else{ 
     287                IP_DEBUG(("func = %#x, head = %#x", func, head)); 
     288 
     289        } 
     290 
     291        return CHAN_HANDLED; 
     292} 
     293 
     294int Ipv4ProtoRegister(int type, struct Ipv4Protocol* proto) 
     295{ 
     296        if (type >= IPV4_NUM_PROTOCOLS) 
     297                return -EINVAL; 
     298 
     299        if (protocols[type]) 
     300                return -EEXIST; 
     301 
     302        protocols[type] = proto; 
     303 
     304        KePrint(KERN_INFO "IPV4: Registered protocol type %d\n", proto->rawProtocol); 
     305 
     306        return 0; 
     307} 
     308 
     309WORD IpPartialSum(void* _data, DWORD bytes, DWORD sum) 
     310{ 
     311        DWORD i; 
     312        char* data = (char*)_data; 
     313 
     314        for (i=0; i<(bytes & ~0x1); i+=2) 
     315        { 
     316                sum+=NetToHostShort(*((WORD*)(data+i))); 
     317                if (sum > 0xFFFF) /* Wrap to 16 bits. */ 
     318                        sum-=0xFFFF; 
     319        } 
     320 
     321        if (i < bytes) 
     322        { 
     323                sum += data[i] << 8; 
     324 
     325                if (sum > 0xFFFF) 
     326                        sum-=0xFFFF; 
     327        } 
     328 
     329        return sum; 
    221330} 
    222331 
    223332struct ChannelOps ipv4Ops = 
    224333{ 
    225         .create = Ipv4Create, 
     334        .create = Ipv4CreateChannel, 
    226335        .write = Ipv4Write, 
    227336        .recvBuffer = Ipv4RecvBuffer, 
    228337}; 
    229338 
     339int ArpInit(); 
     340int IcmpInit(); 
     341int UdpInit(); 
     342int TcpInit(); 
     343int LoopbackInit(); 
     344int RouteInit(); 
     345 
    230346int IpInit() 
    231347{ 
    232         int i; 
     348        ChanRegisterFamily(CHANNEL_IP, &ipv4Ops); 
     349         
     350        ArpInit(); 
     351         
     352        LoopbackInit(); 
     353        RouteInit(); 
     354 
     355        /* IP protocols. These register protoOps for the different protocols. */ 
     356        IcmpInit(); 
     357        UdpInit(); 
     358        TcpInit(); 
    233359         
    234360        KePrint(KERN_INFO "IPV4: Set up IP channels."); 
    235          
    236         ChanRegisterFamily(CHANNEL_IP, &ipv4Ops); 
    237          
    238         for (i = 0; i < IP_CHAN_LIST_MAX; i++) 
    239         { 
    240                 INIT_LIST_HEAD(&udpChannelHeads[i].head); 
    241         } 
    242          
    243         KePrint(" Allocated %u channel lists\n", IP_CHAN_LIST_MAX); 
    244          
    245         ArpInit(); 
    246         IcmpInit(); 
    247          
     361 
    248362        return 0; 
    249363} 
  • Whitix/branches/netchannel/net/network.c

    r2061 r2084  
    2222#include <typedefs.h> 
    2323#include <print.h> 
     24#include <fs/icfs.h> 
     25 
     26struct KeFsEntry* netRoot; 
     27 
     28int NetworkIcFsInit() 
     29{ 
     30        netRoot = IcFsCreateDir(NULL, "Network"); 
     31         
     32        return 0; 
     33} 
     34 
     35struct KeFsEntry* NetworkIcFsGetRoot() 
     36{ 
     37        return netRoot; 
     38} 
     39 
     40SYMBOL_EXPORT(NetworkIcFsGetRoot); 
    2441 
    2542/*********************************************************************** 
     
    3855int EthInit(); 
    3956int NetDeviceInit(); 
     57int ChannelInit(); 
    4058 
    4159int NetworkInit() 
     
    4664 
    4765        EthInit(); 
     66         
     67        NetworkIcFsInit(); 
    4868 
    4969        return ChannelInit(); 
  • Whitix/branches/netchannel/user/burn/main.c

    r1381 r2084  
    428428        char* buffer; 
    429429        char promptPrint[PATH_MAX]; 
    430          
     430 
    431431        /* If a -c option is passed, execute the following parameters and quit */ 
    432432        char* command = NULL; 
  • Whitix/branches/netchannel/user/grub/menu.lst

    r1360 r2084  
    66title Whitix 0.2 CD 
    77kernel --no-mem-option --type=multiboot /Boot/Kernel root=AtaCd0 
    8 module /System/Modules/Core/console.sys 
    98module /System/Modules/Core/cdfs.sys 
    109module /System/Modules/Core/ata_ide.sys 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-boot.Po

    r2061 r2084  
    11libgrub_a-boot.o: boot.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h freebsd.h imgact_aout.h i386-elf.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 freebsd.h imgact_aout.h i386-elf.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-builtins.Po

    r2061 r2084  
    11libgrub_a-builtins.o: builtins.c /usr/include/stdio.h \ 
    2   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    3   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    4   /usr/include/gnu/stubs-32.h \ 
    5   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    6   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    7   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    8   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    9   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    10   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h shared.h \ 
    11   ../config.h ../stage1/stage1.h /usr/include/ncurses.h \ 
    12   /usr/include/ncurses_dll.h /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h term.h serial.h terminfo.h \ 
    15   ../lib/device.h md5.h 
     2 /usr/include/features.h /usr/include/bits/predefs.h \ 
     3 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     4 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     5 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     6 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     7 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     8 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     9 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     10 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h shared.h \ 
     11 ../config.h ../stage1/stage1.h /usr/include/ncurses.h \ 
     12 /usr/include/ncurses_dll.h \ 
     13 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     14 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     15 filesys.h pc_slice.h term.h serial.h terminfo.h ../lib/device.h md5.h 
    1616 
    1717/usr/include/stdio.h: 
    1818 
    1919/usr/include/features.h: 
     20 
     21/usr/include/bits/predefs.h: 
    2022 
    2123/usr/include/sys/cdefs.h: 
     
    2729/usr/include/gnu/stubs-32.h: 
    2830 
    29 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     31/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3032 
    3133/usr/include/bits/types.h: 
     
    3941/usr/include/wchar.h: 
    4042 
    41 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     43/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    4244 
    4345/usr/include/bits/stdio_lim.h: 
     
    5961/usr/include/ncurses_dll.h: 
    6062 
     63/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     64 
    6165/usr/include/unctrl.h: 
    6266 
    6367/usr/include/curses.h: 
    64  
    65 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6668 
    6769mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-char_io.Po

    r2061 r2084  
    11libgrub_a-char_io.o: char_io.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h term.h hercules.h serial.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h term.h \ 
     14 hercules.h serial.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-cmdline.Po

    r2061 r2084  
    11libgrub_a-cmdline.o: cmdline.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h 
    1514 
    1615shared.h: 
     
    2827/usr/include/features.h: 
    2928 
     29/usr/include/bits/predefs.h: 
     30 
    3031/usr/include/sys/cdefs.h: 
    3132 
     
    3637/usr/include/gnu/stubs-32.h: 
    3738 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     39/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3940 
    4041/usr/include/bits/types.h: 
     
    4849/usr/include/wchar.h: 
    4950 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     51/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5152 
    5253/usr/include/bits/stdio_lim.h: 
     
    5859/usr/include/bits/stdio2.h: 
    5960 
     61/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     62 
    6063/usr/include/unctrl.h: 
    6164 
    6265/usr/include/curses.h: 
    6366 
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    65  
    6667mb_header.h: 
    6768 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-common.Po

    r2061 r2084  
    11libgrub_a-common.o: common.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h 
    1514 
    1615shared.h: 
     
    2827/usr/include/features.h: 
    2928 
     29/usr/include/bits/predefs.h: 
     30 
    3031/usr/include/sys/cdefs.h: 
    3132 
     
    3637/usr/include/gnu/stubs-32.h: 
    3738 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     39/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3940 
    4041/usr/include/bits/types.h: 
     
    4849/usr/include/wchar.h: 
    4950 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     51/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5152 
    5253/usr/include/bits/stdio_lim.h: 
     
    5859/usr/include/bits/stdio2.h: 
    5960 
     61/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     62 
    6063/usr/include/unctrl.h: 
    6164 
    6265/usr/include/curses.h: 
    6366 
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    65  
    6667mb_header.h: 
    6768 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-disk_io.Po

    r2061 r2084  
    11libgrub_a-disk_io.o: disk_io.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h ../lib/device.h freebsd.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h ../lib/device.h freebsd.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_ext2fs.Po

    r2061 r2084  
    11libgrub_a-fsys_ext2fs.o: fsys_ext2fs.c shared.h ../config.h \ 
    2   ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
    3   /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h 
     2 ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
     3 /usr/include/stdio.h /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_fat.Po

    r2061 r2084  
    11libgrub_a-fsys_fat.o: fsys_fat.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h fat.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h fat.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_ffs.Po

    r2061 r2084  
    11libgrub_a-fsys_ffs.o: fsys_ffs.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h defs.h disk_inode.h disk_inode_ffs.h \ 
    15   dir.h fs.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h defs.h disk_inode.h disk_inode_ffs.h dir.h fs.h 
    1615 
    1716shared.h: 
     
    2928/usr/include/features.h: 
    3029 
     30/usr/include/bits/predefs.h: 
     31 
    3132/usr/include/sys/cdefs.h: 
    3233 
     
    3738/usr/include/gnu/stubs-32.h: 
    3839 
    39 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    4041 
    4142/usr/include/bits/types.h: 
     
    4950/usr/include/wchar.h: 
    5051 
    51 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5253 
    5354/usr/include/bits/stdio_lim.h: 
     
    5960/usr/include/bits/stdio2.h: 
    6061 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6164/usr/include/unctrl.h: 
    6265 
    6366/usr/include/curses.h: 
    64  
    65 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6667 
    6768mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_iso9660.Po

    r2061 r2084  
    11libgrub_a-fsys_iso9660.o: fsys_iso9660.c shared.h ../config.h \ 
    2   ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
    3   /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h iso9660.h 
     2 ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
     3 /usr/include/stdio.h /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h iso9660.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_jfs.Po

    r2061 r2084  
    11libgrub_a-fsys_jfs.o: fsys_jfs.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h jfs.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h jfs.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_minix.Po

    r2061 r2084  
    11libgrub_a-fsys_minix.o: fsys_minix.c shared.h ../config.h \ 
    2   ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
    3   /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h 
     2 ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
     3 /usr/include/stdio.h /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_reiserfs.Po

    r2061 r2084  
    11libgrub_a-fsys_reiserfs.o: fsys_reiserfs.c shared.h ../config.h \ 
    2   ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
    3   /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h 
     2 ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
     3 /usr/include/stdio.h /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_ufs2.Po

    r2061 r2084  
    11libgrub_a-fsys_ufs2.o: fsys_ufs2.c shared.h ../config.h \ 
    2   ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
    3   /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h ufs2.h 
     2 ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
     3 /usr/include/stdio.h /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h ufs2.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_vstafs.Po

    r2061 r2084  
    11libgrub_a-fsys_vstafs.o: fsys_vstafs.c shared.h ../config.h \ 
    2   ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
    3   /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h vstafs.h 
     2 ../stage1/stage1.h /usr/include/ncurses.h /usr/include/ncurses_dll.h \ 
     3 /usr/include/stdio.h /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h vstafs.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_xfs.Po

    r2061 r2084  
    11libgrub_a-fsys_xfs.o: fsys_xfs.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h xfs.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h xfs.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-gunzip.Po

    r2061 r2084  
    11libgrub_a-gunzip.o: gunzip.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h filesys.h pc_slice.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 filesys.h pc_slice.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-md5.Po

    r2061 r2084  
    11libgrub_a-md5.o: md5.c md5.h shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h 
    1514 
    1615md5.h: 
     
    3029/usr/include/features.h: 
    3130 
     31/usr/include/bits/predefs.h: 
     32 
    3233/usr/include/sys/cdefs.h: 
    3334 
     
    3839/usr/include/gnu/stubs-32.h: 
    3940 
    40 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     41/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    4142 
    4243/usr/include/bits/types.h: 
     
    5051/usr/include/wchar.h: 
    5152 
    52 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     53/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5354 
    5455/usr/include/bits/stdio_lim.h: 
     
    6061/usr/include/bits/stdio2.h: 
    6162 
     63/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     64 
    6265/usr/include/unctrl.h: 
    6366 
    6467/usr/include/curses.h: 
    6568 
    66 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    67  
    6869mb_header.h: 
    6970 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-serial.Po

    r2061 r2084  
    11libgrub_a-serial.o: serial.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h serial.h term.h terminfo.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 serial.h term.h terminfo.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-stage2.Po

    r2061 r2084  
    11libgrub_a-stage2.o: stage2.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h term.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h term.h 
    1514 
    1615shared.h: 
     
    2827/usr/include/features.h: 
    2928 
     29/usr/include/bits/predefs.h: 
     30 
    3031/usr/include/sys/cdefs.h: 
    3132 
     
    3637/usr/include/gnu/stubs-32.h: 
    3738 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     39/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3940 
    4041/usr/include/bits/types.h: 
     
    4849/usr/include/wchar.h: 
    4950 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     51/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5152 
    5253/usr/include/bits/stdio_lim.h: 
     
    5859/usr/include/bits/stdio2.h: 
    5960 
     61/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     62 
    6063/usr/include/unctrl.h: 
    6164 
    6265/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6566 
    6667mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-terminfo.Po

    r2061 r2084  
    11libgrub_a-terminfo.o: terminfo.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h terminfo.h tparm.h serial.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 terminfo.h tparm.h serial.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-tparm.Po

    r2061 r2084  
    11libgrub_a-tparm.o: tparm.c shared.h ../config.h ../stage1/stage1.h \ 
    2   /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
    3   /usr/include/features.h /usr/include/sys/cdefs.h \ 
    4   /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 
    5   /usr/include/gnu/stubs-32.h \ 
    6   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h \ 
    7   /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
    8   /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
    9   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h \ 
    10   /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
    11   /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
    12   /usr/include/unctrl.h /usr/include/curses.h \ 
    13   /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h mb_header.h \ 
    14   mb_info.h tparm.h 
     2 /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/stdio.h \ 
     3 /usr/include/features.h /usr/include/bits/predefs.h \ 
     4 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
     5 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 
     6 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h \ 
     7 /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 
     8 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 
     9 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \ 
     10 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 
     11 /usr/include/bits/stdio.h /usr/include/bits/stdio2.h \ 
     12 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h \ 
     13 /usr/include/unctrl.h /usr/include/curses.h mb_header.h mb_info.h \ 
     14 tparm.h 
    1515 
    1616shared.h: 
     
    2828/usr/include/features.h: 
    2929 
     30/usr/include/bits/predefs.h: 
     31 
    3032/usr/include/sys/cdefs.h: 
    3133 
     
    3638/usr/include/gnu/stubs-32.h: 
    3739 
    38 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stddef.h: 
     40/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h: 
    3941 
    4042/usr/include/bits/types.h: 
     
    4850/usr/include/wchar.h: 
    4951 
    50 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdarg.h: 
     52/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h: 
    5153 
    5254/usr/include/bits/stdio_lim.h: 
     
    5860/usr/include/bits/stdio2.h: 
    5961 
     62/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 
     63 
    6064/usr/include/unctrl.h: 
    6165 
    6266/usr/include/curses.h: 
    63  
    64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h: 
    6567 
    6668mb_header.h: 
  • Whitix/branches/netchannel/user/libc/Makefile

    r910 r2084  
    1111        $(MAKE) -C rtl 
    1212        gcc -m32 -shared -nostdlib -fno-stack-protector -L../posix -lpthread \ 
    13                  -o libstdc.so init/crt_begin.o init/crt_end.o ctype/*.o errno/*.o rtl/*.o stdio/*.o stdlib/*.o assert/*.o string/*.o setjmp/*.o 
     13                 -o libstdc.so init/crt_begin.o init/crt_end.o rtl/*.o ctype/*.o errno/*.o stdio/*.o stdlib/*.o assert/*.o string/*.o setjmp/*.o 
    1414        gcc -m32 -shared -nostdlib -fno-stack-protector -o libm.so init/crt_begin.o init/crt_end.o math/*.o 
    1515 
  • Whitix/branches/netchannel/user/libc/assert/assert.c

    r608 r2084  
    33#include <stdlib.h> 
    44 
    5 void DoAssert(char* fileName,int line) 
     5void DoAssert(char* condition, char* fileName,int line) 
    66{ 
    7         printf("A program failure occured in the source file %s on line %d", 
    8                 fileName,line); 
     7        printf("assert failure: '%s', line %d in file %s\n", 
     8                condition, line, fileName); 
    99                 
    1010        exit(1); 
  • Whitix/branches/netchannel/user/libc/include/assert.h

    r608 r2084  
    66#else 
    77#define assert(condition) \ 
    8         if (!(condition)) DoAssert(__FILE__,__LINE__); 
     8        if (!(condition)) DoAssert(#condition, __FILE__,__LINE__); 
    99#endif 
    1010 
    11 void DoAssert(char* fileName,int line); 
     11void DoAssert(char* condition, char* fileName,int line); 
    1212 
    1313#endif 
  • Whitix/branches/netchannel/user/libc/include/syscalls.h

    r1370 r2084  
    4242#define _SYS_STAT_CHAR                  32 
    4343 
     44struct PollItem 
     45{ 
     46        int fd; 
     47        short events; 
     48        short revents; 
     49}; 
     50 
    4451/* Constant for SysMemoryMap */ 
    4552#define _SYS_MMAP_PRIVATE       0x00000000 
  • Whitix/branches/netchannel/user/libc/include/sysdefs.h

    r2061 r2084  
    8080SYSCALL(58,int,SysIoAccess,4,(int on)); 
    8181 
    82 SYSCALL(59, int, SysChannelCreate, 16, (int family, void* src, void* dest, int flags)); 
     82SYSCALL(59, int, SysChannelCreate, 16, (int family, void* src, void* dest, void* 
     83                        options)); 
    8384SYSCALL(60, int, SysChannelControl, 12, (int fd, unsigned long code, void* data)); 
  • Whitix/branches/netchannel/user/libc/string/str.c

    r1380 r2084  
    541541        long acc; 
    542542 
     543        printf("strtol\n"); 
     544 
    543545        do{ 
    544546                c=*s++; 
  • Whitix/branches/netchannel/user/linker/Makefile

    r910 r2084  
    77### Configurables ### 
    88 
    9 OBJS = hash.o load_lib.o main.o relocate.o resolve.o 
     9OBJS = hash.o load_lib.o main.o relocate.o resolve.o array.o 
    1010LINKER_LDFLAGS =-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,relo -Wl,-e,_start -Wl,-z,now \ 
    1111         -Wl,-Bsymbolic -Wl,--export-dynamic -Wl,--sort-common -Wl,--discard-locals -Wl,--discard-all -Wl,--no-undefined 
     
    1919        $(CC) $(BASE_CFLAGS) -c $*.S -o $*.o 
    2020 
    21 liblinker.so: main.o relocate.o resolve.o load_lib.o hash.o 
     21liblinker.so: $(OBJS) 
    2222        gcc $(BASE_LDFLAGS) $(LINKER_LDFLAGS) -shared $(OBJS) ../libc/rtl/syscall.o -o liblinker.so      
    2323 
  • Whitix/branches/netchannel/user/linker/elf.h

    r1370 r2084  
    88#define INIT_RELOCS_DONE        1 
    99#define INIT_JMP_RELOCS_DONE    2 
     10#define INIT_CALLED_INIT_FUNCS  4 
     11#define INIT_CALLED_FINI_FUNCS  8 
    1012 
    1113typedef unsigned long   Elf_Addr; 
  • Whitix/branches/netchannel/user/linker/load_lib.c

    r1408 r2084  
    293293        return entry; 
    294294} 
     295 
  • Whitix/branches/netchannel/user/linker/main.c

    r1408 r2084  
    55int dummy; 
    66 
    7 static unsigned long __attribute((used)) LinkerMain(int argc,char** argv) 
     7static unsigned long __attribute((used)) LinkerMain(int argc, char** argv) 
    88{ 
    99        unsigned long* args=((unsigned long*)&argv[0]); 
     
    1212        struct ElfDyn* dynEntries; 
    1313        struct ElfResolve resolve; 
     14        struct ElfResolve* entry; 
    1415        int i; 
    1516 
     
    3233                resolve.loadAddr=GetElfLoadAddress(); 
    3334         
    34         dynEntries=(struct ElfDyn*)(ElfGetDynamic()+resolve.loadAddr); 
     35        dynEntries = (struct ElfDyn*)(ElfGetDynamic()+resolve.loadAddr); 
    3536 
    3637        ElfParseDynInfo(dynEntries, resolve.dynamicInfo, resolve.loadAddr); 
  • Whitix/branches/netchannel/user/linker/relocate.c

    r1370 r2084  
    353353                DlFixupSymbols(symbolTables); 
    354354 
     355        for (entry=loadedModules; entry; entry=entry->next) 
     356        { 
     357                if (entry->initFlags & INIT_CALLED_INIT_FUNCS) 
     358                        continue; 
     359 
     360                entry->initFlags |= INIT_CALLED_INIT_FUNCS; 
     361 
     362                if (entry->dynamicInfo[DT_INIT]) 
     363                { 
     364                        void (*elfFunc)(void); 
     365                        elfFunc = (void 
     366                                        (*)(void))(entry->loadAddr+entry->dynamicInfo[DT_INIT]); 
     367 
     368                        elfFunc(); 
     369                } 
     370 
     371                DlRunInitArray(entry); 
     372        } 
     373 
    355374        return 0; 
    356375} 
  • Whitix/branches/netchannel/user/net/Makefile

    r2061 r2084  
    11CFLAGS = -ffreestanding -fno-builtin -I../libc/include -I../sdk/include \ 
     2        -I../posix/include \ 
    23        -fno-stack-protector -m32 -Wall -nostdinc 
    34 
    4 OBJS = dhcp.o ping.o dns.o 
     5OBJS = dhcp.o ping.o dns.o ifconfig.o telnet.o httpd.o 
    56 
    67.c.o: 
     
    89 
    910build: $(OBJS) 
     11        gcc -m32 -nostdlib -L../libc -L../posix -L../sdk/libs ../libc/init/init.o dhcp.o -lstdc -lnetwork -lpthread -Wl,-I/System/Runtime/liblinker.so -o dhcp -lnetwork  
    1012        gcc -m32 -nostdlib -L../libc -L../posix -L../sdk/libs \ 
    11         ../libc/init/init.o dhcp.o -lstdc -lpthread -Wl,-I/System/Runtime/liblinker.so -o dhcp -lnetwork 
     13        ../libc/init/init.o ping.o -lstdc -lpthread \ 
     14        -Wl,-I/System/Runtime/liblinker.so -o ping -lnetwork  
    1215        gcc -m32 -nostdlib -L../libc -L../posix -L../sdk/libs \ 
    13         ../libc/init/init.o ping.o -lstdc -lpthread -Wl,-I/System/Runtime/liblinker.so -o ping -lnetwork 
     16        ../libc/init/init.o httpd.o -lstdc -lposix -lpthread \ 
     17        -Wl,-I/System/Runtime/liblinker.so -o httpd -lnetwork  
    1418        gcc -m32 -nostdlib -L../libc -L../posix -L../sdk/libs \ 
    15         ../libc/init/init.o dns.o -lstdc -lpthread -Wl,-I/System/Runtime/liblinker.so -o dns -lnetwork 
     19        ../libc/init/init.o dns.o -lstdc -lpthread \ 
     20        -Wl,-I/System/Runtime/liblinker.so -o dns -lnetwork  
     21        gcc -m32 -nostdlib -L../libc -L../posix ../libc/init/init.o -lstdc -lpthread -Wl,-I/System/Runtime/liblinker.so ifconfig.o -o ifconfig 
     22        gcc -m32 -nostdlib -L../libc -L../posix -L../sdk/libs ../libc/init/init.o \ 
     23        -lstdc -lpthread -Wl,-I/System/Runtime/liblinker.so telnet.o -o telnet \ 
     24        -lnetwork  
    1625         
    1726clean: 
     
    2029 
    2130install: 
    22         cp dhcp ping dns ../../CdRoot/Applications 
     31        cp dhcp ping dns telnet chan_test httpd ../../CdRoot/Applications 
  • Whitix/branches/netchannel/user/net/dhcp.c

    r2061 r2084  
    33#include <net/network.h> 
    44#include <net/byteorder.h> 
    5  
    6 #define CHN_FAMILY_IP           0 
     5#include <net/channels.h> 
     6#include <net/ipv4.h> 
     7#include <net/udp.h> 
    78 
    89#define MACHINE_NAME    "WhitixMachine" 
     
    1112#define DHCP_BOOT_REPLY         2 
    1213 
     14#define DHCP_PORT_SOURCE        68 
     15#define DHCP_PORT_DEST          67 
     16 
     17#define CHAN_IGNORE_ADDRESSES   1 
     18 
    1319/* TODO: Move to sdk/network. */ 
    1420 
    1521typedef unsigned long DWORD; 
    1622typedef unsigned short WORD; 
     23 
     24/* Globals */ 
     25char* infName; 
     26DWORD subnetMask; 
     27DWORD router; 
    1728 
    1829struct ChannelAddr 
     
    6576} 
    6677 
     78void EthInfUp() 
     79{ 
     80        char infUp[2048]; 
     81        int running = 1; 
     82 
     83        snprintf(infUp, 2048, "/Devices/Network/%s/running", infName); 
     84 
     85        /* Bring up interface */ 
     86 
     87        if (SysConfWrite(infUp, &running, sizeof(int))) 
     88                DhcpError("Could not bring up interface"); 
     89} 
     90 
    6791void EthGetMacAddress() 
    6892{ 
    69         /* Open interface. */ 
    70         if (SysConfRead("/Devices/Network/Ethernet/macAddress", sourceAddr, 6)) 
     93        char infAddress[2048]; 
     94         
     95        snprintf(infAddress, 2048, "/Devices/Network/%s/macAddress", infName); 
     96         
     97        if (SysConfRead(infAddress, sourceAddr, 6) < 6) 
    7198                DhcpError("Could not get MAC address of network card"); 
    7299} 
     
    99126        memset(udpHeader, 0, sizeof(struct UdpHeader)); 
    100127 
    101         udpHeader->sourcePort=HostToNetShort(68); 
    102         udpHeader->destPort=HostToNetShort(67); 
     128        udpHeader->sourcePort = HostToNetShort(DHCP_PORT_SOURCE); 
     129        udpHeader->destPort = HostToNetShort(DHCP_PORT_DEST); 
    103130 
    104131        return (sizeof(struct EthHeader)+sizeof(struct IpHeader)+sizeof(struct UdpHeader)); 
     
    261288        udpHeader=(struct UdpHeader*)(buf+sizeof(struct IpHeader)); 
    262289 
    263         if (HostToNetShort(udpHeader->destPort) != 68) 
     290        if (HostToNetShort(udpHeader->destPort) != DHCP_PORT_SOURCE) 
    264291                return 1; 
    265292 
     
    277304        while (dhcpOption->code != 0xFF) 
    278305        { 
    279                 if (dhcpOption->code == 54) 
     306                switch (dhcpOption->code) 
    280307                { 
    281                         memcpy(&serverIp, dhcpOption->data, 4); 
    282                         break; 
     308                        case 1: 
     309                                subnetMask = NetToHostLong(*(DWORD*)(dhcpOption->data)); 
     310                                break; 
     311                                 
     312                        case 3: 
     313                                router = NetToHostLong(*(DWORD*)(dhcpOption->data)); 
     314                                break; 
     315                                 
     316                        case 54: 
     317                                memcpy(&serverIp, dhcpOption->data, 4); 
     318                                break; 
    283319                } 
    284320 
     
    290326} 
    291327 
    292 int DhcpPacketSend(int chnFd, char* buf, int (*packetConstructor)(char*)) 
    293 { 
    294         int i=4; 
     328ChanRecvBuffer* DhcpPacketSend(Channel* channel, int (*ctor)(char*)) 
     329{ 
     330        int i; 
    295331        int length; 
    296         unsigned long startSeconds; 
    297         struct Time time; 
    298  
    299         while (i < 128) 
    300         { 
    301                 length=packetConstructor(buf); 
    302  
    303                 /* TODO: Temp? */ 
    304                 SysWrite(chnFd, buf, length); 
    305  
    306                 /* Now wait 'i' seconds for a packet. */ 
    307                 SysGetTime(&time); 
    308                 startSeconds=time.seconds; 
    309  
    310                 /* And check for receive. */ 
    311                 do 
    312                 { 
    313                         int ret = SysRead(chnFd, buf, 1024); 
    314  
    315                         if (ret > 0) 
    316                         { 
    317                                 if (!DhcpPacketCheck(buf)) 
    318                                         break; 
    319                         } 
    320  
    321                         SysGetTime(&time); 
    322  
    323                 }while((time.seconds - startSeconds) < i); 
    324  
    325                 if (!DhcpPacketCheck(buf)) 
     332        int ret; 
     333        ChanSendBuffer* buffer = NULL; 
     334        ChanRecvBuffer* resp = NULL; 
     335        char* buf; 
     336 
     337        for (i = 4; i < 128; i*=2) 
     338        { 
     339                buffer = ChanSendBufferAlloc(channel, &buf); 
     340                buf -= ChanHwHeaderBytes(channel); 
     341 
     342                if (!buffer || !buf) 
     343                        DhcpError("Could not allocate buffer for sending"); 
     344 
     345                length = ctor(buf); 
     346 
     347                if (ChanBufferSend(channel, buffer, length - ChanHwHeaderBytes(channel)) < length) 
     348                        DhcpError("Could not send DHCP packet"); 
     349 
     350                length = ChanBufferRecv(channel, &resp, &buf, i*1000); 
     351 
     352                if (length <= 0) 
     353                        continue; 
     354 
     355                ret = DhcpPacketCheck(buf); 
     356 
     357                if (!ret) 
    326358                        break; 
    327  
    328                 i *= 2; 
    329359        } 
    330360 
    331361        if (i == 128) 
    332                 return 1; 
    333  
    334         return 0; 
    335 } 
     362        { 
     363                printf("DHCP: timed out waiting for reply\n"); 
     364                return NULL; 
     365        } 
     366 
     367        return resp; 
     368} 
     369 
     370struct RouteEntry 
     371{        
     372        DWORD destination; 
     373        DWORD gateway; 
     374        DWORD mask; 
     375        int flags; 
     376        char* device; 
     377}; 
     378 
     379void RouteAdd(struct RouteEntry* entry) 
     380{ 
     381        if (SysConfWrite("/Network/Routes/addRoute", entry, sizeof(struct RouteEntry)) < (int)sizeof(struct RouteEntry)) 
     382                DhcpError("Could not add route"); 
     383} 
     384 
     385void RoutePrint(struct RouteEntry* entry) 
     386{ 
     387        printf("ROUTE: dest = %#X, gateway = %#X, mask = %#X, device = %s\n", 
     388                entry->destination, entry->gateway, entry->mask, entry->device); 
     389} 
     390 
     391void DhcpRouteAdd() 
     392{ 
     393        struct RouteEntry local= 
     394        { 
     395                destination: (address & subnetMask), 
     396                gateway: 0, 
     397                mask: subnetMask, 
     398                flags: 0, 
     399                device: infName, 
     400        }; 
     401         
     402        struct RouteEntry gateway= 
     403        { 
     404                destination: 0, 
     405                gateway:        router, 
     406                mask:           0, 
     407                flags:          0, 
     408                device:         infName 
     409        }; 
     410         
     411        RoutePrint(&local); 
     412        RoutePrint(&gateway); 
     413         
     414        RouteAdd(&local); 
     415        RouteAdd(&gateway); 
     416} 
     417 
     418#define CHANNEL_SET_INTERFACE           0x02 
    336419 
    337420int main(int argc, char** argv[]) 
     
    340423        char buf[1024]; 
    341424        struct Time currTime; 
     425        ChannelOptions options; 
     426 
     427        memset(&options, 0, sizeof(ChannelOptions)); 
     428        options.flags = CHAN_IGNORE_ADDRESSES; 
    342429 
    343430        progName = argv[0]; 
    344  
     431         
     432        /* Check we have an interface name. */ 
     433        if (argc < 2) 
     434                DhcpError("You must supply the name of the interface"); 
     435 
     436        infName = argv[1]; 
     437 
     438        if (strcasestr(infName, "Loopback")) 
     439                DhcpError("DHCP does not work on the loopback interface"); 
     440 
     441        EthInfUp(); 
    345442        EthGetMacAddress(sourceAddr); 
    346443 
     
    349446        tid = currTime.seconds; 
    350447         
    351         struct IpEndPoint src={.address = 0, .port = 68, .protocol = 17}, dest = {.address = 0, .port = 67, .protocol = 17}; 
    352  
    353         chnFd=SysChannelCreate(0x01, &src, &dest, 0x01); 
    354  
    355         if (chnFd < 0) 
     448        struct Ipv4EndPoint src={.address = 0, .port = DHCP_PORT_SOURCE}, dest = {.address = 0, 
     449                .port = DHCP_PORT_DEST}; 
     450 
     451        /* Map send and recv pages */ 
     452        Channel* channel = ChannelCreate(CHAN_MAKE_TYPE(CHAN_FAMILY_IP, 
     453                                CHAN_TYPE_UDP), &src, &dest, &options); 
     454        ChanRecvBuffer* buffer; 
     455 
     456        if (!channel) 
    356457                DhcpError("Could not create network channel"); 
    357458 
    358         /* Set socket as non-blocking; we'll do our own waiting. */ 
     459        if (ChannelBindToDevice(channel, infName) < 0) 
     460                DhcpError("Could not bind channel to device"); 
    359461 
    360462        printf("dhcp: Sending DHCPDISCOVER packet\n"); 
    361         if (DhcpPacketSend(chnFd, buf, DhcpConstructDiscover)) 
     463 
     464        buffer = DhcpPacketSend(channel, DhcpConstructDiscover); 
     465        if (!buffer) 
    362466                DhcpError("No reply to DHCPDISCOVER packet"); 
    363          
     467 
    364468        printf("dhcp: Received DHCPOFFER packet\n"); 
    365469        /* Parse the DHCPOFFER packet */ 
    366         DhcpParseOffer(buf); 
     470        DhcpParseOffer(ChanRecvBufferData(channel, buffer)); 
     471        ChanRecvBuffFree(channel, buffer); 
    367472 
    368473        printf("dhcp: Sending DHCPREQUEST packet\n"); 
    369         if (DhcpPacketSend(chnFd, buf, DhcpConstructRequest)) 
     474        buffer = DhcpPacketSend(channel, DhcpConstructRequest); 
     475        if (!buffer) 
    370476                DhcpError("No reply to DHCPREQUEST packet"); 
    371477 
    372         /* Check lease time. Process DHCP ACK packet. */ 
    373  
    374         SysClose(chnFd); 
     478        /* TODO: Check lease time. Process DHCP ACK packet. */ 
     479        ChanRecvBuffFree(channel, buffer); 
     480 
     481        ChannelFree(channel); 
    375482 
    376483        printf("dhcp: New interface address is: %u.%u.%u.%u\n", 
     
    378485 
    379486        /* Privileged configuration variable. */ 
    380         if (SysConfWrite("/Devices/Network/Ethernet0/netAddress", &address, 4)) 
     487        if (SysConfWrite("/Devices/Network/Ethernet0/netAddress", &address, 4) < 4) 
    381488        { 
    382489                DhcpError("Could not set network address of interface"); 
    383490        } 
     491         
     492        DhcpRouteAdd(); 
     493         
     494/* 
     495        if (SysConfWrite("/Devices/Network/Ethernet0/flags", &flags, 4)) 
     496        { 
     497                DhcpError("Could not bring the network interface up.\n"); 
     498        } 
     499*/ 
    384500 
    385501        return 0; 
  • Whitix/branches/netchannel/user/net/dns.c

    r2073 r2084  
    1212{ 
    1313        printf("%s: fatal error. %s.\n", progName, message); 
    14         SysExit(0); 
     14        exit(0); 
    1515} 
    1616 
     
    2020        char buf[1024]; 
    2121        char name[64]; 
    22         unsigned int length; 
     22        int length; 
    2323        struct DnsHeader* header; 
    2424        Socket* dnsSocket; 
    2525        struct DnsState state; 
    2626        ulong address; 
     27        int ret, index; 
    2728 
    2829        progName = argv[0]; 
     
    3637        struct Ipv4EndPoint dnsAddr; 
    3738 
     39        /* TODO: Get DNS server address from somewhere. */ 
    3840        dnsAddr.address = 0xC0A801FE; 
    3941        dnsAddr.port = 53; 
    4042         
    4143        dnsSocket = UdpSocketCreate(); 
     44 
     45        if (!dnsSocket) 
     46                DnsError("Could not create UDP socket"); 
     47 
     48        DnsStartHeader(&state, buf, 1024); 
     49        DnsAddQuery(&state, argv[1], DNS_QUERY_A); 
     50        length = DnsFinishHeader(&state); 
     51 
     52        ret = SocketSendTo(dnsSocket, buf, length, 0, &dnsAddr); 
     53 
     54        if (ret < length) 
     55                DnsError("could not send DNS request packet"); 
    4256         
    43         DnsStartHeader(&state, buf, 1024); 
    44          
    45         DnsAddQuery(&state, argv[1], DNS_QUERY_A); 
    46  
    47         length = DnsFinishHeader(&state); 
    48          
    49         if (SocketSendTo(dnsSocket, buf, length, 0, &dnsAddr) < length) 
    50                 DnsError("could not send DNS request packet"); 
    51  
    5257        length = 1024; 
    5358 
     
    5661 
    5762        DnsStartReply(&state, buf, length); 
     63 
     64        strncpy(name, argv[1], sizeof(name)); 
    5865         
    59         if (DnsGetCanonicalName(&state, name, 64)) 
    60                 printf("%s is an alias for '%s'\n", argv[1], name); 
    61                  
    62         DnsGetIpAddress(&state, &address); 
    63          
    64         printf("Address = %u.%u.%u.%u\n", address >> 24, (address >> 16) & 0xFF, (address >> 8) 
     66        if ((index = DnsGetCanonicalName(&state, name, 64, 0)) >= 0) 
     67        { 
     68                char prevName[64]; 
     69                strncpy(prevName, argv[1], sizeof(prevName)); 
     70 
     71                do 
     72                { 
     73                        printf("%s is an alias for %s\n", prevName, name); 
     74                        strncpy(prevName, name, sizeof(prevName)); 
     75                } while (index = DnsGetCanonicalName(&state, name, 64, index+1) > 0); 
     76        } 
     77 
     78        index = 0; 
     79 
     80        while ((index = DnsGetIpAddresses(&state, &address, index)) >= 0) 
     81        { 
     82                printf("%s has address %u.%u.%u.%u\n", name, address >> 24, (address >> 16) & 0xFF, (address >> 8) 
    6583                & 0xFF, address & 0xFF); 
     84                index++; 
     85        } 
    6686 
    6787        SocketClose(dnsSocket); 
  • Whitix/branches/netchannel/user/net/ping.c

    r2061 r2084  
    55#include <net/dns.h> 
    66#include <net/udp.h> 
     7#include <net/ipv4.h> 
     8 
     9struct Ipv4EndPoint dest; 
    710 
    811void PingError(char* s) 
     
    1215} 
    1316 
     17ulong WrapSum(ulong sum) 
     18{ 
     19        sum=~sum & 0xFFFF; 
     20        return HostToNetShort(sum); 
     21} 
     22 
     23int IcmpSendEcho(Socket* socket, unsigned short identifier, unsigned short sequence) 
     24{ 
     25        /* Build header etc. */ 
     26        char data[64]; 
     27        struct IcmpHeader* header = (struct IcmpHeader*)data; 
     28         
     29        memset(data, 0, 64); 
     30         
     31        header->message = 8; 
     32        header->identifier = identifier; 
     33        header->sequence = HostToNetShort(sequence); 
     34        header->checkSum = WrapSum(IpCheckSum(data, 64, 0)); 
     35         
     36        return SocketSendTo(socket, &data, 64, 0, &dest); 
     37} 
     38 
     39int IcmpGetReply(Socket* socket, struct IcmpHeader* header) 
     40{ 
     41        char buffer[64]; 
     42        struct Ipv4EndPoint from; 
     43        int len; 
     44         
     45        len = SocketRecvFrom(socket, buffer, 64, 0, &from); 
     46 
     47        if (len > 0) 
     48                memcpy(header, buffer, sizeof(struct IcmpHeader)); 
     49         
     50        return len; 
     51} 
     52 
    1453int main(int argc, char* argv[]) 
    1554{ 
    1655        char* address; 
    17 //      struct Ipv4EndPoint dest; 
    1856        Socket* icmpSocket; 
    19 //      struct IcmpReply reply; 
     57        struct IcmpHeader reply; 
    2058        int seq; 
     59        int length; 
     60        unsigned short ident = 0xFFFF - SysGetCurrentProcessId(); 
    2161         
    2262        if (argc < 2) 
     
    2565        address = argv[1]; 
    2666         
    27 //      if (DnsGetHostByName(address, &dest.address)) 
    28 //              PingError("not a valid IP or host name");                
    29          
    30 #if 0 
     67        if (DnsGetHostByName(address, &dest.address)) 
     68                if (Ipv4StringToAddr(address, &dest.address)) 
     69                        return 1; 
     70 
     71        if (dest.address == 0xFFFFFFFF) 
     72                PingError("cannot ping the broadcast address"); 
     73 
    3174        icmpSocket = IcmpSocketCreate(); 
     75 
     76        if (!icmpSocket) 
     77                PingError("could not create ICMP socket"); 
    3278         
    3379        if (SocketConnect(icmpSocket, &dest)) 
    3480                PingError("could not connect to destination"); 
    35          
     81 
     82        length = 64 - 8; 
     83 
     84        printf("PING %s with %d bytes of data\n", argv[1], length); 
     85 
    3686        for (seq = 0; seq < 4; seq++) 
    3787        { 
     
    4090                SysGetTime(&time); 
    4191                 
    42                 IcmpSendEcho(icmpSocket, 0xDEAD, 0x1, NULL); 
    43          
    44                 if (IcmpGetReply(icmpSocket, &reply)) 
     92                if (IcmpSendEcho(icmpSocket, ident, seq) < 0) 
     93                        PingError("could not send ping packet"); 
     94 
     95                length = IcmpGetReply(icmpSocket, &reply); 
     96 
     97                if (length <= 0) 
    4598                { 
    46                         printf("icmp: timed out\n"); 
    47                 }else{ 
    48                         SysGetTime(&newTime); 
    49                          
    50                         /* print time taken. */ 
     99                        printf("Could not receive reply for %d\n", seq); 
     100                        continue; 
    51101                } 
     102                 
     103                printf("%d bytes from %s: sequence %d\n", length, argv[1], 
     104                                NetToHostShort(reply.sequence)); 
    52105        } 
    53106         
    54107        SocketClose(icmpSocket); 
    55 #endif 
    56108         
    57109        return 0; 
  • Whitix/branches/netchannel/user/posix/Makefile

    r1374 r2084  
    1515        $(MAKE) -C process 
    1616        $(MAKE) -C opt 
     17        $(MAKE) -C memory 
    1718        $(MAKE) -C socket 
    18         $(MAKE) -C memory 
    1919        $(MAKE) -C strings 
    20         gcc -nodefaultlibs -nostdlib -m32 -shared -L../libc -lstdc dir/*.o file/*.o wait/*.o signal/*.o net/*.o time/*.o tty/*.o locale/*.o conf/*.o user/*.o process/*.o opt/*.o socket/*.o memory/*.o strings/*.o -o libposix.so 
     20        gcc -nodefaultlibs -nostdlib -m32 -shared -L../libc -lstdc dir/*.o file/*.o wait/*.o signal/*.o net/*.o time/*.o tty/*.o locale/*.o     conf/*.o user/*.o process/*.o opt/*.o memory/*.o strings/*.o socket/*.o -o libposix.so 
    2121 
    2222pthreadlib: 
     
    4444        $(MAKE) -C process clean 
    4545        $(MAKE) -C opt clean 
    46         $(MAKE) -C socket clean 
    4746        $(MAKE) -C memory clean 
    4847        $(MAKE) -C strings clean 
     48        $(MAKE) -C socket clean 
  • Whitix/branches/netchannel/user/posix/file/Makefile

    r572 r2084  
    11include ../make.inc 
    22 
    3 OBJS = file.o fs.o 
     3OBJS = file.o fs.o internal.o 
    44 
    55build: $(OBJS) 
  • Whitix/branches/netchannel/user/posix/include/arpa/inet.h

    r608 r2084  
    1 #ifndef INET_H 
    2 #define INET_H 
     1#ifndef ARPA_INET_H 
     2#define ARPA_INET_H 
     3 
     4#include <netinet/in.h> 
     5 
     6uint32_t htonl(uint32_t hostlong); 
    37 
    48#endif 
  • Whitix/branches/netchannel/user/posix/include/netdb.h

    r608 r2084  
    2626#define NO_ADDRESS              0x10 
    2727 
     28#define PF_INET         0x00 
    2829#define PF_UNIX         0x01 
    2930 
  • Whitix/branches/netchannel/user/posix/include/netinet/in.h

    r608 r2084  
    1 #ifndef IN_H 
    2 #define IN_H 
     1#ifndef NETINET_IN_H 
     2#define NETINET_IN_H 
    33 
    44struct in_addr 
     
    3434 
    3535#define INADDR_LOOPBACK         0x7F000001 
     36#define INADDR_ANY                      0xFFFFFFFF 
    3637 
    3738struct ip_mreqn 
  • Whitix/branches/netchannel/user/posix/include/sys/socket.h

    r1374 r2084  
    77 
    88#define AF_UNIX                 0x00 
     9#define AF_INET                 0x01 
    910 
    1011/* Not yet supported. */ 
    11 #define AF_INET                 0x01 
    1212#define AF_SNA                  0x02 
    1313#define AF_DECnet               0x03 
     
    5353#define SOCK_RAW                0x01 
    5454#define SOCK_STREAM             0x02 
    55 #define SOCK_DGRAM              0x04 
    56 #define SOCK_RDM                0x08 
    57 #define SOCK_SEQPACKET  0x10 
     55#define SOCK_DGRAM              0x03 
     56#define SOCK_RDM                0x04 
     57#define SOCK_SEQPACKET  0x05 
    5858 
    5959#define MSG_OOB         0x01 
  • Whitix/branches/netchannel/user/posix/include/sys/types.h

    r1374 r2084  
    2626typedef int     intptr_t; 
    2727 
     28#ifndef DEFINED_USHORT 
     29#define DEFINED_USHORT 
    2830typedef unsigned short ushort; 
     31#endif 
     32 
    2933typedef unsigned long u_long; 
    3034 
  • Whitix/branches/netchannel/user/posix/socket/socket.c

    r2061 r2084  
    33#include <sys/socket.h> 
    44 
     5#include <net/tcp.h> 
     6 
    57#include <syscalls.h> 
    68 
    7 #include <stdio.h> //TEMP 
     9#include <stdio.h> 
     10 
     11#include "../file/internal.h" 
     12 
     13/* POSIX file operations */ 
     14struct PosixFileType socketType = 
     15{ 
     16}; 
    817 
    918ssize_t send(int s, const void* buf, size_t len, int flags) 
    1019{ 
    11 #if 0 
    12         int ret=SysSocketSend(s, buf, len, flags); 
     20        struct PosixFile* file = PosixHandleToFile(s); 
     21        Socket* socket = (Socket*)PosixFilePriv(file); 
    1322 
    14         if (ret < 0) 
    15         { 
    16                 errno=-ret; 
    17                 return -1; 
    18         } 
    19  
    20         return ret; 
    21 #endif 
    22         return -1; 
     23        return SocketSend(socket, buf, len, flags); 
    2324} 
    2425 
    2526ssize_t recv(int s, void* buf, size_t len, int flags) 
    2627{ 
    27 #if 0 
    28         int ret=SysSocketReceive(s, buf, len, flags); 
     28        struct PosixFile* file = PosixHandleToFile(s); 
     29        Socket* socket = (Socket*)PosixFilePriv(file); 
    2930 
    30         if (ret < 0) 
    31         { 
    32                 errno=-ret; 
    33                 return -1; 
    34         } 
    35  
    36         return ret; 
    37 #endif 
    38         return -1; 
     31        return SocketRecv(socket, buf, len, flags); 
    3932} 
    4033 
     
    5750int socket(int domain, int type, int protocol) 
    5851{ 
    59 //      return SysSocketCreate(domain, type, protocol); 
     52        struct PosixFile* file = PosixFileAlloc(sizeof(Socket), &socketType); 
     53        Socket* socket = (Socket*)PosixFilePriv(file); 
     54        int err; 
     55 
     56        if (!file) 
     57        { 
     58                errno = ENOMEM; 
     59                return -1; 
     60        } 
     61 
     62        err = SocketCreate(socket, domain, type, protocol); 
     63 
     64        if (err) 
     65                goto err; 
     66 
     67        return PosixFileToHandle(file); 
     68 
     69err: 
     70        PosixFileFree(file); 
    6071        return -1; 
    6172} 
     
    6374int accept(int sockfd, struct sockaddr* addr, socklen_t *addrlen) 
    6475{ 
    65 #if 0 
    66         int ret=SysSocketAccept(sockfd, addr, addrlen); 
     76        struct PosixFile* file = PosixHandleToFile(sockfd); 
     77        Socket* socket = (Socket*)PosixFilePriv(file); 
     78        struct PosixFile* child = PosixFileAlloc(sizeof(Socket), &socketType); 
     79        Socket* childSocket = (Socket*)PosixFilePriv(child); 
     80        int err; 
    6781 
    68         if (ret < 0) 
    69         { 
    70                 errno=-ret; 
    71                 return -1; 
    72         } 
     82        err = SocketAccept(socket, childSocket, addr); 
    7383 
    74         return ret; 
    75 #endif 
     84        if (err) 
     85                goto err; 
     86 
     87        return PosixFileToHandle(child); 
     88 
     89err: 
     90        PosixFileFree(child); 
    7691        return -1; 
    7792} 
     
    7994int bind(int s, const struct sockaddr* my_addr, socklen_t addr_len) 
    8095{ 
    81 #if 0 
    82         return SysSocketBind(s, my_addr, addr_len); 
    83 #endif 
     96        struct PosixFile* file = PosixHandleToFile(s); 
     97        Socket* socket = (Socket*)PosixFilePriv(file); 
     98 
     99        return SocketBind(socket, my_addr); 
    84100} 
    85101 
    86102int shutdown(int s, int how) 
    87103{ 
    88 #if 0 
    89         return SysSocketClose(s); 
    90 #endif 
     104        return -1; 
    91105} 
    92106 
    93107int listen(int s, int backlog) 
    94108{ 
    95 #if 0 
    96         return SysSocketListen(s, backlog); 
    97 #endif 
     109        struct PosixFile* file = PosixHandleToFile(s); 
     110        Socket* socket = (Socket*)PosixFilePriv(file); 
     111 
     112        return SocketListen(socket, backlog); 
    98113} 
    99114 
     
    110125} 
    111126 
    112 short htons(short s) 
    113 { 
    114         printf("htons\n"); 
    115         return 0; 
    116 } 
    117  
    118 long htonl(long l) 
    119 { 
    120         printf("htonl\n"); 
    121         return 0; 
    122 } 
    123  
    124127int getsockopt(int s, int level, int optname, void* optval, socklen_t* optlen) 
    125128{ 
     
    128131} 
    129132 
     133short htons(short s) 
     134{ 
     135        unsigned char* p=(unsigned char*)&s; 
     136        return (p[0] << 8) | (p[1]); 
     137} 
     138 
     139long htonl(long l) 
     140{ 
     141        unsigned char* p=(unsigned char*)&l; 
     142        return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); 
     143} 
  • Whitix/branches/netchannel/user/sdk/Makefile

    r910 r2084  
    22        $(MAKE) -C console 
    33        $(MAKE) -C network 
    4         $(MAKE) -C thread 
    54        $(MAKE) -C file 
    65        $(MAKE) -C registry 
     
    1211        $(MAKE) -C console clean 
    1312        $(MAKE) -C network clean 
    14         $(MAKE) -C thread clean 
    1513        $(MAKE) -C file clean 
    1614        $(MAKE) -C registry clean 
  • Whitix/branches/netchannel/user/sdk/include/net/byteorder.h

    r2061 r2084  
    33 
    44unsigned short NetToHostShort(unsigned short num); 
     5unsigned long NetToHostLong(unsigned long num); 
    56 
    67#define HostToNetShort  NetToHostShort 
  • Whitix/branches/netchannel/user/sdk/include/net/channels.h

    r2069 r2084  
    22#define NET_CHANNELS_H 
    33 
     4#include <types.h> 
     5 
    46#define CHAN_FAMILY_IP  0x00 
    5  
    6 #define CHAN_LINK_MAX   14 
    7  
    87#define CHAN_MAKE_TYPE(family, type) (((family) << 16) | (type)) 
    98 
     9/* Keep this synchronised with the structure in include/net/channels.h */ 
     10typedef struct tagChannelOptions 
     11{ 
     12        unsigned int flags; 
     13        unsigned short sendPages; 
     14        unsigned short recvPages; 
     15}ChannelOptions; 
     16 
     17typedef struct tagChannelInfo 
     18{ 
     19        unsigned short numSendBuffers, numSendPages; 
     20    unsigned short numRecvBuffers, numRecvPages; 
     21    unsigned short sendHeaderBytes, recvHeaderBytes; /* Including sizes of 
     22                                                                                                                respective structures */ 
     23        unsigned short hwHeaderBytes; 
     24    unsigned short maxPacketSize; 
     25}ChannelInfo; 
     26 
     27typedef struct tagChannelAddr 
     28{ 
     29        char addr[20]; 
     30}ChannelAddr; 
     31 
     32/* Channel, lowest form of user-space abstraction. */ 
     33typedef struct tagChannel 
     34{ 
     35        int fd; 
     36        ChannelAddr src, dest; 
     37        char* baseAddress; 
     38        ChannelInfo* info; 
     39}Channel; 
     40 
     41Channel* ChannelCreate(int family, void* src, void* dest, ChannelOptions* 
     42                options); 
     43 
     44/* Control functions */ 
     45#define CHANNEL_SET_FLAGS               0x01 
     46#define CHANNEL_SET_INTERFACE   0x02 
     47 
     48/* Opaque data types */ 
     49typedef char ChanSendBuffer; 
     50typedef char ChanRecvBuffer; 
     51 
     52/* Usercode functions - use the (simple) wrappers below. */ 
     53typedef int (*ChanAllocCall)(char*); 
     54extern ChanAllocCall uChanSendBufferAlloc; 
     55typedef void* (*ChanBuffGet)(char*, int); 
     56extern ChanBuffGet uChanSendBuffGet; 
     57extern ChanBuffGet uChanRecvBuffGet; 
     58 
     59typedef int (*ChanBuffLen)(char*); 
     60extern ChanBuffLen uChanRecvBuffLen; 
     61 
     62typedef void (*ChanBuffSetPriv)(char*, void*); 
     63extern ChanBuffSetPriv uChanRecvBuffSetPriv; 
     64 
     65typedef void* (*pChanGetInfo)(char*); 
     66extern pChanGetInfo uChanRecvBuffGetPriv; 
     67extern pChanGetInfo uChanGetInfo; 
     68 
     69typedef void (*pChanFree)(char*, char*); 
     70extern pChanFree uChanRecvBuffFree; 
     71 
     72typedef unsigned short (*pChanGetRead)(char*); 
     73extern pChanGetRead uChanRecvBuffGetRead; 
     74 
     75typedef void (*pChanAddRead)(char*, char*, unsigned short); 
     76extern pChanAddRead uChanRecvBuffAddRead; 
     77 
     78static inline int ChanSendHeaderBytes(Channel* channel) 
     79{ 
     80        return channel->info->sendHeaderBytes; 
     81} 
     82 
     83static inline int ChanRecvHeaderBytes(Channel* channel) 
     84{ 
     85        return channel->info->recvHeaderBytes; 
     86} 
     87 
     88static inline int ChanHwHeaderBytes(Channel* channel) 
     89{ 
     90        return channel->info->hwHeaderBytes; 
     91} 
     92 
     93static inline int ChanMaxPacketSize(Channel* channel) 
     94{ 
     95        return channel->info->maxPacketSize; 
     96} 
     97 
     98static inline void* ChanSendBufferData(Channel* channel, ChanSendBuffer* buffer) 
     99{ 
     100        return (void*)((char*)buffer + channel->info->sendHeaderBytes); 
     101} 
     102 
     103/* Wrapper around the usercode functions */ 
     104static inline ChanSendBuffer* ChanSendBufferAlloc(Channel* channel, char** data) 
     105{ 
     106        int i; 
     107        ChanSendBuffer* ret; 
     108         
     109        if (!data) 
     110                return (void*)0; 
     111 
     112        i = uChanSendBufferAlloc(channel->baseAddress); 
     113 
     114        if (i < 0) 
     115                return (void*)0; 
     116 
     117        ret = (ChanSendBuffer*)uChanSendBuffGet(channel->baseAddress, i); 
     118        *data = ChanSendBufferData(channel, ret); 
     119        return ret; 
     120} 
     121 
     122static inline int ChanSendPages(Channel* channel) 
     123{ 
     124        return channel->info->numSendPages; 
     125} 
     126 
     127static inline int ChanRecvPages(Channel* channel) 
     128{ 
     129        return channel->info->numRecvPages; 
     130} 
     131 
     132/* Get the first unread recv buffer. */ 
     133static inline void* ChanGetRecvBuffer(Channel* channel) 
     134{ 
     135        return uChanRecvBuffGet(channel->baseAddress, -1); 
     136} 
     137 
     138static inline void* ChanRecvBufferData(Channel* channel, ChanRecvBuffer* buffer) 
     139{ 
     140        return (void*)((char*)buffer + channel->info->recvHeaderBytes); 
     141} 
     142 
     143static inline int ChanRecvBufferLen(ChanRecvBuffer* buffer) 
     144{ 
     145        return uChanRecvBuffLen(buffer); 
     146} 
     147 
     148static inline void ChanRecvBuffSetPriv(ChanRecvBuffer* buffer, void* priv) 
     149{ 
     150        return uChanRecvBuffSetPriv(buffer, priv); 
     151} 
     152 
     153static inline void* ChanRecvBuffGetPriv(ChanRecvBuffer* buffer) 
     154{ 
     155        return uChanRecvBuffGetPriv(buffer); 
     156} 
     157 
     158static inline void ChanRecvBuffFree(Channel* channel, ChanRecvBuffer* buffer) 
     159{ 
     160        uChanRecvBuffFree(channel->baseAddress, buffer); 
     161} 
     162 
     163static inline void* ChanGetInfo(Channel* channel) 
     164{ 
     165        return uChanGetInfo(channel->baseAddress); 
     166} 
     167 
     168static inline unsigned short ChanRecvBuffGetRead(ChanRecvBuffer* buffer) 
     169{ 
     170        return uChanRecvBuffGetRead(buffer); 
     171} 
     172 
     173static inline void ChanRecvBuffAddRead(Channel* channel, ChanRecvBuffer* buffer, unsigned short 
     174                add) 
     175{ 
     176        uChanRecvBuffAddRead(channel->baseAddress, buffer, add); 
     177} 
     178 
     179/* I/O */ 
     180int ChanBufferSend(Channel* channel, ChanSendBuffer* buffer, int length); 
     181int ChanBufferRecv(Channel* channel, ChanRecvBuffer** buffer, char** data, int 
     182                timeout); 
     183 
    10184#endif 
  • Whitix/branches/netchannel/user/sdk/include/net/inet_raw.h

    r2061 r2084  
    22#define _NET_INET_RAW_H 
    33 
    4 #include <net/internet.h> 
    54#include <syscalls.h> 
    65 
     
    1817}__attribute__((packed)); 
    1918 
     19#define PROTOCOL_RAW_ICMP       1 
    2020#define PROTOCOL_RAW_UDP        17 
    2121 
  • Whitix/branches/netchannel/user/sdk/include/net/ipv4.h

    r2069 r2084  
    11#ifndef NET_IPV4_H 
    22#define NET_IPV4_H 
     3 
     4#include <types.h> 
     5 
     6/* Matches POSIX structure */ 
     7struct Ipv4Address 
     8{ 
     9        short family; 
     10        unsigned short port; 
     11        unsigned long address; 
     12}; 
    313 
    414struct Ipv4EndPoint 
     
    1020#define IPV4_BROADCAST          0xFFFFFFFF 
    1121 
     22struct IcmpHeader 
     23{ 
     24        uchar   message; 
     25        uchar   code; 
     26        ushort  checkSum; 
     27         
     28        union 
     29        { 
     30                ulong quench; 
     31                struct { ushort identifier, sequence; }; 
     32        }; 
     33}PACKED; 
     34 
    1235#endif 
  • Whitix/branches/netchannel/user/sdk/include/net/network.h

    r2061 r2084  
    66#include <types.h> 
    77#include <net/socket.h> 
    8 #include <net/internet.h> 
    98#include <net/local.h> 
    109#include <net/inet_raw.h> 
  • Whitix/branches/netchannel/user/sdk/include/net/socket.h

    r2061 r2084  
    22#define SOCKET_H 
    33 
     4#include <net/channels.h> 
    45#include <stdlib.h> 
    56#include <types.h> 
    67 
    78/* Defines */ 
    8 #define SOCK_STREAM             0 
     9#define NET_PF_LOCAL    0x0 
     10#define NET_PF_INET             0x1 
    911 
    10 /* Structures */ 
    11  
    12 struct SocketAddr 
    13 { 
    14         unsigned long int family; 
    15         unsigned char data[20]; 
    16 }; 
    17  
    18 /* Function protoypes */ 
    19 int NetSocketCreate(int domain, int type, int protocol); 
    20 int NetSocketBind(int fd, struct SocketAddr* address, int length); 
    21 int NetSocketListen(int fd, int backlog); 
    22 int NetSocketAccept(int fd, struct SocketAddr* address, int* length); 
    23 int NetSocketConnect(int fd, struct SocketAddr* address, int length); 
    24 int NetSocketSend(int fd, const void* buffer, int size, int length); 
    25 int NetSocketReceive(int fd, void* buffer, int size, int length); 
    26 int NetSocketClose(int fd); 
     12#define NET_TYPE_STREAM 0x2 
     13#define NET_TYPE_DGRAM  0x3 
    2714 
    2815/* New sockets. */ 
     
    3017struct SockAddr 
    3118{ 
    32         unsigned char addr[20]; 
     19        short family; 
     20        unsigned char addr[18]; 
    3321}; 
    3422 
     
    3725struct tagSocket 
    3826{ 
    39         int channelFd; 
    4027        struct SocketOps* ops; 
    41         struct SockAddr chanSrc, chanDest; 
     28        Channel* channel; /* FIXME: Should not be pointer */ 
     29        void* priv; 
    4230}; 
    4331 
     
    4634struct SocketOps 
    4735{ 
     36        int (*accept)(Socket* socket, Socket* child, struct SockAddr* addr); 
     37        int (*bind)(Socket* socket, struct SockAddr* addr); 
     38        int (*listen)(Socket* socket, int backlog); 
    4839        int (*create)(Socket* socket); 
    4940        int (*send)(Socket* socket, const void* buffer, unsigned long length, int flags); 
    5041        int (*sendTo)(Socket* socket, const void* buffer, unsigned long length, int flags, struct SockAddr* dest); 
    51         int (*recvFrom)(Socket* socket, const void* buffer, unsigned long length, int flags, struct SockAddr* dest); 
     42        int (*recvFrom)(Socket* socket, void* buffer, unsigned long length, int flags, struct SockAddr* dest); 
    5243        int (*recv)(Socket* socket, void* buffer, unsigned long length, int flags); 
    5344        int (*connect)(Socket* socket, struct SockAddr* sockAddr); 
     
    6253 
    6354/* General functions. */ 
     55int SocketCreate(Socket* socket, int domain, int type, int protocol); 
    6456int SocketConnect(Socket* socket, struct SockAddr* sockAddr); 
    6557int SocketConnectEx(Socket* socket, struct SockAddr* src, struct SockAddr* dest, int flags); 
  • Whitix/branches/netchannel/user/sdk/include/net/udp.h

    r2069 r2084  
    11#ifndef SDK_NET_UDP_H 
    22#define SDK_NET_UDP_H 
     3 
     4#define CHAN_TYPE_UDP           0x01 
    35 
    46#include <net/socket.h> 
  • Whitix/branches/netchannel/user/sdk/include/types.h

    r2067 r2084  
    22#define SDK_TYPES_H 
    33 
    4 typedef unsigned long ulong; 
    5 typedef unsigned short ushort; 
     4typedef unsigned long   ulong; 
     5 
     6#ifndef DEFINED_USHORT 
     7#define DEFINED_USHORT 
     8typedef unsigned short  ushort; 
     9#endif 
     10 
     11typedef unsigned char   uchar; 
    612 
    713#endif 
  • Whitix/branches/netchannel/user/sdk/network/Makefile

    r2061 r2084  
    1 CFLAGS = -Wall -I../include -I../../libc/include -nostdlib -ffreestanding -fno-builtin -fPIC -m32 
     1CFLAGS = -Wall -I../include -I../../libc/include -nostdlib -ffreestanding -fno-builtin -fPIC -m32  
    22 
    3 OBJS = socket.o byteorder.o ipv4.o udp.o memory.o dns.o startup.o 
     3OBJS = byteorder.o ipv4.o udp.o memory.o dns.o icmp.o tcp.o tcp_options.o channels.o init.o socket.o 
    44 
    55.c.o: 
     
    77 
    88build: $(OBJS) 
    9         gcc -m32 -nostdlib -ffreestanding -fno-builtin -shared -o ../libs/libnetwork.so \ 
     9        gcc -m32 -nostdlib -ffreestanding -fno-builtin -shared -L../libs/ \ 
     10        -L../../posix/ -lpthread -o ../libs/libnetwork.so -Wl,-init=NetworkInit \ 
    1011                $(OBJS) ../../libc/init/crt_begin.o ../../libc/init/crt_end.o 
    1112 
  • Whitix/branches/netchannel/user/sdk/network/dns.c

    r2068 r2084  
    126126         
    127127        state->offset = sizeof(struct DnsHeader); 
    128          
     128 
    129129        /* Find offset for answers. */ 
    130130        for (i = 0; i < state->questions; i++) 
     
    179179} 
    180180 
    181 int DnsGetCanonicalName(struct DnsState* state, char* name, int length) 
     181int DnsGetCanonicalName(struct DnsState* state, char* name, int length, int 
     182                start) 
    182183{ 
    183184        int i; 
    184185        struct DnsAnswer* answer = (struct DnsAnswer*)(state->buf + state->offset); 
    185          
    186         for ( i = 0; i < state->answers; i++) 
     186 
     187        /* Skip over records we have already scanned. */ 
     188        for ( i = 0; i < start; i++) 
     189                DNS_SKIP_BYTES(answer, DnsSkipRecord(state, answer)); 
     190 
     191        for ( i = start; i < state->answers; i++) 
    187192        { 
    188193                ushort type = NetToHostShort(answer->type); 
     
    191196                { 
    192197                        DnsCopyCanonicalName(state, answer, name, length); 
    193                         return 1; 
     198                        return i; 
    194199                }else 
    195                         DNS_SKIP_BYTES(answer, DnsSkipRecord(state, answer));                                    
    196         } 
    197                  
    198         return 0; 
     200                        DNS_SKIP_BYTES(answer, DnsSkipRecord(state, answer));    
     201        } 
     202                 
     203        return -1; 
    199204} 
    200205 
     
    206211} 
    207212 
    208 int DnsGetIpAddresses(struct DnsState* state, ulong* address, int dest) 
     213int DnsGetIpAddresses(struct DnsState* state, ulong* address, int 
     214                start) 
    209215{ 
    210216        int i, length; 
    211217        char* p; 
    212218        struct DnsAnswer* answer = (struct DnsAnswer*)(state->buf+state->offset); 
    213          
    214         for (i = 0; i < state->answers; i++) 
     219 
     220        if (start >= state->answers) 
     221                return -1; 
     222 
     223        for (i = 0; i < start; i++) 
     224                DNS_SKIP_BYTES(answer, DnsSkipRecord(state, answer)); 
     225 
     226        for (i = start; i < state->answers; i++) 
    215227        { 
    216228                ushort type = NetToHostShort(answer->type); 
     
    228240                        /* Found the IP address. */ 
    229241                        *address = NetToHostLong(*(ulong*)(((char*)answer)+sizeof(struct DnsAnswer))); 
    230                          
    231                         /* TODO: Collect multiple. */ 
    232                         return 1; 
    233                 }else{ 
     242                        return i; 
     243                }else 
    234244                        DNS_SKIP_BYTES(answer, DnsSkipRecord(state, answer)); 
    235                 } 
    236         } 
    237          
    238         return 0; 
     245        } 
     246         
     247        return -1; 
    239248} 
    240249 
    241250int DnsGetIpAddress(struct DnsState* state, ulong* address) 
    242251{ 
    243         return DnsGetIpAddresses(state, address, 1); 
     252        return DnsGetIpAddresses(state, address, 0); 
    244253} 
    245254 
     
    251260        struct DnsState state; 
    252261        struct Ipv4EndPoint dnsAddr; 
    253          
    254         dnsAddr.address = 0xC0A80001; 
     262 
     263        /* FIXME */ 
     264        dnsAddr.address = 0xC0A801FE; 
    255265        dnsAddr.port = 53; 
    256  
    257         /* TODO: Call Ipv4Address function. */ 
    258266         
    259267        dnsSocket = UdpSocketCreate(); 
    260          
     268 
     269        if (!dnsSocket) 
     270                return -1; 
     271 
    261272        DnsStartHeader(&state, buf, 1024); 
    262          
    263273        DnsAddQuery(&state, name, DNS_QUERY_A); 
    264274 
    265275        length = DnsFinishHeader(&state); 
    266                  
    267         printf("Here, %d\n", length); 
    268276                 
    269277        if (SocketSendTo(dnsSocket, buf, length, 0, &dnsAddr) < length) 
     
    275283                return 1; 
    276284 
    277         printf("Here\n"); 
    278  
    279285        DnsStartReply(&state, buf, length); 
    280                          
    281         DnsGetIpAddress(&state, address); 
    282          
     286 
     287        if (DnsGetIpAddress(&state, address) < 0) 
     288                return -1; 
     289 
    283290        SocketClose(dnsSocket); 
    284          
     291 
    285292        return 0; 
    286293} 
  • Whitix/branches/netchannel/user/sdk/network/ipv4.c

    r2068 r2084  
     1#include <stdio.h> 
     2#include <syscalls.h> 
    13#include <net/network.h> 
     4#include <net/byteorder.h> 
     5#include <net/channels.h> 
     6#include <net/ipv4.h> 
    27 
    38ulong IpCheckSum(char* data, ulong bytes, ulong sum) 
     
    2732        int ch; 
    2833        unsigned long ipAddr = 0, curr = 0; 
    29         int shiftPos = 0; 
     34        int shiftPos = 24; 
    3035         
    3136        while ((ch = *address++)) 
     
    4146                {                        
    4247                        ipAddr |= (curr << shiftPos); 
    43                         shiftPos += 8; 
     48                        shiftPos -= 8; 
    4449                        curr = 0; 
    4550                }else 
     
    4752        } 
    4853         
    49         ipAddr |= (curr << 24); 
     54        ipAddr |= (curr); 
    5055         
    51         if (shiftPos != 24) 
     56        if (shiftPos != 0) 
    5257                return 1; 
    5358                 
     
    5762} 
    5863 
    59 int SocketConnect(Socket* socket, struct SockAddr* addr) 
     64int IpBuildHeader(void* start, struct Ipv4EndPoint* destIp, int length, int protocol) 
    6065{ 
    61         if (!socket) 
    62                 return -1; 
    63                  
    64         if (socket->ops && socket->ops->connect) 
    65                 return socket->ops->connect(socket, addr); 
    66                  
    67         return -1; 
     66        struct IpHeader* ipHeader = (struct IpHeader*)start; 
     67        memset(ipHeader, 0, sizeof(struct IpHeader)); 
     68 
     69        ipHeader->versionLength = (4 << 4) | 5; 
     70        ipHeader->id = HostToNetShort(1); 
     71        ipHeader->ttl = 255; 
     72        ipHeader->protocol = protocol; 
     73        ipHeader->destAddr = NetToHostLong(destIp->address); 
     74        ipHeader->totalLength = NetToHostShort(length + sizeof(struct IpHeader)); 
     75         
     76        /* Checksum is performed when we choose the source address when routing. */ 
     77 
     78        return 0; 
    6879} 
    6980 
    70 int SocketSend(Socket* socket, const void* buffer, unsigned int length, int flags) 
    71 { 
    72         if (!socket) 
    73                 return -1; 
    74                  
    75         if (socket->ops && socket->ops->send) 
    76                 return socket->ops->send(socket, buffer, length, flags); 
    77                  
    78         return -1; 
    79 } 
    8081 
    81 int SocketSendTo(Socket* socket, const void* buffer, unsigned int length, int flags, struct SockAddr* dest) 
    82 { 
    83         if (!socket) 
    84                 return -1; 
    85                  
    86         if (socket->ops && socket->ops->sendTo) 
    87                 return socket->ops->sendTo(socket, buffer, length, flags, dest); 
    88                  
    89         return -1; 
    90 } 
    91  
    92 int SocketRecvFrom(Socket* socket, const void* buffer, unsigned int length, int flags, 
    93         struct SockAddr* dest) 
    94 { 
    95         if (!socket) 
    96                 return -1; 
    97                  
    98         if (socket->ops && socket->ops->recvFrom) 
    99                 return socket->ops->recvFrom(socket, buffer, length, flags, dest); 
    100                  
    101         return -1; 
    102 } 
    103  
    104 int SocketClose(Socket* socket) 
    105 { 
    106         printf("SocketClose(%#X)\n", socket); 
    107         return -1; 
    108 } 
    109  
  • Whitix/branches/netchannel/user/sdk/network/memory.c

    r2068 r2084  
    55#include <net/channels.h> 
    66#include <net/ipv4.h> 
    7  
    8 void* ChanGetBuffer(unsigned int length) 
    9 {        
    10         return malloc(length); 
    11 } 
    12  
    13 void ChanFreeBuffer(void* p) 
    14 { 
    15         free(p); 
    16 } 
     7#include <bitops.h> 
  • Whitix/branches/netchannel/user/sdk/network/socket.c

    r2061 r2084  
    1 /* Network and socket library. */ 
    21#include <net/socket.h> 
    3 #include <syscalls.h> 
    42 
    5 int NetSocketCreate(int domain, int type, int protocol) 
     3#include <stdio.h> 
     4 
     5int SocketCreate(Socket* socket, int domain, int type, int protocol) 
    66{ 
    7 #if 0 
    8         return SysSocketCreate(domain, type, protocol); 
    9 #endif 
     7        /* Keep it simple. */ 
     8        if (domain == NET_PF_LOCAL) 
     9                return -1; 
     10 
     11        if (type == NET_TYPE_STREAM) 
     12        { 
     13                _TcpSocketCreate(socket); 
     14                return 0; 
     15        }else{ 
     16                _UdpSocketCreate(socket); 
     17                return 0; 
     18        } 
     19 
     20        return -1; 
    1021} 
    1122 
    12 int NetSocketBind(int fd, struct SocketAddr* address, int length) 
     23int SocketBind(Socket* socket, struct SockAddr* addr) 
    1324{ 
    14 #if 0 
    15         return SysSocketBind(fd, address, length); 
    16 #endif 
     25        if (socket && socket->ops && socket->ops->bind) 
     26                return socket->ops->bind(socket, addr); 
     27 
     28        return -1; 
    1729} 
    1830 
    19 int NetSocketListen(int fd, int backlog) 
     31int SocketListen(Socket* socket, int backlog) 
    2032{ 
    21 #if 0 
    22         return SysSocketListen(fd, backlog); 
    23 #endif 
     33        if (socket && socket->ops && socket->ops->listen) 
     34                return socket->ops->listen(socket, backlog); 
     35 
     36        return -1; 
    2437} 
    2538 
    26 int NetSocketAccept(int fd, struct SocketAddr* address, int* length) 
     39int SocketAccept(Socket* socket, Socket* child, struct SockAddr* addr) 
    2740{ 
    28 #if 0 
    29         return SysSocketAccept(fd, address, length); 
    30 #endif 
     41        if (socket && socket->ops && socket->ops->accept) 
     42                return socket->ops->accept(socket, child, addr); 
     43 
     44        return -1; 
    3145} 
    3246 
    33 int NetSocketConnect(int fd, struct SocketAddr* address, int length) 
     47int SocketConnect(Socket* socket, struct SockAddr* addr) 
    3448{ 
    35 #if 0 
    36         return SysSocketConnect(fd, address, length); 
    37 #endif 
     49        if (!socket) 
     50                return -1; 
     51                 
     52        if (socket->ops && socket->ops->connect) 
     53                return socket->ops->connect(socket, addr); 
     54                 
     55        return -1; 
    3856} 
    3957 
    40 int NetSocketSend(int fd, const void* buffer, int size, int flags) 
     58int SocketSend(Socket* socket, const void* buffer, unsigned int length, int flags) 
    4159{ 
    42 #if 0 
    43         return SysSocketSend(fd, buffer, size, flags); 
    44 #endif 
     60        if (!socket) 
     61                return -1; 
     62                 
     63        if (socket->ops && socket->ops->send) 
     64                return socket->ops->send(socket, buffer, length, flags); 
     65                 
     66        return -1; 
    4567} 
    4668 
    47 int NetSocketReceive(int fd, void* buffer, int size, int flags) 
     69int SocketSendTo(Socket* socket, const void* buffer, unsigned int length, int flags, struct SockAddr* dest) 
    4870{ 
    49 #if 0 
    50         return SysSocketReceive(fd, buffer, size, flags); 
    51 #endif 
     71        if (!socket) 
     72                return -1; 
     73                 
     74        if (socket->ops && socket->ops->sendTo) 
     75                return socket->ops->sendTo(socket, buffer, length, flags, dest); 
     76                 
     77        return -1; 
    5278} 
    5379 
    54 int NetSocketClose(int fd) 
     80int SocketRecv(Socket* socket, void* buffer, unsigned int length, int 
     81                flags) 
    5582{ 
    56 #if 0 
    57         return SysSocketClose(fd); 
    58 #endif 
     83        if (!socket) 
     84                return -1; 
     85 
     86        if (socket->ops && socket->ops->recv) 
     87                return socket->ops->recv(socket, buffer, length, flags); 
     88 
     89        return -1; 
    5990} 
     91 
     92int SocketRecvFrom(Socket* socket, const void* buffer, unsigned int length, int flags, 
     93        struct SockAddr* dest) 
     94{ 
     95        if (!socket) 
     96                return -1; 
     97                 
     98        if (socket->ops && socket->ops->recvFrom) 
     99                return socket->ops->recvFrom(socket, buffer, length, flags, dest); 
     100                 
     101        return -1; 
     102} 
     103 
     104int SocketClose(Socket* socket) 
     105{ 
     106        if (!socket) 
     107                return -1; 
     108 
     109        if (socket->ops && socket->ops->shutdown) 
     110                return socket->ops->shutdown(socket); 
     111 
     112        /* TODO: Free socket */ 
     113 
     114        return -1; 
     115} 
  • Whitix/branches/netchannel/user/sdk/network/udp.c

    r2068 r2084  
    88static struct SocketOps udpSocketOps; 
    99 
     10int UdpSocketConnect(Socket* socket, struct SockAddr* address); 
     11 
     12int _UdpSocketCreate(Socket* socket) 
     13{ 
     14        socket->ops = &udpSocketOps; 
     15 
     16        /* TODO: no? */ 
     17        if (UdpSocketConnect(socket, NULL) < 0) 
     18                return -1; 
     19 
     20        return 0; 
     21} 
     22 
    1023Socket* UdpSocketCreate() 
    1124{ 
     
    1427        /* Create hidden _SocketCreate function. */ 
    1528        socket = SocketAllocate(); 
    16         socket->ops = &udpSocketOps; 
    17         socket->channelFd = -1; 
    18          
    19         /* TODO: no */ 
    20         UdpSocketConnect(socket, NULL); 
    21          
     29        _UdpSocketCreate(socket); 
     30 
    2231        return socket; 
    2332} 
     
    2736int UdpSocketConnect(Socket* socket, struct SockAddr* address) 
    2837{        
    29         struct Ipv4EndPoint* chanSrc, *chanDest; 
     38        struct Ipv4EndPoint chanSrc, chanDest; 
     39         
     40        chanSrc.address = 0; 
     41        chanSrc.port = 0; /* IP channel code will sort out a port. */ 
     42         
     43        chanDest.address = IPV4_BROADCAST; 
     44        chanDest.port = 0; 
     45                 
     46        socket->channel = ChannelCreate(CHAN_MAKE_TYPE(CHAN_FAMILY_IP, 
     47                                CHAN_TYPE_UDP), &chanSrc, &chanDest, NULL); 
    3048 
    31         chanSrc = &socket->chanSrc; 
    32         chanDest = &socket->chanDest; 
    33          
    34         chanSrc->address = 0; 
    35         chanSrc->port = 0; /* IP channel code will sort out a port. */ 
    36          
    37         chanDest->address = IPV4_BROADCAST; 
    38         chanDest->port = 0; 
    39                  
    40         socket->channelFd = SysChannelCreate(CHAN_MAKE_TYPE(CHAN_FAMILY_IP, CHAN_TYPE_UDP), chanSrc, chanDest, 0); 
     49        if (!socket->channel) 
     50                return -1; 
    4151 
    4252        return 0; 
     
    4757        /* Fill chanDest with dest, chanSrc with source, and use 
    4858         * chanSrc when constructing UDP packet. */ 
    49         memcpy(&socket->chanSrc, source, sizeof(struct Ipv4EndPoint)); 
    50         memcpy(&socket->chanDest, dest, sizeof(struct Ipv4EndPoint)); 
     59        memcpy(&socket->channel->src, source, sizeof(struct Ipv4EndPoint)); 
     60        memcpy(&socket->channel->dest, dest, sizeof(struct Ipv4EndPoint)); 
    5161 
    52         socket->channelFd = SysChannelCreate(CHAN_FAMILY_IP, &socket->chanSrc, &socket->chanDest, flags); 
     62//      socket->channelFd = SysChannelCreate(CHAN_FAMILY_IP, &socket->chanSrc, &socket->chanDest, flags); 
    5363        return -1; 
    5464} 
     
    6676} 
    6777 
     78ulong UdpCheckSum() 
     79{ 
     80        return 0; 
     81} 
     82 
    6883int UdpSocketSendTo(Socket* socket, const void* buffer, unsigned long length, int flags, struct SockAddr* dest) 
    6984{ 
    70         char* chanBuff; 
    71         char* start; 
     85        ChanSendBuffer* chanBuff; 
     86        int ret; 
    7287        struct Ipv4EndPoint* destIp = (struct Ipv4EndPoint*)dest; 
    73         struct Ipv4EndPoint* srcIp = (struct Ipv4EndPoint*)&socket->chanSrc; 
     88        struct Ipv4EndPoint* srcIp = (struct Ipv4EndPoint*)&socket->channel->src; 
    7489        struct IpHeader* ipHeader; 
    7590        struct UdpHeader* udpHeader; 
     91        char* data; 
    7692        int totalLength; 
    7793         
    78         totalLength = length + sizeof(struct UdpHeader) + sizeof(struct IpHeader) + CHAN_LINK_MAX; 
    79          
     94        totalLength = length + sizeof(struct UdpHeader) + sizeof(struct IpHeader); 
     95 
    8096        if (!dest) 
    8197                return -1; 
    82          
    83         chanBuff = ChanGetBuffer(totalLength); 
    84          
    85         /* Fill chanBuff, leave space for LINK_MAX bytes. */ 
    86         start = chanBuff + CHAN_LINK_MAX; 
    87          
    88         ipHeader=(struct IpHeader*)(start); 
    89          
    90         memset(ipHeader, 0, sizeof(struct IpHeader)); 
    9198 
    92         ipHeader->versionLength=(4 << 4) | 5; 
    93         ipHeader->id=HostToNetShort(1); 
    94         ipHeader->ttl=255; 
    95         ipHeader->protocol=PROTOCOL_RAW_UDP; 
    96         ipHeader->destAddr=NetToHostLong(destIp->address); 
    97         ipHeader->sourceAddr=NetToHostLong(srcIp->address); 
    98         ipHeader->totalLength = NetToHostShort(length + sizeof(struct UdpHeader) + sizeof(struct IpHeader)); 
    99         ipHeader->checkSum=WrapSum(IpCheckSum((unsigned char*)ipHeader, sizeof(struct IpHeader), 0)); 
     99        chanBuff = ChanSendBufferAlloc(socket->channel, &data); 
     100 
     101        printf("chanBuff = %#X, data = %#X\n", chanBuff, data); 
     102 
     103        if (!chanBuff) 
     104                return -1; 
     105 
     106        ipHeader=(struct IpHeader*)data; 
     107        IpBuildHeader(ipHeader, destIp, length + sizeof(struct UdpHeader), PROTOCOL_RAW_UDP); 
    100108 
    101109        /* Add UDP header. */ 
    102         udpHeader = (struct UdpHeader*)(start + sizeof(struct IpHeader)); 
     110        udpHeader = (struct UdpHeader*)(data + sizeof(struct IpHeader)); 
    103111         
    104112        udpHeader->sourcePort = NetToHostShort(srcIp->port); 
     
    106114        udpHeader->length = NetToHostShort(length + sizeof(struct UdpHeader)); 
    107115         
    108         memcpy(start + sizeof(struct IpHeader) + sizeof(struct UdpHeader), buffer, length); 
     116        memcpy(data + sizeof(struct IpHeader) + sizeof(struct UdpHeader), buffer, length); 
    109117         
    110         udpHeader->checkSum=WrapSum(IpCheckSum((unsigned char*)udpHeader, sizeof(struct UdpHeader), 
     118/*      udpHeader->checkSum = WrapSum(IpCheckSum((unsigned char*)udpHeader, sizeof(struct UdpHeader), 
    111119                                                IpCheckSum(start+sizeof(struct IpHeader)+sizeof(struct UdpHeader), length, 
    112                                                         IpCheckSum((unsigned char*)&ipHeader->sourceAddr, 8, PROTOCOL_RAW_UDP + HostToNetShort(udpHeader->length))))); 
     120                                                        IpCheckSum((unsigned char*)&ipHeader->sourceAddr, 8, 
     121                                                        PROTOCOL_RAW_UDP + 
     122                                                        HostToNetShort(udpHeader->length))))); */ 
     123 
     124        ret = ChanBufferSend(socket->channel, chanBuff, totalLength); 
    113125         
    114         if (SysWrite(socket->channelFd, chanBuff, totalLength)) 
    115                 length = -1; 
    116          
    117         ChanFreeBuffer(chanBuff); 
    118          
    119         return length; 
     126        return ret; 
    120127} 
    121128 
    122 int UdpSocketRecvFrom(Socket* socket, const void* buffer, unsigned int length, int flags, 
     129int UdpSocketRecvFrom(Socket* socket, void* buffer, unsigned long length, int flags, 
    123130        struct SockAddr* dest) 
    124131{ 
    125         int totalLength = length + sizeof(struct IpHeader) + sizeof(struct UdpHeader); 
    126132        int read; 
    127          
    128         void* chanBuff = ChanGetBuffer(totalLength); 
    129          
    130         read = SysRead(socket->channelFd, chanBuff, totalLength); 
    131          
    132         /* FIXME: More parsing needed!. */ 
    133          
    134         memcpy(buffer, chanBuff + totalLength - length, length); 
    135          
    136         return read - sizeof(struct IpHeader) - sizeof(struct UdpHeader); 
     133        ChanRecvBuffer* chanBuff; 
     134        char* buf; 
     135        int dataByteCnt; 
     136 
     137        read = ChanBufferRecv(socket->channel, &chanBuff, &buf, 2000); 
     138 
     139        if (read <= 0) 
     140        { 
     141                printf("read = %d\n", read); 
     142                return read; 
     143        } 
     144 
     145        dataByteCnt = read - sizeof(struct UdpHeader) - sizeof(struct IpHeader); 
     146 
     147        /* FIXME: More checking. */ 
     148        memcpy(buffer, buf + sizeof(struct IpHeader) + sizeof(struct UdpHeader), 
     149                        dataByteCnt); 
     150 
     151//      ChanBufferFree(socket->channel, chanBuff); 
     152 
     153        return dataByteCnt;  
    137154} 
     155 
    138156static struct SocketOps udpSocketOps =  
    139157{ 
  • Whitix/branches/netchannel/user/sdk/registry/registry.c

    r2070 r2084  
    2626int RegRegistryOpen(char* name, struct Registry* registry) 
    2727{ 
     28#if 0 
    2829        int sockFd; 
    2930        struct SocketAddr addr; 
     
    4243 
    4344        registry->sockFd=sockFd; 
    44          
     45#endif   
    4546        return 0; 
    4647} 
     
    4849int RegRegistryClose(struct Registry* registry) 
    4950{ 
     51#if 0 
    5052        NetSocketClose(registry->sockFd); 
     53#endif 
    5154        return 0; 
    5255} 
     
    5457int RegKeySetOpen(struct Registry* registry, char* name, unsigned long accessRights, struct RegKeySet* keySet) 
    5558{ 
     59#if 0 
    5660        int err; 
    5761         
     
    8791        keySet->handleId=handleId; 
    8892        keySet->registry=registry; 
    89          
     93#endif 
     94 
    9095        return 0; 
    9196} 
     
    139144int RegKeySetReadKey(struct RegKeySet* keySet, char* name, int* type, char* data, unsigned long* length) 
    140145{ 
     146#if 0 
    141147        int err; 
    142148        int sockFd; 
     
    182188        if (type) 
    183189                *type=reply.type; 
     190#endif 
    184191         
    185192        return 0; 
     
    200207char* RegKeySetIterNext(struct RegKeySetIter* iter) 
    201208{ 
     209#if 0 
    202210        struct RegEnumSetPacket 
    203211        { 
     
    250258         
    251259        return ret; 
     260#endif 
     261        return 0; 
    252262} 
    253263 
     
    264274int RegEntryGetType(struct RegKeySet* keySet, char* name, int* ret) 
    265275{ 
     276#if 0 
    266277        struct RegReadKeyPacket packet; 
    267278        int sockFd, err; 
     
    280291                 
    281292        NetSocketReceive(sockFd, ret, 4, 0); 
    282          
    283         return 0; 
    284 } 
     293#endif 
     294        return 0; 
     295} 
  • Whitix/branches/netchannel/user/system/moduleadd.c

    r2061 r2084  
    2828        if (fd < 0) 
    2929        { 
    30                 printf("moduleadd: Could not open %s\n", name); 
     30                printf("moduleadd: Could not open %s (%d)\n", name, fd); 
    3131                return 1; 
    3232        } 
     
    4949 
    5050        /* Check ret. */ 
    51         if (ret) 
    52                 printf("moduleadd: Error adding module %s to kernel: %s\n", name, strerror(ret)); 
    5351 
    5452        SysClose(fd); 
     
    6260                UsagePrint(); 
    6361 
    64         char* moduleName=argv[1]; 
     62        char* moduleName = argv[1]; 
    6563        char buf[PATH_MAX+100]; 
    6664        int ret; 
    6765 
    6866        if (!strstr(moduleName, ".sys")) 
    69                 sprintf(buf, "%s.sys", moduleName); 
     67                snprintf(buf, sizeof(buf), "%s.sys", moduleName); 
    7068        else 
    71                 strcpy(buf, moduleName); 
     69                strncpy(buf, moduleName, sizeof(buf)); 
    7270 
    7371        ret=ModuleLoad(buf, 0); 
     
    8280                if (!ret) 
    8381                { 
    84                         sprintf(buf, "%s.ko", moduleName); 
     82                        snprintf(buf, sizeof(buf), "%s.ko", moduleName); 
    8583                        ret=ModuleLoad(buf, MODULE_FLAG_LINUX); 
    8684                } 
    8785        } 
    8886 
    89         if (ret == 1) 
    90         { 
     87        if (ret != 0) 
    9188                printf("moduleadd: Could not load %s. Exiting\n", buf); 
    92         } 
    9389 
    9490        return ret; 
  • Whitix/branches/netchannel/user/system/registry/socket.c

    r2061 r2084  
    1616void RegSocketCreate() 
    1717{ 
    18         struct SocketAddr addr; 
    19          
    20         serverSock=NetSocketCreate(PF_LOCAL, 0, 0); 
    21         addr.family=PF_LOCAL; 
    22         strcpy(addr.data, ":/Registry"); 
    23         NetSocketBind(serverSock, &addr, sizeof(struct SocketAddr)); 
    24         NetSocketListen(serverSock, 10); 
     18//      struct SocketAddr addr; 
     19         
     20//      serverSock=NetSocketCreate(PF_LOCAL, 0, 0); 
     21//      addr.family=PF_LOCAL; 
     22//      strcpy(addr.data, ":/Registry"); 
     23//      NetSocketBind(serverSock, &addr, sizeof(struct SocketAddr)); 
     24//      NetSocketListen(serverSock, 10); 
    2525} 
    2626 
     
    3636        { 
    3737                handleId=-1; 
    38                 goto send; 
     38//              goto send; 
    3939        } 
    4040         
    4141        handleId=RegKeySetGetHandleId(*list, handle); 
    4242 
    43 send: 
     43//send: 
    4444        /* Send the handle ID back to the calling application. */ 
    45         NetSocketSend(clientFd, &handleId, 4, 0); 
     45//      NetSocketSend(clientFd, &handleId, 4, 0); 
    4646} 
    4747 
     
    8888        } 
    8989         
    90         NetSocketSend(clientFd, &reply, sizeof(struct RegReadKeyReply), 0); 
    91          
    92         if (key) 
    93                 NetSocketSend(clientFd, data, reply.length, 0); 
     90//      NetSocketSend(clientFd, &reply, sizeof(struct RegReadKeyReply), 0); 
     91         
     92//      if (key) 
     93//              NetSocketSend(clientFd, data, reply.length, 0); 
    9494} 
    9595 
     
    157157//      printf("Sending %d\n", length); 
    158158         
    159         NetSocketSend(clientFd, sendBuf, length, 0); 
     159//      NetSocketSend(clientFd, sendBuf, length, 0); 
    160160         
    161161        free(sendBuf); 
     
    164164error: 
    165165        length=-1; 
    166         NetSocketSend(clientFd, &length, sizeof(int), 0); 
     166//      NetSocketSend(clientFd, &length, sizeof(int), 0); 
    167167} 
    168168 
     
    177177        handle=RegKeySetGetHandle(list, packet->handleId); 
    178178         
    179         if (!handle) 
    180                 goto out; 
     179//      if (!handle) 
     180//              goto out; 
    181181                 
    182182        set=handle->set; 
     
    187187        { 
    188188                type=0; 
    189                 goto out; 
     189                //goto out; 
    190190        } 
    191191         
     
    195195                type=1; 
    196196         
    197 out: 
    198         NetSocketSend(clientFd, &type, sizeof(int), 0); 
     197//out: 
     198//      NetSocketSend(clientFd, &type, sizeof(int), 0); 
    199199} 
    200200 
     
    208208        while (1) 
    209209        { 
    210                 int bytesRead=NetSocketReceive(clientFd, buf, 4096, 0); 
     210                int bytesRead=/*NetSocketReceive(clientFd, buf, 4096, 0)*/ 0; 
    211211                 
    212212//              printf("bytesRead = %d\n", bytesRead); 
     
    246246void RegSocketAcceptConn() 
    247247{ 
    248         int clientSock=NetSocketAccept(serverSock, NULL, NULL); 
     248        int clientSock=/*NetSocketAccept(serverSock, NULL, NULL)*/ 0; 
    249249         
    250250        if (clientSock > 0) 
  • Whitix/branches/netchannel/user/system/startup.c

    r2061 r2084  
    3939        int ret, pid; 
    4040 
    41         ModuleLoad("Network/ipv4"); 
     41        pid = ModuleLoad("Network/ipv4"); 
     42        SysWaitForProcessFinish(pid, NULL); 
     43 
    4244        ModuleLoad("Network/ne2k_pci"); 
    43  
    4445        ModuleLoad("Network/pcnet32"); 
    4546//      ModuleLoad("Network/e1000"); 
    46          
    47         /* Move to FS thread? */ 
    48         pid=ModuleLoad("Filesystems/icfs"); 
    49          
    50         SysWaitForProcessFinish(pid, NULL); 
    51          
     47 
    5248        printf("Mounting the system filesystem.."); 
    5349         
     
    7874} 
    7975 
    80 int inputFinished=0; 
    81  
    82 void InputInit() 
    83 { 
    84         int pid; 
    85  
    86         pid=ModuleLoad("Input/Ps2"); 
    87  
    88         SysWaitForProcessFinish(pid, NULL); 
    89  
    90         ModuleLoad("Input/keyboard"); 
    91         ModuleLoad("Input/Ps2Mouse"); 
    92  
    93         inputFinished=1; 
    94  
    95         SysResumeThread(threadId); 
    96 } 
    97  
    9876int unixFinished=0; 
    9977 
     
    11795 
    11896        SysCreateThread(NetworkInit, 0, NULL); 
    119         SysCreateThread(InputInit, 0 , NULL); 
    12097        SysCreateThread(StorageInit, 0, NULL); 
    12198        SysCreateThread(UnixInit, 0, NULL); 
     
    123100        threadId = SysGetCurrentThreadId(); 
    124101 
    125         while (!inputFinished || !networkFinished || !storageFinished || !unixFinished) 
     102        while (!networkFinished || !storageFinished || !unixFinished) 
    126103        { 
    127 //              printf("%#X %#X %#X %#X\n", inputFinished, networkFinished, storageFinished, unixFinished); 
    128104                SysSuspendThread(threadId); 
     105//              SysYield(); 
    129106        } 
    130107 
     
    132109 
    133110        char* args[]={NULL}; 
     111         
     112        int fd = SysOpen("/test.txt", 0, 0); 
     113         
     114        int fds[] = {0, 3, 2}; 
    134115 
    135 //      SysCreateProcess("/System/Startup/regserver", NULL, args); 
     116        //SysCreateProcess("/System/Startup/regserver", NULL, args); 
    136117 
    137         pid=SysCreateProcess("/Applications/burn", NULL, args); 
     118        pid = SysCreateProcess("/Applications/burn", fds, args); 
    138119 
    139120        SysWaitForProcessFinish(pid, NULL); 
  • Whitix/branches/netchannel/user/xynth/demo/desktop/Makefile

    r910 r2084  
    88CFLAGS += -DDESKTOPDIR=\"$(DESKTOPDIR)\" 
    99INCDIR  = ../../src/lib ../../../libc/include ../../../posix/include 
    10 LIBDIR  = ../../src/lib ../../../libc ../../../posix ../../../linker/dl ../../../linker 
    11 LDFLAGS = -t -lxynth -lstdc -lposix -lm -ldl -lpthread -llinker ../../../libc/init/init.o 
     10LIBDIR  = ../../src/lib ../../../libc ../../../posix ../../../linker/dl ../../../sdk/libs ../../../linker 
     11LDFLAGS = -t -lxynth -lstdc -lposix -lm -ldl -lnetwork -lpthread -llinker ../../../libc/init/init.o 
    1212 
    1313OBJS = desktop.o main.o menu.o taskbar.o 
  • Whitix/branches/netchannel/user/xynth/demo/desktop/Makefile.depend

    r2061 r2084  
    11desktop.o: desktop.c desktop.h ../../../libc/include/stdio.h \ 
    2   ../../../libc/include/stddef.h ../../../libc/include/string.h \ 
    3   ../../../libc/include/stdarg.h ../../../libc/include/stdlib.h \ 
    4   ../../../libc/include/limits.h ../../../posix/include/sys/types.h \ 
    5   ../../../posix/include/sys/stat.h ../../../posix/include/sys/time.h \ 
    6   ../../../libc/include/time.h ../../../posix/include/fcntl.h \ 
    7   ../../../libc/include/syscalls.h ../../../libc/include/sysdefs.h \ 
    8   ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
    9   ../../../posix/include/sys/resource.h ../../../posix/include/sys/wait.h \ 
    10   ../../../posix/include/signal.h ../../../posix/include/ucontext.h \ 
    11   ../../../posix/include/sys/ucontext.h ../../../posix/include/getopt.h \ 
    12   ../../../libc/include/stdint.h ../../../libc/include/inttypes.h \ 
    13   ../../../posix/include/sys/unistd.h ../../src/lib/xynth_.h \ 
    14   ../../../libc/include/errno.h ../../../libc/include/ctype.h \ 
    15   ../../src/lib/xynth.h ../../../posix/include/sys/poll.h \ 
    16   ../../../posix/include/sys/socket.h ../../../posix/include/sys/un.h \ 
    17   ../../../posix/include/netinet/in.h ../../../posix/include/arpa/inet.h 
     2 ../../../libc/include/stddef.h ../../../libc/include/string.h \ 
     3 ../../../libc/include/stdarg.h ../../../libc/include/stdlib.h \ 
     4 ../../../libc/include/limits.h ../../../posix/include/sys/types.h \ 
     5 ../../../posix/include/sys/stat.h ../../../posix/include/sys/time.h \ 
     6 ../../../libc/include/time.h ../../../posix/include/fcntl.h \ 
     7 ../../../libc/include/syscalls.h ../../../libc/include/sysdefs.h \ 
     8 ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
     9 ../../../posix/include/sys/resource.h ../../../posix/include/sys/wait.h \ 
     10 ../../../posix/include/signal.h ../../../posix/include/ucontext.h \ 
     11 ../../../posix/include/sys/ucontext.h ../../../posix/include/getopt.h \ 
     12 ../../../libc/include/stdint.h ../../../libc/include/inttypes.h \ 
     13 ../../../posix/include/sys/unistd.h ../../src/lib/xynth_.h \ 
     14 ../../../libc/include/errno.h ../../../libc/include/ctype.h \ 
     15 ../../src/lib/xynth.h ../../../posix/include/sys/poll.h \ 
     16 ../../../posix/include/sys/socket.h ../../../posix/include/sys/un.h \ 
     17 ../../../posix/include/netinet/in.h ../../../posix/include/arpa/inet.h 
    1818main.o: main.c desktop.h ../../../libc/include/stdio.h \ 
    19   ../../../libc/include/stddef.h ../../../libc/include/string.h \ 
    20   ../../../libc/include/stdarg.h ../../../libc/include/stdlib.h \ 
    21   ../../../libc/include/limits.h ../../../posix/include/sys/types.h \ 
    22   ../../../posix/include/sys/stat.h ../../../posix/include/sys/time.h \ 
    23   ../../../libc/include/time.h ../../../posix/include/fcntl.h \ 
    24   ../../../libc/include/syscalls.h ../../../libc/include/sysdefs.h \ 
    25   ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
    26   ../../../posix/include/sys/resource.h ../../../posix/include/sys/wait.h \ 
    27   ../../../posix/include/signal.h ../../../posix/include/ucontext.h \ 
    28   ../../../posix/include/sys/ucontext.h ../../../posix/include/getopt.h \ 
    29   ../../../libc/include/stdint.h ../../../libc/include/inttypes.h \ 
    30   ../../../posix/include/sys/unistd.h ../../src/lib/xynth_.h \ 
    31   ../../../libc/include/errno.h ../../../libc/include/ctype.h \ 
    32   ../../src/lib/xynth.h ../../../posix/include/sys/poll.h \ 
    33   ../../../posix/include/sys/socket.h ../../../posix/include/sys/un.h \ 
    34   ../../../posix/include/netinet/in.h ../../../posix/include/arpa/inet.h 
     19 ../../../libc/include/stddef.h ../../../libc/include/string.h \ 
     20 ../../../libc/include/stdarg.h ../../../libc/include/stdlib.h \ 
     21 ../../../libc/include/limits.h ../../../posix/include/sys/types.h \ 
     22 ../../../posix/include/sys/stat.h ../../../posix/include/sys/time.h \ 
     23 ../../../libc/include/time.h ../../../posix/include/fcntl.h \ 
     24 ../../../libc/include/syscalls.h ../../../libc/include/sysdefs.h \ 
     25 ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
     26 ../../../posix/include/sys/resource.h ../../../posix/include/sys/wait.h \ 
     27 ../../../posix/include/signal.h ../../../posix/include/ucontext.h \ 
     28 ../../../posix/include/sys/ucontext.h ../../../posix/include/getopt.h \ 
     29 ../../../libc/include/stdint.h ../../../libc/include/inttypes.h \ 
     30 ../../../posix/include/sys/unistd.h ../../src/lib/xynth_.h \ 
     31 ../../../libc/include/errno.h ../../../libc/include/ctype.h \ 
     32 ../../src/lib/xynth.h ../../../posix/include/sys/poll.h \ 
     33 ../../../posix/include/sys/socket.h ../../../posix/include/sys/un.h \ 
     34 ../../../posix/include/netinet/in.h ../../../posix/include/arpa/inet.h 
    3535menu.o: menu.c desktop.h ../../../libc/include/stdio.h \ 
    36   ../../../libc/include/stddef.h ../../../libc/include/string.h \ 
    37   ../../../libc/include/stdarg.h ../../../libc/include/stdlib.h \ 
    38   ../../../libc/include/limits.h ../../../posix/include/sys/types.h \ 
    39   ../../../posix/include/sys/stat.h ../../../posix/include/sys/time.h \ 
    40   ../../../libc/include/time.h ../../../posix/include/fcntl.h \ 
    41   ../../../libc/include/syscalls.h ../../../libc/include/sysdefs.h \ 
    42   ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
    43   ../../../posix/include/sys/resource.h ../../../posix/include/sys/wait.h \ 
    44   ../../../posix/include/signal.h ../../../posix/include/ucontext.h \ 
    45   ../../../posix/include/sys/ucontext.h ../../../posix/include/getopt.h \ 
    46   ../../../libc/include/stdint.h ../../../libc/include/inttypes.h \ 
    47   ../../../posix/include/sys/unistd.h ../../src/lib/xynth_.h \ 
    48   ../../../libc/include/errno.h ../../../libc/include/ctype.h \ 
    49   ../../src/lib/xynth.h ../../../posix/include/sys/poll.h \ 
    50   ../../../posix/include/sys/socket.h ../../../posix/include/sys/un.h \ 
    51   ../../../posix/include/netinet/in.h ../../../posix/include/arpa/inet.h 
     36 ../../../libc/include/stddef.h ../../../libc/include/string.h \ 
     37 ../../../libc/include/stdarg.h ../../../libc/include/stdlib.h \ 
     38 ../../../libc/include/limits.h ../../../posix/include/sys/types.h \ 
     39 ../../../posix/include/sys/stat.h ../../../posix/include/sys/time.h \ 
     40 ../../../libc/include/time.h ../../../posix/include/fcntl.h \ 
     41 ../../../libc/include/syscalls.h ../../../libc/include/sysdefs.h \ 
     42 ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
     43 ../../../posix/include/sys/resource.h ../../../posix/include/sys/wait.h \ 
     44 ../../../posix/include/signal.h ../../../posix/include/ucontext.h \ 
     45 ../../../posix/include/sys/ucontext.h ../../../posix/include/getopt.h \ 
     46 ../../../libc/include/stdint.h ../../../libc/include/inttypes.h \ 
     47 ../../../posix/include/sys/unistd.h ../../src/lib/xynth_.h \ 
     48 ../../../libc/include/errno.h ../../../libc/include/ctype.h \ 
     49 ../../src/lib/xynth.h ../../../posix/include/sys/poll.h \ 
     50 ../../../posix/include/sys/socket.h ../../../posix/include/sys/un.h \ 
     51 ../../../posix/include/netinet/in.h ../../../posix/include/arpa/inet.h 
    5252taskbar.o: taskbar.c desktop.h ../../../libc/include/stdio.h \ 
    53   ../../../libc/include/stddef.h ../../../libc/include/string.h \ 
    54   ../../../libc/include/stdarg.h ../../../libc/include/stdlib.h \ 
    55   ../../../libc/include/limits.h ../../../posix/include/sys/types.h \ 
    56   ../../../posix/include/sys/stat.h ../../../posix/include/sys/time.h \ 
    57   ../../../libc/include/time.h ../../../posix/include/fcntl.h \ 
    58   ../../../libc/include/syscalls.h ../../../libc/include/sysdefs.h \ 
    59   ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
    60   ../../../posix/include/sys/resource.h ../../../posix/include/sys/wait.h \ 
    61   ../../../posix/include/signal.h ../../../posix/include/ucontext.h \ 
    62   ../../../posix/include/sys/ucontext.h ../../../posix/include/getopt.h \ 
    63   ../../../libc/include/stdint.h ../../../libc/include/inttypes.h \ 
    64   ../../../posix/include/sys/unistd.h ../../src/lib/xynth_.h \ 
    65   ../../../libc/include/errno.h ../../../libc/include/ctype.h \ 
    66   ../../src/lib/xynth.h ../../../posix/include/sys/poll.h \ 
    67   ../../../posix/include/sys/socket.h ../../../posix/include/sys/un.h \ 
    68   ../../../posix/include/netinet/in.h ../../../posix/include/arpa/inet.h 
     53 ../../../libc/include/stddef.h ../../../libc/include/string.h \ 
     54 ../../../libc/include/stdarg.h ../../../libc/include/stdlib.h \ 
     55 ../../../libc/include/limits.h ../../../posix/include/sys/types.h \ 
     56 ../../../posix/include/sys/stat.h ../../../posix/include/sys/time.h \ 
     57 ../../../libc/include/time.h ../../../posix/include/fcntl.h \ 
     58 ../../../libc/include/syscalls.h ../../../libc/include/sysdefs.h \ 
     59 ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
     60 ../../../posix/include/sys/resource.h ../../../posix/include/sys/wait.h \ 
     61 ../../../posix/include/signal.h ../../../posix/include/ucontext.h \ 
     62 ../../../posix/include/sys/ucontext.h ../../../posix/include/getopt.h \ 
     63 ../../../libc/include/stdint.h ../../../libc/include/inttypes.h \ 
     64 ../../../posix/include/sys/unistd.h ../../src/lib/xynth_.h \ 
     65 ../../../libc/include/errno.h ../../../libc/include/ctype.h \ 
     66 ../../src/lib/xynth.h ../../../posix/include/sys/poll.h \ 
     67 ../../../posix/include/sys/socket.h ../../../posix/include/sys/un.h \ 
     68 ../../../posix/include/netinet/in.h ../../../posix/include/arpa/inet.h 
  • Whitix/branches/netchannel/user/xynth/demo/term/Makefile

    r910 r2084  
    66 
    77INCDIR  = ../../src/lib ../../../libc/include ../../../sdk/include ../../../posix/include 
    8 LIBDIR  = ../../src/lib ../../../libc ../../../posix ../../../linker 
    9 LDFLAGS = -t -lxynth -lstdc -lposix -lm -ldl -lpthread -llinker ../../../libc/init/init.o 
     8LIBDIR  = ../../src/lib ../../../libc ../../../posix ../../../linker ../../../sdk/libs 
     9LDFLAGS = -t -lxynth -lstdc -lposix -lm -ldl -lnetwork -lpthread -llinker ../../../libc/init/init.o 
    1010 
    1111OBJS = term.o 
  • Whitix/branches/netchannel/user/xynth/src/lib/Makefile.depend

    r2061 r2084  
    11alloc.o: alloc.c ../../../libc/include/stdlib.h \ 
    2   ../../../libc/include/limits.h ../../../libc/include/stddef.h xynth_.h \ 
    3   ../../../libc/include/stdio.h ../../../libc/include/string.h \ 
    4   ../../../libc/include/stdarg.h ../../../libc/include/errno.h \ 
    5   ../../../posix/include/unistd.h ../../../posix/include/sys/select.h \ 
    6   ../../../posix/include/sys/types.h ../../../posix/include/sys/time.h \ 
    7 <