VirtualBox

Changeset 60422 in vbox for trunk/src/VBox/Devices/PC/BIOS


Ignore:
Timestamp:
Apr 11, 2016 12:39:13 PM (9 years ago)
Author:
vboxsync
Message:

VGABIOS,PCBIOS: Build variants for 80286 and 8086 in addition to the default 80386 one. Added build time checking of the BIOSORG results (sed + map file). Fixed shutdown code 0ah jump.

Location:
trunk/src/VBox/Devices/PC/BIOS
Files:
6 added
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/Makefile.kmk

    r56292 r60422  
    2525 # VBoxPcBios - The PC BIOS.
    2626 #
    27  MISCBINS += VBoxPcBios
    28  VBoxPcBios_TEMPLATE = VBoxBios
    29  VBoxPcBios_DEFS = \
     27 MISCBINS += VBoxPcBios386
     28 VBoxPcBios386_TEMPLATE = VBoxBios
     29 VBoxPcBios386_BLD_TYPE = release
     30 VBoxPcBios386_CFLAGS = -3
     31 VBoxPcBios386_DEFS = \
    3032        VBOX_PC_BIOS \
    3133        VBOX_LANBOOT_SEG=0xE200 \
    3234        VBOX_WITH_SCSI \
    33         VBOX_WITH_AHCI
    34  VBoxPcBios_LDFLAGS = \
     35        VBOX_WITH_AHCI \
     36        VBOX_BIOS_CPU=80386
     37 #VBoxPcBios386_DEFS.debug = DEBUG_ATA DEBUG_POST DEBUG_INT13
     38 VBoxPcBios386_LDFLAGS = \
    3539        output raw offset=0xF0000 \
    3640        order \
     
    4145          segment BIOS32  segaddr=0xF000 offset=0xDA00 \
    4246          segment BIOSSEG segaddr=0xF000 offset=0xE000
    43  VBoxPcBios_SOURCES = \
     47 VBoxPcBios386_SOURCES = \
    4448        post.c \
    4549        bios.c \
     
    6872        pcibio32.asm \
    6973        apm_pm.asm \
    70         $(VBoxPcBios32_1_TARGET) \
     74        $(VBoxPcBios32_0_OUTDIR)/VBoxPcBios32.lib \
    7175        orgs.asm
     76 #$(VBoxPcBios32_1_TARGET) - reference is lost when extending the target. weird.
    7277
    7378 # For 32-bit C code in PC BIOS.
     
    7782       pci32.c
    7883
     84 MISCBINS += VBoxPcBios286
     85 VBoxPcBios286_EXTENDS = VBoxPcBios386
     86 VBoxPcBios286_CFLAGS  = -2
     87 VBoxPcBios286_DEFS    = $(filter-out VBOX_BIOS_CPU=80386,$(VBoxPcBios386_DEFS)) VBOX_BIOS_CPU=80286
     88
     89 MISCBINS += VBoxPcBios8086
     90 VBoxPcBios8086_EXTENDS = VBoxPcBios386
     91 VBoxPcBios8086_CFLAGS  = -0
     92 VBoxPcBios8086_DEFS    = $(filter-out VBOX_BIOS_CPU=80386,$(VBoxPcBios386_DEFS)) VBOX_BIOS_CPU=80186 ## @todo get it working as 8086!
     93
     94
    7995 #
    80  # Updates the alternative source file.
     96 # Updates the alternative source files.
    8197 #
    82  update-pcbios-source +| $(PATH_SUB_CURRENT)/VBoxBiosAlternative.asm $(PATH_SUB_CURRENT)/VBoxBiosAlternative.md5sum: \
    83                 $$(VBoxPcBios_1_TARGET) \
    84                 $(VBOX_MAKE_ALTERNATIVE_SOURCE) \
    85                 $(VBOX_VBOXCMP)
    86  if1of ($(KBUILD_TYPE), release)
    87         $(VBOX_MAKE_ALTERNATIVE_SOURCE) \
    88                 --bios-image $< \
    89                 --bios-map $(basename $<).map \
    90                 --bios-sym $(basename $<).sym \
    91                 --bios-type system \
    92                 --output $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.asm
    93         $(QUIET)yasm -f bin -o $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.bin $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.asm
    94         $(VBOX_VBOXCMP) $< $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.bin
    95         $(CP) --changed -- $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.asm $(PATH_ROOT)/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm
    96         $(REDIRECT) -C $(dir $(VBoxPcBios_1_TARGET)) -- \
    97                 $(MD5SUM_EXT) -bo $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.md5sum $(notdir $(VBoxPcBios_1_TARGET))
    98         $(CP) --changed -- $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.md5sum $(PATH_ROOT)/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum
    99         $(RM) -f -- $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.asm $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.bin $(VBoxPcBios_0_OUTDIR)/VBoxBiosAlternative.md5sum
    100  else
    101         $(QUIET)$(ECHO) "Fatal error: Can only update VBoxBiosAlternative.asm/md5sum with a release build."
    102         $(QUIET)exit 1
    103  endif
     98 define def_VBoxPcBiosUpdateAltSource
     99
     100  $$(PATH_SUB_CURRENT)/VBoxBiosAlternative$(1).asm +| $$(PATH_SUB_CURRENT)/VBoxBiosAlternative$(1).md5sum: \
     101                $$$$(VBoxPcBios$(1)_1_TARGET) \
     102                $$(VBOX_MAKE_ALTERNATIVE_SOURCE) \
     103                $$(VBOX_VBOXCMP)
     104  if1of ($(KBUILD_TYPE), release)
     105        $$(VBOX_MAKE_ALTERNATIVE_SOURCE) \
     106        --bios-image $$< \
     107        --bios-map $$(basename $$<).map \
     108        --bios-sym $$(basename $$<).sym \
     109        --bios-type system \
     110        --output $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).asm
     111        $$(QUIET)yasm -f bin -o $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).bin $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).asm
     112        $$(VBOX_VBOXCMP) $$< $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).bin
     113        $$(CP) --changed -- $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).asm $$(PATH_ROOT)/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative$(1).asm
     114        $$(REDIRECT) -C $$(dir $$(VBoxPcBios$(1)_1_TARGET)) -- \
     115        $$(MD5SUM_EXT) -bo $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).md5sum $$(notdir $$(VBoxPcBios$(1)_1_TARGET))
     116        $$(CP) --changed -- $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).md5sum $$(PATH_ROOT)/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative$(1).md5sum
     117        $$(RM) -f -- $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).asm $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative.bin $$(VBoxPcBios$(1)_0_OUTDIR)/VBoxBiosAlternative$(1).md5sum
     118  else
     119        $$(QUIET)$$(ECHO) "Fatal error: Can only update VBoxBiosAlternative$(1).asm/md5sum with a release build."
     120        $$(QUIET)exit 1
     121  endif
     122
     123 endef
     124
     125 $(evalcall2 def_VBoxPcBiosUpdateAltSource,386)
     126 $(evalcall2 def_VBoxPcBiosUpdateAltSource,286)
     127 $(evalcall2 def_VBoxPcBiosUpdateAltSource,8086)
     128
     129 update-pcbios-source: \
     130        $(PATH_SUB_CURRENT)/VBoxBiosAlternative386.asm \
     131        $(PATH_SUB_CURRENT)/VBoxBiosAlternative286.asm \
     132        $(PATH_SUB_CURRENT)/VBoxBiosAlternative8086.asm
    104133
    105134endif # VBOX_WITH_OPEN_WATCOM
     
    112141PcBiosBin_TEMPLATE  = VBOXR3
    113142PcBiosBin_DEFS      = IN_VBOXDD2
    114 PcBiosBin_SOURCES   = $(PcBiosBin_0_OUTDIR)/PcBiosBin.c
    115 PcBiosBin_CLEAN     = $(PcBiosBin_0_OUTDIR)/PcBiosBin.c
    116143
    117 ifdef VBOX_WITH_OPEN_WATCOM
    118  $$(PcBiosBin_0_OUTDIR)/PcBiosBin.c: $$(VBoxPcBios_1_TARGET) $(VBOX_BIN2C) | $$(dir $$@)
    119         $(call MSG_TOOL,bin2c,PcBiosBin,$<,$@)
    120         $(QUIET)$(VBOX_BIN2C) -min 64 -max 256 -mask 0xffff -ascii -export PcBiosBinary $< $@
    121 else
    122  PcBiosBin_CLEAN    += $(PcBiosBin_0_OUTDIR)/VBoxPcBios.rom
     144define def_VBoxPcBiosBin
     145 PcBiosBin_CLEAN   += $$(PcBiosBin_0_OUTDIR)/PcBiosBin$(1).c
     146 PcBiosBin_SOURCES += $$(PcBiosBin_0_OUTDIR)/PcBiosBin$(1).c
    123147
    124  $$(PcBiosBin_0_OUTDIR)/PcBiosBin.c + $$(PcBiosBin_0_OUTDIR)/VBoxPcBios.rom: \
    125                 $(PATH_SUB_CURRENT)/VBoxBiosAlternative.asm \
    126                 $(PATH_SUB_CURRENT)/VBoxBiosAlternative.md5sum \
    127                 $(VBOX_BIN2C) | $$(dir $$@)
    128         $(call MSG_TOOL,bin2c,PcBiosBin,$<,$@)
    129         $(QUIET)yasm -f bin -o $(PcBiosBin_0_OUTDIR)/VBoxPcBios.rom $<
    130         $(QUIET)$(REDIRECT) -C $(PcBiosBin_0_OUTDIR) -- \
    131                 $(MD5SUM_EXT) -c $(basename $<).md5sum
    132         $(QUIET)$(VBOX_BIN2C) -min 64 -max 256 -mask 0xffff -ascii -export PcBiosBinary $(PcBiosBin_0_OUTDIR)/VBoxPcBios.rom $@
    133         $(QUIET)$(RM) -f -- $$(PcBiosBin_0_OUTDIR)/VBoxPcBios.rom
    134 endif
     148 ifdef VBOX_WITH_OPEN_WATCOM
     149  $$$$(PcBiosBin_0_OUTDIR)/PcBiosBin$(1).c: $$$$(VBoxPcBios$(1)_1_TARGET) $$(VBOX_BIN2C) | $$$$(dir $$$$@)
     150        $$(call MSG_TOOL,bin2c,PcBiosBin,$$<,$$@)
     151        $$(QUIET)$$(VBOX_BIN2C) -min 64 -max 256 -mask 0xffff -ascii -export PcBiosBinary$(1) $$< $$@
     152 else
     153  PcBiosBin_CLEAN    += $(PcBiosBin_0_OUTDIR)/VBoxPcBios$(1).rom
     154
     155  $$$$(PcBiosBin_0_OUTDIR)/PcBiosBin$(1).c + $$$$(PcBiosBin_0_OUTDIR)/VBoxPcBios$(1).rom: \
     156                $$(PATH_SUB_CURRENT)/VBoxBiosAlternative$(1).asm \
     157                $$(PATH_SUB_CURRENT)/VBoxBiosAlternative$(1).md5sum \
     158                $$(VBOX_BIN2C) | $$$$(dir $$$$@)
     159        $$(call MSG_TOOL,bin2c,PcBiosBin,$$<,$$@)
     160        $$(QUIET)yasm -f bin -o $$(PcBiosBin_0_OUTDIR)/VBoxPcBios.rom $$<
     161        $$(QUIET)$$(REDIRECT) -C $$(PcBiosBin_0_OUTDIR) -- \
     162                $$(MD5SUM_EXT) -c $$(basename $$<).md5sum
     163        $$(QUIET)$$(VBOX_BIN2C) -min 64 -max 256 -mask 0xffff -ascii -export PcBiosBinary$(1) $$(PcBiosBin_0_OUTDIR)/VBoxPcBios$(1).rom $@
     164        $$(QUIET)$$(RM) -f -- $$$$(PcBiosBin_0_OUTDIR)/VBoxPcBios$(1).rom
     165 endif
     166endef
     167$(evalcall2 def_VBoxPcBiosBin,386)
     168$(evalcall2 def_VBoxPcBiosBin,286)
     169$(evalcall2 def_VBoxPcBiosBin,8086)
     170
    135171
    136172
     
    141177 INSTALLS += VBoxPcBiosSym
    142178 VBoxPcBiosSym_TEMPLATE = VBoxDbgSyms
    143  VBoxPcBiosSym_SOURCES = $(basename $(VBoxPcBios_1_TARGET)).sym
     179 VBoxPcBiosSym_SOURCES = \
     180        $(basename $(VBoxPcBios386_1_TARGET)).sym \
     181        $(basename $(VBoxPcBios286_1_TARGET)).sym \
     182        $(basename $(VBoxPcBios8086_1_TARGET)).sym
    144183endif
    145184
  • trunk/src/VBox/Devices/PC/BIOS/apm_pm.asm

    r56292 r60422  
    1616
    1717
     18include commondefs.inc
     19
    1820;; 16-bit protected mode APM entry point
    1921
     
    2527public          apm_pm16_entry
    2628
    27 .286
     29SET_DEFAULT_CPU_286
    2830
    2931
  • trunk/src/VBox/Devices/PC/BIOS/ata.c

    r58818 r60422  
    6767
    6868void insd_discard(unsigned ndwords, unsigned port);
    69 #pragma aux insd_discard =  \
     69#if VBOX_BIOS_CPU >= 80386
     70# pragma aux insd_discard =  \
    7071    ".386"                  \
    7172    "push eax"              \
     
    7576    "pop eax"               \
    7677    parm [cx] [dx] modify exact [cx] nomemory;
     78#endif
    7779
    7880// ---------------------------------------------------------------------------
     
    222224    blksize = bios_dsk->devices[device].blksize;
    223225    if (blksize == 0) {   /* If transfer size is exactly 64K */
     226#if VBOX_BIOS_CPU >= 80386
    224227        if (mode == ATA_MODE_PIO32)
    225228            blksize = 0x4000;
    226229        else
     230#endif
    227231            blksize = 0x8000;
    228232    } else {
     233#if VBOX_BIOS_CPU >= 80386
    229234        if (mode == ATA_MODE_PIO32)
    230235            blksize >>= 2;
    231236        else
     237#endif
    232238            blksize >>= 1;
    233239    }
     
    309315            buffer = MK_FP(FP_SEG(buffer) + 0x80, FP_OFF(buffer) - 0x800);
    310316
    311         if (mode == ATA_MODE_PIO32) {
     317#if VBOX_BIOS_CPU >= 80386
     318        if (mode == ATA_MODE_PIO32)
    312319            buffer = rep_insd(buffer, blksize, iobase1);
    313         } else {
     320        else
     321#endif
    314322            buffer = rep_insw(buffer, blksize, iobase1);
    315         }
    316323        bios_dsk->drqp.trsfsectors += mult_blk_cnt;
    317324        count--;
     
    691698    mode    = bios_dsk->devices[device].mode;
    692699    blksize = 0x200; // was = bios_dsk->devices[device].blksize;
     700#if VBOX_BIOS_CPU >= 80386
    693701    if (mode == ATA_MODE_PIO32)
    694702        blksize >>= 2;
    695703    else
     704#endif
    696705        blksize >>= 1;
    697706
     
    768777            buffer = MK_FP(FP_SEG(buffer) + 0x80, FP_OFF(buffer) - 0x800);
    769778
    770         if (mode == ATA_MODE_PIO32) {
     779#if VBOX_BIOS_CPU >= 80386
     780        if (mode == ATA_MODE_PIO32)
    771781            buffer = rep_outsd(buffer, blksize, iobase1);
    772         } else {
     782        else
     783#endif
    773784            buffer = rep_outsw(buffer, blksize, iobase1);
    774         }
    775785
    776786        bios_dsk->drqp.trsfsectors++;
     
    10511061            }
    10521062
     1063#if VBOX_BIOS_CPU >= 80386
    10531064            if (lmode == ATA_MODE_PIO32) {
    10541065                lcount  >>= 2;
    10551066                lbefore >>= 2;
    10561067                lafter  >>= 2;
    1057             }
    1058             else {
     1068            } else
     1069#endif
     1070            {
    10591071                lcount  >>= 1;
    10601072                lbefore >>= 1;
     
    10621074            }
    10631075
     1076#if VBOX_BIOS_CPU >= 80386
    10641077            if (lmode == ATA_MODE_PIO32) {
    10651078                if (lbefore)
     
    10681081                if (lafter)
    10691082                    insd_discard(lafter, iobase1);
    1070             } else {
     1083            } else
     1084#endif
     1085            {
    10711086                if (lbefore)
    10721087                    insw_discard(lbefore, iobase1);
  • trunk/src/VBox/Devices/PC/BIOS/biosint.h

    r56292 r60422  
    5151#define BX_APM              1
    5252
    53 #define DEBUG_ATA       0
    54 #define DEBUG_AHCI      0
    55 #define DEBUG_SCSI      0
    56 #define DEBUG_CD_BOOT   0
    57 #define DEBUG_ELTORITO  0
    58 #define DEBUG_INT13_HD  0
    59 #define DEBUG_INT13_FL  0
    60 #define DEBUG_INT13_CD  0
    61 #define DEBUG_INT15     0
    62 #define DEBUG_INT15_MS  0
    63 #define DEBUG_INT16     0
    64 #define DEBUG_INT1A     0
    65 #define DEBUG_INT74     0
    66 #define DEBUG_PCI       0
    67 #define DEBUG_APM       0
    68 #define DEBUG_POST      0
     53#ifndef DEBUG_ATA
     54# define DEBUG_ATA       0
     55#endif
     56#ifdef DEBUG_AHCI
     57# define DEBUG_AHCI      0
     58#endif
     59#ifndef DEBUG_SCSI
     60# define DEBUG_SCSI      0
     61#endif
     62#ifndef DEBUG_CD_BOOT
     63# define DEBUG_CD_BOOT   0
     64#endif
     65#ifndef DEBUG_ELTORITO
     66# define DEBUG_ELTORITO  0
     67#endif
     68#ifndef DEBUG_INT13_HD
     69# define DEBUG_INT13_HD  0
     70#endif
     71#ifndef DEBUG_INT13_FL
     72# define DEBUG_INT13_FL  0
     73#endif
     74#ifndef DEBUG_INT13_CD
     75# define DEBUG_INT13_CD  0
     76#endif
     77#ifndef DEBUG_INT15
     78# define DEBUG_INT15     0
     79#endif
     80#ifndef DEBUG_INT15_MS
     81# define DEBUG_INT15_MS  0
     82#endif
     83#ifndef DEBUG_INT16
     84# define DEBUG_INT16     0
     85#endif
     86#ifndef DEBUG_INT1A
     87# define DEBUG_INT1A     0
     88#endif
     89#ifndef DEBUG_INT74
     90# define DEBUG_INT74     0
     91#endif
     92#ifndef DEBUG_PCI
     93# define DEBUG_PCI       0
     94#endif
     95#ifndef DEBUG_APM
     96# define DEBUG_APM       0
     97#endif
     98#ifndef DEBUG_POST
     99# define DEBUG_POST      0
     100#endif
    69101
    70102#define FP_OFF(p)   ((unsigned)(p))
  • trunk/src/VBox/Devices/PC/BIOS/inlines.h

    r58819 r60422  
    106106#pragma aux rep_insw = ".286" "rep insw" parm [es di] [cx] [dx] value [es di] modify exact [cx di];
    107107
     108# if VBOX_BIOS_CPU >= 80386
    108109char __far *rep_insd(char __far *buffer, unsigned ndwords, unsigned port);
    109 #pragma aux rep_insd = ".386" "rep insd" parm [es di] [cx] [dx] value [es di] modify exact [cx di];
     110#  pragma aux rep_insd = ".386" "rep insd" parm [es di] [cx] [dx] value [es di] modify exact [cx di];
     111# endif
    110112
    111113char __far *rep_outsb(char __far *buffer, unsigned nbytes, unsigned port);
     
    115117#pragma aux rep_outsw = ".286" "rep outs dx,word ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
    116118
     119# if VBOX_BIOS_CPU >= 80386
    117120char __far *rep_outsd(char __far *buffer, unsigned ndwords, unsigned port);
    118 #pragma aux rep_outsd = ".386" "rep outs dx,dword ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
     121#  pragma aux rep_outsd = ".386" "rep outs dx,dword ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
     122# endif
    119123
    120124uint16_t swap_16(uint16_t val);
  • trunk/src/VBox/Devices/PC/BIOS/orgs.asm

    r60402 r60422  
    3939;;
    4040
    41 
    4241; Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
    4342; other than GPL or LGPL is available it will apply instead, Oracle elects to use only
     
    4746; of the LGPL is applied is otherwise unspecified.
    4847
     48
     49include commondefs.inc
     50
    4951EBDA_SEG        equ     09FC0h          ; starts at 639K
    5052EBDA_SIZE       equ     1               ; 1K
     
    7577                org     addr - BIOS_FIX_BASE - 2
    7678                db      'XM'
     79                BIOSORG_CHECK addr
    7780                endm
    7881
     
    9396                cld
    9497endm
     98
    9599
    96100;; External function in separate modules
     
    192196;; and data when possible.
    193197
    194 .286p
     198SET_DEFAULT_CPU_286
    195199
    196200BIOSSEG         segment 'CODE'
     
    236240                cli
    237241
     242if VBOX_BIOS_CPU ge 80286
    238243                ;; Check if in protected (V86) mode. If so, the CPU needs
    239244                ;; to be reset.
     245               .286p
    240246                smsw    ax
    241247                test    ax, 1
    242248                jz      in_real_mode
     249                SET_DEFAULT_CPU_286
     250endif
    243251
    244252                ;; Reset processor to get out of protected mode. Use system
     
    324332                ;; 0ah = jump through 40:67 (no EOI) ;ba x 1  %fe05b ; ba x 1 %18b81
    325333                cmp     al, 0ah
    326                 je      eoi_jmp_post
     334                je      no_eoi_jmp_post
    327335
    328336                ;; any other shutdown status values are ignored
     
    378386                call    _log_bios_start
    379387
     388if VBOX_BIOS_CPU ge 80386
    380389                call    pmode_setup
     390endif
    381391
    382392                ;; set all interrupts in 00h-5Fh range to default handler
     
    416426
    417427                ;; Initialize PCI devices. This can and should be done early.
     428if VBOX_BIOS_CPU ge 80386
    418429                call    pcibios_init_iomem_bases
    419430                call    pcibios_init_irqs
     431endif
    420432                SET_INT_VECTOR 1Ah, BIOSSEG, int1a_handler
    421433
     
    616628;;
    617629return_blkmove:
     630                .286p
    618631                mov     ax, 40h
    619632                mov     ds, ax
     
    641654                sti
    642655                retf    2
    643                
     656                SET_DEFAULT_CPU_286
     657
    644658
    645659;; --------------------------------------------------------
     
    655669;; Fixed Disk Parameter Table
    656670;; --------------------------------------------------------
    657 ;;              BIOSORG 0E401h - fixed wrt preceding
     671                BIOSORG_CHECK   0E401h  ; fixed wrt preceding
    658672
    659673rom_fdpt:
     
    672686;; System BIOS Configuration Table
    673687;; --------------------------------------------------------
    674 ;;              BIOSORG 0E6F5h - fixed wrt preceding
     688                BIOSORG_CHECK   0E6F5h  ; fixed wrt preceding
    675689; must match BIOS_CONFIG_TABLE
    676690bios_cfg_table:
     
    740754                push    ds
    741755                push    es
    742                 pusha
     756                DO_PUSHA
    743757                C_SETUP
    744758                call    _int14_function
    745                 popa
     759                DO_POPA
    746760                pop     es
    747761                pop     ds
     
    756770                push    ds
    757771                push    es
    758                 pusha
     772                DO_PUSHA
    759773                C_SETUP
    760774                call    _dummy_isr_function
    761                 popa
     775                DO_POPA
    762776                pop     es
    763777                pop     ds
     
    817831                push    es
    818832                push    ds
    819                 pusha
     833                DO_PUSHA
    820834
    821835                cmp     ah, 0
     
    827841                C_SETUP
    828842                call    _int16_function
    829                 popa
     843                DO_POPA
    830844                pop     ds
    831845                pop     es
     
    854868                C_SETUP
    855869                call    _int16_function
    856                 popa
     870                DO_POPA
    857871                pop     ds
    858872                pop     es
     
    867881
    868882
     883if VBOX_BIOS_CPU ge 80386
    869884;; Quick and dirty protected mode entry/exit routines
    870885include pmode.inc
     
    872887;; Initialization code which needs to run in protected mode (LAPIC etc.)
    873888include pmsetup.inc
     889endif
    874890
    875891
     
    897913                in      al, KBC_DATA
    898914                push    ds
    899                 pusha
     915                DO_PUSHA
    900916                cld                     ; Before INT 15h (and any C code)
    901917ifdef BX_CALL_INT15_4F
     
    930946
    931947int09_done:
    932                 popa
     948                DO_POPA
    933949                pop     ds
    934950                cli
     
    947963
    948964int06_handler:
    949                 pusha
     965                DO_PUSHA
    950966                push    es
    951967                push    ds
     
    954970                pop     ds
    955971                pop     es
    956                 popa
     972                DO_POPA
    957973                iret
    958974
     
    977993                ja      int13_not_eltorito
    978994
    979                 pusha
     995                DO_PUSHA
    980996                push    es
    981997                push    ds
     
    10091025                pop     es
    10101026
    1011                 pusha
     1027                DO_PUSHA
    10121028                push    es
    10131029                push    ds
     
    10581074
    10591075                ;; now the registers can be restored with
    1060                 ;; pop ds; pop es; popa; iret
     1076                ;; pop ds; pop es; DO_POPA; iret
    10611077                test    dl, 80h         ; non-removable?
    10621078                jnz     int13_notfloppy
     
    10711087                ;; ebx may be modified, save here
    10721088                ;; TODO: check/review 32-bit register use
     1089               ;; @todo figure if 80286/8086 variant is applicable.
    10731090                .386
    10741091                shr     ebx, 16
     
    10771094                pop     bx
    10781095                shl     ebx, 16
    1079                 .286
    1080 
     1096                SET_DEFAULT_CPU_286
    10811097                jmp     int13_out
    10821098
     
    10941110                pop     ds
    10951111                pop     es
    1096                 popa
     1112                DO_POPA
    10971113                iret
    10981114
     
    12421258rtc_post        proc    near
    12431259
     1260if VBOX_BIOS_CPU lt 80386 ;; @todo fix loopy code below
     1261                ;; get RTC seconds
     1262                mov     al, 0
     1263                out     CMOS_ADDR, al
     1264                in      al, CMOS_DATA   ; RTC seconds, in BCD
     1265                call    bcd_to_bin      ; ax now has seconds in binary
     1266               test     al, al
     1267               xor      ah, ah
     1268               mov      dx, 0x1234      ; 18206507*0x100/1000000 = 0x1234 (4660.865792)
     1269               mul     dx
     1270               mov      cx, ax          ; tick count in dx:cx
     1271
     1272                ;; get RTC minutes
     1273                mov     al, 2
     1274                out     CMOS_ADDR, al
     1275                in      al, CMOS_DATA   ; RTC minutes, in BCD
     1276                call    bcd_to_bin      ; eax now has minutes in binary
     1277               test    al, al
     1278               jz      rtc_post_hours
     1279rtc_pos_min_loop:                       ; 18206507*60*0x100/1000000 = 0x44463 (279651.94752)
     1280                add     cx, 0x4463
     1281                adc     dx, 0x0004
     1282               dec      al
     1283               jnz      rtc_pos_min_loop
     1284
     1285                ;; get RTC hours
     1286rtc_post_hours:
     1287                mov     al, 4
     1288                out     CMOS_ADDR, al
     1289                in      al, CMOS_DATA   ; RTC hours, in BCD
     1290                call    bcd_to_bin      ; eax now has hours in binary
     1291               test     al, al
     1292               jz       rtc_pos_shift
     1293rtc_pos_hour_loop:                      ; 18206507*3600*0x100/1000000 = 0x100076C (16779116.8512)
     1294                add     cx, 0x076C
     1295                adc     dx, 0x0100
     1296               dec      al
     1297               jnz      rtc_pos_hour_loop
     1298
     1299
     1300                mov     ax, [46Ch]
     1301                mov     dx, [46Ch+2]
     1302
     1303rtc_pos_shift:
     1304                mov     cl, ch
     1305               mov      ch, dl
     1306               mov      dl, dh
     1307               xor      dh, dh
     1308                mov     ds:[46Ch], cx   ; timer tick count
     1309                mov     ds:[46Ch+2], dx ; timer tick count
     1310                mov     ds:[470h], dh   ; rollover flag
     1311
     1312else
    12441313                .386
    12451314                ;; get RTC seconds
     
    12861355                mov     ds:[470h], al   ; rollover flag
    12871356                .286
     1357endif
    12881358                ret
    12891359
     
    13581428;; INT 17h handler - Printer service
    13591429;; --------------------------------------------------------
    1360 ;;              BIOSORG 0EFD2h - fixed WRT preceding code
     1430                BIOSORG_CHECK   0EFD2h  ; fixed WRT preceding code
    13611431
    13621432                jmp     int17_handler   ; NT floppy boot workaround
     
    13651435                push    ds
    13661436                push    es
    1367                 pusha
     1437                DO_PUSHA
    13681438                C_SETUP
    13691439                call    _int17_function
    1370                 popa
     1440                DO_POPA
    13711441                pop     es
    13721442                pop     ds
     
    15111581; TODO: the drive should be in dl already??
    15121582;;              mov     dl, bl          ; tell guest OS what boot drive is
     1583if VBOX_BIOS_CPU lt 80386
     1584                mov     [bp], ax
     1585               shl      ax, 4
     1586                mov     [bp+2], ax      ; set ip
     1587                mov     ax, [bp]
     1588else
    15131589                .386    ; NB: We're getting garbage into high eax bits
    15141590                shl     eax, 4          ; convert seg to ip
     
    15171593                shr     eax, 4          ; get cs back
    15181594                .286
     1595endif
    15191596                and     ax, BIOSSEG     ; remove what went in ip
    15201597                mov     [bp+4], ax      ; set cs
     
    15521629;; INT 11h handler - Equipment list service
    15531630;; --------------------------------------------------------
    1554 ;;              BIOSORG 0F84Dh - fixed wrt preceding code
     1631                BIOSORG_CHECK   0F84Dh  ; fixed wrt preceding code
    15551632int11_handler:
    15561633                ;; Don't touch - fixed size!
     
    15671644;; INT 15h handler - System services
    15681645;; --------------------------------------------------------
    1569 ;;              BIOSORG 0F859h - fixed wrt preceding code
     1646                BIOSORG_CHECK   0F859h  ; fixed wrt preceding code
    15701647int15_handler:
    15711648                pushf
     
    15791656                cmp     ah, 0d0h
    15801657                je      int15_handler32
    1581                 pusha
     1658                DO_PUSHA
    15821659                cmp     ah, 53h         ; APM function?
    15831660                je      apm_call
     
    15871664                call    _int15_function
    15881665int15_handler_popa_ret:
    1589                 popa
     1666                DO_POPA
    15901667int15_handler32_ret:
    15911668                pop     es
     
    16031680
    16041681int15_handler32:
     1682if VBOX_BIOS_CPU ge 80386
    16051683                ;; need to save/restore 32-bit registers
    16061684                .386
     
    16091687                popad
    16101688                .286
     1689else
     1690                DO_PUSHA
     1691                call    _int15_function32
     1692                DO_POPA
     1693endif
    16111694                jmp     int15_handler32_ret
    16121695
     
    16341717
    16351718                sti
    1636                 pusha
     1719                DO_PUSHA
    16371720                push    es
    16381721                push    ds
     
    16591742                pop     ds
    16601743                pop     es
    1661                 popa
     1744                DO_POPA
    16621745                iret
    16631746
     
    16891772;; INT 1Ah handler - Time of the day + PCI BIOS
    16901773;; --------------------------------------------------------
    1691 ;;              BIOSORG 0FE6Eh - fixed wrt preceding table
     1774                BIOSORG_CHECK   0FE6Eh  ; fixed wrt preceding table
    16921775int1a_handler:
     1776if VBOX_BIOS_CPU ge 80386
    16931777                cmp     ah, 0B1h
    16941778                jne     int1a_normal
     
    17051789                pop     es
    17061790                iret
     1791endif
    17071792
    17081793int1a_normal:
    17091794                push    es
    17101795                push    ds
    1711                 pusha
     1796                DO_PUSHA
    17121797                C_SETUP
    17131798int1a_callfunction:
    17141799                call    _int1a_function
    1715                 popa
     1800                DO_POPA
    17161801                pop     ds
    17171802                pop     es
     
    17251810                push    es
    17261811                push    ds
    1727                 pusha
     1812                DO_PUSHA
    17281813                C_SETUP
    17291814                call    _int70_function
    1730                 popa
     1815                DO_POPA
    17311816                pop     ds
    17321817                pop     es
     
    17391824                BIOSORG 0FEA5h
    17401825int08_handler:
     1826if VBOX_BIOS_CPU ge 80386
    17411827                .386
    17421828                sti
    17431829                push    eax
     1830else
     1831                sti
     1832                push    ax
     1833                push    bx
     1834endif
    17441835                push    ds
    17451836                push    dx
     
    17471838                mov     ds, ax
    17481839
     1840if VBOX_BIOS_CPU ge 80386
    17491841                mov     eax, ds:[6Ch]   ; get ticks dword
    17501842                inc     eax
     1843else
     1844                mov     ax, ds:[6Ch]    ; get ticks dword
     1845               mov     bx, ds:[6Ch+2]
     1846                add     ax, 1
     1847               adc      bx, 0
     1848endif
    17511849
    17521850                ;; compare eax to one day's worth of ticks (at 18.2 Hz)
     1851if VBOX_BIOS_CPU ge 80386
    17531852                cmp     eax, 1800B0h
     1853else
     1854                cmp     bx, 18h
     1855               jb       int08_store_ticks
     1856               ja       int08_rollover
     1857               cmp      ax, 00B0h
     1858endif
    17541859                jb      int08_store_ticks
    17551860                ;; there has been a midnight rollover
     1861int08_rollover:
     1862if VBOX_BIOS_CPU ge 80386
    17561863                xor     eax, eax
     1864else
     1865                xor     ax, ax
     1866                xor     bx, bx
     1867endif
    17571868                inc     byte ptr ds:[70h]       ; increment rollover flag
    17581869
    17591870int08_store_ticks:
     1871if VBOX_BIOS_CPU ge 80386
    17601872                mov     ds:[6Ch], eax
     1873else
     1874                mov     ds:[6Ch], ax
     1875                mov     ds:[6Ch+2], bx
     1876endif
    17611877
    17621878                ;; time to turn off floppy drive motor(s)?
     
    17801896                pop     dx
    17811897                pop     ds
     1898if VBOX_BIOS_CPU ge 80386
    17821899                pop     eax
    17831900                .286
     1901else
     1902                pop     bx
     1903                pop     ax
     1904endif
    17841905                iret
    17851906
     
    18131934;; INT 05h - Print Screen service
    18141935;; --------------------------------------------------------
    1815 ;;              BIOSORG 0FF54h - fixed wrt preceding
     1936                BIOSORG_CHECK   0FF54h  ; fixed wrt preceding
    18161937int05_handler:
    18171938                ;; Not implemented
  • trunk/src/VBox/Devices/PC/BIOS/pcibios.inc

    r56292 r60422  
    336336                ret
    337337
    338 .286
    339 
    340338endif            ; !BX_ROMBIOS32
    341339
    342340endif            ; BX_PCIBIOS
    343341
     342SET_DEFAULT_CPU_286
     343
  • trunk/src/VBox/Devices/PC/BIOS/pmode.inc

    r56292 r60422  
    5454                and     al, 0FEh
    5555                mov     cr0, eax
    56                 .286
     56                SET_DEFAULT_CPU_286
    5757                jmp     far ptr really_exit_pm
    5858really_exit_pm:
  • trunk/src/VBox/Devices/PC/BIOS/pmsetup.inc

    r56292 r60422  
    5858                pop     esi
    5959                pop     eax
    60                 .286
     60                SET_DEFAULT_CPU_286
    6161                ret
    6262
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette