Ignore:
Timestamp:
Jun 18, 2017, 10:06:41 PM (7 years ago)
Author:
alain
Message:

Introduce syscalls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_utls.c

    r1 r23  
    22 * kern/sys_utls.c - User Thread Local Storage
    33 *
    4  * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless
    5  * Copyright (c) 2011,2012 UPMC Sorbonne Universites
     4 * Author    Ghassan Almaless (2008,2009,2010,2011,2012)
     5 *           Alain Greiner (2016,2017)
    66 *
    7  * This file is part of ALMOS-kernel.
     7 * Copyright (c) UPMC Sorbonne Universites
    88 *
    9  * ALMOS-kernel is free software; you can redistribute it and/or modify it
     9 * This file is part of ALMOS-MKH.
     10 *
     11 * ALMOS-MKH is free software; you can redistribute it and/or modify it
    1012 * under the terms of the GNU General Public License as published by
    1113 * the Free Software Foundation; version 2.0 of the License.
    1214 *
    13  * ALMOS-kernel is distributed in the hope that it will be useful, but
     15 * ALMOS-MKH is distributed in the hope that it will be useful, but
    1416 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1517 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     
    1719 *
    1820 * You should have received a copy of the GNU General Public License
    19  * along with ALMOS-kernel; if not, write to the Free Software Foundation,
     21 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
    2022 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    2123 */
    2224
    23 #include <types.h>
     25#include <hal_types.h>
    2426#include <errno.h>
    2527#include <thread.h>
    26 #include <kmem.h>
    27 #include <kmagics.h>
    28 #include <semaphore.h>
     28#include <printk.h>
     29#include <syscalls.h>
    2930
    30 #define UTLS_SET       1
    31 #define UTLS_GET       2
    32 #define UTLS_GET_ERRNO 3
    33 
    34 int sys_utls(uint_t operation, uint_t value)
     31/////////////////////////////////
     32int sys_utls( uint32_t operation,
     33              uint32_t value )
    3534{
    36         struct thread_s *this = current_thread;
     35    thread_t * this = CURRENT_THREAD;
    3736 
    3837        switch(operation)
    3938        {
    40         case UTLS_SET:
    41                 this->info.usr_tls = value;
     39            case UTLS_SET:
     40                this->utls = value;
    4241                return 0;
    4342
    44         case UTLS_GET:
    45                 return this->info.usr_tls;
     43            case UTLS_GET:
     44                return this->utls;
    4645
    47         case UTLS_GET_ERRNO:
    48                 return this->info.errno;
     46            case UTLS_GET_ERRNO:
     47                return this->errno;
    4948
    50         default:
    51                 this->info.errno = EINVAL;
     49            default:
     50        printk("\n[ERROR] in %s : illegal utls operation\n", __FUNCTION__ );
     51                this->errno = EINVAL;
    5252                return -1;
    5353        }
    54 }
     54
     55}  // end sys_utls()
Note: See TracChangeset for help on using the changeset viewer.