From 4f6ab5fa31fb60ddd8085783c8d21a48cab4c674 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 28 Dec 2009 17:48:44 +0800 Subject: [PATCH] Bugfixes upon chaning GCC versions - Also updating my config to be correct for my new machine --- Kernel/Makefile.BuildNum | 2 +- Kernel/drv/dma.c | 34 +++++++++++++-------------- Kernel/vfs/nodecache.c | 7 ++++-- Makefile.cfg | 2 +- README | 2 ++ Usermode/Applications/Makefile.cfg | 6 ++--- Usermode/Filesystem/Conf/BootConf.cfg | 0 Usermode/Libraries/acess.ld | 2 +- 8 files changed, 30 insertions(+), 25 deletions(-) mode change 100755 => 100644 Usermode/Filesystem/Conf/BootConf.cfg diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index 188cc18d..65deeabc 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 1080 +BUILD_NUM = 1084 diff --git a/Kernel/drv/dma.c b/Kernel/drv/dma.c index 0fae172b..246ab46b 100644 --- a/Kernel/drv/dma.c +++ b/Kernel/drv/dma.c @@ -32,7 +32,7 @@ t_dmaChannel dma_channels[8]; */ void DMA_Install() { - int i; + Uint i; for(i=8;i--;) { outb( cMASKPORT[i], 0x04 | (i & 0x3) ); // mask channel @@ -49,32 +49,32 @@ void DMA_Install() dma_channels[i].mode = 0; dma_addresses[i] = (char*)DMA_ADDRESS(i); - dma_addresses[i] += 0xC0000000; + dma_addresses[i] += KERNEL_BASE; } } /** - * \fn void DMA_SetChannel(int channel, int length, int read) + * \fn void DMA_SetChannel(int Channel, int length, int read) * \brief Set DMA Channel Length and RW */ -void DMA_SetChannel(int channel, int length, int read) +void DMA_SetChannel(int Channel, int length, int read) { - channel &= 7; - read = read && 1; + Uint chan = Channel & 7; + read = !!read; if(length > DMA_SIZE) length = DMA_SIZE; length --; //Adjust for DMA //__asm__ __volatile__ ("cli"); - outb( cMASKPORT[channel], 0x04 | (channel & 0x3) ); // mask channel - outb( cCLEARPORT[channel], 0x00 ); - outb( cMODEPORT[channel], (0x44 + (!read)*4) | (channel & 0x3) ); - outb( cADDRPORT[channel], LOWB(DMA_ADDRESS(channel)) ); // send address - outb( cADDRPORT[channel], HIB(DMA_ADDRESS(channel)) ); // send address - outb( cPAGEPORT[channel], HIW(DMA_ADDRESS(channel)) ); // send page - outb( cCOUNTPORT[channel], LOWB(length) ); // send size - outb( cCOUNTPORT[channel], HIB(length) ); // send size - outb( cMASKPORT[channel], channel & 0x3 ); // unmask channel - dma_addresses[channel] = (char*)DMA_ADDRESS(channel); - dma_addresses[channel] += 0xC0000000; + outb( cMASKPORT[chan], 0x04 | (chan & 0x3) ); // mask channel + outb( cCLEARPORT[chan], 0x00 ); + outb( cMODEPORT[chan], (0x44 + (!read)*4) | (chan & 0x3) ); + outb( cADDRPORT[chan], LOWB(DMA_ADDRESS(chan)) ); // send address + outb( cADDRPORT[chan], HIB(DMA_ADDRESS(chan)) ); // send address + outb( cPAGEPORT[chan], HIW(DMA_ADDRESS(chan)) ); // send page + outb( cCOUNTPORT[chan], LOWB(length) ); // send size + outb( cCOUNTPORT[chan], HIB(length) ); // send size + outb( cMASKPORT[chan], chan & 0x3 ); // unmask channel + dma_addresses[chan] = (char*)DMA_ADDRESS(chan); + dma_addresses[chan] += KERNEL_BASE; //__asm__ __volatile__ ("sti"); } diff --git a/Kernel/vfs/nodecache.c b/Kernel/vfs/nodecache.c index c503e9cb..b1b1b61c 100644 --- a/Kernel/vfs/nodecache.c +++ b/Kernel/vfs/nodecache.c @@ -158,7 +158,7 @@ void Inode_UncacheNode(int Handle, Uint64 Inode) void Inode_ClearCache(int Handle) { tInodeCache *cache; - tInodeCache *prev = (tInodeCache*) &gVFS_InodeCache; + tInodeCache *prev = NULL; tCachedInode *ent, *next; // Find the cache @@ -184,7 +184,10 @@ void Inode_ClearCache(int Handle) } // Free Cache - prev->Next = cache->Next; + if(prev == NULL) + gVFS_InodeCache = cache->Next; + else + prev->Next = cache->Next; free(cache); } diff --git a/Makefile.cfg b/Makefile.cfg index 3875828f..3f06360f 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -26,4 +26,4 @@ MODULES = UDI FS_Ext2 FDD NE2000 BochsGA #DISTROOT = /mnt/AcessHDD/Acess2 #DISTROOT = ~/Projects/Acess2/Filesystem DISTROOT = a:/Acess2 -ACESSDIR = /home/hodgeja/Projects/Acess2 +ACESSDIR = /home/tpg/Projects/Acess2 diff --git a/README b/README index fa3fd3e7..4fb8be16 100644 --- a/README +++ b/README @@ -42,6 +42,8 @@ MODULES defines what modules should be statically linked with the kernel Set the source root directory (ACESSDIR) and the destination directory (DISTROOT). +To be able to build usermode programs, Usermode/Libraries/acess.ld needs + to be edited to change the SEARCH_DIR directive to the correct path. You may also want to edit Usermode/Filesystem/Conf/BootConf.cfg before installing. diff --git a/Usermode/Applications/Makefile.cfg b/Usermode/Applications/Makefile.cfg index 146177dd..fd8bc451 100644 --- a/Usermode/Applications/Makefile.cfg +++ b/Usermode/Applications/Makefile.cfg @@ -6,9 +6,9 @@ if $(ACESSDIR) == "" then -include ../../../../Makefile.cfg #endif -ACESSDIR := $(ACESSDIR)/Usermode +ACESSUSERDIR := $(ACESSDIR)/Usermode ASFLAGS = -felf -CPPFLAGS = -I$(ACESSDIR)/include/ +CPPFLAGS = -I$(ACESSUSERDIR)/include/ CFLAGS = -fno-stack-protector $(CPPFLAGS) -LDFLAGS = -T $(ACESSDIR)/Libraries/acess.ld -L $(ACESSDIR)/Libraries -I /Acess/Libs/ld-acess.so -lc +LDFLAGS = -T $(ACESSUSERDIR)/Libraries/acess.ld -L $(ACESSUSERDIR)/Libraries -I /Acess/Libs/ld-acess.so -lc diff --git a/Usermode/Filesystem/Conf/BootConf.cfg b/Usermode/Filesystem/Conf/BootConf.cfg old mode 100755 new mode 100644 diff --git a/Usermode/Libraries/acess.ld b/Usermode/Libraries/acess.ld index adf7b2a0..aa2edd3f 100644 --- a/Usermode/Libraries/acess.ld +++ b/Usermode/Libraries/acess.ld @@ -1,7 +1,7 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) ENTRY(start) -SEARCH_DIR(/home/hodgeja/Projects/Acess2/Usermode/Libraries) +SEARCH_DIR(/home/tpg/Projects/Acess2/Usermode/Libraries) INPUT(-lacess crt0.o) SECTIONS { -- 2.20.1