summaryrefslogtreecommitdiffstats
path: root/qemu/roms/openbios/forth/util/apic.fs
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@intel.com>2015-08-28 09:58:54 +0800
committerYang Zhang <yang.z.zhang@intel.com>2015-09-01 12:44:00 +0800
commite44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch)
tree66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/openbios/forth/util/apic.fs
parent9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff)
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5 Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/openbios/forth/util/apic.fs')
-rw-r--r--qemu/roms/openbios/forth/util/apic.fs62
1 files changed, 62 insertions, 0 deletions
diff --git a/qemu/roms/openbios/forth/util/apic.fs b/qemu/roms/openbios/forth/util/apic.fs
new file mode 100644
index 000000000..82a62aa7b
--- /dev/null
+++ b/qemu/roms/openbios/forth/util/apic.fs
@@ -0,0 +1,62 @@
+\
+\ ioapic and local apic tester
+\
+\ Copyright (C) 2003 Stefan Reinauer
+\
+\ See the file "COPYING" for further information about
+\ the copyright and warranty status of this work.
+\
+
+hex
+
+fee00000 constant lapic_base
+fec00000 constant ioapic_base
+
+: read_lapic ( regoffset -- value )
+ lapic_base + l@
+ ;
+
+: write_lapic ( value regoffset -- )
+ lapic_base + l!
+ ;
+
+: read_ioapic ( regoffset -- low_value high_value )
+ 2* 10 + dup
+ ioapic_base l! ioapic_base 4 cells + l@
+ swap 1+
+ ioapic_base l! ioapic_base 4 cells + l@
+ ;
+
+: write_ioapic ( low high regoffset -- )
+ 2* 10 + dup ( low high offs offs )
+ ioapic_base l! rot ioapic_base 4 cells + l! ( high offs )
+ 1+
+ ioapic_base l! ioapic_base 4 cells + l! ( high offs )
+ ;
+
+: test-lapic
+ s" Dumping local apic:" type cr
+ 3f0 0 do
+ i dup ( lapic_base + ) s" 0x" type . s" = 0x" type read_lapic space .
+ i 30 and 0= if cr then
+ 10 +loop
+ cr
+ ;
+
+: test-ioapic
+ s" Dumping io apic:" type cr
+ 17 0 do
+ i dup s" irq=" type . read_ioapic s" = 0x" type . s" ." type .
+ i 1 and 0<> if
+ cr
+ then
+ loop
+ cr
+ ;
+
+: dump-apics
+ test-lapic
+ test-ioapic
+ ;
+
+\ tag: apic test utility