Aspies For Freedom

Full Version: Anyone want to take a peak at Sendla's progress?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here you go:

Code:
/*
*  The Sendla Operating System
*  Copyright 2005, 2006, Motron Software.
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the Free
*  Software Foundation; either version 2 of the License, or (at your option)
*  any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
*  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
*  for more details.
*
*  You should have received a copy of the GNU General Public License along
*  with this program; if not, write to the Free Software Foundation, Inc.,
*  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Sendla OS Main Kernel Functions
*/

#include <system.h>

int strcmp(const char * cs,const char * ct)
{
signed char __res;

while (1) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
break;
}

return __res;
}

/* TODO:
* -rewrite it on asm/hex
* -add optimalization for MMX, 3DNow!, SSE, SSE2
*/
void *memcpy(void *dest, const void *src, int count)
{
    const char *sp = (const char *)src;
    char *dp = (char *)dest;
    for(; count != 0; count--) *dp++ = *sp++;
    return dest;
}

void *memset(void *dest, char val, int count)
{
    char *temp = (char *)dest;
    for( ; count != 0; count--) *temp++ = val;
    return dest;
}

unsigned short *memsetw(unsigned short *dest, unsigned short val, int count)
{
    unsigned short *temp = (unsigned short *)dest;
    for( ; count != 0; count--) *temp++ = val;
    return dest;
}

int strlen(const char *str)
{
    int retval;
    for(retval = 0; *str != '{{mybb-code}}
'; str++) retval++;
    return retval;
}

/* __inline__ this functions!!
*/
__inline__ unsigned char inportb(unsigned short _port)
{
    unsigned char rv;
    __asm__ __volatile__ ("inb %1, %0" : "=a" (rv) : "dN" (_port));
    return rv;
}

__inline__ void outportb(unsigned short _port, unsigned char _data)
{
    __asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
}

void rebootp( void )
{
__asm("reboot:\n"
      "1: \n"
      "inb $0x64,%al\n"
      "testb $0x02,%al\n"
      "jne 1b\n"
      "movw $0x1234,0x472\n"
      "movb $0xfc,%al\n"
      "outb %al,$0x64\n"
      "die: \n"
      "jmp die");
      
return;
}

void killsys( void )
{
cls();
puts("Killing All Processes\nDisabling Drivers\nFinal Checking\n\nThis Computer thanks you for your attention.\nIt is Safe to press the power button\n\n                                          G O O D B Y E !");
__asm("jmp die");
}

/* And Now for the moment you've all been waiting for, MAIN()! Here we must initialize all the kernel stuff, Memory Manager IRQ, IDT etc. and we call a shell to run it all :-D */



void main()
{
    /* It feels safer to initialize the Memory Manager first before the rest
    sma_init();
/* Then we can initialize the Global Descriptors Table [0x8 -> kernel code, 0x10 -> kernel data]
     */
    gdt_install();
    
    /* Next we shall initialize the Interrupts Descriptor Table
     */
    idt_install();
    
    /* If we didn't initialize the video driver we wouldnt see much on the screen ;)
     */
    init_video();
    
    /* Next we will initialize the paging subsystem
     */
    /* init_paging(); */
   /* Then the frames manager Note, this is causing trouble at the moment. */
    /* fm_initialize(); */
    
    /* Then we setup the isrs
     */
    isrs_install();
    
    /* Then we must initialize the 8259A chipset
     */
    irq_install();
    
    /* And then initialize 8253 chipset[timer]
     */
    timer_install();
    
    /* Then we must initialize the keyboard for typing commands
     */
    keyboard_install();
    
    /* Last but not least, we shall enable the interrupts
     */
    __asm__ __volatile__ ("sti");


    /* After all the initilizations we start up on stuff that the user can see, first we clear the screen and draw a box with some text in it */
    cls();
    puts("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ \n");    
    puts("\a\a\aWelcome to Motron Sendla OS Build 2, type \"command\" for a list of commands    \n");
    puts("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ \n");
    /* The last thing we usually do in main() is startup a shell */
    shell();
}


No more than that! lol

lots of missing functions and no makefile so no way to test
Well, all of the functions are made up in system.h and I couldn't put the makefile on the web.  However, you can download the compiled version at http://motron.phpnet.us/sendla/get.php.
Why could you not post system.h and the Makefile?
Dunno, too big.
Reference URL's