Changeset 20

Show
Ignore:
Timestamp:
06/06/08 00:08:06
Author:
michaelfclarke
Message:

Added kfprintf function and as such also added strlen and variable argument functions. Added a test (extreamly SIMPLE) puts also. Kernel currently prints out the memory address that it has been loaded at.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build.sh

    r19 r20  
    163163        FLAGS="$FLAGS -m32 -Wall -ffreestanding -fstrength-reduce \ 
    164164                               -fomit-frame-pointer -finline-functions \ 
    165                                         -nostdinc -fno-builtin -c -o" 
     165                                        -nostdinc -fno-builtin \ 
     166-I \.\/src\/include\/sys -c -o" 
    166167 
    167168        LINKER="ld" 
     
    217218$RUN 
    218219 
     220INPUT_FILE="\.\/src\/klib\/kstrlen\.c" 
     221OUTPUT_FILE="\.\/bin\/kernel\/kstrlen\.o" 
     222RUN=`echo $COMPILER | sed "s/input/$INPUT_FILE/g"` 
     223RUN=`echo $RUN | sed "s/output/$OUTPUT_FILE/g"` 
     224RUN=`echo $RUN | sed "s/flags/$FLAGS/g"` 
     225$RUN 
     226 
     227INPUT_FILE="\.\/src\/klib\/kprintf\.c" 
     228OUTPUT_FILE="\.\/bin\/kernel\/kprintf.o" 
     229RUN=`echo $COMPILER | sed "s/input/$INPUT_FILE/g"` 
     230RUN=`echo $RUN | sed "s/output/$OUTPUT_FILE/g"` 
     231RUN=`echo $RUN | sed "s/flags/$FLAGS/g"` 
     232$RUN 
     233 
    219234# Link all the files together... 
    220235 
  • trunk/src/include

    • Property svn:mergeinfo set
  • trunk/src/kernel.c

    r17 r20  
    2020 */ 
    2121 
     22#include "stdio.h" 
     23 
     24void puts(char *string); 
     25 
     26extern void start; 
     27 
    2228/* 
    2329 * The bootloader will call main below and then the kernel will execute. 
     
    2935{ 
    3036 
     37        char vid_buffer[2048]; 
     38         
     39        kfprintf(vid_buffer, "Loading MouthOS Kernel..."); 
     40        kfprintf(vid_buffer, "  Kernel located at: %x", &start); 
     41 
     42        puts(vid_buffer); 
     43 
    3144        for ( ;; ) ; 
    3245 
    3346} 
     47 
     48/* NB: The following code WILL be removed. This is here ONLY to test 
     49 * that the kfprintf function was working properly. 
     50 */ 
     51 
     52void 
     53puts(char *string) 
     54{ 
     55 
     56        unsigned char *vidmemptr = (unsigned char *) 0xb8000; 
     57 
     58 
     59        while (*string++ != '\0') { 
     60                *vidmemptr++=*string; 
     61                *vidmemptr++=0xF; 
     62        } 
     63 
     64}