Real mode problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Danand
Posts: 17
Joined: Mon Mar 17, 2008 4:56 pm
Contact:

Real mode problem

Post by Danand »

Hi!

I use linux and code my own os. I have writen a simple kernel and need to load it!
I have trying many many many many boot loaders but nobody of them work! I have qemu, bochs dont work here. Must i take boot.bin and kernel.bin in a img fil so then load it whit qemu, or use an other boot loader?
Sorry my english, i'm from norway.. :P

I write my own os now, DanOS. Website coming soon!
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

If you are starting by writing the kernel, then you really should be using GRUB for your bootloader. Do you know why bochs is not working? It should. If bochs + GRUB is not working, then something is probably very wrong with your computer.
Danand
Posts: 17
Joined: Mon Mar 17, 2008 4:56 pm
Contact:

Post by Danand »

Work grub in real mod? Then how? I don't now how to use bochs, i can't find no guide to get bochs to work!
Sorry my english, i'm from norway.. :P

I write my own os now, DanOS. Website coming soon!
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

I don't now how to use bochs, i can't find no guide to get bochs to work!
Then you have not searched thoroughly enough. Hint - check my signature.
Danand
Posts: 17
Joined: Mon Mar 17, 2008 4:56 pm
Contact:

Post by Danand »

Now i just get errors in bochs..
Sorry my english, i'm from norway.. :P

I write my own os now, DanOS. Website coming soon!
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Post by nekros »

check the signature, awesome tutorials.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Danand
Posts: 17
Joined: Mon Mar 17, 2008 4:56 pm
Contact:

Post by Danand »

I have done that! But im trying to remove and installing it agin, mayby its help ;)
Sorry my english, i'm from norway.. :P

I write my own os now, DanOS. Website coming soon!
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

Now i just get errors in bochs..
http://catb.org/~esr/faqs/smart-questions.html
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Danand
Posts: 17
Joined: Mon Mar 17, 2008 4:56 pm
Contact:

Post by Danand »

Ok, here is my bochs log:

Code: Select all

00000000000i[     ] Bochs x86 Emulator 2.3
00000000000i[     ]   Build from CVS snapshot on August 27, 2006
00000000000i[     ] System configuration
00000000000i[     ]   processors: 1 (cores=1, HT threads=1)
00000000000i[     ]   A20 line support: yes
00000000000i[     ]   APIC support: yes
00000000000i[     ] CPU configuration
00000000000i[     ]   level: 6
00000000000i[     ]   paging support: yes, tlb enabled: yes
00000000000i[     ]   SMP support: no
00000000000i[     ]   FPU support: yes
00000000000i[     ]   MMX support: yes
00000000000i[     ]   SSE support: 4
00000000000i[     ]   v8086 mode support: yes
00000000000i[     ]   VME support: yes
00000000000i[     ]   3dnow! support: yes
00000000000i[     ]   PAE support: yes
00000000000i[     ]   PGE support: yes
00000000000i[     ]   PSE support: yes
00000000000i[     ]   x86-64 support: yes
00000000000i[     ]   SEP support: yes
00000000000i[     ] Optimization configuration
00000000000i[     ]   Guest2HostTLB support: yes
00000000000i[     ]   RepeatSpeedups support: yes
00000000000i[     ]   Icache support: yes
00000000000i[     ]   Host Asm support: yes
00000000000i[     ]   Fast function calls: yes
00000000000i[     ] Devices configuration
00000000000i[     ]   NE2000 support: yes
00000000000i[     ]   PCI support: yes
00000000000i[     ]   SB16 support: yes
00000000000i[     ]   USB support: yes
00000000000i[     ]   VGA extension support: vbe 
00000000000i[MEM0 ] allocated memory at 0xb5b4d008. after alignment, vector=0xb5b4e000
00000000000i[MEM0 ] 32,00MB
00000000000i[MEM0 ] rom at 0xf0000/65536 ('/usr/share/bochs/BIOS-bochs-latest')
00000000000p[MEM0 ] >>PANIC<< ROM: couldn't open ROM image file '/usr/share/bochs/VGABIOS-elpin-2.40'.
00000000000i[APIC?] set APIC ID to 0
00000000000i[APIC0] 80686
00000000000i[APIC0] local apic in CPU apicid=00 initializing
00000000000i[VTIME] using 'realtime pit' synchronization method
00000000000i[     ] lt_dlhandle is 0x82ece30
00000000000i[PLGIN] loaded plugin libbx_unmapped.la
00000000000i[     ] lt_dlhandle is 0x82ed9e8
00000000000i[PLGIN] loaded plugin libbx_biosdev.la
00000000000i[     ] lt_dlhandle is 0x82ee318
00000000000i[PLGIN] loaded plugin libbx_cmos.la
00000000000i[     ] lt_dlhandle is 0x82ee8e8
00000000000i[PLGIN] loaded plugin libbx_dma.la
00000000000i[     ] lt_dlhandle is 0x82ee390
00000000000i[PLGIN] loaded plugin libbx_pic.la
00000000000i[     ] lt_dlhandle is 0x82ef048
00000000000i[PLGIN] loaded plugin libbx_vga.la
00000000000i[     ] lt_dlhandle is 0x82ef8a0
00000000000i[PLGIN] loaded plugin libbx_floppy.la
00000000000i[     ] lt_dlhandle is 0x82f00e8
00000000000i[PLGIN] loaded plugin libbx_harddrv.la
00000000000i[     ] lt_dlhandle is 0x8301cb8
00000000000i[PLGIN] loaded plugin libbx_keyboard.la
00000000000i[     ] lt_dlhandle is 0x8301e50
00000000000i[PLGIN] loaded plugin libbx_serial.la
00000000000i[     ] lt_dlhandle is 0x8302310
00000000000i[PLGIN] loaded plugin libbx_parallel.la
00000000000i[     ] lt_dlhandle is 0x83033b0
00000000000i[PLGIN] loaded plugin libbx_extfpuirq.la
00000000000i[     ] lt_dlhandle is 0x8303888
00000000000i[PLGIN] loaded plugin libbx_gameport.la
00000000000i[     ] lt_dlhandle is 0x8303da0
00000000000i[PLGIN] loaded plugin libbx_speaker.la
00000000000i[     ] lt_dlhandle is 0x8304290
00000000000i[PLGIN] loaded plugin libbx_pci.la
00000000000i[     ] lt_dlhandle is 0x8304a20
00000000000i[PLGIN] loaded plugin libbx_pci2isa.la
00000000000i[     ] lt_dlhandle is 0x8305008
00000000000i[PLGIN] loaded plugin libbx_pci_ide.la
00000000000i[IOAP ] initializing I/O APIC
00000000000i[IOAP ] set APIC ID to 1
00000000000i[MEM0 ] Register memory access handlers: fec00000-fec00fff
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Thu Mar 20 00:56:40 2008 (time0=1205971000)
00000000000i[DMA  ] channel 4 used by cascade
00000000000i[DMA  ] channel 2 used by Floppy Drive
Can someone see if something is wrong?
Sorry my english, i'm from norway.. :P

