Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / qemu-palcode / util.c
1 /* Utility functions for the QEMU PALcode.
2
3    Copyright (C) 2011 Richard Henderson
4
5    This file is part of QEMU PALcode.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the text
15    of the GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; see the file COPYING.  If not see
19    <http://www.gnu.org/licenses/>.  */
20
21 #include "protos.h"
22
23
24 void
25 ndelay(unsigned long nsec)
26 {
27   unsigned long target, now;
28
29   /* ??? Fix race between setting an alarm and waiting for an interrupt,
30      so that we can use wtint here.  This isn't used much except for 
31      during startup, so it probably doesn't matter much.  */
32
33   now = get_wall_time();
34   target = now + nsec;
35
36   do
37     now = get_wall_time();
38   while (now < target);
39 }