Changeset 759 for soft


Ignore:
Timestamp:
Jan 18, 2016, 4:57:13 PM (8 years ago)
Author:
alain
Message:

Introduce 4 new FAT related system calls:

  • giet_fat_pread()
  • giet_fat_fprintf()
  • giet_fat_map()
  • giet_fat_unmap()
Location:
soft/giet_vm/giet_libs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/stdio.c

    r749 r759  
    992992                     (unsigned int)buffer,
    993993                     count,
    994                      0 );      // no physical addressing required
     994                     0 );
     995}
     996
     997///////////////////////////////////////
     998int giet_fat_pread( unsigned int fd_id,     
     999                    void*        buffer,
     1000                    unsigned int count, 
     1001                    unsigned int offset ) 
     1002{
     1003    return sys_call( SYSCALL_FAT_PREAD,
     1004                     fd_id,
     1005                     (unsigned int)buffer,
     1006                     count,
     1007                     offset );
    9951008}
    9961009
     
    10041017                     (unsigned int)buffer,
    10051018                     count,
    1006                      0 );      // no physical addressing required
     1019                     0 );
    10071020}
    10081021
     
    10831096
    10841097    va_start( args, format );
     1098
    10851099    count = xprintf( stream, 4096, format, &args );
    10861100    va_end( args );
    10871101
    1088     if ( count == 0xFFFFFFFF ) giet_pthread_exit("illegal format in giet_fat_fprintf()");
     1102    if ( count == 0xFFFFFFFF ) giet_pthread_exit("error in giet_fat_fprintf()");
    10891103
    10901104    return sys_call( SYSCALL_FAT_WRITE,
     
    10931107                     count,
    10941108                     0 );      // no physical addressing required
     1109}
     1110
     1111/////////////////////////////////////////
     1112void* giet_fat_mmap( void*         vaddr,        // MAP_FIXED not supported
     1113                     unsigned int  length,
     1114                     unsigned int  prot,
     1115                     unsigned int  flags,
     1116                     unsigned int  fd_id,
     1117                     unsigned int  offset )
     1118{
     1119    if ( flags & MAP_FIXED )     giet_pthread_exit("error in giet_fat_mmap()");
     1120    if ( flags & MAP_PRIVATE )   giet_pthread_exit("error in giet_fat_mmap()");
     1121    if ( flags & MAP_ANONYMOUS ) giet_pthread_exit("error in giet_fat_mmap()");
     1122    if ( length & 0xFFF )        giet_pthread_exit("error in giet_fat_mmap()");
     1123    if ( offset & 0xFFF )        giet_pthread_exit("error in giet_fat_mmap()");
     1124
     1125    return (void*)sys_call( SYSCALL_FAT_MMAP,
     1126                            fd_id,
     1127                            length>>12,
     1128                            offset>>12,
     1129                            prot );
    10951130}
    10961131
  • soft/giet_vm/giet_libs/stdio.h

    r743 r759  
    6565#define SYSCALL_FAT_CLOSEDIR         0x2A
    6666#define SYSCALL_FAT_READDIR          0x2B
    67 //                                   0x2C
    68 //                                   0x2D
    69 //                                   0x2E
     67#define SYSCALL_FAT_PREAD            0x2C
     68#define SYSCALL_FAT_MMAP             0x2D
     69#define SYSCALL_FAT_MUNMAP           0x2E
    7070//                                   0x2F
    7171
     
    127127#define THREAD_CMD_RESUME       1
    128128#define THREAD_CMD_CONTEXT      2
     129
     130////////////////////////////////////////////////////////////////////////////
     131// Flags and protection values for the giet_fat_mmap() syscall
     132// These define must be synchronized with values in the sys_handler.h file
     133////////////////////////////////////////////////////////////////////////////
     134
     135#define MAP_ANONYMOUS           0x01
     136#define MAP_FILE                0x02
     137#define MAP_FIXED               0x04
     138#define MAP_PRIVATE             0x08
     139#define MAP_SHARED              0x10
     140
     141#define MAP_PROT_READ           0x1
     142#define MAP_PROT_WRITE          0x2
     143#define MAP_PROT_EXEC           0x4
    129144
    130145////////////////////////////////////////////////////////////////////////////
     
    364379                          unsigned int count );
    365380
     381extern int giet_fat_pread( unsigned int fd_id,
     382                           void*        buffer,
     383                           unsigned int count,
     384                           unsigned int offset );
     385 
    366386extern int giet_fat_write( unsigned int fd,
    367387                           void*        buffer,
     
    389409extern int giet_fat_fprintf( unsigned int  fd_id,
    390410                             char*         format, ... );
     411
     412extern void* giet_fat_mmap( void*         vaddr,
     413                            unsigned int  length,
     414                            unsigned int  prot,
     415                            unsigned int  flags,
     416                            unsigned int  fd_id,
     417                            unsigned int  offset );
     418
     419extern int giet_fat_munmap( void*         vaddr,
     420                            unsigned int  length );
    391421
    392422//////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.