[C] Struktur deklarieren

Hm. WinRar: "Das Archiv ist zerstört". Hat leider nicht geklappt.
EDIT: Hat geklappt. Sorry, mein Fehler.
 
Zuletzt bearbeitet:
Mit 7zip funktioniert es einwandfrei. Winrar würde ich schon aufgrund der nervigen Meldungen nicht verwenden ;-) 7-zip hat eine viel bessere Kompression bei größerer Geschwindigkeit.
 
Hi, tut mir Leid, dass ich mich erst jetzt wieder melde, abe ich hatte die letzen Tage keine Zeit. Leider helfen mir auch deine Datein nicht wirklich, weil ich kein make kann. Ich glaube es ist sinnvoller, bei mir nach dem Fehler zu suchen. Da die Datei richtig sein muss, muss es an falschen builden liegen, wobei ja offentsichtlich Bochs einen Fehler macht. Also, auf ein neues:
kernel.asm
Code:
align 4
 
FLAGS    equ 0
MAGIC    equ 0x1BADB002       ; Magicnumber - Erkennungsmerkmal für GRUB
CHECKSUM equ -(MAGIC + FLAGS) ; Checksum
 
 
[BITS 32]
 
[EXTERN code]                   ; Start of the '.text' section.
[EXTERN bss]                    ; Start of the .bss section.
[EXTERN end]                    ; End of the last loadable section.
 
MultiBootHeader:
    dd MAGIC       ; Magic number
    dd FLAGS       ; Flags
    dd CHECKSUM    ; Checksum
    dd MultiBootHeader  ; Wo sich der Multiboot-Descriptor (also das hier gerade) befindet
    dd code ; Wo der Code (also die .text-Sektion) anfängt
    dd bss ; Wo die Daten (also die .data-Sektion) anfängt
    dd end ; Ende des Kernels
    dd start ; Kernel-Einstiegspunkt (Initialer EIP)
 
[GLOBAL] start ; Kernel-Einstiegspunkt
; [EXTERN main] ; Einstiegspunkt im C-Code
 
start:
    push ebx ; Multiboot-Header auf den Stack legen
    cli ; Interrupts anhalten
    ; call main ; Einstiegspunkt im C-Code anspringen und ausführen
 
 
    jmp $ ; endless loop
build.bat
Code:
cd..
building\NASM\NASM.exe -f elf32 -o kernel\kernel.ao kernel\kernel.asm
REM building\NASM\NASM.exe -f elf32 -o kernel\port.ao kernel\port.asm
REM building\NASM\NASM.exe -f elf32 -o kernel\gdt.ao kernel\gdt.asm
REM building\NASM\NASM.exe -f elf32 -o kernel\idt.ao kernel\idt.asm
REM building\NASM\NASM.exe -f elf32 -o kernel\irq.ao kernel\irq.asm
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\main.o kernel\main.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\system.o kernel\system.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\print.o kernel\print.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\GDT.o kernel\GDT.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\IDT.o kernel\IDT.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\ISR.o kernel\ISR.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\IRQ.o kernel\IRQ.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\timer.o kernel\timer.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\keyboard.o kernel\keyboard.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\sound.o kernel\sound.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\strcmp.o kernel\strcmp.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\variables_convert.o kernel\variables_convert.c
REM "building\GCC & LD\bin\i586-elf-gcc.exe" -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -std=gnu99 -o kernel\math.o kernel\math.c
"building\GCC & LD\bin\i586-elf-ld.exe" -melf_i386 -T "building\GCC & LD\bin\link.ld" -o kernel\kernel.elf kernel\kernel.ao
move kernel\kernel.elf building\grub\floppy\
"building\GCC & LD\bin\i586-elf-ld.exe" -melf_i386 -T "building\GCC & LD\bin\link.ld" -o kernel\kernel.elf kernel\kernel.ao
cd building\grub\
bfi.exe -t=144 -f=floppy.img floppy
"DOSBox - bootlace64.lnk"
cd..
mkisofs\mkisofs.exe -b grub\floppy.img -o grub\OS.iso grub\floppy.img
cd..
move building\grub\OS.iso kernel\
cd building
mkisofs\mkisofs.exe -b grub\floppy.img -o grub\OS.iso grub\floppy.img
PAUSE
link.ld
Code:
OUTPUT_FORMAT("elf32-i386")
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 = .;
}
bootlace.conf (wird von der bootlace.lnk aufgerufen)
Code:
[autoexec]
MOUNT c blablabla
c:
bootlace64.com --fat12 --floppy floppy.img
exit
Das alles wird mit GRUB4DOS gemacht (vielleicht mag Bochs 2.5.1 das ja nicht).
Ich hoffe irgendjemand findet einen Fehler. Ansonsten kann ich Bochs wohl vergessen. :D
 
