From: Dan Mick <dmick@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: failing while writing to disk with BIOS in realmode setup
Date: Wed, 01 Jul 2015 20:56:58 -0700 [thread overview]
Message-ID: <5594B68A.3000205@redhat.com> (raw)
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();
next reply other threads:[~2015-07-02 3:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 3:56 Dan Mick [this message]
2015-07-03 1:23 ` failing while writing to disk with BIOS in realmode setup Dan Mick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5594B68A.3000205@redhat.com \
--to=dmick@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.