~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to debian/grub-extras/lua/lstate.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Evan Broder, Mario Limonciello
  • Date: 2010-11-24 13:59:55 UTC
  • mfrom: (1.17.6 upstream) (17.6.15 experimental)
  • Revision ID: james.westby@ubuntu.com-20101124135955-r6ii5sepayr7jt53
Tags: 1.99~20101124-1ubuntu1
[ Colin Watson ]
* Resynchronise with Debian experimental.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed.  If it is, show the
    menu, otherwise boot immediately.  If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt.  Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - Suppress progress messages as the kernel and initrd load for
    non-recovery kernel menu entries.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Don't generate /boot/grub/device.map during grub-install or
    grub-mkconfig by default.
  - Adjust upgrade version checks for Ubuntu.
  - Don't display "GRUB loading" unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts to tolerate
    our backport of the grub-doc split.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack as well, in
    preference.
  - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
  - Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Use qemu rather than qemu-system-i386.
  - Program vesafb on BIOS systems rather than efifb.
  - Add a grub-rescue-efi-amd64 package containing a rescue CD-ROM image
    for EFI-AMD64.
  - On Wubi, don't ask for an install device, but just update wubildr
    using the diverted grub-install.
  - When embedding the core image in a post-MBR gap, check for and avoid
    sectors matching any of a list of known signatures.
  - Disable video_bochs and video_cirrus on PC BIOS systems, as probing
    PCI space seems to break on some systems.
* Downgrade "ACPI shutdown failed" error to a debug message, since it can
  cause spurious test failures.

[ Evan Broder ]
* Enable lua from grub-extras.
* Incorporate the bitop library into lua.
* Add enum_pci function to grub module in lua.
* Switch back to gfxpayload=keep by default, unless the video hardware
  is known to not support it.

