diff --git a/src/grayspace-misc/gsdefines.h b/src/grayspace-misc/gsdefines.h index dd52b00..2cdb4f0 100755 --- a/src/grayspace-misc/gsdefines.h +++ b/src/grayspace-misc/gsdefines.h @@ -1,76 +1,76 @@ -/* - "gsdefines.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 11, 2002 - - Purpose: - - I need/like to use simple defines for basic sized types which - aren't compiler dependant. - So here I define them and will use them, when we decide on some conventions - I will search and replace them out with the proper ones - - - I need some kind of define for target architecture - - NOTES: - - I will stick a 'g' on the end global defines I make for myself - - all my types are ending with g when unsigned, gs when signed - - for now, when I don't care about bit width and hwen I want - just an int for example, I will just use 'int' and assume - this will be the fastest type for doing math on the host CPU - - $Id$ -*/ - -#ifndef _GSDEFINES_H -#define _GSDEFINES_H - -/* HACK: put somewhere better */ - -/* target CPU types (0) means unknown */ -/* HACK: assume we're using IA32 architecture */ -#define TCPU_UNKNOWN (0) -#define TCPU_IA32 (1) - -/* host compiler types (0) means unknown */ -/* HACK: assume we're using gcc 2.95.* comptible compiler */ -#define HCMPLR_UNKNOWN (0) -#define HCMPLR_GCC_2_95_COMPAT (1) - -#if (TCPU_IA32 & HCMPLR_GCC_2_95_COMPAT) - -#define BYTEg unsigned char -#define BYTEgs signed char -#define WORDg unsigned short int -#define WORDgs signed short int -#define DWORDg unsigned int -#define DWORDgs signed int -#define QWORDg unsigned long long int -#define QWORDgs signed long long int - -#else /* #if (TCPU_IA32 & HCMPLR_GCC_2_95_COMPAT) */ - -#error build environment unknown!!! - -#endif /* #if (TCPU_??? & HCMPLR_???) */ - -/* handy macro for creating a bit mask */ -#define MAKEMASK_GS( numbits, bitpos ) (((1<<(numbits)) - 1)<<(bitpos)) - -/* handy macro for extracting masked bits */ -#define GETBITVAL_GS( bits, bitmask, bitpos ) (((bits)&(bitmask))>>(bitpos)) - -/* handy macro for setting masked bits - NOTE: *only* bits which fall into 'bitmask' once positioned will be set */ -#define SETBITVAL_GS( bits_o, bitmask, bitpos, val )\ - (bits_o) &= ~(bitmask);\ - (bits_o) |= ((val)<<(bitpos)&bitmask) - -/* handy macro for setting masked bits with the assumption - that 'val' once positioned will *only* contain bits in 'bitmask' */ -#define SETBITVAL_FAST_GS( bits_o, bitmask, bitpos, val )\ - (bits_o) &= ~(bitmask);\ - (bits_o) |= ((val)<<(bitpos)) - +/* + "gsdefines.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 11, 2002 + + Purpose: + - I need/like to use simple defines for basic sized types which + aren't compiler dependant. + So here I define them and will use them, when we decide on some conventions + I will search and replace them out with the proper ones + + - I need some kind of define for target architecture + + NOTES: + - I will stick a 'g' on the end global defines I make for myself + - all my types are ending with g when unsigned, gs when signed + - for now, when I don't care about bit width and hwen I want + just an int for example, I will just use 'int' and assume + this will be the fastest type for doing math on the host CPU + + $Id$ +*/ + +#ifndef _GSDEFINES_H +#define _GSDEFINES_H + +/* HACK: put somewhere better */ + +/* target CPU types (0) means unknown */ +/* HACK: assume we're using IA32 architecture */ +#define TCPU_UNKNOWN (0) +#define TCPU_IA32 (1) + +/* host compiler types (0) means unknown */ +/* HACK: assume we're using gcc 2.95.* comptible compiler */ +#define HCMPLR_UNKNOWN (0) +#define HCMPLR_GCC_2_95_COMPAT (1) + +#if (TCPU_IA32 & HCMPLR_GCC_2_95_COMPAT) + +#define BYTEg unsigned char +#define BYTEgs signed char +#define WORDg unsigned short int +#define WORDgs signed short int +#define DWORDg unsigned int +#define DWORDgs signed int +#define QWORDg unsigned long long int +#define QWORDgs signed long long int + +#else /* #if (TCPU_IA32 & HCMPLR_GCC_2_95_COMPAT) */ + +#error build environment unknown!!! + +#endif /* #if (TCPU_??? & HCMPLR_???) */ + +/* handy macro for creating a bit mask */ +#define MAKEMASK_GS( numbits, bitpos ) (((1<<(numbits)) - 1)<<(bitpos)) + +/* handy macro for extracting masked bits */ +#define GETBITVAL_GS( bits, bitmask, bitpos ) (((bits)&(bitmask))>>(bitpos)) + +/* handy macro for setting masked bits + NOTE: *only* bits which fall into 'bitmask' once positioned will be set */ +#define SETBITVAL_GS( bits_o, bitmask, bitpos, val )\ + (bits_o) &= ~(bitmask);\ + (bits_o) |= ((val)<<(bitpos)&bitmask) + +/* handy macro for setting masked bits with the assumption + that 'val' once positioned will *only* contain bits in 'bitmask' */ +#define SETBITVAL_FAST_GS( bits_o, bitmask, bitpos, val )\ + (bits_o) &= ~(bitmask);\ + (bits_o) |= ((val)<<(bitpos)) + #endif /* _GSDEFINES_H */ \ No newline at end of file diff --git a/src/sys/Makefile b/src/sys/Makefile index ef3847c..77bb769 100755 --- a/src/sys/Makefile +++ b/src/sys/Makefile @@ -1,7 +1,7 @@ # $Id$ # Kernel Makefile (C) 2002 The UbixOS Project -all: boot-code init-code kernel-code driver-code vmm-code ubixfs-code graphics-code kernel-img +all: boot-code init-code kernel-code driver-code deviceman-code vmm-code ubixfs-code graphics-code kernel-img boot-code: boot (cd boot;make) @@ -15,6 +15,9 @@ driver-code: drivers (cd drivers;make) +deviceman-code: deviceman + (cd deviceman;make) + vmm-code: vmm (cd vmm;make) @@ -38,6 +41,7 @@ (cd boot;make clean) (cd init;make clean) (cd drivers;make clean) + (cd deviceman;make clean) (cd kernel;make clean) (cd compile;make clean) (cd vmm;make clean) diff --git a/src/sys/deviceman/Makefile b/src/sys/deviceman/Makefile new file mode 100755 index 0000000..cda0cf3 --- /dev/null +++ b/src/sys/deviceman/Makefile @@ -0,0 +1,35 @@ +# (C) 2002 The UbixOS Project +# $Id$ + + +# Compiler +CC = gcc +CPP = g++ + + +# Linker +LINKER = ld + +# Remove +REMOVE = rm -fr + +# Objects +OBJS = bus_resources_portio.o + +all: $(OBJS) + +# Compile Types +.cc.o: + $(CPP) -Wall -fomit-frame-pointer -O -I../include -c -o $@ $< +.cc.s: + $(CPP) -Wall -fomit-frame-pointer -O -I../include -S -o $@ $< +.c.o: + $(CC) -Wall -fomit-frame-pointer -O -I../include -c -o $@ $< +.c.s: + $(CC) -Wall -fomit-frame-pointer -O -I../include -S -o $@ $< +.S.o: + $(CC) -Wall -fomit-frame-pointer -c -o $@ $< + +# Clean up the junk +clean: + $(REMOVE) $(OBJS) \ No newline at end of file diff --git a/src/sys/include/deviceman/bus.h b/src/sys/include/deviceman/bus.h index b8a5eb1..19326f6 100755 --- a/src/sys/include/deviceman/bus.h +++ b/src/sys/include/deviceman/bus.h @@ -1,20 +1,20 @@ -/* - "bus.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 11, 2002 - - purpose: master header file for all things BUS related - - $Id$ -*/ - -#ifndef _BUS_H -#define _BUS_H - -#include "bus_resources.h" - - - +/* + "bus.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 11, 2002 + + purpose: master header file for all things BUS related + + $Id$ +*/ + +#ifndef _BUS_H +#define _BUS_H + +#include "bus_resources.h" + + + #endif /* _BUS_H */ \ No newline at end of file diff --git a/src/sys/include/deviceman/bus_resources.h b/src/sys/include/deviceman/bus_resources.h index f2f2124..45978e4 100755 --- a/src/sys/include/deviceman/bus_resources.h +++ b/src/sys/include/deviceman/bus_resources.h @@ -1,219 +1,219 @@ -/* - "bus_resources.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 12, 2002 - - purpose: master header file for bus resource management - - $Id$ -*/ - -#ifndef _BUS_RESOURCES_H -#define _BUS_RESOURCES_H - -/* Intel 32-bit architecture */ -#if TCPU_IA32 - -/* DMA channels */ -#define MIN_DMA_CHANNEL (0) -#define MAX_DMA_CHANNEL (7) -#define NUM_DMA_CHANNELS (MAX_DMA_CHANNEL - MIN_DMA_CHANNEL - 1) - -/* IRQs */ -#define MIN_IRQ (0) -#define MAX_IRQ (15) -#define NUM_IRQS (MAX_IRQ - MIN_IRQ - 1) - -/* Port IO Range */ -#define MIN_PORTIO_ADDR (0) -#define MAX_PORTIO_ADDR (1023) -#define MAXBITS_PORTIO_ADDR (10) - -/* NOTE: 'BI_' denotes roughly something related to BUS info */ - -/* for building/use-with device-info/bus-resource-info structures */ -#define BI_NUMBITS_IRQS (4) -#define BI_NUMBITS_DMA_CHANNELS (3) -#define BI_IRQ_BIT (0) -#define BI_DMA_CHANNEL_BIT (BI_IRQ_BIT + BI_NUMBITS_IRQS) - -#define BI_IRQ_MASK\ - MAKEMASK_GS( BI_NUMBITS_IRQS, BI_IRQ_BIT ) -#define BI_DMA_CHANNEL_MASK\ - MAKEMASK_GS( BI_NUMBITS_DMA_CHANNELS, BI_DMA_CHANNEL_BIT ) - -#define BI_NUMBITS_PORTIO_BASEADDR (16) -#define BI_NUMBITS_PORTIO_OVERADDR (16) -#define BI_PORTIO_BASEADDR_BIT (0) -#define BI_PORTIO_OVERADDR_BIT ( BI_PORTIO_BASEADDR_BIT\ - + BI_NUMBITS_PORTIO_BASEADDR ) -#define BI_PORTIO_BASEADDR_MASK\ - MAKEMASK_GS( BI_NUMBITS_PORTIO_BASEADDR, BI_PORTIO_BASEADDR_BIT ) -#define BI_PORTIO_OVERADDR_MASK\ - MAKEMASK_GS( BI_NUMBITS_PORTIO_OVERADDR, BI_PORTIO_OVERADDR_BIT ) - -/* maximum number of DMAs and IRQs a device can use - NOTE: *must* be same */ -#define BI_MAX_DMAANDIRQS (2) -#define BI_MAX_DMAS (BI_MAX_DMAANDIRQS) -#define BI_MAX_IRQS (BI_MAX_DMAANDIRQS) - -/* maximum number of Port IO ranges a device can use */ -#define BI_MAX_PORTIO_RANGES (4) - -/* structure for storing a device's bus resources */ -typedef struct tagBUS_RESOURCES -{ - /* DMA and IRQ info */ - BYTEg a_dmairq[BI_MAX_DMAANDIRQS]; - - /* - bits [0,1] number of IRQs used - bits [2,3] number of DMA channels used - bits [4,7] number of port IO ranges used - */ - BYTEg resource_counts; - - /* Port IO Ranges */ - DWORDg a_portiorange[BI_MAX_PORTIO_RANGES]; -} -BUS_RESOURCES; - -/* NOTE: 'BUS_RES' denotes interface functions/macros on - the 'BUS_RESOURCES' structure */ - -#if (BI_IRQ_BIT == 0) - /* get IRQ 'idx' from resource description 'br' */ - #define BUS_RES_GETIRQ( br, idx ) ((br).a_dmairq[(idx)]&BI_IRQ_MASK) - - /* set IRQ 'idx' in resource description 'br' to 'irq' */ - #define BUS_RES_SETIRQ( br, idx, irq )\ - (br).a_dmairq[(idx)] &= BI_IRQ_MASK;\ - (br).a_dmairq[(idx)] |= (irq) -#else - /* get IRQ 'idx' from resource description 'br' */ - #define BUS_RES_GETIRQ( br, idx )\ - GETBITVAL_GS( (br).a_dmairq[(idx)], BI_IRQ_MASK, BI_IRQ_BIT ) - - /* set IRQ 'idx' in resource description 'br' to 'irq' */ - #define BUS_RES_SETIRQ( br, idx, irq )\ - SETBITVAL_FAST_GS( (br).a_dmairq[(idx)],\ - BI_IRQ_MASK,\ - BI_IRQ_BIT,\ - (irq) ) -#endif - -/* get DMA 'idx' from resource description 'br' */ -#define BUS_RES_GETDMA( br, idx )\ - GETBITVAL_GS( (br).a_dmairq[(idx)], BI_DMA_MASK, BI_DMA_BIT ) - -/* set DMA 'idx' in resource description 'br' to 'dma' */ -#define BUS_RES_SETDMA( br, idx, dma )\ - SETBITVAL_FAST_GS( (br).a_dmairq[(idx)],\ - BI_DMA_MASK,\ - BI_DMA_BIT,\ - (dma) ) - -#if (BI_PORTIO_BASEADDR_BIT == 0) && (BI_PORTIO_OVERADDR_BIT == BI_NUMBITS_PORTIO_BASEADDR ) - /* get port IO base address 'idx' from resource description 'br' */ - #define BUS_RES_GETPORTIOBASE( br, idx )\ - ((br).a_portiorange[(idx)]&BI_PORTIO_BASEADDR_MASK) - - /* get port IO 'over' address 'idx' from resource description 'br' */ - #define BUS_RES_GETPORTIOOVER( br, idx )\ - ((br).a_portiorange[(idx)]>>BI_PORTIO_OVERADDR_BIT) - - /* get port IO range 'idx' from resource description 'br' - into 'baseaddr_o' and 'overaddr_o' */ - #define BUS_RES_GETPORTIORANGE( br, idx, baseaddr_o, overaddr_o )\ - (baseaddr_o)\ - = ((br).a_portiorange[(idx)] & BI_PORTIO_BASEADDR_MASK);\ - (overaddr_o)\ - = ((br).a_portiorange[(idx)] >> BI_PORTIO_OVERADDR_BIT) - - /* set port IO range 'idx' in resource description 'br' - to 'baseaddr' and 'overaddr' */ - #define BUS_RES_SETPORTIORANGE( br, idx, baseaddr, overaddr )\ - ((br).a_portiorange[(idx)]\ - = ((overaddr)<>2) -/* set number of IRQs used/assign-to device */ -#define BUS_RES_SETIRQSUSED( br, irqsused )\ - (br).resource_counts &= ~0x0C;\ - (br).resource_counts |= ((irqsused)<<2) - -/* get number of DMAs used/assign-to device */ -#define BUS_RES_GETDMASUSED( br )\ - ((br).resource_counts & 3) -/* set number of DMAs used/assign-to device */ -#define BUS_RES_SETDMASUSED( br, dmasused )\ - (br).resource_counts &= ~3;\ - (br).resource_counts |= (dmasused) - -/* get number of port IO ranges used/assign-to device */ -#define BUS_RES_GETPORTIORANGESUSED( br )\ - (((br).resource_counts)>>4) -/* get number of port IO ranges used/assign-to device */ -#define BUS_RES_SETPORTIORANGESUSED( br, rangesused )\ - (br).resource_counts &= 0x0F;\ - (br).resource_counts |= ((rangesused)<<4) - -#else /* #if TCPU_IA32 */ - -#error unknown target CPU!!! - -#endif /* #if TCPU_??? */ - -#include "bus_resources_portio.h" - +/* + "bus_resources.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 12, 2002 + + purpose: master header file for bus resource management + + $Id$ +*/ + +#ifndef _BUS_RESOURCES_H +#define _BUS_RESOURCES_H + +/* Intel 32-bit architecture */ +#if TCPU_IA32 + +/* DMA channels */ +#define MIN_DMA_CHANNEL (0) +#define MAX_DMA_CHANNEL (7) +#define NUM_DMA_CHANNELS (MAX_DMA_CHANNEL - MIN_DMA_CHANNEL - 1) + +/* IRQs */ +#define MIN_IRQ (0) +#define MAX_IRQ (15) +#define NUM_IRQS (MAX_IRQ - MIN_IRQ - 1) + +/* Port IO Range */ +#define MIN_PORTIO_ADDR (0) +#define MAX_PORTIO_ADDR (1023) +#define MAXBITS_PORTIO_ADDR (10) + +/* NOTE: 'BI_' denotes roughly something related to BUS info */ + +/* for building/use-with device-info/bus-resource-info structures */ +#define BI_NUMBITS_IRQS (4) +#define BI_NUMBITS_DMA_CHANNELS (3) +#define BI_IRQ_BIT (0) +#define BI_DMA_CHANNEL_BIT (BI_IRQ_BIT + BI_NUMBITS_IRQS) + +#define BI_IRQ_MASK\ + MAKEMASK_GS( BI_NUMBITS_IRQS, BI_IRQ_BIT ) +#define BI_DMA_CHANNEL_MASK\ + MAKEMASK_GS( BI_NUMBITS_DMA_CHANNELS, BI_DMA_CHANNEL_BIT ) + +#define BI_NUMBITS_PORTIO_BASEADDR (16) +#define BI_NUMBITS_PORTIO_OVERADDR (16) +#define BI_PORTIO_BASEADDR_BIT (0) +#define BI_PORTIO_OVERADDR_BIT ( BI_PORTIO_BASEADDR_BIT\ + + BI_NUMBITS_PORTIO_BASEADDR ) +#define BI_PORTIO_BASEADDR_MASK\ + MAKEMASK_GS( BI_NUMBITS_PORTIO_BASEADDR, BI_PORTIO_BASEADDR_BIT ) +#define BI_PORTIO_OVERADDR_MASK\ + MAKEMASK_GS( BI_NUMBITS_PORTIO_OVERADDR, BI_PORTIO_OVERADDR_BIT ) + +/* maximum number of DMAs and IRQs a device can use + NOTE: *must* be same */ +#define BI_MAX_DMAANDIRQS (2) +#define BI_MAX_DMAS (BI_MAX_DMAANDIRQS) +#define BI_MAX_IRQS (BI_MAX_DMAANDIRQS) + +/* maximum number of Port IO ranges a device can use */ +#define BI_MAX_PORTIO_RANGES (4) + +/* structure for storing a device's bus resources */ +typedef struct tagBUS_RESOURCES +{ + /* DMA and IRQ info */ + BYTEg a_dmairq[BI_MAX_DMAANDIRQS]; + + /* + bits [0,1] number of IRQs used + bits [2,3] number of DMA channels used + bits [4,7] number of port IO ranges used + */ + BYTEg resource_counts; + + /* Port IO Ranges */ + DWORDg a_portiorange[BI_MAX_PORTIO_RANGES]; +} +BUS_RESOURCES; + +/* NOTE: 'BUS_RES' denotes interface functions/macros on + the 'BUS_RESOURCES' structure */ + +#if (BI_IRQ_BIT == 0) + /* get IRQ 'idx' from resource description 'br' */ + #define BUS_RES_GETIRQ( br, idx ) ((br).a_dmairq[(idx)]&BI_IRQ_MASK) + + /* set IRQ 'idx' in resource description 'br' to 'irq' */ + #define BUS_RES_SETIRQ( br, idx, irq )\ + (br).a_dmairq[(idx)] &= BI_IRQ_MASK;\ + (br).a_dmairq[(idx)] |= (irq) +#else + /* get IRQ 'idx' from resource description 'br' */ + #define BUS_RES_GETIRQ( br, idx )\ + GETBITVAL_GS( (br).a_dmairq[(idx)], BI_IRQ_MASK, BI_IRQ_BIT ) + + /* set IRQ 'idx' in resource description 'br' to 'irq' */ + #define BUS_RES_SETIRQ( br, idx, irq )\ + SETBITVAL_FAST_GS( (br).a_dmairq[(idx)],\ + BI_IRQ_MASK,\ + BI_IRQ_BIT,\ + (irq) ) +#endif + +/* get DMA 'idx' from resource description 'br' */ +#define BUS_RES_GETDMA( br, idx )\ + GETBITVAL_GS( (br).a_dmairq[(idx)], BI_DMA_MASK, BI_DMA_BIT ) + +/* set DMA 'idx' in resource description 'br' to 'dma' */ +#define BUS_RES_SETDMA( br, idx, dma )\ + SETBITVAL_FAST_GS( (br).a_dmairq[(idx)],\ + BI_DMA_MASK,\ + BI_DMA_BIT,\ + (dma) ) + +#if (BI_PORTIO_BASEADDR_BIT == 0) && (BI_PORTIO_OVERADDR_BIT == BI_NUMBITS_PORTIO_BASEADDR ) + /* get port IO base address 'idx' from resource description 'br' */ + #define BUS_RES_GETPORTIOBASE( br, idx )\ + ((br).a_portiorange[(idx)]&BI_PORTIO_BASEADDR_MASK) + + /* get port IO 'over' address 'idx' from resource description 'br' */ + #define BUS_RES_GETPORTIOOVER( br, idx )\ + ((br).a_portiorange[(idx)]>>BI_PORTIO_OVERADDR_BIT) + + /* get port IO range 'idx' from resource description 'br' + into 'baseaddr_o' and 'overaddr_o' */ + #define BUS_RES_GETPORTIORANGE( br, idx, baseaddr_o, overaddr_o )\ + (baseaddr_o)\ + = ((br).a_portiorange[(idx)] & BI_PORTIO_BASEADDR_MASK);\ + (overaddr_o)\ + = ((br).a_portiorange[(idx)] >> BI_PORTIO_OVERADDR_BIT) + + /* set port IO range 'idx' in resource description 'br' + to 'baseaddr' and 'overaddr' */ + #define BUS_RES_SETPORTIORANGE( br, idx, baseaddr, overaddr )\ + ((br).a_portiorange[(idx)]\ + = ((overaddr)<>2) +/* set number of IRQs used/assign-to device */ +#define BUS_RES_SETIRQSUSED( br, irqsused )\ + (br).resource_counts &= ~0x0C;\ + (br).resource_counts |= ((irqsused)<<2) + +/* get number of DMAs used/assign-to device */ +#define BUS_RES_GETDMASUSED( br )\ + ((br).resource_counts & 3) +/* set number of DMAs used/assign-to device */ +#define BUS_RES_SETDMASUSED( br, dmasused )\ + (br).resource_counts &= ~3;\ + (br).resource_counts |= (dmasused) + +/* get number of port IO ranges used/assign-to device */ +#define BUS_RES_GETPORTIORANGESUSED( br )\ + (((br).resource_counts)>>4) +/* get number of port IO ranges used/assign-to device */ +#define BUS_RES_SETPORTIORANGESUSED( br, rangesused )\ + (br).resource_counts &= 0x0F;\ + (br).resource_counts |= ((rangesused)<<4) + +#else /* #if TCPU_IA32 */ + +#error unknown target CPU!!! + +#endif /* #if TCPU_??? */ + +#include "bus_resources_portio.h" + #endif /* _BUS_RESOURCES_H */ \ No newline at end of file diff --git a/src/sys/include/deviceman/bus_resources_portio.h b/src/sys/include/deviceman/bus_resources_portio.h index 59d34d6..6e4d074 100755 --- a/src/sys/include/deviceman/bus_resources_portio.h +++ b/src/sys/include/deviceman/bus_resources_portio.h @@ -1,47 +1,47 @@ -/* - "bus_resources_portio.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 12, 2002 - - purpose: for port IO resource management - - $Id$ -*/ - -#ifndef _BUS_RESOURCES_PORTIO_H -#define _BUS_RESOURCES_PORTIO_H - -/* for managing port IO ranges */ -typedef struct tagBUS_PORTIO_POOL -{ - DWORDg a_addrs[(1<<(MAXBITS_PORTIO_ADDR-5))]; -} -BUS_PORTIO_POOL; - -/* checks a range of port addresses - returns: - - 1 if the range is comptetely empty - - 0 otherwise */ -int BUS_PORTIO_CheckRange( BUS_PORTIO_POOL * p_bpp, - DWORDg baseaddr, - DWORDg overaddr ); - -/* allocates a range of port addresses - returns: - - 1 on success - - 0 on failure */ -int BUS_PORTIO_AllocateRange( BUS_PORTIO_POOL * p_bpp, - DWORDg baseaddr, - DWORDg overaddr ); - -/* frees a range of port addresses - returns: - - 1 if any port addresses in the range were allocated - - 0 otherwise */ -int BUS_PORTIO_FreeRange( BUS_PORTIO_POOL * p_bpp, - DWORDg baseaddr, - DWORDg overaddr ); - +/* + "bus_resources_portio.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 12, 2002 + + purpose: for port IO resource management + + $Id$ +*/ + +#ifndef _BUS_RESOURCES_PORTIO_H +#define _BUS_RESOURCES_PORTIO_H + +/* for managing port IO ranges */ +typedef struct tagBUS_PORTIO_POOL +{ + DWORDg a_addrs[(1<<(MAXBITS_PORTIO_ADDR-5))]; +} +BUS_PORTIO_POOL; + +/* checks a range of port addresses + returns: + - 1 if the range is comptetely empty + - 0 otherwise */ +int BUS_PORTIO_CheckRange( BUS_PORTIO_POOL * p_bpp, + DWORDg baseaddr, + DWORDg overaddr ); + +/* allocates a range of port addresses + returns: + - 1 on success + - 0 on failure */ +int BUS_PORTIO_AllocateRange( BUS_PORTIO_POOL * p_bpp, + DWORDg baseaddr, + DWORDg overaddr ); + +/* frees a range of port addresses + returns: + - 1 if any port addresses in the range were allocated + - 0 otherwise */ +int BUS_PORTIO_FreeRange( BUS_PORTIO_POOL * p_bpp, + DWORDg baseaddr, + DWORDg overaddr ); + #endif /* _BUS_RESOURCES_PORTIO_H */ \ No newline at end of file diff --git a/src/sys/include/deviceman/device.h b/src/sys/include/deviceman/device.h index dde9881..3097f7d 100755 --- a/src/sys/include/deviceman/device.h +++ b/src/sys/include/deviceman/device.h @@ -1,88 +1,88 @@ -/* - "device.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 11, 2002 - - purpose: master header file for all things device related - - $Id$ -*/ - -#ifndef _DEVICE_H -#define _DEVICE_H - -// maximum length of a device's name -#define MAX_DEVICE_NAMELEN (16) - -// maximum number of bus devices allowed -#define MAX_BUS_DEVICES (16) - -/* device types (for now, only bus devices allowed) */ -#define DEVICE_TYPE_UNKNOWN (0) -#define DEVICE_TYPE_BUS_ISA (1) -#define DEVICE_TYPE_BUS_PCI (2) - -/* device ISR or pseudo ISR */ -typedef int (* DEVICE_ISR)( void * p ); - -/* device IO routine */ -typedef int (* DEVICE_IO_RTN)( void * p ); - -/* device control routine */ -typedef int (* DEVICE_CTRL_RTN)( void * p ); - -/* ISA bus device structure */ -typedef struct tagDEVICE_ISA -{ - /* bus resources assigned to device */ - BUS_RESOURCES br; - - /* ISRs for device */ - DEVICE_ISR * apfn_isr[BI_MAX_IRQS]; - - /* device IO routine (kernel/driver use only) */ - DEVICE_IO_RTN pfn_io; - - /* device control routine (kernel/driver use only) */ - DEVICE_CTRL_RTN pfn_ctrl; -} -DEVICE_BUS_ISA; - -/* PCI bus device structure */ -/* TODO */ -typedef struct tagDEVICE_BUS_PCI -{ - int dummy; -} -DEVICE_PCI; - -/* bus device structure */ -typedef union tagDEVICE_BUS -{ - DEVICE_BUS_ISA isa; - DEVICE_BUS_PCI pci; -} -DEVICE_BUS; - -/* device structure */ -typedef struct tagDEVICE -{ - /* type of device */ - BYTEg type; - - /* pointer to actual device specific structure */ - void * p; -} -DEVICE; - -/* global kernel structure for device information */ -typedef struct tagDEVICES -{ - /* bus devices */ - DEVICE a_isa[MAX_BUS_DEVICES]; -} -DEVICES; - +/* + "device.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 11, 2002 + + purpose: master header file for all things device related + + $Id$ +*/ + +#ifndef _DEVICE_H +#define _DEVICE_H + +// maximum length of a device's name +#define MAX_DEVICE_NAMELEN (16) + +// maximum number of bus devices allowed +#define MAX_BUS_DEVICES (16) + +/* device types (for now, only bus devices allowed) */ +#define DEVICE_TYPE_UNKNOWN (0) +#define DEVICE_TYPE_BUS_ISA (1) +#define DEVICE_TYPE_BUS_PCI (2) + +/* device ISR or pseudo ISR */ +typedef int (* DEVICE_ISR)( void * p ); + +/* device IO routine */ +typedef int (* DEVICE_IO_RTN)( void * p ); + +/* device control routine */ +typedef int (* DEVICE_CTRL_RTN)( void * p ); + +/* ISA bus device structure */ +typedef struct tagDEVICE_ISA +{ + /* bus resources assigned to device */ + BUS_RESOURCES br; + + /* ISRs for device */ + DEVICE_ISR * apfn_isr[BI_MAX_IRQS]; + + /* device IO routine (kernel/driver use only) */ + DEVICE_IO_RTN pfn_io; + + /* device control routine (kernel/driver use only) */ + DEVICE_CTRL_RTN pfn_ctrl; +} +DEVICE_BUS_ISA; + +/* PCI bus device structure */ +/* TODO */ +typedef struct tagDEVICE_BUS_PCI +{ + int dummy; +} +DEVICE_PCI; + +/* bus device structure */ +typedef union tagDEVICE_BUS +{ + DEVICE_BUS_ISA isa; + DEVICE_BUS_PCI pci; +} +DEVICE_BUS; + +/* device structure */ +typedef struct tagDEVICE +{ + /* type of device */ + BYTEg type; + + /* pointer to actual device specific structure */ + void * p; +} +DEVICE; + +/* global kernel structure for device information */ +typedef struct tagDEVICES +{ + /* bus devices */ + DEVICE a_isa[MAX_BUS_DEVICES]; +} +DEVICES; + #endif /* _DEVICE_H */ \ No newline at end of file diff --git a/src/sys/include/deviceman/isapnp.h b/src/sys/include/deviceman/isapnp.h index 50b8abb..f2f130c 100755 --- a/src/sys/include/deviceman/isapnp.h +++ b/src/sys/include/deviceman/isapnp.h @@ -1,29 +1,29 @@ -/* - "isapnp.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 12, 2002 - - Purpose: ISA PNP support - - $Id$ -*/ - -#ifndef _ISAPNP_H -#define _ISAPNP_H - -#define ACCESS_FUNC_PORT "movl %edx, $0x279\n\t" -#define ACCESS_DATA_PORT "movl %edx, $0x2A9\n\t" -#define FUNC_SETREADPORT "movb $0x00, %al\n\toutb %dx, %al\n\t" -#define FUNC_ISOLATION "movb $0x01, %al\n\toutb %dx, %al\n\t" -#define FUNC_CONFIGCONTROL "movb $0x02, %al\n\toutb %dx, %al\n\t" -#define FUNC_WAKEUP "movb $0x03, %al\n\toutb %dx, %al\n\t" -#define FUNC_RESOURCEDATA "movb $0x04, %al\n\toutb %dx, %al\n\t" -#define FUNC_STATUS "movb $0x05, %al\n\toutb %dx, %al\n\t" -#define FUNC_SETCARDNUM "movb $0x06, %al\n\toutb %dx, %al\n\t" -#define FUNC_SETDEVICENUM "movb $0x07, %al\n\toutb %dx, %al\n\t" -#define FUNC_ACTIVATEADDR "movb $0x1E, %al\n\toutb %dx, %al\n\t" -#define FUNC_IORANGECHECK "movb $0x1F, %al\n\toutb %dx, %al\n\t" - +/* + "isapnp.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 12, 2002 + + Purpose: ISA PNP support + + $Id$ +*/ + +#ifndef _ISAPNP_H +#define _ISAPNP_H + +#define ACCESS_FUNC_PORT "movl %edx, $0x279\n\t" +#define ACCESS_DATA_PORT "movl %edx, $0x2A9\n\t" +#define FUNC_SETREADPORT "movb $0x00, %al\n\toutb %dx, %al\n\t" +#define FUNC_ISOLATION "movb $0x01, %al\n\toutb %dx, %al\n\t" +#define FUNC_CONFIGCONTROL "movb $0x02, %al\n\toutb %dx, %al\n\t" +#define FUNC_WAKEUP "movb $0x03, %al\n\toutb %dx, %al\n\t" +#define FUNC_RESOURCEDATA "movb $0x04, %al\n\toutb %dx, %al\n\t" +#define FUNC_STATUS "movb $0x05, %al\n\toutb %dx, %al\n\t" +#define FUNC_SETCARDNUM "movb $0x06, %al\n\toutb %dx, %al\n\t" +#define FUNC_SETDEVICENUM "movb $0x07, %al\n\toutb %dx, %al\n\t" +#define FUNC_ACTIVATEADDR "movb $0x1E, %al\n\toutb %dx, %al\n\t" +#define FUNC_IORANGECHECK "movb $0x1F, %al\n\toutb %dx, %al\n\t" + #endif // _ISAPNP_H \ No newline at end of file diff --git a/src/sys/include/misc/kernel_string_pool.h b/src/sys/include/misc/kernel_string_pool.h index 8a09ec3..f0f4043 100755 --- a/src/sys/include/misc/kernel_string_pool.h +++ b/src/sys/include/misc/kernel_string_pool.h @@ -1,102 +1,102 @@ -/* - "kernel_string_pool.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 11, 2002 - - purpose: to provide a mechanism for maintaining a pool of strings - for use by the kernel without unnecessary waste of memory - - NOTEs: - - for now only ASCII is supported - - done quickly, pretty hacky - - TODO: - - expand to support unicode - - use huffman encoding instead - - $Id$ -*/ - -#ifndef _KERNEL_STRING_POOL_H -#define _KERNEL_STRING_POOL_H - -/* memory FORMAT of a 'KRNSTR': (quick and dirty for now) - - an 'ID' is used to indicate a string within the pool - ---------------------------------------------------- - - 'ID' - [DWORD]: - - 'num-words' - bits [0,7] - - number of 'KRNWORD's in the string is 'num-words' + 1 - - bits [8,32] BYTE offset inside pool where the 'KRNSTR' - (kernel string) is stored - - 'KRNSTR's (kernel strings) are specified as an array of continuous BYTEs - ------------------------------------------------------------------------ - - 'KRNSTR': - - [KRNWORD] x 'num-words' (given by ID) - - 'KRNWORD': - - [BYTE] 'key1' - - - if key1 == [0,254]: - - key1 is the index of the 'sub-string' in the pool - - - otherwise key1 is an escape sequence and implies: - - [BYTE] 'key2' - - [BYTE] 'key3' - - the index of the 'sub-string' in the pool is key2*256 + key3 + 255 - - - NOTE: the reason for using two extra 8-bit keys instead of a 16-bit - value is in case we port to platform with data alignment exceptions - and this stuff is left dormant and never changed - - - NOTE: a 'space' (0x20) is implied between each 'KRNWORD', therefore - it is not currently possible to break encode string AB into substrings - A & B if AB does not contain any spaces - - - a 'sub-string' is found by using the the index of the - 'sub-string' in the pool to get an offset into an array - of continuous BYTEs via lookup - - 'sub-string's are specified as an array of continuous BYTEs - ----------------------------------------------------------- - - - a 'sub-string' is as follows: - - - [BYTE] 'numchars' [0,255] -> [1,256] - - [BYTE] x 'numchars' (the chars themselves) - - - WARNING: empty 'sub-string's are not allowed - -*/ - -/* WARNING: it is *assumed* any 'ID' given to a kernel - string pool function will be valid!! */ - -/* structure for kernel string pool */ -typedef struct tagKSTR_POOL -{ - /* pointer to where the kernel strings are stored */ - const BYTEg * p_krnstrs; - - /* pointer to where the sub strings are stored */ - const BYTEg * p_substrs; - - /* lookup table for substring offsets */ - const unsigned int * p_substr_off; -} -KSTR_POOL; - -/* the reason for this structure format is so that a tool - can be written which can generate a 'KSTR_POOL' from a configuration - file and place it into a 'C' source and header file pair as static data */ - -// gets the substring indicated by 'id' from the pool 'p_ksp' into 'p_dst' -// - returns pointer to 'p_dst' -char * KSTR_POOL_GetString( KSTR_POOL * p_ksp, char * p_dst, DWORDg id ); - +/* + "kernel_string_pool.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 11, 2002 + + purpose: to provide a mechanism for maintaining a pool of strings + for use by the kernel without unnecessary waste of memory + + NOTEs: + - for now only ASCII is supported + - done quickly, pretty hacky + + TODO: + - expand to support unicode + - use huffman encoding instead + + $Id$ +*/ + +#ifndef _KERNEL_STRING_POOL_H +#define _KERNEL_STRING_POOL_H + +/* memory FORMAT of a 'KRNSTR': (quick and dirty for now) + + an 'ID' is used to indicate a string within the pool + ---------------------------------------------------- + + 'ID' - [DWORD]: + - 'num-words' - bits [0,7] + - number of 'KRNWORD's in the string is 'num-words' + 1 + - bits [8,32] BYTE offset inside pool where the 'KRNSTR' + (kernel string) is stored + + 'KRNSTR's (kernel strings) are specified as an array of continuous BYTEs + ------------------------------------------------------------------------ + + 'KRNSTR': + - [KRNWORD] x 'num-words' (given by ID) + + 'KRNWORD': + - [BYTE] 'key1' + + - if key1 == [0,254]: + - key1 is the index of the 'sub-string' in the pool + + - otherwise key1 is an escape sequence and implies: + - [BYTE] 'key2' + - [BYTE] 'key3' + - the index of the 'sub-string' in the pool is key2*256 + key3 + 255 + + - NOTE: the reason for using two extra 8-bit keys instead of a 16-bit + value is in case we port to platform with data alignment exceptions + and this stuff is left dormant and never changed + + - NOTE: a 'space' (0x20) is implied between each 'KRNWORD', therefore + it is not currently possible to break encode string AB into substrings + A & B if AB does not contain any spaces + + - a 'sub-string' is found by using the the index of the + 'sub-string' in the pool to get an offset into an array + of continuous BYTEs via lookup + + 'sub-string's are specified as an array of continuous BYTEs + ----------------------------------------------------------- + + - a 'sub-string' is as follows: + + - [BYTE] 'numchars' [0,255] -> [1,256] + - [BYTE] x 'numchars' (the chars themselves) + + - WARNING: empty 'sub-string's are not allowed + +*/ + +/* WARNING: it is *assumed* any 'ID' given to a kernel + string pool function will be valid!! */ + +/* structure for kernel string pool */ +typedef struct tagKSTR_POOL +{ + /* pointer to where the kernel strings are stored */ + const BYTEg * p_krnstrs; + + /* pointer to where the sub strings are stored */ + const BYTEg * p_substrs; + + /* lookup table for substring offsets */ + const unsigned int * p_substr_off; +} +KSTR_POOL; + +/* the reason for this structure format is so that a tool + can be written which can generate a 'KSTR_POOL' from a configuration + file and place it into a 'C' source and header file pair as static data */ + +// gets the substring indicated by 'id' from the pool 'p_ksp' into 'p_dst' +// - returns pointer to 'p_dst' +char * KSTR_POOL_GetString( KSTR_POOL * p_ksp, char * p_dst, DWORDg id ); + #endif /* _KERNEL_STRING_POOL_H */ \ No newline at end of file diff --git a/src/sys/include/misc/misc_bit_array.h b/src/sys/include/misc/misc_bit_array.h index 2906148..c9d022b 100755 --- a/src/sys/include/misc/misc_bit_array.h +++ b/src/sys/include/misc/misc_bit_array.h @@ -1,46 +1,46 @@ -/* - "misc_bit_array.h" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 12, 2002 - - purpose: functions for dealing with bit arrays - - $Id$ -*/ - -#ifndef _MISC_BIT_ARRAY_H -#define _MISC_BIT_ARRAY_H - -typedef struct tagBIT_ARRAY_RANGE_PARAMS -{ - DWORDg * p_curdw; - DWORDg * p_firstdw; - DWORDg * p_overdw; - DWORDg premask; - DWORDg postmask; -} -BIT_ARRAY_RANGE_PARAMS; - -// returns: -// - 1 if the given range of bits is empty -// - 0 otherwise -int BIT_ARRAY_IsRangeEmpty( BIT_ARRAY_RANGE_PARAMS * p_rp ); - -// set the given range of bits to all 1s -void BIT_ARRAY_SetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ); - -// set the given range of bits to all 0s -void BIT_ARRAY_ResetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ); - -// builds a structure for use with the other functions -#define BIT_ARRAY_MAKERANGEPARAMS( rp, p_basedw, firstbit, overbit )\ - (rp).premask = ((32-(firstbit))&31);\ - (rp).p_firstdw = (p_basedw) + ((firstbit)>>5);\ - (rp).postmask = ((overbit)&31);\ - (rp).p_overdw = (p_basedw) + ((overbit)>>5);\ - (rp).premask = MAKEMASK_GS( (rp).premask, (32 - (rp).premask) );\ - (rp).postmask = MAKEMASK_GS( (rp).postmask, 0 ) - +/* + "misc_bit_array.h" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 12, 2002 + + purpose: functions for dealing with bit arrays + + $Id$ +*/ + +#ifndef _MISC_BIT_ARRAY_H +#define _MISC_BIT_ARRAY_H + +typedef struct tagBIT_ARRAY_RANGE_PARAMS +{ + DWORDg * p_curdw; + DWORDg * p_firstdw; + DWORDg * p_overdw; + DWORDg premask; + DWORDg postmask; +} +BIT_ARRAY_RANGE_PARAMS; + +// returns: +// - 1 if the given range of bits is empty +// - 0 otherwise +int BIT_ARRAY_IsRangeEmpty( BIT_ARRAY_RANGE_PARAMS * p_rp ); + +// set the given range of bits to all 1s +void BIT_ARRAY_SetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ); + +// set the given range of bits to all 0s +void BIT_ARRAY_ResetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ); + +// builds a structure for use with the other functions +#define BIT_ARRAY_MAKERANGEPARAMS( rp, p_basedw, firstbit, overbit )\ + (rp).premask = ((32-(firstbit))&31);\ + (rp).p_firstdw = (p_basedw) + ((firstbit)>>5);\ + (rp).postmask = ((overbit)&31);\ + (rp).p_overdw = (p_basedw) + ((overbit)>>5);\ + (rp).premask = MAKEMASK_GS( (rp).premask, (32 - (rp).premask) );\ + (rp).postmask = MAKEMASK_GS( (rp).postmask, 0 ) + #endif // _MISC_BIT_ARRAY_H \ No newline at end of file diff --git a/src/sys/misc/kernel_string_pool.c b/src/sys/misc/kernel_string_pool.c index d703e90..ee97900 100755 --- a/src/sys/misc/kernel_string_pool.c +++ b/src/sys/misc/kernel_string_pool.c @@ -1,109 +1,109 @@ -/* - "kernel_string_pool.c" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 11, 2002 - - purpose: to provide a mechanism for maintaining a pool of strings - for use by the kernel without unnecessary waste of memory - - NOTEs: - - for now only ASCII is supported - - done quickly, pretty hacky - - TODO: - - expand to support unicode - - use huffman encoding instead - - $Id$ -*/ - -#include "../../grayspace-misc/gsdefines.h" -#include "../../sys/include/misc/kernel_string_pool.h" - -// returns pointer to character *after* substring read -static char * ReadSubString( char * p_dst, const BYTEg * p_substr ) -{ - char * p_retval; - char * p_curdst; - const char * p_cursubstr; - - p_retval = p_dst + (*p_substr) + 1; - p_cursubstr = (const char *) (p_substr + 1); - - do - { - *p_curdst = *p_cursubstr; - p_cursubstr++; - p_curdst++; - } - while( p_curdst < p_retval ); - - return p_retval; -} - -// returns pointer to character *after* space appended after substring read -static char * ReadSubStringAppendSpace( char * p_dst, const BYTEg * p_substr ) -{ - char * p_retval; - - p_retval = ReadSubString( p_dst, p_substr ); - *p_retval = ' '; - p_retval++; - - return p_retval; -} - -// gets the substring indicated by 'id' from the pool 'p_ksp' into 'p_dst' -// - returns pointer to 'p_dst' -char * KSTR_POOL_GetString( KSTR_POOL * p_ksp, char * p_dst, DWORDg id ) -{ - DWORDg numsubstrs; - DWORDg offset; - char * p_curdst; - const BYTEg * p_substr; - const BYTEg * p_krnstr; - - numsubstrs = (id & 0xFF); - offset = (id >> 8); - p_krnstr = p_ksp->p_krnstrs + offset; - - while( numsubstrs ) - { - // find substring - offset = (DWORDg) *p_krnstr; - p_krnstr++; - if( offset == 255 ) - { - offset += (((DWORDg) *p_krnstr)<<8); - p_krnstr++; - offset += (DWORDg) *p_krnstr; - p_krnstr++; - } - p_substr = p_ksp->p_substrs + p_ksp->p_substr_off[offset]; - - // append to destination and also append a space - p_curdst = ReadSubStringAppendSpace( p_curdst, p_substr ); - - // one less sub string - numsubstrs--; - } - - // find final substring - offset = (DWORDg) *p_krnstr; - p_krnstr++; - if( offset == 255 ) - { - offset += (((DWORDg) *p_krnstr)<<8); - p_krnstr++; - offset += (DWORDg) *p_krnstr; - p_krnstr++; - } - p_substr = p_ksp->p_substrs + p_ksp->p_substr_off[offset]; - - // append to destination - p_curdst = ReadSubString( p_curdst, p_substr ); - - return p_dst; -} +/* + "kernel_string_pool.c" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 11, 2002 + + purpose: to provide a mechanism for maintaining a pool of strings + for use by the kernel without unnecessary waste of memory + + NOTEs: + - for now only ASCII is supported + - done quickly, pretty hacky + + TODO: + - expand to support unicode + - use huffman encoding instead + + $Id$ +*/ + +#include "../../grayspace-misc/gsdefines.h" +#include "../../sys/include/misc/kernel_string_pool.h" + +// returns pointer to character *after* substring read +static char * ReadSubString( char * p_dst, const BYTEg * p_substr ) +{ + char * p_retval; + char * p_curdst; + const char * p_cursubstr; + + p_retval = p_dst + (*p_substr) + 1; + p_cursubstr = (const char *) (p_substr + 1); + + do + { + *p_curdst = *p_cursubstr; + p_cursubstr++; + p_curdst++; + } + while( p_curdst < p_retval ); + + return p_retval; +} + +// returns pointer to character *after* space appended after substring read +static char * ReadSubStringAppendSpace( char * p_dst, const BYTEg * p_substr ) +{ + char * p_retval; + + p_retval = ReadSubString( p_dst, p_substr ); + *p_retval = ' '; + p_retval++; + + return p_retval; +} + +// gets the substring indicated by 'id' from the pool 'p_ksp' into 'p_dst' +// - returns pointer to 'p_dst' +char * KSTR_POOL_GetString( KSTR_POOL * p_ksp, char * p_dst, DWORDg id ) +{ + DWORDg numsubstrs; + DWORDg offset; + char * p_curdst; + const BYTEg * p_substr; + const BYTEg * p_krnstr; + + numsubstrs = (id & 0xFF); + offset = (id >> 8); + p_krnstr = p_ksp->p_krnstrs + offset; + + while( numsubstrs ) + { + // find substring + offset = (DWORDg) *p_krnstr; + p_krnstr++; + if( offset == 255 ) + { + offset += (((DWORDg) *p_krnstr)<<8); + p_krnstr++; + offset += (DWORDg) *p_krnstr; + p_krnstr++; + } + p_substr = p_ksp->p_substrs + p_ksp->p_substr_off[offset]; + + // append to destination and also append a space + p_curdst = ReadSubStringAppendSpace( p_curdst, p_substr ); + + // one less sub string + numsubstrs--; + } + + // find final substring + offset = (DWORDg) *p_krnstr; + p_krnstr++; + if( offset == 255 ) + { + offset += (((DWORDg) *p_krnstr)<<8); + p_krnstr++; + offset += (DWORDg) *p_krnstr; + p_krnstr++; + } + p_substr = p_ksp->p_substrs + p_ksp->p_substr_off[offset]; + + // append to destination + p_curdst = ReadSubString( p_curdst, p_substr ); + + return p_dst; +} diff --git a/src/sys/misc/misc_bit_array.c b/src/sys/misc/misc_bit_array.c index 07611e8..0a85b67 100755 --- a/src/sys/misc/misc_bit_array.c +++ b/src/sys/misc/misc_bit_array.c @@ -1,92 +1,92 @@ -/* - "misc_bit_array.c" - - created by: grayspace aka J. Leveille - for: UbixOS Project - date: May 12, 2002 - - purpose: functions for dealing with bit arrays - - $Id$ -*/ - -#include "../../grayspace-misc/gsdefines.h" -#include "../../sys/include/misc/misc_bit_array.h" - -int BIT_ARRAY_IsRangeEmpty( BIT_ARRAY_RANGE_PARAMS * p_rp ) -{ - p_rp->p_curdw = p_rp->p_firstdw; - - if( !(p_rp->premask & *(p_rp->p_curdw)) ) - { - if( p_rp->premask ) - { - p_rp->p_curdw++; - } - - while( p_rp->p_curdw < p_rp->p_overdw - && !( *(p_rp->p_curdw) ) ) - { - p_rp->p_curdw++; - } - - if( p_rp->p_curdw == p_rp->p_overdw ) - { - if( p_rp->postmask ) - { - if( p_rp->postmask & *(p_rp->p_overdw) ) - { - return 0; - } - } - - return 1; - } - } - - return 0; -} - -void BIT_ARRAY_SetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ) -{ - p_rp->p_curdw = p_rp->p_firstdw; - - if( p_rp->premask ) - { - *(p_rp->p_curdw) |= p_rp->premask; - p_rp->p_curdw++; - } - - while( p_rp->p_curdw < p_rp->p_overdw ) - { - *(p_rp->p_curdw) = 0xFFFFFFFF; - p_rp->p_curdw++; - } - - if( p_rp->postmask ) - { - *(p_rp->p_curdw) |= p_rp->postmask; - } -} - -void BIT_ARRAY_ResetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ) -{ - p_rp->p_curdw = p_rp->p_firstdw; - - if( p_rp->premask ) - { - *(p_rp->p_curdw) &= ~(p_rp->premask); - p_rp->p_curdw++; - } - - while( p_rp->p_curdw < p_rp->p_overdw ) - { - *(p_rp->p_curdw) = 0; - p_rp->p_curdw++; - } - - if( p_rp->postmask ) - { - *(p_rp->p_curdw) &= ~(p_rp->postmask); - } -} +/* + "misc_bit_array.c" + + created by: grayspace aka J. Leveille + for: UbixOS Project + date: May 12, 2002 + + purpose: functions for dealing with bit arrays + + $Id$ +*/ + +#include "../../grayspace-misc/gsdefines.h" +#include "../../sys/include/misc/misc_bit_array.h" + +int BIT_ARRAY_IsRangeEmpty( BIT_ARRAY_RANGE_PARAMS * p_rp ) +{ + p_rp->p_curdw = p_rp->p_firstdw; + + if( !(p_rp->premask & *(p_rp->p_curdw)) ) + { + if( p_rp->premask ) + { + p_rp->p_curdw++; + } + + while( p_rp->p_curdw < p_rp->p_overdw + && !( *(p_rp->p_curdw) ) ) + { + p_rp->p_curdw++; + } + + if( p_rp->p_curdw == p_rp->p_overdw ) + { + if( p_rp->postmask ) + { + if( p_rp->postmask & *(p_rp->p_overdw) ) + { + return 0; + } + } + + return 1; + } + } + + return 0; +} + +void BIT_ARRAY_SetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ) +{ + p_rp->p_curdw = p_rp->p_firstdw; + + if( p_rp->premask ) + { + *(p_rp->p_curdw) |= p_rp->premask; + p_rp->p_curdw++; + } + + while( p_rp->p_curdw < p_rp->p_overdw ) + { + *(p_rp->p_curdw) = 0xFFFFFFFF; + p_rp->p_curdw++; + } + + if( p_rp->postmask ) + { + *(p_rp->p_curdw) |= p_rp->postmask; + } +} + +void BIT_ARRAY_ResetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ) +{ + p_rp->p_curdw = p_rp->p_firstdw; + + if( p_rp->premask ) + { + *(p_rp->p_curdw) &= ~(p_rp->premask); + p_rp->p_curdw++; + } + + while( p_rp->p_curdw < p_rp->p_overdw ) + { + *(p_rp->p_curdw) = 0; + p_rp->p_curdw++; + } + + if( p_rp->postmask ) + { + *(p_rp->p_curdw) &= ~(p_rp->postmask); + } +} diff --git a/ubixos.kdevprj b/ubixos.kdevprj index 0f43927..7e4f5d5 100755 --- a/ubixos.kdevprj +++ b/ubixos.kdevprj @@ -44,7 +44,7 @@ kdevprj_version=1.3 lfv_open_groups=Others make_options=\s-j1 clean all install -makefiles=./Makefile.am,src/Makefile.am,src/sys/Makefile.am,src/sys/include/Makefile.am,src/lib/Makefile.am,src/lib/libc/Makefile.am,src/lib/libc/include/Makefile.am,src/bin/Makefile.am,src/bin/shell/Makefile.am,Makefile.am,src/sys/boot/Makefile.am,src/sys/init/Makefile.am,src/sys/include/ubixos/Makefile.am,src/sys/drivers/Makefile.am,src/sys/kernel/Makefile.am,src/sys/compile/Makefile.am,src/sys/include/version/Makefile.am,src/sys/include/drivers/Makefile.am,src/sys/vmm/Makefile.am,src/sys/include/vmm/Makefile.am,src/sys/include/ubixfs/Makefile.am,src/sys/ubixfs/Makefile.am,src/tools/Makefile.am,src/bin/init/Makefile.am,src/lib/libc/stdio/Makefile.am,src/lib/libc/include/sys/Makefile.am,src/lib/libc/sys/Makefile.am,src/lib/libc/stdlib/Makefile.am,src/sys/misc/Makefile.am +makefiles=./Makefile.am,src/Makefile.am,src/sys/Makefile.am,src/sys/include/Makefile.am,src/lib/Makefile.am,src/lib/libc/Makefile.am,src/lib/libc/include/Makefile.am,src/bin/Makefile.am,src/bin/shell/Makefile.am,Makefile.am,src/sys/boot/Makefile.am,src/sys/init/Makefile.am,src/sys/include/ubixos/Makefile.am,src/sys/drivers/Makefile.am,src/sys/kernel/Makefile.am,src/sys/compile/Makefile.am,src/sys/include/version/Makefile.am,src/sys/include/drivers/Makefile.am,src/sys/vmm/Makefile.am,src/sys/include/vmm/Makefile.am,src/sys/include/ubixfs/Makefile.am,src/sys/ubixfs/Makefile.am,src/tools/Makefile.am,src/bin/init/Makefile.am,src/lib/libc/stdio/Makefile.am,src/lib/libc/include/sys/Makefile.am,src/lib/libc/sys/Makefile.am,src/lib/libc/stdlib/Makefile.am,src/sys/misc/Makefile.am,src/sys/deviceman/Makefile.am,src/grayspace-misc/Makefile.am,src/sys/include/deviceman/Makefile.am,src/sys/include/misc/Makefile.am modifyMakefiles=true project_name=UbixOS project_type=normal_empty @@ -94,7 +94,7 @@ [src/Makefile.am] files= -sub_dirs=sys,lib,bin,tools +sub_dirs=sys,lib,bin,tools,grayspace-misc type=normal [src/bin/Makefile] @@ -142,6 +142,17 @@ install_location= type=SOURCE +[src/grayspace-misc/Makefile.am] +files=src/grayspace-misc/gsdefines.h +sub_dirs= +type=normal + +[src/grayspace-misc/gsdefines.h] +dist=true +install=false +install_location= +type=HEADER + [src/lib/Makefile.am] sub_dirs=libc, type=normal @@ -310,7 +321,7 @@ [src/sys/Makefile.am] files=src/sys/Makefile -sub_dirs=include,boot,init,drivers,kernel,compile,vmm,ubixfs,misc +sub_dirs=include,boot,init,drivers,kernel,compile,vmm,ubixfs,misc,deviceman type=normal [src/sys/boot/Makefile] @@ -341,6 +352,23 @@ sub_dirs= type=normal +[src/sys/deviceman/Makefile] +dist=true +install=false +install_location= +type=DATA + +[src/sys/deviceman/Makefile.am] +files=src/sys/deviceman/Makefile,src/sys/deviceman/bus_resources_portio.c +sub_dirs= +type=static_library + +[src/sys/deviceman/bus_resources_portio.c] +dist=true +install=false +install_location= +type=SOURCE + [src/sys/drivers/8259.c] dist=true install=false @@ -378,9 +406,44 @@ [src/sys/include/Makefile.am] files=src/sys/include/stdarg.h -sub_dirs=ubixos,version,drivers,vmm,ubixfs +sub_dirs=ubixos,version,drivers,vmm,ubixfs,deviceman,misc type=normal +[src/sys/include/deviceman/Makefile.am] +files=src/sys/include/deviceman/bus.h,src/sys/include/deviceman/bus_resources.h,src/sys/include/deviceman/bus_resources_portio.h,src/sys/include/deviceman/device.h,src/sys/include/deviceman/isapnp.h +sub_dirs= +type=normal + +[src/sys/include/deviceman/bus.h] +dist=true +install=false +install_location= +type=HEADER + +[src/sys/include/deviceman/bus_resources.h] +dist=true +install=false +install_location= +type=HEADER + +[src/sys/include/deviceman/bus_resources_portio.h] +dist=true +install=false +install_location= +type=HEADER + +[src/sys/include/deviceman/device.h] +dist=true +install=false +install_location= +type=HEADER + +[src/sys/include/deviceman/isapnp.h] +dist=true +install=false +install_location= +type=HEADER + [src/sys/include/drivers/8259.h] dist=true install=false @@ -410,6 +473,23 @@ install_location= type=HEADER +[src/sys/include/misc/Makefile.am] +files=src/sys/include/misc/kernel_string_pool.h,src/sys/include/misc/misc_bit_array.h +sub_dirs= +type=normal + +[src/sys/include/misc/kernel_string_pool.h] +dist=true +install=false +install_location= +type=HEADER + +[src/sys/include/misc/misc_bit_array.h] +dist=true +install=false +install_location= +type=HEADER + [src/sys/include/stdarg.h] dist=true install=false @@ -629,7 +709,7 @@ type=SOURCE [src/sys/misc/Makefile.am] -files=src/sys/misc/kernel_string_pool.c,src/sys/misc/kernel_string_pool.h,src/sys/misc/misc_bit_array.c +files=src/sys/misc/kernel_string_pool.c,src/sys/misc/misc_bit_array.c sharedlib_LDFLAGS=-version-info 0:0:1 sharedlib_rootname=misc sub_dirs= @@ -641,12 +721,6 @@ install_location= type=SOURCE -[src/sys/misc/kernel_string_pool.h] -dist=true -install=false -install_location= -type=HEADER - [src/sys/misc/misc_bit_array.c] dist=true install=false