~ubuntu-branches/ubuntu/hardy/kvm/hardy-backports

« back to all changes in this revision

Viewing changes to bios/apmbios.S

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2008-02-26 13:10:57 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20080226131057-s67x6l89mtjw1x9b
Tags: 1:62+dfsg-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#error unsupported APM mode
29
29
#endif
30
30
 
31
 
APMSYM(out_str):      
 
31
APMSYM(out_str):
32
32
  push eax
33
33
  push ebx
34
34
  mov ebx, eax
44
44
  pop ebx
45
45
  pop eax
46
46
  ret
47
 
  
 
47
 
48
48
APMSYM(07_poweroff_str):
49
49
  .ascii "Shutdown"
50
50
  db 0
54
54
APMSYM(07_standby_str):
55
55
  .ascii "Standby"
56
56
  db 0
57
 
  
 
57
 
58
58
#if DEBUG_APM
59
 
APMSYM(put_str):      
 
59
APMSYM(put_str):
60
60
  push edx
61
61
  mov dx, #INFO_PORT
62
62
  call APMSYM(out_str)
63
63
  pop edx
64
64
  ret
65
 
  
 
65
 
66
66
; print the hex number in eax
67
 
APMSYM(put_num):      
 
67
APMSYM(put_num):
68
68
  push eax
69
69
  push ebx
70
70
  push ecx
98
98
  outb dx, al
99
99
  shr eax, #8
100
100
  outb dx, al
101
 
  
 
101
 
102
102
  mov eax,ebx
103
103
  call APMSYM(put_num)
104
 
  
 
104
 
105
105
  mov al, #0x3b
106
106
  outb dx,al
107
107
  mov al, #0x20
108
108
  outb dx,al
109
 
  ret  
 
109
  ret
110
110
 
111
111
APMSYM(put_regs):
112
112
  push eax
113
113
  push edx
114
114
  push ebx
115
115
  mov dx, #INFO_PORT
116
 
  
 
116
 
117
117
  mov ebx, eax
118
118
  mov eax, #0x3d584145 // 'EAX='
119
119
  call APMSYM(put_reg)
133
133
  mov ebx, edi
134
134
  mov eax, #0x3d494445 // 'EDI='
135
135
  call APMSYM(put_reg)
136
 
  
 
136
 
137
137
  mov al, #0x0a
138
138
  outb dx, al
139
139
  pop ebx
149
149
_apm16_entry:
150
150
#endif
151
151
  pushf
152
 
  
 
152
 
153
153
#if defined(APM_REAL)
154
154
_apmreal_entry:
155
155
#endif
167
167
 
168
168
  mov ah, #1 // APM major version
169
169
  mov al, #2 // APM minor version
170
 
  
 
170
 
171
171
  mov bh, #0x50 // 'P'
172
172
  mov bl, #0x4d // 'M'
173
 
  
 
173
 
174
174
  // bit 0 : 16 bit interface supported
175
175
  // bit 1 : 32 bit interface supported
176
176
  mov cx, #0x3
177
177
  jmp APMSYM(ok)
178
 
  
 
178
 
179
179
;-----------------
180
180
; APM real mode interface connect
181
181
APMSYM(01):
190
190
  jne APMSYM(03)
191
191
 
192
192
  mov bx, #_apm16_entry
193
 
  
 
193
 
194
194
  mov ax, #0xf000 // 16 bit code segment base
195
195
  mov si, #0xfff0 // 16 bit code segment size
196
196
  mov cx, #0xf000 // data segment address
234
234
APMSYM(07):
235
235
  cmp al, #0x07
236
236
  jne APMSYM(08)
237
 
  
 
237
 
238
238
  cmp bx, #1
239
239
  jne APMSYM(ok)
240
 
  
 
240
 
241
241
  cmp cx, #3
242
242
  je APMSYM(07_poweroff)
243
 
  
 
243
 
244
244
  cmp cx, #2
245
245
  je APMSYM(07_suspend)
246
 
  
 
246
 
247
247
  cmp cx, #1
248
248
  je APMSYM(07_standby)
249
 
  
 
249
 
250
250
  jne APMSYM(ok)
251
 
  
252
 
APMSYM(07_poweroff):  
 
251
 
 
252
APMSYM(07_poweroff):
253
253
  // send power off event to emulator
254
254
  cli
255
255
  mov dx, #0x8900
297
297
  // mov ch, #0x8 // charging
298
298
  mov cl, #0xff // unknown remaining time
299
299
  // mov cl, #50
300
 
  mov dx, #0xffff // unknown remaining time 
 
300
  mov dx, #0xffff // unknown remaining time
301
301
  mov si, #0      // zero battery
302
302
  // mov si, #1      // one battery
303
303
  jmp APMSYM(ok)
309
309
  jne APMSYM(0e)
310
310
  mov ah, #0x80 // no event pending
311
311
  jmp APMSYM(error)
312
 
   
 
312
 
313
313
;-----------------
314
314
; APM Driver Version
315
315
APMSYM(0e):
316
316
  cmp al, #0x0e
317
317
  jne APMSYM(0f)
318
 
  
 
318
 
319
319
  mov ah, #1
320
320
  mov al, #2
321
 
  
 
321
 
322
322
  jmp APMSYM(ok)
323
323
 
324
324
;-----------------
347
347
#if defined(APM_REAL)
348
348
  jmp iret_modify_cf
349
349
#else
350
 
  retf  
 
350
  retf
351
351
#endif
352
352
APMSYM(unimplemented):
353
353
APMSYM(error):