libk  Diff

Differences From Artifact [a74c88489c]:

To Artifact [78d762a0b4]:


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
	mov edi, [rsp + 0] ; sizeof arguments
	; first argument to _boot(): argc
	; this is a 32-bit signed(??) integer
	; that is equal to the number of
	; elements in argv (see below). it is
	; not strictly necessary, because argv
	; is per spec always null-terminated,
	; but we pass it just in case.



	lea rsi, [rsp + 8] ; &arguments
	; 2nd argument to _boot(): ptr to argv
	; this points to an array of strings
	; containing the program's command line
	; arguments. _boot() does not need to 
	; parse this, but it does need to store
	; it in the structure passed to main()



	lea rdx, [rsp + 16] ; &environment
	; third argument to _boot(): ptr to envp
	; this points to the list of environment
	; variables for the running program. it
	; is the responsibility of _boot to parse
	; this list and arrange it into a set of
	; legible and useful C arrays.





	mov rax, 0 ; zero out %rax
	; this is required by the C ABI, and is
	; reputedly necessary for compatibility
	; with icc, intel's own proprietary C
	; compiler.








|
>
>








>
>

|





|
>
>
>
>







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
	mov edi, [rsp + 0] ; sizeof arguments
	; first argument to _boot(): argc
	; this is a 32-bit signed(??) integer
	; that is equal to the number of
	; elements in argv (see below). it is
	; not strictly necessary, because argv
	; is per spec always null-terminated,
	; but we pass it just in case. it is
	; also used for finding the environment
	; below.

	lea rsi, [rsp + 8] ; &arguments
	; 2nd argument to _boot(): ptr to argv
	; this points to an array of strings
	; containing the program's command line
	; arguments. _boot() does not need to 
	; parse this, but it does need to store
	; it in the structure passed to main()
	; this exists on the stack, right above
	; argc

	lea rdx, [rsp + rdi * 8 + 16] ; &environment
	; third argument to _boot(): ptr to envp
	; this points to the list of environment
	; variables for the running program. it
	; is the responsibility of _boot to parse
	; this list and arrange it into a set of
	; legible and useful C arrays. it exists
	; above the argument list, the math is
	; stack pointer + argc*pointers(8 bytes)
	; + 16 bytes (argc itself and the
	; terminating null from argv)

	mov rax, 0 ; zero out %rax
	; this is required by the C ABI, and is
	; reputedly necessary for compatibility
	; with icc, intel's own proprietary C
	; compiler.