[ Mario Limonciello ]
* Built part_msdos and vfat into bootx64.efi (LP: #677758)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $
 
3
** Global State
 
4
** See Copyright Notice in lua.h
 
5
*/
 
6
 
 
7
#ifndef lstate_h
 
8
#define lstate_h
 
9
 
 
10
#include "lua.h"
 
11
 
 
12
#include "lobject.h"
 
13
#include "ltm.h"
 
14
#include "lzio.h"
 
15
 
 
16
 
 
17
 
 
18
struct lua_longjmp;  /* defined in ldo.c */
 
19
 
 
20
 
 
21
/* table of globals */
 
22
#define gt(L)   (&L->l_gt)
 
23
 
 
24
/* registry */
 
25
#define registry(L)     (&G(L)->l_registry)
 
26
 
 
27
 
 
28
/* extra stack space to handle TM calls and some other extras */
 
29
#define EXTRA_STACK   5
 
30
 
 
31
 
 
32
#define BASIC_CI_SIZE           8
 
33
 
 
34
#define BASIC_STACK_SIZE        (2*LUA_MINSTACK)
 
35
 
 
36
 
 
37
 
 
38
typedef struct stringtable {
 
39
  GCObject **hash;
 
40
  lu_int32 nuse;  /* number of elements */
 
41
  int size;
 
42
} stringtable;
 
43
 
 
44
 
 
45
/*
 
46
** informations about a call
 
47
*/
 
48
typedef struct CallInfo {
 
49
  StkId base;  /* base for this function */
 
50
  StkId func;  /* function index in the stack */
 
51
  StkId top;  /* top for this function */
 
52
  const Instruction *savedpc;
 
53
  int nresults;  /* expected number of results from this function */
 
54
  int tailcalls;  /* number of tail calls lost under this entry */
 
55
} CallInfo;
 
56
 
 
57
 
 
58
 
 
59
#define curr_func(L)    (clvalue(L->ci->func))
 
60
#define ci_func(ci)     (clvalue((ci)->func))
 
61
#define f_isLua(ci)     (!ci_func(ci)->c.isC)
 
62
#define isLua(ci)       (ttisfunction((ci)->func) && f_isLua(ci))
 
63
 
 
64
 
 
65
/*
 
66
** `global state', shared by all threads of this state
 
67
*/
 
68
typedef struct global_State {
 
69
  stringtable strt;  /* hash table for strings */
 
70
  lua_Alloc frealloc;  /* function to reallocate memory */
 
71
  void *ud;         /* auxiliary data to `frealloc' */
 
72
  lu_byte currentwhite;
 
73
  lu_byte gcstate;  /* state of garbage collector */
 
74
  int sweepstrgc;  /* position of sweep in `strt' */
 
75
  GCObject *rootgc;  /* list of all collectable objects */
 
76
  GCObject **sweepgc;  /* position of sweep in `rootgc' */
 
77
  GCObject *gray;  /* list of gray objects */
 
78
  GCObject *grayagain;  /* list of objects to be traversed atomically */
 
79
  GCObject *weak;  /* list of weak tables (to be cleared) */
 
80
  GCObject *tmudata;  /* last element of list of userdata to be GC */
 
81
  Mbuffer buff;  /* temporary buffer for string concatentation */
 
82
  lu_mem GCthreshold;
 
83
  lu_mem totalbytes;  /* number of bytes currently allocated */
 
84
  lu_mem estimate;  /* an estimate of number of bytes actually in use */
 
85
  lu_mem gcdept;  /* how much GC is `behind schedule' */
 
86
  int gcpause;  /* size of pause between successive GCs */
 
87
  int gcstepmul;  /* GC `granularity' */
 
88
  lua_CFunction panic;  /* to be called in unprotected errors */
 
89
  TValue l_registry;
 
90
  struct lua_State *mainthread;
 
91
  UpVal uvhead;  /* head of double-linked list of all open upvalues */
 
92
  struct Table *mt[NUM_TAGS];  /* metatables for basic types */
 
93
  TString *tmname[TM_N];  /* array with tag-method names */
 
94
} global_State;
 
95
 
 
96
 
 
97
/*
 
98
** `per thread' state
 
99
*/
 
100
struct lua_State {
 
101
  CommonHeader;
 
102
  lu_byte status;
 
103
  StkId top;  /* first free slot in the stack */
 
104
  StkId base;  /* base of current function */
 
105
  global_State *l_G;
 
106
  CallInfo *ci;  /* call info for current function */
 
107
  const Instruction *savedpc;  /* `savedpc' of current function */
 
108
  StkId stack_last;  /* last free slot in the stack */
 
109
  StkId stack;  /* stack base */
 
110
  CallInfo *end_ci;  /* points after end of ci array*/
 
111
  CallInfo *base_ci;  /* array of CallInfo's */
 
112
  int stacksize;
 
113
  int size_ci;  /* size of array `base_ci' */
 
114
  unsigned short nCcalls;  /* number of nested C calls */
 
115
  unsigned short baseCcalls;  /* nested C calls when resuming coroutine */
 
116
  lu_byte hookmask;
 
117
  lu_byte allowhook;
 
118
  int basehookcount;
 
119
  int hookcount;
 
120
  lua_Hook hook;
 
121
  TValue l_gt;  /* table of globals */
 
122
  TValue env;  /* temporary place for environments */
 
123
  GCObject *openupval;  /* list of open upvalues in this stack */
 
124
  GCObject *gclist;
 
125
  struct lua_longjmp *errorJmp;  /* current error recover point */
 
126
  ptrdiff_t errfunc;  /* current error handling function (stack index) */
 
127
};
 
128
 
 
129
 
 
130
#define G(L)    (L->l_G)
 
131
 
 
132
 
 
133
/*
 
134
** Union of all collectable objects
 
135
*/
 
136
union GCObject {
 
137
  GCheader gch;
 
138
  union TString ts;
 
139
  union Udata u;
 
140
  union Closure cl;
 
141
  struct Table h;
 
142
  struct Proto p;
 
143
  struct UpVal uv;
 
144
  struct lua_State th;  /* thread */
 
145
};
 
146
 
 
147
 
 
148
/* macros to convert a GCObject into a specific value */
 
149
#define rawgco2ts(o)    check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
 
150
#define gco2ts(o)       (&rawgco2ts(o)->tsv)
 
151
#define rawgco2u(o)     check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))
 
152
#define gco2u(o)        (&rawgco2u(o)->uv)
 
153
#define gco2cl(o)       check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))
 
154
#define gco2h(o)        check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
 
155
#define gco2p(o)        check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
 
156
#define gco2uv(o)       check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))
 
157
#define ngcotouv(o) \
 
158
        check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv))
 
159
#define gco2th(o)       check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
 
160
 
 
161
/* macro to convert any Lua object into a GCObject */
 
162
#define obj2gco(v)      (cast(GCObject *, (v)))
 
163
 
 
164
 
 
165
LUAI_FUNC lua_State *luaE_newthread (lua_State *L);
 
166
LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
 
167
 
 
168
#endif
 
169