~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/openbios/forth/util/apic.fs

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
2
\ ioapic and local apic tester
 
3
 
4
\ Copyright (C) 2003 Stefan Reinauer
 
5
 
6
\ See the file "COPYING" for further information about
 
7
\ the copyright and warranty status of this work.
 
8
 
9
 
 
10
hex
 
11
 
 
12
fee00000 constant lapic_base
 
13
fec00000 constant ioapic_base
 
14
 
 
15
: read_lapic ( regoffset -- value )
 
16
  lapic_base + l@
 
17
  ;
 
18
 
 
19
: write_lapic ( value regoffset -- )
 
20
  lapic_base + l!
 
21
  ;
 
22
 
 
23
: read_ioapic ( regoffset -- low_value high_value )
 
24
  2* 10 + dup 
 
25
  ioapic_base l! ioapic_base 4 cells + l@
 
26
  swap 1+ 
 
27
  ioapic_base l! ioapic_base 4 cells + l@
 
28
  ;
 
29
 
 
30
: write_ioapic ( low high regoffset -- )
 
31
  2* 10 + dup                                   ( low high offs offs ) 
 
32
  ioapic_base l! rot ioapic_base 4 cells + l!   ( high offs )
 
33
  1+
 
34
  ioapic_base l! ioapic_base 4 cells + l!       ( high offs )
 
35
  ;
 
36
 
 
37
: test-lapic 
 
38
  s" Dumping local apic:" type cr
 
39
  3f0 0 do
 
40
    i dup ( lapic_base + ) s" 0x" type . s" = 0x" type read_lapic space . 
 
41
    i 30 and 0= if cr then
 
42
  10 +loop
 
43
  cr
 
44
  ;
 
45
 
 
46
: test-ioapic
 
47
  s" Dumping io apic:" type cr
 
48
  17 0 do 
 
49
    i dup s" irq=" type . read_ioapic s" = 0x" type . s" ." type . 
 
50
    i 1 and 0<> if 
 
51
      cr
 
52
    then
 
53
  loop
 
54
  cr
 
55
  ;
 
56
 
 
57
: dump-apics
 
58
  test-lapic
 
59
  test-ioapic
 
60
  ;
 
61
 
 
62
\ tag: apic test utility