~ubuntu-branches/ubuntu/saucy/seabios/saucy-proposed

« back to all changes in this revision

Viewing changes to src/romlayout.S

  • Committer: Package Import Robot
  • Author(s): Michael Tokarev
  • Date: 2013-07-08 21:34:44 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20130708213444-6ed9q23j39x143lu
Tags: 1.7.3-1
Multi-Arch: allowed

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
        cli
242
242
        cld
243
243
        // Use the ExtraStack in low mem.
244
 
        movl $_datalow_seg, %eax
 
244
        movl $_zonelow_seg, %eax
245
245
        movw %ax, %ds
246
246
        movw %ax, %ss
247
247
        movl $ExtraStack + BUILD_EXTRA_STACK_SIZE, %esp
334
334
        popfl
335
335
        lretl
336
336
 
337
 
// PCI-BIOS 32bit entry point
 
337
// PCI-BIOS entry points
338
338
        DECLFUNC entry_pcibios32
339
339
entry_pcibios32:
340
340
        pushfl
341
341
        pushl %gs               // Backup %gs and set %gs=%ds
342
342
        pushl %ds
343
343
        popl %gs
344
 
        ENTRY_ARG_ESP _cfunc32seg_handle_pcibios32
 
344
        ENTRY_ARG_ESP _cfunc32seg_handle_pcibios
345
345
        popl %gs
346
346
        popfl
347
347
        lretl
348
348
 
 
349
        .code16gcc
 
350
        DECLFUNC entry_pcibios16
 
351
entry_pcibios16:
 
352
        ENTRY_ARG handle_pcibios
 
353
        iretw
 
354
 
349
355
// BIOS32 support
350
 
        EXPORTFUNC entry_bios32
 
356
        .code32
 
357
        DECLFUNC entry_bios32
351
358
entry_bios32:
352
359
        pushfl
353
360
#if CONFIG_PCIBIOS
384
391
 
385
392
        .code16gcc
386
393
 
 
394
// UEFI Compatibility Support Module (CSM) entry point
 
395
        EXPORTFUNC entry_csm
 
396
entry_csm:
 
397
        // Backup register state
 
398
        pushfw
 
399
        cli
 
400
        cld
 
401
        pushl %eax                      // dummy
 
402
        PUSHBREGS
 
403
 
 
404
        // Backup stack location and convert to a "flat pointer"
 
405
        movl %ss, %eax
 
406
        movw %ax, BREGS_code+2(%esp)    // Store %ss in bregs->code.seg
 
407
        shll $4, %eax
 
408
        addl %esp, %eax
 
409
 
 
410
        // Change to BUILD_STACK_ADDR stack
 
411
        xorl %ebx, %ebx
 
412
        movw %bx, %ss
 
413
        movl $BUILD_STACK_ADDR, %esp
 
414
 
 
415
        // Jump to 32bit mode and call handle_csm(bregs)
 
416
        movl $_cfunc32flat_handle_csm, %edx
 
417
        jmp transition32
 
418
 
 
419
        DECLFUNC __csm_return
 
420
        .code32
 
421
__csm_return:
 
422
        movl $1f, %edx
 
423
        jmp transition16big
 
424
        .code16gcc
 
425
 
 
426
        // Switch back to original stack
 
427
1:      movzwl BREGS_code+2(%eax), %edx
 
428
        movl %edx, %ecx
 
429
        shll $4, %ecx
 
430
        subl %ecx, %eax
 
431
        movl %edx, %ss
 
432
        movl %eax, %esp
 
433
 
 
434
        // Restore register state and return.
 
435
        POPBREGS
 
436
        addw $4, %sp                    // pop dummy
 
437
        popfw
 
438
        lretw
 
439
 
387
440
 
