~ubuntu-branches/ubuntu/trusty/seabios/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/vgabios-attempt-to-detect-old-x86emu-and-force-a-fault.diff/vgasrc/vgaentry.S

  • Committer: Package Import Robot
  • Author(s): Michael Tokarev
  • Date: 2014-02-17 21:35:59 UTC
  • Revision ID: package-import@ubuntu.com-20140217213559-cuhrmak46sc5121g
Tags: 1.7.4-4
apply vgabios-attempt-to-detect-old-x86emu-and-force-a-fault.diff:
a patch from upstream to work around apparently broken x86 emulation
in some software.  (Closes: #737142)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Rom layout and bios assembler to C interface.
 
2
//
 
3
// Copyright (C) 2009-2013  Kevin O'Connor <kevin@koconnor.net>
 
4
//
 
5
// This file may be distributed under the terms of the GNU LGPLv3 license.
 
6
 
 
7
 
 
8
#include "asm-offsets.h" // BREGS_*
 
9
#include "config.h" // CONFIG_*
 
10
#include "entryfuncs.S" // ENTRY_*
 
11
 
 
12
 
 
13
/****************************************************************
 
14
 * Rom Header
 
15
 ****************************************************************/
 
16
 
 
17
        .section .rom.header
 
18
        .code16gcc
 
19
        .global _rom_header, _rom_header_size, _rom_header_checksum
 
20
_rom_header:
 
21
        .word 0xaa55
 
22
_rom_header_size:
 
23
        .byte 0
 
24
_rom_header_entry:
 
25
        jmp _optionrom_entry
 
26
_rom_header_checksum:
 
27
        .byte 0
 
28
_rom_header_other:
 
29
        .space 17
 
30
_rom_header_pcidata:
 
31
#if CONFIG_VGA_PCI == 1
 
32
        .word rom_pci_data
 
33
#else
 
34
        .word 0
 
35
#endif
 
36
_rom_header_pnpdata:
 
37
        .word 0
 
38
_rom_header_other2:
 
39
        .word 0
 
40
_rom_header_signature:
 
41
        .asciz "IBM"
 
42
 
 
43
 
 
44
/****************************************************************
 
45
 * Entry points
 
46
 ****************************************************************/
 
47
 
 
48
        // This macro is the same as ENTRY_ARG except the "calll"
 
49
        // instruction is avoided to work around known issues in the
 
50
        // emulation of some versions of x86emu.
 
51
        .macro ENTRY_ARG_VGA cfunc
 
52
        cli
 
53
        cld
 
54
        PUSHBREGS
 
55
        movw %ss, %ax           // Move %ss to %ds
 
56
        movw %ax, %ds
 
57
        movl %esp, %ebx         // Backup %esp, then zero high bits
 
58
        movzwl %sp, %esp
 
59
        movl %esp, %eax         // First arg is pointer to struct bregs
 
60
        pushw %ax ; callw \cfunc
 
61
        movl %ebx, %esp         // Restore %esp (including high bits)
 
62
        POPBREGS
 
63
        .endm
 
64
 
 
65
        DECLFUNC entry_104f05
 
66
entry_104f05:
 
67
        ENTRY_ARG_VGA vbe_104f05
 
68
        lretw
 
69
 
 
70
        DECLFUNC _optionrom_entry
 
71
_optionrom_entry:
 
72
        ENTRY_ARG_VGA vga_post
 
73
        lretw
 
74
 
 
75
        DECLFUNC entry_10
 
76
entry_10:
 
77
        ENTRY_ARG_VGA handle_10
 
78
        iretw
 
79
 
 
80
        // Entry point using extra stack
 
81
        DECLFUNC entry_10_extrastack
 
82
entry_10_extrastack:
 
83
        cli
 
84
        cld
 
85
        pushw %ds               // Set %ds:%eax to space on ExtraStack
 
86
        pushl %eax
 
87
        movw %cs:ExtraStackSeg, %ds
 
88
        movl $(CONFIG_VGA_EXTRA_STACK_SIZE-BREGS_size-8), %eax
 
89
        popl BREGS_eax(%eax)    // Backup registers
 
90
        popw BREGS_ds(%eax)
 
91
        movl %edi, BREGS_edi(%eax)
 
92
        movl %esi, BREGS_esi(%eax)
 
93
        movl %ebp, BREGS_ebp(%eax)
 
94
        movl %ebx, BREGS_ebx(%eax)
 
95
        movl %edx, BREGS_edx(%eax)
 
96
        movl %ecx, BREGS_ecx(%eax)
 
97
        movw %es, BREGS_es(%eax)
 
98
        movl %esp, BREGS_size+0(%eax)
 
99
        movw %ss, BREGS_size+4(%eax)
 
100
        popl BREGS_code(%eax)
 
101
        popw BREGS_flags(%eax)
 
102
 
 
103
        movw %ds, %dx           // Setup %ss/%esp and call function
 
104
        movw %dx, %ss
 
105
        movl %eax, %esp
 
106
        pushw %ax ; callw handle_10
 
107
 
 
108
        movl %esp, %eax         // Restore registers and return
 
109
        movw BREGS_size+4(%eax), %ss
 
110
        movl BREGS_size+0(%eax), %esp
 
111
        popl %edx
 
112
        popw %dx
 
113
        pushw BREGS_flags(%eax)
 
114
        pushl BREGS_code(%eax)
 
115
        movl BREGS_edi(%eax), %edi
 
116
        movl BREGS_esi(%eax), %esi
 
117
        movl BREGS_ebp(%eax), %ebp
 
118
        movl BREGS_ebx(%eax), %ebx
 
119
        movl BREGS_edx(%eax), %edx
 
120
        movl BREGS_ecx(%eax), %ecx
 
121
        movw BREGS_es(%eax), %es
 
122
        pushw BREGS_ds(%eax)
 
123
        pushl BREGS_eax(%eax)
 
124
        popl %eax
 
125
        popw %ds
 
126
        iretw