Code: Select all
start.o:start.o:(.text+0x14): relocation truncated to fit: 16 against `.text'
start.o:start.o:(.text+0x17): relocation truncated to fit: 16 against `.text'
start.o:start.o:(.text+0x1e): relocation truncated to fit: 16 against `.text'
start.o:start.o:(.text+0x21): relocation truncated to fit: 16 against `.text'
start.o:start.o:(.text+0x25): relocation truncated to fit: 16 against `.text'
start.o:start.o:(.text+0x29): relocation truncated to fit: 16 against `.text'
start.o:start.o:(.text+0x35): relocation truncated to fit: 16 against `.text'
start.o:start.o:(.text+0x43): relocation truncated to fit: 16 against `.text'
start.o:start.o:(.text+0x4e): relocation truncated to fit: 16 against `.text'
Code: Select all
;;;
;; <header id="source/system/start.asm">
;; <description>Enters 32-bit protected mode, then the C
;; kernel.</description>
;; <copyright>Copyright (C) 2007, Griffinsoft Corporation</copyright>
;; <website>http://www.griffinsoft.net/</website>
;; <notes>
;; <!--None-->
;; </notes>
;; </header>
;;;
[BITS 16]
[GLOBAL start]
;; Jump directly to Start
jmp Start
;;;
;; <function id="Start">
;; <description>Enters protected mode and sets up the GDT.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
Start:
xor ebx, ebx
mov bx, cs
shl ebx, 4
mov eax, ebx
lea eax, [ebx]
mov [GDT2 + 2], ax
mov [GDT3 + 2], ax
shr eax, 16
mov [GDT2 + 4], al
mov [GDT3 + 4], al
mov [GDT2 + 7], ah
mov [GDT3 + 7], ah
lea eax, [ebx + GDT]
mov [GDTPointer + 2], eax
push dword 0
popfd
o32 lgdt [GDTPointer]
mov eax, cr0
or al, 1
mov cr0, eax
jmp codeSelector:ProtectedMode
[BITS 32]
;;;
;; <function id="ProtectedMode">
;; <description>Goes to the C kernel.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
ProtectedMode:
mov ax, dataSelector
mov ds, eax
mov ss, eax
nop
mov es, eax
mov fs, eax
mov gs, eax
xor eax, eax
mov ax, sp
mov esp, eax
[EXTERN _Kernel]
call _Kernel
jmp $
;;;
;; <function id="GDT">
;; <description>Part of the GDT.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
GDT:
dw 0
dw 0
db 0
db 0
db 0
db 0
;;;
;; <function id="linearSelector">
;; <description>Linear segment selector.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
linearSelector equ $-GDT
dw 0xFFFF
dw 0
db 0
db 0x92
db 0xCF
db 0
;;;
;; <function id="codeSelector">
;; <description>Code segment selector.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
codeSelector equ $-GDT
;;;
;; <function id="GDT2">
;; <description>Part of the GDT.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
GDT2:
dw 0xFFFF
dw 0
db 0
db 0x9A
db 0xCF
db 0
;;;
;; <function id="dataSelector">
;; <description>Data segment selector.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
dataSelector equ $-GDT
;;;
;; <function id="GDT3">
;; <description>Part of the GDT.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
GDT3:
dw 0xFFFF
dw 0
db 0
db 0x92
db 0xCF
db 0
;;;
;; <function id="GDTEnd">
;; <description>Part of the GDT.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
GDTEnd:
;;;
;; <function id="GDTPointer">
;; <description>Part of the GDT.</description>
;; <parameters>
;; <!--None-->
;; </parameters>
;; </function>
;;;
GDTPointer:
dw GDTEnd - GDT - 1
dd GDT