Exemplo n.º 1
0
void Main(struct Boot_Info *bootInfo) {
    Init_BSS();
    Init_Screen();
    Init_Mem(bootInfo);
    Init_CRC32();
    Init_TSS();

    lockKernel();
    Init_Interrupts(0);
    Init_SMP();
    TODO_P(PROJECT_VIRTUAL_MEMORY_A,
           "initialize virtual memory page tables.");
    Init_Scheduler(0, (void *)KERN_STACK);
    Init_Traps();
    Init_Local_APIC(0);
    Init_Timer();

    Init_Keyboard();
    Init_DMA();
    /* Init_Floppy(); *//* floppy initialization hangs on virtualbox */
    Init_IDE();
    Init_PFAT();
    Init_GFS2();
    Init_GOSFS();
    Init_CFS();
    Init_Alarm();

    Release_SMP();

    /* Initialize Networking */
    Init_Network_Devices();
    Init_ARP_Protocol();
    Init_IP();
    Init_Routing();
    Init_Sockets();
    Init_RIP();
    /* End networking subsystem init */

    /* Initialize Sound */
    Init_Sound_Devices();
    /* End sound init */

    Mount_Root_Filesystem();

    TODO_P(PROJECT_VIRTUAL_MEMORY_A, "initialize page file.");

    Set_Current_Attr(ATTRIB(BLACK, GREEN | BRIGHT));
    Print("Welcome to GeekOS!\n");
    Set_Current_Attr(ATTRIB(BLACK, GRAY));

    TODO_P(PROJECT_SOUND, "play startup sound");

    Spawn_Init_Process();

    /* it's time to shutdown the system */
    Hardware_Shutdown();

    /* we should not get here */
}
Exemplo n.º 2
0
static int GFS2_Disk_Properties(struct Mount_Point *mountPoint,
                                unsigned int *block_size,
                                unsigned int *blocks_in_disk) {
    TODO_P(PROJECT_GFS2,
           "GeekOS filesystem infomation operation; set variables.");
    return EUNSUPPORTED;
}
Exemplo n.º 3
0
int Eth_Dispatch(struct Net_Device *device, struct Net_Buf *nBuf) {
    struct Ethernet_Header header;
    int rc;

    rc = Net_Buf_Extract(nBuf, 0x00, &header, sizeof(header));
    if (rc != 0)
        return rc;

    DEBUG_ETH("Trying to remove the header... \n");

    rc = Net_Buf_Remove(nBuf, 0x00, sizeof(header));
    if (rc != 0) {
        DEBUG_ETH("Failed to remove the header.\n");
        return rc;
    }

    if (ntohs(header.type) <= 1500) {
        /* treat as raw ethernet; this is the largest part of this assignment, approx ten lines. */
        TODO_P(PROJECT_RAW_ETHERNET,
               "awaken a thread waiting for this frame, if any");
        return 0;
    } else {
        struct Ethernet_Dispatch_Entry *curr;
        for (curr = Get_Front_Of_Ethernet_Dispatch_Table(&s_ethDispatchTable);
             curr != NULL && curr->type != ntohs(header.type);
             curr = Get_Next_In_Ethernet_Dispatch_Table(curr));
        if (curr) {
            DEBUG_ETH("Ethernet dispatching packet to %d protocol\n",
                      ntohs(header.type));
            curr->dispatcher(device, nBuf);
            return 0;
        }

        Print("Destroying netbuf in ethernet layer\n");
        Net_Buf_Destroy(nBuf);

        return -1;
    }

}
Exemplo n.º 4
0
int Eth_Transmit(struct Net_Device *device, struct Net_Buf *nBuf,
                 uchar_t * destAddr, ushort_t type) {
    struct Ethernet_Header header;
    int rc;

    KASSERT(Interrupts_Enabled());

    /* all you have to do in this function is fill in the header. */
    TODO_P(PROJECT_RAW_ETHERNET,
           "construct the ethernet header for the destination, this device's address, and the type.");

    rc = Net_Buf_Prepend(nBuf, &header, sizeof(header), NET_BUF_ALLOC_COPY);
    if (rc != 0)
        return rc;

    ulong_t size = MAX(NET_BUF_SIZE(nBuf), ETH_MIN_DATA);       /* buffer size must be at least ETH_MIN_DATA, 
                                                                   even if we don't use it. */

    KASSERT0(size >= ETH_MIN_DATA, "input to Eth_Transmit should be at least ETH_MIN_DATA long");       /* paranoia. */

    void *buffer = Malloc(size);
    if (buffer == 0)
        return ENOMEM;

    rc = Net_Buf_Extract_All(nBuf, buffer);
    if (rc != 0) {
        Free(buffer);
        return rc;
    }

    Disable_Interrupts();
    device->transmit(device, buffer, size);
    Enable_Interrupts();

    return 0;
}
Exemplo n.º 5
0
/*
 * Write data to current position in file.
 */
