Title: | Alpha Developer Support |
Notice: | [email protected], 800-332-4786 |
Moderator: | HYDRA::SYSTEM |
Created: | Mon Jun 06 1994 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3722 |
Total number of notes: | 11359 |
Company Name : Paston Chase - Point 21519 Contact Name : Graham Mann Phone : 44 1603502 061 Fax : 44 1603502072 Email : [email protected] Date/Time in : 4-MAR-1997 10:30:14 Entered by : Nick Hudson SPE center : REO Category : vms OS Version : 6.2 System H/W : Brief Description of Problem: ----------------------------- From: ESSB::ESSB::MRGATE::"ILO::ESSC::dlennon" 4-MAR-1997 09:56:32.71 To: RDGENG::ASAP CC: Subj: POINT No. 21519, Paston Chase From: NAME: ESCTECH@ILO TEL: (822-)6704 ADDR: ILO <dlennon@ESSC@ILO> To: ASAP@RDGENG@MRGATE Hello - POINT Log Number 21519 Company Name Paston Chase Engineers name Graham Mann Telephone Number 44 1603502 061 Fax Number 44 1603502072 E-mail Address [email protected] Operating System, Version OpenVMS, V6.2 Platform Alpha Problem Statement INTEROFFICE MEMORANDUM Date: 03-Mar-1997 06:11pm From: [email protected]@PMDF@INTERNET Dept: Tel No: Subject: System Time Hi, ASAP No: A60265 Alpha AXP, OpenVMS 6.2, and the 'C' compiler. I'm trying to port a piece of Macro 32 code: read_systime current_time ; Get current system time Which I've duplicated as: extern unsigned int EXE$GQ_SYSTIME; union { unsigned int qt[2]; uint64 t_64; } _align(QUADWORD) current_time; main() { unsigned int *qp; qp = &EXE$GQ_SYSTIME; current_time.qt[0] = *qp, current_time.qt[1] = *(qp+1); printf("Time:[%08X,%08X]\n", count,current_time.qt[0],current_time.qt[1]); current_time.t_64 = __PAL_LDQP(qp); printf("Time:[%08X,%08X]\n", count,current_time.qt[0],current_time.qt[1]); } The first part works fine. The idea of the second part was to get the time as one indivisible entity to avoid problems when the least significant integer wraps back to zero. The __PAL_LDQP poduces the following when executed. Time:[6322662C,009B0B73] %SYSTEM-F-OPCDEC, opcode reserved to Digital fault at PC=00030180, PS=0000001B %TRACE-F-TRACEBACK, symbolic stack dump follows Image Name Module Name Routine Name Line Number rel PC abs PC PCB_VALUE PCB_VALUE main 2682 00000180 00030180 PCB_VALUE PCB_VALUE __main 0 00000090 00030090 0 8226C170 8226C170 Is there a better way to get the system time? Do the __PAL builtins have to be run from kernel mode? Regards Graham Mann Paston Chase Please e-mail to [email protected]
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
3265.1 | KZIN::HUDSON | That's what I think | Tue Mar 04 1997 06:41 | 64 | |
From: DEC:.REO.REOVTX::HUDSON "[email protected] - UK Software Partner Engineering 830-4121" 4-MAR-1997 11:40:34.82 To: nm%vbormc::"[email protected]" CC: HUDSON Subj: RE:POINT No. 21519, Paston Chase, get system time Hello Graham Mann The reason you're getting OPCDEC is the LDQP PALcode routine has to be called from kernel mode. But I don't think it's what you want anyway, as LDQP is LoaD Quadword at Physical Address (i.e. reads physical rather than virtual memory). What you need in your program is to get a LDQ instruction, and you can force that as shown in the following code. Since LDQ is atomic, you shouldn't need to take out a lock before reading the clock. So this program can be run by a non-privileged user. Regards Nick Hudson Digital Software Partner Engineering ================================================================================ #include <builtins.h> #include <starlet.h> #include <limits.h> #include <ints.h> #include <stdio.h> extern unsigned int EXE$GQ_SYSTIME; union { unsigned int qt[2]; uint64 t_64; } _align(QUADWORD) current_time; main() { // because of using "*(qi+1)", we tell the compiler that qi is // a pointer to 32bit values unsigned int *qi; // to force "LDQ", we tell compiler that qp is a pointer to // 64 bit values uint64 *qp; qp = (uint64 *)&EXE$GQ_SYSTIME; qi = &EXE$GQ_SYSTIME; current_time.qt[0] = *qi, current_time.qt[1] = *(qi+1); printf("Time:[%08X,%08X]\n", current_time.qt[1],current_time.qt[0]); current_time.t_64 = (uint64 )*qp; printf("Time:[%08X,%08X]\n", current_time.qt[1],current_time.qt[0]); } |