hex_file.cc (8229:78bf55f23338) hex_file.cc (8706:b1838faf3bcc)
1/*
2 * Copyright (c) 2007 MIPS Technologies, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 22 unchanged lines hidden (view full) ---

31#include <cctype>
32#include <cstdio>
33#include <list>
34#include <string>
35
36#include "base/loader/hex_file.hh"
37#include "base/loader/symtab.hh"
38#include "base/cprintf.hh"
1/*
2 * Copyright (c) 2007 MIPS Technologies, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 22 unchanged lines hidden (view full) ---

31#include <cctype>
32#include <cstdio>
33#include <list>
34#include <string>
35
36#include "base/loader/hex_file.hh"
37#include "base/loader/symtab.hh"
38#include "base/cprintf.hh"
39#include "mem/translating_port.hh"
39#include "mem/port_proxy.hh"
40
41using namespace std;
42/*
43 * Load a Hex File into memory. Currently only used with MIPS
44 * BARE_IRON mode. A hex file consists of [Address Data] tuples that
45 * get directly loaded into physical memory. The address specified is
46 * a word address (i.e., to get the byte address, shift left by 2) The
47 * data is a full 32-bit hex value.

--- 6 unchanged lines hidden (view full) ---

54 panic("Unable to open %s\n", filename.c_str());
55}
56
57HexFile::~HexFile()
58{
59}
60
61bool
40
41using namespace std;
42/*
43 * Load a Hex File into memory. Currently only used with MIPS
44 * BARE_IRON mode. A hex file consists of [Address Data] tuples that
45 * get directly loaded into physical memory. The address specified is
46 * a word address (i.e., to get the byte address, shift left by 2) The
47 * data is a full 32-bit hex value.

--- 6 unchanged lines hidden (view full) ---

54 panic("Unable to open %s\n", filename.c_str());
55}
56
57HexFile::~HexFile()
58{
59}
60
61bool
62HexFile::loadSections(Port *memPort)
62HexFile::loadSections(PortProxy* memProxy)
63{
64 char Line[64];
65 Addr MemAddr;
66 uint32_t Data;
67 while (!feof(fp)) {
68 char *ret = fgets(Line, sizeof(Line), fp);
69 if (!ret)
70 panic("malformed file");
71 parseLine(Line, &MemAddr, &Data);
72 if (MemAddr != 0) {
73 // Now, write to memory
63{
64 char Line[64];
65 Addr MemAddr;
66 uint32_t Data;
67 while (!feof(fp)) {
68 char *ret = fgets(Line, sizeof(Line), fp);
69 if (!ret)
70 panic("malformed file");
71 parseLine(Line, &MemAddr, &Data);
72 if (MemAddr != 0) {
73 // Now, write to memory
74 memPort->writeBlob(MemAddr << 2, (uint8_t *)&Data, sizeof(Data));
74 memProxy->writeBlob(MemAddr << 2, (uint8_t *)&Data, sizeof(Data));
75 }
76 }
77 return true;
78}
79
80void
81HexFile::parseLine(char *Str, Addr *A, uint32_t *D)
82{

--- 56 unchanged lines hidden ---
75 }
76 }
77 return true;
78}
79
80void
81HexFile::parseLine(char *Str, Addr *A, uint32_t *D)
82{

--- 56 unchanged lines hidden ---