linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* failing while writing to disk with BIOS in realmode setup
@ 2015-07-02  3:56 Dan Mick
  2015-07-03  1:23 ` Dan Mick
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Mick @ 2015-07-02  3:56 UTC (permalink / raw)
  To: linux-kernel

What might I be doing wrong?  Why won't this code succeed to write to
the (otherwise empty) drive 1 from kernel setup's main?  I'm 100%
certain this is the code I'm booting (with grub/bzImage); it's as though
the intcalls just never happen (or fail for some reason I can't get
telemetry on, which is why I'm trying this technique in the first place).

--- /var/tmp/main.c	2015-06-30 14:08:52.435618099 -0700
+++ arch/x86/boot/main.c	2015-07-01 20:33:32.227506260 -0700
@@ -132,6 +131,8 @@
 	}
 }

+char block[512] = "DJM WAS HERE                     ";
+
 void main(void)
 {
 	/* First, copy the boot header into the "zeropage" */
@@ -142,6 +143,22 @@
 	if (cmdline_find_option_bool("debug"))
 		puts("early console in setup code\n");

+	struct biosregs ireg, oreg;
+	initregs(&ireg);
+	ireg.ah = 0;		// reset drive 81
+	ireg.dl = 0x81;
+	intcall(0x13, &ireg, &oreg);
+
+	initregs(&ireg);
+	ireg.ah = 0x03;		// write AL sectors to drive DL CHS CH/DH/CL
+	ireg.al = 1;
+	ireg.dl = 0x81;
+	ireg.cl = 1;
+	ireg.dh = 0;
+	ireg.es = ds();
+	ireg.bx = (uint)(uintptr_t)█
+
+	intcall(0x13, &ireg, &oreg);
 	/* End of heap check */
 	init_heap();



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: failing while writing to disk with BIOS in realmode setup
  2015-07-02  3:56 failing while writing to disk with BIOS in realmode setup Dan Mick
@ 2015-07-03  1:23 ` Dan Mick
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Mick @ 2015-07-03  1:23 UTC (permalink / raw)
  To: linux-kernel

On 07/01/2015 08:56 PM, Dan Mick wrote:
> What might I be doing wrong?  Why won't this code succeed to write to
> the (otherwise empty) drive 1 from kernel setup's main?  

Indeed it was something very dumb, as hpa was kind enough to point out:
grub2 with 'linux' never runs the 16-bit realmode setup code.  at all.

Changing to linux16/initrd16 is making much more sense.  Many thanks to hpa.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-03  1:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02  3:56 failing while writing to disk with BIOS in realmode setup Dan Mick
2015-07-03  1:23 ` Dan Mick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).