Rémi a écrit 3 commentaires

  • # erreur kernel Valgrind

    Posté par . En réponse au message Créer mini-os unix. Évalué à 0.

    J ai utilise valgind pour voir d ou vient le probleme et voici le resultat

    ==8680== Memcheck, a memory error detector
    ==8680== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
    ==8680== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
    ==8680== Command: ./kernel
    ==8680==
    ==8680== Invalid write of size 1
    ==8680== at 0x103DB9: hide_cursor (screen.c:100)
    ==8680== by 0x103B54: putcar (screen.c:33)
    ==8680== by 0x103097: printk (printk.c:96)
    ==8680== by 0x101C3A: kmain (kernel.c:27)
    ==8680== by 0x100015: ??? (in /home/ubuntu/Shell/kern/kernel)
    ==8680== Address 0xb8501 is not stack'd, malloc'd or (recently) free'd
    ==8680==
    ==8680==
    ==8680== Process terminating with default action of signal 11 (SIGSEGV)
    ==8680== Access not within mapped region at address 0xB8501
    ==8680== at 0x103DB9: hide_cursor (screen.c:100)
    ==8680== by 0x103B54: putcar (screen.c:33)
    ==8680== by 0x103097: printk (printk.c:96)
    ==8680== by 0x101C3A: kmain (kernel.c:27)
    ==8680== by 0x100015: ??? (in /home/ubuntu/Shell/kern/kernel)
    ==8680== If you believe this happened as a result of a stack
    ==8680== overflow in your program's main thread (unlikely but
    ==8680== possible), you can try to increase the size of the
    ==8680== main thread stack using the --main-stacksize= flag.
    ==8680== The main thread stack size used in this run was 8388608.
    ==8680==
    ==8680== HEAP SUMMARY:
    ==8680== in use at exit: 0 bytes in 0 blocks
    ==8680== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
    ==8680==
    ==8680== All heap blocks were freed—no leaks are possible
    ==8680==
    ==8680== For counts of detected and suppressed errors, rerun with: -v
    ==8680== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
    si vous pouvez m aider ca serai sympas
    bonne soiree

  • # OS

    Posté par . En réponse au message Créer mini-os unix. Évalué à 0.

    Il n y a plus personne ?

  • [^] # Re: hide_cursor()

    Posté par . En réponse au message Créer mini-os unix. Évalué à 0.

    J'ai fait comme ceci

    #include "io.h"
    #include "types.h"
    #define __SCREEN__
    #include "screen.h"
    void scrollup(unsigned int n)
    {
     unsigned char *video, *tmp;
     for (video = (unsigned char *) RAMSCREEN;
     video < (unsigned char *) SCREENLIM; video += 2) {
     tmp = (unsigned char *) (video + n * 160);
     if (tmp < (unsigned char *) SCREENLIM) {
     *video = *tmp;
     *(video + 1) = *(tmp + 1);
     } else {
     *video = 0;
     *(video + 1) = 0x07;
     }
     }
     kY -= n;
     if (kY < 0)
     kY = 0;
    }
    void putcar(uchar c)
    {
     unsigned char *video;
     hide_cursor();
     video = (unsigned char *) (RAMSCREEN + 2 * kX + 160 * kY);
     if (c == 10) { /* CR-NL */
     kX = 0;
     kY++;
     } else if (c == 8) { /* BS */
     if (kX) {
     *(video + 1) = 0x0;
     kX--;
     }
     } else if (c == 9) { /* TAB */
     kX = kX + 8 - (kX % 8);
     } else if (c == 13) { /* CR */
     kX = 0;
     } else { /* autres caracteres */
     *video = c;
     *(video + 1) = kattr;
     kX++;
     if (kX > 79) {
     kX = 0;
     kY++;
     }
     }
     if (kY > 24)
     scrollup(kY - 24);
     show_cursor();
    }
    void move_hw_cursor(u8 x, u8 y)
    {
     u16 c_pos;
     c_pos = y * 80 + x;
     outb(0x3d4, 0x0f);
     outb(0x3d5, (u8) c_pos);
     outb(0x3d4, 0x0e);
     outb(0x3d5, (u8) (c_pos >> 8));
    }
    void hide_hw_cursor(void)
    {
     move_hw_cursor(-1, -1);
    }
    void show_cursor()
    {
     unsigned char *video;
     cursorX = kX;
     cursorY = kY;
     video = (unsigned char *) (RAMSCREEN + 2 * cursorX + 160 * cursorY);
     *video = cursorC;
     *(video + 1) = cursorA;
    }
    void hide_cursor(void)
    {
     unsigned char *video;
     cursorX = kX;
     cursorY = kY;
     video = (unsigned char *) (RAMSCREEN + 2 * cursorX + 160 * cursorY);
     *(video + 1) = 0x0;
    }
    
    

    mais il m'affiche toujours Program received signal SIGSEGV, Segmentation fault.
    0x00103dcf in hide_cursor () at screen.c:100
    100 *(video + 1) = 0x0;
    PS : désolé pour la réponse un peu tardive