I write my own os now, DanOS. Website coming soon!
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Post by nekros »

Are you getting errors, or are you just checking?
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Danand
Posts: 17
Joined: Mon Mar 17, 2008 4:56 pm
Contact:

Post by Danand »

Im trying to load my kernel! Im just testing with james tutorials. So when i test i get errors, i post the log over here. The bochs dont com up at all, so i need help then!
Sorry my english, i'm from norway.. :P

I write my own os now, DanOS. Website coming soon!
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Post by nekros »

please provide a detailed explanation of what you are doing.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post by neon »

Danand wrote:Im trying to load my kernel! Im just testing with james tutorials. So when i test i get errors, i post the log over here. The bochs dont com up at all, so i need help then!
Hm... Considering that "none" of the bootloaders work, and Bochs does not seem to do anything, perhaps you are not copying (or installing) your bootloader correctly in the first place?

You can check this for certain using Bochs debugger. (Search Google for tutorials)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Danand
Posts: 17
Joined: Mon Mar 17, 2008 4:56 pm
Contact:

Post by Danand »

My kernel is in C, loader.s look like this:

Code: Select all

global _loader           ; making entry point visible to linker
extern _kmain            ; _kmain is defined elsewhere

; setting up the Multiboot header - see GRUB docs for details
MODULEALIGN equ  1<<0                   ; align loaded modules on page boundaries
MEMINFO     equ  1<<1                   ; provide memory map
FLAGS       equ  MODULEALIGN | MEMINFO  ; this is the Multiboot 'flag' field
MAGIC       equ    0x1BADB002           ; 'magic number' lets bootloader find the header
CHECKSUM    equ -(MAGIC + FLAGS)        ; checksum required

section .text
align 4
MultiBootHeader:
   dd MAGIC
   dd FLAGS
   dd CHECKSUM

; reserve initial kernel stack space
STACKSIZE equ 0x4000                  ; that's 16k.

_loader:
   mov esp, stack+STACKSIZE           ; set up the stack
   push eax                           ; pass Multiboot magic number
   push ebx                           ; pass Multiboot info structure

   call  _kmain                       ; call kernel proper
   hlt                                ; halt machine should kernel return

section .bss
align 32
stack:
   resb STACKSIZE                     ; reserve 16k stack on a quadword boundary
"setting up the Multiboot header - see GRUB docs for details" mens that i must use GRUB? I have googled in days after boot loaders, nobody of them have worket, or them workt, but them not load the kernel!
Sorry my english, i'm from norway.. :P

I write my own os now, DanOS. Website coming soon!
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post by neon »

"setting up the Multiboot header - see GRUB docs for details" mens that i must use GRUB? I have googled in days after boot loaders, nobody of them have worket, or them workt, but them not load the kernel!
You do not *need* to use GRUB. Some members (myself included) developed their own bootloaders. If you are unable to get GRUB working, I would probably stay away from this for now... specifically if all you want to develop a kernel.

You still have not described how you are building everything (and copying the bootloader to your disk). Also, include what the problem is. How do you know it does not load the kernel? Is it even getting into _loader? What format is your kernel in (*.exe, *.elf, etc..)? How are you setting up GRUB?

We need details.

(Also, your loader.s is not at all a bootloader. I am suspecting GRUB is not set up correctly.)

Also, what compiler are you using for your C kernel? If you are sticking with 16 bit, I sure hope it can compile 16 bit real mode code and not 32 bit...
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Post Reply