Subversion Repositories HelenOS

Rev

Rev 2071 | Rev 2222 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2071 Rev 2219
Line 70... Line 70...
70
	multiboot_meeting_point:
70
	multiboot_meeting_point:
71
	
71
	
72
	movl %eax, grub_eax							# save parameters from GRUB
72
	movl %eax, grub_eax							# save parameters from GRUB
73
	movl %ebx, grub_ebx
73
	movl %ebx, grub_ebx
74
	
74
	
-
 
75
	# Protected 32-bit. We want to reuse the code-seg descriptor,
-
 
76
	# the Default operand size must not be 1 when entering long mode
-
 
77
	
-
 
78
	movl $0x80000000, %eax  
-
 
79
 	cpuid
-
 
80
 	cmp $0x80000000, %eax						# any function > 80000000h?
-
 
81
	jbe long_mode_unsupported
-
 
82
	movl $(AMD_CPUID_EXTENDED), %eax			# Extended function code 80000001
-
 
83
	cpuid
-
 
84
	bt $29, %edx								# Test if long mode is supported.
-
 
85
 	jc long_mode_supported
-
 
86
 
-
 
87
	long_mode_unsupported:
-
 
88
		movl $long_mode_msg, %esi
-
 
89
		jmp error_halt
-
 
90
	
-
 
91
	long_mode_supported:
-
 
92
	
75
#ifdef CONFIG_FB
93
#ifdef CONFIG_FB
76
	mov $vesa_init, %esi;
94
	mov $vesa_init, %esi
77
	mov $VESA_INIT_SEGMENT << 4, %edi
95
	mov $VESA_INIT_SEGMENT << 4, %edi
78
	mov $e_vesa_init - vesa_init, %ecx
96
	mov $e_vesa_init - vesa_init, %ecx
79
	cld
97
	cld
80
	rep movsb
98
	rep movsb
81
 
99
 
Line 90... Line 108...
90
	mov %di, KA2PA(vesa_width)
108
	mov %di, KA2PA(vesa_width)
91
	mov %bx, KA2PA(vesa_scanline)
109
	mov %bx, KA2PA(vesa_scanline)
92
	shr $16, %ebx
110
	shr $16, %ebx
93
	mov %bx, KA2PA(vesa_bpp)
111
	mov %bx, KA2PA(vesa_bpp)
94
#endif	
112
#endif	
95
 
-
 
96
	# Protected 32-bit. We want to reuse the code-seg descriptor,
-
 
97
	# the Default operand size must not be 1 when entering long mode
-
 
98
	
-
 
99
	movl $0x80000000, %eax  
-
 
100
 	cpuid
-
 
101
 	cmp $0x80000000, %eax						# any function > 80000000h?
-
 
102
	jbe long_mode_unsupported
-
 
103
	movl $(AMD_CPUID_EXTENDED), %eax			# Extended function code 80000001
-
 
104
	cpuid
-
 
105
	bt $29, %edx								# Test if long mode is supported.
-
 
106
 	jc long_mode_supported
-
 
107
 
-
 
108
	long_mode_unsupported:
-
 
109
		cli
-
 
110
		hlt
-
 
111
	
-
 
112
	long_mode_supported:
-
 
113
	
113
	
114
	# Enable 64-bit page transaltion entries - CR4.PAE = 1.
114
	# Enable 64-bit page transaltion entries - CR4.PAE = 1.
115
	# Paging is not enabled until after long mode is enabled
115
	# Paging is not enabled until after long mode is enabled
116
	
116
	
117
	movl %cr4, %eax
117
	movl %cr4, %eax
Line 443... Line 443...
443
	
443
	
444
	jmpl $gdtselector(KTEXT32_DES), $vesa_meeting_point
444
	jmpl $gdtselector(KTEXT32_DES), $vesa_meeting_point
445
	
445
	
446
.align 4
446
.align 4
447
e_vesa_init:
447
e_vesa_init:
448
#endif	
448
#endif
-
 
449
 
-
 
450
# Print string from %esi to EGA display (in red) and halt
-
 
451
error_halt:
-
 
452
	movl $0xb8000, %edi						# base of EGA text mode memory
-
 
453
	xorl %eax, %eax
-
 
454
	
-
 
455
	movw $0x3d4, %dx						# read bits 8 - 15 of the cursor address
-
 
456
	movb $0xe, %al
-
 
457
	outb %al, %dx
-
 
458
	
-
 
459
	movw $0x3d5, %dx
-
 
460
	inb %dx, %al
-
 
461
	shl $8, %ax
-
 
462
	
-
 
463
	movw $0x3d4, %dx						# read bits 0 - 7 of the cursor address
-
 
464
	movb $0xf, %al
-
 
465
	outb %al, %dx
-
 
466
	
-
 
467
	movw $0x3d5, %dx
-
 
468
	inb %dx, %al
-
 
469
	
-
 
470
	cmp $1920, %ax
-
 
471
	jbe cursor_ok
-
 
472
		movw $1920, %ax						# sanity check for the cursor on the last line
-
 
473
	cursor_ok:
-
 
474
	
-
 
475
	movw %ax, %bx
-
 
476
	shl $1, %eax
-
 
477
	addl %eax, %edi
-
 
478
	
-
 
479
	movw $0x0c00, %ax						# black background, light red foreground
-
 
480
	cld
-
 
481
	
-
 
482
	ploop:
-
 
483
		lodsb
-
 
484
		cmp $0, %al
-
 
485
		je ploop_end
-
 
486
		stosw
-
 
487
		inc %bx	
-
 
488
		jmp ploop
-
 
489
	ploop_end:
-
 
490
	
-
 
491
	movw $0x3d4, %dx						# write bits 8 - 15 of the cursor address
-
 
492
	movb $0xe, %al
-
 
493
	outb %al, %dx
-
 
494
	
-
 
495
	movw $0x3d5, %dx
-
 
496
	movb %bh, %al
-
 
497
	outb %al, %dx
-
 
498
	
-
 
499
	movw $0x3d4, %dx						# write bits 0 - 7 of the cursor address
-
 
500
	movb $0xf, %al
-
 
501
	outb %al, %dx
-
 
502
	
-
 
503
	movw $0x3d5, %dx
-
 
504
	movb %bl, %al
-
 
505
	outb %al, %dx
-
 
506
		
-
 
507
	cli
-
 
508
	hlt
449
				
509
				
450
.section K_DATA_START, "aw", @progbits
510
.section K_DATA_START, "aw", @progbits
451
.align 4096
511
.align 4096
452
 
512
 
453
# Identical mapping of first 64MB and the same of -2GB -> 0	
513
# Identical mapping of first 64MB and the same of -2GB -> 0	
Line 511... Line 571...
511
grub_eax:
571
grub_eax:
512
	.long 0
572
	.long 0
513
 
573
 
514
grub_ebx:
574
grub_ebx:
515
	.long 0
575
	.long 0
-
 
576
 
-
 
577
long_mode_msg:
-
 
578
	.ascii "64 bit long mode not supported. System halted.\0"