public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Emile Michel Hobo van Oranje <e.m.hobo@hotmail.nl>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Question on installing new bootloader
Date: Thu, 30 Nov 2023 19:04:44 +0000	[thread overview]
Message-ID: <AM6P194MB0263B1B9E0D1FDFEC1101C1BAE82A@AM6P194MB0263.EURP194.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

Dear developers:

I'm trying to install a new bootloader on a computer. My angle was to write it to the zero address of the CMOS as follows, but the result is a SEGMENTATION FAULT. How do I write to the zero address using C?

-- CODE --

#include <stdio.h>

int main (int argc, char* argv[]) {
  unsigned char* mem;
  FILE* load;

  mem = 0;
  load = fopen("bootloader", "r");
  while (!feof(load)) {
    *mem = getc(load);
    mem++;
  }
  fclose(load);
}

-- END OF CODE --

It should just do this, but it doesn't. What stands in my way? C is a low level programming language that's advertised as being suitable for system programming, which would include a bootloader. I did make sure to include the bootloader in the same directory as the executable.

Kind regards,

Emile Michel Hobo van Oranje (recognized by the Supreme Court of the Netherlands)

             reply	other threads:[~2023-11-30 19:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 19:04 Emile Michel Hobo van Oranje [this message]
2023-11-30 19:58 ` David Brown

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=AM6P194MB0263B1B9E0D1FDFEC1101C1BAE82A@AM6P194MB0263.EURP194.PROD.OUTLOOK.COM \
    --to=e.m.hobo@hotmail.nl \
    --cc=gcc-help@gcc.gnu.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).