summary refs log tree commit diff stats
path: root/lib/packages/docutils/rstast.nim
Commit message (Collapse)AuthorAgeFilesLines
* document proper imports, fixes #8164 (#10698)Miran2019-02-191-0/+2
|
* docgen: support markdown link syntax; enable markdown extensionsAraq2019-01-111-0/+3
|
* WIP: disallow 'nil' for strings and seqsAndreas Rumpf2018-08-131-2/+2
|
* remove deprecated stuff from the stdlib; introduce better deprecation warningsAraq2018-05-051-3/+0
|
* lib/packages/docutils - Dropped 'T' from typespdw2015-06-041-13/+16
|
* docutils are gcsafeAraq2015-04-041-41/+42
|
* Replaced deprecated repeatChar() with repeat() or spaces().Hans Raaf2015-03-041-5/+5
|
* updated the compiler to use the new symbol namesAraq2014-08-281-2/+2
|
* Nimrod renamed to NimAraq2014-08-281-1/+1
|
* Modify renderRstToJson to use the json libraryflaviut2014-04-051-18/+17
|
* Add renderRstToJson in docutilsflaviut2014-04-051-0/+25
|
* case consistency: next stepsAraq2013-12-291-12/+12
|
* case consistency part 4Araq2013-12-271-12/+12
|
* case consistency part 1Araq2013-12-271-2/+2
|
* Adds docutils modules to lib index, fixes :idx: markers.Grzegorz Adam Hankiewicz2013-06-091-1/+1
|
* Moved packages to lib directory.Dominik Picheta2013-02-251-0/+288
elper: create new segment' href='/akkartik/mu/commit/subx/053new_segment.subx?h=hlt&id=871d2227c4a07b3be580d80894db40646fc59ca9'>871d2227 ^
cdfb2dbf ^
ee9a9237 ^
6030d7e2 ^
91dab3e1 ^
cdfb2dbf ^

6030d7e2 ^
c98d4b1c ^
dd9ba09a ^
cdfb2dbf ^
f75f333f ^

6030d7e2 ^

cdfb2dbf ^







cf02c20b ^
cdfb2dbf ^
6030d7e2 ^
cdfb2dbf ^

91dab3e1 ^
6030d7e2 ^

871d2227 ^

e5cbbea4 ^
871d2227 ^
f75f333f ^
6030d7e2 ^
9b16f190 ^
cdfb2dbf ^
6030d7e2 ^
9b16f190 ^
6030d7e2 ^
9b16f190 ^
6030d7e2 ^
9b16f190 ^
6030d7e2 ^
9b16f190 ^
6030d7e2 ^
9b16f190 ^
871d2227 ^
ee9a9237 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90











                                                                               

       


                                                                                                                                                 
 
                      




                                                                                                                                                                       
                   
               
                         
              
                               
                      


                                                                                                                                                                        
                                                                               
                                                                                                                                                                    
                        
                                                                                                                                                                       

                                
 
                                                               
              
               
                                                                                                                                                                       

                      
               
                                        
                                                                                                                                                                            
                                                                                                                                                                                          

                                           

                                   







                                                                                                                                                                             
                 
                         
                 

                 
                                                                                                                                                                       

                 

       
 
                                                                                             
                                          
          
           
                      
         
           
                      
                                     
                   
                                             
        
                                                
            
                                               
 
                            
# Create a new segment (pool of memory for allocating chunks from) in the form
# of an *allocation descriptor* that can be passed to the memory allocator
# (defined in a later layer).
#
# Currently an allocation descriptor consists of just the bounds of the pool of
# available memory:
#
#   curr : address
#   end : address
#
# This isn't enough information to reclaim individual allocations. We can't
# support arbitrary reclamation yet.

== code
#   instruction                     effective address                                                   register    displacement    immediate
# . op          subop               mod             rm32          base        index         scale       r32
# . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes

Entry:   # manual test
    # var ad/ECX : (address allocation-descriptor) = {0, 0}
    68/push  0/imm32/limit
    68/push  0/imm32/curr
    89/copy                         3/mod/direct    1/rm32/ECX    .           .             .           4/r32/ESP   .               .                 # copy ESP to ECX
    # new-segment(0x1000, ad)
    # . . push args
    51/push-ECX
    68/push  0x1000/imm32
    # . . call
    e8/call  new-segment/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
    # EAX = ad->curr
    8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy *ECX to EAX
    # write to *EAX to check that we have access to the newly-allocated segment
    c7          0/subop/copy        0/mod/direct    0/rm32/EAX    .           .             .           .           .               0x34/imm32        # copy to *EAX
    # syscall(exit, EAX)
    89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
    b8/copy-to-EAX  1/imm32/exit
    cd/syscall  0x80/imm8

new-segment:  # len : int, ad : (address allocation-descriptor)
    # . prolog
    55/push-EBP
    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
    # . save registers
    50/push-EAX
    53/push-EBX
    # copy len to _mmap-new-segment->len
    8b/copy                         1/mod/*+disp8   5/rm32/EBP    .           .             .           0/r32/EAX   8/disp8         .                 # copy *(EBP+8) to EAX
    89/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   _mmap-new-segment:len/disp32      # copy EAX to *_mmap-new-segment:len
    # mmap(_mmap-new-segment)
    bb/copy-to-EBX  _mmap-new-segment/imm32
    b8/copy-to-EAX  0x5a/imm32/mmap
    cd/syscall  0x80/imm8
    # copy {EAX, EAX+len} to *ad
    # . EBX = ad
    8b/copy                         1/mod/*+disp8   5/rm32/EBP    .           .             .           3/r32/EBX   0xc/disp8       .                 # copy *(EBP+12) to EBX
    # . *EBX = EAX
    89/copy                         0/mod/indirect  3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to *EBX
    # . *(EBX+4) = EAX+len
    03/add                          1/mod/*+disp8   5/rm32/EBP    .           .             .           0/r32/EAX   8/disp8         .                 # add *(EBP+8) to EAX
    89/copy                         1/mod/*+disp8   3/rm32/EBX    .           .             .           0/r32/EAX   4/disp8         .                 # copy EAX to *(EBX+4)
$new-segment:end:
    # . restore registers
    5b/pop-to-EBX
    58/pop-to-EAX
    # . epilog
    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
    5d/pop-to-EBP
    c3/return

== data

# various constants used here were found in the Linux sources (search for file mman-common.h)
_mmap-new-segment:  # type mmap_arg_struct
    # addr
    0/imm32
_mmap-new-segment:len:
    # len
    0/imm32
    # protection flags
    3/imm32  # PROT_READ | PROT_WRITE
    # sharing flags
    0x22/imm32  # MAP_PRIVATE | MAP_ANONYMOUS
    # fd
    -1/imm32  # since MAP_ANONYMOUS is specified
    # offset
    0/imm32  # since MAP_ANONYMOUS is specified

# . . vim:nowrap:textwidth=0