diff --git a/.coafile b/.coafile
new file mode 100644
index 00000000..c08c3ae2
--- /dev/null
+++ b/.coafile
@@ -0,0 +1,6 @@
+[Default]
+bears = SpaceConsistencyBear
+files = **/*.c
+use_spaces = true
+default_actions = SpaceConsistencyBear: ApplyPatchAction
+tab_width = 8
diff --git a/src/andromeda/panic.c b/src/andromeda/panic.c
index 4dc57158..fd00dbf3 100644
--- a/src/andromeda/panic.c
+++ b/src/andromeda/panic.c
@@ -21,19 +21,19 @@
// Claim to have panicked, show the message and enter an infinite loop.
void panicDebug(char* msg, char* file, int line)
{
- stack_dump((uint32_t*)&msg, 8);
+ stack_dump((uint32_t*)&msg, 8);
#ifdef CAS
- // Little easter egg, a request from Cas van Raan
- printf("Shit's fucked up at line %i in file %s\n%s\nTry again!", line, file, msg);
+ // Little easter egg, a request from Cas van Raan
+ printf("Shit's fucked up at line %i in file %s\n%s\nTry again!", line, file, msg);
#else
- printf("Andromeda panic in %s at line %i\n%s\n", file, line, msg);
+ printf("Andromeda panic in %s at line %i\n%s\n", file, line, msg);
#endif
- endProg(); // Halt and catch fire!
+ endProg(); // Halt and catch fire!
}
void asm_panic(char* msg)
{
- stack_dump((uint32_t*)&msg, 8);
- printf("Andromeda panic in assembly file!\n%s\n", msg);
- endProg();
+ stack_dump((uint32_t*)&msg, 8);
+ printf("Andromeda panic in assembly file!\n%s\n", msg);
+ endProg();
}
diff --git a/src/arch/x86/kernel/rtc.c b/src/arch/x86/kernel/rtc.c
index 98d5d832..c1e22b77 100644
--- a/src/arch/x86/kernel/rtc.c
+++ b/src/arch/x86/kernel/rtc.c
@@ -35,7 +35,7 @@ static void program_rtc(struct device *dev);
/**
* \var rtc_dev
* \brief Global variable for the real time clock.
- *
+ *
* At boot, this is the uninitialized rtc. The function setup_rtc() has
* to be called to initialise the rtc and make sure it is kept up to date.
*/
@@ -44,7 +44,7 @@ struct device *rtc_dev;
/**
* \var hz_table[]
* \brief Rate to hertz converter.
- *
+ *
* This array (/table) converts a RTC rate to the associated frequention in
* Hertz.
*/
@@ -56,7 +56,7 @@ static const unsigned short hz_table[] = { 0, 256, 128, 0x2000, 0x1000, 0x800,
* \param clock Configured real time clock object.
* \brief Returns the frequention of a real time clock object.
* \return Clock frequention in Hertz
- *
+ *
* This function returns the configured frequention in Hertz of the given RTC
* object. If the RTC is not configured correctly or when it is turned of the
* return value will be 0.
@@ -69,7 +69,7 @@ inline unsigned short get_rtc_frq(rtc_t *clock)
/**
* \fn setup_rtcan
* \brief Setup the RTC.
- *
+ *
* This function initialises the Real Time Clock object. It also registers and
* initialises an IRQ/ISR to keep the RTC object up to date.
*/
@@ -111,7 +111,7 @@ static int rtc_create_driver(struct device *dev)
* \fn program_rtc(struct device *dev)
* \param dev The clock device.
* \brief Config the real time clock.
- *
+ *
* program_rtc configures the hardware RTC. It will set the clock to the correct
* frequency and enable the IRQ. The RTC will be programmed to a periodic
* clock/interrupt.
diff --git a/src/arch/x86/mm/gdt.c b/src/arch/x86/mm/gdt.c
index 10efb0e4..a7e278cc 100644
--- a/src/arch/x86/mm/gdt.c
+++ b/src/arch/x86/mm/gdt.c
@@ -136,17 +136,17 @@ void setEntry (int num, unsigned int base, unsigned int limit,
else
{
limit = limit >> 8;
- GDT[num].baseLow = (base & 0xFFFFFF);
- GDT[num].baseHigh = (base >> 24) & 0xFF;
- GDT[num].limit = (limit & 0xFFFF);
- GDT[num].limitHigh = (limit >> 16) & 0xF;
- GDT[num].dpl = dpl & 0x3;
- GDT[num].type = type & 0xF;
- GDT[num].zero = 0;
- GDT[num].one = 1;
+ GDT[num].baseLow = (base & 0xFFFFFF);
+ GDT[num].baseHigh = (base >> 24) & 0xFF;
+ GDT[num].limit = (limit & 0xFFFF);
+ GDT[num].limitHigh = (limit >> 16) & 0xF;
+ GDT[num].dpl = dpl & 0x3;
+ GDT[num].type = type & 0xF;
+ GDT[num].zero = 0;
+ GDT[num].one = 1;
GDT[num].granularity= 1;
- GDT[num].s = 1;
- GDT[num].mode = 1;
+ GDT[num].s = 1;
+ GDT[num].mode = 1;
}
}
#endif
diff --git a/src/drivers/disk/ata.c b/src/drivers/disk/ata.c
index 2b982b91..c6257b5f 100644
--- a/src/drivers/disk/ata.c
+++ b/src/drivers/disk/ata.c
@@ -23,22 +23,22 @@
int
ol_ata_detect_dev_type (ol_ata_dev_t dev)
{
- ol_ata_soft_reset(dev); /* waits until master drive is ready again */
+ ol_ata_soft_reset(dev); /* waits until master drive is ready again */
outb(OL_ATA_FEATURES(dev->base_port), 4);
- outb(OL_ATA_DRIVE_SELECT(dev->base_port), 0xA0 | (dev->slave << 4));
- inb(dev->dcr); /* wait 400ns for drive select to work */
- inb(dev->dcr);
- inb(dev->dcr);
- inb(dev->dcr);
- uint8_t cl = inb(OL_ATA_MID_LBA(dev->base_port));
- uint8_t ch = inb(OL_ATA_HIGH_LBA(dev->base_port));
+ outb(OL_ATA_DRIVE_SELECT(dev->base_port), 0xA0 | (dev->slave << 4));
+ inb(dev->dcr); /* wait 400ns for drive select to work */
+ inb(dev->dcr);
+ inb(dev->dcr);
+ inb(dev->dcr);
+ uint8_t cl = inb(OL_ATA_MID_LBA(dev->base_port));
+ uint8_t ch = inb(OL_ATA_HIGH_LBA(dev->base_port));
- /* differentiate ATA, ATAPI, SATA and SATAPI */
- if(cl == 0x14 && ch == 0xEB) return OL_ATA_PATAPI;
- if(cl == 0x69 && ch == 0x96) return OL_ATA_SATAPI;
- if(cl == 0 && ch == 0) return OL_ATA_PATA;
- if(cl == 0x3c && ch == 0xc3) return OL_ATA_SATA;
- return OL_ATA_UNKNOWN;
+ /* differentiate ATA, ATAPI, SATA and SATAPI */
+ if(cl == 0x14 && ch == 0xEB) return OL_ATA_PATAPI;
+ if(cl == 0x69 && ch == 0x96) return OL_ATA_SATAPI;
+ if(cl == 0 && ch == 0) return OL_ATA_PATA;
+ if(cl == 0x3c && ch == 0xc3) return OL_ATA_SATA;
+ return OL_ATA_UNKNOWN;
}
static void
diff --git a/src/drivers/graphics/VGA.c b/src/drivers/graphics/VGA.c
index 2600240d..76ba53fc 100644
--- a/src/drivers/graphics/VGA.c
+++ b/src/drivers/graphics/VGA.c
@@ -82,37 +82,37 @@ extern boolean pageDbg;
int setVideoMode(int mode)
{
- int size = videoModes[mode].width * videoModes[mode].height * videoModes[mode].depth;
- free(screenbuf);
- if (size != 0)
- screenbuf = kmalloc(size);
- else
- screenbuf = NULL;
-
- printf("Check 1\n");
-
- if(screenbuf==NULL)
- {screenbuf = 0xA0000;printf("kmalloc(%i) returned NULL!\n",size);return -1;}
-// if ( 0 == setModeViaPorts(videoModes[mode].width, videoModes[mode].height, videoModes[mode].chain4?1:0))
-// {printf("setModeViaPorts(%i,%i,%i) failed!\n",videoModes[mode].width, videoModes[mode].height, videoModes[mode].chain4?1:0);return -1;}
- printf("Check 1.1\n");
- memset(0xA0000,11,16);
- printf("Check 2\n");
- printf("Screenbuf: %X\nESP: %X\nValue: %X\n", screenbuf, getESP(), size);
- printf("Check 2.1\n");
- int i = 0;
- for (; i < 0x4FFFFFFF; i++);
- pageDbg = TRUE;
- printf("Check 2.2\n");
- memset(screenbuf,0,size); //hangs
- printf("Check 3\n");
- for(;;);
- memset(0xA0010,11,16);
-
-
- videoMode = mode;
- updateScreen();
- return 0;
+ int size = videoModes[mode].width * videoModes[mode].height * videoModes[mode].depth;
+ free(screenbuf);
+ if (size != 0)
+ screenbuf = kmalloc(size);
+ else
+ screenbuf = NULL;
+
+ printf("Check 1\n");
+
+ if(screenbuf==NULL)
+ {screenbuf = 0xA0000;printf("kmalloc(%i) returned NULL!\n",size);return -1;}
+// if ( 0 == setModeViaPorts(videoModes[mode].width, videoModes[mode].height, videoModes[mode].chain4?1:0))
+// {printf("setModeViaPorts(%i,%i,%i) failed!\n",videoModes[mode].width, videoModes[mode].height, videoModes[mode].chain4?1:0);return -1;}
+ printf("Check 1.1\n");
+ memset(0xA0000,11,16);
+ printf("Check 2\n");
+ printf("Screenbuf: %X\nESP: %X\nValue: %X\n", screenbuf, getESP(), size);
+ printf("Check 2.1\n");
+ int i = 0;
+ for (; i < 0x4FFFFFFF; i++);
+ pageDbg = TRUE;
+ printf("Check 2.2\n");
+ memset(screenbuf,0,size); //hangs
+ printf("Check 3\n");
+ for(;;);
+ memset(0xA0010,11,16);
+
+
+ videoMode = mode;
+ updateScreen();
+ return 0;
}
//#define outp(port,msg) outb(port,msg)
@@ -293,43 +293,43 @@ int setModeViaPorts(int width, int height,int chain4)
*/
void updateScreen()
{
- if(videoModes[videoMode].chain4)
- memcpy(
- screenbuf ,
- (void*)0xA0000 ,
- videoModes[videoMode].width * videoModes[videoMode].height * videoModes[videoMode].depth
- );
- else
- {
- int size = videoModes[videoMode].width * videoModes[videoMode].height * videoModes[videoMode].depth / 4;
- unsigned int i = 0 ,
- i2 ;
- unsigned char* plane1 = (unsigned char*)(0xA0000) ;
- unsigned char* plane2 = (unsigned char*)(0xA0000+size) ; // ]
- unsigned char* plane3 = (unsigned char*)(0xA0000+2*size); // ]-> these adress seem to be wrong.
- unsigned char* plane4 = (unsigned char*)(0xA0000+3*size); // ]
- unsigned char* buf = screenbuf ;
-
- for(; i < size; i++)
- {
- *plane1 = (unsigned char)0;
- *plane2 = (unsigned char)0;
- *plane3 = (unsigned char)0;
- *plane4 = (unsigned char)0;
- for(i2=0;i2<4;i2++)
- {
- *plane1 |= (unsigned char)( (*buf ) & 0x03 );
- *plane2 |= (unsigned char)( (*buf << 2) & 0x03 );
- *plane3 |= (unsigned char)( (*buf << 4) & 0x03 );
- *plane4 |= (unsigned char)( (*buf << 6) & 0x03 );
- buf++;
- }
- plane1++;
- plane2++;
- plane3++;
- plane4++;
- }
- }
+ if(videoModes[videoMode].chain4)
+ memcpy(
+ screenbuf ,
+ (void*)0xA0000 ,
+ videoModes[videoMode].width * videoModes[videoMode].height * videoModes[videoMode].depth
+ );
+ else
+ {
+ int size = videoModes[videoMode].width * videoModes[videoMode].height * videoModes[videoMode].depth / 4;
+ unsigned int i = 0 ,
+ i2 ;
+ unsigned char* plane1 = (unsigned char*)(0xA0000) ;
+ unsigned char* plane2 = (unsigned char*)(0xA0000+size) ; // ]
+ unsigned char* plane3 = (unsigned char*)(0xA0000+2*size); // ]-> these adress seem to be wrong.
+ unsigned char* plane4 = (unsigned char*)(0xA0000+3*size); // ]
+ unsigned char* buf = screenbuf ;
+
+ for(; i < size; i++)
+ {
+ *plane1 = (unsigned char)0;
+ *plane2 = (unsigned char)0;
+ *plane3 = (unsigned char)0;
+ *plane4 = (unsigned char)0;
+ for(i2=0;i2<4;i2++)
+ {
+ *plane1 |= (unsigned char)( (*buf ) & 0x03 );
+ *plane2 |= (unsigned char)( (*buf << 2) & 0x03 );
+ *plane3 |= (unsigned char)( (*buf << 4) & 0x03 );
+ *plane4 |= (unsigned char)( (*buf << 6) & 0x03 );
+ buf++;
+ }
+ plane1++;
+ plane2++;
+ plane3++;
+ plane4++;
+ }
+ }
}
/**
diff --git a/src/drivers/keyboard/kbd.c b/src/drivers/keyboard/kbd.c
index b3a5038e..0c42e41a 100644
--- a/src/drivers/keyboard/kbd.c
+++ b/src/drivers/keyboard/kbd.c
@@ -27,126 +27,126 @@ static void toggle_kb_leds(uint8_t);
static ol_kb_scancode_t keycodes[] = {
- {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0, '\0', '\0'},
- {0x01, 0x76, 0x08, 0x1d, 0x29, 0x35, 1, '\0', '\0'}, /* Esc */
- {0x02, 0x16, 0x16, 0x1e, 0x1e, 0x12, 2, '1', '!'}, /* 1 ! */
- {0x03, 0x1e, 0x1e, 0x1f, 0x1f, 0x13, 3, '2', '@'}, /* 2 @ */
- {0x04, 0x26, 0x26, 0x20, 0x20, 0x14, 4, '3', '#'}, /* 3 # */
- {0x05, 0x25, 0x25, 0x21, 0x21, 0x15, 5, '4', '$'}, /* 4 $ */
- {0x06, 0x2e, 0x2e, 0x22, 0x22, 0x17, 6, '5', '%'}, /* 5 % */
- {0x07, 0x36, 0x36, 0x23, 0x23, 0x16, 7, '6', '^'}, /* 6 ^ */
- {0x08, 0x3d, 0x3d, 0x24, 0x24, 0x1a, 8, '7', '&'}, /* 7 & */
- {0x09, 0x3e, 0x3e, 0x25, 0x25, 0x1c, 9, '8', '*'}, /* 8 * */
- {0x0a, 0x46, 0x46, 0x26, 0x26, 0x19, 10, '9', '('}, /* 9 ( */
- {0x0b, 0x45, 0x45, 0x27, 0x27, 0x1d, 11, '0', ')'}, /* 0 ) */
- {0x0c, 0x4e, 0x4e, 0x28, 0x2d, 0x1b, 12, '-', '_'}, /* - _ */
- {0x0d, 0x55, 0x55, 0x29, 0x2e, 0x18, 13,'=', '+'}, /* = + */
- {0x0e, 0x66, 0x66, 0x2b, 0x2a, 0x33, 14,'\b', '\b'}, /* Backspace */
- {0x0f, 0x0d, 0x0d, 0x35, 0x2b, 0x30, 15, '\t', '\t'}, /* Tab */
- {0x10, 0x15, 0x15, 0x36, 0x14, 0x0c, 16, 'q', 'Q'}, /* Q */
- {0x11, 0x1d, 0x1d, 0x37, 0x1a, 0x0d, 17, 'w', 'W'}, /* W */
- {0x12, 0x24, 0x24, 0x38, 0x08, 0x0e, 18, 'e', 'E'}, /* E */
- {0x13, 0x2d, 0x2d, 0x39, 0x15, 0x0f, 19, 'r', 'R'}, /* R */
- {0x14, 0x2c, 0x2c, 0x3a, 0x17, 0x11, 20, 't', 'T'}, /* T */
- {0x15, 0x35, 0x35, 0x3b, 0x1c, 0x10, 21, 'y', 'Y'}, /* Y */
- {0x16, 0x3c, 0x3c, 0x3c, 0x18, 0x20, 22, 'u', 'U'}, /* U */
- {0x17, 0x43, 0x43, 0x3d, 0x0c, 0x22, 23, 'i', 'I'}, /* I */
- {0x18, 0x44, 0x44, 0x3e, 0x12, 0x1f, 24, 'o', 'O'}, /* O */
- {0x19, 0x4d, 0x4d, 0x3f, 0x13, 0x23, 25, 'p', 'P'}, /* P */
- {0x1a, 0x54, 0x54, 0x40, 0x2f, 0x21, 26, '[', '{'}, /* [ { */
- {0x1b, 0x5b, 0x5b, 0x41, 0x30, 0x1e, 27, ']', '}'}, /* ] } */
- {0x1c, 0x5a, 0x5a, 0x59, 0x28, 0x24, 28, '\n', '\n'}, /* Enter */
- {0x1d, 0x14, 0x11, 0x4c, 0xe0, 0x36, 29,'\0', '\0'}, /* Left Control */
- {0x1e, 0x1c, 0x1c, 0x4d, 0x04, 0x00, 30, 'a', 'A'}, /* A */
- {0x1f, 0x1b, 0x1b, 0x4e, 0x16, 0x01, 31, 's', 'S'}, /* S */
- {0x20, 0x23, 0x23, 0x4f, 0x07, 0x02, 32, 'd', 'D'}, /* D */
- {0x21, 0x2b, 0x2b, 0x50, 0x09, 0x03, 33, 'f', 'F'}, /* F */
- {0x22, 0x34, 0x34, 0x51, 0x0a, 0x05, 34, 'g', 'G'}, /* G */
- {0x23, 0x33, 0x33, 0x52, 0x0b, 0x04, 35, 'h', 'H'}, /* H */
- {0x24, 0x3b, 0x3b, 0x53, 0x0d, 0x26, 36, 'j', 'J'}, /* J */
- {0x25, 0x42, 0x42, 0x54, 0x0e, 0x28, 37, 'k', 'K'}, /* K */
- {0x26, 0x4b, 0x4b, 0x55, 0x0f, 0x25, 38, 'l', 'L'}, /* L */
- {0x27, 0x4c, 0x4c, 0x56, 0x33, 0x29, 39, ';', ':'}, /* ; : */
- {0x28, 0x52, 0x52, 0x57, 0x34, 0x27, 40, '\'', '\"'}, /* ' " */
- {0x29, 0x0e, 0x0e, 0x2a, 0x35, 0x32, 41, '`', '~'}, /* ` ~ */
- {0x2a, 0x12, 0x12, 0x63, 0xe1, 0x38, 42, '\0', '\0'}, /* Left Shift */
- {0x2b, 0x5d, 0x5c, 0x58, 0x31, 0x2a, 43, '\\', '|'}, /* \ | */
- {0x2c, 0x1a, 0x1a, 0x64, 0x1d, 0x06, 44, 'z', 'Z'}, /* Z */
- {0x2d, 0x22, 0x22, 0x65, 0x1b, 0x07, 45, 'x', 'X'}, /* X */
- {0x2e, 0x21, 0x21, 0x66, 0x06, 0x08, 46, 'c', 'C'}, /* C */
- {0x2f, 0x2a, 0x2a, 0x67, 0x19, 0x09, 47, 'v', 'V'}, /* V */
- {0x30, 0x32, 0x32, 0x68, 0x05, 0x0b, 48, 'b', 'B'}, /* B */
- {0x31, 0x31, 0x31, 0x69, 0x11, 0x2d, 49, 'n', 'N'}, /* N */
- {0x32, 0x3a, 0x3a, 0x6a, 0x10, 0x2e, 50, 'm', 'M'}, /* M */
- {0x33, 0x41, 0x41, 0x6b, 0x36, 0x2b, 51, ',', '<'}, /* , < */
- {0x34, 0x49, 0x49, 0x6c, 0x37, 0x2f, 52, '.', '>'}, /* . > */
- {0x35, 0x4a, 0x4a, 0x6d, 0x38, 0x2c, 53, '/', '?'}, /* / ? */
- {0x36, 0x59, 0x59, 0x6e, 0xe5, 0x7b, 54,'\0', '\0'}, /* Right Shift */
- {0x37, 0x7c, 0x7e, 0x2f, 0x55, 0x43, 55, '\0', '\0'}, /* KP * */
- {0x38, 0x11, 0x19, 0x13, 0xe2, 0x37, 56, '\0', '\0'}, /* Left Alt */
- {0x39, 0x29, 0x29, 0x79, 0x2c, 0x31, 57, ' ', ' '}, /* Space */
- {0x3a, 0x58, 0x14, 0x77, 0x39, 0x39, 58, '\0', '\0'}, /* Caps Lock */
- {0x3b, 0x05, 0x07, 0x05, 0x3a, 0x7a, 59, '\0', '\0'}, /* F1 */
- {0x3c, 0x06, 0x0f, 0x06, 0x3b, 0x78, 60, '\0', '\0'}, /* F2 */
- {0x3d, 0x04, 0x17, 0x08, 0x3c, 0x63, 61, '\0', '\0'}, /* F3 */
- {0x3e, 0x0c, 0x1f, 0x0a, 0x3d, 0x76, 62, '\0', '\0'}, /* F4 */
- {0x3f, 0x03, 0x27, 0x0c, 0x3e, 0x60, 63, '\0', '\0'}, /* F5 */
- {0x40, 0x0b, 0x2f, 0x0e, 0x3f, 0x61, 64, '\0', '\0'}, /* F6 */
- {0x41, 0x02, 0x37, 0x10, 0x40, 0x62, 65, '\0', '\0'}, /* F7 */
- {0x42, 0x0a, 0x3f, 0x11, 0x41, 0x64, 66, '\0', '\0'}, /* F8 */
- {0x43, 0x01, 0x47, 0x12, 0x42, 0x65, 67, '\0', '\0'}, /* F9 */
- {0x44, 0x09, 0x4f, 0x07, 0x43, 0x6d, 68, '\0', '\0'}, /* F10 */
- {0x45, 0x77, 0x76, 0x62, 0x53, 0x47, 69, '\0', '\0'}, /* Num Lock */
- {0x46, 0x7e, 0x5f, 0x17, 0x47, 0x6b, 70, '\0', '\0'}, /* Scroll Lock Break */
- {0x47, 0x6c, 0x6c, 0x44, 0x5f, 0x59, 71, '\0', '\0'}, /* KP Home 7 */
- {0x48, 0x75, 0x75, 0x45, 0x60, 0x5b, 72, '\0', '\0'}, /* KP Up 8 */
- {0x49, 0x7d, 0x7d, 0x46, 0x61, 0x5c, 73, '\0', '\0'}, /* KP PgUp 9 */
- {0x4a, 0x7b, 0x84, 0x47, 0x56, 0x4e, 74, '\0', '\0'}, /* KP - */
- {0x4b, 0x6b, 0x6b, 0x5b, 0x5c, 0x56, 75, '\0', '\0'}, /* KP Left 4 */
- {0x4c, 0x73, 0x73, 0x5c, 0x5d, 0x57, 76, '\0', '\0'}, /* KP 5 */
- {0x4d, 0x74, 0x74, 0x5d, 0x5e, 0x58, 77, '\0', '\0'}, /* KP Right 6 */
- {0x4e, 0x79, 0x7c, 0x7d, 0x57, 0x45, 78, '\0', '\0'}, /* KP + */
- {0x4f, 0x69, 0x69, 0x70, 0x59, 0x53, 79, '\0', '\0'}, /* KP End 1 */
- {0x50, 0x72, 0x72, 0x71, 0x5a, 0x54, 80, '\0', '\0'}, /* KP Down 2 */
- {0x51, 0x7a, 0x7a, 0x72, 0x5b, 0x55, 81, '\0', '\0'}, /* KP PgDn 3 */
- {0x52, 0x70, 0x70, 0x5e, 0x62, 0x52, 82, '\0', '\0'}, /* KP Ins 0 */
- {0x53, 0x71, 0x71, 0x32, 0x63, 0x41, 83, '\0', '\0'}, /* KP Del . */
+ {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0, '\0', '\0'},
+ {0x01, 0x76, 0x08, 0x1d, 0x29, 0x35, 1, '\0', '\0'}, /* Esc */
+ {0x02, 0x16, 0x16, 0x1e, 0x1e, 0x12, 2, '1', '!'}, /* 1 ! */
+ {0x03, 0x1e, 0x1e, 0x1f, 0x1f, 0x13, 3, '2', '@'}, /* 2 @ */
+ {0x04, 0x26, 0x26, 0x20, 0x20, 0x14, 4, '3', '#'}, /* 3 # */
+ {0x05, 0x25, 0x25, 0x21, 0x21, 0x15, 5, '4', '$'}, /* 4 $ */
+ {0x06, 0x2e, 0x2e, 0x22, 0x22, 0x17, 6, '5', '%'}, /* 5 % */
+ {0x07, 0x36, 0x36, 0x23, 0x23, 0x16, 7, '6', '^'}, /* 6 ^ */
+ {0x08, 0x3d, 0x3d, 0x24, 0x24, 0x1a, 8, '7', '&'}, /* 7 & */
+ {0x09, 0x3e, 0x3e, 0x25, 0x25, 0x1c, 9, '8', '*'}, /* 8 * */
+ {0x0a, 0x46, 0x46, 0x26, 0x26, 0x19, 10, '9', '('}, /* 9 ( */
+ {0x0b, 0x45, 0x45, 0x27, 0x27, 0x1d, 11, '0', ')'}, /* 0 ) */
+ {0x0c, 0x4e, 0x4e, 0x28, 0x2d, 0x1b, 12, '-', '_'}, /* - _ */
+ {0x0d, 0x55, 0x55, 0x29, 0x2e, 0x18, 13,'=', '+'}, /* = + */
+ {0x0e, 0x66, 0x66, 0x2b, 0x2a, 0x33, 14,'\b', '\b'}, /* Backspace */
+ {0x0f, 0x0d, 0x0d, 0x35, 0x2b, 0x30, 15, '\t', '\t'}, /* Tab */
+ {0x10, 0x15, 0x15, 0x36, 0x14, 0x0c, 16, 'q', 'Q'}, /* Q */
+ {0x11, 0x1d, 0x1d, 0x37, 0x1a, 0x0d, 17, 'w', 'W'}, /* W */
+ {0x12, 0x24, 0x24, 0x38, 0x08, 0x0e, 18, 'e', 'E'}, /* E */
+ {0x13, 0x2d, 0x2d, 0x39, 0x15, 0x0f, 19, 'r', 'R'}, /* R */
+ {0x14, 0x2c, 0x2c, 0x3a, 0x17, 0x11, 20, 't', 'T'}, /* T */
+ {0x15, 0x35, 0x35, 0x3b, 0x1c, 0x10, 21, 'y', 'Y'}, /* Y */
+ {0x16, 0x3c, 0x3c, 0x3c, 0x18, 0x20, 22, 'u', 'U'}, /* U */
+ {0x17, 0x43, 0x43, 0x3d, 0x0c, 0x22, 23, 'i', 'I'}, /* I */
+ {0x18, 0x44, 0x44, 0x3e, 0x12, 0x1f, 24, 'o', 'O'}, /* O */
+ {0x19, 0x4d, 0x4d, 0x3f, 0x13, 0x23, 25, 'p', 'P'}, /* P */
+ {0x1a, 0x54, 0x54, 0x40, 0x2f, 0x21, 26, '[', '{'}, /* [ { */
+ {0x1b, 0x5b, 0x5b, 0x41, 0x30, 0x1e, 27, ']', '}'}, /* ] } */
+ {0x1c, 0x5a, 0x5a, 0x59, 0x28, 0x24, 28, '\n', '\n'}, /* Enter */
+ {0x1d, 0x14, 0x11, 0x4c, 0xe0, 0x36, 29,'\0', '\0'}, /* Left Control */
+ {0x1e, 0x1c, 0x1c, 0x4d, 0x04, 0x00, 30, 'a', 'A'}, /* A */
+ {0x1f, 0x1b, 0x1b, 0x4e, 0x16, 0x01, 31, 's', 'S'}, /* S */
+ {0x20, 0x23, 0x23, 0x4f, 0x07, 0x02, 32, 'd', 'D'}, /* D */
+ {0x21, 0x2b, 0x2b, 0x50, 0x09, 0x03, 33, 'f', 'F'}, /* F */
+ {0x22, 0x34, 0x34, 0x51, 0x0a, 0x05, 34, 'g', 'G'}, /* G */
+ {0x23, 0x33, 0x33, 0x52, 0x0b, 0x04, 35, 'h', 'H'}, /* H */
+ {0x24, 0x3b, 0x3b, 0x53, 0x0d, 0x26, 36, 'j', 'J'}, /* J */
+ {0x25, 0x42, 0x42, 0x54, 0x0e, 0x28, 37, 'k', 'K'}, /* K */
+ {0x26, 0x4b, 0x4b, 0x55, 0x0f, 0x25, 38, 'l', 'L'}, /* L */
+ {0x27, 0x4c, 0x4c, 0x56, 0x33, 0x29, 39, ';', ':'}, /* ; : */
+ {0x28, 0x52, 0x52, 0x57, 0x34, 0x27, 40, '\'', '\"'}, /* ' " */
+ {0x29, 0x0e, 0x0e, 0x2a, 0x35, 0x32, 41, '`', '~'}, /* ` ~ */
+ {0x2a, 0x12, 0x12, 0x63, 0xe1, 0x38, 42, '\0', '\0'}, /* Left Shift */
+ {0x2b, 0x5d, 0x5c, 0x58, 0x31, 0x2a, 43, '\\', '|'}, /* \ | */
+ {0x2c, 0x1a, 0x1a, 0x64, 0x1d, 0x06, 44, 'z', 'Z'}, /* Z */
+ {0x2d, 0x22, 0x22, 0x65, 0x1b, 0x07, 45, 'x', 'X'}, /* X */
+ {0x2e, 0x21, 0x21, 0x66, 0x06, 0x08, 46, 'c', 'C'}, /* C */
+ {0x2f, 0x2a, 0x2a, 0x67, 0x19, 0x09, 47, 'v', 'V'}, /* V */
+ {0x30, 0x32, 0x32, 0x68, 0x05, 0x0b, 48, 'b', 'B'}, /* B */
+ {0x31, 0x31, 0x31, 0x69, 0x11, 0x2d, 49, 'n', 'N'}, /* N */
+ {0x32, 0x3a, 0x3a, 0x6a, 0x10, 0x2e, 50, 'm', 'M'}, /* M */
+ {0x33, 0x41, 0x41, 0x6b, 0x36, 0x2b, 51, ',', '<'}, /* , < */
+ {0x34, 0x49, 0x49, 0x6c, 0x37, 0x2f, 52, '.', '>'}, /* . > */
+ {0x35, 0x4a, 0x4a, 0x6d, 0x38, 0x2c, 53, '/', '?'}, /* / ? */
+ {0x36, 0x59, 0x59, 0x6e, 0xe5, 0x7b, 54,'\0', '\0'}, /* Right Shift */
+ {0x37, 0x7c, 0x7e, 0x2f, 0x55, 0x43, 55, '\0', '\0'}, /* KP * */
+ {0x38, 0x11, 0x19, 0x13, 0xe2, 0x37, 56, '\0', '\0'}, /* Left Alt */
+ {0x39, 0x29, 0x29, 0x79, 0x2c, 0x31, 57, ' ', ' '}, /* Space */
+ {0x3a, 0x58, 0x14, 0x77, 0x39, 0x39, 58, '\0', '\0'}, /* Caps Lock */
+ {0x3b, 0x05, 0x07, 0x05, 0x3a, 0x7a, 59, '\0', '\0'}, /* F1 */
+ {0x3c, 0x06, 0x0f, 0x06, 0x3b, 0x78, 60, '\0', '\0'}, /* F2 */
+ {0x3d, 0x04, 0x17, 0x08, 0x3c, 0x63, 61, '\0', '\0'}, /* F3 */
+ {0x3e, 0x0c, 0x1f, 0x0a, 0x3d, 0x76, 62, '\0', '\0'}, /* F4 */
+ {0x3f, 0x03, 0x27, 0x0c, 0x3e, 0x60, 63, '\0', '\0'}, /* F5 */
+ {0x40, 0x0b, 0x2f, 0x0e, 0x3f, 0x61, 64, '\0', '\0'}, /* F6 */
+ {0x41, 0x02, 0x37, 0x10, 0x40, 0x62, 65, '\0', '\0'}, /* F7 */
+ {0x42, 0x0a, 0x3f, 0x11, 0x41, 0x64, 66, '\0', '\0'}, /* F8 */
+ {0x43, 0x01, 0x47, 0x12, 0x42, 0x65, 67, '\0', '\0'}, /* F9 */
+ {0x44, 0x09, 0x4f, 0x07, 0x43, 0x6d, 68, '\0', '\0'}, /* F10 */
+ {0x45, 0x77, 0x76, 0x62, 0x53, 0x47, 69, '\0', '\0'}, /* Num Lock */
+ {0x46, 0x7e, 0x5f, 0x17, 0x47, 0x6b, 70, '\0', '\0'}, /* Scroll Lock Break */
+ {0x47, 0x6c, 0x6c, 0x44, 0x5f, 0x59, 71, '\0', '\0'}, /* KP Home 7 */
+ {0x48, 0x75, 0x75, 0x45, 0x60, 0x5b, 72, '\0', '\0'}, /* KP Up 8 */
+ {0x49, 0x7d, 0x7d, 0x46, 0x61, 0x5c, 73, '\0', '\0'}, /* KP PgUp 9 */
+ {0x4a, 0x7b, 0x84, 0x47, 0x56, 0x4e, 74, '\0', '\0'}, /* KP - */
+ {0x4b, 0x6b, 0x6b, 0x5b, 0x5c, 0x56, 75, '\0', '\0'}, /* KP Left 4 */
+ {0x4c, 0x73, 0x73, 0x5c, 0x5d, 0x57, 76, '\0', '\0'}, /* KP 5 */
+ {0x4d, 0x74, 0x74, 0x5d, 0x5e, 0x58, 77, '\0', '\0'}, /* KP Right 6 */
+ {0x4e, 0x79, 0x7c, 0x7d, 0x57, 0x45, 78, '\0', '\0'}, /* KP + */
+ {0x4f, 0x69, 0x69, 0x70, 0x59, 0x53, 79, '\0', '\0'}, /* KP End 1 */
+ {0x50, 0x72, 0x72, 0x71, 0x5a, 0x54, 80, '\0', '\0'}, /* KP Down 2 */
+ {0x51, 0x7a, 0x7a, 0x72, 0x5b, 0x55, 81, '\0', '\0'}, /* KP PgDn 3 */
+ {0x52, 0x70, 0x70, 0x5e, 0x62, 0x52, 82, '\0', '\0'}, /* KP Ins 0 */
+ {0x53, 0x71, 0x71, 0x32, 0x63, 0x41, 83, '\0', '\0'}, /* KP Del . */
/*
* The most common extensions to the base.
*/
- { 0, 0x78, 0x56, 0x09, 0x44, 0x67, 87, '\0', '\0'}, /* F11 */
- { 0, 0x07, 0x5e, 0x0b, 0x45, 0x6f, 88, '\0', '\0'}, /* F12 */
- { 0, 0xda, 0x79, 0x5a, 0x58, 0x4c, 96, '\0', '\0'}, /* KP Enter */
- { 0, 0xca, 0x77, 0x2e, 0x54, 0x4b, 98, '\0', '\0'}, /* KP / */
- { 0, 0x91, 0x39, 0x0d, 0xe6, 0x7c, 100, '\0', '\0'}, /* Right Alt (Graph) */
- { 0, 0, 0x58, 0, 0, 0, 100, '\0', '\0'}, /* Alt Graph - Sun PS/2 Type 5 */
- { 0, 0xf1, 0x64, 0x42, 0x4c, 0x75, 111, '\0', '\0'}, /* Delete */
- { 0, 0xfe, 0x62, 0x15, 0x48, 0x71, 119, '\0', '\0'}, /* Pause Break */
- { 0, 0xf7, 0, 0, 0, 0, 119, '\0', '\0'}, /* Alternate Pause Break */
+ { 0, 0x78, 0x56, 0x09, 0x44, 0x67, 87, '\0', '\0'}, /* F11 */
+ { 0, 0x07, 0x5e, 0x0b, 0x45, 0x6f, 88, '\0', '\0'}, /* F12 */
+ { 0, 0xda, 0x79, 0x5a, 0x58, 0x4c, 96, '\0', '\0'}, /* KP Enter */
+ { 0, 0xca, 0x77, 0x2e, 0x54, 0x4b, 98, '\0', '\0'}, /* KP / */
+ { 0, 0x91, 0x39, 0x0d, 0xe6, 0x7c, 100, '\0', '\0'}, /* Right Alt (Graph) */
+ { 0, 0, 0x58, 0, 0, 0, 100, '\0', '\0'}, /* Alt Graph - Sun PS/2 Type 5 */
+ { 0, 0xf1, 0x64, 0x42, 0x4c, 0x75, 111, '\0', '\0'}, /* Delete */
+ { 0, 0xfe, 0x62, 0x15, 0x48, 0x71, 119, '\0', '\0'}, /* Pause Break */
+ { 0, 0xf7, 0, 0, 0, 0, 119, '\0', '\0'}, /* Alternate Pause Break */
/*
* The separate navigation keys
*/
- { 0, 0xec, 0x6e, 0x34, 0x4a, 0x73, 102, '\0', '\0'}, /* Home */
- { 0, 0xf5, 0x63, 0x14, 0x52, 0x3e, 103, '\0', '\0'}, /* Up */
- { 0, 0xfd, 0x6f, 0x60, 0x4b, 0x74, 104, '\0', '\0'}, /* Page Up */
- { 0, 0xeb, 0x61, 0x18, 0x50, 0x3b, 105, '\0', '\0'}, /* Left */
- { 0, 0xf4, 0x6a, 0x1c, 0x4f, 0x3c, 106, '\0', '\0'}, /* Right */
- { 0, 0xe9, 0x65, 0x4a, 0x4d, 0x77, 107, '\0', '\0'}, /* End */
- { 0, 0xf2, 0x60, 0x1b, 0x51, 0x3d, 108, '\0', '\0'}, /* Down */
- { 0, 0xfa, 0x6d, 0x7b, 0x4e, 0x79, 109, '\0', '\0'}, /* Page Down */
- { 0, 0xf0, 0x67, 0x2c, 0x49, 0x72, 110, '\0', '\0'}, /* Insert */
+ { 0, 0xec, 0x6e, 0x34, 0x4a, 0x73, 102, '\0', '\0'}, /* Home */
+ { 0, 0xf5, 0x63, 0x14, 0x52, 0x3e, 103, '\0', '\0'}, /* Up */
+ { 0, 0xfd, 0x6f, 0x60, 0x4b, 0x74, 104, '\0', '\0'}, /* Page Up */
+ { 0, 0xeb, 0x61, 0x18, 0x50, 0x3b, 105, '\0', '\0'}, /* Left */
+ { 0, 0xf4, 0x6a, 0x1c, 0x4f, 0x3c, 106, '\0', '\0'}, /* Right */
+ { 0, 0xe9, 0x65, 0x4a, 0x4d, 0x77, 107, '\0', '\0'}, /* End */
+ { 0, 0xf2, 0x60, 0x1b, 0x51, 0x3d, 108, '\0', '\0'}, /* Down */
+ { 0, 0xfa, 0x6d, 0x7b, 0x4e, 0x79, 109, '\0', '\0'}, /* Page Down */
+ { 0, 0xf0, 0x67, 0x2c, 0x49, 0x72, 110, '\0', '\0'}, /* Insert */
/*
* The OS keys
*/
- { 0, 0x9f, 0x8b, 0x78, 0xe3, 0, 125, '\0', '\0'}, /* Left Meta (Win, Apple, Amiga) */
- { 0, 0xa7, 0x8c, 0x7a, 0xe7, 0, 126, '\0', '\0'}, /* Right Meta (Win, Apple, Amiga) */
- { 0, 0xaf, 0x8d, 0x43, 0x65, 0, 127, '\0', '\0'} /* Compose (Application) */
+ { 0, 0x9f, 0x8b, 0x78, 0xe3, 0, 125, '\0', '\0'}, /* Left Meta (Win, Apple, Amiga) */
+ { 0, 0xa7, 0x8c, 0x7a, 0xe7, 0, 126, '\0', '\0'}, /* Right Meta (Win, Apple, Amiga) */
+ { 0, 0xaf, 0x8d, 0x43, 0x65, 0, 127, '\0', '\0'} /* Compose (Application) */
};
@@ -159,23 +159,23 @@ uint8_t leds = 0;
uint32_t key_pressed = 0;
void kb_handle(uint8_t c)
{
- if(c & 0x80)
- {
- /*
- * Here I can test if the shift key is pressed or not and display
+ if(c & 0x80)
+ {
+ /*
+ * Here I can test if the shift key is pressed or not and display
* capital letters and stuff like that..
- */
- uint8_t tmp = c ^ 0x80;
- if(tmp == 0x38) altkey = FALSE;
- if(tmp == 0x1d) ctrlkey = FALSE;
- if(tmp == 0x4f) endkey = FALSE;
+ */
+ uint8_t tmp = c ^ 0x80;
+ if(tmp == 0x38) altkey = FALSE;
+ if(tmp == 0x1d) ctrlkey = FALSE;
+ if(tmp == 0x4f) endkey = FALSE;
if(tmp == 0x2a) shiftkey ^= TRUE;
if(tmp == 0x36) shiftkey ^= TRUE;
if(tmp == 0x3a) shiftkey ^= TRUE;
- }
+ }
- else
- {
+ else
+ {
// togle keyboard leds
if(c == 0x45)
{
@@ -192,12 +192,12 @@ void kb_handle(uint8_t c)
leds ^= OL_SCROLL_LED;
toggle_kb_leds(leds);
}
- /*
- * All default letters are taken from the array. All other keys
+ /*
+ * All default letters are taken from the array. All other keys
* are handled in this switch case
- */
- switch(c)
- {
+ */
+ switch(c)
+ {
case 0x2a:
shiftkey ^= TRUE;
break;
@@ -205,40 +205,40 @@ void kb_handle(uint8_t c)
shiftkey ^= TRUE;
break;
- case 0xe0: // escaped scan codes
- break;
- case 0x38:
- altkey = TRUE;
- break;
+ case 0xe0: // escaped scan codes
+ break;
+ case 0x38:
+ altkey = TRUE;
+ break;
- case 0x1d:
- ctrlkey = TRUE;
- break;
+ case 0x1d:
+ ctrlkey = TRUE;
+ break;
- case 0x4f:
- endkey = TRUE;
- break;
+ case 0x4f:
+ endkey = TRUE;
+ break;
- case 0x50:
- scroll(1);
- break;
- default:
+ case 0x50:
+ scroll(1);
+ break;
+ default:
shiftkey ? putc(keycodes[c].capvalue) :
putc(keycodes[c].value);
key_pressed = 1;
- break;
- }
+ break;
+ }
- if(ctrlkey && altkey && endkey)
- {
- reboot();
- }
+ if(ctrlkey && altkey && endkey)
+ {
+ reboot();
+ }
#ifdef KBD_PANIC
- if (keycodes[c].code == 0x62)
- panic("Keyboard panic!");
+ if (keycodes[c].code == 0x62)
+ panic("Keyboard panic!");
#endif
- }
- return;
+ }
+ return;
}
static void toggle_kb_leds(uint8_t status)
diff --git a/src/fs/path.c b/src/fs/path.c
index 0a7e44c3..817266f2 100644
--- a/src/fs/path.c
+++ b/src/fs/path.c
@@ -22,69 +22,69 @@
void clean_path(struct __PATH_ELEMENT* elements)
{
- struct __PATH_ELEMENT *carriage = elements;
- for (; carriage != NULL; carriage = carriage->next)
- {
- kfree(carriage);
- }
+ struct __PATH_ELEMENT *carriage = elements;
+ for (; carriage != NULL; carriage = carriage->next)
+ {
+ kfree(carriage);
+ }
}
void add_character(struct __PATH_ELEMENT* element, char c)
{
- if (element->cursor == 0xff)
- return;
- element->name[element->cursor] = c;
- element->cursor++;
+ if (element->cursor == 0xff)
+ return;
+ element->name[element->cursor] = c;
+ element->cursor++;
}
struct __PATH_ELEMENT *parse_path(char* path)
{
- if (path == NULL)
- return NULL;
- if (strlen(path) == 0)
- return NULL;
+ if (path == NULL)
+ return NULL;
+ if (strlen(path) == 0)
+ return NULL;
- struct __PATH_ELEMENT *list = kmalloc(sizeof(struct __PATH_ELEMENT));
- memset(list, 0, sizeof(struct __PATH_ELEMENT));
+ struct __PATH_ELEMENT *list = kmalloc(sizeof(struct __PATH_ELEMENT));
+ memset(list, 0, sizeof(struct __PATH_ELEMENT));
- struct __PATH_ELEMENT *carriage = list;
- int idx = 0;
- boolean escaped = FALSE;
+ struct __PATH_ELEMENT *carriage = list;
+ int idx = 0;
+ boolean escaped = FALSE;
- for (; path[idx] != '\0'; idx++)
- {
- switch(path[idx])
- {
- case '\\':
- if (escaped)
- {
- add_character(carriage, '\\');
- escaped = FALSE;
- }
- else
- escaped = TRUE;
- break;
- case '/':
- add_character(carriage, '/');
- if (!escaped)
- {
- carriage->next =
- kmalloc(sizeof(struct __PATH_ELEMENT));
- if (carriage->next == NULL)
- {
- clean_path(list);
- return NULL;
- }
- memset(carriage->next, 0,
- sizeof(struct __PATH_ELEMENT));
- carriage = carriage->next;
- }
- escaped = FALSE;
- break;
- default:
- add_character(carriage, path[idx]);
- escaped = FALSE;
- }
- }
- return list;
+ for (; path[idx] != '\0'; idx++)
+ {
+ switch(path[idx])
+ {
+ case '\\':
+ if (escaped)
+ {
+ add_character(carriage, '\\');
+ escaped = FALSE;
+ }
+ else
+ escaped = TRUE;
+ break;
+ case '/':
+ add_character(carriage, '/');
+ if (!escaped)
+ {
+ carriage->next =
+ kmalloc(sizeof(struct __PATH_ELEMENT));
+ if (carriage->next == NULL)
+ {
+ clean_path(list);
+ return NULL;
+ }
+ memset(carriage->next, 0,
+ sizeof(struct __PATH_ELEMENT));
+ carriage = carriage->next;
+ }
+ escaped = FALSE;
+ break;
+ default:
+ add_character(carriage, path[idx]);
+ escaped = FALSE;
+ }
+ }
+ return list;
}
diff --git a/src/lib/stdio/printf.c b/src/lib/stdio/printf.c
index 2c5e95d4..62ecaf22 100644
--- a/src/lib/stdio/printf.c
+++ b/src/lib/stdio/printf.c
@@ -443,6 +443,6 @@ int vsprintf(char* str, char* fmt, va_list list)
}
/** @}
- * \file
+ * \file
*/
diff --git a/src/math/complex.c b/src/math/complex.c
index 7e6745b5..cc358803 100644
--- a/src/math/complex.c
+++ b/src/math/complex.c
@@ -25,19 +25,19 @@
double
cabs(double complex x)
{
- return sqrt( creal(x)*creal(x) + cimag(x)*cimag(x) );
+ return sqrt( creal(x)*creal(x) + cimag(x)*cimag(x) );
}
float
cabsf(float complex);
{
- return sqrtf( crealf(x)*crealf(x) + cimagf(x)*cimagf(x) );
+ return sqrtf( crealf(x)*crealf(x) + cimagf(x)*cimagf(x) );
}
long double
cabsl(long double complex);
{
- return sqrtl( creall(x)*creall(x) + cimagl(x)*cimagl(x) );
+ return sqrtl( creall(x)*creall(x) + cimagl(x)*cimagl(x) );
}
/**
@@ -46,17 +46,17 @@ cabsl(long double complex);
double complex ccos(double complex);
{
- return ( sin(creal(x))*cosh(cimag(x)) ) + I( cos(creal(x))*sinh(cimag(x)) );
+ return ( sin(creal(x))*cosh(cimag(x)) ) + I( cos(creal(x))*sinh(cimag(x)) );
}
float complex ccosf(float complex);
{
- return ( sinf(crealf(x))*coshf(cimagf(x)) ) + I( cosf(crealf(x))*sinhf(cimagf(x)) );
+ return ( sinf(crealf(x))*coshf(cimagf(x)) ) + I( cosf(crealf(x))*sinhf(cimagf(x)) );
}
long double complex ccosl(long double complex);
{
- return ( sinl(creall(x))*coshl(cimagl(x)) ) + I( cosl(creall(x))*sinhl(cimagl(x)) );
+ return ( sinl(creall(x))*coshl(cimagl(x)) ) + I( cosl(creall(x))*sinhl(cimagl(x)) );
}
/**
@@ -65,17 +65,17 @@ long double complex ccosl(long double complex);
double complex cacos(double complex);
{
- return ;
+ return ;
}
float complex cacosf(float complex);
{
- return ;
+ return ;
}
long double complex cacosl(long double complex);
{
- return ;
+ return ;
}
/**
@@ -84,17 +84,17 @@ long double complex cacosl(long double complex);
double complex ccosh(double complex);
{
- return ;
+ return ;
}
float complex ccoshf(float complex);
{
- return ;
+ return ;
}
long double complex ccoshl(long double complex);
{
- return ;
+ return ;
}
/**
@@ -103,17 +103,17 @@ long double complex ccoshl(long double complex);
double complex cacosh(double complex);
{
- return ;
+ return ;
}
float complex cacoshf(float complex);
{
- return ;
+ return ;
}
long double complex cacoshl(long double complex);
{
- return ;
+ return ;
}
/**
@@ -122,17 +122,17 @@ long double complex cacoshl(long double complex);
double carg(double complex);
{
- return ;
+ return ;
}
float cargf(float complex);
{
- return ;
+ return ;
}
long double cargl(long double complex);
{
- return ;
+ return ;
}
/**
@@ -141,17 +141,17 @@ long double cargl(long double complex);
double complex casin(double complex);
{
- return ;
+ return ;
}
float complex casinf(float complex);
{
- return ;
+ return ;
}
long double complex casinl(long double complex);
{
- return ;
+ return ;
}
/**
@@ -160,17 +160,17 @@ long double complex casinl(long double complex);
float complex casinhf(float complex);
{
- return ;
+ return ;
}
double complex casinh(double complex);
{
- return ;
+ return ;
}
long double complex casinhl(long double complex);
{
- return ;
+ return ;
}
/**
@@ -179,17 +179,17 @@ long double complex casinhl(long double complex);
double complex catan(double complex);
{
- return ;
+ return ;
}
float complex catanf(float complex);
{
- return ;
+ return ;
}
long double complex catanl(long double complex);
{
- return ;
+ return ;
}
/**
@@ -198,196 +198,196 @@ long double complex catanl(long double complex);
double complex catanh(double complex);
{
- return ;
+ return ;
}
float complex catanhf(float complex);
{
- return ;
+ return ;
}
long double complex catanhl(long double complex);
{
- return ;
+ return ;
}
double complex cexp(double complex);
{
- return ;
+ return ;
}
float complex cexpf(float complex);
{
- return ;
+ return ;
}
long double complex cexpl(long double complex);
{
- return ;
+ return ;
}
double cimag(double complex);
{
- return ;
+ return ;
}
float cimagf(float complex);
{
- return ;
+ return ;
}
long double cimagl(long double complex);
{
- return ;
+ return ;
}
double complex clog(double complex);
{
- return ;
+ return ;
}
float complex clogf(float complex);
{
- return ;
+ return ;
}
long double complex clogl(long double complex);
{
- return ;
+ return ;
}
double complex conj(double complex);
{
- return ;
+ return ;
}
float complex conjf(float complex);
{
- return ;
+ return ;
}
long double complex conjl(long double complex);
{
- return ;
+ return ;
}
double complex cpow(double complex, double complex);
{
- return ;
+ return ;
}
float complex cpowf(float complex, float complex);
{
- return ;
+ return ;
}
long double complex cpowl(long double complex, long double complex);
{
- return ;
+ return ;
}
double complex cproj(double complex);
{
- return ;
+ return ;
}
float complex cprojf(float complex);
{
- return ;
+ return ;
}
long double complex cprojl(long double complex);
{
- return ;
+ return ;
}
double creal(double complex);
{
- return ;
+ return ;
}
float crealf(float complex);
{
- return ;
+ return ;
}
long double creall(long double complex);
{
- return ;
+ return ;
}
double complex csin(double complex);
{
- return ;
+ return ;
}
float complex csinf(float complex);
{
- return ;
+ return ;
}
double complex csinh(double complex);
{
- return ;
+ return ;
}
float complex csinhf(float complex);
{
- return ;
+ return ;
}
long double complex csinhl(long double complex);
{
- return ;
+ return ;
}
long double complex csinl(long double complex);
{
- return ;
+ return ;
}
double complex csqrt(double complex);
{
- return ;
+ return ;
}
float complex csqrtf(float complex);
{
- return ;
+ return ;
}
long double complex csqrtl(long double complex);
{
- return ;
+ return ;
}
double complex ctan(double complex);
{
- return ;
+ return ;
}
float complex ctanf(float complex);
{
- return ;
+ return ;
}
double complex ctanh(double complex);
{
- return ;
+ return ;
}
float complex ctanhf(float complex);
{
- return ;
+ return ;
}
long double complex ctanhl(long double complex);
{
- return ;
+ return ;
}
long double complex ctanl(long double complex);
{
- return ;
+ return ;
}
diff --git a/src/math/math.c b/src/math/math.c
index a09f5131..59e91607 100644
--- a/src/math/math.c
+++ b/src/math/math.c
@@ -26,19 +26,19 @@
double
abs(double num)
{
- return (num>0)?num:-num;
+ return (num>0)?num:-num;
}
float
absf(float num)
{
- return (num>0)?num:-num;
+ return (num>0)?num:-num;
}
long double
absl(long double num)
{
- return (num>0)?num:-num;
+ return (num>0)?num:-num;
}
unsigned int seedTwo = 1; // Store the seeds
@@ -47,57 +47,57 @@ unsigned int seedOne = 1;
void
randomize(unsigned int s) // Create the seed
{
- if (s!=0)
- {
- seedTwo = s;
- seedOne = s/2;
- if (seedOne == 0)
- {
- seedOne = 0x0BADB002;
- }
- }
- else
- {
- seedTwo = 0xDEADBEEF;
- seedOne = 0xCAFEBABE;
- }
+ if (s!=0)
+ {
+ seedTwo = s;
+ seedOne = s/2;
+ if (seedOne == 0)
+ {
+ seedOne = 0x0BADB002;
+ }
+ }
+ else
+ {
+ seedTwo = 0xDEADBEEF;
+ seedOne = 0xCAFEBABE;
+ }
}
int
randomA() // Hash the stuff and make it random.
{
- // Doesn't need to be thread safe for extra randomness.
- if (seedTwo == 0)
- {
- seedTwo = 1;
- }
- if (seedOne == 0)
- {
- seedOne = 1;
- }
- int ret1 = 36969 * (seedOne & 0xFFFF) + (seedTwo >> 16);
- int ret2 = 18000 * (seedTwo & 0xFFFF) + (seedOne >> 16);
+ // Doesn't need to be thread safe for extra randomness.
+ if (seedTwo == 0)
+ {
+ seedTwo = 1;
+ }
+ if (seedOne == 0)
+ {
+ seedOne = 1;
+ }
+ int ret1 = 36969 * (seedOne & 0xFFFF) + (seedTwo >> 16);
+ int ret2 = 18000 * (seedTwo & 0xFFFF) + (seedOne >> 16);
- int ret = (ret1 << 16) + ret2;
+ int ret = (ret1 << 16) + ret2;
- seedOne = ret1; // Set the seeding values
- seedTwo = ret2;
+ seedOne = ret1; // Set the seeding values
+ seedTwo = ret2;
- return ret;
+ return ret;
}
int
random()
{
- int ret = randomA();
- ret %= RANDMAX;
- ret += RANDMIN;
+ int ret = randomA();
+ ret %= RANDMAX;
+ ret += RANDMIN;
- if (ret < 0)
- {
- ret *= -1;
- }
- return ret;
+ if (ret < 0)
+ {
+ ret *= -1;
+ }
+ return ret;
}
#define PI (3.141592653589793) //238462643383279502884197169399375105820974944592307816406286209 Yes, I know the compiler will skip most of the decimals...
@@ -109,380 +109,380 @@ random()
double
NAN()
{
- double nan;
- *((float*)&nan) = 0x7f800000;
- return nan;
+ double nan;
+ *((float*)&nan) = 0x7f800000;
+ return nan;
}
float
NANf()
{
- float nan;
- *((int*)&nan) = 0x7f800000;
- return nan;
+ float nan;
+ *((int*)&nan) = 0x7f800000;
+ return nan;
}
long double
NANl()
{
- long double nan;
- *((int*)&nan) = 0x7f800000;
- return nan;
+ long double nan;
+ *((int*)&nan) = 0x7f800000;
+ return nan;
}
#endif
inline char
isNaN(double num)
{
- return (num != num);
+ return (num != num);
}
inline char
isNaNf(float num)
{
- return (num != num);
+ return (num != num);
}
inline char
isNaNl(long double num)
{
- return (num != num);
+ return (num != num);
}
double
sin(double x)
{
- double ret = x,
- x2 = x*x,
- lastRet = x;
- int i = 2;
- for (;i<0xffffff;i+=2)
- {
- lastRet = -lastRet * ( x2 / (i*(i+1)) );
- if ( -0.0000000001=1)
- return NAN();
- return ln( (1+x) / (1-x) )/2;
+ if (abs(x)>=1)
+ return NAN();
+ return ln( (1+x) / (1-x) )/2;
}
float
atanhf(float x)
{
- if (absf(x)>=1)
- return NANf();
- return lnf( (1+x) / (1-x) )/2;
+ if (absf(x)>=1)
+ return NANf();
+ return lnf( (1+x) / (1-x) )/2;
}
long double
atanhl(long double x)
{
- if (absl(x)>=1)
- return NANl();
- return lnl( (1+x) / (1-x) )/2;
+ if (absl(x)>=1)
+ return NANl();
+ return lnl( (1+x) / (1-x) )/2;
}
#endif
double
exp(double n) //Another beautiful Taylor polynomial
{
- double ret = 1;
- double x = n;
- unsigned int fac = 1, i = 2;
- for (; (fac<0xffffffff) ;i++) // stop if i is insane high
- {
- ret += x/i; // ret += (x^i)/(i!)
- if ( (x>(0xffffffff/n)) || ( x==(x*n) ) ) // stop if x != reliable anymore
- break;
- fac *= i; // making it (i+1)!
- }
- return ret;
+ double ret = 1;
+ double x = n;
+ unsigned int fac = 1, i = 2;
+ for (; (fac<0xffffffff) ;i++) // stop if i is insane high
+ {
+ ret += x/i; // ret += (x^i)/(i!)
+ if ( (x>(0xffffffff/n)) || ( x==(x*n) ) ) // stop if x != reliable anymore
+ break;
+ fac *= i; // making it (i+1)!
+ }
+ return ret;
}
float
expf(float n) //Another beautiful Taylor polynomiall
{
- float ret = 1;
- float x = n;
- unsigned int fac = 1, i = 2;
- for (; (fac<0xffffffff) ;i++) // stop if i is insane high
- {
- ret += x/i; // ret += (x^i)/(i!)
- if ( (x>(0xffffffff/n)) || ( x==(x*n) ) ) // stop if x != relyable anymore
- break;
- fac *= i; // making it (i+1)!
- }
- return ret;
+ float ret = 1;
+ float x = n;
+ unsigned int fac = 1, i = 2;
+ for (; (fac<0xffffffff) ;i++) // stop if i is insane high
+ {
+ ret += x/i; // ret += (x^i)/(i!)
+ if ( (x>(0xffffffff/n)) || ( x==(x*n) ) ) // stop if x != relyable anymore
+ break;
+ fac *= i; // making it (i+1)!
+ }
+ return ret;
}
long double
expl(long double n) //Another beautiful Taylor polynomial
{
- long double ret = 1;
- long double x = n;
- unsigned int fac = 1, i = 2;
- for (; (fac<0xffffffff) ;i++) // stop if i is insane high
- {
- ret += x/i; // ret += (x^i)/(i!)
- if ( (x>(0xffffffff/n)) || ( x==(x*n) ) ) // stop if x != relyable anymore
- break;
- fac *= i; // making it (i+1)!
- }
- return ret;
+ long double ret = 1;
+ long double x = n;
+ unsigned int fac = 1, i = 2;
+ for (; (fac<0xffffffff) ;i++) // stop if i is insane high
+ {
+ ret += x/i; // ret += (x^i)/(i!)
+ if ( (x>(0xffffffff/n)) || ( x==(x*n) ) ) // stop if x != relyable anymore
+ break;
+ fac *= i; // making it (i+1)!
+ }
+ return ret;
}
double
ln(double x)
{
- if (x < 0)
- return -1; // e^x will never be less than 0
- double ret = x,
- tmp = -x;
- unsigned int i = 1;
- x--; // actualy we calculate ln (1 + x)
- for (;i<0xffffffff;i++)
- {
- ret += tmp/i;
- if ( tmp==(tmp*-x) || ( (tmp>0)?(tmp*-xtmp) ) ) // stop if tmp != relyable anymore
- break;
- tmp*=-x;
- }
- return ret;
+ if (x < 0)
+ return -1; // e^x will never be less than 0
+ double ret = x,
+ tmp = -x;
+ unsigned int i = 1;
+ x--; // actualy we calculate ln (1 + x)
+ for (;i<0xffffffff;i++)
+ {
+ ret += tmp/i;
+ if ( tmp==(tmp*-x) || ( (tmp>0)?(tmp*-xtmp) ) ) // stop if tmp != relyable anymore
+ break;
+ tmp*=-x;
+ }
+ return ret;
}
float
lnf(float x)
{
- if (x < 0)
- return -1; // e^x will never be less than 0
- float ret = x,
- tmp = -x;
- unsigned int i = 1;
- x--; // actualy we calculate ln (1 + x)
- for (;i<0xffffffff;i++)
- {
- ret += tmp/i;
- if ( tmp==(tmp*-x) || ( (tmp>0)?(tmp*-xtmp) ) ) // stop if tmp != relyable anymore
- break;
- tmp*=-x;
- }
- return ret;
+ if (x < 0)
+ return -1; // e^x will never be less than 0
+ float ret = x,
+ tmp = -x;
+ unsigned int i = 1;
+ x--; // actualy we calculate ln (1 + x)
+ for (;i<0xffffffff;i++)
+ {
+ ret += tmp/i;
+ if ( tmp==(tmp*-x) || ( (tmp>0)?(tmp*-xtmp) ) ) // stop if tmp != relyable anymore
+ break;
+ tmp*=-x;
+ }
+ return ret;
}
long double
lnl(long double x)
{
- if (x < 0)
- return -1; // e^x will never be less than 0
- long double ret = x,
- tmp = -x;
- unsigned int i = 1;
- x--; // actualy we calculate ln (1 + x)
- for (;i<0xffffffff;i++)
- {
- ret += tmp/i;
- if ( tmp==(tmp*-x) || ( (tmp>0)?(tmp*-xtmp) ) ) // stop if tmp != relyable anymore
- break;
- tmp*=-x;
- }
- return ret;
+ if (x < 0)
+ return -1; // e^x will never be less than 0
+ long double ret = x,
+ tmp = -x;
+ unsigned int i = 1;
+ x--; // actualy we calculate ln (1 + x)
+ for (;i<0xffffffff;i++)
+ {
+ ret += tmp/i;
+ if ( tmp==(tmp*-x) || ( (tmp>0)?(tmp*-xtmp) ) ) // stop if tmp != relyable anymore
+ break;
+ tmp*=-x;
+ }
+ return ret;
}
double
sqrt(double x)
{
- return exp(2*ln(x));
+ return exp(2*ln(x));
}
float
sqrtf(float x)
{
- return expf(2*ln(x));
+ return expf(2*ln(x));
}
long double
sqrtl(long double x)
{
- return expl(2*ln(x));
+ return expl(2*ln(x));
}
double
pow(double x, double exponent)
{
- double ret = 1;
- for (;exponent>=1;exponent--)
- {
- ret *= x;
- }
- if (exponent!=0) // i.a.w.: if exp was not a integer
- ret *= exp(ln(x)*exponent);
- return ret;
+ double ret = 1;
+ for (;exponent>=1;exponent--)
+ {
+ ret *= x;
+ }
+ if (exponent!=0) // i.a.w.: if exp was not a integer
+ ret *= exp(ln(x)*exponent);
+ return ret;
}
float
powf(float x, float exponent)
{
- float ret = 1;
- for (;exponent>=1;exponent--)
- {
- ret *= x;
- }
- if (exponent!=0) // i.a.w.: if exp was not a integer
- ret *= exp(ln(x)*exponent);
- return ret;
+ float ret = 1;
+ for (;exponent>=1;exponent--)
+ {
+ ret *= x;
+ }
+ if (exponent!=0) // i.a.w.: if exp was not a integer
+ ret *= exp(ln(x)*exponent);
+ return ret;
}
long double
powl(long double x, long double exponent)
{
- long double ret = 1;
- for (;exponent>=1;exponent--)
- {
- ret *= x;
- }
- if (exponent!=0) // i.a.w.: if exp was not a integer
- ret *= exp(ln(x)*exponent);
- return ret;
+ long double ret = 1;
+ for (;exponent>=1;exponent--)
+ {
+ ret *= x;
+ }
+ if (exponent!=0) // i.a.w.: if exp was not a integer
+ ret *= exp(ln(x)*exponent);
+ return ret;
}
int log2i(int x)
diff --git a/src/mm/paging/page_alloc/page_alloc_init.c b/src/mm/paging/page_alloc/page_alloc_init.c
index 0a0c6392..01212bc8 100644
--- a/src/mm/paging/page_alloc/page_alloc_init.c
+++ b/src/mm/paging/page_alloc/page_alloc_init.c
@@ -43,15 +43,15 @@ int mboot_parse(multiboot_memory_map_t* map, int map_size)
/* Pointer to the mboot list entry */
multiboot_memory_map_t* mmap = map;
- int i = 0;
+ int i = 0;
/* While not outside of the mboot list */
while((addr_t)mmap < (addr_t)map + map_size)
{
- i++;
+ i++;
#ifdef PA_DBG
printf( "Entry: %i\taddr: %X.%X\tsize: %X\ttype: %X\n",
- (int)i,
- (int)(mmap->addr >> 32),
+ (int)i,
+ (int)(mmap->addr >> 32),
(int)mmap->addr,
(int)mmap->len,
(int)mmap->type
diff --git a/src/mm/slob/alloc.c b/src/mm/slob/alloc.c
index 3128aba9..71f12d10 100644
--- a/src/mm/slob/alloc.c
+++ b/src/mm/slob/alloc.c
@@ -54,19 +54,19 @@ volatile mutex_t prot = mutex_unlocked;
void
examine_heap()
{
- printf("Head\t0x%X\n", (int) heap);
- if (heap == NULL)
- return;
- volatile memory_node_t* carriage;
- for (carriage = heap; carriage != NULL; carriage = carriage->next)
- {
+ printf("Head\t0x%X\n", (int) heap);
+ if (heap == NULL)
+ return;
+ volatile memory_node_t* carriage;
+ for (carriage = heap; carriage != NULL; carriage = carriage->next)
+ {
printf(
"node: 0x%X\tsize: 0x%X\tnext: 0x%X\n",
(int)carriage,
carriage->size,
(int)carriage->next
);
- }
+ }
}
// This code is called whenever a new block header needs to be created.
@@ -76,33 +76,33 @@ int
initHdr(volatile memory_node_t* block, size_t size)
{
long test = size - sizeof(*block);
- if (test <= ALLOC_MIN)
- return 1;
- block->size = size;
- block->previous = NULL;
- block->next = NULL;
- block->used = FALSE;
- block->hdrMagic = MM_NODE_MAGIC;
- return 0;
+ if (test <= ALLOC_MIN)
+ return 1;
+ block->size = size;
+ block->previous = NULL;
+ block->next = NULL;
+ block->used = FALSE;
+ block->hdrMagic = MM_NODE_MAGIC;
+ return 0;
}
void*
realloc(void* ptr, size_t size)
{
- void* new = alloc(size, FALSE);
- volatile memory_node_t* ptrInfo = ptr - sizeof (memory_node_t);
- size_t currentSize = ptrInfo->size;
- memcpy(new, ptr, (size > currentSize) ? currentSize : size);
- return new;
+ void* new = alloc(size, FALSE);
+ volatile memory_node_t* ptrInfo = ptr - sizeof (memory_node_t);
+ size_t currentSize = ptrInfo->size;
+ memcpy(new, ptr, (size > currentSize) ? currentSize : size);
+ return new;
}
void*
nalloc(size_t size)
{
- void* tmp = alloc(size, FALSE);
- if (tmp != NULL)
- memset(tmp, 0, size);
- return tmp;
+ void* tmp = alloc(size, FALSE);
+ if (tmp != NULL)
+ memset(tmp, 0, size);
+ return tmp;
}
// Finds a block on the heap, which is free and which is large enough.
@@ -117,45 +117,45 @@ alloc(size_t size, uint16_t pageAlligned)
/* Ensure that the block size remains 8 byte aligned */
if ((size + sizeof(memory_node_t)) % 8 != 0)
size += 8 - (size + sizeof(memory_node_t)) % 8;
- if (size > ALLOC_MAX)
- {
- return NULL;
- }
- mutex_lock(&prot);
- volatile memory_node_t* carriage = heap;
- for (; carriage != NULL; carriage = carriage->next)
- {
- if (pageAlligned == TRUE)
- {
- if (!carriage->used)
- {
- /**
- * If the block isn't used and the block should
- * be aligned with the page boundary, the block
- * is called.
- * The code figures out the required offset for
- * the block to be able to hold the desired
- * block.
- */
- addr_t offset = PAGEBOUNDARY - ((addr_t)
- carriage +
- sizeof (memory_node_t))
- % PAGEBOUNDARY;
- offset %= PAGEBOUNDARY;
- addr_t blockSize = offset + size;
-
- if (carriage->size >= blockSize)
- // if the size is large enough to be split into
- // page alligned blocks, then do it.
- {
- volatile memory_node_t* ret = splitMul
- (carriage, size,
- TRUE);
- // Split the block
- use_memnode_block(ret);
- // Mark the block as used
- //return the desired block
- mutex_unlock(&prot);
+ if (size > ALLOC_MAX)
+ {
+ return NULL;
+ }
+ mutex_lock(&prot);
+ volatile memory_node_t* carriage = heap;
+ for (; carriage != NULL; carriage = carriage->next)
+ {
+ if (pageAlligned == TRUE)
+ {
+ if (!carriage->used)
+ {
+ /**
+ * If the block isn't used and the block should
+ * be aligned with the page boundary, the block
+ * is called.
+ * The code figures out the required offset for
+ * the block to be able to hold the desired
+ * block.
+ */
+ addr_t offset = PAGEBOUNDARY - ((addr_t)
+ carriage +
+ sizeof (memory_node_t))
+ % PAGEBOUNDARY;
+ offset %= PAGEBOUNDARY;
+ addr_t blockSize = offset + size;
+
+ if (carriage->size >= blockSize)
+ // if the size is large enough to be split into
+ // page alligned blocks, then do it.
+ {
+ volatile memory_node_t* ret = splitMul
+ (carriage, size,
+ TRUE);
+ // Split the block
+ use_memnode_block(ret);
+ // Mark the block as used
+ //return the desired block
+ mutex_unlock(&prot);
/*
* With vm_range_update, we make sure that the range
* allocator keeps enough range descriptors in its
@@ -164,101 +164,101 @@ alloc(size_t size, uint16_t pageAlligned)
* some range descriptors left to use.
*/
vm_range_update();
- return (void*) ret + sizeof
- (memory_node_t);
- }
- else
- {
- // The block isn't the right size
- //so find another one.
- continue;
- }
- }
- else
- {
-
- /**
- * The block is used, which may be the
- * case in multithreaded environments.
- * This means the other thread isn't
- * done with this block and we need to
- * leave it as is.
- */
- continue;
- }
- }
- else if (carriage->size >= size && carriage->size < size +
- sizeof (memory_node_t))
- {
- if (use_memnode_block(carriage))
- // check the usage of the block
- {
- continue;
- }
- mutex_unlock(&prot);
- /*
- * With vm_range_update, we make sure that the range
- * allocator keeps enough range descriptors in its
- * buffer to satisfy our needs as an object allocator,
- * so that when we run out of memory, there are still
- * some range descriptors left to use.
- */
- vm_range_update();
- return (void*) carriage + sizeof (memory_node_t);
- }
- else if (carriage->size >= size + sizeof (memory_node_t))
- // the block is too large
- {
- if (carriage->used)
- // assert that the block isn't used
- {
- continue;
- }
-
- volatile memory_node_t* tmp = split(carriage, size);
- // split the block
-
- use_memnode_block(tmp);
- mutex_unlock(&prot);
-
- /*
- * With vm_range_update, we make sure that the range
- * allocator keeps enough range descriptors in its
- * buffer to satisfy our needs as an object allocator,
- * so that when we run out of memory, there are still
- * some range descriptors left to use.
- */
- vm_range_update();
- return (void*) tmp + sizeof (memory_node_t);
- }
- if (carriage->next == NULL || carriage->next == carriage)
- {
- /*
- printf("Allocation at end of list!\nblocks: %X\tCarrige"
- ": %X\tsize: %X\n",
- (int) heap, (int) carriage,
- (int) carriage->size);
- */
- if (carriage->next == carriage)
- printf("Loop in list!\n");
- break;
- /**
- * If we haven't found anything but we're at the end of
- * the list or heap corruption occured, we break out of
- * the loop and return the default pointer (which is
- * NULL).
- */
- }
- }
- mutex_unlock(&prot);
- void* new_pages = vm_get_kernel_heap_pages(0x100000);
- if (new_pages == NULL)
- return NULL;
-
- complement_heap(new_pages, 0x100000);
- return alloc(size, pageAlligned);
-
- return NULL;
+ return (void*) ret + sizeof
+ (memory_node_t);
+ }
+ else
+ {
+ // The block isn't the right size
+ //so find another one.
+ continue;
+ }
+ }
+ else
+ {
+
+ /**
+ * The block is used, which may be the
+ * case in multithreaded environments.
+ * This means the other thread isn't
+ * done with this block and we need to
+ * leave it as is.
+ */
+ continue;
+ }
+ }
+ else if (carriage->size >= size && carriage->size < size +
+ sizeof (memory_node_t))
+ {
+ if (use_memnode_block(carriage))
+ // check the usage of the block
+ {
+ continue;
+ }
+ mutex_unlock(&prot);
+ /*
+ * With vm_range_update, we make sure that the range
+ * allocator keeps enough range descriptors in its
+ * buffer to satisfy our needs as an object allocator,
+ * so that when we run out of memory, there are still
+ * some range descriptors left to use.
+ */
+ vm_range_update();
+ return (void*) carriage + sizeof (memory_node_t);
+ }
+ else if (carriage->size >= size + sizeof (memory_node_t))
+ // the block is too large
+ {
+ if (carriage->used)
+ // assert that the block isn't used
+ {
+ continue;
+ }
+
+ volatile memory_node_t* tmp = split(carriage, size);
+ // split the block
+
+ use_memnode_block(tmp);
+ mutex_unlock(&prot);
+
+ /*
+ * With vm_range_update, we make sure that the range
+ * allocator keeps enough range descriptors in its
+ * buffer to satisfy our needs as an object allocator,
+ * so that when we run out of memory, there are still
+ * some range descriptors left to use.
+ */
+ vm_range_update();
+ return (void*) tmp + sizeof (memory_node_t);
+ }
+ if (carriage->next == NULL || carriage->next == carriage)
+ {
+ /*
+ printf("Allocation at end of list!\nblocks: %X\tCarrige"
+ ": %X\tsize: %X\n",
+ (int) heap, (int) carriage,
+ (int) carriage->size);
+ */
+ if (carriage->next == carriage)
+ printf("Loop in list!\n");
+ break;
+ /**
+ * If we haven't found anything but we're at the end of
+ * the list or heap corruption occured, we break out of
+ * the loop and return the default pointer (which is
+ * NULL).
+ */
+ }
+ }
+ mutex_unlock(&prot);
+ void* new_pages = vm_get_kernel_heap_pages(0x100000);
+ if (new_pages == NULL)
+ return NULL;
+
+ complement_heap(new_pages, 0x100000);
+ return alloc(size, pageAlligned);
+
+ return NULL;
}
#pragma GCC diagnostic push
@@ -267,83 +267,83 @@ void
free(void* ptr, size_t size)
{
#ifdef MMTEST
- printf("Free!!!\n");
+ printf("Free!!!\n");
#endif
- if (ptr == NULL)
- return;
- mutex_lock(&prot);
- volatile memory_node_t* block = (void*) ptr - sizeof (memory_node_t);
- volatile memory_node_t* carriage;
- if (block->hdrMagic != MM_NODE_MAGIC)
- {
- mutex_unlock(&prot);
- return;
- }
-
- /**
- * Try to put the block back into the list of free nodes,
- *Actually claim it's free and then merge it into the others if possible.
- * This code is littered with debugging code.
- */
-
- // Debugging code
+ if (ptr == NULL)
+ return;
+ mutex_lock(&prot);
+ volatile memory_node_t* block = (void*) ptr - sizeof (memory_node_t);
+ volatile memory_node_t* carriage;
+ if (block->hdrMagic != MM_NODE_MAGIC)
+ {
+ mutex_unlock(&prot);
+ return;
+ }
+
+ /**
+ * Try to put the block back into the list of free nodes,
+ *Actually claim it's free and then merge it into the others if possible.
+ * This code is littered with debugging code.
+ */
+
+ // Debugging code
#ifdef MMTEST
- printf("Before:\n");
- examineHeap();
- printf("\n");
+ printf("Before:\n");
+ examineHeap();
+ printf("\n");
#endif
- return_memnode_block(block); // actually mark the block unused.
- // more debugging code
+ return_memnode_block(block); // actually mark the block unused.
+ // more debugging code
#ifdef MMTEST
- printf("During:");
- examineHeap();
- printf("\n");
+ printf("During:");
+ examineHeap();
+ printf("\n");
#endif
- // Now find a place for the block to fit into the heap list
- for (carriage = heap; carriage != NULL && carriage->next != carriage &&
- carriage->next != heap; carriage = carriage->next)
- // Loop through the heap list
- {
-
- // if we found the right spot, merge the lot.
- if ((void*) block + block->size + sizeof (memory_node_t) ==
- (void*) carriage
- || (void*) carriage + carriage->size +
- sizeof (memory_node_t) == (void*) block)
- {
- volatile memory_node_t* test = merge_memnode(block, carriage);
- // merging code
- if (test == NULL)
- // if the merge failed
- {
- printf("Merge failed\n");
+ // Now find a place for the block to fit into the heap list
+ for (carriage = heap; carriage != NULL && carriage->next != carriage &&
+ carriage->next != heap; carriage = carriage->next)
+ // Loop through the heap list
+ {
+
+ // if we found the right spot, merge the lot.
+ if ((void*) block + block->size + sizeof (memory_node_t) ==
+ (void*) carriage
+ || (void*) carriage + carriage->size +
+ sizeof (memory_node_t) == (void*) block)
+ {
+ volatile memory_node_t* test = merge_memnode(block, carriage);
+ // merging code
+ if (test == NULL)
+ // if the merge failed
+ {
+ printf("Merge failed\n");
#ifdef MMTEST
- printf("After\n");
- examineHeap();
- printf("\n");
- wait();
+ printf("After\n");
+ examineHeap();
+ printf("\n");
+ wait();
#endif
- continue;
- }
- else
- {
+ continue;
+ }
+ else
+ {
break;
-// block = test;
-// carriage = test->previous;
- /**
- * We can now continue trying to merge the rest
- * of the list, which might be possible.
- */
- }
- }
- }
- // Even more debugging code
+// block = test;
+// carriage = test->previous;
+ /**
+ * We can now continue trying to merge the rest
+ * of the list, which might be possible.
+ */
+ }
+ }
+ }
+ // Even more debugging code
#ifdef MMTEST
- printf("After\n");
- examineHeap();
- printf("\n");
+ printf("After\n");
+ examineHeap();
+ printf("\n");
#endif
- mutex_unlock(&prot);
+ mutex_unlock(&prot);
/*
* With vm_range_update, we make sure that the range
@@ -354,226 +354,226 @@ free(void* ptr, size_t size)
*/
vm_range_update();
- return; // Return success
+ return; // Return success
}
#pragma GCC diagnostic pop
static boolean
use_memnode_block(volatile memory_node_t* x)
{
- // mark the block as used and remove it from the heap list
- if (x->used == FALSE)
- {
- x->used = TRUE;
- if (x->previous != NULL)
- // if we're not at the top of the list
- x->previous->next = x->next;
- // set the previous block to hold the next block
- else
- // if we are at the top of the list, move the top of the
- // list to the next block
- heap = x->next;
- if (x->next != NULL)
- // if we're not at the end of the list
- x->next->previous = x->previous;
- // set the next block to hold the previous block
- else
- x->next->previous = NULL;
- // Over here the block should be removed from the heap lists.
- return FALSE; // return that the block wasn't used.
- }
- else
- return TRUE;
+ // mark the block as used and remove it from the heap list
+ if (x->used == FALSE)
+ {
+ x->used = TRUE;
+ if (x->previous != NULL)
+ // if we're not at the top of the list
+ x->previous->next = x->next;
+ // set the previous block to hold the next block
+ else
+ // if we are at the top of the list, move the top of the
+ // list to the next block
+ heap = x->next;
+ if (x->next != NULL)
+ // if we're not at the end of the list
+ x->next->previous = x->previous;
+ // set the next block to hold the previous block
+ else
+ x->next->previous = NULL;
+ // Over here the block should be removed from the heap lists.
+ return FALSE; // return that the block wasn't used.
+ }
+ else
+ return TRUE;
}
static void
return_memnode_block(volatile memory_node_t* block)
{
- /* This code marks the block as unused and puts it back in the list. */
- if (block->hdrMagic != MM_NODE_MAGIC)
- return; /* Make sure we're not corrupting the
- * heap
- */
- block->used = FALSE;
- volatile memory_node_t* carriage;
- if ((void*) block < (void*) heap)
- {
- /* if we're at the top of the heap list add the block there. */
- heap->previous = block;
- block->next = heap;
- block->previous = NULL;
- heap = block;
- return;
- }
- /* We're apparently not at the top of the list */
- for (carriage = heap; carriage != NULL; carriage = carriage->next)
- // Loop through the heap list.
+ /* This code marks the block as unused and puts it back in the list. */
+ if (block->hdrMagic != MM_NODE_MAGIC)
+ return; /* Make sure we're not corrupting the
+ * heap
+ */
+ block->used = FALSE;
+ volatile memory_node_t* carriage;
+ if ((void*) block < (void*) heap)
+ {
+ /* if we're at the top of the heap list add the block there. */
+ heap->previous = block;
+ block->next = heap;
+ block->previous = NULL;
+ heap = block;
+ return;
+ }
+ /* We're apparently not at the top of the list */
+ for (carriage = heap; carriage != NULL; carriage = carriage->next)
+ // Loop through the heap list.
{
if ((addr_t)carriage < (addr_t)block &&
(addr_t)(carriage->next) > (addr_t)block)
- {
- block->previous = carriage;
- block->next = carriage->next;
- carriage->next = block;
+ {
+ block->previous = carriage;
+ block->next = carriage->next;
+ carriage->next = block;
block->next->previous = block;
- return;
- }
- if (carriage->next == NULL)
- {
- /* we are at the end of the list, add the block here */
- carriage -> next = block;
- block -> previous = carriage;
- carriage->next->next = NULL;
+ return;
+ }
+ if (carriage->next == NULL)
+ {
+ /* we are at the end of the list, add the block here */
+ carriage -> next = block;
+ block -> previous = carriage;
+ carriage->next->next = NULL;
debug("We're done at %X with block %X of size %X\n",
(int)carriage,
(int)block,
(int)(block->size)
);
- return;
- }
- }
+ return;
+ }
+ }
}
static volatile memory_node_t*
split(volatile memory_node_t* block, size_t size)
{
- /**
- * This code splits the block into two parts, the lower of which is
- * returned to the caller.
- */
- volatile memory_node_t* second = ((void*) block) +
- sizeof (memory_node_t) + size;
-
- if (initHdr(second, block->size - size - sizeof (memory_node_t)))
- return block;
- /* initialise the second block to the right size */
-
- second->previous = block; // fix the heap lists
- second->next = block->next;
- second->next->previous = second;
-
- block->next = second;
- block->size = size;
- block->previous->next = block;
- return block; // return the bottom block
+ /**
+ * This code splits the block into two parts, the lower of which is
+ * returned to the caller.
+ */
+ volatile memory_node_t* second = ((void*) block) +
+ sizeof (memory_node_t) + size;
+
+ if (initHdr(second, block->size - size - sizeof (memory_node_t)))
+ return block;
+ /* initialise the second block to the right size */
+
+ second->previous = block; // fix the heap lists
+ second->next = block->next;
+ second->next->previous = second;
+
+ block->next = second;
+ block->size = size;
+ block->previous->next = block;
+ return block; // return the bottom block
}
static volatile memory_node_t*
splitMul(volatile memory_node_t* block, size_t size, boolean pageAlligned)
{
- // if the block should be pageAlligned
- if (pageAlligned)
- {
- // figure out whether or not the block is at the right place
- if (((addr_t) ((void*) block + sizeof (memory_node_t))) %
- PAGEBOUNDARY == 0)
- {
- // if so we can manage with a simple split
- #ifdef MMTEST
- printf("Simple split\n");
- #endif
- /* If this block gets reached the block is at the offset
- * in memory.*/
- return split(block, size);
- }
- else if ((addr_t) ((void*) block + sizeof (memory_node_t)) %
- PAGEBOUNDARY != 0)
- {
- // if not we must do a bit more complex
- #ifdef MMTEST
- printf("Complex split\n");
- #endif
- /**
- * If we get here, the base address of the block isn't
- * alligned with the offset. Split the block and then
- * use split on the higher block so the middle is page
- * alligned.
- * Below we figure out where the second block should
- * start using some algorithms of which it isn't a
- * shame if a beginner doesn't fully get it.
- */
- addr_t secondAddr;
- addr_t base = (unsigned int) ((void*) block + 2 *
- sizeof (memory_node_t)); /* base address */
-
- addr_t offset = PAGEBOUNDARY - (base % PAGEBOUNDARY);
- /* the addrress is used to figure out the offset to the
- * page boundary */
- secondAddr = (addr_t) ((void*) block + sizeof
- (memory_node_t));
- /* put the base address into second */
-
- secondAddr += offset; /* add the offset to second */
- volatile memory_node_t* second = (void*) secondAddr;
- volatile memory_node_t* next = block->next;
- /* Temporarilly store next */
-
- int secondSize = block->size - ((void*) second -
- (void*) block);
- initHdr(second, secondSize);
- /* init the second block with the temp size */
- block->size = (void*) second - ((void*) block + sizeof
- (memory_node_t));
- block->next = second;
- /* fix the heap lists to make a split or return
- * possible */
- second->previous = block;
- second->next = next;
- if (second->size > size + sizeof (memory_node_t))
- {
- volatile memory_node_t *ret =
- split(second, size);
- return ret; /* if the second block still is too
- large do a normal split because this will return
- the right address anyways. */
- }
- else
- {
- return second;
- /* the size is right and at the right address,
- what more could we want. */
- }
- }
- }
- else
- /**
- * here we can just do a normal block split because there is no
- * address requirement.
- */
- return split(block, size);
- return NULL;
+ // if the block should be pageAlligned
+ if (pageAlligned)
+ {
+ // figure out whether or not the block is at the right place
+ if (((addr_t) ((void*) block + sizeof (memory_node_t))) %
+ PAGEBOUNDARY == 0)
+ {
+ // if so we can manage with a simple split
+ #ifdef MMTEST
+ printf("Simple split\n");
+ #endif
+ /* If this block gets reached the block is at the offset
+ * in memory.*/
+ return split(block, size);
+ }
+ else if ((addr_t) ((void*) block + sizeof (memory_node_t)) %
+ PAGEBOUNDARY != 0)
+ {
+ // if not we must do a bit more complex
+ #ifdef MMTEST
+ printf("Complex split\n");
+ #endif
+ /**
+ * If we get here, the base address of the block isn't
+ * alligned with the offset. Split the block and then
+ * use split on the higher block so the middle is page
+ * alligned.
+ * Below we figure out where the second block should
+ * start using some algorithms of which it isn't a
+ * shame if a beginner doesn't fully get it.
+ */
+ addr_t secondAddr;
+ addr_t base = (unsigned int) ((void*) block + 2 *
+ sizeof (memory_node_t)); /* base address */
+
+ addr_t offset = PAGEBOUNDARY - (base % PAGEBOUNDARY);
+ /* the addrress is used to figure out the offset to the
+ * page boundary */
+ secondAddr = (addr_t) ((void*) block + sizeof
+ (memory_node_t));
+ /* put the base address into second */
+
+ secondAddr += offset; /* add the offset to second */
+ volatile memory_node_t* second = (void*) secondAddr;
+ volatile memory_node_t* next = block->next;
+ /* Temporarilly store next */
+
+ int secondSize = block->size - ((void*) second -
+ (void*) block);
+ initHdr(second, secondSize);
+ /* init the second block with the temp size */
+ block->size = (void*) second - ((void*) block + sizeof
+ (memory_node_t));
+ block->next = second;
+ /* fix the heap lists to make a split or return
+ * possible */
+ second->previous = block;
+ second->next = next;
+ if (second->size > size + sizeof (memory_node_t))
+ {
+ volatile memory_node_t *ret =
+ split(second, size);
+ return ret; /* if the second block still is too
+ large do a normal split because this will return
+ the right address anyways. */
+ }
+ else
+ {
+ return second;
+ /* the size is right and at the right address,
+ what more could we want. */
+ }
+ }
+ }
+ else
+ /**
+ * here we can just do a normal block split because there is no
+ * address requirement.
+ */
+ return split(block, size);
+ return NULL;
}
static volatile memory_node_t*
merge_memnode(volatile memory_node_t* alpha, volatile memory_node_t* beta)
{
- // First we check for possible corruption
- if (alpha->hdrMagic != MM_NODE_MAGIC || beta->hdrMagic != MM_NODE_MAGIC)
- {
+ // First we check for possible corruption
+ if (alpha->hdrMagic != MM_NODE_MAGIC || beta->hdrMagic != MM_NODE_MAGIC)
+ {
#ifdef MMTEST
- printf("HDR error\n");
- // debugging code
+ printf("HDR error\n");
+ // debugging code
#endif
- return NULL; // return error
- }
- if ((((void*) alpha) + alpha->size + sizeof (memory_node_t) != beta) &&
- (((void*) beta) + beta->size + sizeof (memory_node_t) != alpha))
- // if the pointers don't match, we should not proceed.
- return NULL;
- // return error
- volatile memory_node_t* tmp;
- if (((void*) beta) + beta->size + sizeof (memory_node_t) == alpha)
- {
- // if the blocks are in reversed order, put them in the
- // right order
+ return NULL; // return error
+ }
+ if ((((void*) alpha) + alpha->size + sizeof (memory_node_t) != beta) &&
+ (((void*) beta) + beta->size + sizeof (memory_node_t) != alpha))
+ // if the pointers don't match, we should not proceed.
+ return NULL;
+ // return error
+ volatile memory_node_t* tmp;
+ if (((void*) beta) + beta->size + sizeof (memory_node_t) == alpha)
+ {
+ // if the blocks are in reversed order, put them in the
+ // right order
tmp = alpha;
alpha = beta;
beta = tmp;
- }
+ }
- alpha->size += beta->size + sizeof (memory_node_t);
- alpha->next = beta->next;
- alpha->used = FALSE;
+ alpha->size += beta->size + sizeof (memory_node_t);
+ alpha->next = beta->next;
+ alpha->used = FALSE;
- return alpha;
+ return alpha;
}
diff --git a/src/mm/slob/heap.c b/src/mm/slob/heap.c
index a6cd246c..33463e6d 100644
--- a/src/mm/slob/heap.c
+++ b/src/mm/slob/heap.c
@@ -55,13 +55,13 @@
int
heap_inset_block(volatile memory_node_t* heap_l, volatile memory_node_t *block)
{
- if (heap_l == NULL || block == NULL)
- return -E_HEAP_GENERIC;
+ if (heap_l == NULL || block == NULL)
+ return -E_HEAP_GENERIC;
- addr_t block_address = (addr_t) block;
+ addr_t block_address = (addr_t) block;
- volatile memory_node_t *carriage = heap_l;
- volatile memory_node_t *last = NULL;
+ volatile memory_node_t *carriage = heap_l;
+ volatile memory_node_t *last = NULL;
if ((addr_t)heap_l >= block_address)
{
@@ -78,15 +78,15 @@ heap_inset_block(volatile memory_node_t* heap_l, volatile memory_node_t *block)
last = carriage;
carriage = carriage->next;
}
- if (last == NULL)
- return -E_HEAP_GENERIC;
-
- block->next = last->next;
- block->previous = last;
- last->next = block;
- if (block->next != NULL)
- block->next->previous = block;
- return -E_SUCCESS;
+ if (last == NULL)
+ return -E_HEAP_GENERIC;
+
+ block->next = last->next;
+ block->previous = last;
+ last->next = block;
+ if (block->next != NULL)
+ block->next->previous = block;
+ return -E_SUCCESS;
}
/**
@@ -96,21 +96,21 @@ heap_inset_block(volatile memory_node_t* heap_l, volatile memory_node_t *block)
void
heap_add_blocks(void* base, uint32_t size)
{
- volatile memory_node_t* node = (memory_node_t*) base;
- initHdr(node, size - sizeof (memory_node_t));
- if (heap == NULL)
- {
- mutex_lock(&prot);
- heap = node;
- mutex_unlock(&prot);
- }
- else
- {
- mutex_lock(&prot);
- if (heap_inset_block(heap, node) != -E_SUCCESS)
- panic("Could not add blocks to map");
- mutex_unlock(&prot);
- }
+ volatile memory_node_t* node = (memory_node_t*) base;
+ initHdr(node, size - sizeof (memory_node_t));
+ if (heap == NULL)
+ {
+ mutex_lock(&prot);
+ heap = node;
+ mutex_unlock(&prot);
+ }
+ else
+ {
+ mutex_lock(&prot);
+ if (heap_inset_block(heap, node) != -E_SUCCESS)
+ panic("Could not add blocks to map");
+ mutex_unlock(&prot);
+ }
}
int slob_sys_register()
diff --git a/src/mm/test.c b/src/mm/test.c
index ab0550c4..b548af7e 100644
--- a/src/mm/test.c
+++ b/src/mm/test.c
@@ -27,44 +27,44 @@ extern unsigned int end;
void testMMap(multiboot_info_t* hdr)
{
- if (hdr->flags && MULTIBOOT_INFO_MEM_MAP)
- {
- printf ("mmap_addr = 0x%x\n", (unsigned int)hdr->mmap_addr);
- printf(", mmap_length = 0x%x\n", (unsigned int)hdr->mmap_length);
- for (mmap = (multiboot_memory_map_t *) hdr->mmap_addr;
- (unsigned long) mmap < hdr->mmap_addr + hdr->mmap_length;
- mmap = (multiboot_memory_map_t *) ((unsigned long) mmap
+ if (hdr->flags && MULTIBOOT_INFO_MEM_MAP)
+ {
+ printf ("mmap_addr = 0x%x\n", (unsigned int)hdr->mmap_addr);
+ printf(", mmap_length = 0x%x\n", (unsigned int)hdr->mmap_length);
+ for (mmap = (multiboot_memory_map_t *) hdr->mmap_addr;
+ (unsigned long) mmap < hdr->mmap_addr + hdr->mmap_length;
+ mmap = (multiboot_memory_map_t *) ((unsigned long) mmap
+ mmap->size + sizeof (mmap->size)))
- {
- printf (" size = 0x%x, base_addr = 0x%x%x length"
- "= 0x%x%x, type = 0x%x\n",
- (int)mmap->size,
- mmap->addr>>32,
- mmap->addr & 0xFFFFFFFF,
- mmap->len >> 32,
- mmap->len&0xFFFFFFFF,
- mmap->type);
- }
- printf("End pointer = %x\n",(int)&end);
- }
-
- if (hdr->flags && MULTIBOOT_INFO_MODS)
- {
- int mods = hdr->mods_count;
- multiboot_module_t* mbootModules = (multiboot_module_t*)hdr->mods_addr;
- printf("No. modules: %x\n",mods);
- int i = 0;
- for (; i < mods; i++)
- {
- printf("Base addr = %x\n",mbootModules[i].mod_start);
- printf("End addr = %x\n",mbootModules[i].mod_end);
- printf("CMD line = %s\n",(char*)mbootModules[i].cmdline);
- }
- }
- else
- {
- printf("No modules found!\n");
- }
+ {
+ printf (" size = 0x%x, base_addr = 0x%x%x length"
+ "= 0x%x%x, type = 0x%x\n",
+ (int)mmap->size,
+ mmap->addr>>32,
+ mmap->addr & 0xFFFFFFFF,
+ mmap->len >> 32,
+ mmap->len&0xFFFFFFFF,
+ mmap->type);
+ }
+ printf("End pointer = %x\n",(int)&end);
+ }
+
+ if (hdr->flags && MULTIBOOT_INFO_MODS)
+ {
+ int mods = hdr->mods_count;
+ multiboot_module_t* mbootModules = (multiboot_module_t*)hdr->mods_addr;
+ printf("No. modules: %x\n",mods);
+ int i = 0;
+ for (; i < mods; i++)
+ {
+ printf("Base addr = %x\n",mbootModules[i].mod_start);
+ printf("End addr = %x\n",mbootModules[i].mod_end);
+ printf("CMD line = %s\n",(char*)mbootModules[i].cmdline);
+ }
+ }
+ else
+ {
+ printf("No modules found!\n");
+ }
}
#endif
@@ -73,11 +73,11 @@ void testMMap(multiboot_info_t* hdr)
struct small
{
- int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
+ int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
};
struct large
{
- int a[1024];
+ int a[1024];
};
typedef struct small small_t;
@@ -85,49 +85,49 @@ typedef struct large large_t;
void wait()
{
- int i;
- for (i = 0; i < 0x1FFFFFFF; i++)
- {
- }
+ int i;
+ for (i = 0; i < 0x1FFFFFFF; i++)
+ {
+ }
}
void testAlloc()
{
- printf("Heap test suite!\n\n");
- large_t* a = alloc(sizeof(large_t), FALSE);
- printf("Addr of A: %x\n",(int)a);
- large_t* b = alloc(sizeof(large_t), TRUE);
- printf("Addr of B: %x\n",(int)a);
+ printf("Heap test suite!\n\n");
+ large_t* a = alloc(sizeof(large_t), FALSE);
+ printf("Addr of A: %x\n",(int)a);
+ large_t* b = alloc(sizeof(large_t), TRUE);
+ printf("Addr of B: %x\n",(int)a);
- small_t* c = alloc(sizeof(small_t), FALSE);
- printf("Addr of C: %x\n",(int)a);
- small_t* d = alloc(sizeof(small_t), TRUE);
- printf("Addr of D: %x\n",(int)a);
+ small_t* c = alloc(sizeof(small_t), FALSE);
+ printf("Addr of C: %x\n",(int)a);
+ small_t* d = alloc(sizeof(small_t), TRUE);
+ printf("Addr of D: %x\n",(int)a);
- examineHeap();
- wait();
+ examineHeap();
+ wait();
- free(a);
- free(c);
+ free(a);
+ free(c);
- examineHeap();
- wait();
+ examineHeap();
+ wait();
- a = alloc(sizeof(large_t), TRUE);
- printf("Addr of A: %x\n",(int)a);
- c = alloc(sizeof(small_t), TRUE);
- printf("Addr of C: %x\n",(int)a);
+ a = alloc(sizeof(large_t), TRUE);
+ printf("Addr of A: %x\n",(int)a);
+ c = alloc(sizeof(small_t), TRUE);
+ printf("Addr of C: %x\n",(int)a);
- examineHeap();
- wait();
+ examineHeap();
+ wait();
- free(a);
- free(b);
- free(c);
- free(d);
+ free(a);
+ free(b);
+ free(c);
+ free(d);
- examineHeap();
- wait();
+ examineHeap();
+ wait();
}
#endif
diff --git a/src/net/netlayer.c b/src/net/netlayer.c
index 180d8d40..2ad01328 100644
--- a/src/net/netlayer.c
+++ b/src/net/netlayer.c
@@ -23,4 +23,4 @@
void netif_netlayer_init()
{
netif_init_ip();
-}
\ No newline at end of file
+}