printk.cc (4046:ef34b290091e) printk.cc (4429:74351f86f49a)
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
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;

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

27 *
28 * Authors: Nathan Binkert
29 * Ali Saidi
30 */
31
32#include <sys/types.h>
33#include <algorithm>
34
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
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;

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

27 *
28 * Authors: Nathan Binkert
29 * Ali Saidi
30 */
31
32#include <sys/types.h>
33#include <algorithm>
34
35#include "base/trace.hh"
36#include "arch/arguments.hh"
35#include "arch/arguments.hh"
36#include "base/trace.hh"
37#include "kern/linux/printk.hh"
37
38using namespace std;
39
40
41void
38
39using namespace std;
40
41
42void
42Printk(TheISA::Arguments args)
43Printk(stringstream &out, TheISA::Arguments args)
43{
44{
44 std::ostream &out = Trace::output();
45 char *p = (char *)args++;
46
45 char *p = (char *)args++;
46
47 ios::fmtflags saved_flags = out.flags();
48 char old_fill = out.fill();
49 int old_precision = out.precision();
50
51 while (*p) {
52 switch (*p) {
53 case '%': {
54 bool more = true;
55 bool islong = false;
56 bool leftjustify = false;
57 bool format = false;
58 bool zero = false;

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

253 default: {
254 size_t len = strcspn(p, "%\n\r\0");
255 out.write(p, len);
256 p += len;
257 }
258 }
259 }
260
47 while (*p) {
48 switch (*p) {
49 case '%': {
50 bool more = true;
51 bool islong = false;
52 bool leftjustify = false;
53 bool format = false;
54 bool zero = false;

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

249 default: {
250 size_t len = strcspn(p, "%\n\r\0");
251 out.write(p, len);
252 p += len;
253 }
254 }
255 }
256
261 out.flags(saved_flags);
262 out.fill(old_fill);
263 out.precision(old_precision);
264}
265
257}
258