mirror of https://github.com/acidanthera/audk.git
Detab in DuetPkg
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9170 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
10b48963c8
commit
b29a823d91
|
@ -1090,18 +1090,18 @@ BiosVideoCheckForVbe (
|
|||
//
|
||||
// INT 10 - VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION
|
||||
//
|
||||
// AX = 4F00h
|
||||
// ES:DI -> buffer for SuperVGA information (see #00077)
|
||||
// AX = 4F00h
|
||||
// ES:DI -> buffer for SuperVGA information (see #00077)
|
||||
// Return: AL = 4Fh if function supported
|
||||
// AH = status
|
||||
// 00h successful
|
||||
// ES:DI buffer filled
|
||||
// 01h failed
|
||||
// ---VBE v2.0---
|
||||
// 02h function not supported by current hardware configuration
|
||||
// 03h function invalid in current video mode
|
||||
// Desc: determine whether VESA BIOS extensions are present and the capabilities
|
||||
// supported by the display adapter
|
||||
// AH = status
|
||||
// 00h successful
|
||||
// ES:DI buffer filled
|
||||
// 01h failed
|
||||
// ---VBE v2.0---
|
||||
// 02h function not supported by current hardware configuration
|
||||
// 03h function invalid in current video mode
|
||||
// Desc: determine whether VESA BIOS extensions are present and the capabilities
|
||||
// supported by the display adapter
|
||||
//
|
||||
gBS->SetMem (&Regs, sizeof (Regs), 0);
|
||||
Regs.X.AX = VESA_BIOS_EXTENSIONS_RETURN_CONTROLLER_INFORMATION;
|
||||
|
@ -1232,15 +1232,15 @@ BiosVideoCheckForVbe (
|
|||
//
|
||||
// INT 10 - VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION
|
||||
//
|
||||
// AX = 4F01h
|
||||
// CX = SuperVGA video mode (see #04082 for bitfields)
|
||||
// ES:DI -> 256-byte buffer for mode information (see #00079)
|
||||
// AX = 4F01h
|
||||
// CX = SuperVGA video mode (see #04082 for bitfields)
|
||||
// ES:DI -> 256-byte buffer for mode information (see #00079)
|
||||
// Return: AL = 4Fh if function supported
|
||||
// AH = status
|
||||
// 00h successful
|
||||
// ES:DI buffer filled
|
||||
// 01h failed
|
||||
// Desc: determine the attributes of the specified video mode
|
||||
// AH = status
|
||||
// 00h successful
|
||||
// ES:DI buffer filled
|
||||
// 01h failed
|
||||
// Desc: determine the attributes of the specified video mode
|
||||
//
|
||||
gBS->SetMem (&Regs, sizeof (Regs), 0);
|
||||
Regs.X.AX = VESA_BIOS_EXTENSIONS_RETURN_MODE_INFORMATION;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
Copyright (c) 2006 - 2009, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -130,7 +130,7 @@ typedef struct {
|
|||
#define BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS(a) CR (a, BIOS_VIDEO_DEV, GraphicsOutput, BIOS_VIDEO_DEV_SIGNATURE)
|
||||
#define BIOS_VIDEO_DEV_FROM_VGA_MINI_PORT_THIS(a) CR (a, BIOS_VIDEO_DEV, VgaMiniPort, BIOS_VIDEO_DEV_SIGNATURE)
|
||||
|
||||
#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
|
||||
#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
|
||||
|
||||
#define EFI_SEGMENT(_Adr) (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)
|
||||
#define EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This module provides EFI_GRAPHIC_OUT_PROTOCOL based on functions of video
|
||||
# on legacy BIOS.
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -47,4 +47,4 @@
|
|||
gEfiVgaMiniPortProtocolGuid
|
||||
gEfiLegacy8259ProtocolGuid
|
||||
gEfiEdidDiscoveredProtocolGuid
|
||||
gEfiEdidActiveProtocolGuid
|
||||
gEfiEdidActiveProtocolGuid
|
||||
|
|
|
@ -129,7 +129,7 @@ BootSectorEntryPoint:
|
|||
xorw %bx, %bx
|
||||
|
||||
FindEFILDR:
|
||||
cmpl $LOADER_FILENAME_PART1, (%di) # Compare to "EFIL"
|
||||
cmpl $LOADER_FILENAME_PART1, (%di) # Compare to "EFIL"
|
||||
jne FindVARSTORE
|
||||
cmpl $LOADER_FILENAME_PART2, 4(%di)
|
||||
jne FindVARSTORE
|
||||
|
|
|
@ -119,7 +119,7 @@ BootSectorEntryPoint:
|
|||
FindEFILDR:
|
||||
cmpl $LOADER_FILENAME_PART1, (%di) # Compare to "EFIL"
|
||||
jne FindVARSTORE
|
||||
cmpl $LOADER_FILENAME_PART2, 4(%di)
|
||||
cmpl $LOADER_FILENAME_PART2, 4(%di)
|
||||
jne FindVARSTORE
|
||||
cmpl $LOADER_FILENAME_PART3, 7(%di)
|
||||
jne FindVARSTORE
|
||||
|
|
|
@ -59,7 +59,7 @@ Start:
|
|||
LOOP_1: # loop through all IDT entries exception handlers and initialize to default handler
|
||||
movw %bx, (%edi) # write bits 15..0 of offset
|
||||
movw $0x20, 2(%edi) # SYS_CODE_SEL from GDT
|
||||
movw $(0x0e00 | 0x8000), 4(%edi) # type = 386 interrupt gate, present
|
||||
movw $(0x0e00 | 0x8000), 4(%edi) # type = 386 interrupt gate, present
|
||||
movw %ax, 6(%edi) # write bits 31..16 of offset
|
||||
addl $8, %edi # move up to next descriptor
|
||||
addw DEFAULT_HANDLER_SIZE, %bx # move to next entry point
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
# within 255 bytes of the common entry. This must
|
||||
# be done to maintain the consistency of the size
|
||||
# of entry points...
|
||||
.byte 0xe9 # jmp 16 bit relative
|
||||
.long commonIdtEntry - . - 4 # offset to jump to
|
||||
.byte 0xe9 # jmp 16 bit relative
|
||||
.long commonIdtEntry - . - 4 # offset to jump to
|
||||
.endm
|
||||
|
||||
|
||||
|
@ -56,21 +56,21 @@ Start:
|
|||
call ClearScreen
|
||||
|
||||
# Populate IDT with meaningful offsets for exception handlers...
|
||||
sidt Idtr
|
||||
|
||||
sidt Idtr
|
||||
|
||||
|
||||
movl Halt, %eax
|
||||
movl Halt, %eax
|
||||
movl %eax,%ebx # use bx to copy 15..0 to descriptors
|
||||
shrl $16,%eax # use ax to copy 31..16 to descriptors
|
||||
# 63..32 of descriptors is 0
|
||||
movl $0x78,%ecx # 78h IDT entries to initialize with unique entry points (exceptions)
|
||||
movl (Idtr + 2), %esi
|
||||
movl (Idtr + 2), %esi
|
||||
movl (%esi),%edi
|
||||
|
||||
LOOP_1: # loop through all IDT entries exception handlers and initialize to default handler
|
||||
movw %bx, (%edi) # write bits 15..0 of offset
|
||||
movw $0x38, 2(%edi) # SYS_CODE_SEL64 from GDT
|
||||
movw $(0x0e00 | 0x8000), 4(%edi) # type = 386 interrupt gate, present
|
||||
movw $(0x0e00 | 0x8000), 4(%edi) # type = 386 interrupt gate, present
|
||||
movw %ax, 6(%edi) # write bits 31..16 of offset
|
||||
movl $0, 8(%edi) # write bits 31..16 of offset
|
||||
addl $16, %edi # move up to next descriptor
|
||||
|
@ -123,12 +123,12 @@ LOOP_1: # loop through all IDT entries e
|
|||
movl 0x30(%ebp),%edi # edi = [[22000 + [22014] + 3c] + 2c] = ImageBase (63..32 is zero, ignore)
|
||||
movl 0x28(%ebp),%eax # eax = [[22000 + [22014] + 3c] + 24] = EntryPoint
|
||||
addl %edi,%eax # eax = ImageBase + EntryPoint
|
||||
movl %ebx, EfiLdrOffset
|
||||
movl %ebx, EfiLdrOffset
|
||||
movl %eax, (%ebx) # Modify far jump instruction for correct entry point
|
||||
|
||||
movw 6(%ebp), %bx # bx = Number of sections
|
||||
movw 6(%ebp), %bx # bx = Number of sections
|
||||
xorl %eax,%eax
|
||||
movw 0x14(%ebp), %ax # ax = Optional Header Size
|
||||
movw 0x14(%ebp), %ax # ax = Optional Header Size
|
||||
addl %eax,%ebp
|
||||
addl $0x18,%ebp # ebp = Start of 1st Section
|
||||
|
||||
|
@ -155,12 +155,12 @@ SectionLoop:
|
|||
cmpw $0,%bx
|
||||
jne SectionLoop
|
||||
|
||||
movl (Idtr), %eax # get size of IDT
|
||||
movzx (%edx), %eax
|
||||
movl (Idtr), %eax # get size of IDT
|
||||
movzx (%edx), %eax
|
||||
.byte 0xff
|
||||
.byte 0xc0
|
||||
# inc eax
|
||||
addl 2(%edx), %eax # add to base of IDT to get location of memory map...
|
||||
addl 2(%edx), %eax # add to base of IDT to get location of memory map...
|
||||
xorl %ecx,%ecx
|
||||
movl %eax,%ecx # put argument to RCX
|
||||
|
||||
|
@ -379,11 +379,11 @@ commonIdtEntry:
|
|||
ja PrintDefaultString
|
||||
PrintExceptionString:
|
||||
shll $3,%eax ## multiply by 8 to get offset from StringTable to actual string address
|
||||
addl StringTable, %eax
|
||||
addl StringTable, %eax
|
||||
movl (%eax),%esi
|
||||
jmp PrintTheString
|
||||
PrintDefaultString:
|
||||
movl IntUnknownString, %esi
|
||||
movl IntUnknownString, %esi
|
||||
# patch Int number
|
||||
movl %eax,%edx
|
||||
call A2C
|
||||
|
@ -394,35 +394,35 @@ PrintDefaultString:
|
|||
movb %al,(%esi)
|
||||
PrintTheString:
|
||||
call PrintString
|
||||
movl String2, %esi
|
||||
movl String2, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 19*8(%ebp),%eax # CS
|
||||
call PrintQword
|
||||
movb $':', %al
|
||||
movb %al, (%edi)
|
||||
movb %al, (%edi)
|
||||
addl $2,%edi
|
||||
.byte 0x48
|
||||
movl 18*8(%ebp),%eax # RIP
|
||||
call PrintQword
|
||||
movl String3, %esi
|
||||
movl String3, %esi
|
||||
call PrintString
|
||||
|
||||
movl $0xb8140,%edi
|
||||
|
||||
movl StringRax, %esi
|
||||
movl StringRax, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 15*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringRcx, %esi
|
||||
movl StringRcx, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 14*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringRdx, %esi
|
||||
movl StringRdx, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 13*8(%ebp),%eax
|
||||
|
@ -430,19 +430,19 @@ PrintTheString:
|
|||
|
||||
movl $0xb81e0,%edi
|
||||
|
||||
movl StringRbx, %esi
|
||||
movl StringRbx, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 12*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringRsp, %esi
|
||||
movl StringRsp, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 21*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringRbp, %esi
|
||||
movl StringRbp, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 10*8(%ebp),%eax
|
||||
|
@ -450,19 +450,19 @@ PrintTheString:
|
|||
|
||||
movl $0xb8280,%edi
|
||||
|
||||
movl StringRsi, %esi
|
||||
movl StringRsi, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 9*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringRdi, %esi
|
||||
movl StringRdi, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 8*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringEcode, %esi
|
||||
movl StringEcode, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 17*8(%ebp),%eax
|
||||
|
@ -470,19 +470,19 @@ PrintTheString:
|
|||
|
||||
movl $0xb8320,%edi
|
||||
|
||||
movl StringR8, %esi
|
||||
movl StringR8, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 7*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringR9, %esi
|
||||
movl StringR9, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 6*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringR10, %esi
|
||||
movl StringR10, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 5*8(%ebp),%eax
|
||||
|
@ -490,19 +490,19 @@ PrintTheString:
|
|||
|
||||
movl $0xb83c0,%edi
|
||||
|
||||
movl StringR11, %esi
|
||||
movl StringR11, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 4*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringR12, %esi
|
||||
movl StringR12, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 3*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringR13, %esi
|
||||
movl StringR13, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 2*8(%ebp),%eax
|
||||
|
@ -510,19 +510,19 @@ PrintTheString:
|
|||
|
||||
movl $0xb8460,%edi
|
||||
|
||||
movl StringR14, %esi
|
||||
movl StringR14, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 1*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringR15, %esi
|
||||
movl StringR15, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 0*8(%ebp),%eax
|
||||
call PrintQword
|
||||
|
||||
movl StringSs, %esi
|
||||
movl StringSs, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 22*8(%ebp),%eax
|
||||
|
@ -530,7 +530,7 @@ PrintTheString:
|
|||
|
||||
movl $0xb8500,%edi
|
||||
|
||||
movl StringRflags, %esi
|
||||
movl StringRflags, %esi
|
||||
call PrintString
|
||||
.byte 0x48
|
||||
movl 20*8(%ebp),%eax
|
||||
|
@ -554,7 +554,7 @@ InnerLoop:
|
|||
movl (%esi),%eax
|
||||
call PrintQword
|
||||
addl $8,%esi
|
||||
mov $0x00, %al
|
||||
mov $0x00, %al
|
||||
movb %al,(%edi)
|
||||
addl $2,%edi
|
||||
loop InnerLoop
|
||||
|
@ -585,7 +585,7 @@ InnerLoop1:
|
|||
movl (%esi),%eax
|
||||
call PrintQword
|
||||
addl $8,%esi
|
||||
movb $0x00, %al
|
||||
movb $0x00, %al
|
||||
movb %al,(%edi)
|
||||
addl $2,%edi
|
||||
loop InnerLoop1
|
||||
|
@ -652,10 +652,10 @@ LN_C1:
|
|||
PrintString:
|
||||
pushl %eax
|
||||
LN_C2:
|
||||
movb (%esi), %al
|
||||
movb (%esi), %al
|
||||
cmpb $0,%al
|
||||
je LN_C3
|
||||
movb %al, (%edi)
|
||||
movb %al, (%edi)
|
||||
.byte 0xff
|
||||
.byte 0xc6
|
||||
# inc esi
|
||||
|
@ -687,7 +687,7 @@ looptop:
|
|||
jle @f
|
||||
addb $7,%bl
|
||||
@@:
|
||||
movb %bl, (%edi)
|
||||
movb %bl, (%edi)
|
||||
addl $2,%edi
|
||||
loop looptop
|
||||
#wbinvd
|
||||
|
@ -701,12 +701,12 @@ ClearScreen:
|
|||
pushl %eax
|
||||
pushl %ecx
|
||||
|
||||
movb $0x00, %al
|
||||
movb $0x00, %al
|
||||
movb $0xc,%ah
|
||||
movl $0xb8000,%edi
|
||||
movl $80*24,%ecx
|
||||
LN_C4:
|
||||
movw %ax, (%edi)
|
||||
movw %ax, (%edi)
|
||||
addl $2,%edi
|
||||
loop LN_C4
|
||||
movl $0xb8000,%edi
|
||||
|
|
|
@ -74,7 +74,7 @@ BootSectorEntryPoint:
|
|||
NoVarStore:
|
||||
pushw %es
|
||||
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
||||
movb %al, %es:(4)
|
||||
movb %al, %es:(4)
|
||||
jmp SaveVolumeId
|
||||
|
||||
CheckVarStoreSize:
|
||||
|
@ -232,7 +232,7 @@ ReadCylinderLoop:
|
|||
movw $0x7bfc,%bp # bp = 0x7bfc
|
||||
movl %esi,%eax # eax = Start LBA
|
||||
xorl %edx,%edx # edx = 0
|
||||
movzwl (%bp), %ebx # bx = MaxSector
|
||||
movzwl (%bp), %ebx # bx = MaxSector
|
||||
divl %ebx # ax = StartLBA / MaxSector
|
||||
incw %dx # dx = (StartLBA % MaxSector) + 1
|
||||
|
||||
|
@ -354,7 +354,7 @@ MemMapLoop:
|
|||
MemMapDone:
|
||||
leal MemoryMap, %eax
|
||||
subl %eax,%edi # Get the address of the memory map
|
||||
movl %edi, MemoryMapSize # Save the size of the memory map
|
||||
movl %edi, MemoryMapSize # Save the size of the memory map
|
||||
|
||||
xorl %ebx,%ebx
|
||||
movw %cs,%bx # BX=segment
|
||||
|
@ -416,7 +416,7 @@ A20GateEnabled:
|
|||
|
||||
leal OffsetIn32BitProtectedMode, %eax
|
||||
addl $0x20000+0x6,%eax
|
||||
movl %eax, OffsetIn32BitProtectedMode
|
||||
movl %eax, OffsetIn32BitProtectedMode
|
||||
|
||||
leal OffsetInLongMode, %eax
|
||||
addl $0x20000+0x6,%eax
|
||||
|
@ -582,7 +582,7 @@ Empty8042Loop:
|
|||
|
||||
.p2align 1
|
||||
|
||||
gdtr: .long GDT_END - GDT_BASE - 1 # GDT limit
|
||||
gdtr: .long GDT_END - GDT_BASE - 1 # GDT limit
|
||||
.long 0 # (GDT base gets set above)
|
||||
##############################################################################
|
||||
# global descriptor table (GDT)
|
||||
|
@ -701,366 +701,366 @@ idtr: .long IDT_END - IDT_BASE - 1 # IDT limit
|
|||
IDT_BASE:
|
||||
# divide by zero (INT 0)
|
||||
.equ DIV_ZERO_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# debug exception (INT 1)
|
||||
.equ DEBUG_EXCEPT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# NMI (INT 2)
|
||||
.equ NMI_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# soft breakpoint (INT 3)
|
||||
.equ BREAKPOINT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# overflow (INT 4)
|
||||
.equ OVERFLOW_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# bounds check (INT 5)
|
||||
.equ BOUNDS_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# invalid opcode (INT 6)
|
||||
.equ INVALID_OPCODE_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# device not available (INT 7)
|
||||
.equ DEV_NOT_AVAIL_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# double fault (INT 8)
|
||||
.equ DOUBLE_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Coprocessor segment overrun - reserved (INT 9)
|
||||
.equ RSVD_INTR_SEL1, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# invalid TSS (INT 0ah)
|
||||
.equ INVALID_TSS_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# segment not present (INT 0bh)
|
||||
.equ SEG_NOT_PRESENT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# stack fault (INT 0ch)
|
||||
.equ STACK_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# general protection (INT 0dh)
|
||||
.equ GP_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# page fault (INT 0eh)
|
||||
.equ PAGE_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Intel reserved - do not use (INT 0fh)
|
||||
.equ RSVD_INTR_SEL2, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# floating point error (INT 10h)
|
||||
.equ FLT_POINT_ERR_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# alignment check (INT 11h)
|
||||
.equ ALIGNMENT_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# machine check (INT 12h)
|
||||
.equ MACHINE_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# SIMD floating-point exception (INT 13h)
|
||||
.equ SIMD_EXCEPTION_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# 85 unspecified descriptors, First 12 of them are reserved, the rest are avail
|
||||
.fill 85 * 16, 1, 0 # db (85 * 16) dup(0)
|
||||
.fill 85 * 16, 1, 0 # db (85 * 16) dup(0)
|
||||
|
||||
# IRQ 0 (System timer) - (INT 68h)
|
||||
.equ IRQ0_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 1 (8042 Keyboard controller) - (INT 69h)
|
||||
.equ IRQ1_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Reserved - IRQ 2 redirect (IRQ 2) - DO NOT USE!!! - (INT 6ah)
|
||||
.equ IRQ2_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 3 (COM 2) - (INT 6bh)
|
||||
.equ IRQ3_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 4 (COM 1) - (INT 6ch)
|
||||
.equ IRQ4_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 5 (LPT 2) - (INT 6dh)
|
||||
.equ IRQ5_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 6 (Floppy controller) - (INT 6eh)
|
||||
.equ IRQ6_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 7 (LPT 1) - (INT 6fh)
|
||||
.equ IRQ7_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 8 (RTC Alarm) - (INT 70h)
|
||||
.equ IRQ8_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 9 - (INT 71h)
|
||||
.equ IRQ9_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 10 - (INT 72h)
|
||||
.equ IRQ10_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 11 - (INT 73h)
|
||||
.equ IRQ11_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 12 (PS/2 mouse) - (INT 74h)
|
||||
.equ IRQ12_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 13 (Floating point error) - (INT 75h)
|
||||
.equ IRQ13_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 14 (Secondary IDE) - (INT 76h)
|
||||
.equ IRQ14_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 15 (Primary IDE) - (INT 77h)
|
||||
.equ IRQ15_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
IDT_END:
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ MemoryMap: .long 0,0,0,0,0,0,0,0
|
|||
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
#.org 0x0fe0 #Just for pass build
|
||||
#.org 0x0fe0 #Just for pass build
|
||||
MyStack:
|
||||
# below is the pieces of the IVT that is used to redirect INT 68h - 6fh
|
||||
# back to INT 08h - 0fh when in real mode... It is 'org'ed to a
|
||||
|
@ -1133,7 +1133,7 @@ MyStack:
|
|||
iret
|
||||
|
||||
|
||||
#.org 0x0ffe #Just for pass build
|
||||
#.org 0x0ffe #Just for pass build
|
||||
BlockSignature:
|
||||
.word 0xaa55
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ BootSectorEntryPoint:
|
|||
NoVarStore:
|
||||
pushw %es
|
||||
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
||||
movb %al, %es:(4)
|
||||
movb %al, %es:(4)
|
||||
jmp SaveVolumeId
|
||||
|
||||
CheckVarStoreSize:
|
||||
|
@ -247,7 +247,7 @@ ReadCylinderLoop:
|
|||
movw $0x7bfc,%bp # bp = 0x7bfc
|
||||
movl %esi,%eax # eax = Start LBA
|
||||
xorl %edx,%edx # edx = 0
|
||||
movzwl (%bp), %ebx # bx = MaxSector
|
||||
movzwl (%bp), %ebx # bx = MaxSector
|
||||
divl %ebx # ax = StartLBA / MaxSector
|
||||
incw %dx # dx = (StartLBA % MaxSector) + 1
|
||||
|
||||
|
@ -369,7 +369,7 @@ MemMapLoop:
|
|||
MemMapDone:
|
||||
leal MemoryMap, %eax
|
||||
subl %eax,%edi # Get the address of the memory map
|
||||
movl %edi, MemoryMapSize # Save the size of the memory map
|
||||
movl %edi, MemoryMapSize # Save the size of the memory map
|
||||
|
||||
xorl %ebx,%ebx
|
||||
movw %cs,%bx # BX=segment
|
||||
|
@ -431,7 +431,7 @@ A20GateEnabled:
|
|||
|
||||
leal OffsetIn32BitProtectedMode, %eax
|
||||
addl $0x20000+0x6,%eax
|
||||
movl %eax, OffsetIn32BitProtectedMode
|
||||
movl %eax, OffsetIn32BitProtectedMode
|
||||
|
||||
leal OffsetInLongMode, %eax
|
||||
addl $0x20000+0x6,%eax
|
||||
|
@ -597,7 +597,7 @@ Empty8042Loop:
|
|||
|
||||
.p2align 1
|
||||
|
||||
gdtr: .long GDT_END - GDT_BASE - 1 # GDT limit
|
||||
gdtr: .long GDT_END - GDT_BASE - 1 # GDT limit
|
||||
.long 0 # (GDT base gets set above)
|
||||
##############################################################################
|
||||
# global descriptor table (GDT)
|
||||
|
@ -716,366 +716,366 @@ idtr: .long IDT_END - IDT_BASE - 1 # IDT limit
|
|||
IDT_BASE:
|
||||
# divide by zero (INT 0)
|
||||
.equ DIV_ZERO_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# debug exception (INT 1)
|
||||
.equ DEBUG_EXCEPT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# NMI (INT 2)
|
||||
.equ NMI_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# soft breakpoint (INT 3)
|
||||
.equ BREAKPOINT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# overflow (INT 4)
|
||||
.equ OVERFLOW_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# bounds check (INT 5)
|
||||
.equ BOUNDS_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# invalid opcode (INT 6)
|
||||
.equ INVALID_OPCODE_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# device not available (INT 7)
|
||||
.equ DEV_NOT_AVAIL_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# double fault (INT 8)
|
||||
.equ DOUBLE_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Coprocessor segment overrun - reserved (INT 9)
|
||||
.equ RSVD_INTR_SEL1, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# invalid TSS (INT 0ah)
|
||||
.equ INVALID_TSS_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# segment not present (INT 0bh)
|
||||
.equ SEG_NOT_PRESENT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# stack fault (INT 0ch)
|
||||
.equ STACK_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# general protection (INT 0dh)
|
||||
.equ GP_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# page fault (INT 0eh)
|
||||
.equ PAGE_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Intel reserved - do not use (INT 0fh)
|
||||
.equ RSVD_INTR_SEL2, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# floating point error (INT 10h)
|
||||
.equ FLT_POINT_ERR_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# alignment check (INT 11h)
|
||||
.equ ALIGNMENT_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# machine check (INT 12h)
|
||||
.equ MACHINE_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# SIMD floating-point exception (INT 13h)
|
||||
.equ SIMD_EXCEPTION_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# 85 unspecified descriptors, First 12 of them are reserved, the rest are avail
|
||||
.fill 85 * 16, 1, 0 # db (85 * 16) dup(0)
|
||||
.fill 85 * 16, 1, 0 # db (85 * 16) dup(0)
|
||||
|
||||
# IRQ 0 (System timer) - (INT 68h)
|
||||
.equ IRQ0_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 1 (8042 Keyboard controller) - (INT 69h)
|
||||
.equ IRQ1_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Reserved - IRQ 2 redirect (IRQ 2) - DO NOT USE!!! - (INT 6ah)
|
||||
.equ IRQ2_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 3 (COM 2) - (INT 6bh)
|
||||
.equ IRQ3_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 4 (COM 1) - (INT 6ch)
|
||||
.equ IRQ4_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 5 (LPT 2) - (INT 6dh)
|
||||
.equ IRQ5_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 6 (Floppy controller) - (INT 6eh)
|
||||
.equ IRQ6_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 7 (LPT 1) - (INT 6fh)
|
||||
.equ IRQ7_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 8 (RTC Alarm) - (INT 70h)
|
||||
.equ IRQ8_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 9 - (INT 71h)
|
||||
.equ IRQ9_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 10 - (INT 72h)
|
||||
.equ IRQ10_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 11 - (INT 73h)
|
||||
.equ IRQ11_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 12 (PS/2 mouse) - (INT 74h)
|
||||
.equ IRQ12_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 13 (Floating point error) - (INT 75h)
|
||||
.equ IRQ13_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 14 (Secondary IDE) - (INT 76h)
|
||||
.equ IRQ14_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 15 (Primary IDE) - (INT 77h)
|
||||
.equ IRQ15_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
IDT_END:
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ MemoryMap: .long 0,0,0,0,0,0,0,0
|
|||
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
#.org 0x0fe0 #Just for pass build
|
||||
#.org 0x0fe0 #Just for pass build
|
||||
MyStack:
|
||||
# below is the pieces of the IVT that is used to redirect INT 68h - 6fh
|
||||
# back to INT 08h - 0fh when in real mode... It is 'org'ed to a
|
||||
|
@ -1148,7 +1148,7 @@ MyStack:
|
|||
iret
|
||||
|
||||
|
||||
#.org 0x0ffe #Just for pass build
|
||||
#.org 0x0ffe #Just for pass build
|
||||
BlockSignature:
|
||||
.word 0xaa55
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
.stack:
|
||||
.486p:
|
||||
.code16
|
||||
|
||||
|
||||
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x020
|
||||
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
|
||||
.equ BLOCK_SIZE, 0x0200
|
||||
|
@ -715,7 +715,7 @@ IDT_BASE:
|
|||
.word 0 # offset 31:16
|
||||
|
||||
# 85 unspecified descriptors, First 12 of them are reserved, the rest are avail
|
||||
.fill 85 * 8, 1, 0 # db (85 * 8) dup(0)
|
||||
.fill 85 * 8, 1, 0 # db (85 * 8) dup(0)
|
||||
|
||||
# IRQ 0 (System timer) - (INT 0x68)
|
||||
.equ IRQ0_SEL, .-IDT_BASE
|
||||
|
|
|
@ -54,7 +54,7 @@ SystemId: .ascii "FAT12 " # SystemId - 8 bytes
|
|||
|
||||
BootSectorEntryPoint:
|
||||
# ASSUME ds:@code"
|
||||
# ASSUME ss:@code"
|
||||
# ASSUME ss:@code"
|
||||
# ds = 1000, es = 2000 + x (size of first cluster >> 4)
|
||||
# cx = Start Cluster of EfiLdr
|
||||
# dx = Start Cluster of Efivar.bin
|
||||
|
@ -74,7 +74,7 @@ BootSectorEntryPoint:
|
|||
NoVarStore:
|
||||
pushw %es
|
||||
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
||||
movb %al, %es:(4)
|
||||
movb %al, %es:(4)
|
||||
jmp SaveVolumeId
|
||||
|
||||
CheckVarStoreSize:
|
||||
|
@ -86,7 +86,7 @@ CheckVarStoreSize:
|
|||
LoadVarStore:
|
||||
movb $0,%al
|
||||
movb %al, %es:(4)
|
||||
movw (%di), %cx
|
||||
movw (%di), %cx
|
||||
# ES:DI = 1500:0
|
||||
xorw %di,%di
|
||||
pushw %es
|
||||
|
@ -98,7 +98,7 @@ SaveVolumeId:
|
|||
movw VolId(%bp), %ax
|
||||
movw %ax, %es:(0)
|
||||
movw VolId+2(%bp), %ax
|
||||
movw %ax, %es:(2)
|
||||
movw %ax, %es:(2)
|
||||
|
||||
# Read Efildr
|
||||
popw %cx
|
||||
|
@ -166,7 +166,7 @@ FatChainLoop:
|
|||
pushw %si # Save si
|
||||
movw %ax,%si # si = FatOffset
|
||||
shrw $BLOCK_SHIFT, %ax # ax = FatOffset >> BLOCK_SHIFT
|
||||
addw ReservedSectors(%bp), %ax # ax = FatSectorNumber = ReservedSectors + (FatOffset >> BLOCK_OFFSET)
|
||||
addw ReservedSectors(%bp), %ax # ax = FatSectorNumber = ReservedSectors + (FatOffset >> BLOCK_OFFSET)
|
||||
andw $BLOCK_MASK, %si # si = FatOffset & BLOCK_MASK
|
||||
cmpw %dx,%ax # Compare FatSectorNumber to CachedFatSectorNumber
|
||||
je SkipFatRead
|
||||
|
@ -178,7 +178,7 @@ FatChainLoop:
|
|||
popw %es
|
||||
movw %ax,%dx # CachedFatSectorNumber = FatSectorNumber
|
||||
SkipFatRead:
|
||||
movw (%si), %bx # bx = NextClusterNumber
|
||||
movw (%si), %bx # bx = NextClusterNumber
|
||||
movw %cx,%ax # ax = ClusterNumber
|
||||
andw $1,%ax # See if this is an odd cluster number
|
||||
je EvenFatEntry
|
||||
|
@ -200,9 +200,9 @@ ReadClusters:
|
|||
movw %bx,%cx # ClusterNumber = NextClusterNumber
|
||||
subw $2,%ax # ax = StartCluster - 2
|
||||
xorb %bh,%bh
|
||||
movb SectorsPerCluster(%bp), %bl # bx = SectorsPerCluster
|
||||
movb SectorsPerCluster(%bp), %bl # bx = SectorsPerCluster
|
||||
mulw %bx # ax = (StartCluster - 2) * SectorsPerCluster
|
||||
addw (%bp), %ax # ax = FirstClusterLBA + (StartCluster-2)*SectorsPerCluster
|
||||
addw (%bp), %ax # ax = FirstClusterLBA + (StartCluster-2)*SectorsPerCluster
|
||||
pushw %ax # save start sector
|
||||
movw %si,%ax # ax = NumberOfClusters
|
||||
mulw %bx # ax = NumberOfClusters * SectorsPerCluster
|
||||
|
@ -243,7 +243,7 @@ ReadCylinderLoop:
|
|||
divl %ebx # ax = StartLBA / MaxSector
|
||||
incw %dx # dx = (StartLBA % MaxSector) + 1
|
||||
|
||||
movw (%bp), %bx # bx = MaxSector
|
||||
movw (%bp), %bx # bx = MaxSector
|
||||
subw %dx,%bx # bx = MaxSector - Sector
|
||||
incw %bx # bx = MaxSector - Sector + 1
|
||||
cmpw %bx,%cx # Compare (Blocks) to (MaxSector - Sector + 1)
|
||||
|
@ -311,11 +311,11 @@ Halt:
|
|||
ErrorString:
|
||||
.byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!',0x0c
|
||||
|
||||
.org 0x01fa
|
||||
.org 0x01fa
|
||||
LBAOffsetForBootSector:
|
||||
.long 0x0
|
||||
|
||||
.org 0x01fe
|
||||
.org 0x01fe
|
||||
.word 0xaa55
|
||||
|
||||
#******************************************************************************
|
||||
|
@ -328,7 +328,7 @@ LBAOffsetForBootSector:
|
|||
.equ WRITE_DATA_PORT_CMD, 0x0d1 # 8042 command to write the data port
|
||||
.equ ENABLE_A20_CMD, 0x0df # 8042 command to enable A20
|
||||
|
||||
.org 0x200
|
||||
.org 0x200
|
||||
jmp start
|
||||
Em64String:
|
||||
.byte 'E', 0x0c, 'm', 0x0c, '6', 0x0c, '4', 0x0c, 'T', 0x0c, ' ', 0x0c, 'U', 0x0c, 'n', 0x0c, 's', 0x0c, 'u', 0x0c, 'p', 0x0c, 'p', 0x0c, 'o', 0x0c, 'r', 0x0c, 't', 0x0c, 'e', 0x0c, 'd', 0x0c, '!', 0x0c
|
||||
|
@ -361,7 +361,7 @@ MemMapLoop:
|
|||
MemMapDone:
|
||||
leal MemoryMap, %eax
|
||||
subl %eax,%edi # Get the address of the memory map
|
||||
movl %edi, MemoryMapSize # Save the size of the memory map
|
||||
movl %edi, MemoryMapSize # Save the size of the memory map
|
||||
|
||||
xorl %ebx,%ebx
|
||||
movw %cs,%bx # BX=segment
|
||||
|
@ -423,7 +423,7 @@ A20GateEnabled:
|
|||
|
||||
leal OffsetIn32BitProtectedMode, %eax
|
||||
addl $0x20000+0x6,%eax
|
||||
movl %eax, OffsetIn32BitProtectedMode
|
||||
movl %eax, OffsetIn32BitProtectedMode
|
||||
|
||||
leal OffsetInLongMode, %eax
|
||||
addl $0x20000+0x6,%eax
|
||||
|
@ -589,7 +589,7 @@ Empty8042Loop:
|
|||
|
||||
.p2align 1
|
||||
|
||||
gdtr: .long GDT_END - GDT_BASE - 1 # GDT limit
|
||||
gdtr: .long GDT_END - GDT_BASE - 1 # GDT limit
|
||||
.long 0 # (GDT base gets set above)
|
||||
##############################################################################
|
||||
# global descriptor table (GDT)
|
||||
|
@ -708,366 +708,366 @@ idtr: .long IDT_END - IDT_BASE - 1 # IDT limit
|
|||
IDT_BASE:
|
||||
# divide by zero (INT 0)
|
||||
.equ DIV_ZERO_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# debug exception (INT 1)
|
||||
.equ DEBUG_EXCEPT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# NMI (INT 2)
|
||||
.equ NMI_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# soft breakpoint (INT 3)
|
||||
.equ BREAKPOINT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# overflow (INT 4)
|
||||
.equ OVERFLOW_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# bounds check (INT 5)
|
||||
.equ BOUNDS_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# invalid opcode (INT 6)
|
||||
.equ INVALID_OPCODE_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# device not available (INT 7)
|
||||
.equ DEV_NOT_AVAIL_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# double fault (INT 8)
|
||||
.equ DOUBLE_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Coprocessor segment overrun - reserved (INT 9)
|
||||
.equ RSVD_INTR_SEL1, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# invalid TSS (INT 0ah)
|
||||
.equ INVALID_TSS_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# segment not present (INT 0bh)
|
||||
.equ SEG_NOT_PRESENT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# stack fault (INT 0ch)
|
||||
.equ STACK_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# general protection (INT 0dh)
|
||||
.equ GP_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# page fault (INT 0eh)
|
||||
.equ PAGE_FAULT_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Intel reserved - do not use (INT 0fh)
|
||||
.equ RSVD_INTR_SEL2, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# floating point error (INT 10h)
|
||||
.equ FLT_POINT_ERR_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# alignment check (INT 11h)
|
||||
.equ ALIGNMENT_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# machine check (INT 12h)
|
||||
.equ MACHINE_CHECK_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# SIMD floating-point exception (INT 13h)
|
||||
.equ SIMD_EXCEPTION_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# 85 unspecified descriptors, First 12 of them are reserved, the rest are avail
|
||||
.fill 85 * 16, 1, 0 # db (85 * 16) dup(0)
|
||||
.fill 85 * 16, 1, 0 # db (85 * 16) dup(0)
|
||||
|
||||
# IRQ 0 (System timer) - (INT 68h)
|
||||
.equ IRQ0_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 1 (8042 Keyboard controller) - (INT 69h)
|
||||
.equ IRQ1_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# Reserved - IRQ 2 redirect (IRQ 2) - DO NOT USE!!! - (INT 6ah)
|
||||
.equ IRQ2_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 3 (COM 2) - (INT 6bh)
|
||||
.equ IRQ3_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 4 (COM 1) - (INT 6ch)
|
||||
.equ IRQ4_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 5 (LPT 2) - (INT 6dh)
|
||||
.equ IRQ5_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 6 (Floppy controller) - (INT 6eh)
|
||||
.equ IRQ6_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 7 (LPT 1) - (INT 6fh)
|
||||
.equ IRQ7_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 8 (RTC Alarm) - (INT 70h)
|
||||
.equ IRQ8_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 9 - (INT 71h)
|
||||
.equ IRQ9_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 10 - (INT 72h)
|
||||
.equ IRQ10_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 11 - (INT 73h)
|
||||
.equ IRQ11_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 12 (PS/2 mouse) - (INT 74h)
|
||||
.equ IRQ12_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 13 (Floating point error) - (INT 75h)
|
||||
.equ IRQ13_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 14 (Secondary IDE) - (INT 76h)
|
||||
.equ IRQ14_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
# IRQ 15 (Primary IDE) - (INT 77h)
|
||||
.equ IRQ15_SEL, .-IDT_BASE
|
||||
.word 0 # offset 15:0
|
||||
.word 0 # offset 15:0
|
||||
.long SYS_CODE64_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # type = 386 interrupt gate, present
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
.word 0 # offset 31:16
|
||||
.long 0 # offset 63:32
|
||||
.long 0 # 0 for reserved
|
||||
|
||||
IDT_END:
|
||||
|
||||
|
@ -1108,7 +1108,7 @@ MemoryMap: .long 0,0,0,0,0,0,0,0
|
|||
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
.org 0x0fe0
|
||||
.org 0x0fe0
|
||||
MyStack:
|
||||
# below is the pieces of the IVT that is used to redirect INT 68h - 6fh
|
||||
# back to INT 08h - 0fh when in real mode... It is 'org'ed to a
|
||||
|
@ -1140,7 +1140,7 @@ MyStack:
|
|||
iret
|
||||
|
||||
|
||||
.org 0x0ffe
|
||||
.org 0x0ffe
|
||||
BlockSignature:
|
||||
.word 0xaa55
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
#EXTERN ExceptionHandler: NEAR
|
||||
#EXTERN mTimerVector: DWORD
|
||||
|
||||
.data
|
||||
ASM_GLOBAL ASM_PFX(mExceptionCodeSize)
|
||||
.data
|
||||
ASM_GLOBAL ASM_PFX(mExceptionCodeSize)
|
||||
ASM_PFX(mExceptionCodeSize): .long 9
|
||||
|
||||
.text
|
||||
ASM_GLOBAL ASM_PFX(InitDescriptor)
|
||||
.text
|
||||
ASM_GLOBAL ASM_PFX(InitDescriptor)
|
||||
|
||||
ASM_PFX(InitDescriptor):
|
||||
movl $GDT_BASE,%eax # EAX=PHYSICAL address of gdt
|
||||
|
@ -44,7 +44,7 @@ ASM_PFX(InitDescriptor):
|
|||
# UINTN Vector,
|
||||
# VOID (*Handler)(VOID)
|
||||
# )
|
||||
ASM_GLOBAL ASM_PFX(InstallInterruptHandler)
|
||||
ASM_GLOBAL ASM_PFX(InstallInterruptHandler)
|
||||
ASM_PFX(InstallInterruptHandler):
|
||||
# Vector:DWORD @ 4(%esp)
|
||||
# Handler:DWORD @ 8(%esp)
|
||||
|
@ -68,7 +68,7 @@ ASM_PFX(InstallInterruptHandler):
|
|||
pop %edi
|
||||
ret
|
||||
|
||||
.macro JmpCommonIdtEntry
|
||||
.macro JmpCommonIdtEntry
|
||||
# jmp commonIdtEntry - this must be hand coded to keep the assembler from
|
||||
# using a 8 bit reletive jump when the entries are
|
||||
# within 255 bytes of the common entry. This must
|
||||
|
@ -76,10 +76,10 @@ ASM_PFX(InstallInterruptHandler):
|
|||
# of entry points...
|
||||
.byte 0xe9 # jmp 16 bit reletive
|
||||
.long commonIdtEntry - . - 4 # offset to jump to
|
||||
.endm
|
||||
.endm
|
||||
|
||||
.p2align 1
|
||||
ASM_GLOBAL ASM_PFX(SystemExceptionHandler)
|
||||
ASM_GLOBAL ASM_PFX(SystemExceptionHandler)
|
||||
ASM_PFX(SystemExceptionHandler):
|
||||
INT0:
|
||||
pushl $0x0 # push error code place holder on the stack
|
||||
|
@ -198,15 +198,15 @@ INT19:
|
|||
JmpCommonIdtEntry
|
||||
|
||||
INTUnknown:
|
||||
.rept (32 - 20)
|
||||
.rept (32 - 20)
|
||||
pushl $0x0 # push error code place holder on the stack
|
||||
# push xxh # push vector number
|
||||
.byte 0x6a
|
||||
.byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
|
||||
JmpCommonIdtEntry
|
||||
.endr
|
||||
.endr
|
||||
|
||||
ASM_GLOBAL ASM_PFX(SystemTimerHandler)
|
||||
ASM_GLOBAL ASM_PFX(SystemTimerHandler)
|
||||
ASM_PFX(SystemTimerHandler):
|
||||
pushl $0
|
||||
pushl $ASM_PFX(mTimerVector)
|
||||
|
@ -417,10 +417,10 @@ ExceptionDone:
|
|||
# data
|
||||
#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
.data
|
||||
.data
|
||||
.p2align 2
|
||||
|
||||
gdtr: .short GDT_END - GDT_BASE - 1 # GDT limit
|
||||
gdtr: .short GDT_END - GDT_BASE - 1 # GDT limit
|
||||
.long 0 # (GDT base gets set above)
|
||||
#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
# global descriptor table (GDT)
|
||||
|
@ -507,7 +507,7 @@ GDT_END:
|
|||
|
||||
|
||||
|
||||
idtr: .short IDT_END - IDT_BASE - 1 # IDT limit
|
||||
idtr: .short IDT_END - IDT_BASE - 1 # IDT limit
|
||||
.long 0 # (IDT base gets set above)
|
||||
#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
# interrupt descriptor table (IDT)
|
||||
|
@ -682,16 +682,16 @@ SIMD_EXCEPTION_SEL = .-IDT_BASE
|
|||
.byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present
|
||||
.short 0 # offset 31:16
|
||||
|
||||
.rept (32 - 20)
|
||||
.rept (32 - 20)
|
||||
.short 0 # offset 15:0
|
||||
.short SYS_CODE_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present
|
||||
.short 0 # offset 31:16
|
||||
.endr
|
||||
.endr
|
||||
|
||||
# 72 unspecified descriptors
|
||||
.fill 72 * 8, 1, 0
|
||||
.fill 72 * 8, 1, 0
|
||||
|
||||
# IRQ 0 (System timer) - (INT 0x68)
|
||||
IRQ0_SEL = .-IDT_BASE
|
||||
|
@ -821,7 +821,7 @@ IRQ15_SEL = .-IDT_BASE
|
|||
.byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present
|
||||
.short 0 # offset 31:16
|
||||
|
||||
.fill 1 * 8, 1, 0
|
||||
.fill 1 * 8, 1, 0
|
||||
|
||||
IDT_END:
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
#EXTERN ExceptionHandler: NEAR
|
||||
#EXTERN mTimerVector: DWORD
|
||||
|
||||
.data
|
||||
ASM_GLOBAL ASM_PFX(mExceptionCodeSize)
|
||||
.data
|
||||
ASM_GLOBAL ASM_PFX(mExceptionCodeSize)
|
||||
ASM_PFX(mExceptionCodeSize): .long 9
|
||||
|
||||
.text
|
||||
ASM_GLOBAL ASM_PFX(InitDescriptor)
|
||||
.text
|
||||
ASM_GLOBAL ASM_PFX(InitDescriptor)
|
||||
|
||||
ASM_PFX(InitDescriptor):
|
||||
movq $GDT_BASE,%rax # EAX=PHYSICAL address of gdt
|
||||
|
@ -47,7 +47,7 @@ ASM_PFX(InitDescriptor):
|
|||
# UINTN Vector,
|
||||
# VOID (*Handler)(VOID)
|
||||
# )
|
||||
ASM_GLOBAL ASM_PFX(InstallInterruptHandler)
|
||||
ASM_GLOBAL ASM_PFX(InstallInterruptHandler)
|
||||
ASM_PFX(InstallInterruptHandler):
|
||||
# Vector:DWORD @ 4(%esp)
|
||||
# Handler:DWORD @ 8(%esp)
|
||||
|
@ -73,7 +73,7 @@ ASM_PFX(InstallInterruptHandler):
|
|||
pop %rbx
|
||||
ret
|
||||
|
||||
.macro JmpCommonIdtEntry
|
||||
.macro JmpCommonIdtEntry
|
||||
# jmp commonIdtEntry - this must be hand coded to keep the assembler from
|
||||
# using a 8 bit reletive jump when the entries are
|
||||
# within 255 bytes of the common entry. This must
|
||||
|
@ -81,10 +81,10 @@ ASM_PFX(InstallInterruptHandler):
|
|||
# of entry points...
|
||||
.byte 0xe9 # jmp 16 bit reletive
|
||||
.long commonIdtEntry - . - 4 # offset to jump to
|
||||
.endm
|
||||
.endm
|
||||
|
||||
.p2align 1
|
||||
ASM_GLOBAL ASM_PFX(SystemExceptionHandler)
|
||||
ASM_GLOBAL ASM_PFX(SystemExceptionHandler)
|
||||
ASM_PFX(SystemExceptionHandler):
|
||||
INT0:
|
||||
push $0x0 # push error code place holder on the stack
|
||||
|
@ -203,15 +203,15 @@ INT19:
|
|||
JmpCommonIdtEntry
|
||||
|
||||
INTUnknown:
|
||||
.rept (32 - 20)
|
||||
.rept (32 - 20)
|
||||
push $0x0 # push error code place holder on the stack
|
||||
# push xxh # push vector number
|
||||
.byte 0x6a
|
||||
.byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
|
||||
JmpCommonIdtEntry
|
||||
.endr
|
||||
.endr
|
||||
|
||||
ASM_GLOBAL ASM_PFX(SystemTimerHandler)
|
||||
ASM_GLOBAL ASM_PFX(SystemTimerHandler)
|
||||
ASM_PFX(SystemTimerHandler):
|
||||
push $0
|
||||
push $ASM_PFX(mTimerVector)
|
||||
|
@ -452,10 +452,10 @@ ExceptionDone:
|
|||
# data
|
||||
##############################################################################
|
||||
|
||||
.data
|
||||
.data
|
||||
.p2align 4
|
||||
|
||||
gdtr: .short GDT_END - GDT_BASE - 1 # GDT limit
|
||||
gdtr: .short GDT_END - GDT_BASE - 1 # GDT limit
|
||||
.quad 0 # (GDT base gets set above)
|
||||
##############################################################################
|
||||
# global descriptor table (GDT)
|
||||
|
@ -542,7 +542,7 @@ GDT_END:
|
|||
|
||||
|
||||
|
||||
idtr: .short IDT_END - IDT_BASE - 1 # IDT limit
|
||||
idtr: .short IDT_END - IDT_BASE - 1 # IDT limit
|
||||
.quad 0 # (IDT base gets set above)
|
||||
##############################################################################
|
||||
# interrupt descriptor table (IDT)
|
||||
|
@ -717,16 +717,16 @@ SIMD_EXCEPTION_SEL = .-IDT_BASE
|
|||
.byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present
|
||||
.short 0 # offset 31:16
|
||||
|
||||
.rept (32 - 20)
|
||||
.rept (32 - 20)
|
||||
.short 0 # offset 15:0
|
||||
.short SYS_CODE_SEL # selector 15:0
|
||||
.byte 0 # 0 for interrupt gate
|
||||
.byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present
|
||||
.short 0 # offset 31:16
|
||||
.endr
|
||||
.endr
|
||||
|
||||
# 72 unspecified descriptors
|
||||
.fill 72 * 8, 1, 0
|
||||
.fill 72 * 8, 1, 0
|
||||
|
||||
# IRQ 0 (System timer) - (INT 0x68)
|
||||
IRQ0_SEL = .-IDT_BASE
|
||||
|
@ -856,7 +856,7 @@ IRQ15_SEL = .-IDT_BASE
|
|||
.byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present
|
||||
.short 0 # offset 31:16
|
||||
|
||||
.fill 16, 1, 0
|
||||
.fill 16, 1, 0
|
||||
|
||||
IDT_END:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
Copyright (c) 2006 - 2009, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -47,7 +47,7 @@ VARIABLE_GLOBAL *mGlobal;
|
|||
|
||||
@param[in] DataSize Size of data. 0 means delete
|
||||
|
||||
@param[in] Attributes Attribues of the variable
|
||||
@param[in] Attributes Attribues of the variable
|
||||
|
||||
@param[in] Variable The variable information which is used to keep track of variable usage.
|
||||
|
||||
|
@ -829,7 +829,7 @@ AutoUpdateLangVariable(
|
|||
|
||||
@param[in] DataSize Size of data. 0 means delete
|
||||
|
||||
@param[in] Attributes Attribues of the variable
|
||||
@param[in] Attributes Attribues of the variable
|
||||
|
||||
@param[in] Variable The variable information which is used to keep track of variable usage.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#/*++
|
||||
#
|
||||
# Copyright (c) 2006 - 2007, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -64,4 +64,4 @@
|
|||
[Pcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
Copyright (c) 2006 - 2009, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -132,12 +132,12 @@ BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
|
|||
// (CONSOLE_IN | STD_ERROR)
|
||||
// },
|
||||
// {
|
||||
// (EFI_DEVICE_PATH_PROTOCOL *) &gDummyPciVgaDevicePath,
|
||||
// CONSOLE_OUT
|
||||
// (EFI_DEVICE_PATH_PROTOCOL *) &gDummyPciVgaDevicePath,
|
||||
// CONSOLE_OUT
|
||||
// },
|
||||
// {
|
||||
// (EFI_DEVICE_PATH_PROTOCOL *) &gDummyPciSerialDevicePath,
|
||||
// (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
|
||||
// (EFI_DEVICE_PATH_PROTOCOL *) &gDummyPciSerialDevicePath,
|
||||
// (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
|
||||
// },
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL*) &gUsbClassKeyboardDevicePath,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# and ITC could be programmed by OS, it cannot be used by SMM drivers
|
||||
# and runtime drivers, ACPI timer is recommended for SMM drivers and RUNTIME
|
||||
# drivers.
|
||||
# Copyright (c) 2007, Intel Corporation.
|
||||
# Copyright (c) 2007 - 2009, Intel Corporation.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -53,4 +53,4 @@
|
|||
[Guids]
|
||||
gEfiAcpiDescriptionGuid
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2005 - 2007, Intel Corporation
|
||||
Copyright (c) 2005 - 2009, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -994,7 +994,7 @@ Returns:
|
|||
Data = Value;
|
||||
Index = 0;
|
||||
for (Data = Value; Data != 0; Data >>= 1) {
|
||||
Index ++;
|
||||
Index ++;
|
||||
}
|
||||
Value |= ((UINT32)(-1) << Index);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2005 - 2007, Intel Corporation
|
||||
Copyright (c) 2005 - 2009, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -571,7 +571,7 @@ Returns:
|
|||
PCI_IO_DEVICE *PciIoDevice;
|
||||
|
||||
if (Buffer == NULL){
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
|
||||
|
@ -624,7 +624,7 @@ Returns:
|
|||
PCI_IO_DEVICE *PciIoDevice;
|
||||
|
||||
if (Buffer == NULL){
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
|
||||
|
@ -677,7 +677,7 @@ Returns:
|
|||
PCI_IO_DEVICE *PciIoDevice;
|
||||
|
||||
if (Buffer == NULL){
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
|
||||
|
@ -730,7 +730,7 @@ Returns:
|
|||
PCI_IO_DEVICE *PciIoDevice;
|
||||
|
||||
if (Buffer == NULL){
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
|
||||
|
@ -1074,7 +1074,7 @@ Returns:
|
|||
PCI_IO_DEVICE *PciIoDevice;
|
||||
|
||||
if( HostAddress == NULL ){
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
|
||||
|
@ -1282,21 +1282,21 @@ Returns:
|
|||
return EFI_SUCCESS;
|
||||
|
||||
case EfiPciIoAttributeOperationEnable:
|
||||
if(Attributes & ~(PciIoDevice->Supports)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
NewAttributes = PciIoDevice->Attributes | Attributes;
|
||||
if(Attributes & ~(PciIoDevice->Supports)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
NewAttributes = PciIoDevice->Attributes | Attributes;
|
||||
break;
|
||||
case EfiPciIoAttributeOperationDisable:
|
||||
if(Attributes & ~(PciIoDevice->Supports)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
if(Attributes & ~(PciIoDevice->Supports)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
NewAttributes = PciIoDevice->Attributes & (~Attributes);
|
||||
break;
|
||||
case EfiPciIoAttributeOperationSet:
|
||||
if(Attributes & ~(PciIoDevice->Supports)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
if(Attributes & ~(PciIoDevice->Supports)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
NewAttributes = Attributes;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2005, Intel Corporation
|
||||
Copyright (c) 2005 - 2009, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -59,8 +59,8 @@ PcatRootBridgeIoIoRead (
|
|||
)
|
||||
{
|
||||
PCAT_PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
|
||||
UINTN InStride;
|
||||
UINTN OutStride;
|
||||
UINTN InStride;
|
||||
UINTN OutStride;
|
||||
UINTN AlignMask;
|
||||
UINTN Address;
|
||||
PTR Buffer;
|
||||
|
@ -163,9 +163,9 @@ PcatRootBridgeIoIoWrite (
|
|||
)
|
||||
{
|
||||
PCAT_PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
|
||||
UINTN InStride;
|
||||
UINTN OutStride;
|
||||
UINTN AlignMask;
|
||||
UINTN InStride;
|
||||
UINTN OutStride;
|
||||
UINTN AlignMask;
|
||||
UINTN Address;
|
||||
PTR Buffer;
|
||||
UINT16 Data16;
|
||||
|
@ -318,9 +318,9 @@ PcatRootBridgeIoPciRW (
|
|||
)
|
||||
{
|
||||
PCAT_PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
|
||||
UINTN AlignMask;
|
||||
UINTN InStride;
|
||||
UINTN OutStride;
|
||||
UINTN AlignMask;
|
||||
UINTN InStride;
|
||||
UINTN OutStride;
|
||||
UINT64 Address;
|
||||
DEFIO_PCI_ADDR *Defio;
|
||||
PTR Buffer;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2005 - 2008, Intel Corporation
|
||||
Copyright (c) 2005 - 2009, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -43,7 +43,7 @@ Returns:
|
|||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
PCAT_PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
|
||||
UINTN PciSegmentIndex;
|
||||
UINTN PciRootBridgeIndex;
|
||||
|
@ -93,7 +93,7 @@ Returns:
|
|||
PrivateData->Signature = PCAT_PCI_ROOT_BRIDGE_SIGNATURE;
|
||||
PrivateData->Handle = NULL;
|
||||
PrivateData->DevicePath = NULL;
|
||||
InitializeListHead (&PrivateData->MapInfo);
|
||||
InitializeListHead (&PrivateData->MapInfo);
|
||||
|
||||
//
|
||||
// Initialize the PCI root bridge number and the bus range for that root bridge
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2005 - 2008, Intel Corporation
|
||||
Copyright (c) 2005 - 2009, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -202,7 +202,7 @@ PcatRootBridgeIoMemRW (
|
|||
|
||||
EFI_STATUS
|
||||
PcatRootBridgeIoConstructor (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Protocol,
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Protocol,
|
||||
IN UINTN SegmentNumber
|
||||
)
|
||||
/*++
|
||||
|
@ -707,7 +707,7 @@ PcatRootBridgeIoMap (
|
|||
}
|
||||
|
||||
|
||||
Status =gBS->AllocatePool (
|
||||
Status =gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
sizeof(MAP_INFO_INSTANCE),
|
||||
(VOID **)&MapInstance
|
||||
|
@ -723,7 +723,7 @@ PcatRootBridgeIoMap (
|
|||
PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS(This);
|
||||
InsertTailList(&PrivateData->MapInfo,&MapInstance->Link);
|
||||
|
||||
//
|
||||
//
|
||||
// The DeviceAddress is the address of the maped buffer below 4GB
|
||||
//
|
||||
*DeviceAddress = MapInfo->MappedHostAddress;
|
||||
|
@ -770,14 +770,14 @@ PcatRootBridgeIoUnmap (
|
|||
//
|
||||
MapInfo = (MAP_INFO *)Mapping;
|
||||
|
||||
for (Link = PrivateData->MapInfo.ForwardLink; Link != &PrivateData->MapInfo; Link = Link->ForwardLink) {
|
||||
if (((MAP_INFO_INSTANCE*)Link)->Map == MapInfo)
|
||||
break;
|
||||
for (Link = PrivateData->MapInfo.ForwardLink; Link != &PrivateData->MapInfo; Link = Link->ForwardLink) {
|
||||
if (((MAP_INFO_INSTANCE*)Link)->Map == MapInfo)
|
||||
break;
|
||||
}
|
||||
|
||||
if (Link == &PrivateData->MapInfo) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
RemoveEntryList(Link);
|
||||
((MAP_INFO_INSTANCE*)Link)->Map = NULL;
|
||||
|
@ -872,7 +872,7 @@ PcatRootBridgeIoFreeBuffer (
|
|||
{
|
||||
|
||||
if( HostAddress == NULL ){
|
||||
return EFI_INVALID_PARAMETER;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
return gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress, Pages);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue