Changeset 2084 for Whitix/branches
- Timestamp:
- 05/17/10 15:54:05 (2 years ago)
- Location:
- Whitix/branches/netchannel
- Files:
-
- 9 added
- 1 removed
- 203 modified
-
Makefile (modified) (1 diff)
-
arch/i386/boot/Makefile (modified) (1 diff)
-
arch/i386/boot/multiboot.S (modified) (5 diffs)
-
arch/i386/kernel/Makefile (modified) (1 diff)
-
arch/i386/kernel/init.c (modified) (1 diff)
-
arch/i386/kernel/ints.c (modified) (7 diffs)
-
arch/i386/kernel/link.ld.S (added)
-
arch/i386/kernel/multiboot.c (modified) (2 diffs)
-
arch/i386/kernel/process.c (modified) (5 diffs)
-
arch/i386/kernel/smp.c (modified) (1 diff)
-
arch/i386/mm/init.c (modified) (6 diffs)
-
arch/i386/mm/virt.c (modified) (19 diffs)
-
bochsrc.txt (modified) (4 diffs)
-
devices/Makefile (modified) (1 diff)
-
devices/input/Makefile (modified) (1 diff)
-
devices/input/keyboard.c (modified) (3 diffs)
-
devices/input/ps2.c (modified) (1 diff)
-
devices/input/ps2mouse.c (modified) (1 diff)
-
devices/kedev/class.c (modified) (2 diffs)
-
devices/kedev/sdevice.c (modified) (1 diff)
-
devices/linux/dma.c (modified) (4 diffs)
-
devices/linux/eth.c (modified) (2 diffs)
-
devices/linux/include/irq.h (modified) (1 diff)
-
devices/linux/include/net.h (modified) (4 diffs)
-
devices/linux/irq.c (modified) (3 diffs)
-
devices/linux/mem.c (modified) (2 diffs)
-
devices/linux/net.c (modified) (12 diffs)
-
devices/linux/pci.c (modified) (5 diffs)
-
devices/linux/resource.c (modified) (1 diff)
-
devices/linux/timer.c (modified) (1 diff)
-
devices/misc/misc.c (modified) (4 diffs)
-
devices/net/Makefile (modified) (1 diff)
-
devices/net/ne2k-pci.c (modified) (5 diffs)
-
devices/net/pcnet.c (modified) (2 diffs)
-
devices/pci/pci_core.c (modified) (1 diff)
-
devices/pci/pci_lib.c (modified) (4 diffs)
-
devices/pci/pci_mem.c (modified) (1 diff)
-
devices/storage/ata/ata-cd.c (modified) (1 diff)
-
devices/storage/ata/ata.c (modified) (4 diffs)
-
fs/Makefile (modified) (1 diff)
-
fs/devfs/devfs.c (modified) (1 diff)
-
fs/ext3/ext3.h (modified) (1 diff)
-
fs/ext3/inode.c (modified) (6 diffs)
-
fs/fat/dir.c (modified) (1 diff)
-
fs/fat/fat.h (modified) (2 diffs)
-
fs/fat/vnode.c (modified) (10 diffs)
-
fs/icfs/Makefile (modified) (1 diff)
-
fs/icfs/config.c (modified) (3 diffs)
-
fs/icfs/icfs.c (modified) (5 diffs)
-
fs/icfs/icfs.h (modified) (2 diffs)
-
fs/icfs/icsetup.c (modified) (1 diff)
-
fs/icfs/info.c (modified) (17 diffs)
-
fs/isofs/dir.c (modified) (2 diffs)
-
fs/journal/commit.c (modified) (3 diffs)
-
fs/journal/journals.c (modified) (3 diffs)
-
fs/journal/transaction.c (modified) (1 diff)
-
fs/kfs/dir.c (modified) (4 diffs)
-
fs/reiserfs/dir.c (modified) (2 diffs)
-
fs/vfs/bcache.c (modified) (4 diffs)
-
fs/vfs/dir.c (modified) (2 diffs)
-
fs/vfs/file.c (modified) (2 diffs)
-
fs/vfs/poll.c (modified) (6 diffs)
-
fs/vfs/vcache.c (modified) (2 diffs)
-
fs/vfs/vnode.c (modified) (2 diffs)
-
include/config.h (modified) (1 diff)
-
include/error.h (modified) (1 diff)
-
include/fs/bcache.h (modified) (1 diff)
-
include/fs/exports.h (modified) (1 diff)
-
include/fs/icfs.h (modified) (2 diffs)
-
include/fs/kfs.h (modified) (2 diffs)
-
include/fs/vfs.h (modified) (3 diffs)
-
include/i386/i386.h (modified) (1 diff)
-
include/keobject.h (modified) (1 diff)
-
include/llist.h (modified) (2 diffs)
-
include/locks.h (modified) (2 diffs)
-
include/module.h (modified) (3 diffs)
-
include/net/buffer.h (modified) (6 diffs)
-
include/net/channels.h (modified) (7 diffs)
-
include/net/device.h (modified) (4 diffs)
-
include/net/eth.h (modified) (4 diffs)
-
include/net/ipv4.h (modified) (4 diffs)
-
include/pci.h (modified) (2 diffs)
-
include/print.h (modified) (2 diffs)
-
include/string.h (modified) (2 diffs)
-
include/timer.h (modified) (1 diff)
-
include/typedefs.h (modified) (1 diff)
-
include/vmm.h (modified) (4 diffs)
-
include/wait.h (modified) (2 diffs)
-
kernel/main.c (modified) (4 diffs)
-
kernel/module.c (modified) (8 diffs)
-
kernel/process.c (modified) (8 diffs)
-
kernel/sched.c (modified) (5 diffs)
-
kernel/startup.c (modified) (1 diff)
-
kernel/symbols.c (modified) (2 diffs)
-
kernel/timer.c (modified) (4 diffs)
-
kernel/wait.c (modified) (3 diffs)
-
lib/Makefile (modified) (1 diff)
-
lib/keobject.c (modified) (5 diffs)
-
lib/string.c (modified) (4 diffs)
-
lib/vsprintf.c (modified) (2 diffs)
-
make.inc (modified) (3 diffs)
-
memory/mmap.c (modified) (10 diffs)
-
memory/pg_alloc.c (modified) (12 diffs)
-
memory/shmem.c (modified) (3 diffs)
-
memory/slab.c (modified) (4 diffs)
-
memory/vmm.c (modified) (4 diffs)
-
net/Makefile (modified) (1 diff)
-
net/channels/Makefile (modified) (1 diff)
-
net/channels/file.c (modified) (7 diffs)
-
net/channels/init.c (modified) (2 diffs)
-
net/channels/memory.c (modified) (1 diff)
-
net/channels/recv.c (modified) (2 diffs)
-
net/channels/sys.c (modified) (5 diffs)
-
net/device.c (modified) (4 diffs)
-
net/eth.c (modified) (4 diffs)
-
net/ipv4/Makefile (modified) (1 diff)
-
net/ipv4/icmp.c (modified) (10 diffs)
-
net/ipv4/init.c (modified) (7 diffs)
-
net/ipv4/loopback.c (added)
-
net/ipv4/route.c (added)
-
net/network.c (modified) (3 diffs)
-
user/burn/main.c (modified) (1 diff)
-
user/grub/menu.lst (modified) (1 diff)
-
user/grub/stage2/.deps/libgrub_a-boot.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-builtins.Po (modified) (4 diffs)
-
user/grub/stage2/.deps/libgrub_a-char_io.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-cmdline.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-common.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-disk_io.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_ext2fs.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_fat.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_ffs.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_iso9660.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_jfs.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_minix.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_reiserfs.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_ufs2.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_vstafs.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-fsys_xfs.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-gunzip.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-md5.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-serial.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-stage2.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-terminfo.Po (modified) (5 diffs)
-
user/grub/stage2/.deps/libgrub_a-tparm.Po (modified) (5 diffs)
-
user/libc/Makefile (modified) (1 diff)
-
user/libc/assert/assert.c (modified) (1 diff)
-
user/libc/include/assert.h (modified) (1 diff)
-
user/libc/include/syscalls.h (modified) (1 diff)
-
user/libc/include/sysdefs.h (modified) (1 diff)
-
user/libc/string/str.c (modified) (1 diff)
-
user/linker/Makefile (modified) (2 diffs)
-
user/linker/elf.h (modified) (1 diff)
-
user/linker/load_lib.c (modified) (1 diff)
-
user/linker/main.c (modified) (3 diffs)
-
user/linker/relocate.c (modified) (1 diff)
-
user/net/Makefile (modified) (3 diffs)
-
user/net/dhcp.c (modified) (10 diffs)
-
user/net/dns.c (modified) (4 diffs)
-
user/net/ifconfig.c (added)
-
user/net/ping.c (modified) (4 diffs)
-
user/net/telnet.c (added)
-
user/posix/Makefile (modified) (2 diffs)
-
user/posix/file/Makefile (modified) (1 diff)
-
user/posix/include/arpa/inet.h (modified) (1 diff)
-
user/posix/include/netdb.h (modified) (1 diff)
-
user/posix/include/netinet/in.h (modified) (2 diffs)
-
user/posix/include/sys/socket.h (modified) (2 diffs)
-
user/posix/include/sys/types.h (modified) (1 diff)
-
user/posix/socket/socket.c (modified) (6 diffs)
-
user/sdk/Makefile (modified) (2 diffs)
-
user/sdk/include/net/byteorder.h (modified) (1 diff)
-
user/sdk/include/net/channels.h (modified) (1 diff)
-
user/sdk/include/net/inet_raw.h (modified) (2 diffs)
-
user/sdk/include/net/ipv4.h (modified) (2 diffs)
-
user/sdk/include/net/network.h (modified) (1 diff)
-
user/sdk/include/net/socket.h (modified) (5 diffs)
-
user/sdk/include/net/udp.h (modified) (1 diff)
-
user/sdk/include/types.h (modified) (1 diff)
-
user/sdk/network/Makefile (modified) (2 diffs)
-
user/sdk/network/dns.c (modified) (7 diffs)
-
user/sdk/network/ipv4.c (modified) (5 diffs)
-
user/sdk/network/ipv4.h (added)
-
user/sdk/network/memory.c (modified) (1 diff)
-
user/sdk/network/socket.c (modified) (1 diff)
-
user/sdk/network/tcp_buffer.h (added)
-
user/sdk/network/tcp_options.h (added)
-
user/sdk/network/udp.c (modified) (6 diffs)
-
user/sdk/registry/registry.c (modified) (11 diffs)
-
user/sdk/thread (deleted)
-
user/system/moduleadd.c (modified) (4 diffs)
-
user/system/registry/socket.c (modified) (10 diffs)
-
user/system/startup.c (modified) (5 diffs)
-
user/tests (added)
-
user/xynth/demo/desktop/Makefile (modified) (1 diff)
-
user/xynth/demo/desktop/Makefile.depend (modified) (1 diff)
-
user/xynth/demo/term/Makefile (modified) (1 diff)
-
user/xynth/src/lib/Makefile.depend (modified) (1 diff)
-
user/xynth/src/lib/expat/Makefile.depend (modified) (1 diff)
-
user/xynth/src/lib/freetype2/Makefile.depend (modified) (1 diff)
-
user/xynth/src/lib/libpng/Makefile.depend (modified) (1 diff)
-
user/xynth/src/lib/libz/Makefile.depend (modified) (1 diff)
-
user/xynth/src/lib/pixman/Makefile.depend (modified) (1 diff)
-
user/xynth/src/server/Makefile.depend (modified) (1 diff)
-
user/xynth/src/themes/silverado/Makefile.depend (modified) (1 diff)
-
user/xynth/src/widget/Makefile.depend (modified) (1 diff)
-
user/xynth/src/widget/widgetc/Makefile (modified) (1 diff)
-
user/xynth/src/widget/widgetc/Makefile.depend (modified) (1 diff)
-
user/xynth/src/widget/widgetr/Makefile (modified) (2 diffs)
-
user/xynth/src/widget/widgetr/Makefile.depend (modified) (1 diff)
-
video/Makefile (modified) (1 diff)
-
video/console.c (modified) (7 diffs)
-
video/virtual.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/netchannel/Makefile
r2061 r2084 53 53 54 54 kern: subdirs 55 ld -M -T link.ldarch/$(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 \ 56 56 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 \ 58 58 -o kern > kernel.txt 59 59 mkdir -p $(DIRMODULES) -
Whitix/branches/netchannel/arch/i386/boot/Makefile
r1218 r2084 4 4 build: $(OBJS) 5 5 6 multiboot.o: $(DEPTH)include/config.h 7 6 8 include ../../../make.inc -
Whitix/branches/netchannel/arch/i386/boot/multiboot.S
r1315 r2084 6 6 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 7 7 #define MULTIBOOT_HEADER_FLAGS 0x00000003 8 9 #define VA_TO_PA(addr) (addr - KERNEL_ADDRESS_BASE) 8 10 9 11 .text … … 24 26 25 27 realStart: 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 33 fill: 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 54 HigherHalfStart: 27 55 lgdt gdtr 28 56 29 57 mov $(idleStack+4096), %esp 30 58 … … 38 66 call i386CopyMultiBoot 39 67 40 add %esp, 868 add $0x08, %esp 41 69 42 70 mov $0x28, %ax /* TSS_SEL in the GDT */ … … 62 90 63 91 .data 92 .align 0x1000 93 .globl bootPageDirectory 94 bootPageDirectory: 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 105 bootFirstTable: 106 .fill 1024, 4, 0 107 bootSecondTable: 108 .fill 1024, 4, 0 109 bootThirdTable: 110 .fill 1024, 4, 0 111 bootFourthTable: 112 .fill 1024, 4, 0 113 bootFifthTable: 114 .fill 1024, 4, 0 64 115 65 116 gdtr: 66 117 gdtSize: .short gdtEnd-gdt-1 67 118 gdtBase: .long gdt 119 120 .globl gdt 68 121 69 122 gdt: … … 96 149 /* TSS selector */ 97 150 .word 0x68 /* Limit (length of TSS) */ 98 .word 0x2 000 /* Base*/151 .word 0x2200 /* Base; TODO: Use macro */ 99 152 .word 0x8900 /* Type */ 100 153 .word 0x0000 /* Granularity and limit */ 101 154 155 /* TLS selector. Modified at every task switch */ 156 .word 0x0 157 .word 0x0 158 .word 0x0 159 .word 0x0 160 102 161 gdtEnd: -
Whitix/branches/netchannel/arch/i386/kernel/Makefile
r1030 r2084 1 1 DEPTH=../../../ 2 2 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 3 OBJS := 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 4 EXTRA_OBJS := link.lds 5 5 6 build: $(OBJS) 6 build: $(OBJS) $(EXTRA_OBJS) 7 8 link.lds: $(DEPTH)include/config.h 7 9 8 10 include $(DEPTH)make.inc -
Whitix/branches/netchannel/arch/i386/kernel/init.c
r1444 r2084 89 89 { 90 90 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); 91 92 i386InitMultiBoot(); 92 93 PhysInit(); -
Whitix/branches/netchannel/arch/i386/kernel/ints.c
r2061 r2084 69 69 SYMBOL_EXPORT(IrqAdd); 70 70 71 int IrqRemove(BYTE irq, Irq isr,void* data)71 int IrqRemove(BYTE irq, Irq isr, void* data) 72 72 { 73 73 struct IrqEntry* entry; … … 128 128 if (!funcAddr) 129 129 return -ENOSYS; 130 130 131 131 /* Verify stack */ 132 132 return DispatchSysCall(funcAddr, stackPointer, numArgBytes); … … 198 198 /* PAGE FAULT */ 199 199 case 14: 200 if (currThread->preemptCount > 0) 201 KePrint("eip = %#lX\n", curr->eip); 200 202 asm volatile("mov %%cr2,%0" : "=r"(address)); 201 203 if (MmapHandleFault(current, address, curr->error)) … … 218 220 { 219 221 /* 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); 221 223 ThrArchPrintContext(curr); /* Debug */ 222 224 ThrProcessExit(-1); … … 225 227 cli(); /* Just get the message out */ 226 228 if (irq == 14 && address < PAGE_SIZE) 227 KePrint("\nNULL POINTER EXCEPTION (address = %#.8 X)\n", address);229 KePrint("\nNULL POINTER EXCEPTION (address = %#.8lX)\n", address); 228 230 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); 230 232 ThrArchPrintContext(curr); 231 233 hlt(); … … 254 256 255 257 ListForEachEntry(curr,&irqsHead[irq],next) 258 { 259 if (!curr->irq) 260 { 261 ThrArchPrintContext(currThread->currContext); /* Debug */ 262 cli(); hlt(); 263 } 264 256 265 if (!(curr->irq(curr->data))) 257 266 break; 267 } 258 268 } 259 269 … … 292 302 293 303 default: 294 KePrint("Unhandled interrupt : index = %# X\n", irq);304 KePrint("Unhandled interrupt : index = %#lX\n", irq); 295 305 } 296 306 -
Whitix/branches/netchannel/arch/i386/kernel/multiboot.c
r1319 r2084 64 64 DWORD i; 65 65 struct MbModule* curr = mbInfo->modAddr; 66 66 67 67 for (i=0; i<mbInfo->modCount; i++) 68 68 { … … 78 78 KernelPanic("Could not initialize the kernel"); 79 79 } 80 81 // KePrint(KERN_INFO "Loaded %s\n", curr[i].string);82 80 } 83 81 } -
Whitix/branches/netchannel/arch/i386/kernel/process.c
r2061 r2084 18 18 19 19 #include <i386/process.h> 20 #include <addresses.h> 20 21 #include <i386/i386.h> 21 22 #include <task.h> … … 28 29 #include <sections.h> 29 30 30 #define TSS_ADDR 0x2 00031 #define TSS_ADDR 0x2200 31 32 32 33 void i386ExitThread(); … … 34 35 DWORD exitCode=0xF8000000; 35 36 36 struct TSS* tss=(struct TSS*) TSS_ADDR;37 struct TSS* tss=(struct TSS*)(TSS_ADDR); 37 38 38 39 struct Thread* ThrArchSwitch(struct Thread* prev,struct Thread* next) … … 94 95 95 96 /* 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; 98 99 99 100 /* And restore the current process. */ … … 190 191 191 192 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); 197 199 198 200 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)); 200 202 201 203 cli(); hlt(); -
Whitix/branches/netchannel/arch/i386/kernel/smp.c
r1071 r2084 94 94 95 95 found: 96 KePrint(KERN_INFO "SMP: MP table found at %# X\n",addr);96 KePrint(KERN_INFO "SMP: MP table found at %#lX\n",addr); 97 97 return 0; 98 98 } -
Whitix/branches/netchannel/arch/i386/mm/init.c
r1678 r2084 19 19 #include <i386/physical.h> 20 20 #include <pg_alloc.h> 21 #include <addresses.h> 21 22 #include <print.h> 22 23 … … 228 229 { 229 230 currEntry=&entries[i]; 230 KePrint(KERN_INFO "Start: %#016 X 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)); 231 232 232 233 switch (currEntry->rangeType) … … 245 246 break; 246 247 default: 247 KePrint("Type = % u\n",currEntry->rangeType);248 KePrint("Type = %lu\n", currEntry->rangeType); 248 249 } 249 250 } … … 347 348 */ 348 349 349 ebdaSeg = *(WORD*) 0x40E;350 ebdaSeg = *(WORD*)PA_TO_VA(0x40E); 350 351 351 352 if (ebdaSeg) … … 356 357 357 358 /* Reserve BIOS code/data areas */ 358 PageReserveArea(0xA0000, 0x100000-0xA0000);359 PageReserveArea(0xA0000, 0x100000-0xA0000); 359 360 } 360 361 … … 364 365 365 366 PhysReadMemoryMap(); 366 367 367 maxPfn=GetMaxPfn(); 368 369 368 PageEarlyInit(maxPfn); 370 371 369 /* Print memory size for information purposes */ 372 370 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); 374 372 375 373 if (memSize < 2) -
Whitix/branches/netchannel/arch/i386/mm/virt.c
r1678 r2084 21 21 #include <sections.h> 22 22 #include <malloc.h> 23 #include <addresses.h> 23 24 #include <slab.h> 24 25 #include <print.h> … … 34 35 35 36 #define invlpg(page) asm volatile("invlpg %0" :: "m"(*(char*)page)) 37 #define KERNEL_DIR_BEGIN (KERNEL_ADDRESS_BASE >> 22) 38 36 39 struct Cache* managerCache; 37 38 void PagingEnable(struct MemManager* manager)39 {40 VirtSetCurrent(manager);41 SetCr0(GetCr0() | CR0_PG);42 }43 40 44 41 /*********************************************************************** … … 61 58 } 62 59 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 catch79 * 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 of119 * 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 129 60 int VirtMemManagerInit(struct MemManager* manager,int kernel) 130 61 { 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)); 139 63 140 64 if (kernel) 141 65 { 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) 143 72 goto error; 144 }else{73 145 74 DWORD* vPageDir, *kPageDir; 146 75 … … 153 82 ZeroMemory(vPageDir, PAGE_SIZE); 154 83 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]; 171 91 vPageDir[1023]=((DWORD)manager->pageDir) | PAGE_PRESENT | PAGE_RW | PAGE_KERNEL; 172 92 VirtUnmapPhysPage((DWORD)vPageDir); … … 177 97 PreemptDisable(); 178 98 179 ListAddTail(&manager->list, &managerList);99 ListAddTail(&manager->list, &managerList); 180 100 181 101 if (currThread) … … 210 130 { 211 131 /* Go through all the page tables, releasing the memory if allocated. No need to release kernel page tables */ 212 inti;132 DWORD i; 213 133 struct PhysPage* curr=NULL; 214 134 DWORD* vPageDir; … … 224 144 vPageDir=(DWORD*)VirtAllocateTemp((DWORD)manager->pageDir); 225 145 226 /* Free all the private page directories */ 227 for (i=2; i<768; i++) 146 for (i=2; i<KERNEL_DIR_BEGIN; i++) 228 147 { 229 148 if (vPageDir[i] & PAGE_PRESENT) … … 239 158 PreemptEnable(); 240 159 241 MemCacheFree(managerCache, manager);160 MemCacheFree(managerCache, manager); 242 161 243 162 return 0; … … 247 166 { 248 167 /* Init the kernel page tables */ 249 VirtMemManagerInit(&kernelMem, true); 250 251 return 0; 168 return VirtMemManagerInit(&kernelMem, true); 252 169 } 253 170 254 171 int VirtInit() 255 172 { 256 managerCache=MemCacheCreate("Manager Cache",sizeof(struct MemManager),NULL,NULL,0); 173 managerCache=MemCacheCreate("VmManagers", sizeof(struct MemManager), NULL, NULL, 0); 174 257 175 if (!managerCache) 258 176 return -ENOMEM; … … 263 181 int VirtMemMapPage(DWORD virt,DWORD phys,int perms) 264 182 { 265 DWORD virtEnt, flags; 183 DWORD flags; 184 DWORD virtEnt; 266 185 struct MemManager* manager; 267 186 DWORD* virtDir; … … 271 190 return -EFAULT; 272 191 273 virtEnt =PGDIR_ENT(virt);192 virtEnt = PGDIR_ENT(virt); 274 193 275 194 IrqSaveFlags(flags); … … 278 197 { 279 198 pageDir[virtEnt]=PageAlloc()->physAddr | perms | PAGE_RW; 199 280 200 /* Zero out the whole page table */ 281 201 ZeroMemory(&pageTable[virtEnt*1024], PAGE_SIZE); 282 202 283 203 /* If in kernel memory space, map to all other page directories */ 284 if (virtEnt >= 768)204 if (virtEnt >= (KERNEL_DIR_BEGIN)) 285 205 { 286 206 ListForEachEntry(manager,&managerList,list) 287 207 { 208 /* Avoid copying to the same page table entry */ 209 if ((DWORD)manager->pageDir == VirtToPhys((DWORD)pageDir)) 210 break; 211 288 212 virtDir=(DWORD*)VirtAllocateTemp((DWORD)manager->pageDir); 289 virtDir[virtEnt] =pageDir[virtEnt];213 virtDir[virtEnt] = pageDir[virtEnt]; 290 214 VirtUnmapPhysPage((DWORD)virtDir); 291 215 } 292 216 } 293 217 } 294 218 295 219 pageTable[PGTABLE_ENT(virt)]=phys | perms; 296 220 invlpg(virt); 297 221 298 222 IrqRestoreFlags(flags); 299 223 return 0; … … 312 236 VirtUnmapPhysPage(curr); 313 237 } 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 acceptable318 * Should it?319 */320 238 321 239 DWORD VirtMapPhysPage(DWORD virt,DWORD endVirt,int perms) … … 339 257 if (!(pageDir[PGDIR_ENT(i)]) || !(pageTable[PGTABLE_ENT(i)])) /* Definitely not used */ 340 258 { 341 VirtMemMapPage(i, page,perms);259 VirtMemMapPage(i, page, perms); 342 260 IrqRestoreFlags(flags); 343 261 return i; … … 360 278 361 279 IrqSaveFlags(flags); 362 363 // KePrint("VirtMapPhysRange(%#X,%#X,%u,%d)\n",virt,endVirt,numPages,perms);364 280 365 281 for (i=virt; i<endVirt; i+=PAGE_SIZE) … … 424 340 pageTable[PGTABLE_ENT(address)] &= ~(0xFFF); 425 341 pageTable[PGTABLE_ENT(address)] |= protection; 426 // KePrint("address = %#X\n", pageTable[PGTABLE_ENT(address)]);427 342 } 428 343 } … … 436 351 void VirtUnmapPhysPage(DWORD virt) 437 352 { 353 DWORD flags; 354 355 IrqSaveFlags(flags); 356 438 357 if (!pageDir[PGDIR_ENT(virt)] || !pageTable[PGTABLE_ENT(virt)]) 439 358 /* Doesn't exist */ 440 return;359 goto out; 441 360 442 361 pageTable[PGTABLE_ENT(virt)]=0; 443 362 invlpg(virt); 363 364 out: 365 IrqRestoreFlags(flags); 444 366 } 445 367 … … 450 372 DWORD i; 451 373 452 /* 0xF00 00000 to 0xF8000000 is the space for temporarily mapping physical memory */453 454 for (i=0xF00 00000; 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) 455 377 if (!pageDir[PGDIR_ENT(i)] || !pageTable[PGTABLE_ENT(i)]) /* Definitely not used */ 456 378 { 457 VirtMemMapPage(i, phys,PAGE_PRESENT | PAGE_KERNEL | PAGE_RW);379 VirtMemMapPage(i, phys, PAGE_PRESENT | PAGE_KERNEL | PAGE_RW); 458 380 return i; 459 381 } … … 467 389 void VirtShowFault(DWORD address,int error) 468 390 { 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]); 470 392 471 393 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); 473 395 474 396 KePrint("\n"); -
Whitix/branches/netchannel/bochsrc.txt
r2061 r2084 4 4 megs: 64 5 5 romimage: 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" 7 7 boot: cdrom 8 8 floppy_bootsig_check: disabled=0 … … 22 22 com4: enabled=0 23 23 usb1: enabled=0 24 #i440fxsupport: enabled=1, slot2=ne2k 24 ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:01, ethmod=linux, ethdev=eth0 25 i440fxsupport: enabled=1 25 26 vga_update_interval: 40000 26 27 vga: extension=vbe … … 30 31 clock: sync=none, time0=local 31 32 # no cmosimage 32 ne2k: enabled=1, ioaddr=0x800, irq=7, mac=b0:c4:20:00:00:01, ethmod=vnet, ethdev=eth033 pnic: enabled=034 33 sb16: enabled=0 35 34 # no loader … … 45 44 keyboard_serial_delay: 250 46 45 keyboard_paste_delay: 100000 47 keyboard_mapping: enabled=1, map=/usr/local/share/bochs/keymaps/x11-pc-uk.map48 46 user_shortcut: keys=none 49 47 mouse: enabled=0, type=ps2 -
Whitix/branches/netchannel/devices/Makefile
r2061 r2084 10 10 11 11 modules_install: 12 $(MAKE) -C input modules_install13 12 $(MAKE) -C net modules_install 14 13 $(MAKE) -C storage modules_install -
Whitix/branches/netchannel/devices/input/Makefile
r653 r2084 1 1 DEPTH=../../ 2 2 3 MODULES := ps2mouse.sys keyboard.sys ps2.sys 4 5 build: $(MODULES) 6 7 modules_install: 8 cp -f *.sys ../../CdRoot/System/Modules/Input 3 build: keyboard.o ps2.o 9 4 10 5 include $(DEPTH)make.inc -
Whitix/branches/netchannel/devices/input/keyboard.c
r955 r2084 108 108 BYTE prevScancode=0; 109 109 110 #ifdef CONFIG_DEBUG 111 extern int DebugLoop(); 112 #endif 113 110 114 static int KeyboardIrq(void* data) 111 115 { … … 144 148 isCaps=isCaps ^ true; 145 149 break; 150 151 #ifdef CONFIG_DEBUG 152 case 0x01: 153 DebugLoop(); 154 break; 155 #endif 146 156 147 157 case 0x9D: … … 221 231 return 0; 222 232 } 223 224 ModuleInit(KeyboardInit); -
Whitix/branches/netchannel/devices/input/ps2.c
r559 r2084 36 36 37 37 SYMBOL_EXPORT(Ps2Wait); 38 39 int 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 50 SYMBOL_EXPORT(Ps2WaitForData); 38 51 39 52 static int Ps2SendByte(int byte) -
Whitix/branches/netchannel/devices/input/ps2mouse.c
r1054 r2084 145 145 while (size >= sizeof(struct Ps2MousePacket)) 146 146 { 147 WAIT_ON( mouseQueue, mouseHead != mouseTail);147 WAIT_ON(&mouseQueue, mouseHead != mouseTail); 148 148 149 149 while (Ps2TryRead(data)); -
Whitix/branches/netchannel/devices/kedev/class.c
r1283 r2084 2 2 #include <devices/class.h> 3 3 #include <fs/devfs.h> 4 #include <print.h> 4 5 #include <module.h> 5 6 #include <keobject.h> … … 21 22 SYMBOL_EXPORT(DevClassCreate); 22 23 24 int DevClassLookup(char* name, struct DevClass** class) 25 { 26 KePrint("DevClassLookup\n"); 27 return 0; 28 } 29 30 SYMBOL_EXPORT(DevClassLookup); 31 23 32 int ClassInit() 24 33 { -
Whitix/branches/netchannel/devices/kedev/sdevice.c
r1283 r2084 199 199 200 200 SpinLockIrq(&requestLock); 201 ListRemove (&request->list);201 ListRemoveInit(&request->list); 202 202 SpinUnlockIrq(&requestLock); 203 203 204 204 if (status > 0) 205 205 KePrint("I/O error reading sector %u\n",request->sector); 206 206 207 207 /* BufferUnlock also wakes up the queue that's waiting for it */ 208 208 BufferUnlock(request->buffer); -
Whitix/branches/netchannel/devices/linux/dma.c
r2061 r2084 3 3 #include <print.h> 4 4 #include <typedefs.h> 5 #include <i386/virtual.h> 6 #include <pci.h> 5 7 6 8 #include "include/pci.h" 7 9 #include "include/module.h" 8 10 9 quickcall void* dma_alloc_coherent(struct device* dev, unsigned long size, void* handle, intgfp);10 void* dma_free_coherent(struct device* dev, unsigned long size, void* cpu_addr, unsigned inthandle);11 quickcall void* dma_alloc_coherent(struct device* dev, unsigned long size, void* handle, unsigned long gfp); 12 quickcall void* dma_free_coherent(struct device* dev, unsigned long size, void* cpu_addr, unsigned long handle); 11 13 quickcall unsigned long dma_map_single(struct device* hwdev, void* ptr, unsigned long size, int direction); 12 14 quickcall void dma_unmap_single(struct device* hwdev, void* ptr, unsigned long size, int direction); … … 51 53 SYMBOL_EXPORT(dma_ops); 52 54 53 quickcall void* dma_alloc_coherent(struct device* dev, unsigned long size, void* handle, intgfp)55 quickcall void* dma_alloc_coherent(struct device* dev, unsigned long size, void* handle, unsigned long gfp) 54 56 { 55 57 struct PciDevice* device = (struct PciDevice*)dev->devP; … … 63 65 SYMBOL_EXPORT(dma_alloc_coherent); 64 66 65 void* dma_free_coherent(struct device* dev, unsigned long size, void* cpu_addr, unsigned inthandle)67 quickcall void* dma_free_coherent(struct device* dev, unsigned long size, void* cpu_addr, unsigned long handle) 66 68 { 67 69 KePrint("dma_free_coherent\n"); … … 73 75 quickcall unsigned long dma_map_single(struct device* hwdev, void* ptr, unsigned long size, int direction) 74 76 { 75 DWORD virt = ptr + 0xC0000000;77 DWORD virt = (DWORD)ptr + 0xC0000000; 76 78 77 79 return VirtToPhys(virt); -
Whitix/branches/netchannel/devices/linux/eth.c
r2061 r2084 60 60 } 61 61 62 SYMBOL_EXPORT(ethtool_op_set_sg); 63 64 DWORD ethtool_op_get_sg(void* dev) 65 { 66 KePrint("ethtool_op_get_sg\n"); 67 return 0; 68 } 69 70 SYMBOL_EXPORT(ethtool_op_get_sg); 71 72 DWORD ethtool_op_get_tso(void* dev) 73 { 74 KePrint("ethtool_op_get_tso\n"); 75 return 0; 76 } 77 78 SYMBOL_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 86 SYMBOL_EXPORT(ethtool_op_set_tx_csum); 87 88 DWORD ethtool_op_get_tx_csum(void* dev) 89 { 90 KePrint("ethtool_op_get_tx_csum\n"); 91 return 0; 92 } 93 94 SYMBOL_EXPORT(ethtool_op_get_tx_csum);*/ 95 96 int 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 102 SYMBOL_EXPORT(ethtool_op_set_tx_hw_csum); 103 62 104 unsigned short eth_type_trans(void* skb, void* dev) 63 105 { … … 99 141 quickcall struct net_device* alloc_etherdev_mq(int priv, unsigned int queue_count) 100 142 { 101 struct net_device* ret = (struct net_device*)MemAlloc(sizeof(struct net_device) + priv + 100 0);143 struct net_device* ret = (struct net_device*)MemAlloc(sizeof(struct net_device) + priv + 100); 102 144 103 145 INIT_LIST_HEAD(&ret->dev_list); 104 146 INIT_LIST_HEAD(&ret->napi_list); 105 147 106 // KePrint("alloc_etherdev_mq\n"); 148 ret->addr_len = 6; 149 ret->mtu = 1492; 107 150 108 151 return ret; -
Whitix/branches/netchannel/devices/linux/include/irq.h
r2063 r2084 7 7 #include "module.h" 8 8 9 typedef quickcall void (*irq_func)(int, void* );9 typedef quickcall void (*irq_func)(int, void*, void*); 10 10 11 11 struct linux_irq -
Whitix/branches/netchannel/devices/linux/include/net.h
r2061 r2084 72 72 char name[16]; 73 73 char hlist[8]; 74 char* if alias;74 char* if_alias; 75 75 76 76 unsigned long mem_end; … … 95 95 void* get_stats; 96 96 struct net_device_stats stats; 97 98 void* wireless_handlers; 99 void* wireless_data; 97 100 98 101 void* ethtool_ops; … … 129 132 unsigned int allmulti; 130 133 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]; 137 135 138 136 unsigned long last_rx; … … 245 243 }; 246 244 245 #define __bitwise__ 246 typedef unsigned __bitwise__ gfp_t; 247 248 quickcall char* print_mac(char* mac, unsigned char* addr); 249 247 250 #endif -
Whitix/branches/netchannel/devices/linux/irq.c
r2061 r2084 3 3 #include <pci.h> 4 4 #include <print.h> 5 #include <malloc.h> 5 6 6 7 #include "include/irq.h" … … 57 58 58 59 if (entry->func) 59 entry->func(entry->irq, entry->data );60 else61 return 0;60 entry->func(entry->irq, entry->data, NULL); 61 62 return 0; 62 63 } 63 64 64 quickcall int request_irq(unsigned int irq, void (*handler)(int, void*, void*),65 quickcall int request_irq(unsigned int irq, quickcall void (*handler)(int, void*, void*), 65 66 unsigned long irqflags, const char* devname, void* devid) 66 67 { … … 73 74 entry->func = handler; 74 75 entry->data = devid; 75 76 77 KePrint("request_irq(%u)\n", irq); 78 76 79 IrqAddEntry(irq, &entry->entry); 77 80 -
Whitix/branches/netchannel/devices/linux/mem.c
r2061 r2084 8 8 quickcall void kfree(void* addr) 9 9 { 10 KePrint("kfree(%#X)\n", addr);10 // KePrint("kfree(%#X)\n", addr); 11 11 MemFree(addr); 12 12 } … … 45 45 46 46 SYMBOL_EXPORT(warn_on_slowpath); 47 48 quickcall void iounmap(void* addr) 49 { 50 KePrint("iounmap\n"); 51 } 52 53 SYMBOL_EXPORT(iounmap); 54 55 56 struct 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. */ 65 struct kmem_cache kmalloc_caches[100]; 66 67 SYMBOL_EXPORT(kmalloc_caches); -
Whitix/branches/netchannel/devices/linux/net.c
r2061 r2084 1 1 #include <console.h> 2 2 #include <module.h> 3 #include <locks.h> 3 4 #include <print.h> 4 5 #include <tasklet.h> … … 34 35 SYMBOL_EXPORT(__netif_schedule); 35 36 36 void netif_carrier_off(void* dev)37 quickcall void netif_carrier_off(void* dev) 37 38 { 38 39 KePrint("netif_carrier_off\n"); … … 41 42 SYMBOL_EXPORT(netif_carrier_off); 42 43 43 void netif_carrier_on(void* dev) 44 { 45 KePrint("netif_carrier_on\n"); 44 quickcall void netif_carrier_on(void* dev) 45 { 46 46 } 47 47 … … 66 66 skb->buffer.data = skb->buffer.start = skb->data; 67 67 skb->buffer.length = skb->len; 68 69 // KePrint("netif_receive_skb(%#X, %d)\n", skb->data, skb->len); 68 70 69 71 return EthRecv(skb->dev->ethDevice, &skb->buffer); … … 71 73 72 74 SYMBOL_EXPORT(netif_receive_skb); 75 76 int 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 } 73 84 74 85 int LinuxNetSend(struct NetDevice* device, struct NetBuffer* sockBuff) … … 76 87 struct net_device* dev = (struct net_device*)(device->priv); 77 88 struct sk_buff* skb = dev_alloc_skb(sockBuff->length); 89 int ret; 78 90 79 91 memcpy(skb->data, sockBuff->data, sockBuff->length); … … 81 93 skb->end = skb->tail = skb->head + sockBuff->length; 82 94 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; 85 102 } 86 103 87 104 struct NetDevOps linuxNetOps= 88 105 { 106 .start = LinuxNetStart, 89 107 .send = LinuxNetSend, 90 108 }; … … 93 111 quickcall int register_netdev(struct net_device* dev) 94 112 { 95 char buf[18];96 113 int ret = 0; 97 114 struct EthDevice* ethDev; 98 115 struct NetDevice* netDev; 99 100 /* Figure out offset of dev_addr */ 101 memset(dev->dev_addr, 0x22, 6); 102 116 103 117 /* Alloc in ethdev_mq */ 104 118 dev->tx_queue = (struct net_queue*)MemAlloc(sizeof(struct net_queue)); 105 119 dev->tx_queue->state = 0; 106 120 107 netDev = NetDeviceAlloc(); 121 netDev = NetDeviceAlloc(); 108 122 ethDev = dev->ethDevice = EthDeviceAlloc(netDev); 109 123 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 110 127 memcpy(ethDev->macAddress, dev->dev_addr, 6); 111 128 129 netDev->ops = &linuxNetOps; 130 netDev->priv = dev; 131 netDev->procPriv = ethDev; 132 netDev->mtu = dev->mtu; 133 112 134 EthDeviceRegister(ethDev); 113 135 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")); 121 137 122 138 return ret; … … 148 164 149 165 if (n->state & 0x1) 150 work = n->poll(n, 1 6);166 work = n->poll(n, 100); 151 167 152 168 IrqRestoreFlags(flags); … … 155 171 SYMBOL_EXPORT(__napi_schedule); 156 172 157 void dev_kfree_skb_any( void* skb)173 void dev_kfree_skb_any(struct sk_buff* skb) 158 174 { 159 175 if (!IrqsEnabled()) 160 176 { 161 KePrint("dev_kfree_skb_any: free in irq\n"); 177 // MemFree(skb->head); 178 // MemFree(skb); 162 179 }else{ 163 180 KePrint("dev_kfree_skb_any: free in normal\n"); … … 186 203 SYMBOL_EXPORT(dev_alloc_skb); 187 204 205 void* __netdev_alloc_skb(void* dev, unsigned int length, gfp_t gfp_mask) 206 { 207 KePrint("__netdev_alloc_skb\n"); 208 return NULL; 209 } 210 211 SYMBOL_EXPORT(__netdev_alloc_skb); 212 188 213 unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta) 189 214 { … … 201 226 202 227 SYMBOL_EXPORT(__vlan_hwaccel_rx); 228 229 int ___pskb_trim(void* skb, unsigned int len) 230 { 231 KePrint("___pskb_trim\n"); 232 return 0; 233 } 234 235 SYMBOL_EXPORT(___pskb_trim); 236 237 int 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 243 SYMBOL_EXPORT(pskb_expand_head); 244 245 void* kmem_cache_alloc(void* s, gfp_t gfpflags) 246 { 247 KePrint("kmem_cache_alloc\n"); 248 return NULL; 249 } 250 251 SYMBOL_EXPORT(kmem_cache_alloc); 252 253 int capable(int cap) 254 { 255 KePrint("capable\n"); 256 return 0; 257 } 258 259 SYMBOL_EXPORT(capable); 260 261 void dev_kfree_skb_irq(struct sk_buff *skb) 262 { 263 KePrint("dev_kfree_skb_irq\n"); 264 } 265 266 SYMBOL_EXPORT(dev_kfree_skb_irq); 267 268 enum 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 277 SYMBOL_EXPORT(system_state); 278 279 /* Workqueue stuff. I'll put it here for now. */ 280 int cancel_work_sync(void* work) 281 { 282 KePrint("cancel_work_sync\n"); 283 return 0; 284 } 285 286 SYMBOL_EXPORT(cancel_work_sync); 287 288 int schedule_work(void* work) 289 { 290 KePrint("schedule_work\n"); 291 return 0; 292 } 293 294 SYMBOL_EXPORT(schedule_work); 295 296 void* mem_map; 297 298 SYMBOL_EXPORT(mem_map); 299 300 int _spin_trylock(void* lock) 301 { 302 KePrint("_spin_trylock\n"); 303 return 0; 304 } 305 306 SYMBOL_EXPORT(_spin_trylock); 307 -
Whitix/branches/netchannel/devices/linux/pci.c
r2061 r2084 1 1 #include <console.h> 2 #include <malloc.h> 2 3 #include <module.h> 3 4 #include <pci.h> … … 12 13 U pci_enable_device 13 14 U pci_enable_device_mem 14 U pci_enable_msi15 15 U pci_find_capability 16 16 U pci_release_selected_regions … … 19 19 U pci_save_state 20 20 U pci_select_bars 21 U pci_set_consistent_dma_mask22 U pci_set_dma_mask23 21 U pci_set_mwi 24 22 U pcix_get_mmrbc … … 94 92 95 93 dev->dev.devP = device; 96 94 97 95 return driver->probe(dev, devId); 98 96 } … … 144 142 145 143 SYMBOL_EXPORT(pci_unregister_driver); 144 145 int pci_set_consistent_dma_mask(void* dev, QWORD mask) 146 { 147 KePrint("pci_set_consistent_dma_mask\n"); 148 return 0; 149 } 150 151 SYMBOL_EXPORT(pci_set_consistent_dma_mask); 152 153 void* pci_iomap(void* dev, int bar, unsigned long max) 154 { 155 KePrint("pci_iomap\n"); 156 return NULL; 157 } 158 159 SYMBOL_EXPORT(pci_iomap); 160 161 void* ioremap_nocache(DWORD phys_addr, unsigned long size) 162 { 163 KePrint("ioremap_nocache\n"); 164 return NULL; 165 } 166 167 SYMBOL_EXPORT(ioremap_nocache); 168 169 int pci_enable_msi(void* pdev) 170 { 171 KePrint("pci_enable_msi\n"); 172 return 0; 173 } 174 175 SYMBOL_EXPORT(pci_enable_msi); 176 177 void pci_disable_msi(void* dev) 178 { 179 KePrint("pci_disable_msi\n"); 180 } 181 182 SYMBOL_EXPORT(pci_disable_msi); 183 184 int pci_request_regions(void* dev, const char *res_name) 185 { 186 KePrint("pci_request_regions\n"); 187 return 0; 188 } 189 190 SYMBOL_EXPORT(pci_request_regions); 191 192 void pci_release_regions(void* dev) 193 { 194 KePrint("pci_release_regions\n"); 195 } 196 197 SYMBOL_EXPORT(pci_release_regions); 198 199 const char *dev_driver_string(const void* dev) 200 { 201 KePrint("dev_driver_string\n"); 202 return ""; 203 } 204 205 SYMBOL_EXPORT(dev_driver_string); 206 207 struct pci_bus; 208 209 int 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 215 SYMBOL_EXPORT(pci_bus_read_config_byte); 216 217 int 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 223 SYMBOL_EXPORT(pci_bus_write_config_word); 224 225 int 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 231 SYMBOL_EXPORT(pci_bus_write_config_dword); 232 233 int pci_set_dma_mask(void* dev, QWORD mask) 234 { 235 KePrint("pci_set_dma_mask\n"); 236 return 0; 237 } 238 239 SYMBOL_EXPORT(pci_set_dma_mask); -
Whitix/branches/netchannel/devices/linux/resource.c
r2061 r2084 7 7 quickcall void* __request_region(void* parent, unsigned long start, unsigned long n, char* name) 8 8 { 9 return 0xDEADCAFE;9 return (void*)0xDEADCAFE; 10 10 } 11 11 -
Whitix/branches/netchannel/devices/linux/timer.c
r2061 r2084 4 4 #include <timer.h> 5 5 6 #include "include/timer.h" 6 7 #include "include/module.h" 7 8 8 quickcall void init_timer(struct Timer* timer) 9 void LinuxTimerProxyFunc(void* data); 10 11 quickcall void init_timer(struct linux_timer* timer) 9 12 { 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; 12 17 } 13 18 14 19 SYMBOL_EXPORT(init_timer); 15 20 16 void mod_timer(void* timer, unsigned long expires)21 void LinuxTimerProxyFunc(void* data) 17 22 { 18 KePrint("mod_timer\n"); 23 struct linux_timer* timer = (struct linux_timer*)data; 24 timer->function(timer->data); 25 } 26 27 quickcall 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); 19 33 } 20 34 -
Whitix/branches/netchannel/devices/misc/misc.c
r1078 r2084 23 23 #include <i386/i386.h> 24 24 #include <i386/virtual.h> 25 #include <print.h> 25 26 #include <keobject.h> 26 27 #include <devices/class.h> 28 #include <i386/pit.h> 27 29 28 30 #define MISC_MAJOR 2 … … 51 53 } 52 54 55 int 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 64 SYMBOL_EXPORT(RandomGetBytes); 65 66 static int RandomRead(struct File* file, BYTE* data, DWORD size) 67 { 68 KePrint("RandomRead(%u)\n", size); 69 return 0; 70 } 71 53 72 struct FileOps nullOps={ 54 73 .write = NullWrite, … … 64 83 }; 65 84 85 struct FileOps ranOps={ 86 .read = RandomRead, 87 }; 88 66 89 struct DevClass specialClass; 67 static struct KeDevice nullDev, zeroDev, memDev ;90 static struct KeDevice nullDev, zeroDev, memDev, ranDev; 68 91 69 92 int MiscInit() … … 77 100 KeDeviceCreate(&memDev, &specialClass.set, DEV_ID_MAKE(MISC_MAJOR, 2), &memOps, 78 101 DEVICE_CHAR, "Memory"); 102 KeDeviceCreate(&ranDev, &specialClass.set, DEV_ID_MAKE(MISC_MAJOR, 3), 103 &ranOps, DEVICE_CHAR, "Random"); 79 104 80 105 return 0; -
Whitix/branches/netchannel/devices/net/Makefile
r1683 r2084 5 5 6 6 modules_install: 7 cp ne2k-pci.sys ../../CdRoot/System/Modules/Network 7 cp ne2k-pci.sys ../../CdRoot/System/Modules/Network/ne2k_pci.sys 8 8 cp pcnet.sys ../../CdRoot/System/Modules/Network 9 9 -
Whitix/branches/netchannel/devices/net/ne2k-pci.c
r1683 r2084 135 135 unsigned char rxPage, thisFrame; 136 136 struct Ne2kHeader packetHeader; 137 DWORD data; 137 138 138 139 while (++rxPacketCount < 10) … … 161 162 outb(ne2kDev->ioAddr+NE2K_CMD, NE2K_CMD_RREAD | NE2K_CMD_START); 162 163 163 *((DWORD*)&packetHeader)=ind(ne2kDev->ioAddr+NE2K_DATA); 164 data = ind(ne2kDev->ioAddr + NE2K_DATA); 165 memcpy(&packetHeader, &data, 4); 164 166 165 167 outb(ne2kDev->ioAddr+NE2K_ISR, NE2K_RDMA_COMPLETE); … … 298 300 #define CLONE_INFO(var, cName, cFlags) \ 299 301 static struct Ne2kCloneInfo var = { .name = cName, .flags = (cFlags) } 300 301 302 302 303 CLONE_INFO(chipRealTek, "RealTek RTL-8029", FDX_REALTEK); … … 311 312 CLONE_INFO(chipHoltek_HT80229, "Holtek HT80229", ONLY_32BIT_IO | FDX_HOLTEK | STOP_PG_0x60); 312 313 CLONE_INFO(chipWinBond_89C940_8c4a, "Winbond W89C940 (misprogrammed)", 0); 313 314 314 315 315 struct PciDeviceId ne2kIdTable[]= … … 528 528 KePrint("NE2K: Found %s. I/O base = %#X, irq = %u. MAC = ", ne2kDev->info->name, ioAddr, device->irq); 529 529 530 EthPrintMacAddress(ethDev );530 EthPrintMacAddress(ethDev->macAddress); 531 531 EthDeviceRegister(ethDev); 532 532 -
Whitix/branches/netchannel/devices/net/pcnet.c
r2061 r2084 184 184 static int PcNetOpen(struct NetDevice* dev) 185 185 { 186 struct PcNetDevice* pcDev = NetDevPriv(dev);186 // struct PcNetDevice* pcDev = NetDevPriv(dev); 187 187 188 188 return 0; … … 259 259 260 260 PcNetReadMacAddress(ops, ioAddr, macAddr); 261 EthPrintMacAddress( macAddr);261 EthPrintMacAddress(ethDev->macAddress); 262 262 263 263 /* Set the init block. */ -
Whitix/branches/netchannel/devices/pci/pci_core.c
r2061 r2084 82 82 DWORD n; 83 83 }u; 84 85 if (bus > 255 || dev > 255 || func > 255) 86 return -EINVAL; 84 87 85 88 u.n=0; -
Whitix/branches/netchannel/devices/pci/pci_lib.c
r1684 r2084 26 26 #include <pci.h> 27 27 #include <slab.h> 28 #include <print.h> 28 29 29 30 LIST_HEAD(pciDriverList); … … 89 90 90 91 /* 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); 92 95 93 96 return PciWriteConfigWord(device, PCI_COMMAND, command); … … 95 98 96 99 SYMBOL_EXPORT(PciEnableDevice); 100 101 static 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 } 97 115 98 116 int PciSetMaster(struct PciDevice* device) … … 103 121 return -EIO; 104 122 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; 108 132 } 109 133 -
Whitix/branches/netchannel/devices/pci/pci_mem.c
r2061 r2084 34 34 } 35 35 36 ret = VirtMapPhysPage(0xC0000000, 0xD0000000, 3);36 ret = (void*)VirtMapPhysPage(0xC0000000, 0xD0000000, 3); 37 37 38 *dmaAddr = VirtToPhys( ret);38 *dmaAddr = VirtToPhys((DWORD)ret); 39 39 40 40 return ret; -
Whitix/branches/netchannel/devices/storage/ata/ata-cd.c
r1368 r2084 248 248 249 249 IrqRestoreFlags(flags); 250 251 // printf("AtapiRead(%u)\n", request->sector); 252 250 253 251 return -SIOPENDING; 254 252 } -
Whitix/branches/netchannel/devices/storage/ata/ata.c
r1682 r2084 213 213 * on the controller. 214 214 */ 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); 222 223 223 224 return err; … … 227 228 { 228 229 struct AtaController* controller = drive->parent; 229 230 StorageEndRequest(drive->sDev, status);231 230 232 231 controller->busy = 0; … … 239 238 240 239 TimerRemove(&controller->timer); 240 241 StorageEndRequest(drive->sDev, status); 241 242 242 243 /* See if there any pending requests that another drive was waiting for. */ … … 257 258 struct AtaController* controller = (struct AtaController*)data; 258 259 259 260 260 if (!controller->busy) 261 261 return; 262 263 262 264 263 TimerRemove(&controller->timer); 265 264 -
Whitix/branches/netchannel/fs/Makefile
r977 r2084 16 16 $(MAKE) -C reiserfs modules_install 17 17 $(MAKE) -C journal modules_install 18 $(MAKE) -C icfs modules_install19 18 20 19 clean: -
Whitix/branches/netchannel/fs/devfs/devfs.c
r1365 r2084 202 202 } 203 203 204 int DevFsLookup(struct VNode** retVal,struct VNode* dir, char* name, int nameLength)204 int DevFsLookup(struct VNode** retVal,struct VNode* dir, char* name, size_t nameLength) 205 205 { 206 206 struct KeFsEntry* entry; -
Whitix/branches/netchannel/fs/ext3/ext3.h
r965 r2084 190 190 int Ext3WriteVNode(struct VNode* vNode); 191 191 int Ext3DirtyVNode(struct VNode* vNode); 192 int Ext3Lookup(struct VNode** retVal,struct VNode* dir,char* name, int nameLength);192 int Ext3Lookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 193 193 int Ext3ReadDir(struct File* file,void* dirEntries); 194 194 int Ext3BlockMap(struct VNode* vNode, DWORD block, int flags); 195 195 struct Buffer* Ext3BlockRead(struct VNode* vNode,int block, int create); 196 int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name, int nameLength);196 int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 197 197 int Ext3Truncate(struct VNode* vNode, DWORD size); 198 int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name, int nameLength);198 int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 199 199 struct 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);200 int Ext3Remove(struct VNode* dir, char* name, size_t nameLength); 201 int Ext3RemoveDir(struct VNode* dir, char* name, size_t nameLength); 202 202 203 203 int Ext3FileWrite(struct File* file,BYTE* buffer,DWORD len); -
Whitix/branches/netchannel/fs/ext3/inode.c
r1086 r2084 197 197 } 198 198 199 int Ext3FindEntry(struct VNode* dir, char* name, int nameLength, struct Ext3DirEntry** ext3Entry,199 int Ext3FindEntry(struct VNode* dir, char* name, size_t nameLength, struct Ext3DirEntry** ext3Entry, 200 200 struct Buffer** buffer) 201 201 { … … 324 324 } 325 325 326 int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name, int nameLength)326 int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 327 327 { 328 328 struct JournalHandle* handle; … … 374 374 } 375 375 376 int Ext3Remove(struct VNode* dir, char* name, int nameLength)376 int Ext3Remove(struct VNode* dir, char* name, size_t nameLength) 377 377 { 378 378 struct JournalHandle* handle; … … 398 398 } 399 399 400 int Ext3Lookup(struct VNode** retVal,struct VNode* dir,char* name, int nameLength)400 int Ext3Lookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 401 401 { 402 402 int ret; 403 403 struct Ext3DirEntry* ext3Entry; 404 404 405 ret =Ext3FindEntry(dir, name, nameLength, &ext3Entry, NULL);405 ret = Ext3FindEntry(dir, name, nameLength, &ext3Entry, NULL); 406 406 407 407 if (!ret) … … 537 537 ******************************************************************************/ 538 538 539 int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name, int nameLength)539 int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 540 540 { 541 541 struct VNode* vNode; … … 588 588 } 589 589 590 int Ext3RemoveDir(struct VNode* dir, char* name, int nameLength)590 int Ext3RemoveDir(struct VNode* dir, char* name, size_t nameLength) 591 591 { 592 592 return -ENOTIMPL; -
Whitix/branches/netchannel/fs/fat/dir.c
r1339 r2084 154 154 ***********************************************************************/ 155 155 156 int FatScanDir(struct VNode* vNode,const char* name, int nameLength,struct FatDirEntry* retVal,DWORD* vNum,DWORD* dirPos)156 int FatScanDir(struct VNode* vNode,const char* name, size_t nameLength,struct FatDirEntry* retVal,DWORD* vNum,DWORD* dirPos) 157 157 { 158 158 DWORD pos; -
Whitix/branches/netchannel/fs/fat/fat.h
r1340 r2084 165 165 }; 166 166 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);167 int FatCreate(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 168 int FatRemove(struct VNode* dir,char* name, size_t nameLength); 169 int FatLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 170 int FatRmDir(struct VNode* dir,char* name, size_t nameLength); 171 171 int FatWriteVNode(struct VNode* vNode); 172 172 int FatReadVNode(struct VNode* vNode); 173 173 int FatNameToStr(char* fat12Name,char* name); 174 int FatMkDir(struct VNode** retVal,struct VNode* dir,char* name, int nameLength);174 int FatMkDir(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 175 175 int 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);176 int FatScanDir(struct VNode* vNode,const char* name, size_t nameLength,struct FatDirEntry* retVal,DWORD* vNum,DWORD* dirPos); 177 int FatCreateShortName(struct VNode* dir,char* fatName,char* name, size_t nameLength, int* isShortName); 178 178 int FatIsLong(const char* name,int nameLength); 179 179 … … 190 190 /* Directory functions */ 191 191 int FatAddEntries(struct VNode* dir,int numEntries); 192 int FatAddName(struct VNode* dir,char* fatName,char* name, int nameLength,DWORD* vNum,int attr, int isShortName);192 int FatAddName(struct VNode* dir,char* fatName,char* name, size_t nameLength,DWORD* vNum,int attr, int isShortName); 193 193 int FatReadDir(struct File* file,void* dirEntries); 194 194 int FatGetDirEntry(struct VNode* vNode,struct FatDirEntry* dirEntry,int currPos); -
Whitix/branches/netchannel/fs/fat/vnode.c
r1344 r2084 24 24 #include <slab.h> 25 25 #include <malloc.h> 26 #include <assert.h> 26 27 #include <print.h> 27 28 … … 223 224 } 224 225 225 int FatLookup(struct VNode** retVal,struct VNode* dir,char* name, int nameLength)226 int FatLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 226 227 { 227 228 DWORD vNum=0; … … 320 321 } 321 322 322 int FatCreateShortName(struct VNode* vNode,char* fatName,char* name, int nameLength, int* isShortName)323 int FatCreateShortName(struct VNode* vNode,char* fatName,char* name, size_t nameLength, int* isShortName) 323 324 { 324 325 int i=0; … … 588 589 /* Function should be cleared up soon */ 589 590 590 int FatAddName(struct VNode* dir, char* fatName, char* name, int nameLength,591 int FatAddName(struct VNode* dir, char* fatName, char* name, size_t nameLength, 591 592 DWORD* vNum, int attr, int isShortName) 592 593 { … … 648 649 /* Creates a file */ 649 650 650 int FatCreate(struct VNode** retVal,struct VNode* dir,char* name, int nameLength)651 int FatCreate(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 651 652 { 652 653 int err; … … 666 667 #define FAT_MKDIR_SIZE 64 667 668 668 int FatMkDir(struct VNode** retVal, struct VNode* dir,char* name,int nameLength)669 int FatMkDir(struct VNode** retVal, struct VNode* dir, char* name, size_t nameLength) 669 670 { 670 671 int err; … … 738 739 } 739 740 740 int FatRemoveLongEntry(struct VNode* dir,char* name, int nameLength)741 int FatRemoveLongEntry(struct VNode* dir,char* name, size_t nameLength) 741 742 { 742 743 int err,extLen; … … 779 780 } 780 781 781 int FatRemove(struct VNode* dir,char* name, int nameLength)782 int FatRemove(struct VNode* dir,char* name, size_t nameLength) 782 783 { 783 784 struct VNode* vNode; 784 785 int err; 785 786 786 err=FatLookup(&vNode,dir,name,nameLength); 787 KeAssert(vNode->refs == 1); 788 789 err=FatLookup(&vNode, dir, name, nameLength); 787 790 788 791 if (err) 789 792 return err; 790 793 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; 799 796 SetVNodeDirty(vNode); 800 797 VNodeRelease(vNode); /* Update to disk */ … … 825 822 continue; 826 823 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)) 829 826 return 1; 830 827 } … … 833 830 } 834 831 835 int FatRmDir(struct VNode* dir,char* name, int nameLength)832 int FatRmDir(struct VNode* dir,char* name, size_t nameLength) 836 833 { 837 834 struct VNode* vNode; -
Whitix/branches/netchannel/fs/icfs/Makefile
r879 r2084 1 1 DEPTH=../../ 2 OBJS = icsetup.o info.o info_cpu.o config.o 2 OBJS = icsetup.o info.o info_cpu.o config.o icfs.o 3 3 4 build: $(OBJS) icfs.sys 5 6 modules_install: 7 cp icfs.sys ../../CdRoot/System/Modules/Filesystems 4 build: $(OBJS) 8 5 9 6 include $(DEPTH)make.inc -
Whitix/branches/netchannel/fs/icfs/config.c
r1081 r2084 37 37 } 38 38 39 int SysConfRead(char* name, BYTE* data, int size)39 int SysConfRead(char* name, char* data, int size) 40 40 { 41 41 struct KeFsEntry* entry; … … 47 47 return -ENOENT; 48 48 49 IcRead(&position, entry->file, data, size); 50 51 return 0; 49 return IcRead(&position, entry->file, (BYTE*)data, size); 52 50 } 53 51 54 int SysConfWrite(char* name, BYTE* data, int size)52 int SysConfWrite(char* name, char* data, int size) 55 53 { 56 54 struct KeFsEntry* entry; … … 58 56 59 57 entry=ConfigResolvePath(name); 60 58 61 59 if (!entry) 62 60 return -ENOENT; 63 61 64 IcWrite(&position, entry->file, data, size); 65 66 return 0; 62 return IcWrite(&position, entry->file, (BYTE*)data, size); 67 63 } 68 64 -
Whitix/branches/netchannel/fs/icfs/icfs.c
r1081 r2084 39 39 }; 40 40 41 int IcFsLookup(struct VNode** retVal, struct VNode* dir, char* name, int nameLength)41 int IcFsLookup(struct VNode** retVal, struct VNode* dir, char* name, size_t nameLength) 42 42 { 43 43 struct KeFsEntry* entry; … … 88 88 vNode->fileOps=&icFsFileOps; 89 89 90 vNode->mode =entry->type;91 90 vNode->mode = entry->type; 91 92 92 if (vNode->mode & VFS_ATTR_DIR) 93 vNode->size =KeFsDirSize(&entry->dir);93 vNode->size = KeFsDirSize(&entry->dir); 94 94 else if (vNode->mode & VFS_ATTR_FILE) 95 95 { … … 104 104 105 105 case ICFS_TYPE_STR: 106 vNode->size=strlen( iEnt->sVal);106 vNode->size=strlen((const char*)iEnt->sVal); 107 107 break; 108 108 … … 110 110 vNode->size=iEnt->size; 111 111 break; 112 112 113 case ICFS_TYPE_FUNC: 114 vNode->size = 0; /* Can't give a size. */ 115 break; 116 113 117 default: 114 KePrint(" TODO: %d\n", iEnt->type);118 KePrint("IcFsReadVNode: %d\n", iEnt->type); 115 119 } 116 120 } … … 153 157 return VfsRegisterFileSystem(&icFileSystem); 154 158 } 155 156 ModuleInit(IcFsInit); -
Whitix/branches/netchannel/fs/icfs/icfs.h
r896 r2084 4 4 #include <fs/icfs.h> 5 5 #include <typedefs.h> 6 #include <malloc.h> 6 7 7 8 /* Internal function prototypes. */ … … 11 12 DWORD IcFsGetRootId(); 12 13 14 /* Internal utility functions. */ 15 16 static inline struct IcFsEntry* IcEntryAlloc() 17 { 18 return (struct IcFsEntry*)MemAlloc(sizeof(struct IcFsEntry)); 19 } 20 13 21 #endif -
Whitix/branches/netchannel/fs/icfs/icsetup.c
r1417 r2084 13 13 return 0; 14 14 } 15 16 ModuleInit(IcInit); -
Whitix/branches/netchannel/fs/icfs/info.c
r1091 r2084 7 7 #include <print.h> 8 8 9 #include "icfs.h" 10 9 11 struct KeFsEntry root; 10 12 11 int InfoReadInt(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size)13 int InfoReadInt(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 12 14 { 13 15 DWORD copied; … … 22 24 } 23 25 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);26 int 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); 31 33 32 34 *position+=copied; … … 35 37 } 36 38 37 int InfoReadArray(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size)39 int InfoReadArray(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 38 40 { 39 41 DWORD copied; … … 48 50 } 49 51 50 int IcRead(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size) 52 int 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 68 int IcRead(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 51 69 { 52 70 switch (iEnt->type) … … 60 78 case ICFS_TYPE_BYTE: 61 79 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); 65 86 } 66 87 … … 70 91 SYMBOL_EXPORT(IcRead); 71 92 72 int IcWriteInt(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size)93 int IcWriteInt(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 73 94 { 74 95 DWORD copied; 75 96 76 97 copied=MIN(size-*position, sizeof(int)-*position); 77 78 98 memcpy(iEnt->iVal+*position, data, copied); 79 80 99 *position+=copied; 81 100 … … 83 102 } 84 103 85 int IcWrite(DWORD* position, struct IcFsEntry* iEnt, char* data, DWORD size) 104 int 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 */ 115 int 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 126 int IcWrite(DWORD* position, struct IcFsEntry* iEnt, BYTE* data, DWORD size) 86 127 { 87 128 switch (iEnt->type) … … 89 130 case ICFS_TYPE_INT: 90 131 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); 91 138 92 139 default: 93 KePrint(" TODO: %d\n", iEnt->type);140 KePrint("IcWrite: %d\n", iEnt->type); 94 141 } 95 142 … … 99 146 SYMBOL_EXPORT(IcWrite); 100 147 101 int IcFsAddIntEntry(struct KeFsEntry* dir, c har* name, int* value, DWORD permissions)148 int IcFsAddIntEntry(struct KeFsEntry* dir, const char* name, int* value, DWORD permissions) 102 149 { 103 150 struct KeFsEntry* entry; … … 109 156 entry=KeFsAddEntry(&dir->dir, name, permissions); 110 157 111 newEnt =(struct IcFsEntry*)MemAlloc(sizeof(struct IcFsEntry));158 newEnt = IcEntryAlloc(); 112 159 newEnt->type=ICFS_TYPE_INT; 113 160 newEnt->iVal=value; … … 120 167 SYMBOL_EXPORT(IcFsAddIntEntry); 121 168 122 struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, c har* name, char* str, DWORD permissions)169 struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, const char* name, char** str, DWORD permissions) 123 170 { 124 171 struct KeFsEntry* entry; … … 128 175 dir=&root; 129 176 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; 135 182 136 183 entry->file=newEnt; … … 139 186 } 140 187 141 int IcFsAddSoftLink(struct KeFsEntry* dir, char* name, 188 SYMBOL_EXPORT(IcFsAddStrEntry); 189 190 int 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 211 SYMBOL_EXPORT(IcFsAddArrayEntry); 212 213 int 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 241 SYMBOL_EXPORT(IcFsAddFuncEntry); 242 243 int IcFsAddSoftLink(struct KeFsEntry* dir, const char* name, 142 244 int (*followLink)(struct KeFsEntry**, struct KeFsEntry*)) 143 245 { … … 167 269 } 168 270 271 SYMBOL_EXPORT(IcFsCreateDir); 272 169 273 int IcFsRemoveDir(struct KeFsEntry* dir) 170 274 { … … 172 276 } 173 277 278 /* Process an array of IC attributes and add them to a particular directory. */ 279 int 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 174 331 DWORD IcFsGetRootId() 175 332 { … … 179 336 SYMBOL_EXPORT(IcFsGetRootId); 180 337 181 int Info RootCreate()338 int InfoInit() 182 339 { 183 340 KeFsInitRoot(&root); … … 185 342 return 0; 186 343 } 187 188 int InfoCpuInit();189 190 int InfoInit()191 {192 InfoRootCreate();193 194 #if 0195 InfoCreateDir(NULL, "Devices");196 InfoCpuInit();197 InfoCreateDir(NULL, "Memory");198 // InfoMemInit();199 InfoCreateDir(NULL, "Processes");200 #endif201 202 return 0;203 } -
Whitix/branches/netchannel/fs/isofs/dir.c
r1128 r2084 183 183 } 184 184 185 int IsoLookup(struct VNode** retVal,struct VNode* dir,char* name, int nameLength)185 int IsoLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 186 186 { 187 187 DWORD i=0; … … 192 192 struct IsoSbPriv* sbPriv=IsoGetSbPriv(dir->superBlock); 193 193 char aName[256]; 194 int aNameLen;194 size_t aNameLen; 195 195 196 196 while (i < dir->size) -
Whitix/branches/netchannel/fs/journal/commit.c
r885 r2084 39 39 int JournalWaitCommit(struct Journal* journal, DWORD id) 40 40 { 41 INIT_WAITQUEUE_ENTRY(waitEntry);41 WAIT_DEFINE(waitEntry); 42 42 43 43 while (id > journal->commitSequence) … … 47 47 ThrSuspendThread(currThread); 48 48 ThrSchedule(); 49 Wait RemoveFromQueue(&journal->commitWaitDone, &waitEntry);49 WaitFinishWait(&journal->commitWaitDone, &waitEntry); 50 50 } 51 51 … … 219 219 JournalUnlock(journal); 220 220 KePrint("wait: %u ", commitTrans->updates); 221 WAIT_ON( journal->waitUpdates, !commitTrans->updates);221 WAIT_ON(&journal->waitUpdates, !commitTrans->updates); 222 222 JournalLock(journal); 223 223 } -
Whitix/branches/netchannel/fs/journal/journals.c
r1338 r2084 137 137 struct Journal* journal=(struct Journal*)arg; 138 138 struct Timer commitTimer; 139 INIT_WAITQUEUE_ENTRY(commitWait);139 WAIT_DEFINE(commitWait); 140 140 141 141 INIT_WAITQUEUE_HEAD(&journal->commitWait); … … 167 167 TimerRemove(&commitTimer); 168 168 169 Wait RemoveFromQueue(&journal->commitWait, &commitWait);169 WaitFinishWait(&journal->commitWait, &commitWait); 170 170 171 171 /* Get the running transaction, if we timed out, and commit that. Check expires. */ … … 244 244 journal->flags|=JOURN_UNMOUNT; 245 245 WakeUp(&journal->commitWait); 246 WAIT_ON( journal->commitWaitDone, !journal->flags);246 WAIT_ON(&journal->commitWaitDone, !journal->flags); 247 247 248 248 if (journal->currTransaction) -
Whitix/branches/netchannel/fs/journal/transaction.c
r885 r2084 287 287 JournalUnlock(journal); 288 288 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); 290 290 JournalLock(journal); 291 291 goto repeat; -
Whitix/branches/netchannel/fs/kfs/dir.c
r1091 r2084 23 23 SYMBOL_EXPORT(KeFsDirSize); 24 24 25 struct KeFsEntry* KeFsLookupDir(struct KeFsDir* dir, char* name, int nameLength)25 struct KeFsEntry* KeFsLookupDir(struct KeFsDir* dir, char* name, size_t nameLength) 26 26 { 27 27 struct KeFsEntry* entry; … … 59 59 SYMBOL_EXPORT(KeFsLookup); 60 60 61 int KeFsReadDir(struct File* file, int (*fillDir)(void*, c har*, int, DWORD), void* dirEntries)61 int KeFsReadDir(struct File* file, int (*fillDir)(void*, const char*, size_t, DWORD), void* dirEntries) 62 62 { 63 63 struct KeFsEntry* entry; … … 128 128 SYMBOL_EXPORT(KeFsNameToDir); 129 129 130 struct KeFsEntry* KeFsAddDir(struct KeFsDir* dir, c har* name)130 struct KeFsEntry* KeFsAddDir(struct KeFsDir* dir, const char* name) 131 131 { 132 132 struct KeFsDir *newDir; … … 160 160 SYMBOL_EXPORT(KeFsAddDir); 161 161 162 struct KeFsEntry* KeFsAddEntry(struct KeFsDir* dir, c har* name, DWORD permissions)162 struct KeFsEntry* KeFsAddEntry(struct KeFsDir* dir, const char* name, DWORD permissions) 163 163 { 164 164 struct KeFsEntry* entry; -
Whitix/branches/netchannel/fs/reiserfs/dir.c
r929 r2084 1 1 #include "reiserfs.h" 2 2 3 int ReLookup(struct VNode** retVal,struct VNode* dir,char* name, int nameLength);3 int ReLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength); 4 4 int ReReadDir(struct File* file, void* dirEntries); 5 5 int ReBlockMap(struct VNode* vNode, DWORD offset, int flags); … … 40 40 } 41 41 42 int ReLookup(struct VNode** retVal,struct VNode* dir,char* name, int nameLength)42 int ReLookup(struct VNode** retVal,struct VNode* dir,char* name, size_t nameLength) 43 43 { 44 44 struct ReCpuKey key; -
Whitix/branches/netchannel/fs/vfs/bcache.c
r1687 r2084 90 90 void BufferUnlock(struct Buffer* buffer) 91 91 { 92 buffer->flags &= ~(1 <<BUFFER_LOCKED);93 WakeUp (&buffer->waitQueue);92 BitClear(&buffer->flags, BUFFER_LOCKED); 93 WakeUpAll(&buffer->waitQueue); 94 94 } 95 95 … … 99 99 { 100 100 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)); 114 102 BufferRelease(buffer); 115 103 } … … 290 278 { 291 279 struct Buffer* buff; 292 280 293 281 /* Exit early if buffer is already in memory */ 294 282 if ((buff=BlockFindBuffer(device,blockNum))) … … 518 506 } 519 507 508 #ifdef CONFIG_DEBUG 509 int 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 520 534 int BlockInit() 521 535 { -
Whitix/branches/netchannel/fs/vfs/dir.c
r1328 r2084 310 310 ***********************************************************************/ 311 311 312 int FillDir(void* entries, char* name,int nameLen,DWORD vNum)312 int FillDir(void* entries, const char* name, size_t nameLen, DWORD vNum) 313 313 { 314 314 struct FillDirInfo* dirEntries=(struct FillDirInfo*)entries; … … 524 524 } 525 525 526 int SysGetCurrDir(char* str, int size)526 int SysGetCurrDir(char* str, size_t size) 527 527 { 528 528 if (strlen(current->sCwd) > size) 529 529 return -EFAULT; /* -ETOOLONG */ 530 530 531 if (VirtCheckArea((void*)str, (DWORD)size,VER_WRITE))531 if (VirtCheckArea((void*)str, (DWORD)size, VER_WRITE)) 532 532 return -EFAULT; 533 533 534 strncpy(str, current->sCwd,size);534 strncpy(str, current->sCwd, size); 535 535 536 536 return strlen(current->sCwd); -
Whitix/branches/netchannel/fs/vfs/file.c
r1686 r2084 606 606 { 607 607 struct File* file=FileGet(fd); 608 608 609 if (UNLIKELY(!file)) 609 610 return -EBADF; … … 740 741 } 741 742 742 /* TODO: Create sync function for file operations . */743 /* TODO: Create sync function for file operations structure. */ 743 744 int SysFileSync(int fd) 744 745 { -
Whitix/branches/netchannel/fs/vfs/poll.c
r881 r2084 25 25 #include <print.h> 26 26 #include <user_acc.h> 27 #include <timer.h> 27 28 28 29 int PollAddWait(struct PollQueue* pollQueue, WaitQueue* newQueue) … … 36 37 37 38 /* And add the wait queue to the poll wait queues. */ 38 pollQueue->waitQueues[pollQueue->i++] =newQueue;39 pollQueue->waitQueues[pollQueue->i++] = newQueue; 39 40 40 41 PreemptEnable(); … … 47 48 int VfsPollFd(int fd, struct PollItem* pollItem, struct PollQueue* waitQueues) 48 49 { 49 struct File* file; 50 51 file=FileGet(fd); 50 struct File* file = FileGet(fd); 51 52 52 if (!file->fileOps || !file->fileOps->poll) 53 53 return -EINVAL; … … 96 96 for (i=0; i<numFds; i++) 97 97 { 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; 99 105 100 106 if (pollArray[i].revents > 0) … … 106 112 107 113 /* 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{ 111 117 ThrSuspendThread(currThread); 112 118 ThrSchedule(); 113 //}119 } 114 120 115 121 timeout=0; 116 122 } 117 123 124 error: 118 125 IrqSaveFlags(flags); 119 126 … … 121 128 for (i=0; i<numFds; i++) 122 129 if (pollQueue.waitQueues[i]) 123 Wait RemoveFromQueue(pollQueue.waitQueues[i], &pollQueue.waitEntries[i]);130 WaitFinishWait(pollQueue.waitQueues[i], &pollQueue.waitEntries[i]); 124 131 125 132 MemFree(pollQueue.waitEntries); -
Whitix/branches/netchannel/fs/vfs/vcache.c
r1329 r2084 376 376 { 377 377 if (vNode->lock) 378 WAIT_ON( vNode->waitQueue, vNode->lock == 0);378 WAIT_ON(&vNode->waitQueue, vNode->lock == 0); 379 379 } 380 380 … … 390 390 { 391 391 vNode->lock=0; 392 WakeUp (&vNode->waitQueue);392 WakeUpAll(&vNode->waitQueue); 393 393 } 394 394 -
Whitix/branches/netchannel/fs/vfs/vnode.c
r1327 r2084 306 306 return -ENOTIMPL; 307 307 308 blockSize =BYTES_PER_SECTOR(vNode->superBlock);308 blockSize = BYTES_PER_SECTOR(vNode->superBlock); 309 309 310 310 /* Read in PAGE_SIZE/blockSize buffers to the page. */ … … 317 317 ZeroMemory(page+(i*blockSize), blockSize); 318 318 else{ 319 buff =BlockRead(vNode->superBlock->sDevice, res);319 buff = BlockRead(vNode->superBlock->sDevice, res); 320 320 if (!buff) 321 321 { -
Whitix/branches/netchannel/include/config.h
r1693 r2084 3 3 4 4 #define CONFIG_ALL_SYMBOLS 5 /* #define CONFIG_DEBUG */ 5 6 6 #define KERN_LOG_LEVEL 5 7 #define KERN_LOG_LEVEL 7 8 #define KERNEL_ADDRESS_BASE 0xC0000000 7 9 8 10 #endif -
Whitix/branches/netchannel/include/error.h
r608 r2084 55 55 #define ECONNRESET 26 /* Connection reset by peer. */ 56 56 #define ETIMEDOUT 27 /* Operation timed out. */ 57 #define ENOROUTE 28 /* There is no route to the specified endpoint. */ 57 58 58 59 #endif -
Whitix/branches/netchannel/include/fs/bcache.h
r1045 r2084 36 36 37 37 /* Defines for dealing with flags. */ 38 #define BufferLocked(buffer) ( (buffer)->flags & (1 <<BUFFER_LOCKED))38 #define BufferLocked(buffer) (BitTest(&(buffer)->flags, BUFFER_LOCKED)) 39 39 #define BufferDirty(buffer) ((buffer)->flags & (1 << BUFFER_DIRTY)) 40 40 #define BufferJournal(buffer) ((buffer)->flags & (1 << BUFFER_JOURNAL)) -
Whitix/branches/netchannel/include/fs/exports.h
r1691 r2084 54 54 int SysUnmount(char* mountPoint); 55 55 56 int SysGetCurrDir(char* path, int len);56 int SysGetCurrDir(char* path, size_t len); 57 57 58 58 int 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 1 19 #ifndef ICFS_H 2 20 #define ICFS_H 3 21 4 22 #include <llist.h> 23 #include <keobject.h> 24 #include <typedefs.h> 5 25 6 26 #define ICFS_TYPE_INT 0 … … 9 29 #define ICFS_TYPE_FUNC 3 10 30 31 typedef int (*IcReadFunc)(struct KeObject* object, BYTE* data, unsigned long size, DWORD position); 32 typedef int (*IcWriteFunc)(struct KeObject* object, BYTE* data, unsigned long size, DWORD position); 33 34 struct 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 11 45 struct IcAttribute 12 46 { 47 int type; 48 49 IcReadFunc readFunc; 50 IcWriteFunc writeFunc; 51 13 52 int offset; 53 int perms; 54 55 const char* name; 14 56 }; 15 57 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 } 18 97 19 98 #define IC_END() \ 20 { 0,}99 { -1, NULL, NULL, -1, -1, NULL } 21 100 22 101 struct IcFsEntry 23 102 { 24 103 int type; 104 struct KeObject* owner; 105 25 106 union 26 107 { 27 108 int* iVal; 28 char* sVal;109 char** sVal; 29 110 111 /* Array entries. */ 30 112 struct 31 113 { 32 114 char* csVal; 33 int minLen, maxLen, size;115 unsigned int minLen, maxLen, size; 34 116 }; 117 118 /* Function entries. */ 119 struct IcFuncEntry entry; 35 120 }; 36 121 }; 37 122 38 123 struct 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. */ 126 int IcFsAddIntEntry(struct KeFsEntry* dir, const char* name, int* value, DWORD permissions); 127 128 struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, const char* name, char** str, DWORD permissions); 129 130 int IcFsAddArrayEntry(struct KeFsEntry* dir, const char* name, char* array, unsigned int minLen, unsigned int maxLen, unsigned int size); 131 132 int IcFsAddSoftLink(struct KeFsEntry* dir, const char* name, 42 133 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 */ 139 int IcFsAddFuncEntry(struct KeFsEntry* dir, struct KeObject* object, const char* name, IcReadFunc readFunc, IcWriteFunc writeFunc); 140 141 int IcFsRemoveDir(struct KeFsEntry* dir); 43 142 44 143 #endif -
Whitix/branches/netchannel/include/fs/kfs.h
r1690 r2084 26 26 }; 27 27 28 c har* name;28 const char* name; 29 29 }; 30 30 … … 33 33 int KeFsDirSize(struct KeFsDir* dir); 34 34 struct KeFsEntry* KeFsLookup(struct VNode* dir, char* name, int nameLength); 35 int KeFsReadDir(struct File* file, int (*fillDir)(void*, c har*, int, DWORD), void* dirEntries);36 struct KeFsEntry* KeFsAddDir(struct KeFsDir* dir, c har* name);35 int KeFsReadDir(struct File* file, int (*fillDir)(void*, const char*, size_t, DWORD), void* dirEntries); 36 struct KeFsEntry* KeFsAddDir(struct KeFsDir* dir, const char* name); 37 37 int KeFsRemoveDir(struct KeFsEntry* entry); 38 struct KeFsEntry* KeFsAddEntry(struct KeFsDir* dir, c har* name, DWORD permissions);38 struct KeFsEntry* KeFsAddEntry(struct KeFsDir* dir, const char* name, DWORD permissions); 39 39 struct KeFsDir* KeFsDirLookup(char* name, int nameLength, struct KeFsDir* dir); 40 40 struct KeFsDir* KeFsNameToDir(struct KeFsDir* dir, char** name); 41 struct KeFsEntry* KeFsLookupDir(struct KeFsDir* dir, char* name, int nameLength);41 struct KeFsEntry* KeFsLookupDir(struct KeFsDir* dir, char* name, size_t nameLength); 42 42 43 43 #endif -
Whitix/branches/netchannel/include/fs/vfs.h
r1692 r2084 138 138 struct VNodeOps* vNodeOps; 139 139 struct FileOps* fileOps; 140 struct VmAreaOps* areaOps; 140 141 struct ListHead next; 141 142 DevId devId; … … 191 192 }; 192 193 193 int FillDir(void* dirEntry, char* name,int nameLen,DWORD vNodeNum);194 int FillDir(void* dirEntry, const char* name, size_t nameLen,DWORD vNodeNum); 194 195 195 196 /* Flags to pass to block map */ … … 198 199 struct VNodeOps 199 200 { 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); 205 206 int (*permission)(struct VNode* vNode,int access); 206 207 int (*followLink)(struct VNode** retVal, struct VNode* vNode); -
Whitix/branches/netchannel/include/i386/i386.h
r1695 r2084 36 36 #define CR0_NW 0x20000000 /* No write-through */ 37 37 38 #define ARCH_STACK_TOP 0x C000000038 #define ARCH_STACK_TOP 0x80000000 39 39 #define ARCH_STACK_SIZE 4096 /* Kernel stack size */ 40 40 -
Whitix/branches/netchannel/include/keobject.h
r1092 r2084 216 216 struct KeObject* KeSetFind(struct KeSet* set, const char* name); 217 217 218 #define KeSetForEach(pos, set, object) \ 219 ListForEachEntry(pos, &set.head, object.next) 220 218 221 struct KeSubsystem 219 222 { -
Whitix/branches/netchannel/include/llist.h
r1719 r2084 62 62 { 63 63 DoListRemove(entry->prev, entry->next); 64 entry->prev = NULL;65 entry->next = NULL;66 64 } 67 65 … … 82 80 83 81 #define ListForEachEntry(pos,head,member) \ 84 for (pos=ListEntry((head)->next,typeof(*pos), member); \82 for (pos=ListEntry((head)->next,typeof(*pos), member); \ 85 83 &(pos->member) != head; \ 86 84 pos=ListEntry(pos->member.next, typeof(*pos), member)) -
Whitix/branches/netchannel/include/locks.h
r666 r2084 1 1 #ifndef LOCKS_H 2 2 #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 12 static 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 25 static inline void BitSet(volatile void* address, int bit) 26 { 27 asm volatile("" 28 "btsl %1, %0" 29 :"+m"(ADDR) 30 :"Ir"(bit)); 31 } 32 33 static inline void BitClear(volatile void* address, int bit) 34 { 35 asm volatile("" 36 "btrl %1, %0" 37 :"+m"(ADDR) 38 :"Ir"(bit)); 39 } 3 40 4 41 static inline int BitTestAndSet(volatile void* address, int bit) … … 9 46 "btsl %2, %1\n\t" 10 47 "sbbl %0, %0" 11 :"=r"(oldBit), "=m"( *(volatile long*)address)12 :" Ir"(bit) : "memory");48 :"=r"(oldBit), "=m"(ADDR) 49 :"ir"(bit) : "memory"); 13 50 14 51 return oldBit; 15 52 } 16 53 54 static 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 17 67 #endif -
Whitix/branches/netchannel/include/module.h
r2061 r2084 32 32 #include <elf.h> 33 33 #include <llist.h> 34 #include <types.h> 34 35 #include <typedefs.h> 35 36 … … 42 43 43 44 struct KernelSymbol* keSymTab; 44 int keSymTabSize;45 size_t keSymTabSize; 45 46 46 47 /* ELF specific information. */ … … 52 53 53 54 char* strTable; 54 int strTableSize;55 size_t strTableSize; 55 56 56 57 struct ElfSymbol* symTable; 57 int symTableSize;58 size_t symTableSize; 58 59 int flags; 59 60 }; -
Whitix/branches/netchannel/include/net/buffer.h
r2061 r2084 8 8 #include <llist.h> 9 9 10 #include <print.h> 11 10 12 struct NetDevice; 11 13 … … 14 16 struct ListHead next; 15 17 unsigned char* start, *data; 16 int type ;18 int type, refs; 17 19 unsigned int length; 18 20 struct NetDevice* device; 21 22 /* Pointers into the buffer */ 23 BYTE* macHeader; 24 BYTE* networkHeader; 25 BYTE* transportHeader; 19 26 }; 20 27 … … 63 70 64 71 ret->length = length; 72 ret->refs = 1; 65 73 ret->data = ret->start = (unsigned char*)MemAlloc(length); 66 74 … … 73 81 74 82 ret->length = length; 83 ret->refs = 1; 75 84 ret->data = ret->start = data; 76 85 … … 83 92 84 93 ret->length = length; 94 ret->refs = 1; 85 95 ret->data = ret->start = (unsigned char*)MemAlloc(length); 86 96 … … 90 100 static inline void NetFreeBuffer(struct NetBuffer* buffer) 91 101 { 102 if (--buffer->refs > 0) 103 return; 104 92 105 MemFree(buffer->start); 93 106 MemFree(buffer); -
Whitix/branches/netchannel/include/net/channels.h
r2061 r2084 26 26 #include <i386/i386.h> 27 27 #include <wait.h> 28 #include <fs/vfs.h> 28 29 29 30 struct ChannelHead; … … 34 35 }PACKED; 35 36 37 /* Information that kernel and user code will often need to refer to while 38 * constructing a packet */ 39 struct 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 36 48 /* Channel types. */ 37 49 #define CHANNEL_IP 0x00 38 50 39 51 #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. */ 61 struct 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 81 struct ChanSendHeader 82 { 83 unsigned int magic; 84 unsigned short length; 85 unsigned short indexFlags; 86 int ret; 87 }; 88 89 struct 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 99 struct ChannelOptions 100 { 101 int flags; 102 unsigned short sendBuffers, recvBuffers; 103 }; 104 105 106 /* Flags */ 107 108 #define CHANNEL_IGNORE_ADDRESSES 0x01 40 109 41 110 /* struct Channel … … 51 120 { 52 121 unsigned short family, type; 53 unsignedint flags;122 int flags; 54 123 55 124 struct ChannelAddr srcAddr, destAddr; 125 struct ChannelInfo info; 56 126 57 127 /* Copying data. */ 58 struct ChanMasterPage* masterPage;59 unsigned int pos, lastRead;60 128 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; 61 142 62 143 struct ListHead next; 63 144 }; 64 145 146 static inline DWORD ChanHeaderBytes(struct Channel* channel) 147 { 148 return channel->info.hwHeaderBytes; 149 } 150 151 static inline DWORD ChanSendHeaderBytes(struct Channel* channel) 152 { 153 return channel->info.sendHeaderBytes; 154 } 155 156 static inline DWORD ChanRecvHeaderBytes(struct Channel* channel) 157 { 158 return channel->info.recvHeaderBytes; 159 } 160 161 static inline DWORD ChanMaxPacketSize(struct Channel* channel) 162 { 163 return channel->info.maxPacketSize; 164 } 165 166 static inline DWORD ChanBufferSize(struct Channel* channel) 167 { 168 return ChanHeaderBytes(channel) + ChanMaxPacketSize(channel); 169 } 170 171 static inline DWORD ChanSendPages(struct Channel* channel) 172 { 173 return channel->info.numSendPages; 174 } 175 176 static inline DWORD ChanRecvPages(struct Channel* channel) 177 { 178 return channel->info.numRecvPages; 179 } 180 65 181 struct ChannelOps 66 182 { 67 struct ChannelHead* (*create)(struct Channel* channel); 183 int (*create)(struct Channel* channel, struct ChannelHead** head, struct 184 ChannelOptions* options); 68 185 int (*control)(struct Channel* channel, int code, void* data); 69 186 int (*write)(struct Channel* channel, void* data, unsigned int length); … … 72 189 }; 73 190 74 #define CHANNEL_NUM_PER_PAGE (PAGE_SIZE/sizeof(void*))75 #define CHANNEL_MAX_ITER 1076 77 /* One for sending, and one for recieving? */78 struct ChanMasterPage79 {80 void* pages[CHANNEL_NUM_PER_PAGE];81 };82 83 191 struct ChannelHead 84 192 { … … 86 194 struct ListHead head; 87 195 }; 196 197 struct Channel* ChannelAlloc(); 198 void ChannelFree(struct Channel* channel); 199 int ChannelMemorySetup(struct Channel* channel, struct ChannelOptions* options); 200 int ChanRegisterFamily(int family, struct ChannelOps* channelOps); 201 int ChannelCopyPacket(struct Channel* channel, struct NetBuffer* buffer); 202 int ChanAttachFd(struct Channel* channel); 203 204 void* ChannelMapPage(struct Channel* channel, DWORD address); 205 void ChannelUnmapPage(void* page); 88 206 89 207 typedef int (*ChanCompareFunc)(struct Channel*, struct ChannelAddr*, struct ChannelAddr*); … … 97 215 ListForEachEntry(curr, &head->head, next) 98 216 { 99 if (compare(curr, src, dest) == 0)217 if (compare(curr, src, dest) != 0) 100 218 { 101 219 ret = curr; … … 107 225 } 108 226 109 /* Flags */ 110 111 #define CHANNEL_IGNORE_ADDRESSES 0x01 227 static inline struct Channel* ChanFromVNode(struct VNode* vNode) 228 { 229 if (!vNode) 230 return NULL; 231 232 return vNode->extraInfo; 233 } 234 235 static inline struct Channel* ChanFromFile(struct File* file) 236 { 237 if (!file || !file->vNode) 238 return NULL; 239 240 return (file->vNode->extraInfo); 241 } 112 242 113 243 /* ChannelControl flags */ 114 244 #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 116 250 117 251 #endif -
Whitix/branches/netchannel/include/net/device.h
r2062 r2084 31 31 struct NetDevOps 32 32 { 33 int (*start)(struct NetDevice* device); 34 int (*buildHeader)(struct NetDevice* device, struct NetBuffer* sockBuff, void* address); 33 35 int (*send)(struct NetDevice* device, struct NetBuffer* sockBuff); 34 36 }; … … 37 39 #define NetDevPriv(dev) ((dev)->priv) 38 40 41 /* struct NetDevice - flags */ 42 #define NET_DEVICE_LOOPBACK 0x01 43 #define NET_DEVICE_RUNNING 0x02 44 39 45 struct NetDevice 40 46 { 41 47 struct KeDevice device; 48 char* infType; /* Ethernet%d, Loopback%d etc. */ 42 49 int type; /* Ethernet, wireless etc. */ 43 50 struct PciDevice* pciDev; … … 47 54 struct ChannelOps* channelOps; 48 55 unsigned long netAddress; 56 int flags; 57 58 struct ListHead next; 49 59 50 60 /* Data-link layer specifics. */ 51 61 unsigned int headerLen, addressLen; 62 unsigned int mtu; 52 63 }; 64 65 static inline struct NetDevice* NetDeviceFromObj(struct KeObject* object) 66 { 67 struct KeDevice* device = KeObjectToDevice(object); 68 return ContainerOf(device, struct NetDevice, device); 69 } 53 70 54 71 static inline unsigned int NetDevHeaderLen(struct NetDevice* device) … … 64 81 struct NetDevice* NetDeviceAlloc(); 65 82 int NetDeviceRegister(struct NetDevice* device); 83 DWORD NetDevFindMinMtu(); 84 DWORD NetDevFindMaxHeader(); 85 int NetDeviceSend(struct NetDevice* device, struct NetBuffer* buffer); 86 struct NetDevice* NetDeviceFind(); 66 87 67 88 #endif -
Whitix/branches/netchannel/include/net/eth.h
r1716 r2084 23 23 #include <typedefs.h> 24 24 25 struct sEthMac 26 { 27 BYTE c[6]; 28 }PACKED; 29 30 typedef struct sEthMac EthMac; 25 typedef char EthMac[6]; 31 26 32 27 struct EthDevice … … 36 31 }; 37 32 38 static inline unsigned char* EthDevMacAddress(struct NetDevice* device)33 static inline BYTE* EthDevMacAddress(struct NetDevice* device) 39 34 { 40 35 return ((struct EthDevice*)(device->procPriv))->macAddress; … … 55 50 int EthDeviceRegister(struct EthDevice* device); 56 51 int EthSetAddress(struct EthDevice* device, BYTE* macAddress); 57 52 int EthAddHeader(struct NetBuffer* buffer, unsigned char* srcAddr, unsigned char* dstAddr, unsigned short type); 58 53 int EthRecv(struct EthDevice* device, struct NetBuffer* buffer); 59 54 … … 66 61 } 67 62 68 static inline void EthPrintMacAddress( struct EthDevice* ethDev)63 static inline void EthPrintMacAddress(BYTE* macAddress) 69 64 { 70 65 int i; 71 66 72 67 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' : ':'); 74 69 } 75 70 -
Whitix/branches/netchannel/include/net/ipv4.h
r1715 r2084 25 25 #define IP_CHAN_LIST_MAX 64 26 26 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 27 33 /* Types of protocol in the 'protocol' field of struct IpHeader and struct Ipv4EndPoint. */ 28 #define PROTOCOL_TYPE_ICMP129 #define PROTOCOL_TYPE_TCP630 #define PROTOCOL_TYPE_UDP1734 #define IPV4_PROTOCOL_TYPE_ICMP 1 35 #define IPV4_PROTOCOL_TYPE_TCP 6 36 #define IPV4_PROTOCOL_TYPE_UDP 17 31 37 32 38 struct Ipv4EndPoint … … 34 40 DWORD address; 35 41 WORD port; 36 WORD protocol;37 42 }; 43 44 #define IPV4_PORT_ANY 0x0 45 46 #define IPV4_ALLOCATE_PORT 0x01 47 48 #define IPV4_PMAP_SIZE 2048 49 50 struct 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 66 int Ipv4ProtoRegister(int type, struct Ipv4Protocol* proto); 38 67 39 68 #define IP_VERSION(header) ((header)->versionLength >> 4) … … 65 94 { 66 95 // KePrint("IpCheckSum: odd number of bytes\n"); 96 (void)oddByte; 67 97 } 68 98 … … 73 103 } 74 104 105 struct 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 119 struct 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 131 struct RouteEntry* RouteLookup(DWORD address, struct NetDevice** dev); 132 75 133 #endif -
Whitix/branches/netchannel/include/pci.h
r2061 r2084 65 65 #define PCI_COMMAND_MEM 0x02 66 66 #define PCI_COMMAND_MASTER 0x04 67 #define PCI_LATENCY_TIMER 0x0D 67 68 #define PCI_SUBSYS_VENDOR_ID 0x2C 68 69 #define PCI_SUBSYS_ID 0x2E … … 128 129 void* PciAllocConsistent(struct PciDevice* device, unsigned int size, DWORD* dmaAddr); 129 130 131 /* Resource functions. */ 132 int PciResourceStart(struct PciDevice* device, int index); 133 130 134 #endif -
Whitix/branches/netchannel/include/print.h
r888 r2084 3 3 4 4 #include <config.h> 5 #include <stdarg.h> 5 6 6 7 #define KERN_CRITICAL "<0>" … … 10 11 #define KERN_DEBUG "<4>" 11 12 12 void KePrint(char* message, ...); 13 void KeVaPrint(const char* message, VaList args); 14 void KePrint(char* message, ...) /* __attribute__((format (printf, 1, 2))) */; 13 15 void KeSetOutput(void (*newOutput)(char*, int)); 14 16 -
Whitix/branches/netchannel/include/string.h
r1321 r2084 22 22 #include <stdarg.h> 23 23 #include <typedefs.h> 24 #include <types.h> 24 25 25 26 int strncpy(char* dest,char* src,int len); 26 27 int strncmp(const char* s1,const char* s2,int num); 27 int str len(char* str);28 s tatic inline int strcmp(const char* s1,const char* s2) {return strncmp(s1,s2,0xFFFFFFFF);}28 int strcmp(const char* s1, const char* s2); 29 size_t strlen(const char* str); 29 30 int strnicmp(const char* s1,const char* s2,int num); 30 31 char* strcat(char* s1,const char* s2); 31 32 char* strchr(char* string,int c); 32 void* memcpy(void* dest,void* src,long size); 33 void* memcpy(void* dest, const void* src, size_t size); 34 char* strcpy(char* dest, const char* src); 33 35 34 36 #if 0 … … 62 64 63 65 char* vasprintf(const char* fmt, VaList args); 66 unsigned long strlcpy(char* dest, char* src, unsigned long size); 67 int scnprintf(char* buf, unsigned long size, const char* fmt, ...); 64 68 65 69 #endif -
Whitix/branches/netchannel/include/timer.h
r2061 r2084 28 28 void (*func)(void* data); 29 29 void* data; 30 void* timer Level;30 void* timerPriv[2]; 31 31 }; 32 32 -
Whitix/branches/netchannel/include/typedefs.h
r986 r2084 22 22 #define MIN(a,b) (((a < b) ? a : b)) 23 23 #define MAX(a,b) (((a > b) ? a : b)) 24 25 #include <types.h> 24 26 25 27 /* Some i386-isms */ -
Whitix/branches/netchannel/include/vmm.h
r1323 r2084 51 51 struct VmAreaOps 52 52 { 53 int (* handleNoPage)(struct VMArea* area, DWORD address, DWORD offset);53 int (*noPage)(struct VMArea* area, DWORD address, DWORD offset); 54 54 int (*addPage)(struct VMArea* area, DWORD address); 55 55 }; … … 63 63 struct VMArea* VmLookupAddress(struct Process* process,DWORD address); 64 64 struct VMMapPage* VmLookupPage(struct VNode* vNode,DWORD offset); 65 int VmMapFilePhysPage(struct VNode* vNode, int offset, DWORD address); 65 66 struct VMMapPage* VmCreateMappedPage(DWORD offset,struct PhysPage* page); 66 67 DWORD MMapFindAddress(struct Process* process,DWORD length); … … 75 76 void VmWaitForPage(struct VMMapPage* page); 76 77 int VmFreeMappedPage(struct VNode* vNode, DWORD physAddr); 78 79 static 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 } 77 88 78 89 /* General page fault errors */ … … 95 106 /* General mmap defines */ 96 107 #define MMAP_BASE (0x800000) 97 #define MMAP_END (0xC0000000)108 #define MMAP_END KERNEL_ADDRESS_BASE 98 109 99 110 #endif -
Whitix/branches/netchannel/include/wait.h
r1689 r2084 25 25 #include <typedefs.h> 26 26 27 void KePrint(char*, ...);28 29 27 /* Uncomment this if you'd like to investigate strange wait-queue behaviour. */ 30 /* #define WAIT_DEBUG */31 28 32 29 struct WaitQueueTag … … 54 51 }; 55 52 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 } 58 58 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) \ 85 60 do{ \ 86 if ((condition)) \ 87 break; \ 88 struct WaitQueueEntry waitEntry={currThread,{NULL,NULL}}; \ 61 WAIT_DEFINE(waitEntry); \ 89 62 ThrGetThread(currThread); \ 90 63 while (1) { \ 64 WaitPrepareWait(waitQueue, &waitEntry); \ 91 65 if ((condition)) break; \ 92 WaitAddToQueue(&(waitQueue),&waitEntry); \93 66 ThrSuspendThread(currThread); \ 94 67 ThrSchedule(); /* Will return here when the thread is scheduled again */ \ 95 68 } \ 69 WaitFinishWait(waitQueue, &waitEntry); \ 96 70 ThrReleaseThread(currThread); \ 97 71 }while(0) 98 72 99 void WakeUp(WaitQueue* waitQueue); 73 #define WAIT_ON(waitQueue, condition) \ 74 do { \ 75 if (!(condition)) \ 76 PERFORM_WAIT_ON(waitQueue, condition); \ 77 }while(0) 78 79 #define SLEEP_ON(waitQueue) \ 80 do { \ 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 90 void WakeUpCommon(WaitQueue* waitQueue, int number); 91 void _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. */ 97 void WaitPrepareWait(WaitQueue* waitQueue, struct WaitQueueEntry* waitEntry); 98 void WaitFinishWait(WaitQueue* waitQueue, struct WaitQueueEntry* waitEntry); 99 100 /* Inline functions. */ 101 102 static inline void WaitAddToQueue(WaitQueue* waitQueue, struct WaitQueueEntry* waitEntry) 103 { 104 ListAddTail(&waitEntry->next, &waitQueue->list); 105 } 100 106 101 107 #endif -
Whitix/branches/netchannel/kernel/main.c
r1675 r2084 31 31 extern int ThrEarlyInit(); 32 32 extern int TimeInit(); 33 extern int UserCodeInit(); 33 34 extern int ShutdownInit(); 34 35 extern int ModulesBootLoad(); … … 40 41 extern int LoadInit(); 41 42 extern int DevFsInit(); 43 extern int IcFsInit(); 42 44 extern int DeviceInit(); 43 45 extern int MiscInit(); 44 46 extern int StartInit(); 47 extern int KeyboardInit(); 48 extern int ConsoleInit(); 45 49 46 50 void KernelMain() … … 51 55 TimeInit(); 52 56 ShutdownInit(); 57 UserCodeInit(); 53 58 54 59 /* Set up the device-related subsystems. */ … … 59 64 VfsInit(); 60 65 DevFsInit(); 66 IcFsInit(); 61 67 DeviceInit(); 68 69 ConsoleInit(); 70 KeyboardInit(); 62 71 63 72 MiscInit(); -
Whitix/branches/netchannel/kernel/module.c
r2061 r2084 140 140 } 141 141 142 struct Module* curr; 143 144 PreemptDisable(); 142 struct Module* curr, *curr2; 145 143 146 144 /* 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; 150 148 151 149 if (!curr->keSymTab) … … 160 158 { 161 159 if (!strcmp(currSym->name, name)) 162 {163 PreemptEnable();164 160 return currSym->addr; 165 }166 161 167 162 currSym++; … … 169 164 } 170 165 } 171 172 PreemptEnable();173 166 174 167 return 0; … … 271 264 } 272 265 273 void* ModuleSectionFind(struct Module* module, const char* sectionNames, const char* name, int total, int* size)266 void* ModuleSectionFind(struct Module* module, const char* sectionNames, const char* name, int total, size_t* size) 274 267 { 275 268 int i; … … 284 277 { 285 278 if (size) 286 *size =module->sectionHeaders[i].shSize;279 *size = module->sectionHeaders[i].shSize; 287 280 288 281 return (void*)(module->sectionHeaders[i].shAddr); … … 396 389 if (ModuleSymbolPrepare(module)) 397 390 return -ENOENT; 398 391 399 392 for (i=0; i<elfHeader->shEntries; i++) 400 393 { … … 423 416 char* verMagic; 424 417 void* infoAddr; 425 unsigned int infoSize;418 size_t infoSize; 426 419 427 420 modInit = ModuleSymbolFind(module, "init_module", STT_FUNC); … … 435 428 /* Find the version string of the module, and make sure the module 436 429 * is built to the kernel version we support. */ 437 verMagic = ModuleGetInfo( elfHeader->shEntries, infoAddr, infoSize, "vermagic");430 verMagic = ModuleGetInfo(module->sectionHeaders, infoAddr, infoSize, "vermagic"); 438 431 439 432 /* Version check */ -
Whitix/branches/netchannel/kernel/process.c
r1677 r2084 8 8 #include <keobject.h> 9 9 #include <user_acc.h> 10 #include <print.h> 10 11 #include <fs/icfs.h> 11 12 #include <fs/vfs.h> … … 118 119 struct KeFsEntry* dir = process->object.dir; 119 120 120 IcFsAddStrEntry(dir, "name", process->name, VFS_ATTR_READ);121 IcFsAddStrEntry(dir, "name", &process->name, VFS_ATTR_READ); 121 122 122 123 ListAddTail(&process->next,&processList); … … 217 218 int retVal=0; 218 219 219 waitEntry.thread=currThread;220 221 220 if (finishStatus) 222 221 if (VirtCheckArea(finishStatus,sizeof(int),VER_WRITE)) … … 225 224 if (pid >= 0) 226 225 { 227 process =ThrFindProcessById(pid);226 process = ThrFindProcessById(pid); 228 227 if (!process) 229 228 return -ENOENT; … … 237 236 238 237 repeat: 239 238 waitEntry.thread=currThread; 240 239 WaitAddToQueue(¤t->waitQueue, &waitEntry); 241 240 ThrSuspendThread(currThread); … … 331 330 332 331 if (current->parent) 333 WakeUp (¤t->parent->waitQueue);332 WakeUpAll(¤t->parent->waitQueue); 334 333 } 335 334 … … 345 344 * 346 345 ***********************************************************************/ 346 347 int MmapProcessRemove(struct Process*); 348 void LoadReleaseFsContext(); 347 349 348 350 void ThrProcessExit(int returnCode) … … 380 382 if (curr->state != THR_RUNNING) 381 383 { 382 KePrint("Killing waiting thread\n"); 383 cli(); hlt(); 384 KePrint("WARN: Killing waiting thread\n"); 384 385 } 385 386 -
Whitix/branches/netchannel/kernel/sched.c
r985 r2084 128 128 if (currThread && currThread->preemptCount) 129 129 { 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)); 132 132 cli(); hlt(); 133 133 } … … 141 141 * in ThrFreeThread. */ 142 142 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; 148 148 149 149 /* The only threads without a parent process are kernel threads - who … … 176 176 * contexts. 177 177 */ 178 178 179 if (prevThread != currThread) 179 180 ThrArchSwitch(prevThread,currThread); … … 183 184 184 185 SYMBOL_EXPORT(ThrSchedule); 186 187 #ifdef CONFIG_DEBUG 188 int 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 185 200 186 201 /*********************************************************************** … … 202 217 } 203 218 219 void 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 204 229 /*********************************************************************** 205 230 * -
Whitix/branches/netchannel/kernel/startup.c
r1677 r2084 10 10 11 11 extern int TaskletInit(); 12 extern int PciInit(); /* FIXME: Does it need to be here? */ 12 13 extern int NetworkInit(); 13 14 extern int ModulesBootLoad(); -
Whitix/branches/netchannel/kernel/symbols.c
r1677 r2084 28 28 29 29 #define KERNEL_BASE_ADDRESS 0x100000 30 31 /* We call SymbolsCopy before anything else. */ 30 32 #define DATA __attribute__((section(".data"))) 31 33 … … 62 64 *offset=currOffset; 63 65 *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 }70 66 71 67 return stringTable+currSym->symName; -
Whitix/branches/netchannel/kernel/timer.c
r1325 r2084 53 53 { 54 54 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; 56 56 57 curr->expires -=timer->expires;57 curr->expires -= timer->expires; 58 58 59 59 /* Add before the current timer. */ 60 DoListAdd(&timer->list, curr->list.prev,&curr->list);60 DoListAdd(&timer->list, curr->list.prev, &curr->list); 61 61 goto out; 62 62 } … … 65 65 /* Add to end of list */ 66 66 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; 68 68 69 69 ListAddTail(&timer->list, &timerList); … … 136 136 { 137 137 struct Timer* timer; 138 DWORD flags; 138 139 139 140 if (ListEmpty(&timerList)) 140 141 return; 141 142 143 IrqSaveFlags(flags); 144 142 145 /* 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 */ 145 149 146 150 // KePrint("timer->expires = %#X\n", timer->expires); … … 165 169 struct Timer timer; 166 170 167 timer.func =SleepWakeup;168 timer.expires =milliSeconds;169 timer.data =currThread;171 timer.func = SleepWakeup; 172 timer.expires = milliSeconds; 173 timer.data = currThread; 170 174 171 175 TimerAdd(&timer); 172 176 ThrSuspendThread(currThread); 173 177 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); 174 183 } 175 184 176 185 SYMBOL_EXPORT(Sleep); 186 187 /* Kernel system calls for timers */ 188 int SysTimerCreate() 189 { 190 return 0; 191 } 192 193 int SysTimerDestroy() 194 { 195 return 0; 196 } -
Whitix/branches/netchannel/kernel/wait.c
r1314 r2084 21 21 #include <task.h> 22 22 #include <wait.h> 23 #include <print.h> 23 24 24 25 /*********************************************************************** 25 26 * 26 * FUNCTION: WakeUp 27 * FUNCTION: WakeUpCommon 27 28 * 28 29 * DESCRIPTION: Wake up all threads waiting on a waitqueue. … … 34 35 ***********************************************************************/ 35 36 36 void WakeUp (WaitQueue* waitQueue)37 void WakeUpCommon(WaitQueue* waitQueue, int number) 37 38 { 38 39 struct WaitQueueEntry* curr, *curr2; … … 42 43 return; 43 44 44 SpinLock(&waitQueue->spinLock);45 46 45 ListForEachEntrySafe(curr, curr2, &waitQueue->list, next) 47 46 { 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 } 53 52 53 ListRemoveInit(&curr->next); 54 54 ThrResumeThread(curr->thread); 55 ListRemove(&curr->next);56 55 56 if (!--number) 57 return; 57 58 } 58 59 SpinUnlock(&waitQueue->spinLock);60 59 } 61 60 62 SYMBOL_EXPORT(WakeUp); 61 SYMBOL_EXPORT(WakeUpCommon); 62 63 void _WakeUp(WaitQueue* waitQueue, int number) 64 { 65 DWORD flags; 66 IrqSaveFlags(flags); 67 WakeUpCommon(waitQueue, number); 68 IrqRestoreFlags(flags); 69 } 70 71 SYMBOL_EXPORT(_WakeUp); 72 73 void 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 83 SYMBOL_EXPORT(WaitPrepareWait); 84 85 void ThrEndWait(struct Thread* thread); 86 87 void 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 99 SYMBOL_EXPORT(WaitFinishWait); -
Whitix/branches/netchannel/lib/Makefile
r973 r2084 1 1 DEPTH=../ 2 2 3 OBJS = string.o vsprintf.o bitmap.o keobject.o 3 OBJS = string.o vsprintf.o bitmap.o keobject.o usercode.o 4 4 5 5 build: $(OBJS) -
Whitix/branches/netchannel/lib/keobject.c
r1333 r2084 20 20 #include <fs/kfs.h> 21 21 #include <string.h> 22 #include <malloc.h> 22 23 #include <keobject.h> 23 24 #include <module.h> … … 25 26 #include <fs/devfs.h> 26 27 #include <fs/icfs.h> 28 #include <panic.h> 27 29 28 30 void KeObjectInit(struct KeObject* object, struct KeSet* parent) … … 102 104 int KeObjectVaAttach(struct KeObject* object, const char* name, VaList vaList) 103 105 { 104 int length;105 106 106 if (!object) 107 107 return -EFAULT; … … 149 149 struct KeObject* KeSetFind(struct KeSet* set, const char* name) 150 150 { 151 struct KeObject* curr ;151 struct KeObject* curr, *curr2; 152 152 153 SpinLock(&set->lock); 154 155 ListForEachEntry(curr, &set->head, next) 153 ListForEachEntrySafe(curr, curr2, &set->head, next) 156 154 { 157 155 const char* objName = KeObjGetName(curr); … … 161 159 162 160 if (!strcmp(name, objName)) 163 goto out;161 return curr; 164 162 } 165 163 166 curr = NULL; 167 168 out: 169 SpinUnlock(&set->lock); 170 return curr; 164 return NULL; 171 165 } 172 166 -
Whitix/branches/netchannel/lib/string.c
r2061 r2084 20 20 #include <string.h> 21 21 #include <malloc.h> 22 #include <task.h> 23 #include <console.h> 22 24 23 25 int strncpy(char* dest,char* src, int len) 24 26 { 25 27 while (*src != '\0' && len--) 26 *dest++=*src++; 28 *dest++=*src++; 27 29 28 30 while (len--) … … 38 40 unsigned char res = 0; 39 41 42 40 43 while (num) 41 44 { … … 50 53 51 54 SYMBOL_EXPORT(strncmp); 55 56 int strcmp(const char* s1, const char* s2) 57 { 58 return strncmp(s1, s2, ~0); 59 } 60 61 SYMBOL_EXPORT(strcmp); 52 62 53 63 int strnicmp(const char* s1,const char* s2,int num) … … 88 98 SYMBOL_EXPORT(stricmp); 89 99 90 int strlen(char* str)100 size_t strlen(const char* str) 91 101 { 92 102 int ret=0; -
Whitix/branches/netchannel/lib/vsprintf.c
r2061 r2084 399 399 int sprintf(char* str, const char* fmt, ...) 400 400 { 401 KePrint("sprintf");402 401 return 0; 403 402 } … … 408 407 { 409 408 VaList args; 410 int i;409 size_t i; 411 410 412 411 VaStart(args, fmt); -
Whitix/branches/netchannel/make.inc
r2061 r2084 10 10 SED = sed 11 11 override CFLAGS += -fomit-frame-pointer -ffreestanding -fno-stack-protector -fno-builtin \ 12 -nostdlib -m32 -Wall -Wextra - Os -I$(DEPTH)include -Wno-unused-parameter12 -nostdlib -m32 -Wall -Wextra -Werror -Os -I$(DEPTH)include -Wno-unused-parameter 13 13 BE_VERBOSE = 0 14 14 LD_R_FLAGS = -r -melf_i386 … … 21 21 22 22 %.o : %.c 23 @echo " CC $*.c"23 @echo " CC $*.c" 24 24 @$(CC) $(CFLAGS) -c $*.c -o $*.o 25 25 @$(CC) -MM $(CFLAGS) -c $*.c > .deps/$*.d 26 26 27 27 %.sys : %.c 28 @echo " CC $*.c (M)"28 @echo " CC $*.c (M)" 29 29 @$(CC) $(CFLAGS) -DMODULE -fno-common -c $*.c -o $*.sys 30 30 @$(CC) -MM $(CFLAGS) -DMODULE -c $*.c > .deps/$*.d … … 33 33 #gas assembly files 34 34 %.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" 37 42 38 43 ifneq ($(IGNORE_CLEAN), y) -
Whitix/branches/netchannel/memory/mmap.c
r2061 r2084 32 32 extern struct Cache* areaCache,*mapCache; 33 33 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 37 static int VmSharePage(struct VMArea* area, DWORD address) 38 { 39 return 0; 40 } 35 41 36 42 /*********************************************************************** … … 55 61 int ret; 56 62 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)) 59 65 return 0; 60 66 … … 82 88 83 89 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); 85 91 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); 87 98 88 99 if (ret) … … 90 101 } 91 102 }else{ 92 mappedPage=VmLookupPage(area->vNode,offset); 103 /* TODO: Need to handle race here? */ 104 mappedPage = VmLookupPage(area->vNode,offset); 93 105 94 106 if (!mappedPage) … … 104 116 105 117 /* Add to shared list so other read-only pages can map this page */ 106 mappedPage =VmCreateMappedPage(offset, newPage);118 mappedPage = VmCreateMappedPage(offset, newPage); 107 119 108 120 if (!mappedPage) … … 171 183 return -EFAULT; 172 184 173 174 area=VmLookupAddress(process,address); 175 185 area = VmLookupAddress(process,address); 186 176 187 /* Area of memory not currently mapped? */ 177 188 if (!area) … … 444 455 /* FIXME: Split this function up. Eight parameters is bad design. */ 445 456 446 DWORD MMapDo(struct Process* process, struct VNode* vNode,DWORD address,DWORD length,int protection,DWORD offset,int flags, struct VmAreaOps* ops)457 DWORD MMapDo(struct Process* process, struct VNode* vNode, DWORD address, DWORD length, int protection, DWORD offset, int flags, struct VmAreaOps* ops) 447 458 { 448 459 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); 449 463 450 464 if (!process || !length || !area) … … 478 492 flags |= MMAP_ANON; 479 493 } 494 495 /* Used for mapping data channels */ 496 if (!ops && vNode->areaOps) 497 ops = vNode->areaOps; 480 498 481 499 /* Fill in the new structure */ … … 630 648 if (fd != -1 && !(file=FileGet(fd))) 631 649 return 0; 632 650 633 651 if (file) 634 vNode =file->vNode;652 vNode = file->vNode; 635 653 636 654 return MMapDo(current, vNode, PAGE_ALIGN(address), … … 780 798 781 799 int VmInit(); 800 int ShMemInit(); 782 801 783 802 int MMapInit() -
Whitix/branches/netchannel/memory/pg_alloc.c
r1348 r2084 31 31 #include <console.h> 32 32 #include <sections.h> 33 #include <symbols.h> 33 34 #include <module.h> 35 #include <locks.h> 34 36 #include <panic.h> 35 37 #include <print.h> 38 #include <addresses.h> 36 39 37 40 static BYTE* allocatedBitmap; … … 52 55 53 56 /* 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) 55 59 struct PhysPage* pageArrayPtr=(struct PhysPage*)(PSTACK_START_ADDRESS); 56 60 … … 58 62 int PageEarlyInit(DWORD endPfn) 59 63 { 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); 70 70 71 71 /* Reserve the first page of memory. Important structures may be stored there. */ … … 73 73 74 74 /* 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); 76 76 77 77 /* 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)); 79 79 80 80 /* 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))))), 83 83 ((maxPfn+1023) >> 10)*sizeof(WaitQueue)); 84 84 … … 90 90 /* 91 91 * 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. 93 93 */ 94 94 … … 99 99 isa.numPages=0; 100 100 INIT_LIST_HEAD(&isa.list); 101 101 102 for (i=0; i<isa.maxPages; i++) 102 103 { 103 104 /* Free, can push onto stack */ 104 105 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); 108 110 ++isa.numPages; 109 111 } … … 116 118 { 117 119 normal.maxPages=maxPfn-4096; 118 /* Go through normal memory and it's bitmap andpush onto stack */120 /* Go through normal memory and push onto stack */ 119 121 for (i=4096; i<maxPfn; i++) 120 122 { 121 123 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 } 125 130 } 126 131 } … … 147 152 IrqSaveFlags(flags); 148 153 149 page=ListEntry(stack->list.next,struct PhysPage,list); 154 page=ListEntry(stack->list.next,struct PhysPage,list); 155 150 156 --stack->numPages; 151 157 ListRemove(stack->list.next); 152 153 page->refs=1;154 155 158 IrqRestoreFlags(flags); 156 159 … … 168 171 { 169 172 struct PhysPage* page; 170 171 // KePrint("pages left = %u\n", normal.numPages+isa.numPages);172 173 173 174 /* Allocate from the normal page stack first, and then the ISA stack */ … … 185 186 { 186 187 /* Just allocate from the ISA stack */ 187 if ( !isa.numPages)188 if (isa.numPages < 5) 188 189 KernelPanic("System out of memory"); 189 190 … … 198 199 IrqSaveFlags(flags); 199 200 200 page->refs=0xDEADBEEF; /* Marker value */201 201 ++stack->numPages; 202 202 … … 240 240 241 241 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!"); 246 243 247 244 /* Set all the pages as allocated */ 248 245 while (size) 249 246 { 250 B mapSetBit(allocatedBitmap,(start >> 12),true);247 BitSet(allocatedBitmap, (start >> 12)); 251 248 start+=PAGE_SIZE; 252 249 size-=PAGE_SIZE; -
Whitix/branches/netchannel/memory/shmem.c
r2061 r2084 45 45 struct VmAreaOps shMemOps= 46 46 { 47 . handleNoPage = ShMemNoPage,47 .noPage = ShMemNoPage, 48 48 .addPage = ShMemAddPage, 49 49 }; … … 85 85 shDesc->size=PAGE_ALIGN_UP(size); 86 86 shDesc->pages=(DWORD*)MemAlloc(sizeof(DWORD)*numPages); 87 88 KePrint("size = %u\n", size);89 87 90 88 if (!shDesc->pages) … … 143 141 int ShMemAddPage(struct VMArea* area, DWORD address) 144 142 { 143 #if 0 145 144 struct SharedMemoryDesc* shMem=ShMemFind(area->length); 146 145 int pageIndex=(address-area->start) >> PAGE_SHIFT; 147 146 148 KePrint("pageIndex = %d\n", pageIndex);149 150 147 if (!shMem) 151 148 return -EFAULT; 152 149 153 150 while (1); 151 #endif 154 152 155 153 return 0; -
Whitix/branches/netchannel/memory/slab.c
r1349 r2084 38 38 39 39 /* General slab limits */ 40 #define SLAB_START 0xC000000041 #define SLAB_END 0xD000000040 #define SLAB_START (KERNEL_ADDRESS_BASE + 0x100000) 41 #define SLAB_END (KERNEL_ADDRESS_BASE + 0x8000000) 42 42 43 43 /* How many bytes can fit in a cache? */ … … 141 141 else 142 142 /* 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); 145 145 } 146 146 … … 167 167 168 168 /* 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)); 170 170 cli(); hlt(); 171 171 } … … 315 315 currSlab->isFull=1; 316 316 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); 319 319 320 320 IrqRestoreFlags(flags); -
Whitix/branches/netchannel/memory/vmm.c
r1347 r2084 113 113 /*********************************************************************** 114 114 * 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. 123 125 * 124 126 ***********************************************************************/ … … 126 128 struct VMMapPage* VmCreateMappedPage(DWORD offset, struct PhysPage* page) 127 129 { 128 struct VMMapPage* mappedPage =(struct VMMapPage*)MemCacheAlloc(mapCache);130 struct VMMapPage* mappedPage = (struct VMMapPage*)MemCacheAlloc(mapCache); 129 131 130 132 if (!mappedPage) 131 133 return NULL; 132 134 133 mappedPage->offset =offset;134 mappedPage->page =page;135 mappedPage->offset = offset; 136 mappedPage->page = page; 135 137 136 138 return mappedPage; … … 193 195 { 194 196 WaitQueue* waitQueue; 195 INIT_WAITQUEUE_ENTRY(waitEntry);197 WAIT_DEFINE(waitEntry); 196 198 197 199 waitQueue=PageGetWaitQueue(page->page); 198 199 // KePrint("Waiting on %#X\n", page->page->physAddr);200 200 201 201 PageGet(page->page); … … 256 256 { 257 257 page->flags &= ~(1 << PAGE_LOCKED); 258 WakeUp (PageGetWaitQueue(page->page));258 WakeUpAll(PageGetWaitQueue(page->page)); 259 259 } 260 260 -
Whitix/branches/netchannel/net/Makefile
r2061 r2084 1 1 DEPTH=../ 2 OBJS = network.o device.o eth.o 2 OBJS = network.o device.o eth.o arp.o 3 3 IGNORE_CLEAN = y 4 4 -
Whitix/branches/netchannel/net/channels/Makefile
r2066 r2084 1 1 DEPTH=../../ 2 OBJS = file.o memory.o sys.o recv.o init.o 2 OBJS = file.o memory.o sys.o recv.o init.o userlib.o 3 3 4 4 build: $(OBJS) -
Whitix/branches/netchannel/net/channels/file.c
r2061 r2084 22 22 #include <net/channels.h> 23 23 #include <module.h> 24 #include <locks.h> 24 25 #include <print.h> 25 26 #include <sys.h> 26 27 #include <fs/vfs.h> 27 28 #include <task.h> 28 29 static inline struct Channel* ChanFromFile(struct File* file) 30 { 31 return (file->vNode->extraInfo); 32 } 29 #include <vmm.h> 33 30 34 31 int ChanRead(struct File* file, BYTE* data, DWORD size); 35 32 int ChanWrite(struct File* file, BYTE* data, DWORD size); 36 int Chan MemoryMap(struct VNode* vNode, DWORD address, DWORD offset);33 int ChanPoll(struct File* file, struct PollItem* item, struct PollQueue* pollQueue); 37 34 int ChanClose(struct File* file); 35 int ChanMapNoPage(struct VMArea* area, DWORD address, DWORD offset); 38 36 39 37 struct FileOps channelFileOps = … … 41 39 .read = ChanRead, 42 40 .write = ChanWrite, 43 . mMap = ChanMemoryMap,41 .poll = ChanPoll, 44 42 .close = ChanClose, 43 }; 44 45 struct VmAreaOps channelAreaOps = 46 { 47 .noPage = ChanMapNoPage, 45 48 }; 46 49 … … 63 66 file->vNode = VNodeGetEmpty(); 64 67 file->fileOps = file->vNode->fileOps = &channelFileOps; 68 file->vNode->areaOps = &channelAreaOps; 65 69 file->vNode->mode = VFS_ATTR_RW | VFS_ATTR_FILE; 66 70 67 71 file->vNode->superBlock = &chanSuperBlock; 68 72 file->vNode->extraInfo=(void*)channel; 73 channel->file = file; 69 74 70 75 return fd; … … 73 78 int ChanRead(struct File* file, BYTE* data, DWORD size) 74 79 { 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; 95 82 } 96 83 … … 98 85 { 99 86 struct Channel* channel = ChanFromFile(file); 100 87 struct ChanSendHeader* header = (struct ChanSendHeader*)data; 88 int ret; 89 struct VMArea* area; 90 101 91 if (!channelOps[channel->family]) 102 92 return -EINVAL; … … 104 94 if (!channelOps[channel->family]->write) 105 95 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 122 int 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; 108 133 } 109 134 … … 111 136 { 112 137 struct Channel* channel = ChanFromFile(file); 113 114 138 ListRemove(&channel->next); 115 116 139 return 0; 117 140 } 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 28 28 29 29 extern struct SysCall channelSysCalls[]; 30 extern int ChannelUserCodeInit(); 30 31 31 32 int ChannelInit() … … 36 37 SysRegisterRange(SYS_CHANNEL_BASE, channelSysCalls); 37 38 39 ChannelUserCodeInit(); 40 38 41 return 0; 39 42 } -
Whitix/branches/netchannel/net/channels/memory.c
r2061 r2084 23 23 #include <module.h> 24 24 #include <print.h> 25 #include <vmm.h> 25 26 #include <sys.h> 26 27 #include <task.h> 27 28 #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 33 void* ChannelMapPage(struct Channel* channel, DWORD address); 34 35 /* Allocation map functions */ 36 struct 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); 33 64 34 masterPage = (struct ChanMasterPage*)MemAlloc(sizeof(struct ChanMasterPage)); 65 return (struct ChanRecvHeader*)(channel->pages[index] + offset); 66 } 67 68 void* ChannelMapPage(struct Channel* channel, DWORD address) 69 { 70 return (void*)VirtAllocateTemp(address); 71 } 72 73 void ChannelUnmapPage(void* page) 74 { 75 VirtUnmapPhysPage((DWORD)page); 76 } 77 78 static 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 89 static void ChanSendHeaderInit(struct Channel* channel, struct ChanSendHeader* 90 header, int i) 91 { 92 header->magic = CHAN_SEND_MAGIC; 93 ChanSetIndex(header, i); 94 } 95 96 int 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 } 35 108 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); 47 113 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; 52 121 53 if (!channel->masterPage->pages[pos])122 while (offset < (i*PAGE_SIZE)) 54 123 { 55 channel->masterPage->pages[pos] = buffer; 56 channel->pos = pos+1; 57 WakeUp(&channel->waitQueue); 58 return 0; 124 buffIndex++; 125 offset += bufferSize; 59 126 } 60 127 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 { 62 139 } 63 64 return -ENOMEM; 140 141 return 0; 142 } 143 144 int 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; 65 170 } 66 171 67 172 SYMBOL_EXPORT(ChannelCopyPacket); 173 174 int 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 */ 219 struct Channel* ChannelAlloc() 220 { 221 return (struct Channel*)MemAlloc(sizeof(struct Channel)); 222 } 223 224 void ChannelFree(struct Channel* channel) 225 { 226 MemFree(channel); 227 } -
Whitix/branches/netchannel/net/channels/recv.c
r2066 r2084 45 45 46 46 if (ops && ops->recvBuffer) 47 if (UNLIKELY(ops->recvBuffer(buffer) == 0))47 if (UNLIKELY(ops->recvBuffer(buffer) == CHAN_NOT_HANDLED)) 48 48 ops = NULL; 49 49 … … 52 52 int i; 53 53 54 55 54 for (i = 0; i < CHANNEL_MAX; i++) 56 55 { 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) 60 58 break; 61 59 } 62 60 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) 71 62 buffer->device->channelOps = channelOps[i]; 72 }73 63 } 74 64 -
Whitix/branches/netchannel/net/channels/sys.c
r2061 r2084 29 29 extern struct ChannelOps* channelOps[CHANNEL_MAX]; 30 30 31 int NetChannelCreate(int chnType, void* source, void* dest, struct 32 ChannelOptions* info) 33 { 34 /* TODO */ 35 return 0; 36 } 37 31 38 #define CHAN_TYPE_TO_FAMILY(type) ((type) >> 16) 32 39 33 int SysChannelCreate(int chnType, void* source, void* dest, int flags) 40 int SysChannelCreate(int chnType, void* source, void* dest, struct 41 ChannelOptions* options) 34 42 { 35 43 struct ChannelOps* type; … … 37 45 struct ChannelHead* head; 38 46 int family = CHAN_TYPE_TO_FAMILY(chnType); 47 int ret; 39 48 40 49 if (family > CHANNEL_MAX || !channelOps[family]) … … 44 53 45 54 /* Allocate channels, and run the family-specific code. */ 46 channel = (struct Channel*)MemAlloc(sizeof(struct Channel));55 channel = ChannelAlloc(); 47 56 48 57 channel->family = family; 49 58 channel->type = (chnType & 0xFFFF); 50 channel->flags = flags;51 59 52 60 /* user memcpy? */ … … 56 64 if (type->create) 57 65 { 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 66 76 /* 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); 70 80 INIT_WAITQUEUE_HEAD(&channel->waitQueue); 71 81 72 82 /* Copy address back to memcpy, in case they've changed. For example, 73 83 * the Ipv4 code allocates source ports if the application requires … … 77 87 } 78 88 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 97 freeChannel: 98 MemFree(channel); 99 return ret; 80 100 } 81 101 82 102 int SysChannelControl(int chnFd, int code, void* data) 83 103 { 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 84 137 return -ENOTIMPL; 85 138 } -
Whitix/branches/netchannel/net/device.c
r2061 r2084 24 24 #include <slab.h> 25 25 #include <fs/devfs.h> 26 #include <fs/icfs.h> 26 27 27 28 struct Cache* netDeviceCache; 28 29 /* Only one device for now! TODO: Add support for multiple devices. */30 struct NetDevice* currDevice = NULL;31 32 29 struct DevClass networkClass; 33 34 /* For now */35 SYMBOL_EXPORT(currDevice);36 30 37 31 struct NetDevice* NetDeviceAlloc() … … 42 36 SYMBOL_EXPORT(NetDeviceAlloc); 43 37 38 int NetDeviceGetRunning(struct KeObject* object, BYTE* data, unsigned long size, DWORD position) 39 { 40 return 0; 41 } 42 43 int 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 44 74 int NetDeviceRegister(struct NetDevice* device) 45 { 46 currDevice=device; 47 75 { 48 76 KeDeviceInit(&device->device, &networkClass.set, 0, NULL, DEVICE_CHAR); 49 77 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 52 83 return 0; 53 84 } … … 57 88 int NetDeviceSend(struct NetDevice* device, struct NetBuffer* buffer) 58 89 { 90 int ret; 91 59 92 if (!device->ops || !device->ops->send) 60 93 return -ENOTIMPL; 61 94 95 ret = device->ops->send(device, buffer); 96 97 if (ret) 98 return ret; 99 else 100 return buffer->length; 101 62 102 // if (device-> state & NET_DEVICE_QUEUE_RUNNING) 63 return device->ops->send(device, buffer);64 103 // else{ 65 104 /* Add the packet onto the queue, and wait for the device to pick … … 72 111 SYMBOL_EXPORT(NetDeviceSend); 73 112 113 DWORD 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 127 SYMBOL_EXPORT(NetDevFindMinMtu); 128 129 DWORD 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 143 SYMBOL_EXPORT(NetDevFindMaxHeader); 144 145 struct 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 160 SYMBOL_EXPORT(NetDeviceFind); 161 74 162 int NetDeviceInit() 75 163 { -
Whitix/branches/netchannel/net/eth.c
r2061 r2084 17 17 */ 18 18 19 #include <net/arp.h> 19 20 #include <net/device.h> 20 21 #include <net/byteswap.h> … … 40 41 SYMBOL_EXPORT(EthDeviceAlloc); 41 42 43 int 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 42 60 int EthDeviceRegister(struct EthDevice* device) 43 61 { 44 62 int ret; 45 63 struct KeFsEntry* dir; 64 struct NetDevice* netDev = device->dev; 46 65 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); 48 80 49 81 if (ret) … … 51 83 52 84 /* TODO: Use proper IcFs attributes. */ 53 dir = KeDeviceGetConfDir(& device->dev->device);85 dir = KeDeviceGetConfDir(&netDev->device); 54 86 55 87 /* 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 63 91 return 0; 64 92 } … … 103 131 header->type = NetToHostShort(type); 104 132 105 NetBufferPush(buffer, sizeof(struct EthHeader));106 107 133 return 0; 108 134 } -
Whitix/branches/netchannel/net/ipv4/Makefile
r2064 r2084 1 1 DEPTH=../../ 2 MODULES = init.sys arp.sys icmp.sys2 MODULES = init.sys icmp.sys loopback.sys route.sys port.sys udp.sys tcp.sys 3 3 4 4 build: $(MODULES) -
Whitix/branches/netchannel/net/ipv4/icmp.c
r2064 r2084 11 11 #include <net/eth.h> 12 12 13 #include "ipv4.h" 14 13 15 #define ICMP_ECHO_REPLY 0 14 16 #define ICMP_ECHO_REQUEST 8 17 18 struct ChannelHead icmpChannelHead; 15 19 16 20 struct IcmpHeader … … 27 31 }PACKED; 28 32 33 struct IcmpHeader* NetBuffIcmpHeader(struct NetBuffer* buffer) 34 { 35 return (struct IcmpHeader*)(buffer->transportHeader); 36 } 37 29 38 struct KeTasklet icmpTasklet; 30 39 31 40 LIST_HEAD(icmpPacketList); 32 41 42 void 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 54 WORD 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 67 int 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 33 79 int IcmpRecvBuffer(struct NetBuffer* buffer) 34 80 { … … 36 82 37 83 header = (struct IcmpHeader*)(buffer->data + sizeof(struct IpHeader)); 38 84 39 85 switch (header->message) 40 86 { 41 87 case ICMP_ECHO_REQUEST: 42 88 if (header->code != 0) 89 { 90 IP_DEBUG(("Invalid header code %u", header->code)); 43 91 return -EINVAL; 92 } 44 93 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 } 46 99 47 100 /* If there are more fragments set, or frame offset != 0, discard. 48 101 * Don't want to deal with IP fragmentation in the kernel, and 49 102 * ICMP echo requests shouldn't go to userspace. 103 * 104 * Actually, Linux only replies to the first packet! 50 105 */ 51 106 … … 56 111 57 112 break; 113 114 default: 115 IcmpCopyToChannels(buffer); 116 break; 58 117 } 59 118 60 return 1;119 return CHAN_HANDLED; 61 120 } 62 121 … … 73 132 74 133 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)); 79 142 80 143 memcpy(replyIp, ipHeader, sizeof(struct IpHeader)); … … 84 147 85 148 /* 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)); 87 151 88 152 memcpy(replyIcmp, icmpHeader, totalLength - sizeof(struct IpHeader)); … … 91 155 replyIcmp->code = 0; 92 156 replyIcmp->checkSum = 0; 93 replyIcmp->checkSum = IpCheckSum( replyIcmp, totalLength - sizeof(struct IpHeader));157 replyIcmp->checkSum = IpCheckSum((WORD*)replyIcmp, totalLength - sizeof(struct IpHeader)); 94 158 95 159 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); 98 164 } 99 165 … … 113 179 IcmpEchoReply(curr); 114 180 break; 181 182 default: 183 IP_DEBUG(("Unrecognised type %u", header->message)); 115 184 } 116 185 … … 121 190 } 122 191 192 struct ChannelHead* IcmpChannelHash(struct Ipv4EndPoint* src, struct 193 Ipv4EndPoint* dest) 194 { 195 return &icmpChannelHead; 196 } 197 198 struct Ipv4Protocol icmpProto = 199 { 200 name : "ICMP", 201 rawProtocol : IPV4_PROTOCOL_TYPE_ICMP, 202 hash : IcmpChannelHash, 203 }; 204 123 205 int IcmpInit() 124 206 { … … 128 210 TaskletAdd(&icmpTasklet); 129 211 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 10 10 #include <net/eth.h> 11 11 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 14 extern struct ChannelHead icmpChannelHeads[IP_CHAN_LIST_MAX]; 15 16 static struct Ipv4Protocol* protocols[IPV4_NUM_PROTOCOLS]; 17 18 int 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 */ 40 56 }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) 67 85 return -EFAULT; 68 69 return head;86 87 return 0; 70 88 } 71 89 … … 73 91 { 74 92 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.. */ 76 100 netBuff = NetAllocSendBuffer(data, length); 77 101 78 102 if (!netBuff) 79 103 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; 102 125 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); 107 158 } 108 159 … … 129 180 * have a valid checksum. */ 130 181 if (IP_VERSION(ipHeader) != 4) 182 { 183 IP_DEBUG(("not IPV4? version = %d", IP_VERSION(ipHeader))); 131 184 return -EINVAL; 132 133 /* CHECKSUM */ 185 } 186 187 /* TODO: IP CHECKSUM */ 134 188 135 189 /* TODO: More checks, see if packet is long enough */ 136 190 switch (ipHeader->protocol) 137 191 { 138 case PROTOCOL_TYPE_ICMP:192 case IPV4_PROTOCOL_TYPE_ICMP: 139 193 break; 140 194 141 case PROTOCOL_TYPE_TCP:142 case PROTOCOL_TYPE_UDP:195 case IPV4_PROTOCOL_TYPE_TCP: 196 case IPV4_PROTOCOL_TYPE_UDP: 143 197 Ipv4GetPorts(buffer, src, dest); 144 198 break; … … 148 202 return -EINVAL; 149 203 } 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; 170 206 } 171 207 … … 175 211 struct IpHeader* header = (struct IpHeader*)(buffer->data); 176 212 177 return (header->protocol == PROTOCOL_TYPE_ICMP); 213 return (header->protocol == IPV4_PROTOCOL_TYPE_ICMP); 214 } 215 216 int Ipv4ArpRequest(struct NetBuffer* buffer); 217 int IcmpRecvBuffer(struct NetBuffer* buffer); 218 219 static 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; 178 232 } 179 233 … … 183 237 struct ChannelHead* head = NULL; 184 238 struct Channel* channel; 185 239 struct Ipv4Protocol* proto; 240 struct IpHeader* ipHeader; 186 241 ChanCompareFunc func = NULL; 187 242 188 struct IpHeader*ipHeader = (struct IpHeader*)(buffer->data);243 ipHeader = (struct IpHeader*)(buffer->data); 189 244 190 245 if (buffer->type == ETH_ARP) … … 192 247 193 248 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? */ 196 252 if (Ipv4GetInfo(buffer, &src, &dest) < 0) 197 return 0;253 return CHAN_NOT_HANDLED; 198 254 199 255 if (Ipv4IsIcmpPacket(buffer)) 200 256 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); 213 272 214 273 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. */ 217 285 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 294 int 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 309 WORD 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; 221 330 } 222 331 223 332 struct ChannelOps ipv4Ops = 224 333 { 225 .create = Ipv4Create ,334 .create = Ipv4CreateChannel, 226 335 .write = Ipv4Write, 227 336 .recvBuffer = Ipv4RecvBuffer, 228 337 }; 229 338 339 int ArpInit(); 340 int IcmpInit(); 341 int UdpInit(); 342 int TcpInit(); 343 int LoopbackInit(); 344 int RouteInit(); 345 230 346 int IpInit() 231 347 { 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(); 233 359 234 360 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 248 362 return 0; 249 363 } -
Whitix/branches/netchannel/net/network.c
r2061 r2084 22 22 #include <typedefs.h> 23 23 #include <print.h> 24 #include <fs/icfs.h> 25 26 struct KeFsEntry* netRoot; 27 28 int NetworkIcFsInit() 29 { 30 netRoot = IcFsCreateDir(NULL, "Network"); 31 32 return 0; 33 } 34 35 struct KeFsEntry* NetworkIcFsGetRoot() 36 { 37 return netRoot; 38 } 39 40 SYMBOL_EXPORT(NetworkIcFsGetRoot); 24 41 25 42 /*********************************************************************** … … 38 55 int EthInit(); 39 56 int NetDeviceInit(); 57 int ChannelInit(); 40 58 41 59 int NetworkInit() … … 46 64 47 65 EthInit(); 66 67 NetworkIcFsInit(); 48 68 49 69 return ChannelInit(); -
Whitix/branches/netchannel/user/burn/main.c
r1381 r2084 428 428 char* buffer; 429 429 char promptPrint[PATH_MAX]; 430 430 431 431 /* If a -c option is passed, execute the following parameters and quit */ 432 432 char* command = NULL; -
Whitix/branches/netchannel/user/grub/menu.lst
r1360 r2084 6 6 title Whitix 0.2 CD 7 7 kernel --no-mem-option --type=multiboot /Boot/Kernel root=AtaCd0 8 module /System/Modules/Core/console.sys9 8 module /System/Modules/Core/cdfs.sys 10 9 module /System/Modules/Core/ata_ide.sys -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-boot.Po
r2061 r2084 1 1 libgrub_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.hfreebsd.h imgact_aout.h i386-elf.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-builtins.Po
r2061 r2084 1 1 libgrub_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.h2 /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 16 16 17 17 /usr/include/stdio.h: 18 18 19 19 /usr/include/features.h: 20 21 /usr/include/bits/predefs.h: 20 22 21 23 /usr/include/sys/cdefs.h: … … 27 29 /usr/include/gnu/stubs-32.h: 28 30 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: 30 32 31 33 /usr/include/bits/types.h: … … 39 41 /usr/include/wchar.h: 40 42 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: 42 44 43 45 /usr/include/bits/stdio_lim.h: … … 59 61 /usr/include/ncurses_dll.h: 60 62 63 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 64 61 65 /usr/include/unctrl.h: 62 66 63 67 /usr/include/curses.h: 64 65 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:66 68 67 69 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-char_io.Po
r2061 r2084 1 1 libgrub_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.hhercules.h serial.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-cmdline.Po
r2061 r2084 1 1 libgrub_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 15 14 16 15 shared.h: … … 28 27 /usr/include/features.h: 29 28 29 /usr/include/bits/predefs.h: 30 30 31 /usr/include/sys/cdefs.h: 31 32 … … 36 37 /usr/include/gnu/stubs-32.h: 37 38 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: 39 40 40 41 /usr/include/bits/types.h: … … 48 49 /usr/include/wchar.h: 49 50 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: 51 52 52 53 /usr/include/bits/stdio_lim.h: … … 58 59 /usr/include/bits/stdio2.h: 59 60 61 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 62 60 63 /usr/include/unctrl.h: 61 64 62 65 /usr/include/curses.h: 63 66 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 66 67 mb_header.h: 67 68 -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-common.Po
r2061 r2084 1 1 libgrub_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 15 14 16 15 shared.h: … … 28 27 /usr/include/features.h: 29 28 29 /usr/include/bits/predefs.h: 30 30 31 /usr/include/sys/cdefs.h: 31 32 … … 36 37 /usr/include/gnu/stubs-32.h: 37 38 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: 39 40 40 41 /usr/include/bits/types.h: … … 48 49 /usr/include/wchar.h: 49 50 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: 51 52 52 53 /usr/include/bits/stdio_lim.h: … … 58 59 /usr/include/bits/stdio2.h: 59 60 61 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 62 60 63 /usr/include/unctrl.h: 61 64 62 65 /usr/include/curses.h: 63 66 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 66 67 mb_header.h: 67 68 -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-disk_io.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h ../lib/device.h freebsd.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_ext2fs.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h2 ../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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_fat.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h fat.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_ffs.Po
r2061 r2084 1 1 libgrub_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 16 15 17 16 shared.h: … … 29 28 /usr/include/features.h: 30 29 30 /usr/include/bits/predefs.h: 31 31 32 /usr/include/sys/cdefs.h: 32 33 … … 37 38 /usr/include/gnu/stubs-32.h: 38 39 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: 40 41 41 42 /usr/include/bits/types.h: … … 49 50 /usr/include/wchar.h: 50 51 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: 52 53 53 54 /usr/include/bits/stdio_lim.h: … … 59 60 /usr/include/bits/stdio2.h: 60 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 61 64 /usr/include/unctrl.h: 62 65 63 66 /usr/include/curses.h: 64 65 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:66 67 67 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_iso9660.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h iso9660.h2 ../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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_jfs.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h jfs.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_minix.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h2 ../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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_reiserfs.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h2 ../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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_ufs2.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h ufs2.h2 ../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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_vstafs.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h vstafs.h2 ../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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-fsys_xfs.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h xfs.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-gunzip.Po
r2061 r2084 1 1 libgrub_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.hfilesys.h pc_slice.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-md5.Po
r2061 r2084 1 1 libgrub_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 15 14 16 15 md5.h: … … 30 29 /usr/include/features.h: 31 30 31 /usr/include/bits/predefs.h: 32 32 33 /usr/include/sys/cdefs.h: 33 34 … … 38 39 /usr/include/gnu/stubs-32.h: 39 40 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: 41 42 42 43 /usr/include/bits/types.h: … … 50 51 /usr/include/wchar.h: 51 52 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: 53 54 54 55 /usr/include/bits/stdio_lim.h: … … 60 61 /usr/include/bits/stdio2.h: 61 62 63 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 64 62 65 /usr/include/unctrl.h: 63 66 64 67 /usr/include/curses.h: 65 68 66 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:67 68 69 mb_header.h: 69 70 -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-serial.Po
r2061 r2084 1 1 libgrub_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.hserial.h term.h terminfo.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-stage2.Po
r2061 r2084 1 1 libgrub_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 15 14 16 15 shared.h: … … 28 27 /usr/include/features.h: 29 28 29 /usr/include/bits/predefs.h: 30 30 31 /usr/include/sys/cdefs.h: 31 32 … … 36 37 /usr/include/gnu/stubs-32.h: 37 38 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: 39 40 40 41 /usr/include/bits/types.h: … … 48 49 /usr/include/wchar.h: 49 50 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: 51 52 52 53 /usr/include/bits/stdio_lim.h: … … 58 59 /usr/include/bits/stdio2.h: 59 60 61 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 62 60 63 /usr/include/unctrl.h: 61 64 62 65 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 66 66 67 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-terminfo.Po
r2061 r2084 1 1 libgrub_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.hterminfo.h tparm.h serial.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/grub/stage2/.deps/libgrub_a-tparm.Po
r2061 r2084 1 1 libgrub_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.htparm.h2 /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 15 15 16 16 shared.h: … … 28 28 /usr/include/features.h: 29 29 30 /usr/include/bits/predefs.h: 31 30 32 /usr/include/sys/cdefs.h: 31 33 … … 36 38 /usr/include/gnu/stubs-32.h: 37 39 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: 39 41 40 42 /usr/include/bits/types.h: … … 48 50 /usr/include/wchar.h: 49 51 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: 51 53 52 54 /usr/include/bits/stdio_lim.h: … … 58 60 /usr/include/bits/stdio2.h: 59 61 62 /usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdbool.h: 63 60 64 /usr/include/unctrl.h: 61 65 62 66 /usr/include/curses.h: 63 64 /usr/lib/gcc/i486-linux-gnu/4.3.3/include/stdbool.h:65 67 66 68 mb_header.h: -
Whitix/branches/netchannel/user/libc/Makefile
r910 r2084 11 11 $(MAKE) -C rtl 12 12 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/*.o13 -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 14 14 gcc -m32 -shared -nostdlib -fno-stack-protector -o libm.so init/crt_begin.o init/crt_end.o math/*.o 15 15 -
Whitix/branches/netchannel/user/libc/assert/assert.c
r608 r2084 3 3 #include <stdlib.h> 4 4 5 void DoAssert(char* fileName,int line)5 void DoAssert(char* condition, char* fileName,int line) 6 6 { 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); 9 9 10 10 exit(1); -
Whitix/branches/netchannel/user/libc/include/assert.h
r608 r2084 6 6 #else 7 7 #define assert(condition) \ 8 if (!(condition)) DoAssert( __FILE__,__LINE__);8 if (!(condition)) DoAssert(#condition, __FILE__,__LINE__); 9 9 #endif 10 10 11 void DoAssert(char* fileName,int line);11 void DoAssert(char* condition, char* fileName,int line); 12 12 13 13 #endif -
Whitix/branches/netchannel/user/libc/include/syscalls.h
r1370 r2084 42 42 #define _SYS_STAT_CHAR 32 43 43 44 struct PollItem 45 { 46 int fd; 47 short events; 48 short revents; 49 }; 50 44 51 /* Constant for SysMemoryMap */ 45 52 #define _SYS_MMAP_PRIVATE 0x00000000 -
Whitix/branches/netchannel/user/libc/include/sysdefs.h
r2061 r2084 80 80 SYSCALL(58,int,SysIoAccess,4,(int on)); 81 81 82 SYSCALL(59, int, SysChannelCreate, 16, (int family, void* src, void* dest, int flags)); 82 SYSCALL(59, int, SysChannelCreate, 16, (int family, void* src, void* dest, void* 83 options)); 83 84 SYSCALL(60, int, SysChannelControl, 12, (int fd, unsigned long code, void* data)); -
Whitix/branches/netchannel/user/libc/string/str.c
r1380 r2084 541 541 long acc; 542 542 543 printf("strtol\n"); 544 543 545 do{ 544 546 c=*s++; -
Whitix/branches/netchannel/user/linker/Makefile
r910 r2084 7 7 ### Configurables ### 8 8 9 OBJS = hash.o load_lib.o main.o relocate.o resolve.o 9 OBJS = hash.o load_lib.o main.o relocate.o resolve.o array.o 10 10 LINKER_LDFLAGS =-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,relo -Wl,-e,_start -Wl,-z,now \ 11 11 -Wl,-Bsymbolic -Wl,--export-dynamic -Wl,--sort-common -Wl,--discard-locals -Wl,--discard-all -Wl,--no-undefined … … 19 19 $(CC) $(BASE_CFLAGS) -c $*.S -o $*.o 20 20 21 liblinker.so: main.o relocate.o resolve.o load_lib.o hash.o21 liblinker.so: $(OBJS) 22 22 gcc $(BASE_LDFLAGS) $(LINKER_LDFLAGS) -shared $(OBJS) ../libc/rtl/syscall.o -o liblinker.so 23 23 -
Whitix/branches/netchannel/user/linker/elf.h
r1370 r2084 8 8 #define INIT_RELOCS_DONE 1 9 9 #define INIT_JMP_RELOCS_DONE 2 10 #define INIT_CALLED_INIT_FUNCS 4 11 #define INIT_CALLED_FINI_FUNCS 8 10 12 11 13 typedef unsigned long Elf_Addr; -
Whitix/branches/netchannel/user/linker/load_lib.c
r1408 r2084 293 293 return entry; 294 294 } 295 -
Whitix/branches/netchannel/user/linker/main.c
r1408 r2084 5 5 int dummy; 6 6 7 static unsigned long __attribute((used)) LinkerMain(int argc, char** argv)7 static unsigned long __attribute((used)) LinkerMain(int argc, char** argv) 8 8 { 9 9 unsigned long* args=((unsigned long*)&argv[0]); … … 12 12 struct ElfDyn* dynEntries; 13 13 struct ElfResolve resolve; 14 struct ElfResolve* entry; 14 15 int i; 15 16 … … 32 33 resolve.loadAddr=GetElfLoadAddress(); 33 34 34 dynEntries =(struct ElfDyn*)(ElfGetDynamic()+resolve.loadAddr);35 dynEntries = (struct ElfDyn*)(ElfGetDynamic()+resolve.loadAddr); 35 36 36 37 ElfParseDynInfo(dynEntries, resolve.dynamicInfo, resolve.loadAddr); -
Whitix/branches/netchannel/user/linker/relocate.c
r1370 r2084 353 353 DlFixupSymbols(symbolTables); 354 354 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 355 374 return 0; 356 375 } -
Whitix/branches/netchannel/user/net/Makefile
r2061 r2084 1 1 CFLAGS = -ffreestanding -fno-builtin -I../libc/include -I../sdk/include \ 2 -I../posix/include \ 2 3 -fno-stack-protector -m32 -Wall -nostdinc 3 4 4 OBJS = dhcp.o ping.o dns.o 5 OBJS = dhcp.o ping.o dns.o ifconfig.o telnet.o httpd.o 5 6 6 7 .c.o: … … 8 9 9 10 build: $(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 10 12 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 12 15 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 14 18 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 16 25 17 26 clean: … … 20 29 21 30 install: 22 cp dhcp ping dns ../../CdRoot/Applications31 cp dhcp ping dns telnet chan_test httpd ../../CdRoot/Applications -
Whitix/branches/netchannel/user/net/dhcp.c
r2061 r2084 3 3 #include <net/network.h> 4 4 #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> 7 8 8 9 #define MACHINE_NAME "WhitixMachine" … … 11 12 #define DHCP_BOOT_REPLY 2 12 13 14 #define DHCP_PORT_SOURCE 68 15 #define DHCP_PORT_DEST 67 16 17 #define CHAN_IGNORE_ADDRESSES 1 18 13 19 /* TODO: Move to sdk/network. */ 14 20 15 21 typedef unsigned long DWORD; 16 22 typedef unsigned short WORD; 23 24 /* Globals */ 25 char* infName; 26 DWORD subnetMask; 27 DWORD router; 17 28 18 29 struct ChannelAddr … … 65 76 } 66 77 78 void 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 67 91 void EthGetMacAddress() 68 92 { 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) 71 98 DhcpError("Could not get MAC address of network card"); 72 99 } … … 99 126 memset(udpHeader, 0, sizeof(struct UdpHeader)); 100 127 101 udpHeader->sourcePort =HostToNetShort(68);102 udpHeader->destPort =HostToNetShort(67);128 udpHeader->sourcePort = HostToNetShort(DHCP_PORT_SOURCE); 129 udpHeader->destPort = HostToNetShort(DHCP_PORT_DEST); 103 130 104 131 return (sizeof(struct EthHeader)+sizeof(struct IpHeader)+sizeof(struct UdpHeader)); … … 261 288 udpHeader=(struct UdpHeader*)(buf+sizeof(struct IpHeader)); 262 289 263 if (HostToNetShort(udpHeader->destPort) != 68)290 if (HostToNetShort(udpHeader->destPort) != DHCP_PORT_SOURCE) 264 291 return 1; 265 292 … … 277 304 while (dhcpOption->code != 0xFF) 278 305 { 279 if (dhcpOption->code == 54)306 switch (dhcpOption->code) 280 307 { 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; 283 319 } 284 320 … … 290 326 } 291 327 292 int DhcpPacketSend(int chnFd, char* buf, int (*packetConstructor)(char*))293 { 294 int i =4;328 ChanRecvBuffer* DhcpPacketSend(Channel* channel, int (*ctor)(char*)) 329 { 330 int i; 295 331 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) 326 358 break; 327 328 i *= 2;329 359 } 330 360 331 361 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 370 struct RouteEntry 371 { 372 DWORD destination; 373 DWORD gateway; 374 DWORD mask; 375 int flags; 376 char* device; 377 }; 378 379 void 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 385 void 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 391 void 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 336 419 337 420 int main(int argc, char** argv[]) … … 340 423 char buf[1024]; 341 424 struct Time currTime; 425 ChannelOptions options; 426 427 memset(&options, 0, sizeof(ChannelOptions)); 428 options.flags = CHAN_IGNORE_ADDRESSES; 342 429 343 430 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(); 345 442 EthGetMacAddress(sourceAddr); 346 443 … … 349 446 tid = currTime.seconds; 350 447 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) 356 457 DhcpError("Could not create network channel"); 357 458 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"); 359 461 360 462 printf("dhcp: Sending DHCPDISCOVER packet\n"); 361 if (DhcpPacketSend(chnFd, buf, DhcpConstructDiscover)) 463 464 buffer = DhcpPacketSend(channel, DhcpConstructDiscover); 465 if (!buffer) 362 466 DhcpError("No reply to DHCPDISCOVER packet"); 363 467 364 468 printf("dhcp: Received DHCPOFFER packet\n"); 365 469 /* Parse the DHCPOFFER packet */ 366 DhcpParseOffer(buf); 470 DhcpParseOffer(ChanRecvBufferData(channel, buffer)); 471 ChanRecvBuffFree(channel, buffer); 367 472 368 473 printf("dhcp: Sending DHCPREQUEST packet\n"); 369 if (DhcpPacketSend(chnFd, buf, DhcpConstructRequest)) 474 buffer = DhcpPacketSend(channel, DhcpConstructRequest); 475 if (!buffer) 370 476 DhcpError("No reply to DHCPREQUEST packet"); 371 477 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); 375 482 376 483 printf("dhcp: New interface address is: %u.%u.%u.%u\n", … … 378 485 379 486 /* Privileged configuration variable. */ 380 if (SysConfWrite("/Devices/Network/Ethernet0/netAddress", &address, 4) )487 if (SysConfWrite("/Devices/Network/Ethernet0/netAddress", &address, 4) < 4) 381 488 { 382 489 DhcpError("Could not set network address of interface"); 383 490 } 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 */ 384 500 385 501 return 0; -
Whitix/branches/netchannel/user/net/dns.c
r2073 r2084 12 12 { 13 13 printf("%s: fatal error. %s.\n", progName, message); 14 SysExit(0);14 exit(0); 15 15 } 16 16 … … 20 20 char buf[1024]; 21 21 char name[64]; 22 unsignedint length;22 int length; 23 23 struct DnsHeader* header; 24 24 Socket* dnsSocket; 25 25 struct DnsState state; 26 26 ulong address; 27 int ret, index; 27 28 28 29 progName = argv[0]; … … 36 37 struct Ipv4EndPoint dnsAddr; 37 38 39 /* TODO: Get DNS server address from somewhere. */ 38 40 dnsAddr.address = 0xC0A801FE; 39 41 dnsAddr.port = 53; 40 42 41 43 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"); 42 56 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 52 57 length = 1024; 53 58 … … 56 61 57 62 DnsStartReply(&state, buf, length); 63 64 strncpy(name, argv[1], sizeof(name)); 58 65 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) 65 83 & 0xFF, address & 0xFF); 84 index++; 85 } 66 86 67 87 SocketClose(dnsSocket); -
Whitix/branches/netchannel/user/net/ping.c
r2061 r2084 5 5 #include <net/dns.h> 6 6 #include <net/udp.h> 7 #include <net/ipv4.h> 8 9 struct Ipv4EndPoint dest; 7 10 8 11 void PingError(char* s) … … 12 15 } 13 16 17 ulong WrapSum(ulong sum) 18 { 19 sum=~sum & 0xFFFF; 20 return HostToNetShort(sum); 21 } 22 23 int 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 39 int 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 14 53 int main(int argc, char* argv[]) 15 54 { 16 55 char* address; 17 // struct Ipv4EndPoint dest;18 56 Socket* icmpSocket; 19 // struct IcmpReplyreply;57 struct IcmpHeader reply; 20 58 int seq; 59 int length; 60 unsigned short ident = 0xFFFF - SysGetCurrentProcessId(); 21 61 22 62 if (argc < 2) … … 25 65 address = argv[1]; 26 66 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 31 74 icmpSocket = IcmpSocketCreate(); 75 76 if (!icmpSocket) 77 PingError("could not create ICMP socket"); 32 78 33 79 if (SocketConnect(icmpSocket, &dest)) 34 80 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 36 86 for (seq = 0; seq < 4; seq++) 37 87 { … … 40 90 SysGetTime(&time); 41 91 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) 45 98 { 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; 51 101 } 102 103 printf("%d bytes from %s: sequence %d\n", length, argv[1], 104 NetToHostShort(reply.sequence)); 52 105 } 53 106 54 107 SocketClose(icmpSocket); 55 #endif56 108 57 109 return 0; -
Whitix/branches/netchannel/user/posix/Makefile
r1374 r2084 15 15 $(MAKE) -C process 16 16 $(MAKE) -C opt 17 $(MAKE) -C memory 17 18 $(MAKE) -C socket 18 $(MAKE) -C memory19 19 $(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.so20 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 21 21 22 22 pthreadlib: … … 44 44 $(MAKE) -C process clean 45 45 $(MAKE) -C opt clean 46 $(MAKE) -C socket clean47 46 $(MAKE) -C memory clean 48 47 $(MAKE) -C strings clean 48 $(MAKE) -C socket clean -
Whitix/branches/netchannel/user/posix/file/Makefile
r572 r2084 1 1 include ../make.inc 2 2 3 OBJS = file.o fs.o 3 OBJS = file.o fs.o internal.o 4 4 5 5 build: $(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 6 uint32_t htonl(uint32_t hostlong); 3 7 4 8 #endif -
Whitix/branches/netchannel/user/posix/include/netdb.h
r608 r2084 26 26 #define NO_ADDRESS 0x10 27 27 28 #define PF_INET 0x00 28 29 #define PF_UNIX 0x01 29 30 -
Whitix/branches/netchannel/user/posix/include/netinet/in.h
r608 r2084 1 #ifndef IN_H2 #define IN_H1 #ifndef NETINET_IN_H 2 #define NETINET_IN_H 3 3 4 4 struct in_addr … … 34 34 35 35 #define INADDR_LOOPBACK 0x7F000001 36 #define INADDR_ANY 0xFFFFFFFF 36 37 37 38 struct ip_mreqn -
Whitix/branches/netchannel/user/posix/include/sys/socket.h
r1374 r2084 7 7 8 8 #define AF_UNIX 0x00 9 #define AF_INET 0x01 9 10 10 11 /* Not yet supported. */ 11 #define AF_INET 0x0112 12 #define AF_SNA 0x02 13 13 #define AF_DECnet 0x03 … … 53 53 #define SOCK_RAW 0x01 54 54 #define SOCK_STREAM 0x02 55 #define SOCK_DGRAM 0x0 456 #define SOCK_RDM 0x0 857 #define SOCK_SEQPACKET 0x 1055 #define SOCK_DGRAM 0x03 56 #define SOCK_RDM 0x04 57 #define SOCK_SEQPACKET 0x05 58 58 59 59 #define MSG_OOB 0x01 -
Whitix/branches/netchannel/user/posix/include/sys/types.h
r1374 r2084 26 26 typedef int intptr_t; 27 27 28 #ifndef DEFINED_USHORT 29 #define DEFINED_USHORT 28 30 typedef unsigned short ushort; 31 #endif 32 29 33 typedef unsigned long u_long; 30 34 -
Whitix/branches/netchannel/user/posix/socket/socket.c
r2061 r2084 3 3 #include <sys/socket.h> 4 4 5 #include <net/tcp.h> 6 5 7 #include <syscalls.h> 6 8 7 #include <stdio.h> //TEMP 9 #include <stdio.h> 10 11 #include "../file/internal.h" 12 13 /* POSIX file operations */ 14 struct PosixFileType socketType = 15 { 16 }; 8 17 9 18 ssize_t send(int s, const void* buf, size_t len, int flags) 10 19 { 11 #if 0 12 int ret=SysSocketSend(s, buf, len, flags);20 struct PosixFile* file = PosixHandleToFile(s); 21 Socket* socket = (Socket*)PosixFilePriv(file); 13 22 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); 23 24 } 24 25 25 26 ssize_t recv(int s, void* buf, size_t len, int flags) 26 27 { 27 #if 0 28 int ret=SysSocketReceive(s, buf, len, flags);28 struct PosixFile* file = PosixHandleToFile(s); 29 Socket* socket = (Socket*)PosixFilePriv(file); 29 30 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); 39 32 } 40 33 … … 57 50 int socket(int domain, int type, int protocol) 58 51 { 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 69 err: 70 PosixFileFree(file); 60 71 return -1; 61 72 } … … 63 74 int accept(int sockfd, struct sockaddr* addr, socklen_t *addrlen) 64 75 { 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; 67 81 68 if (ret < 0) 69 { 70 errno=-ret; 71 return -1; 72 } 82 err = SocketAccept(socket, childSocket, addr); 73 83 74 return ret; 75 #endif 84 if (err) 85 goto err; 86 87 return PosixFileToHandle(child); 88 89 err: 90 PosixFileFree(child); 76 91 return -1; 77 92 } … … 79 94 int bind(int s, const struct sockaddr* my_addr, socklen_t addr_len) 80 95 { 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); 84 100 } 85 101 86 102 int shutdown(int s, int how) 87 103 { 88 #if 0 89 return SysSocketClose(s); 90 #endif 104 return -1; 91 105 } 92 106 93 107 int listen(int s, int backlog) 94 108 { 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); 98 113 } 99 114 … … 110 125 } 111 126 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 124 127 int getsockopt(int s, int level, int optname, void* optval, socklen_t* optlen) 125 128 { … … 128 131 } 129 132 133 short htons(short s) 134 { 135 unsigned char* p=(unsigned char*)&s; 136 return (p[0] << 8) | (p[1]); 137 } 138 139 long 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 2 2 $(MAKE) -C console 3 3 $(MAKE) -C network 4 $(MAKE) -C thread5 4 $(MAKE) -C file 6 5 $(MAKE) -C registry … … 12 11 $(MAKE) -C console clean 13 12 $(MAKE) -C network clean 14 $(MAKE) -C thread clean15 13 $(MAKE) -C file clean 16 14 $(MAKE) -C registry clean -
Whitix/branches/netchannel/user/sdk/include/net/byteorder.h
r2061 r2084 3 3 4 4 unsigned short NetToHostShort(unsigned short num); 5 unsigned long NetToHostLong(unsigned long num); 5 6 6 7 #define HostToNetShort NetToHostShort -
Whitix/branches/netchannel/user/sdk/include/net/channels.h
r2069 r2084 2 2 #define NET_CHANNELS_H 3 3 4 #include <types.h> 5 4 6 #define CHAN_FAMILY_IP 0x00 5 6 #define CHAN_LINK_MAX 147 8 7 #define CHAN_MAKE_TYPE(family, type) (((family) << 16) | (type)) 9 8 9 /* Keep this synchronised with the structure in include/net/channels.h */ 10 typedef struct tagChannelOptions 11 { 12 unsigned int flags; 13 unsigned short sendPages; 14 unsigned short recvPages; 15 }ChannelOptions; 16 17 typedef 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 27 typedef struct tagChannelAddr 28 { 29 char addr[20]; 30 }ChannelAddr; 31 32 /* Channel, lowest form of user-space abstraction. */ 33 typedef struct tagChannel 34 { 35 int fd; 36 ChannelAddr src, dest; 37 char* baseAddress; 38 ChannelInfo* info; 39 }Channel; 40 41 Channel* 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 */ 49 typedef char ChanSendBuffer; 50 typedef char ChanRecvBuffer; 51 52 /* Usercode functions - use the (simple) wrappers below. */ 53 typedef int (*ChanAllocCall)(char*); 54 extern ChanAllocCall uChanSendBufferAlloc; 55 typedef void* (*ChanBuffGet)(char*, int); 56 extern ChanBuffGet uChanSendBuffGet; 57 extern ChanBuffGet uChanRecvBuffGet; 58 59 typedef int (*ChanBuffLen)(char*); 60 extern ChanBuffLen uChanRecvBuffLen; 61 62 typedef void (*ChanBuffSetPriv)(char*, void*); 63 extern ChanBuffSetPriv uChanRecvBuffSetPriv; 64 65 typedef void* (*pChanGetInfo)(char*); 66 extern pChanGetInfo uChanRecvBuffGetPriv; 67 extern pChanGetInfo uChanGetInfo; 68 69 typedef void (*pChanFree)(char*, char*); 70 extern pChanFree uChanRecvBuffFree; 71 72 typedef unsigned short (*pChanGetRead)(char*); 73 extern pChanGetRead uChanRecvBuffGetRead; 74 75 typedef void (*pChanAddRead)(char*, char*, unsigned short); 76 extern pChanAddRead uChanRecvBuffAddRead; 77 78 static inline int ChanSendHeaderBytes(Channel* channel) 79 { 80 return channel->info->sendHeaderBytes; 81 } 82 83 static inline int ChanRecvHeaderBytes(Channel* channel) 84 { 85 return channel->info->recvHeaderBytes; 86 } 87 88 static inline int ChanHwHeaderBytes(Channel* channel) 89 { 90 return channel->info->hwHeaderBytes; 91 } 92 93 static inline int ChanMaxPacketSize(Channel* channel) 94 { 95 return channel->info->maxPacketSize; 96 } 97 98 static inline void* ChanSendBufferData(Channel* channel, ChanSendBuffer* buffer) 99 { 100 return (void*)((char*)buffer + channel->info->sendHeaderBytes); 101 } 102 103 /* Wrapper around the usercode functions */ 104 static 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 122 static inline int ChanSendPages(Channel* channel) 123 { 124 return channel->info->numSendPages; 125 } 126 127 static inline int ChanRecvPages(Channel* channel) 128 { 129 return channel->info->numRecvPages; 130 } 131 132 /* Get the first unread recv buffer. */ 133 static inline void* ChanGetRecvBuffer(Channel* channel) 134 { 135 return uChanRecvBuffGet(channel->baseAddress, -1); 136 } 137 138 static inline void* ChanRecvBufferData(Channel* channel, ChanRecvBuffer* buffer) 139 { 140 return (void*)((char*)buffer + channel->info->recvHeaderBytes); 141 } 142 143 static inline int ChanRecvBufferLen(ChanRecvBuffer* buffer) 144 { 145 return uChanRecvBuffLen(buffer); 146 } 147 148 static inline void ChanRecvBuffSetPriv(ChanRecvBuffer* buffer, void* priv) 149 { 150 return uChanRecvBuffSetPriv(buffer, priv); 151 } 152 153 static inline void* ChanRecvBuffGetPriv(ChanRecvBuffer* buffer) 154 { 155 return uChanRecvBuffGetPriv(buffer); 156 } 157 158 static inline void ChanRecvBuffFree(Channel* channel, ChanRecvBuffer* buffer) 159 { 160 uChanRecvBuffFree(channel->baseAddress, buffer); 161 } 162 163 static inline void* ChanGetInfo(Channel* channel) 164 { 165 return uChanGetInfo(channel->baseAddress); 166 } 167 168 static inline unsigned short ChanRecvBuffGetRead(ChanRecvBuffer* buffer) 169 { 170 return uChanRecvBuffGetRead(buffer); 171 } 172 173 static inline void ChanRecvBuffAddRead(Channel* channel, ChanRecvBuffer* buffer, unsigned short 174 add) 175 { 176 uChanRecvBuffAddRead(channel->baseAddress, buffer, add); 177 } 178 179 /* I/O */ 180 int ChanBufferSend(Channel* channel, ChanSendBuffer* buffer, int length); 181 int ChanBufferRecv(Channel* channel, ChanRecvBuffer** buffer, char** data, int 182 timeout); 183 10 184 #endif -
Whitix/branches/netchannel/user/sdk/include/net/inet_raw.h
r2061 r2084 2 2 #define _NET_INET_RAW_H 3 3 4 #include <net/internet.h>5 4 #include <syscalls.h> 6 5 … … 18 17 }__attribute__((packed)); 19 18 19 #define PROTOCOL_RAW_ICMP 1 20 20 #define PROTOCOL_RAW_UDP 17 21 21 -
Whitix/branches/netchannel/user/sdk/include/net/ipv4.h
r2069 r2084 1 1 #ifndef NET_IPV4_H 2 2 #define NET_IPV4_H 3 4 #include <types.h> 5 6 /* Matches POSIX structure */ 7 struct Ipv4Address 8 { 9 short family; 10 unsigned short port; 11 unsigned long address; 12 }; 3 13 4 14 struct Ipv4EndPoint … … 10 20 #define IPV4_BROADCAST 0xFFFFFFFF 11 21 22 struct 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 12 35 #endif -
Whitix/branches/netchannel/user/sdk/include/net/network.h
r2061 r2084 6 6 #include <types.h> 7 7 #include <net/socket.h> 8 #include <net/internet.h>9 8 #include <net/local.h> 10 9 #include <net/inet_raw.h> -
Whitix/branches/netchannel/user/sdk/include/net/socket.h
r2061 r2084 2 2 #define SOCKET_H 3 3 4 #include <net/channels.h> 4 5 #include <stdlib.h> 5 6 #include <types.h> 6 7 7 8 /* Defines */ 8 #define SOCK_STREAM 0 9 #define NET_PF_LOCAL 0x0 10 #define NET_PF_INET 0x1 9 11 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 27 14 28 15 /* New sockets. */ … … 30 17 struct SockAddr 31 18 { 32 unsigned char addr[20]; 19 short family; 20 unsigned char addr[18]; 33 21 }; 34 22 … … 37 25 struct tagSocket 38 26 { 39 int channelFd;40 27 struct SocketOps* ops; 41 struct SockAddr chanSrc, chanDest; 28 Channel* channel; /* FIXME: Should not be pointer */ 29 void* priv; 42 30 }; 43 31 … … 46 34 struct SocketOps 47 35 { 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); 48 39 int (*create)(Socket* socket); 49 40 int (*send)(Socket* socket, const void* buffer, unsigned long length, int flags); 50 41 int (*sendTo)(Socket* socket, const void* buffer, unsigned long length, int flags, struct SockAddr* dest); 51 int (*recvFrom)(Socket* socket, constvoid* buffer, unsigned long length, int flags, struct SockAddr* dest);42 int (*recvFrom)(Socket* socket, void* buffer, unsigned long length, int flags, struct SockAddr* dest); 52 43 int (*recv)(Socket* socket, void* buffer, unsigned long length, int flags); 53 44 int (*connect)(Socket* socket, struct SockAddr* sockAddr); … … 62 53 63 54 /* General functions. */ 55 int SocketCreate(Socket* socket, int domain, int type, int protocol); 64 56 int SocketConnect(Socket* socket, struct SockAddr* sockAddr); 65 57 int SocketConnectEx(Socket* socket, struct SockAddr* src, struct SockAddr* dest, int flags); -
Whitix/branches/netchannel/user/sdk/include/net/udp.h
r2069 r2084 1 1 #ifndef SDK_NET_UDP_H 2 2 #define SDK_NET_UDP_H 3 4 #define CHAN_TYPE_UDP 0x01 3 5 4 6 #include <net/socket.h> -
Whitix/branches/netchannel/user/sdk/include/types.h
r2067 r2084 2 2 #define SDK_TYPES_H 3 3 4 typedef unsigned long ulong; 5 typedef unsigned short ushort; 4 typedef unsigned long ulong; 5 6 #ifndef DEFINED_USHORT 7 #define DEFINED_USHORT 8 typedef unsigned short ushort; 9 #endif 10 11 typedef unsigned char uchar; 6 12 7 13 #endif -
Whitix/branches/netchannel/user/sdk/network/Makefile
r2061 r2084 1 CFLAGS = -Wall -I../include -I../../libc/include -nostdlib -ffreestanding -fno-builtin -fPIC -m32 1 CFLAGS = -Wall -I../include -I../../libc/include -nostdlib -ffreestanding -fno-builtin -fPIC -m32 2 2 3 OBJS = socket.o byteorder.o ipv4.o udp.o memory.o dns.o startup.o3 OBJS = byteorder.o ipv4.o udp.o memory.o dns.o icmp.o tcp.o tcp_options.o channels.o init.o socket.o 4 4 5 5 .c.o: … … 7 7 8 8 build: $(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 \ 10 11 $(OBJS) ../../libc/init/crt_begin.o ../../libc/init/crt_end.o 11 12 -
Whitix/branches/netchannel/user/sdk/network/dns.c
r2068 r2084 126 126 127 127 state->offset = sizeof(struct DnsHeader); 128 128 129 129 /* Find offset for answers. */ 130 130 for (i = 0; i < state->questions; i++) … … 179 179 } 180 180 181 int DnsGetCanonicalName(struct DnsState* state, char* name, int length) 181 int DnsGetCanonicalName(struct DnsState* state, char* name, int length, int 182 start) 182 183 { 183 184 int i; 184 185 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++) 187 192 { 188 193 ushort type = NetToHostShort(answer->type); … … 191 196 { 192 197 DnsCopyCanonicalName(state, answer, name, length); 193 return 1;198 return i; 194 199 }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; 199 204 } 200 205 … … 206 211 } 207 212 208 int DnsGetIpAddresses(struct DnsState* state, ulong* address, int dest) 213 int DnsGetIpAddresses(struct DnsState* state, ulong* address, int 214 start) 209 215 { 210 216 int i, length; 211 217 char* p; 212 218 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++) 215 227 { 216 228 ushort type = NetToHostShort(answer->type); … … 228 240 /* Found the IP address. */ 229 241 *address = NetToHostLong(*(ulong*)(((char*)answer)+sizeof(struct DnsAnswer))); 230 231 /* TODO: Collect multiple. */ 232 return 1; 233 }else{ 242 return i; 243 }else 234 244 DNS_SKIP_BYTES(answer, DnsSkipRecord(state, answer)); 235 } 236 } 237 238 return 0; 245 } 246 247 return -1; 239 248 } 240 249 241 250 int DnsGetIpAddress(struct DnsState* state, ulong* address) 242 251 { 243 return DnsGetIpAddresses(state, address, 1);252 return DnsGetIpAddresses(state, address, 0); 244 253 } 245 254 … … 251 260 struct DnsState state; 252 261 struct Ipv4EndPoint dnsAddr; 253 254 dnsAddr.address = 0xC0A80001; 262 263 /* FIXME */ 264 dnsAddr.address = 0xC0A801FE; 255 265 dnsAddr.port = 53; 256 257 /* TODO: Call Ipv4Address function. */258 266 259 267 dnsSocket = UdpSocketCreate(); 260 268 269 if (!dnsSocket) 270 return -1; 271 261 272 DnsStartHeader(&state, buf, 1024); 262 263 273 DnsAddQuery(&state, name, DNS_QUERY_A); 264 274 265 275 length = DnsFinishHeader(&state); 266 267 printf("Here, %d\n", length);268 276 269 277 if (SocketSendTo(dnsSocket, buf, length, 0, &dnsAddr) < length) … … 275 283 return 1; 276 284 277 printf("Here\n");278 279 285 DnsStartReply(&state, buf, length); 280 281 DnsGetIpAddress(&state, address); 282 286 287 if (DnsGetIpAddress(&state, address) < 0) 288 return -1; 289 283 290 SocketClose(dnsSocket); 284 291 285 292 return 0; 286 293 } -
Whitix/branches/netchannel/user/sdk/network/ipv4.c
r2068 r2084 1 #include <stdio.h> 2 #include <syscalls.h> 1 3 #include <net/network.h> 4 #include <net/byteorder.h> 5 #include <net/channels.h> 6 #include <net/ipv4.h> 2 7 3 8 ulong IpCheckSum(char* data, ulong bytes, ulong sum) … … 27 32 int ch; 28 33 unsigned long ipAddr = 0, curr = 0; 29 int shiftPos = 0;34 int shiftPos = 24; 30 35 31 36 while ((ch = *address++)) … … 41 46 { 42 47 ipAddr |= (curr << shiftPos); 43 shiftPos += 8;48 shiftPos -= 8; 44 49 curr = 0; 45 50 }else … … 47 52 } 48 53 49 ipAddr |= (curr << 24);54 ipAddr |= (curr); 50 55 51 if (shiftPos != 24)56 if (shiftPos != 0) 52 57 return 1; 53 58 … … 57 62 } 58 63 59 int SocketConnect(Socket* socket, struct SockAddr* addr)64 int IpBuildHeader(void* start, struct Ipv4EndPoint* destIp, int length, int protocol) 60 65 { 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; 68 79 } 69 80 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 }80 81 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 5 5 #include <net/channels.h> 6 6 #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. */2 1 #include <net/socket.h> 3 #include <syscalls.h>4 2 5 int NetSocketCreate(int domain, int type, int protocol) 3 #include <stdio.h> 4 5 int SocketCreate(Socket* socket, int domain, int type, int protocol) 6 6 { 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; 10 21 } 11 22 12 int NetSocketBind(int fd, struct SocketAddr* address, int length)23 int SocketBind(Socket* socket, struct SockAddr* addr) 13 24 { 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; 17 29 } 18 30 19 int NetSocketListen(int fd, int backlog)31 int SocketListen(Socket* socket, int backlog) 20 32 { 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; 24 37 } 25 38 26 int NetSocketAccept(int fd, struct SocketAddr* address, int* length)39 int SocketAccept(Socket* socket, Socket* child, struct SockAddr* addr) 27 40 { 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; 31 45 } 32 46 33 int NetSocketConnect(int fd, struct SocketAddr* address, int length)47 int SocketConnect(Socket* socket, struct SockAddr* addr) 34 48 { 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; 38 56 } 39 57 40 int NetSocketSend(int fd, const void* buffer, int size, int flags)58 int SocketSend(Socket* socket, const void* buffer, unsigned int length, int flags) 41 59 { 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; 45 67 } 46 68 47 int NetSocketReceive(int fd, void* buffer, int size, int flags)69 int SocketSendTo(Socket* socket, const void* buffer, unsigned int length, int flags, struct SockAddr* dest) 48 70 { 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; 52 78 } 53 79 54 int NetSocketClose(int fd) 80 int SocketRecv(Socket* socket, void* buffer, unsigned int length, int 81 flags) 55 82 { 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; 59 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 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 8 8 static struct SocketOps udpSocketOps; 9 9 10 int UdpSocketConnect(Socket* socket, struct SockAddr* address); 11 12 int _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 10 23 Socket* UdpSocketCreate() 11 24 { … … 14 27 /* Create hidden _SocketCreate function. */ 15 28 socket = SocketAllocate(); 16 socket->ops = &udpSocketOps; 17 socket->channelFd = -1; 18 19 /* TODO: no */ 20 UdpSocketConnect(socket, NULL); 21 29 _UdpSocketCreate(socket); 30 22 31 return socket; 23 32 } … … 27 36 int UdpSocketConnect(Socket* socket, struct SockAddr* address) 28 37 { 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); 30 48 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; 41 51 42 52 return 0; … … 47 57 /* Fill chanDest with dest, chanSrc with source, and use 48 58 * chanSrc when constructing UDP packet. */ 49 memcpy(&socket->chan Src, source, sizeof(struct Ipv4EndPoint));50 memcpy(&socket->chan Dest, dest, sizeof(struct Ipv4EndPoint));59 memcpy(&socket->channel->src, source, sizeof(struct Ipv4EndPoint)); 60 memcpy(&socket->channel->dest, dest, sizeof(struct Ipv4EndPoint)); 51 61 52 socket->channelFd = SysChannelCreate(CHAN_FAMILY_IP, &socket->chanSrc, &socket->chanDest, flags);62 // socket->channelFd = SysChannelCreate(CHAN_FAMILY_IP, &socket->chanSrc, &socket->chanDest, flags); 53 63 return -1; 54 64 } … … 66 76 } 67 77 78 ulong UdpCheckSum() 79 { 80 return 0; 81 } 82 68 83 int UdpSocketSendTo(Socket* socket, const void* buffer, unsigned long length, int flags, struct SockAddr* dest) 69 84 { 70 char* chanBuff;71 char* start;85 ChanSendBuffer* chanBuff; 86 int ret; 72 87 struct Ipv4EndPoint* destIp = (struct Ipv4EndPoint*)dest; 73 struct Ipv4EndPoint* srcIp = (struct Ipv4EndPoint*)&socket->chan Src;88 struct Ipv4EndPoint* srcIp = (struct Ipv4EndPoint*)&socket->channel->src; 74 89 struct IpHeader* ipHeader; 75 90 struct UdpHeader* udpHeader; 91 char* data; 76 92 int totalLength; 77 93 78 totalLength = length + sizeof(struct UdpHeader) + sizeof(struct IpHeader) + CHAN_LINK_MAX;79 94 totalLength = length + sizeof(struct UdpHeader) + sizeof(struct IpHeader); 95 80 96 if (!dest) 81 97 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));91 98 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); 100 108 101 109 /* Add UDP header. */ 102 udpHeader = (struct UdpHeader*)( start+ sizeof(struct IpHeader));110 udpHeader = (struct UdpHeader*)(data + sizeof(struct IpHeader)); 103 111 104 112 udpHeader->sourcePort = NetToHostShort(srcIp->port); … … 106 114 udpHeader->length = NetToHostShort(length + sizeof(struct UdpHeader)); 107 115 108 memcpy( start+ sizeof(struct IpHeader) + sizeof(struct UdpHeader), buffer, length);116 memcpy(data + sizeof(struct IpHeader) + sizeof(struct UdpHeader), buffer, length); 109 117 110 udpHeader->checkSum=WrapSum(IpCheckSum((unsigned char*)udpHeader, sizeof(struct UdpHeader),118 /* udpHeader->checkSum = WrapSum(IpCheckSum((unsigned char*)udpHeader, sizeof(struct UdpHeader), 111 119 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); 113 125 114 if (SysWrite(socket->channelFd, chanBuff, totalLength)) 115 length = -1; 116 117 ChanFreeBuffer(chanBuff); 118 119 return length; 126 return ret; 120 127 } 121 128 122 int UdpSocketRecvFrom(Socket* socket, const void* buffer, unsigned intlength, int flags,129 int UdpSocketRecvFrom(Socket* socket, void* buffer, unsigned long length, int flags, 123 130 struct SockAddr* dest) 124 131 { 125 int totalLength = length + sizeof(struct IpHeader) + sizeof(struct UdpHeader);126 132 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; 137 154 } 155 138 156 static struct SocketOps udpSocketOps = 139 157 { -
Whitix/branches/netchannel/user/sdk/registry/registry.c
r2070 r2084 26 26 int RegRegistryOpen(char* name, struct Registry* registry) 27 27 { 28 #if 0 28 29 int sockFd; 29 30 struct SocketAddr addr; … … 42 43 43 44 registry->sockFd=sockFd; 44 45 #endif 45 46 return 0; 46 47 } … … 48 49 int RegRegistryClose(struct Registry* registry) 49 50 { 51 #if 0 50 52 NetSocketClose(registry->sockFd); 53 #endif 51 54 return 0; 52 55 } … … 54 57 int RegKeySetOpen(struct Registry* registry, char* name, unsigned long accessRights, struct RegKeySet* keySet) 55 58 { 59 #if 0 56 60 int err; 57 61 … … 87 91 keySet->handleId=handleId; 88 92 keySet->registry=registry; 89 93 #endif 94 90 95 return 0; 91 96 } … … 139 144 int RegKeySetReadKey(struct RegKeySet* keySet, char* name, int* type, char* data, unsigned long* length) 140 145 { 146 #if 0 141 147 int err; 142 148 int sockFd; … … 182 188 if (type) 183 189 *type=reply.type; 190 #endif 184 191 185 192 return 0; … … 200 207 char* RegKeySetIterNext(struct RegKeySetIter* iter) 201 208 { 209 #if 0 202 210 struct RegEnumSetPacket 203 211 { … … 250 258 251 259 return ret; 260 #endif 261 return 0; 252 262 } 253 263 … … 264 274 int RegEntryGetType(struct RegKeySet* keySet, char* name, int* ret) 265 275 { 276 #if 0 266 277 struct RegReadKeyPacket packet; 267 278 int sockFd, err; … … 280 291 281 292 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 28 28 if (fd < 0) 29 29 { 30 printf("moduleadd: Could not open %s \n", name);30 printf("moduleadd: Could not open %s (%d)\n", name, fd); 31 31 return 1; 32 32 } … … 49 49 50 50 /* Check ret. */ 51 if (ret)52 printf("moduleadd: Error adding module %s to kernel: %s\n", name, strerror(ret));53 51 54 52 SysClose(fd); … … 62 60 UsagePrint(); 63 61 64 char* moduleName =argv[1];62 char* moduleName = argv[1]; 65 63 char buf[PATH_MAX+100]; 66 64 int ret; 67 65 68 66 if (!strstr(moduleName, ".sys")) 69 s printf(buf, "%s.sys", moduleName);67 snprintf(buf, sizeof(buf), "%s.sys", moduleName); 70 68 else 71 str cpy(buf, moduleName);69 strncpy(buf, moduleName, sizeof(buf)); 72 70 73 71 ret=ModuleLoad(buf, 0); … … 82 80 if (!ret) 83 81 { 84 s printf(buf, "%s.ko", moduleName);82 snprintf(buf, sizeof(buf), "%s.ko", moduleName); 85 83 ret=ModuleLoad(buf, MODULE_FLAG_LINUX); 86 84 } 87 85 } 88 86 89 if (ret == 1) 90 { 87 if (ret != 0) 91 88 printf("moduleadd: Could not load %s. Exiting\n", buf); 92 }93 89 94 90 return ret; -
Whitix/branches/netchannel/user/system/registry/socket.c
r2061 r2084 16 16 void RegSocketCreate() 17 17 { 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); 25 25 } 26 26 … … 36 36 { 37 37 handleId=-1; 38 goto send;38 // goto send; 39 39 } 40 40 41 41 handleId=RegKeySetGetHandleId(*list, handle); 42 42 43 send:43 //send: 44 44 /* Send the handle ID back to the calling application. */ 45 NetSocketSend(clientFd, &handleId, 4, 0);45 // NetSocketSend(clientFd, &handleId, 4, 0); 46 46 } 47 47 … … 88 88 } 89 89 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); 94 94 } 95 95 … … 157 157 // printf("Sending %d\n", length); 158 158 159 NetSocketSend(clientFd, sendBuf, length, 0);159 // NetSocketSend(clientFd, sendBuf, length, 0); 160 160 161 161 free(sendBuf); … … 164 164 error: 165 165 length=-1; 166 NetSocketSend(clientFd, &length, sizeof(int), 0);166 // NetSocketSend(clientFd, &length, sizeof(int), 0); 167 167 } 168 168 … … 177 177 handle=RegKeySetGetHandle(list, packet->handleId); 178 178 179 if (!handle)180 goto out;179 // if (!handle) 180 // goto out; 181 181 182 182 set=handle->set; … … 187 187 { 188 188 type=0; 189 goto out;189 //goto out; 190 190 } 191 191 … … 195 195 type=1; 196 196 197 out:198 NetSocketSend(clientFd, &type, sizeof(int), 0);197 //out: 198 // NetSocketSend(clientFd, &type, sizeof(int), 0); 199 199 } 200 200 … … 208 208 while (1) 209 209 { 210 int bytesRead= NetSocketReceive(clientFd, buf, 4096, 0);210 int bytesRead=/*NetSocketReceive(clientFd, buf, 4096, 0)*/ 0; 211 211 212 212 // printf("bytesRead = %d\n", bytesRead); … … 246 246 void RegSocketAcceptConn() 247 247 { 248 int clientSock= NetSocketAccept(serverSock, NULL, NULL);248 int clientSock=/*NetSocketAccept(serverSock, NULL, NULL)*/ 0; 249 249 250 250 if (clientSock > 0) -
Whitix/branches/netchannel/user/system/startup.c
r2061 r2084 39 39 int ret, pid; 40 40 41 ModuleLoad("Network/ipv4"); 41 pid = ModuleLoad("Network/ipv4"); 42 SysWaitForProcessFinish(pid, NULL); 43 42 44 ModuleLoad("Network/ne2k_pci"); 43 44 45 ModuleLoad("Network/pcnet32"); 45 46 // ModuleLoad("Network/e1000"); 46 47 /* Move to FS thread? */ 48 pid=ModuleLoad("Filesystems/icfs"); 49 50 SysWaitForProcessFinish(pid, NULL); 51 47 52 48 printf("Mounting the system filesystem.."); 53 49 … … 78 74 } 79 75 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 98 76 int unixFinished=0; 99 77 … … 117 95 118 96 SysCreateThread(NetworkInit, 0, NULL); 119 SysCreateThread(InputInit, 0 , NULL);120 97 SysCreateThread(StorageInit, 0, NULL); 121 98 SysCreateThread(UnixInit, 0, NULL); … … 123 100 threadId = SysGetCurrentThreadId(); 124 101 125 while (! inputFinished || !networkFinished || !storageFinished || !unixFinished)102 while (!networkFinished || !storageFinished || !unixFinished) 126 103 { 127 // printf("%#X %#X %#X %#X\n", inputFinished, networkFinished, storageFinished, unixFinished);128 104 SysSuspendThread(threadId); 105 // SysYield(); 129 106 } 130 107 … … 132 109 133 110 char* args[]={NULL}; 111 112 int fd = SysOpen("/test.txt", 0, 0); 113 114 int fds[] = {0, 3, 2}; 134 115 135 //SysCreateProcess("/System/Startup/regserver", NULL, args);116 //SysCreateProcess("/System/Startup/regserver", NULL, args); 136 117 137 pid =SysCreateProcess("/Applications/burn", NULL, args);118 pid = SysCreateProcess("/Applications/burn", fds, args); 138 119 139 120 SysWaitForProcessFinish(pid, NULL); -
Whitix/branches/netchannel/user/xynth/demo/desktop/Makefile
r910 r2084 8 8 CFLAGS += -DDESKTOPDIR=\"$(DESKTOPDIR)\" 9 9 INCDIR = ../../src/lib ../../../libc/include ../../../posix/include 10 LIBDIR = ../../src/lib ../../../libc ../../../posix ../../../linker/dl ../../../ linker11 LDFLAGS = -t -lxynth -lstdc -lposix -lm -ldl -l pthread -llinker ../../../libc/init/init.o10 LIBDIR = ../../src/lib ../../../libc ../../../posix ../../../linker/dl ../../../sdk/libs ../../../linker 11 LDFLAGS = -t -lxynth -lstdc -lposix -lm -ldl -lnetwork -lpthread -llinker ../../../libc/init/init.o 12 12 13 13 OBJS = desktop.o main.o menu.o taskbar.o -
Whitix/branches/netchannel/user/xynth/demo/desktop/Makefile.depend
r2061 r2084 1 1 desktop.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.h2 ../../../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 18 18 main.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.h19 ../../../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 35 35 menu.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.h36 ../../../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 52 52 taskbar.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.h53 ../../../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 6 6 7 7 INCDIR = ../../src/lib ../../../libc/include ../../../sdk/include ../../../posix/include 8 LIBDIR = ../../src/lib ../../../libc ../../../posix ../../../linker 9 LDFLAGS = -t -lxynth -lstdc -lposix -lm -ldl -l pthread -llinker ../../../libc/init/init.o8 LIBDIR = ../../src/lib ../../../libc ../../../posix ../../../linker ../../../sdk/libs 9 LDFLAGS = -t -lxynth -lstdc -lposix -lm -ldl -lnetwork -lpthread -llinker ../../../libc/init/init.o 10 10 11 11 OBJS = term.o -
Whitix/branches/netchannel/user/xynth/src/lib/Makefile.depend
r2061 r2084 1 1 alloc.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/s