static int GFS2_Write(struct File *file, void *buf, ulong_t numBytes) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem write operation");
    return EUNSUPPORTED;
}
Exemplo n.º 6
0
/*
 * Open a file named by given path.
 */
static int GFS2_Open(struct Mount_Point *mountPoint, const char *path,
                     int mode, struct File **pFile) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem open operation");
    return EUNSUPPORTED;
}
Exemplo n.º 7
0
void Init_Ethernet() {
    TODO_P(PROJECT_ETHERNET, "initialization");
}
Exemplo n.º 8
0
/*
 * Get information about the running processes
 * Params:
 *   state->ebx - pointer to user memory containing an array of
 *   Process_Info structs
 *   state->ecx - length of the passed in array in memory
 * Returns: -1 on failure
 *          0 if size of user memory too small
 *          N the number of entries in the table, on success
 */
static int Sys_PS(struct Interrupt_State *state) {
  TODO_P(PROJECT_BACKGROUND_JOBS, "Sys_PS system call");
}
Exemplo n.º 9
0
/*
 * Get the time of day.
 * Params:
 *   state - processor registers from user mode
 *
 * Returns: value of the g_numTicks global variable
 */
static int Sys_GetTimeOfDay(struct Interrupt_State *state) {
  TODO_P(PROJECT_SCHEDULING, "GetTimeOfDay system call");
}
Exemplo n.º 10
0
void Free(void *n) {
    TODO_P(PROJECT_MALLOC, "free!");
}
Exemplo n.º 11
0
Arquivo: rip.c Projeto: Foshie/Classes
void Init_RIP(void) {
    TODO_P(PROJECT_RIP,
           "start threads, setup state, set alarm to timeout routes");
}
Exemplo n.º 12
0
/*
 * Create a directory named by given path.
 */
static int GFS2_Create_Directory(struct Mount_Point *mountPoint,
                                 const char *path) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem create directory operation");
    return EUNSUPPORTED;
}
Exemplo n.º 13
0
/*
 * Complete signal handling for this process.
 * Params:
 *   none
 *
 * Returns: 0 on success or error code (< 0) on error
 */
static int Sys_ReturnSignal(struct Interrupt_State *state) {
    TODO_P(PROJECT_SIGNALS, "Sys_ReturnSignal system call");
}
Exemplo n.º 14
0
/*
 * Get metadata for given file.
 */
static int GFS2_FStat(struct File *file, struct VFS_File_Stat *stat) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem FStat operation");
    return 0;
}
Exemplo n.º 15
0
/*
 * Open a directory named by given path.
 */
static int GFS2_Open_Directory(struct Mount_Point *mountPoint,
                               const char *path, struct File **pDir) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem open directory operation");
    return EUNSUPPORTED;
}
Exemplo n.º 16
0
/*
 * Synchronize the filesystem data with the disk
 * (i.e., flush out all buffered filesystem data).
 */
static int GFS2_Sync(struct Mount_Point *mountPoint) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem sync operation");
    return EUNSUPPORTED;
}
Exemplo n.º 17
0
/*
 * Get metadata (size, permissions, etc.) of file named by given path.
 */
static int GFS2_Stat(struct Mount_Point *mountPoint, const char *path,
                     struct VFS_File_Stat *stat) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem stat operation");
    return EUNSUPPORTED;
}
Exemplo n.º 18
0
/*
 * Open a directory named by given path.
 */
static int GFS2_Delete(struct Mount_Point *mountPoint, const char *path) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem delete operation");
    return EUNSUPPORTED;
}
Exemplo n.º 19
0
/*
 * Register the Return_Signal trampoline for this process.
 * Signals cannot be delivered until this is registered.
 * Params:
 *   state->ebx - pointer to Return_Signal function
 *   state->ecx - pointer to the default handler
 *   state->edx - pointer to the ignore handler
 *
 * Returns: 0 on success or error code (< 0) on error
 */
static int Sys_RegDeliver(struct Interrupt_State *state) {
    // TODO("Sys_RegDeliver system call");
    TODO_P(PROJECT_SIGNALS, "Sys_RegDeliver system call");
    return 0;
}
Exemplo n.º 20
0
/*
 * Seek to a position in file.
 */
static int GFS2_Seek(struct File *file, ulong_t pos) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem seek operation");
    return EUNSUPPORTED;
}
Exemplo n.º 21
0
/*
 * Reap a child process that has died
 * Params:
 *   state->ebx - pointer to status of process reaped
 * Returns: pid of reaped process on success, -1 on error.
 */
