]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/BootSector/st32_64.S
Use .p2align directive instead of ambiguous .align directive.
[mirror_edk2.git] / DuetPkg / BootSector / st32_64.S
CommitLineData
f3eb2131 1#------------------------------------------------------------------------------\r
2#*\r
3#* Copyright 2006 - 2007, Intel Corporation \r
4#* All rights reserved. This program and the accompanying materials \r
5#* are licensed and made available under the terms and conditions of the BSD License \r
6#* which accompanies this distribution. The full text of the license may be found at \r
7#* http://opensource.org/licenses/bsd-license.php \r
8#* \r
9#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11#* \r
12#* st32_64.asm\r
13#* \r
14#* Abstract:\r
15#*\r
16#------------------------------------------------------------------------------\r
17\r
18\r
19 .stack: \r
20 .486p: \r
21 .code16\r
22\r
e343d447 23.equ FAT_DIRECTORY_ENTRY_SIZE, 0x020\r
24.equ FAT_DIRECTORY_ENTRY_SHIFT, 5\r
25.equ BLOCK_SIZE, 0x0200\r
26.equ BLOCK_MASK, 0x01ff\r
f3eb2131 27.equ BLOCK_SHIFT, 9\r
28\r
29 .org 0x0\r
30Ia32Jump: \r
31 jmp BootSectorEntryPoint # JMP inst - 3 bytes\r
32 nop\r
33\r
e343d447 34OemId: .ascii "INTEL " # OemId - 8 bytes\r
35SectorSize: .word 0 # Sector Size - 2 bytes\r
36SectorsPerCluster: .byte 0 # Sector Per Cluster - 1 byte\r
37ReservedSectors: .word 0 # Reserved Sectors - 2 bytes\r
38NoFats: .byte 0 # Number of FATs - 1 byte\r
39RootEntries: .word 0 # Root Entries - 2 bytes\r
40Sectors: .word 0 # Number of Sectors - 2 bytes\r
41Media: .byte 0 # Media - 1 byte\r
42SectorsPerFat16: .word 0 # Sectors Per FAT for FAT12/FAT16 - 2 byte\r
43SectorsPerTrack: .word 0 # Sectors Per Track - 2 bytes\r
44Heads: .word 0 # Heads - 2 bytes\r
45HiddenSectors: .long 0 # Hidden Sectors - 4 bytes\r
46LargeSectors: .long 0 # Large Sectors - 4 bytes\r
47\r
48#******************************************************************************\r
49#\r
50#The structure for FAT32 starting at offset 36 of the boot sector. (At this point, \r
51#the BPB/boot sector for FAT12 and FAT16 differs from the BPB/boot sector for FAT32.)\r
52#\r
53#******************************************************************************\r
54\r
55SectorsPerFat32: .long 0 # Sectors Per FAT for FAT32 - 4 bytes\r
56ExtFlags: .word 0 # Mirror Flag - 2 bytes\r
57FSVersion: .word 0 # File System Version - 2 bytes\r
58RootCluster: .long 0 # 1st Cluster Number of Root Dir - 4 bytes\r
59FSInfo: .word 0 # Sector Number of FSINFO - 2 bytes\r
60BkBootSector: .word 0 # Sector Number of Bk BootSector - 2 bytes\r
61Reserved: .fill 12,1,0 # Reserved Field - 12 bytes\r
62PhysicalDrive: .byte 0 # Physical Drive Number - 1 byte\r
63Reserved1: .byte 0 # Reserved Field - 1 byte\r
64Signature: .byte 0 # Extended Boot Signature - 1 byte\r
65VolId: .ascii " " # Volume Serial Number - 4 bytes\r
66FatLabel: .ascii " " # Volume Label - 11 bytes\r
67FileSystemType: .ascii "FAT32 " # File System Type - 8 bytes\r
68\r
f3eb2131 69\r
70BootSectorEntryPoint: \r
71 # ASSUME ds:@code\r
72 # ASSUME ss:@code\r
73 # ds = 1000, es = 2000 + x (size of first cluster >> 4)\r
74 # cx = Start Cluster of EfiLdr\r
75 # dx = Start Cluster of Efivar.bin\r
76\r
77# Re use the BPB data stored in Boot Sector\r
78 movw $0x7c00,%bp\r
79\r
80 pushw %cx\r
81# Read Efivar.bin\r
82# 1000:dx = DirectoryEntry of Efivar.bin -> BS.com has filled already\r
83 movw $0x1900,%ax\r
84 movw %ax,%es\r
85 testw %dx,%dx\r
86 jnz CheckVarStoreSize\r
87\r
88 movb $1,%al\r
89NoVarStore: \r
90 pushw %es\r
91# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl\r
92 movb %al, %es:(4)\r
93 jmp SaveVolumeId\r
94\r
95CheckVarStoreSize: \r
96 movw %dx,%di\r
97 cmpl $0x4000, %ds:2(%di)\r
98 movb $2,%al\r
99 jne NoVarStore\r
100\r
101LoadVarStore: \r
102 movb $0,%al\r
e343d447 103 movb %al, %es:(4)\r
f3eb2131 104 movw (%di), %cx\r
105# ES:DI = 1500:0\r
106 xorw %di,%di\r
107 pushw %es\r
108 movw $0x1500,%ax\r
109 movw %ax,%es\r
110 call ReadFile\r
111SaveVolumeId: \r
112 popw %es\r
e343d447 113 movw VolId(%bp), %ax\r
114 movw %ax, %es:(0) # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId\r
115 movw VolId+2(%bp), %ax\r
f3eb2131 116 movw %ax, %es:(2)\r
117\r
118# Read Efildr\r
119 popw %cx\r
120# cx = Start Cluster of Efildr -> BS.com has filled already\r
121# ES:DI = 2000:0, first cluster will be read again\r
122 xorw %di,%di # di = 0\r
123 movw $0x2000,%ax\r
124 movw %ax,%es\r
125 call ReadFile\r
126 movw %cs,%ax\r
127 movw %ax, %cs:JumpSegment\r
128\r
129CheckEm64T: \r
130 movl $0x80000001,%eax\r
131# cpuid\r
132 .word 0xA20F\r
133 btl $29,%edx\r
134 jc CheckEm64TPass\r
135 pushw %cs\r
136 popw %ds\r
137 leaw Em64String,%si\r
138 movw $18,%cx\r
139 jmp PrintStringAndHalt\r
140CheckEm64TPass: \r
141jumpFarInstruction: \r
142 .byte 0xea\r
143jumpOffset: \r
144 .word 0x200\r
145jumpSegment: \r
146 .word 0x2000\r
147\r
148\r
149\r
150# ****************************************************************************\r
151# ReadFile\r
152#\r
153# Arguments:\r
154# CX = Start Cluster of File\r
155# ES:DI = Buffer to store file content read from disk\r
156#\r
157# Return:\r
158# (ES << 4 + DI) = end of file content Buffer\r
159#\r
160# ****************************************************************************\r
161ReadFile: \r
162# si = NumberOfClusters\r
163# cx = ClusterNumber\r
164# dx = CachedFatSectorNumber\r
165# ds:0000 = CacheFatSectorBuffer\r
166# es:di = Buffer to load file\r
167# bx = NextClusterNumber\r
168 pusha\r
169 movw $1,%si # NumberOfClusters = 1\r
170 pushw %cx # Push Start Cluster onto stack\r
171 movw $0xfff,%dx # CachedFatSectorNumber = 0xfff\r
172FatChainLoop: \r
173 movw %cx,%ax # ax = ClusterNumber \r
174 andw $0xfff8,%ax # ax = ax & 0xfff8\r
175 cmpw $0xfff8,%ax # See if this is the last cluster\r
176 je FoundLastCluster # Jump if last cluster found\r
177 movw %cx,%ax # ax = ClusterNumber\r
178 shlw $2, %ax # FatOffset = ClusterNumber * 2\r
179 pushw %si # Save si\r
180 movw %ax,%si # si = FatOffset\r
181 shrw $BLOCK_SHIFT, %ax # ax = FatOffset >> BLOCK_SHIFT\r
182 addw ReservedSectors(%bp), %ax # ax = FatSectorNumber = ReservedSectors + (FatOffset >> BLOCK_OFFSET)\r
183 andw $BLOCK_MASK, %si # si = FatOffset & BLOCK_MASK\r
184 cmpw %dx,%ax # Compare FatSectorNumber to CachedFatSectorNumber\r
185 je SkipFatRead\r
186 movw $2,%bx\r
187 pushw %es\r
188 pushw %ds\r
189 popw %es\r
190 call ReadBlocks # Read 2 blocks starting at AX storing at ES:DI\r
191 popw %es\r
192 movw %ax,%dx # CachedFatSectorNumber = FatSectorNumber\r
193SkipFatRead: \r
194 movw (%si), %bx # bx = NextClusterNumber\r
195 movw %cx,%ax # ax = ClusterNumber\r
196 popw %si # Restore si\r
197 decw %bx # bx = NextClusterNumber - 1\r
198 cmpw %cx,%bx # See if (NextClusterNumber-1)==ClusterNumber\r
199 jne ReadClusters\r
200 incw %bx # bx = NextClusterNumber\r
201 incw %si # NumberOfClusters++\r
202 movw %bx,%cx # ClusterNumber = NextClusterNumber\r
203 jmp FatChainLoop\r
204ReadClusters: \r
205 incw %bx\r
206 popw %ax # ax = StartCluster\r
207 pushw %bx # StartCluster = NextClusterNumber\r
208 movw %bx,%cx # ClusterNumber = NextClusterNumber\r
209 subw $2,%ax # ax = StartCluster - 2\r
210 xorb %bh,%bh\r
211 movb SectorsPerCluster(%bp), %bl # bx = SectorsPerCluster\r
212 mulw %bx # ax = (StartCluster - 2) * SectorsPerCluster\r
213 addw (%bp), %ax # ax = FirstClusterLBA + (StartCluster-2)*SectorsPerCluster\r
214 pushw %ax # save start sector\r
215 movw %si,%ax # ax = NumberOfClusters\r
216 mulw %bx # ax = NumberOfClusters * SectorsPerCluster\r
217 movw %ax,%bx # bx = Number of Sectors\r
218 popw %ax # ax = Start Sector\r
219 call ReadBlocks\r
220 movw $1,%si # NumberOfClusters = 1\r
221 jmp FatChainLoop\r
222FoundLastCluster: \r
223 popw %cx\r
224 popa\r
225 ret\r
226\r
227\r
228# ****************************************************************************\r
229# ReadBlocks - Reads a set of blocks from a block device\r
230#\r
231# AX = Start LBA\r
232# BX = Number of Blocks to Read\r
233# ES:DI = Buffer to store sectors read from disk\r
234# ****************************************************************************\r
235\r
236# cx = Blocks\r
237# bx = NumberOfBlocks\r
238# si = StartLBA\r
239\r
240ReadBlocks: \r
241 pusha\r
e343d447 242 addl LBAOffsetForBootSector(%bp), %eax # Add LBAOffsetForBootSector to Start LBA\r
f3eb2131 243 addl HiddenSectors(%bp), %eax # Add HiddenSectors to Start LBA\r
244 movl %eax,%esi # esi = Start LBA\r
245 movw %bx,%cx # cx = Number of blocks to read\r
246ReadCylinderLoop: \r
247 movw $0x7bfc,%bp # bp = 0x7bfc\r
248 movl %esi,%eax # eax = Start LBA\r
249 xorl %edx,%edx # edx = 0\r
250 movzwl (%bp), %ebx # bx = MaxSector\r
251 divl %ebx # ax = StartLBA / MaxSector\r
252 incw %dx # dx = (StartLBA % MaxSector) + 1\r
253\r
254 movw (%bp), %bx # bx = MaxSector\r
255 subw %dx,%bx # bx = MaxSector - Sector\r
256 incw %bx # bx = MaxSector - Sector + 1\r
257 cmpw %bx,%cx # Compare (Blocks) to (MaxSector - Sector + 1)\r
258 jg LimitTransfer\r
259 movw %cx,%bx # bx = Blocks\r
260LimitTransfer: \r
261 pushw %ax # save ax\r
262 movw %es,%ax # ax = es\r
263 shrw $(BLOCK_SHIFT-4), %ax # ax = Number of blocks into mem system\r
264 andw $0x7f,%ax # ax = Number of blocks into current seg\r
265 addw %bx,%ax # ax = End Block number of transfer\r
266 cmpw $0x80,%ax # See if it crosses a 64K boundry\r
267 jle NotCrossing64KBoundry # Branch if not crossing 64K boundry\r
268 subw $0x80,%ax # ax = Number of blocks past 64K boundry\r
269 subw %ax,%bx # Decrease transfer size by block overage\r
270NotCrossing64KBoundry: \r
271 popw %ax # restore ax\r
272\r
273 pushw %cx\r
274 movb %dl,%cl # cl = (StartLBA % MaxSector) + 1 = Sector\r
275 xorw %dx,%dx # dx = 0\r
e343d447 276 divw 2(%bp) # ax = ax / (MaxHead + 1) = Cylinder \r
f3eb2131 277 # dx = ax % (MaxHead + 1) = Head\r
278\r
279 pushw %bx # Save number of blocks to transfer\r
280 movb %dl,%dh # dh = Head\r
281 movw $0x7c00,%bp # bp = 0x7c00\r
282 movb PhysicalDrive(%bp), %dl # dl = Drive Number\r
283 movb %al,%ch # ch = Cylinder\r
284 movb %bl,%al # al = Blocks\r
285 movb $2,%ah # ah = Function 2\r
286 movw %di,%bx # es:bx = Buffer address\r
287 int $0x13\r
288 jc DiskError\r
289 popw %bx\r
290 popw %cx\r
291 movzwl %bx,%ebx\r
292 addl %ebx,%esi # StartLBA = StartLBA + NumberOfBlocks\r
293 subw %bx,%cx # Blocks = Blocks - NumberOfBlocks\r
294 movw %es,%ax\r
295 shlw $(BLOCK_SHIFT-4), %bx\r
296 addw %bx,%ax\r
297 movw %ax,%es # es:di = es:di + NumberOfBlocks*BLOCK_SIZE\r
298 cmpw $0,%cx\r
299 jne ReadCylinderLoop\r
300 popa\r
301 ret\r
302\r
303DiskError: \r
304 pushw %cs\r
305 popw %ds\r
306 leaw ErrorString,%si\r
307 movw $7,%cx\r
308 jmp PrintStringAndHalt\r
309\r
310PrintStringAndHalt: \r
311 movw $0xb800,%ax\r
312 movw %ax,%es\r
313 movw $160,%di\r
314 rep\r
315 movsw\r
316Halt: \r
317 jmp Halt\r
318\r
e343d447 319ErrorString: \r
f3eb2131 320 .byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!',0x0c\r
321\r
322 .org 0x01fa\r
323LBAOffsetForBootSector: \r
324 .long 0x0\r
325\r
326 .org 0x01fe\r
327 .word 0xaa55\r
328\r
329#******************************************************************************\r
330#******************************************************************************\r
331#******************************************************************************\r
332\r
333.equ DELAY_PORT, 0x0ed # Port to use for 1uS delay\r
334.equ KBD_CONTROL_PORT, 0x060 # 8042 control port \r
335.equ KBD_STATUS_PORT, 0x064 # 8042 status port \r
336.equ WRITE_DATA_PORT_CMD, 0x0d1 # 8042 command to write the data port\r
337.equ ENABLE_A20_CMD, 0x0df # 8042 command to enable A20\r
338\r
339 .org 0x200\r
340 jmp start\r
341Em64String: \r
342.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\r
343\r
344start: \r
345 movw %cs,%ax\r
346 movw %ax,%ds\r
347 movw %ax,%es\r
348 movw %ax,%ss\r
349 movw $MyStack, %sp\r
350\r
351# mov ax,0b800h\r
352# mov es,ax\r
353# mov byte ptr es:[160],'a'\r
354# mov ax,cs\r
355# mov es,ax\r
356\r
357 movl $0,%ebx\r
358 leal MemoryMap, %edi\r
359MemMapLoop: \r
360 movl $0xe820,%eax\r
361 movl $20,%ecx\r
362 movl $0x534d4150, %edx # SMAP\r
363 int $0x15\r
364 jc MemMapDone\r
365 addl $20,%edi\r
366 cmpl $0,%ebx\r
367 je MemMapDone\r
368 jmp MemMapLoop\r
369MemMapDone: \r
370 leal MemoryMap, %eax\r
371 subl %eax,%edi # Get the address of the memory map\r
372 movl %edi, MemoryMapSize # Save the size of the memory map\r
373\r
374 xorl %ebx,%ebx\r
375 movw %cs,%bx # BX=segment\r
376 shll $4,%ebx # BX="linear" address of segment base\r
e343d447 377 leal GDT_BASE(%ebx), %eax # EAX=PHYSICAL address of gdt\r
378 movl %eax, (gdtr + 2) # Put address of gdt into the gdtr\r
379 leal IDT_BASE(%ebx), %eax # EAX=PHYSICAL address of idt\r
380 movl %eax, (idtr + 2) # Put address of idt into the idtr\r
f3eb2131 381 leal MemoryMapSize(%ebx), %edx # Physical base address of the memory map\r
382\r
383# mov ax,0b800h\r
384# mov es,ax\r
385# mov byte ptr es:[162],'b'\r
386# mov ax,cs\r
387# mov es,ax\r
388\r
389#\r
390# Enable A20 Gate \r
391#\r
392\r
393 movw $0x2401,%ax # Enable A20 Gate\r
394 int $0x15\r
395 jnc A20GateEnabled # Jump if it suceeded\r
396\r
397#\r
398# If INT 15 Function 2401 is not supported, then attempt to Enable A20 manually.\r
399#\r
400\r
401 call Empty8042InputBuffer # Empty the Input Buffer on the 8042 controller\r
402 jnz Timeout8042 # Jump if the 8042 timed out\r
403 outw %ax, $DELAY_PORT # Delay 1 uS\r
404 movb $WRITE_DATA_PORT_CMD, %al # 8042 cmd to write output port\r
405 outb %al, $KBD_STATUS_PORT # Send command to the 8042\r
406 call Empty8042InputBuffer # Empty the Input Buffer on the 8042 controller\r
407 jnz Timeout8042 # Jump if the 8042 timed out\r
408 movb $ENABLE_A20_CMD, %al # gate address bit 20 on\r
409 outb %al, $KBD_CONTROL_PORT # Send command to thre 8042\r
410 call Empty8042InputBuffer # Empty the Input Buffer on the 8042 controller\r
411 movw $25,%cx # Delay 25 uS for the command to complete on the 8042\r
412Delay25uS: \r
413 outw %ax, $DELAY_PORT # Delay 1 uS\r
414 loop Delay25uS\r
415Timeout8042: \r
416\r
417\r
418A20GateEnabled: \r
419\r
420#\r
421# DISABLE INTERRUPTS - Entering Protected Mode\r
422#\r
423\r
424 cli\r
425\r
426# mov ax,0b800h\r
427# mov es,ax\r
428# mov byte ptr es:[164],'c'\r
429# mov ax,cs\r
430# mov es,ax\r
431\r
432 leal OffsetIn32BitProtectedMode, %eax\r
433 addl $0x20000+0x6,%eax\r
434 movl %eax, OffsetIn32BitProtectedMode \r
435\r
436 leal OffsetInLongMode, %eax\r
437 addl $0x20000+0x6,%eax\r
438 movl %eax, OffsetInLongMode \r
439\r
440 #\r
441 # load GDT\r
442 #\r
443 .byte 0x66\r
444 lgdt gdtr\r
445\r
446 #\r
447 # Enable Protect Mode (set CR0.PE=1)\r
448 #\r
449 movl $cr0, %eax # Read CR0.\r
450 orl $0x1,%eax # Set PE=1\r
451 movl %eax, %cr0 # Write CR0.\r
452 .byte 0x66\r
453 .byte 0xea # jmp far 16:32\r
454OffsetIn32BitProtectedMode: \r
455 .long 0x0000000 # offset $+8 (In32BitProtectedMode)\r
456 .word 0x10 # selector (flat CS)\r
457In32BitProtectedMode: \r
458\r
459#\r
460# Entering Long Mode\r
461#\r
462 .byte 0x66\r
463 movw $8,%ax\r
464 movw %ax,%ds\r
465 movw %ax,%es\r
466 movw %ax,%ss\r
467\r
468 #\r
469 # Enable the 64-bit page-translation-table entries by\r
470 # setting CR4.PAE=1 (this is _required_ before activating\r
471 # long mode). Paging is not enabled until after long mode\r
472 # is enabled.\r
473 #\r
474 .byte 0xf\r
475 .byte 0x20\r
476 .byte 0xe0\r
477# mov eax, cr4\r
478 btsl $5,%eax\r
479 .byte 0xf\r
480 .byte 0x22\r
481 .byte 0xe0\r
482# mov cr4, eax\r
483\r
484 #\r
485 # This is the Trapolean Page Tables that are guarenteed\r
486 # under 4GB.\r
487 #\r
488 # Address Map:\r
489 # 10000 ~ 12000 - efildr (loaded)\r
490 # 20000 ~ 21000 - start64.com\r
491 # 21000 ~ 22000 - efi64.com\r
492 # 22000 ~ 90000 - efildr\r
493 # 90000 ~ 96000 - 4G pagetable (will be reload later)\r
494 #\r
495 .byte 0xb8\r
496 .long 0x90000\r
497# mov eax, 90000h\r
498 movl %eax, %cr3\r
499\r
500 #\r
501 # Enable long mode (set EFER.LME=1).\r
502 #\r
503 .byte 0xb9\r
504 .long 0xc0000080\r
505# mov ecx, 0c0000080h ; EFER MSR number.\r
506 .byte 0xf\r
507 .byte 0x32\r
508# rdmsr ; Read EFER.\r
509 .byte 0xf\r
510 .byte 0xba\r
511 .byte 0xe8\r
512 .byte 0x8\r
513# bts eax, 8 ; Set LME=1.\r
514 .byte 0xf\r
515 .byte 0x30\r
516# wrmsr ; Write EFER.\r
517\r
518 #\r
519 # Enable paging to activate long mode (set CR0.PG=1)\r
520 #\r
521 movl $cr0, %eax # Read CR0.\r
522 .byte 0xf\r
523 .byte 0xba\r
524 .byte 0xe8\r
525 .byte 0x1f\r
526# bts eax, 31 ; Set PG=1.\r
527 movl %eax, %cr0 # Write CR0.\r
528 jmp GoToLongMode\r
529GoToLongMode: \r
530\r
531 .byte 0x67\r
532 .byte 0xea # Far Jump $+9:Selector to reload CS\r
533OffsetInLongMode: \r
534 .long 00000000 # $+9 Offset is ensuing instruction boundary\r
535 .word 0x38 # Selector is our code selector, 38h\r
536\r
537InLongMode: \r
538 .byte 0x66\r
539 movw $0x30,%ax\r
540 movw %ax,%ds\r
541\r
542 .byte 0x66\r
543 movw $0x18,%ax\r
544 movw %ax,%es\r
545 movw %ax,%ss\r
546 movw %ax,%ds\r
547\r
548 .byte 0xbd\r
549 .long 0x400000\r
550# mov ebp,000400000h ; Destination of EFILDR32\r
551 .byte 0xbb\r
552 .long 0x70000\r
553# mov ebx,000070000h ; Length of copy\r
554\r
555 #\r
556 # load idt later\r
557 #\r
558 .byte 0x48\r
559 .byte 0x33\r
560 .byte 0xc0\r
561# xor rax, rax\r
562 .byte 0x66\r
563 movw $idtr, %ax\r
564 .byte 0x48\r
565 .byte 0x5\r
566 .long 0x20000\r
567# add rax, 20000h\r
568\r
569 .byte 0xf\r
570 .byte 0x1\r
571 .byte 0x18\r
572# lidt fword ptr [rax]\r
573\r
574 .byte 0x48\r
575 .byte 0xc7\r
576 .byte 0xc0\r
577 .long 0x21000\r
578# mov rax, 21000h\r
579 .byte 0x50\r
580# push rax\r
581\r
582# ret\r
583 .byte 0xc3\r
584\r
585Empty8042InputBuffer: \r
586 movw $0,%cx\r
587Empty8042Loop: \r
588 outw %ax, $DELAY_PORT # Delay 1us\r
589 inb $KBD_STATUS_PORT, %al # Read the 8042 Status Port\r
590 andb $0x2,%al # Check the Input Buffer Full Flag\r
591 loopnz Empty8042Loop # Loop until the input buffer is empty or a timout of 65536 uS\r
592 ret\r
593\r
594##############################################################################\r
595# data\r
596##############################################################################\r
597\r
9811c392 598 .p2align 1\r
f3eb2131 599\r
600 gdtr: .long GDT_END - GDT_BASE - 1 # GDT limit \r
601 .long 0 # (GDT base gets set above)\r
602##############################################################################\r
603# global descriptor table (GDT)\r
604##############################################################################\r
605\r
9811c392 606 .p2align 1\r
f3eb2131 607\r
608GDT_BASE: \r
609# null descriptor\r
610.equ NULL_SEL, .-GDT_BASE # Selector [0x0]\r
611 .word 0 # limit 15:0\r
612 .word 0 # base 15:0\r
613 .byte 0 # base 23:16\r
614 .byte 0 # type\r
615 .byte 0 # limit 19:16, flags\r
616 .byte 0 # base 31:24\r
617\r
618# linear data segment descriptor\r
619.equ LINEAR_SEL, .-GDT_BASE # Selector [0x8]\r
620 .word 0xFFFF # limit 0xFFFFF\r
621 .word 0 # base 0\r
622 .byte 0\r
623 .byte 0x92 # present, ring 0, data, expand-up, writable\r
624 .byte 0xCF # page-granular, 32-bit\r
625 .byte 0\r
626\r
627# linear code segment descriptor\r
628.equ LINEAR_CODE_SEL, .-GDT_BASE # Selector [0x10]\r
629 .word 0xFFFF # limit 0xFFFFF\r
630 .word 0 # base 0\r
631 .byte 0\r
632 .byte 0x9A # present, ring 0, data, expand-up, writable\r
633 .byte 0xCF # page-granular, 32-bit\r
634 .byte 0\r
635\r
636# system data segment descriptor\r
637.equ SYS_DATA_SEL, .-GDT_BASE # Selector [0x18]\r
638 .word 0xFFFF # limit 0xFFFFF\r
639 .word 0 # base 0\r
640 .byte 0\r
641 .byte 0x92 # present, ring 0, data, expand-up, writable\r
642 .byte 0xCF # page-granular, 32-bit\r
643 .byte 0\r
644\r
645# system code segment descriptor\r
646.equ SYS_CODE_SEL, .-GDT_BASE # Selector [0x20]\r
647 .word 0xFFFF # limit 0xFFFFF\r
648 .word 0 # base 0\r
649 .byte 0\r
650 .byte 0x9A # present, ring 0, data, expand-up, writable\r
651 .byte 0xCF # page-granular, 32-bit\r
652 .byte 0\r
653\r
654# spare segment descriptor\r
655.equ SPARE3_SEL, .-GDT_BASE # Selector [0x28]\r
656 .word 0 # limit 0xFFFFF\r
657 .word 0 # base 0\r
658 .byte 0\r
659 .byte 0 # present, ring 0, data, expand-up, writable\r
660 .byte 0 # page-granular, 32-bit\r
661 .byte 0\r
662\r
663#\r
664# system data segment descriptor\r
665#\r
666.equ SYS_DATA64_SEL, .-GDT_BASE # Selector [0x30]\r
667 .word 0xFFFF # limit 0xFFFFF\r
668 .word 0 # base 0\r
669 .byte 0\r
670 .byte 0x92 # P | DPL [1..2] | 1 | 1 | C | R | A\r
671 .byte 0xCF # G | D | L | AVL | Segment [19..16]\r
672 .byte 0\r
673\r
674#\r
675# system code segment descriptor\r
676#\r
677.equ SYS_CODE64_SEL, .-GDT_BASE # Selector [0x38]\r
678 .word 0xFFFF # limit 0xFFFFF\r
679 .word 0 # base 0\r
680 .byte 0\r
681 .byte 0x9A # P | DPL [1..2] | 1 | 1 | C | R | A\r
682 .byte 0xAF # G | D | L | AVL | Segment [19..16]\r
683 .byte 0\r
684\r
685# spare segment descriptor\r
686.equ SPARE4_SEL, .-GDT_BASE # Selector [0x40]\r
687 .word 0 # limit 0xFFFFF\r
688 .word 0 # base 0\r
689 .byte 0\r
690 .byte 0 # present, ring 0, data, expand-up, writable\r
691 .byte 0 # page-granular, 32-bit\r
692 .byte 0\r
693\r
694GDT_END: \r
695\r
9811c392 696 .p2align 1\r
f3eb2131 697\r
698\r
699\r
700idtr: .long IDT_END - IDT_BASE - 1 # IDT limit\r
701 .quad 0 # (IDT base gets set above)\r
702\r
703##############################################################################\r
704# interrupt descriptor table (IDT)\r
705#\r
706# Note: The hardware IRQ's specified in this table are the normal PC/AT IRQ\r
707# mappings. This implementation only uses the system timer and all other\r
708# IRQs will remain masked. The descriptors for vectors 33+ are provided\r
709# for convenience.\r
710##############################################################################\r
711\r
712#idt_tag db "IDT",0 \r
9811c392 713 .p2align 1\r
f3eb2131 714\r
715\r
716IDT_BASE: \r
717# divide by zero (INT 0)\r
718.equ DIV_ZERO_SEL, .-IDT_BASE\r
719 .word 0 # offset 15:0\r
720 .long SYS_CODE64_SEL # selector 15:0\r
721 .byte 0 # 0 for interrupt gate\r
722 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
723 .word 0 # offset 31:16\r
724 .long 0 # offset 63:32\r
725 .long 0 # 0 for reserved\r
726\r
727# debug exception (INT 1)\r
728.equ DEBUG_EXCEPT_SEL, .-IDT_BASE\r
729 .word 0 # offset 15:0\r
730 .long SYS_CODE64_SEL # selector 15:0\r
731 .byte 0 # 0 for interrupt gate\r
732 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
733 .word 0 # offset 31:16\r
734 .long 0 # offset 63:32\r
735 .long 0 # 0 for reserved\r
736\r
737# NMI (INT 2)\r
738.equ NMI_SEL, .-IDT_BASE\r
739 .word 0 # offset 15:0\r
740 .long SYS_CODE64_SEL # selector 15:0\r
741 .byte 0 # 0 for interrupt gate\r
742 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
743 .word 0 # offset 31:16\r
744 .long 0 # offset 63:32\r
745 .long 0 # 0 for reserved\r
746\r
747# soft breakpoint (INT 3)\r
748.equ BREAKPOINT_SEL, .-IDT_BASE\r
749 .word 0 # offset 15:0\r
750 .long SYS_CODE64_SEL # selector 15:0\r
751 .byte 0 # 0 for interrupt gate\r
752 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
753 .word 0 # offset 31:16\r
754 .long 0 # offset 63:32\r
755 .long 0 # 0 for reserved\r
756\r
757# overflow (INT 4)\r
758.equ OVERFLOW_SEL, .-IDT_BASE\r
759 .word 0 # offset 15:0\r
760 .long SYS_CODE64_SEL # selector 15:0\r
761 .byte 0 # 0 for interrupt gate\r
762 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
763 .word 0 # offset 31:16\r
764 .long 0 # offset 63:32\r
765 .long 0 # 0 for reserved\r
766\r
767# bounds check (INT 5)\r
768.equ BOUNDS_CHECK_SEL, .-IDT_BASE\r
769 .word 0 # offset 15:0\r
770 .long SYS_CODE64_SEL # selector 15:0\r
771 .byte 0 # 0 for interrupt gate\r
772 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
773 .word 0 # offset 31:16\r
774 .long 0 # offset 63:32\r
775 .long 0 # 0 for reserved\r
776\r
777# invalid opcode (INT 6)\r
778.equ INVALID_OPCODE_SEL, .-IDT_BASE\r
779 .word 0 # offset 15:0\r
780 .long SYS_CODE64_SEL # selector 15:0\r
781 .byte 0 # 0 for interrupt gate\r
782 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
783 .word 0 # offset 31:16\r
784 .long 0 # offset 63:32\r
785 .long 0 # 0 for reserved\r
786\r
787# device not available (INT 7)\r
788.equ DEV_NOT_AVAIL_SEL, .-IDT_BASE\r
789 .word 0 # offset 15:0\r
790 .long SYS_CODE64_SEL # selector 15:0\r
791 .byte 0 # 0 for interrupt gate\r
792 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
793 .word 0 # offset 31:16\r
794 .long 0 # offset 63:32\r
795 .long 0 # 0 for reserved\r
796\r
797# double fault (INT 8)\r
798.equ DOUBLE_FAULT_SEL, .-IDT_BASE\r
799 .word 0 # offset 15:0\r
800 .long SYS_CODE64_SEL # selector 15:0\r
801 .byte 0 # 0 for interrupt gate\r
802 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
803 .word 0 # offset 31:16\r
804 .long 0 # offset 63:32\r
805 .long 0 # 0 for reserved\r
806\r
807# Coprocessor segment overrun - reserved (INT 9)\r
808.equ RSVD_INTR_SEL1, .-IDT_BASE\r
809 .word 0 # offset 15:0\r
810 .long SYS_CODE64_SEL # selector 15:0\r
811 .byte 0 # 0 for interrupt gate\r
812 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
813 .word 0 # offset 31:16\r
814 .long 0 # offset 63:32\r
815 .long 0 # 0 for reserved\r
816\r
817# invalid TSS (INT 0ah)\r
818.equ INVALID_TSS_SEL, .-IDT_BASE\r
819 .word 0 # offset 15:0\r
820 .long SYS_CODE64_SEL # selector 15:0\r
821 .byte 0 # 0 for interrupt gate\r
822 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
823 .word 0 # offset 31:16\r
824 .long 0 # offset 63:32\r
825 .long 0 # 0 for reserved\r
826\r
827# segment not present (INT 0bh)\r
828.equ SEG_NOT_PRESENT_SEL, .-IDT_BASE\r
829 .word 0 # offset 15:0\r
830 .long SYS_CODE64_SEL # selector 15:0\r
831 .byte 0 # 0 for interrupt gate\r
832 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
833 .word 0 # offset 31:16\r
834 .long 0 # offset 63:32\r
835 .long 0 # 0 for reserved\r
836\r
837# stack fault (INT 0ch)\r
838.equ STACK_FAULT_SEL, .-IDT_BASE\r
839 .word 0 # offset 15:0\r
840 .long SYS_CODE64_SEL # selector 15:0\r
841 .byte 0 # 0 for interrupt gate\r
842 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
843 .word 0 # offset 31:16\r
844 .long 0 # offset 63:32\r
845 .long 0 # 0 for reserved\r
846\r
847# general protection (INT 0dh)\r
848.equ GP_FAULT_SEL, .-IDT_BASE\r
849 .word 0 # offset 15:0\r
850 .long SYS_CODE64_SEL # selector 15:0\r
851 .byte 0 # 0 for interrupt gate\r
852 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
853 .word 0 # offset 31:16\r
854 .long 0 # offset 63:32\r
855 .long 0 # 0 for reserved\r
856\r
857# page fault (INT 0eh)\r
858.equ PAGE_FAULT_SEL, .-IDT_BASE\r
859 .word 0 # offset 15:0\r
860 .long SYS_CODE64_SEL # selector 15:0\r
861 .byte 0 # 0 for interrupt gate\r
862 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
863 .word 0 # offset 31:16\r
864 .long 0 # offset 63:32\r
865 .long 0 # 0 for reserved\r
866\r
867# Intel reserved - do not use (INT 0fh)\r
868.equ RSVD_INTR_SEL2, .-IDT_BASE\r
869 .word 0 # offset 15:0\r
870 .long SYS_CODE64_SEL # selector 15:0\r
871 .byte 0 # 0 for interrupt gate\r
872 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
873 .word 0 # offset 31:16\r
874 .long 0 # offset 63:32\r
875 .long 0 # 0 for reserved\r
876\r
877# floating point error (INT 10h)\r
878.equ FLT_POINT_ERR_SEL, .-IDT_BASE\r
879 .word 0 # offset 15:0\r
880 .long SYS_CODE64_SEL # selector 15:0\r
881 .byte 0 # 0 for interrupt gate\r
882 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
883 .word 0 # offset 31:16\r
884 .long 0 # offset 63:32\r
885 .long 0 # 0 for reserved\r
886\r
887# alignment check (INT 11h)\r
888.equ ALIGNMENT_CHECK_SEL, .-IDT_BASE\r
889 .word 0 # offset 15:0\r
890 .long SYS_CODE64_SEL # selector 15:0\r
891 .byte 0 # 0 for interrupt gate\r
892 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
893 .word 0 # offset 31:16\r
894 .long 0 # offset 63:32\r
895 .long 0 # 0 for reserved\r
896\r
897# machine check (INT 12h)\r
898.equ MACHINE_CHECK_SEL, .-IDT_BASE\r
899 .word 0 # offset 15:0\r
900 .long SYS_CODE64_SEL # selector 15:0\r
901 .byte 0 # 0 for interrupt gate\r
902 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
903 .word 0 # offset 31:16\r
904 .long 0 # offset 63:32\r
905 .long 0 # 0 for reserved\r
906\r
907# SIMD floating-point exception (INT 13h)\r
908.equ SIMD_EXCEPTION_SEL, .-IDT_BASE\r
909 .word 0 # offset 15:0\r
910 .long SYS_CODE64_SEL # selector 15:0\r
911 .byte 0 # 0 for interrupt gate\r
912 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
913 .word 0 # offset 31:16\r
914 .long 0 # offset 63:32\r
915 .long 0 # 0 for reserved\r
916\r
917# 85 unspecified descriptors, First 12 of them are reserved, the rest are avail\r
918 .fill 85 * 16, 1, 0 # db (85 * 16) dup(0)\r
919\r
920# IRQ 0 (System timer) - (INT 68h)\r
921.equ IRQ0_SEL, .-IDT_BASE\r
922 .word 0 # offset 15:0\r
923 .long SYS_CODE64_SEL # selector 15:0\r
924 .byte 0 # 0 for interrupt gate\r
925 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
926 .word 0 # offset 31:16\r
927 .long 0 # offset 63:32\r
928 .long 0 # 0 for reserved\r
929\r
930# IRQ 1 (8042 Keyboard controller) - (INT 69h)\r
931.equ IRQ1_SEL, .-IDT_BASE\r
932 .word 0 # offset 15:0\r
933 .long SYS_CODE64_SEL # selector 15:0\r
934 .byte 0 # 0 for interrupt gate\r
935 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
936 .word 0 # offset 31:16\r
937 .long 0 # offset 63:32\r
938 .long 0 # 0 for reserved\r
939\r
940# Reserved - IRQ 2 redirect (IRQ 2) - DO NOT USE!!! - (INT 6ah)\r
941.equ IRQ2_SEL, .-IDT_BASE\r
942 .word 0 # offset 15:0\r
943 .long SYS_CODE64_SEL # selector 15:0\r
944 .byte 0 # 0 for interrupt gate\r
945 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
946 .word 0 # offset 31:16\r
947 .long 0 # offset 63:32\r
948 .long 0 # 0 for reserved\r
949\r
950# IRQ 3 (COM 2) - (INT 6bh)\r
951.equ IRQ3_SEL, .-IDT_BASE\r
952 .word 0 # offset 15:0\r
953 .long SYS_CODE64_SEL # selector 15:0\r
954 .byte 0 # 0 for interrupt gate\r
955 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
956 .word 0 # offset 31:16\r
957 .long 0 # offset 63:32\r
958 .long 0 # 0 for reserved\r
959\r
960# IRQ 4 (COM 1) - (INT 6ch)\r
961.equ IRQ4_SEL, .-IDT_BASE\r
962 .word 0 # offset 15:0\r
963 .long SYS_CODE64_SEL # selector 15:0\r
964 .byte 0 # 0 for interrupt gate\r
965 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
966 .word 0 # offset 31:16\r
967 .long 0 # offset 63:32\r
968 .long 0 # 0 for reserved\r
969\r
970# IRQ 5 (LPT 2) - (INT 6dh)\r
971.equ IRQ5_SEL, .-IDT_BASE\r
972 .word 0 # offset 15:0\r
973 .long SYS_CODE64_SEL # selector 15:0\r
974 .byte 0 # 0 for interrupt gate\r
975 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
976 .word 0 # offset 31:16\r
977 .long 0 # offset 63:32\r
978 .long 0 # 0 for reserved\r
979\r
980# IRQ 6 (Floppy controller) - (INT 6eh)\r
981.equ IRQ6_SEL, .-IDT_BASE\r
982 .word 0 # offset 15:0\r
983 .long SYS_CODE64_SEL # selector 15:0\r
984 .byte 0 # 0 for interrupt gate\r
985 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
986 .word 0 # offset 31:16\r
987 .long 0 # offset 63:32\r
988 .long 0 # 0 for reserved\r
989\r
990# IRQ 7 (LPT 1) - (INT 6fh)\r
991.equ IRQ7_SEL, .-IDT_BASE\r
992 .word 0 # offset 15:0\r
993 .long SYS_CODE64_SEL # selector 15:0\r
994 .byte 0 # 0 for interrupt gate\r
995 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
996 .word 0 # offset 31:16\r
997 .long 0 # offset 63:32\r
998 .long 0 # 0 for reserved\r
999\r
1000# IRQ 8 (RTC Alarm) - (INT 70h)\r
1001.equ IRQ8_SEL, .-IDT_BASE\r
1002 .word 0 # offset 15:0\r
1003 .long SYS_CODE64_SEL # selector 15:0\r
1004 .byte 0 # 0 for interrupt gate\r
1005 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
1006 .word 0 # offset 31:16\r
1007 .long 0 # offset 63:32\r
1008 .long 0 # 0 for reserved\r
1009\r
1010# IRQ 9 - (INT 71h)\r
1011.equ IRQ9_SEL, .-IDT_BASE\r
1012 .word 0 # offset 15:0\r
1013 .long SYS_CODE64_SEL # selector 15:0\r
1014 .byte 0 # 0 for interrupt gate\r
1015 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
1016 .word 0 # offset 31:16\r
1017 .long 0 # offset 63:32\r
1018 .long 0 # 0 for reserved\r
1019\r
1020# IRQ 10 - (INT 72h)\r
1021.equ IRQ10_SEL, .-IDT_BASE\r
1022 .word 0 # offset 15:0\r
1023 .long SYS_CODE64_SEL # selector 15:0\r
1024 .byte 0 # 0 for interrupt gate\r
1025 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
1026 .word 0 # offset 31:16\r
1027 .long 0 # offset 63:32\r
1028 .long 0 # 0 for reserved\r
1029\r
1030# IRQ 11 - (INT 73h)\r
1031.equ IRQ11_SEL, .-IDT_BASE\r
1032 .word 0 # offset 15:0\r
1033 .long SYS_CODE64_SEL # selector 15:0\r
1034 .byte 0 # 0 for interrupt gate\r
1035 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
1036 .word 0 # offset 31:16\r
1037 .long 0 # offset 63:32\r
1038 .long 0 # 0 for reserved\r
1039\r
1040# IRQ 12 (PS/2 mouse) - (INT 74h)\r
1041.equ IRQ12_SEL, .-IDT_BASE\r
1042 .word 0 # offset 15:0\r
1043 .long SYS_CODE64_SEL # selector 15:0\r
1044 .byte 0 # 0 for interrupt gate\r
1045 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
1046 .word 0 # offset 31:16\r
1047 .long 0 # offset 63:32\r
1048 .long 0 # 0 for reserved\r
1049\r
1050# IRQ 13 (Floating point error) - (INT 75h)\r
1051.equ IRQ13_SEL, .-IDT_BASE\r
1052 .word 0 # offset 15:0\r
1053 .long SYS_CODE64_SEL # selector 15:0\r
1054 .byte 0 # 0 for interrupt gate\r
1055 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
1056 .word 0 # offset 31:16\r
1057 .long 0 # offset 63:32\r
1058 .long 0 # 0 for reserved\r
1059\r
1060# IRQ 14 (Secondary IDE) - (INT 76h)\r
1061.equ IRQ14_SEL, .-IDT_BASE\r
1062 .word 0 # offset 15:0\r
1063 .long SYS_CODE64_SEL # selector 15:0\r
1064 .byte 0 # 0 for interrupt gate\r
1065 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
1066 .word 0 # offset 31:16\r
1067 .long 0 # offset 63:32\r
1068 .long 0 # 0 for reserved\r
1069\r
1070# IRQ 15 (Primary IDE) - (INT 77h)\r
1071.equ IRQ15_SEL, .-IDT_BASE\r
1072 .word 0 # offset 15:0\r
1073 .long SYS_CODE64_SEL # selector 15:0\r
1074 .byte 0 # 0 for interrupt gate\r
1075 .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r
1076 .word 0 # offset 31:16\r
1077 .long 0 # offset 63:32\r
1078 .long 0 # 0 for reserved\r
1079\r
1080IDT_END: \r
1081\r
9811c392 1082 .p2align 1\r
f3eb2131 1083\r
1084MemoryMapSize: .long 0\r
1085MemoryMap: .long 0,0,0,0,0,0,0,0\r
1086 .long 0,0,0,0,0,0,0,0\r
1087 .long 0,0,0,0,0,0,0,0\r
1088 .long 0,0,0,0,0,0,0,0\r
1089 .long 0,0,0,0,0,0,0,0\r
1090 .long 0,0,0,0,0,0,0,0\r
1091 .long 0,0,0,0,0,0,0,0\r
1092 .long 0,0,0,0,0,0,0,0\r
1093 .long 0,0,0,0,0,0,0,0\r
1094 .long 0,0,0,0,0,0,0,0\r
1095 .long 0,0,0,0,0,0,0,0\r
1096 .long 0,0,0,0,0,0,0,0\r
1097 .long 0,0,0,0,0,0,0,0\r
1098 .long 0,0,0,0,0,0,0,0\r
1099 .long 0,0,0,0,0,0,0,0\r
1100 .long 0,0,0,0,0,0,0,0\r
1101 .long 0,0,0,0,0,0,0,0\r
1102 .long 0,0,0,0,0,0,0,0\r
1103 .long 0,0,0,0,0,0,0,0\r
1104 .long 0,0,0,0,0,0,0,0\r
1105 .long 0,0,0,0,0,0,0,0\r
1106 .long 0,0,0,0,0,0,0,0\r
1107 .long 0,0,0,0,0,0,0,0\r
1108 .long 0,0,0,0,0,0,0,0\r
1109 .long 0,0,0,0,0,0,0,0\r
1110 .long 0,0,0,0,0,0,0,0\r
1111 .long 0,0,0,0,0,0,0,0\r
1112 .long 0,0,0,0,0,0,0,0\r
1113 .long 0,0,0,0,0,0,0,0\r
1114 .long 0,0,0,0,0,0,0,0\r
1115\r
1116 .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\r
1117 .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\r
1118\r
1119 #.org 0x0fe0 #Just for pass build\r
1120MyStack: \r
1121 # below is the pieces of the IVT that is used to redirect INT 68h - 6fh\r
1122 # back to INT 08h - 0fh when in real mode... It is 'org'ed to a\r
1123 # known low address (20f00) so it can be set up by PlMapIrqToVect in\r
1124 # 8259.c\r
1125\r
1126 int $8\r
1127 iret\r
1128\r
1129 int $9\r
1130 iret\r
1131\r
1132 int $10\r
1133 iret\r
1134\r
1135 int $11\r
1136 iret\r
1137\r
1138 int $12\r
1139 iret\r
1140\r
1141 int $13\r
1142 iret\r
1143\r
1144 int $14\r
1145 iret\r
1146\r
1147 int $15\r
1148 iret\r
1149\r
1150\r
1151 #.org 0x0ffe #Just for pass build\r
1152BlockSignature: \r
1153 .word 0xaa55\r
1154\r