Zuletzt bearbeitet:
Hi, ich bin's wieder. :)
Bochs hat ein Problem mit folgendem Code:
Code:
mov cr0, eax
Egal, ob 16- oder 32-bit.
Kann Bochs bei euch diesen Code ausführen:
Code:
start:
	[BITS 16]
	mov eax, cr0
	or al, 1
	mov cr0, eax
	jmp $
Binär assembliert und zu folgendem Bootloader kopiert:
Code:
[ORG 0x7C00]
start: 
	cli
	mov ax, 0x9000
	mov ss, ax
	mov sp, 0
	sti
	mov [bootdrive], dl
	call load
	mov ax, 0x1000
	mov es, ax
	mov ds, ax
	push ax
	mov ax, 0
	push ax
	retf

load:
	push ds
	mov ax, 0
	mov dl, [bootdrive]
	int 0x13
	pop ds
	jc load
 
load1:
	mov ax, 0x1000
	mov es, ax
	mov bx, 0
	mov ah, 2
	mov al, 18
	mov cx, 2
	mov dx, 0
	int 0x13
	jc load1
	retn

bootdrive db 0

times 512-($-$$)-2 db 0
dw 0xAA55
Am Code kann es hier doch kaum liegen, oder?
Hier noch die bochssrc Datei:
Code:
# configuration file generated by Bochs
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, gameport=1
config_interface: win32config
display_library: win32
memory: host=32, guest=32
romimage: file="BIOS-bochs-latest"
vgaromimage: file="VGABIOS-lgpl-latest"
boot: floppy
floppy_bootsig_check: disabled=0
floppya: type=1_44, 1_44="OS.img", status=inserted, write_protected=0
# no floppyb
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata2: enabled=0
ata3: enabled=0
parport1: enabled=1, file=""
parport2: enabled=0
com1: enabled=1, mode=file, dev="serial.txt"
com2: enabled=0
com3: enabled=0
com4: enabled=0
usb_uhci: enabled=0
usb_ohci: enabled=0
usb_xhci: enabled=0
pci: enabled=1, chipset=i440fx
vga: extension=vbe, update_freq=5
cpu: count=1, ips=4000000, model=bx_generic, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1
cpuid: family=6, model=0x03, stepping=3, mmx=1, apic=xapic, sse=sse2, sse4a=0, sep=1, aes=0, xsave=0, xsaveopt=0, movbe=0, smep=0, x86_64=1, 1g_pages=0, pcid=0, fsgsbase=0, mwait=1, mwait_is_nop=0
cpuid: vendor_string="GenuineIntel"
cpuid: brand_string="              Intel(R) Pentium(R) 4 CPU        "

print_timestamps: enabled=0
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=realtime, time0=local
# no cmosimage
ne2k: enabled=0
pnic: enabled=0
sb16: enabled=0
es1370: enabled=0
# no loader
log: log
logprefix: %t-%e-@%i-%d
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
keyboard_type: mf
keyboard_serial_delay: 250
keyboard_paste_delay: 100000
keyboard_mapping: enabled=0, map=
user_shortcut: keys=none
mouse: enabled=0, type=ps2, toggle=ctrl+mbutton
Ich werde jetzt zur Sicherheit, Bochs nochmal neu installieren. Ich freue mich weiterhin über jede Anregung!
 
Meine Güte! Es lag wirklich an Bochs. Ich hätte Bochs sofort neu installieren sollen. Es gibt dennoch ein kleines Problem, aber ich denke, dass bekomme ich selbst hin, ansonsten melde ich mich nochmal.
 

Neue Beiträge

Zurück