delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/15/06:15:50

From: Clemens Valens <c DOT valens AT mindless DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Q: rebooting PC
Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here
X-Originating-Host: 195.154.148.69
X-Wren-Trace: cD8YOC0/YwI5emsdL3F+Z3hsf2hgaClzamBwbW9yfz9hYCpwYCp+f2JqY3RnJmwrcCUyPC1uGxczInEyIHo4JHR8MTs=
Message-ID: <929439363.23288@www.remarq.com>
Lines: 43
Date: Tue, 15 Jun 1999 01:36:02 -0800
NNTP-Posting-Host: 10.0.3.195
X-Trace: WReNphoon3 929439615 10.0.3.195 (Tue, 15 Jun 1999 02:40:15 PDT)
NNTP-Posting-Date: Tue, 15 Jun 1999 02:40:15 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am porting a program from BC 3.1 to DJGPP and am
experiencing some problems. My program runs on an embedded
system, not easily accesible. It is reconfigurable from
another machine and therefore I have to reboot it sometimes
completely. For this I used the function below, which
worked very well. However I don't know how to port it to
DJGPP and I don't even know if it is possible this way. How
can I reboot a PC with a program compiled with DJGPP?

/*
 * Force a jump to fff0:f000, the PC reset vector.
 */
void reboot(void)
{
  asm {
    mov ax,0xf000
    push ax
    mov ax,0xfff0
    push ax
    retf
  }
}

Ported to DJGPP this becomes:

void reboot(void)
{
  asm ("movw $0xf000,%ax; pushw %ax; movw $0xfff0,%ax;
pushw %ax; ret;");
}

I tried this because you never know. Not unexpectedly this
does not work, and it GP faults with something like SIGSEGV
blah blah. I tried to change it to 32-bit but the result
remained the same, a GP fault.

So my question is: how can I do this in DJGPP, if at all?

Clemens



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019