Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .coafile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Default]
bears = SpaceConsistencyBear
files = **/*.c
use_spaces = true
default_actions = SpaceConsistencyBear: ApplyPatchAction
tab_width = 8
16 changes: 8 additions & 8 deletions src/andromeda/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
10 changes: 5 additions & 5 deletions src/arch/x86/kernel/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <i>setup_rtc()</i> has
* to be called to initialise the rtc and make sure it is kept up to date.
*/
Expand All @@ -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.
*/
Expand All @@ -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.
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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.
Expand Down
20 changes: 10 additions & 10 deletions src/arch/x86/mm/gdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions src/drivers/disk/ata.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
136 changes: 68 additions & 68 deletions src/drivers/graphics/VGA.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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++;
}
}
}

/**
Expand Down
Loading