[Savage40] s3switch does segmentation fault / xv overlay on tv
weired
Harald Strack
hstrack at trymedia.com
Thu May 26 06:17:32 PDT 2005
Tim Roberts wrote:
> Harald Strack wrote:
>
>>
>> I am now since 2 days on googeling and it seems that no one else has
>> the same problems like
>> me, so I ask...
>>
>> System:
>> IBM ThinkPad T23 (2647-4MG)
>> S3 Inc. SuperSavage IX/C SDR
>>
>> Debian sarge
>> Kernel: 2.6.8, 2.6.11, 2.4.27
>> XFree86 Version 4.3.0.1 (Debian 4.3.0.dfsg.1-12.0.1)
>> s3switch / Savage driver version: ?? (debian sarge, binary)
>>
>> Problem1: s3switch does segmentation fault
>>
>> s3switch claims:
>>
>> Devices attached: CRT LCD TV
>> Devices active: CRT LCD
>> Current TV format is NTSC-J
>
>
>
> The SuperSavage BIOSes do not maintain the register s3switch uses to
> detect the TV format. That value is unreliable, as you see.
>
>> $ s3switch pal
>> Segmentation fault
>
>
>
> Are you comfortable using gdb? The typical problem here is that the
> BIOS author has left in some debug code that writes progress values to
> an I/O port that they monitor on a logic analyzer. s3switch only asks
> for permission to write to the VGA I/O ports, so any unexpected write
> causes a Segmentation fault. If you can catch the problem with gdb
> and get a register dump, you can make sure the failing instruction is
> an I/O port write, get the I/O port number either from the second byte
> of the instruction or the $dx register, and add that port number to
> the list of ioperm calls in the s3switch.c source code.
>
Thanks a lot, I will try it:
(gdb) run pal
Starting program: /root/build/s3.org/s3switch pal
Program received signal SIGSEGV, Segmentation fault.
0x08049ca7 in em_outb () at lrmi.c:539
539 asm volatile ("outb %b0, (%w1)"
(gdb) list
534 }
535
536 static void
537 em_outb(void)
538 {
539 asm volatile ("outb %b0, (%w1)"
540 : : "a" (context.vm.regs.eax),
541 "d" (context.vm.regs.edx));
542 }
543
(gdb) bt
#0 0x08049ca7 in em_outb () at lrmi.c:539
#1 0x08049f62 in emulate () at lrmi.c:668
#2 0x0804a317 in run_vm86 () at lrmi.c:792
#3 0x0804a51c in LRMI_int (i=16, r=0xbffff9e0) at lrmi.c:877
#4 0x08048b4d in set_tv_state (state=8) at s3switch.c:264
#5 0x08048e97 in set_new_tvstate (tvstate=8) at s3switch.c:382
#6 0x080490ba in main (argc=2, argv=0xbffffaec) at s3switch.c:443
(gdb) info registers
eax 0x5fff 24575
ecx 0x10000 65536
edx 0x70 112
ebx 0xb7fdc038 -1208106952
esp 0xbffff948 0xbffff948
ebp 0xbffff948 0xbffff948
esi 0xbffffae4 -1073743132
edi 0xb7fdd330 -1208102096
eip 0x8049ca7 0x8049ca7
eflags 0x10246 66118
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
-> writing 2 bytes to 0x70 ? (correct me, when i am wrong)
--> adding to s3switch.c
ioperm( 0x70, 2, enable );
Next try:
(gdb) run pal
Starting program: /root/build/s3.org/s3switch pal
Program received signal SIGSEGV, Segmentation fault.
0x08049cc3 in em_outb () at lrmi.c:539
539 asm volatile ("outb %b0, (%w1)"
(gdb) list
534 }
535
536 static void
537 em_outb(void)
538 {
539 asm volatile ("outb %b0, (%w1)"
540 : : "a" (context.vm.regs.eax),
541 "d" (context.vm.regs.edx));
542 }
543
(gdb) bt
#0 0x08049cc3 in em_outb () at lrmi.c:539
#1 0x08049f7e in emulate () at lrmi.c:668
#2 0x0804a333 in run_vm86 () at lrmi.c:792
#3 0x0804a538 in LRMI_int (i=16, r=0xbffff9e0) at lrmi.c:877
#4 0x08048b68 in set_tv_state (state=8) at s3switch.c:265
#5 0x08048eb2 in set_new_tvstate (tvstate=8) at s3switch.c:383
#6 0x080490d5 in main (argc=2, argv=0xbffffaec) at s3switch.c:444
(gdb) info registers
eax 0x5380 21376
ecx 0x10000 65536
edx 0xb2 178
ebx 0xb7fdc038 -1208106952
esp 0xbffff948 0xbffff948
ebp 0xbffff948 0xbffff948
esi 0xbffffae4 -1073743132
edi 0xb7fdd330 -1208102096
eip 0x8049cc3 0x8049cc3
eflags 0x10246 66118
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
(gdb)
-> writing 2 bytes to 0xb2 ? (correct me, when i am wrong)
--> adding to s3switch.c
ioperm( 0xb2, 2, enable );
Next try:
# ./s3switch pal
vm86() failed
return = 0x1
eax = 0x00000080
ebx = 0x00000100
ecx = 0x00005f07
edx = 0x000000b2
esi = 0x0000005f
edi = 0x0000ffff
ebp = 0x00000fd4
eip = 0x00009a39
cs = 0xc000
esp = 0x00000fb2
ss = 0x1000
ds = 0x0000
es = 0x0000
fs = 0x0000
gs = 0x0000
eflags = 0x000b3202
cs:ip = [ e6 4f 3d 80 53 75 04 59 5b eb 03 83 c4 04 66 8b ]
Could not set TV state (vm86 failure)
Devices attached: CRT LCD TV
Devices active: CRT LCD
Current TV format is NTSC-J
So it seems to be elswhere...
Maybe this helps (using the s3switch with the ioperms added!):
When I am in TV mode, I get this:
# ./s3switch tv
Devices attached: CRT LCD TV
Devices active: CRT LCD
Current TV format is NTSC
So it claims to be NTSC !?
# ./s3switch NTSC
vm86() failed
return = 0x1
eax = 0x00000080
ebx = 0x00000100
ecx = 0x00005f07
edx = 0x000000b2
esi = 0x0000005f
edi = 0x0000ffff
ebp = 0x00000fd4
eip = 0x00009a39
cs = 0xc000
esp = 0x00000fb2
ss = 0x1000
ds = 0x0000
es = 0x0000
fs = 0x0000
gs = 0x0000
eflags = 0x000b3202
cs:ip = [ e6 4f 3d 80 53 75 04 59 5b eb 03 83 c4 04 66 8b ]
Could not set TV state (vm86 failure)
Devices attached: CRT LCD TV
Devices active: CRT LCD
Current TV format is NTSC
# ./s3switch NTSC-J
Devices attached: CRT LCD TV
Devices active: CRT LCD
Current TV format is NTSC
With debugger and breakpoint at the ioport:
(using the s3switch without the additional ioperms)
(gdb) run pal
Starting program: /root/build/s3.org/s3switch pal
Program received signal SIGSEGV, Segmentation fault.
0x08049ca7 in em_outb () at lrmi.c:539
539 asm volatile ("outb %b0, (%w1)"
(gdb) brak lrmi.c:539
Undefined command: "brak". Try "help".
(gdb) break lrmi.c:539
Breakpoint 1 at 0x8049c9c: file lrmi.c, line 539.
(gdb) run NTSC-J
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /root/build/s3.org/s3switch NTSC-J
Devices attached: CRT LCD TV
Devices active: CRT LCD
Current TV format is NTSC
Program exited normally.
Do not know enough about this stuff sorry... But I have time... If you
have more
ideas for me to fiddle around, they are welcome
Best Regards
Harry
More information about the Savage40
mailing list