OSDN Git Service

2009-04-08 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-osinte-tru64.adb
index 1d40fca..88cc2fd 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
---         Copyright (C) 1998-2005, Free Software Foundation, Inc.          --
+--         Copyright (C) 1998-2007, Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNARL is free software; you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -73,8 +73,9 @@ package body System.OS_Interface is
    begin
       Asm ("call_pal 0x9e" & ASCII.LF & ASCII.HT &
            "bis $31, $0, %0",
-           Outputs => pthread_t'Asm_Output ("=r", Self),
-           Clobber => "$0");
+           Outputs  => pthread_t'Asm_Output ("=r", Self),
+           Clobber  => "$0",
+           Volatile => True);
       return Self;
    end pthread_self;
 
@@ -82,7 +83,7 @@ package body System.OS_Interface is
    -- Hide_Yellow_Zone --
    ----------------------
 
-   procedure Hide_Yellow_Zone is
+   procedure Hide_Unhide_Yellow_Zone (Hide : Boolean) is
       type Teb_Ptr is access all pthread_teb_t;
       Teb : Teb_Ptr;
       Res : Interfaces.C.int;
@@ -93,15 +94,20 @@ package body System.OS_Interface is
 
       Asm ("call_pal 0x9e" & ASCII.LF & ASCII.HT &
            "bis $31, $0, %0",
-           Outputs => Teb_Ptr'Asm_Output ("=r", Teb),
-           Clobber => "$0");
+           Outputs  => Teb_Ptr'Asm_Output ("=r", Teb),
+           Clobber  => "$0",
+           Volatile => True);
 
       --  Stick a guard page right above the Yellow Zone if it exists
 
       if Teb.all.stack_yellow /= Teb.all.stack_guard then
-         Res := mprotect (Teb.all.stack_yellow, Get_Page_Size, PROT_ON);
+         if Hide then
+            Res := mprotect (Teb.all.stack_yellow, Get_Page_Size, PROT_ON);
+         else
+            Res := mprotect (Teb.all.stack_yellow, Get_Page_Size, PROT_OFF);
+         end if;
       end if;
-   end Hide_Yellow_Zone;
+   end Hide_Unhide_Yellow_Zone;
 
    -----------------
    -- To_Duration --
@@ -112,11 +118,6 @@ package body System.OS_Interface is
       return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
    end To_Duration;
 
-   function To_Duration (TV : struct_timeval) return Duration is
-   begin
-      return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
-   end To_Duration;
-
    -----------------
    -- To_Timespec --
    -----------------
@@ -141,30 +142,4 @@ package body System.OS_Interface is
                        tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
    end To_Timespec;
 
-   ----------------
-   -- To_Timeval --
-   ----------------
-
-   function To_Timeval (D : Duration) return struct_timeval is
-      S : time_t;
-      F : Duration;
-
-   begin
-      S := time_t (Long_Long_Integer (D));
-      F := D - Duration (S);
-
-      --  If F has negative value due to a round-up, adjust for positive F
-      --  value.
-
-      if F < 0.0 then
-         S := S - 1;
-         F := F + 1.0;
-      end if;
-
-      return
-        struct_timeval'
-          (tv_sec => S,
-           tv_usec => time_t (Long_Long_Integer (F * 10#1#E6)));
-   end To_Timeval;
-
 end System.OS_Interface;