~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/openhackware/src/libexec/prep.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * <prep.c>
 
3
 *
 
4
 * Open Hack'Ware BIOS PREP executable file loader
 
5
 * 
 
6
 * Copyright (c) 2004-2005 Jocelyn Mayer
 
7
 * 
 
8
 *   This program is free software; you can redistribute it and/or
 
9
 *   modify it under the terms of the GNU General Public License V2
 
10
 *   as published by the Free Software Foundation
 
11
 *
 
12
 *   This program is distributed in the hope that it will be useful,
 
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 *   GNU General Public License for more details.
 
16
 *
 
17
 *   You should have received a copy of the GNU General Public License
 
18
 *   along with this program; if not, write to the Free Software
 
19
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
20
 */
 
21
 
 
22
#include <stdlib.h>
 
23
#include <stdio.h>
 
24
#include "bios.h"
 
25
#include "exec.h"
 
26
 
 
27
/* PREP boot loader */
 
28
int exec_load_prep (inode_t *file, unused void **dest,
 
29
                    unused void **entry, unused void **end,
 
30
                    unused uint32_t loffset)
 
31
{
 
32
    unsigned char buffer[512];
 
33
 
 
34
    file_seek(file, loffset);
 
35
    if (fs_read(file, buffer, 512) < 0) {
 
36
        ERROR("Cannot load first bloc of file...\n");
 
37
        return -2;
 
38
    }
 
39
    if (buffer[0x1FE] != 0x55 || buffer[0x1FF] != 0xAA) {
 
40
        DPRINTF("Not a PREP file\n");
 
41
        return -2;
 
42
    }
 
43
 
 
44
    return -2;
 
45
}