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