Changeset 573


Ignore:
Timestamp:
Mar 9, 2006, 4:35:00 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Added assembly code for inb() and outb().
  • Print a small message at kernel boot time just to check that the kernel was properly loaded.
Location:
libcaca/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/build-kernel

    r569 r573  
    22
    33##  Kernel-mode libcaca compilation script -- Sam Hocevar <sam@zoy.org>
    4 ##  $Id: build-dos 333 2006-03-07 12:39:34Z sam $
     4##  $Id$
    55
    66set -x
     
    1616            --host i386
    1717
    18 (cd cucul && make)
    19 (cd caca && make)
     18# We need this.
     19make clean
    2020
    21 (cd src && make cacafire-aafire.o)
     21cd cucul && make && cd ..
     22cd caca && make && cd ..
    2223
    23 (cd kernel &&
    24     gcc $CFLAGS -c multiboot.S -o multiboot.o
    25     gcc $CFLAGS $CPPFLAGS -c kernel.c -o kernel.o)
     24cd src && make cacafire-aafire.o && cd ..
     25
     26cd kernel &&
     27    gcc $CFLAGS -c multiboot.S -o multiboot.o &&
     28    gcc $CFLAGS $CPPFLAGS -c kernel.c -o kernel.o &&
     29cd ..
    2630
    2731gcc $LDFLAGS -o src/cacafire kernel/multiboot.o kernel/kernel.o src/cacafire-aafire.o caca/.libs/libcaca.a cucul/.libs/libcucul.a
     
    2933objcopy -O binary src/cacafire cacafire.boot
    3034
     35# For further development: create floppy images using the kernel
     36#gcc -traditional -c -o bootsect.o bootsect.S
     37#ld -Ttext 0x0 -s --oformat binary bootsect.o -o cacafire.img
     38
  • libcaca/trunk/caca/caca_internals.h

    r565 r573  
    2727typedef unsigned char uint8_t;
    2828typedef unsigned short uint16_t;
    29 typedef unsigned int uint32_t;
     29typedef unsigned long int uint32_t;
     30typedef long int intptr_t;
     31typedef long unsigned int uintptr_t;
    3032#endif
    3133
  • libcaca/trunk/cucul/cucul_internals.h

    r571 r573  
    2727typedef unsigned char uint8_t;
    2828typedef unsigned short uint16_t;
    29 typedef unsigned int uint32_t;
     29typedef unsigned long int uint32_t;
     30typedef long int intptr_t;
     31typedef long unsigned int uintptr_t;
    3032#endif
    3133
  • libcaca/trunk/kernel/kernel.c

    r568 r573  
    3030void cmain(unsigned long int magic, unsigned long int addr)
    3131{
     32    static char const text[] = "Booting libcaca kernel...";
     33    char const *ptr = text;
     34    char *video = (char*)0xB8000;
     35
    3236    char *argv[] = { NULL };
    3337    int argc = 0;
     38
     39    /* Print a text message to say hello */
     40    while(*ptr)
     41        *video = *ptr++; video += 2;
     42
     43    /* Launch the main program */
    3444    main(argc, argv);
    3545}
  • libcaca/trunk/kernel/kernel.h

    r568 r573  
    2828#define __BIG_ENDIAN 2
    2929
     30/* Assembly code for outb and inb */
     31extern inline void outb(unsigned char val, unsigned short port);
     32extern inline unsigned char inb(unsigned short port);
     33
     34extern inline void outb(unsigned char val, unsigned short port)
     35{
     36    __asm__ __volatile__ ("outb %b0,%w1" : : "a" (val), "Nd" (port));
     37}
     38
     39extern inline unsigned char inb(unsigned short port)
     40{
     41    unsigned char tmp;
     42    __asm__ __volatile__ ("inb %w1,%0" : "=a" (tmp) : "Nd" (port));
     43    return tmp;
     44}
     45
    3046/* Various typedefs -- some are x86-specific */
    3147#define CUSTOM_INTTYPES
    3248typedef unsigned char uint8_t;
    3349typedef unsigned short uint16_t;
    34 typedef unsigned int uint32_t;
    35 typedef unsigned int uintptr_t;
     50typedef unsigned long int uint32_t;
     51typedef long int intptr_t;
     52typedef long unsigned int uintptr_t;
    3653
    3754typedef unsigned int size_t;
Note: See TracChangeset for help on using the changeset viewer.