388
441
/****************************************************************
389
442
 * Interrupt entry points
396
449
        cld
397
450
        pushw %ds               // Set %ds:%eax to space on ExtraStack
398
451
        pushl %eax
399
 
        movl $_datalow_seg, %eax
 
452
        movl $_zonelow_seg, %eax
400
453
        movl %eax, %ds
401
454
        movl StackPos, %eax
402
455
        subl $24, %eax
427
480
        popw %ds
428
481
        iretw
429
482
 
 
483
        // Main entry point for interrupts handled on extra stack
 
484
        DECLFUNC irqentry_arg_extrastack
 
485
irqentry_arg_extrastack:
 
486
        cli
 
487
        cld
 
488
        pushw %ds               // Set %ds:%eax to space on ExtraStack
 
489
        pushl %eax
 
490
        movl $_zonelow_seg, %eax
 
491
        movl %eax, %ds
 
492
        movl StackPos, %eax
 
493
        subl $BREGS_size+8, %eax
 
494
        popl BREGS_eax(%eax)    // Backup registers
 
495
        popw BREGS_ds(%eax)
 
496
        movl %edi, BREGS_edi(%eax)
 
497
        movl %esi, BREGS_esi(%eax)
 
498
        movl %ebp, BREGS_ebp(%eax)
 
499
        movl %ebx, BREGS_ebx(%eax)
 
500
        movl %edx, BREGS_edx(%eax)
 
501
        movl %ecx, BREGS_ecx(%eax)
 
502
        popl %ecx
 
503
        movw %es, BREGS_es(%eax)
 
504
        movl %esp, BREGS_size+0(%eax)
 
505
        movzwl %sp, %esp
 
506
        movw %ss, BREGS_size+4(%eax)
 
507
        movl (%esp), %edx
 
508
        movl %edx, BREGS_code(%eax)
 
509
        movw 4(%esp), %dx
 
510
        movw %dx, BREGS_flags(%eax)
 
511
 
 
512
        movw %ds, %dx           // Setup %ss/%esp and call function
 
513
        movw %dx, %ss
 
514
        movl %eax, %esp
 
515
        calll *%ecx
 
516
 
 
517
        movl %esp, %eax         // Restore registers and return
 
518
        movw BREGS_size+4(%eax), %ss
 
519
        movl BREGS_size+0(%eax), %esp
 
520
        popl %edx
 
521
        popw %dx
 
522
        pushw BREGS_flags(%eax)
 
523
        pushl BREGS_code(%eax)
 
524
        movl BREGS_edi(%eax), %edi
 
525
        movl BREGS_esi(%eax), %esi
 
526
        movl BREGS_ebp(%eax), %ebp
 
527
        movl BREGS_ebx(%eax), %ebx
 
528
        movl BREGS_edx(%eax), %edx
 
529
        movl BREGS_ecx(%eax), %ecx
 
530
        movw BREGS_es(%eax), %es
 
531
        pushw BREGS_ds(%eax)
 
532
        pushl BREGS_eax(%eax)
 
533
        popl %eax
 
534
        popw %ds
 
535
        iretw
 
536
 
430
537
        // Main entry point for interrupts with args
431
538
        DECLFUNC irqentryarg
432
539
irqentryarg:
451
558
        .global entry_\num
452
559
        entry_\num :
453
560
        pushl $ handle_\num
 
561
#if CONFIG_ENTRY_EXTRASTACK
 
562
        jmp irqentry_arg_extrastack
 
563
#else
454
564
        jmp irqentryarg
 
565
#endif
455
566
        .endm
456
567
 
457
568
        .macro DECL_IRQ_ENTRY_ARG num
554
665
        // 0xfa6e - vgafont8 in font.c
555
666
 
556
667
        ORG 0xfe6e
 
668
        .global entry_1a_official
 
669
entry_1a_official:
 
670
        cmpb $0xb1, %ah
 
671
        je entry_pcibios16      // PCIBIOS calls can be in protected mode
557
672
        IRQ_ENTRY_ARG 1a
558
673
 
559
674
        ORG 0xfea5