Hello,

I wrote an email few hours ago, and as no fast response given I decided to
try to implement by myself.

I got it, (or it seems), I am able to write to page > 0 in graphics mode.

I attach you the patch to compile under OpenBSD and also write on page > 0
Also I attach the raw image (that only works on QEMU not BOCHS).
But you can compile it if you want:
https://github.com/hombrelogico/MyOwnOperatingSystem

P.D: master branch is painting pixels very slow. The SeaBIOS of qemu
package in OpenBSD is painting really faster.
diff -Naur -x .config* -x .git -x __pycache__ -x vgalayout.lds.d seabios_current/Makefile seabios/Makefile
--- seabios_current/Makefile	Tue Feb 26 05:36:30 2019
+++ seabios/Makefile	Mon Feb 25 20:04:32 2019
@@ -23,9 +23,9 @@
 OBJDUMP=$(CROSS_PREFIX)objdump
 STRIP=$(CROSS_PREFIX)strip
 PYTHON=python
-CPP=cpp
+CPP=clang-cpp
 IASL:=iasl
-LD32BIT_FLAG:=-melf_i386
+LD32BIT_FLAG:=-melf_i386_obsd -nopie -znorelro
 
 # Source files
 SRCBOTH=misc.c stacks.c output.c string.c block.c cdrom.c disk.c mouse.c kbd.c \
@@ -175,15 +175,15 @@
 
 $(OUT)rom16.o: $(OUT)code16.o $(OUT)romlayout16.lds
 	@echo "  Linking $@"
-	$(Q)$(LD) -T $(OUT)romlayout16.lds $< -o $@
+	$(Q)$(LD) $(LD32BIT_FLAG) -T $(OUT)romlayout16.lds $< -o $@
 
 $(OUT)rom32seg.o: $(OUT)code32seg.o $(OUT)romlayout32seg.lds
 	@echo "  Linking $@"
-	$(Q)$(LD) -T $(OUT)romlayout32seg.lds $< -o $@
+	$(Q)$(LD) $(LD32BIT_FLAG) -T $(OUT)romlayout32seg.lds $< -o $@
 
 $(OUT)rom.o: $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o $(OUT)romlayout32flat.lds
 	@echo "  Linking $@"
-	$(Q)$(LD) -N -T $(OUT)romlayout32flat.lds $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o -o $@
+	$(Q)$(LD) $(LD32BIT_FLAG) -N -T $(OUT)romlayout32flat.lds $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o -o $@
 
 $(OUT)bios.bin.prep: $(OUT)rom.o scripts/checkrom.py
 	@echo "  Prepping $@"
@@ -234,7 +234,7 @@
 	@echo "  Linking $@"
 	$(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autovgaversion.h
 	$(Q)$(CC) $(CFLAGS16) -c vgasrc/vgaversion.c -o $(OUT)vgaversion.o
-	$(Q)$(LD) --gc-sections -T $(OUT)vgasrc/vgalayout.lds $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgaversion.o -o $@
+	$(Q)$(LD) $(LD32BIT_FLAG) --gc-sections -T $(OUT)vgasrc/vgalayout.lds $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgaversion.o -o $@
 
 $(OUT)vgabios.bin.raw: $(OUT)vgarom.o
 	@echo "  Extracting binary $@"
diff -Naur -x .config* -x .git -x __pycache__ -x vgalayout.lds.d seabios_current/vgasrc/vgafb.c seabios/vgasrc/vgafb.c
--- seabios_current/vgasrc/vgafb.c	Tue Feb 26 05:36:30 2019
+++ seabios/vgasrc/vgafb.c	Tue Feb 26 05:40:15 2019
@@ -51,7 +51,8 @@
 {
     if (!CONFIG_VGA_STDVGA_PORTS)
         return;
-    void *dest_far = (void*)(op->y * op->linelength + op->x / 8);
+    void *dest_far = (void*)(op->y * op->linelength + op->x / 8)
+	+ vgahw_get_displaystart (op->vmode_g);
     int plane;
     switch (op->op) {
     default:
@@ -100,11 +101,12 @@
 {
     int bpp = GET_GLOBAL(op->vmode_g->depth);
     void *dest_far = (void*)(op->y / 2 * op->linelength + op->x / 8 * bpp);
+    int address = vgahw_get_displaystart (op->vmode_g);
     switch (op->op) {
     default:
     case GO_READ8:
         if (op->y & 1)
-            dest_far += 0x2000;
+            dest_far += address;
         if (bpp == 1) {
             u8 data = GET_FARVAR(SEG_CTEXT, *(u8*)dest_far);
             int pixel;
@@ -120,7 +122,7 @@
         break;
     case GO_WRITE8:
         if (op->y & 1)
-            dest_far += 0x2000;
+            dest_far += address;
         if (bpp == 1) {
             u8 data = 0;
             int pixel;
@@ -144,15 +146,15 @@
         data |= (data<<2) | (data<<4) | (data<<6);
         memset_stride(SEG_CTEXT, dest_far, data
                       , op->xlen / 8 * bpp, op->linelength, op->ylen / 2);
-        memset_stride(SEG_CTEXT, dest_far + 0x2000, data
+        memset_stride(SEG_CTEXT, dest_far + address, data
                       , op->xlen / 8 * bpp, op->linelength, op->ylen / 2);
         break;
     case GO_MEMMOVE: ;
         void *src_far = (void*)(op->srcy / 2 * op->linelength + op->x / 8 * bpp);
-        memmove_stride(SEG_CTEXT, dest_far, src_far
-                       , op->xlen / 8 * bpp, op->linelength, op->ylen / 2);
-        memmove_stride(SEG_CTEXT, dest_far + 0x2000, src_far + 0x2000
-                       , op->xlen / 8 * bpp, op->linelength, op->ylen / 2);
+        memmove_stride(SEG_CTEXT, dest_far, src_far,
+		op->xlen / 8 * bpp, op->linelength, op->ylen / 2);
+        memmove_stride(SEG_CTEXT, dest_far + address, src_far + address,
+		op->xlen / 8 * bpp, op->linelength, op->ylen / 2);
         break;
     }
 }

Attachment: bootloader.bin
Description: Binary data

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to