heres the link.ld file
Code: Select all
ENTRY(start)
SECTIONS
{
.text 0x100000 :
{
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data :
{
data = .; _data = .; __data = .;
*(.data)
*(.rodata)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
Code: Select all
; Diclonius VESA Mode Swicher
[GLOBAL _set_vesa]
[SECTION .vesa]
; set_vesa: C-Prototype: void set_vesa ();
[BITS 32]
_set_vesa:
sgdt [saved_gdt]
sidt [saved_idt]
mov [saved_esp], esp
lgdt [gdtr] ; Load the GDT descriptor
cli
jmp RM_Code_Sel:pmode_16bit
[BITS 16]
pmode_16bit:
mov ax,RM_Data_Sel
mov ss,ax
mov ds,ax
;lidt [ridtr]
mov eax, cr0
and al,0xfe
mov cr0, eax
mov sp,0xFFFE
mov bx,[RealModeCS]
push bx
lea bx,[do_rm]
push bx
retf
do_rm:
mov ax,cs
mov ds,ax
mov ss,ax
nop
mov es,ax
mov fs,ax
mov gs,ax
lidt [ridtr]
sti
mov ax,0x700 ;put struct to 0x7000
mov es,ax
mov di,0x0 ;Put to 0x7000 with offset 0x0
mov eax,'VBE2' ;tell VESA-BIOS that we want VBE 2 rather than VBE 1
mov [es:di],eax
mov ax,0x4F00 ;Function to get VBE Controller Information
int 0x10
cmp al,0x4F ;Is Function supported?
jne continue_cga
cmp ah,0x00 ;successful?
jne continue_cga
mov ax,0x800 ;position for VBE Mode Information struct
mov es,ax
mov ax,0x4F01 ;function call for VBE Mode Information
mov cx,[0x8200] ;getting VBE Mode number
mov di,0x0
int 0x10
cmp al,0x4F
jne continue_cga
cmp ah,0x00
jne continue_cga
;jmp continue_cga
mov ax,0x4F02 ;loading VBE mode-setting-function
mov bx,[0x8200] ;getting VBE Mode number
or bx,0x4000 ;enable linear Buffering
int 0x10 ;go for it
jmp activate_pm
continue_cga:
activate_pm:
cli
lgdt [gdtr]
mov eax,cr0
or al,0x01
mov cr0,eax
jmp PM_Code_Sel:do_pm
do_pm:
mov ax,0x10
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
mov ds,ax
[BITS 32]
mov esp,[saved_esp]
lidt [saved_idt]
lgdt [saved_gdt]
[SECTION .DATA]
ridtr:
dw 0xFFFF ; limit=0xFFFF
dd 0 ; base=0
RealModeCS:
dw 0x0
gdtr:
dw gdt_end-1
dd gdt
gdt:
dw 0,0,0,0 ;null desrciptor
PM_Code_Sel equ $-gdt
dw 0xFFFF
dw 0x0000
dw 0x9A00
dw 0x00CF
PM_Data_Sel equ $-gdt
dw 0xFFFF
dw 0x0000
dw 0x9200
dw 0x00CF
RM_Code_Sel equ $-gdt
dw 0xFFFF
dw 0x0000
dw 0x9A00
dw 0x0000
RM_Data_Sel equ $-gdt
dw 0xFFFF
dw 0x0000
dw 0x9200
dw 0x0000
gdt_end:
saved_gdt:
dw 0
dd 0
saved_idt:
dw 0
dd 0
saved_esp:
dw 0
saved_gdtr:
dw 0
Code: Select all
i386-elf-ld -Tlink.ld -o dicloniu.s32 boot.o vesa.o main.o monitor.o common.o descriptor_tables.o isr.o interrupt.o gdt.o timer.o kheap
.o paging.o ordered_array.o fs.o initrd.o task.o process.o serial.o keyboard.o drawing.o syscall.o console.o
vesa.o: In function `pmode_16bit':
vesa.s:(.vesa+0x37): relocation truncated to fit: R_386_16 against `.DATA'
vesa.s:(.vesa+0x3c): relocation truncated to fit: R_386_16 against `.vesa'
vesa.o: In function `do_rm':
vesa.s:(.vesa+0x50): relocation truncated to fit: R_386_16 against `.DATA'
vesa.o: In function `activate_pm':
vesa.s:(.vesa+0xa1): relocation truncated to fit: R_386_16 against `.DATA'
vesa.s:(.vesa+0xac): relocation truncated to fit: R_386_16 against `.vesa'
vesa.o: In function `gdtr':
vesa.s:(.DATA+0x8): relocation truncated to fit: R_386_16 against `.DATA'
make: *** [link] Error 1