- the MBR (16 bit, of course) loads the kernel (which has the first half
of code in 16bit, and the second half in 64-bit code).
- after loading kernel, MBR passes the control to 16-bit kernel code
- 16bit kernel code switches to 64bit long mode and jumps to the 64bit section in kernel
My MBR is 512 bytes (no doubts)
My kernel 16bit code is also 512 bytes, kernel loaded to 7E00h,
so the 64bit section starts at 8000h
The fisrt few lines of the 64bit section in kernel is as follow (NASM):
Code: Select all
[bits 64]
;;
; Long mode entry point
; Memory address is 0:8000h here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;;
longmode: jmp longmode_start
;;
; 64-bit kernel data & subroutines used by this 64bit section of kernel
;;
%include "64bit/macros.asm"
%include "64bit/subs/system.asm"
%include "64bit/subs/text8025.asm"
%include "64bit/subs/keybrd.asm"
%include "64bit/subs/harddsk.asm"
times 4*1024 db 99h ;<--THIS IS WHAT MAKES TROUBLE
;;
; Main 64bit code of kernel, this is where kernel starts actually
;;
longmode_start: cli ;no IDT has been set up
call init_system ;init System Data Area (SDA)
...
just for testing.
The problem is, when I try to increase this amount of data
to 6KB or more, Bochs doesn't run as normal anymore,
it keeps restarting!