static int Sys_WaitNoPID(struct Interrupt_State *state) {
  TODO_P(PROJECT_SIGNALS, "Sys_WaitNoPID system call");
}
Exemplo n.º 22
0
/*
 * Close a file.
 */
static int GFS2_Close(struct File *file) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem close operation");
    return EUNSUPPORTED;
}
Exemplo n.º 23
0
void *Malloc(unsigned long n __attribute__ ((unused))) {
    Print("Malloc not implemented in user mode\n");
    return 0;
    TODO_P(PROJECT_MALLOC, "Malloc");
}
Exemplo n.º 24
0
/*
 * Stat operation for an already open directory.
 */
static int GFS2_FStat_Directory(struct File *dir, struct VFS_File_Stat *stat) {
    /* may be unused. */
    TODO_P(PROJECT_GFS2, "GeekOS filesystem FStat directory operation");
    return 0;
}
Exemplo n.º 25
0
/*
 * Directory Close operation.
 */
static int GFS2_Close_Directory(struct File *dir) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem Close directory operation");
    return EUNSUPPORTED;
}
Exemplo n.º 26
0
void Main(struct Boot_Info *bootInfo) {
    Init_BSS();
    Init_Screen();
    Init_Mem(bootInfo);
    Init_CRC32();
    TODO_P(PROJECT_PERCPU, "Initialize PERCPU");
    Init_TSS();

    /* by modifying begin_int_atomic to autolock if not locked when interrupts are disabled, 
       this lockKernel() became duplicative */
    /* lockKernel(); */
    Init_Interrupts(0);
    Print("Init_SMP\n");
    Init_SMP();
    Print("/Init_SMP\n");
    TODO_P(PROJECT_VIRTUAL_MEMORY_A,
           "initialize virtual memory page tables.");
    Init_Scheduler(0, (void *)KERN_STACK);
    Init_Traps();
    Init_Local_APIC(0);
    Init_Timer();

    Init_Keyboard();
    Init_DMA();
    /* Init_Floppy(); *//* floppy initialization hangs on virtualbox */
    Init_IDE();
    Init_PFAT();
    if(Init_GFS2)
        Init_GFS2();
    if(Init_GFS3)
        Init_GFS3();
    Init_GOSFS();
    Init_CFS();
    Init_Alarm();
    Init_Serial();

    Print("the global lock is %sheld.\n",
          Kernel_Is_Locked()? "" : "not ");

    Release_SMP();

    /* Initialize Networking */
    /* 
       Init_Network_Devices();
       Init_ARP_Protocol();
       Init_IP();
       Init_Routing();
       Init_Sockets();
       Init_RIP();
     */
    /* End networking subsystem init */

    /* Initialize Sound */
    Init_Sound_Devices();
    /* End sound init */

    Mount_Root_Filesystem();

    TODO_P(PROJECT_VIRTUAL_MEMORY_A, "initialize page file.");

    Set_Current_Attr(ATTRIB(BLACK, GREEN | BRIGHT));
    Print("Welcome to GeekOS!\n");
    Set_Current_Attr(ATTRIB(BLACK, GRAY));

    TODO_P(PROJECT_SOUND, "play startup sound");

    TODO_P(PROJECT_SERIAL,
           "Initialize the serial console and start the shell.");

    Spawn_Init_Process();

    /* it's time to shutdown the system because Init exited. */
    Hardware_Shutdown();

    /* we should not get here */
}
Exemplo n.º 27
0
/*
 * Set the scheduling policy.
 * Params:
 *   state->ebx - policy,
 *   state->ecx - number of ticks in quantum
 * Returns: 0 if successful, -1 otherwise
 */
static int Sys_SetSchedulingPolicy(struct Interrupt_State *state) {
  TODO_P(PROJECT_SCHEDULING, "SetSchedulingPolicy system call");
}
Exemplo n.º 28
0
/* called by the system call to read raw ethernet.  not really needed except 
   as driver (testing) code. */
int Eth_Receive(struct Net_Device *device, /*@out@ */ struct Net_Buf **nBuf) {
    /* This is the complementary part to the receive path. */
    TODO_P(PROJECT_RAW_ETHERNET,
           "sleep until a frame arrives, ensure that an nBuf is put in the second argument");
}
Exemplo n.º 29
0
/*
 * Limit system call.
 */
static int Sys_Limit(struct Interrupt_State *state) {
    TODO_P(PROJECT_LIMIT_SYSCALLS_SYSCALL, "Need to Implement Sys_Limit");
}
Exemplo n.º 30
0
/*
 * Read a directory entry from an open directory.
 */
static int GFS2_Read_Entry(struct File *dir, struct VFS_Dir_Entry *entry) {
    TODO_P(PROJECT_GFS2, "GeekOS filesystem Read_Entry operation");
    return EUNSUPPORTED;
}