core.lua (b57465454b35f6e24a6df02a93a27d0136c016d9) core.lua (c1ab36f54de61baa5afb53b4e4d87a0553a035e0)
1--
2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
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
7-- are met:
8-- 1. Redistributions of source code must retain the above copyright

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

213
214 local m = loader.getenv("boot_multicons");
215 if (m ~= nil) then
216 return true;
217 end
218 return false;
219end
220
1--
2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
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
7-- are met:
8-- 1. Redistributions of source code must retain the above copyright

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

213
214 local m = loader.getenv("boot_multicons");
215 if (m ~= nil) then
216 return true;
217 end
218 return false;
219end
220
221function core.isSystem386()
222 return (loader.machine_arch == "i386");
223end
224
221-- This may be a better candidate for a 'utility' module.
222function core.shallowCopyTable(tbl)
223 local new_tbl = {};
224 for k, v in pairs(tbl) do
225 if (type(v) == "table") then
226 new_tbl[k] = core.shallowCopyTable(v);
227 else
228 new_tbl[k] = v;
229 end
230 end
231 return new_tbl;
232end
233
234-- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386, it will
235-- generally be set upon execution of the kernel. Because of this, we can't (or
236-- don't really want to) detect/disable ACPI on !i386 reliably. Just set it
237-- enabled if we detect it and leave well enough alone if we don't.
225-- This may be a better candidate for a 'utility' module.
226function core.shallowCopyTable(tbl)
227 local new_tbl = {};
228 for k, v in pairs(tbl) do
229 if (type(v) == "table") then
230 new_tbl[k] = core.shallowCopyTable(v);
231 else
232 new_tbl[k] = v;
233 end
234 end
235 return new_tbl;
236end
237
238-- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386, it will
239-- generally be set upon execution of the kernel. Because of this, we can't (or
240-- don't really want to) detect/disable ACPI on !i386 reliably. Just set it
241-- enabled if we detect it and leave well enough alone if we don't.
238if (core.getACPIPresent(false)) then
242if (core.isSystem386()) and (core.getACPIPresent(false)) then
239 core.setACPI(true);
240end
241return core;
243 core.setACPI(true);
244end
245return core;