vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / debugger / bochs / bochs.cpp
blob2ab0f694bda2ab6653ff6073e86e2d46b0085569
1 /*
2 * Copyright 2008, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * François Revol, revol@free.fr
7 */
10 #include <debug.h>
11 #include <driver_settings.h>
12 #include <ISA.h>
14 static isa_module_info *sISAModule;
17 static int
18 debugger_puts(const char *s, int32 length)
20 int i;
21 for (i = 0; i < length; i++)
22 sISAModule->write_io_8(0xe9, s[i]);
23 return i;
27 static status_t
28 std_ops(int32 op, ...)
30 void *handle;
31 bool load = false;
33 switch (op) {
34 case B_MODULE_INIT:
35 handle = load_driver_settings("kernel");
36 if (handle) {
37 load = get_driver_boolean_parameter(handle,
38 "bochs_debug_output", load, true);
39 unload_driver_settings(handle);
41 if (load) {
42 if (get_module(B_ISA_MODULE_NAME, (module_info **)&sISAModule) < B_OK)
43 return B_ERROR;
45 return load ? B_OK : B_ERROR;
46 case B_MODULE_UNINIT:
47 put_module(B_ISA_MODULE_NAME);
48 return B_OK;
50 return B_BAD_VALUE;
54 static struct debugger_module_info sModuleInfo = {
56 "debugger/bochs/v1",
58 &std_ops
60 NULL,
61 NULL,
62 debugger_puts,
63 NULL
66 module_info *modules[] = {
67 (module_info *)&sModuleInfo,
68 NULL