Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / slof / fs / logging.fs
1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2008 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
8 \ *
9 \ * Contributors:
10 \ *     IBM Corporation - initial implementation
11 \ ****************************************************************************/
12
13 \ Words to write to nvram log
14
15 defer nvramlog-write-byte
16
17 : .nvramlog-write-byte ( byte -- )
18 #if defined(DISABLE_NVRAM) || defined(RTAS_NVRAM)
19         drop
20 #else
21         0 1 asm-cout
22 #endif
23 ;
24
25 ' .nvramlog-write-byte to nvramlog-write-byte
26
27 : nvramlog-write-string ( str len -- )
28    dup 0> IF
29       0 DO dup c@ 
30       nvramlog-write-byte char+ LOOP
31    ELSE
32       drop
33    THEN drop ;
34
35 : nvramlog-write-number ( number format -- )
36   0 swap <# 0 ?DO # LOOP #> 
37   nvramlog-write-string ;
38
39 : nvramlog-write-string-cr ( str len -- )
40   nvramlog-write-string
41   a nvramlog-write-byte d nvramlog-write-byte ;
42
43 \ as long as dual-emit is enabled
44 \ the string is written into NVRAM as well!!
45 : log-string ( str len -- ) type ;