Ignore:
Timestamp:
Aug 24, 2015, 5:08:30 PM (9 years ago)
Author:
guerin
Message:

fix kill/exec

  • introduce physical_memcpy for fat_read
  • don't defer task exec
  • load writable segments in exec syscall
Location:
soft/giet_vm/giet_fat32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_fat32/fat32.c

    r674 r707  
    31743174//   GIET_FAT32_IO_ERROR
    31753175/////////////////////////////////////////////////////////////////////////////////
    3176 int _fat_read( unsigned int fd_id,     // file descriptor index
    3177                void*        buffer,    // destination buffer
    3178                unsigned int count )    // number of bytes to read
     3176int _fat_read( unsigned int fd_id,          // file descriptor index
     3177               paddr_t buffer,              // destination buffer
     3178               unsigned int count,          // number of bytes to read
     3179               unsigned int phys )          // use physical_memcpy
    31793180{
    31803181    // checking FAT initialized
     
    32663267        unsigned char*  source;
    32673268        unsigned int    nbytes;
    3268         unsigned char*  dest = (unsigned char*)buffer + done;
     3269
    32693270        if ( (cluster_id == first_cluster_id) && (cluster_id == last_cluster_id) )
    32703271        {
     
    32893290
    32903291        // move data
    3291         memcpy( dest , source , nbytes );
     3292        if ( !phys )
     3293        {
     3294            void* dest = (void*)(unsigned int)buffer + done;
     3295
     3296            memcpy( dest, source, nbytes );
     3297        }
     3298        else
     3299        {
     3300            unsigned int flags;
     3301            paddr_t pdest = buffer + done;
     3302            paddr_t psource  = _v2p_translate( (unsigned int)source, &flags );
     3303
     3304            _physical_memcpy( pdest, psource, nbytes );
     3305        }
     3306
    32923307        done = done + nbytes;
    32933308    }
     
    42664281    while ( 1 )
    42674282    {
    4268         if ( _fat_read( fd_id, &buf, sizeof(buf) ) != sizeof(buf) )
     4283        if ( _fat_read( fd_id, (unsigned int)&buf, sizeof(buf), 0 ) != sizeof(buf) )
    42694284        {
    42704285            _printf("\n[FAT ERROR] _fat_readdir(): can't read entry\n" );
  • soft/giet_vm/giet_fat32/fat32.h

    r674 r707  
    1212#include "giet_config.h"
    1313#include "kernel_locks.h"
     14#include "mapping_info.h"
    1415
    1516/*************** Partition Boot Sector Format **********************************/
     
    225226
    226227extern int _fat_read( unsigned int fd_id,                  // file descriptor 
    227                       void*        buffer,                 // destination buffer
    228                       unsigned int count );                // number of bytes
     228                      paddr_t buffer,                      // destination buffer
     229                      unsigned int count,                  // number of bytes
     230                      unsigned int phys );                 // use physical_memcpy
    229231
    230232extern int _fat_write( unsigned int fd_id,                 // file descriptor
Note: See TracChangeset for help on using the changeset viewer.